Skip to content

storage: clean up below-Raft Split and Merge locking#39158

Merged
craig[bot] merged 3 commits intocockroachdb:masterfrom
nvb:nvanbenschoten/cleanupSplitMergeLock
Jul 30, 2019
Merged

storage: clean up below-Raft Split and Merge locking#39158
craig[bot] merged 3 commits intocockroachdb:masterfrom
nvb:nvanbenschoten/cleanupSplitMergeLock

Conversation

@nvb
Copy link
Copy Markdown
Contributor

@nvb nvb commented Jul 30, 2019

This PR contains three related cleanups that I stumbled into while cleaning up raft entry application in preparation for #38954.

The first cleanup is that we avoid improperly handling errors that may be returned when acquiring the split/merge locks. If this operation fails then we can't simply return an error and not apply the command. We need to be deterministic at this point. The only option we have is to fatal. See #19448 (comment).

The second cleanup is that we then remove stale code that was attempting to recover from failed split and merge application. This error handling only made sense in a pre-proposer evaluated KV world.

The third commit addresses a TODO to assert that the RHS range during a split is not initialized. The TODO looks like it went in before proposer evaluated KV, which protects us against both replays and reproposals.

nvb added 3 commits July 30, 2019 00:03
If this operation fails then we can't simply return an error and
not apply the command. We need to be deterministic at this point.
The only option we have is to fatal.

See cockroachdb#19448 (comment).

The commit also removes the crash reporting added here, which doesn't
appear to have ever fired after two years.

Release note: None
…anup

This was being used to detect failed Splits, but it doesn't look like
this is actually possible any more. In terms of the code, `rResult.Split`
should never be nil unless a Raft command is being rejected below Raft,
in which case we will never have called `acquireSplitLock` in the first
place. In terms of the comment, it sounds like this is protecting against
failures that were only relevant before proposer evaluated KV.

Release note: None
…t lock

The comment was added in 0dd7d1a, before proposer evaluated KV. Reproposals
are not an issue because of the max lease index, which ensures that only a
single instance of a command applies. Replays of the Range split transaction
are also not an issue because they are protected against above Raft.

Release note: None
@nvb nvb requested review from a team and bdarnell July 30, 2019 04:07
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Contributor

@bdarnell bdarnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r1, 3 of 3 files at r2, 1 of 1 files at r3.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained

@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Jul 30, 2019

bors r=bdarnell

craig bot pushed a commit that referenced this pull request Jul 30, 2019
39158: storage: clean up below-Raft Split and Merge locking r=bdarnell a=nvanbenschoten

This PR contains three related cleanups that I stumbled into while cleaning up raft entry application in preparation for #38954.

The first cleanup is that we avoid improperly handling errors that may be returned when acquiring the split/merge locks. If this operation fails then we can't simply return an error and not apply the command. We need to be deterministic at this point. The only option we have is to fatal. See #19448 (comment).

The second cleanup is that we then remove stale code that was attempting to recover from failed split and merge application. This error handling only made sense in a pre-proposer evaluated KV world.

The third commit addresses a TODO to assert that the RHS range during a split is not initialized. The TODO looks like it went in before proposer evaluated KV, which protects us against both replays and reproposals.

Co-authored-by: Nathan VanBenschoten <nvanbenschoten@gmail.com>
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 30, 2019

Build succeeded

@craig craig bot merged commit 82370ca into cockroachdb:master Jul 30, 2019
@nvb nvb deleted the nvanbenschoten/cleanupSplitMergeLock branch August 3, 2019 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants