Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kvserver: consolidate RaftTruncatedState handling #136536

Merged
merged 3 commits into from
Dec 3, 2024

Conversation

pav-kv
Copy link
Collaborator

@pav-kv pav-kv commented Dec 2, 2024

This PR simplifies handling the RaftTruncatedState eval result, and adds TODO to remove a zero check after the next below-raft migration.

RaftExpectedFirstIndex used to be zero before f9dee66 which started setting this field after a LooselyCoupledRaftLogTruncation version gate. Since then, the version gate has been removed, and the field is set unconditionally.

But we still need to have done at least one below-raft migration to safely say that this field can't be zero.

Related to #136109

@pav-kv pav-kv requested a review from a team as a code owner December 2, 2024 22:25
Copy link

blathers-crl bot commented Dec 2, 2024

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@pav-kv pav-kv requested review from sumeerbhola and tbg December 2, 2024 22:26
@pav-kv pav-kv force-pushed the simplify-trunc-state-handling branch 2 times, most recently from 74b97f7 to f00afad Compare December 3, 2024 00:49
Copy link
Member

@tbg tbg left a comment

Choose a reason for hiding this comment

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

But we can't rule out that there are still raft log entries around that have the zero, right? In contrived scenarios, these could pop up for application after an upgrade to the release that contains this PR. Don't we - at least technically - need a below-raft migration here?

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @sumeerbhola)

Copy link
Collaborator Author

@pav-kv pav-kv left a comment

Choose a reason for hiding this comment

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

Good point, yeah, I'll remove this part of the PR. Unless we've had any below-raft migrations after Feb 2022. We don't need a fully-fledged migration, just the wait/sync all state machines aspect of it. Any other below-raft migration would give us this for free.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @sumeerbhola)

@pav-kv
Copy link
Collaborator Author

pav-kv commented Dec 3, 2024

The last below-raft migration #75675 was a bit earlier than that change #76215. So yeah, it's slightly unsafe. Will add it to the list of things waiting for the next migration.

RaftExpectedFirstIndex used to be zero before f9dee66 which started
setting this field after a LooselyCoupledRaftLogTruncation version gate.
Since then, the version gate has been removed, and the field is set
unconditionally.

But we still need to have done at least one below-raft migration to
safely say that this field can't be zero. Added a TODO.

Epic: none
Release note: none
@pav-kv pav-kv force-pushed the simplify-trunc-state-handling branch from f00afad to 1f16c56 Compare December 3, 2024 12:28
@pav-kv pav-kv requested a review from tbg December 3, 2024 12:33
@pav-kv
Copy link
Collaborator Author

pav-kv commented Dec 3, 2024

TFTR!

bors r=tbg

craig bot pushed a commit that referenced this pull request Dec 3, 2024
136536: kvserver: consolidate RaftTruncatedState handling r=tbg a=pav-kv

This PR simplifies handling the `RaftTruncatedState` eval result, and adds TODO to remove a zero check after the next below-raft migration.

`RaftExpectedFirstIndex` used to be zero before f9dee66 which started setting this field after a `LooselyCoupledRaftLogTruncation` version gate. Since then, the version gate has been removed, and the field is set unconditionally.

But we still need to have done at least one below-raft migration to safely say that this field can't be zero.

Related to #136109

Co-authored-by: Pavel Kalinnikov <[email protected]>
@craig
Copy link
Contributor

craig bot commented Dec 3, 2024

Build failed:

@pav-kv
Copy link
Collaborator Author

pav-kv commented Dec 3, 2024

The CI failure in bors is unrelated: #136548.

@pav-kv
Copy link
Collaborator Author

pav-kv commented Dec 3, 2024

bors retry

craig bot pushed a commit that referenced this pull request Dec 3, 2024
136497: kv: use crtime.Mono in sendPartialBatch r=RaduBerinde a=RaduBerinde

Informs: #133315
Release note: None

136536: kvserver: consolidate RaftTruncatedState handling r=tbg a=pav-kv

This PR simplifies handling the `RaftTruncatedState` eval result, and adds TODO to remove a zero check after the next below-raft migration.

`RaftExpectedFirstIndex` used to be zero before f9dee66 which started setting this field after a `LooselyCoupledRaftLogTruncation` version gate. Since then, the version gate has been removed, and the field is set unconditionally.

But we still need to have done at least one below-raft migration to safely say that this field can't be zero.

Related to #136109

Co-authored-by: Radu Berinde <[email protected]>
Co-authored-by: Pavel Kalinnikov <[email protected]>
@craig
Copy link
Contributor

craig bot commented Dec 3, 2024

Build failed (retrying...):

@pav-kv
Copy link
Collaborator Author

pav-kv commented Dec 3, 2024

bors cancel

@craig
Copy link
Contributor

craig bot commented Dec 3, 2024

Canceled.

@pav-kv
Copy link
Collaborator Author

pav-kv commented Dec 3, 2024

CI should be fixed by #136583. Retrying to enter the queue after it.

@pav-kv
Copy link
Collaborator Author

pav-kv commented Dec 3, 2024

bors r+

@craig craig bot merged commit db1d1c0 into cockroachdb:master Dec 3, 2024
22 of 23 checks passed
@pav-kv pav-kv deleted the simplify-trunc-state-handling branch December 3, 2024 17:31
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