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: allow term and generation increments #105044

Merged

Conversation

andrewbaptist
Copy link
Collaborator

Previously delegated snapshots had a check where it would not allow delegation if the term or generation were different between the sender and the recipient. This was incorrect as on the coordinator it was possible that the term and generation could increment. This change allows the sending of changes as long as the sender (leaseholder or delegate) has an equal or greater term or generation.

Epic: none
Fixes: #104477

Release note: None

@blathers-crl
Copy link

blathers-crl bot commented Jun 16, 2023

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

@andrewbaptist andrewbaptist marked this pull request as ready for review June 16, 2023 14:25
@andrewbaptist andrewbaptist requested a review from a team as a code owner June 16, 2023 14:25
pkg/kv/kvserver/replica_command.go Show resolved Hide resolved
pkg/kv/kvserver/replica_command.go Show resolved Hide resolved
Copy link
Collaborator Author

@andrewbaptist andrewbaptist left a comment

Choose a reason for hiding this comment

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

TFTR - good catch on the comments. Snapshots are "loosely coupled" with other replica and lease movements, so it needs to be more tolerant of forward changes to these values but not backward values.

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


pkg/kv/kvserver/replica_command.go line 2917 at r1 (raw file):

Previously, pavelkalinnikov (Pavel Kalinnikov) wrote…

Could you update the validateSnapshotDelegationRequest method comment accordingly? It currently speaks in terms of term/gen equality.

Is the comment above up-to-date? Not sure what "if there are merges or splits, it is safer to reject" means, but don't we enable this "unsafe" scenario with this change?

Updated the comment. Forward changes to term and generation are OK, but backwards changes are not.


pkg/kv/kvserver/replica_command.go line 2968 at r1 (raw file):

Previously, pavelkalinnikov (Pavel Kalinnikov) wrote…

Is the comment above up-to-date?

Update the comment here also.

Previously delegated snapshots had a check where it would not allow
delegation if the term or generation were different between the sender
and the recipient. This was incorrect as on the coordinator it was
possible that the term and generation could increment. This change
allows the sending of changes as long as the sender (leaseholder or
delegate) has an equal or greater term or generation.

Epic: none
Fixes: cockroachdb#104477

Release note: None
@andrewbaptist
Copy link
Collaborator Author

bors r=pavelkalinnikov

@craig
Copy link
Contributor

craig bot commented Jun 23, 2023

Build failed:

@andrewbaptist
Copy link
Collaborator Author

bors retry

@craig
Copy link
Contributor

craig bot commented Jun 26, 2023

Build succeeded:

@craig craig bot merged commit 19b67e3 into cockroachdb:master Jun 26, 2023
6 of 7 checks passed
@andrewbaptist andrewbaptist deleted the 2023-06-15-fix-delegate-check branch December 15, 2023 21:34
@kvoli
Copy link
Collaborator

kvoli commented Mar 26, 2024

blathers backport 23.1

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.

kv/kvserver: TestReplicaTombstone failed
4 participants