forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kvserver: check GC threshold after acquiring a storage snapshot
Previously, we would check if a given read could proceed with execution _before_ we acquired a snapshot of the storage engine state. In particular, we would check the replica's in-memory GC threshold before the state of the engine had been pinned. This meant that the following scenario was possible: 1. Request comes in, checks the replica's in-memory GC threshold and determines that it is safe to proceed. 2. A pair of GC requests bump the GC threshold and garbage-collect the expired data. 3. The read acquires a snapshot of the storage engine state. 4. The read continues with its execution and sees an incorrect result. This commit makes it such that we now check the GC threshold after we acquire a snapshot of the storage engine state. It does so by lifting the GC threshold check out of `checkExecutionCanProceed()` and splitting up the single critical section under `Replica.mu` into two. NB: Note that this commit only fixes our current model of issuing `GCRequest`s -- which is that we first issue a GCRequest that simply bumps the GC threshold and then issue another GCRequest that actually performs the garbage collection. If a single GCRequest were to do both of these things, we'd still have an issue with reads potentially seeing incorrect results since, currently, the in-memory GC threshold is bumped as a "post-apply" side effect that takes effect after the expired data has already been garbage collected. This will be handled in a future patch. Release note: none
- Loading branch information
1 parent
5541cf8
commit ab6d45e
Showing
7 changed files
with
65 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters