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: trim state used from snapshots #72314

Merged
merged 1 commit into from
Nov 3, 2021

Conversation

tbg
Copy link
Member

@tbg tbg commented Nov 2, 2021

Snapshots contain a serialized copy of the ReplicaState. However, the
snapshot itself contains that data already. Having two sources of data
that may be interpreted differently can lead to problems, as we saw in
#72239.

This commit deprecates using the entire ReplicaState. Instead, we pick
out the descriptor and ignore everything else. Instead of using the
copy of the state to initialize the recipient's in-memory state, we
now use a state loader.

In 22.2 we can only send the descriptor but maybe we won't do that; for
logging and debugging it's kind of nice to have everything present.

Fixes #72222.

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@tbg tbg changed the title snaps internal state kvserver: trim state used from snapshots Nov 2, 2021
@tbg tbg force-pushed the snaps-internal-state branch from f9ed0c8 to 2d17daf Compare November 2, 2021 10:00
@tbg tbg requested a review from a team November 2, 2021 10:00
Snapshots contain a serialized copy of the `ReplicaState`. However, the
snapshot itself contains that data already. Having two sources of data
that may be interpreted differently can lead to problems, as we saw in
[72239].

This commit deprecates using the entire ReplicaState. Instead, we pick
out the descriptor and ignore everything else. Instead of using the
copy of the state to initialize the recipient's in-memory state, we
now use a state loader.

In 22.2 we can only send the descriptor but maybe we won't do that; for
logging and debugging it's kind of nice to have everything present.

Fixes cockroachdb#72222.

[cockroachdb#72239]: cockroachdb#72239

Release note: None
@tbg tbg marked this pull request as ready for review November 2, 2021 12:24
@tbg tbg force-pushed the snaps-internal-state branch from 2d17daf to 5660c32 Compare November 2, 2021 12:24
@tbg tbg requested a review from a team as a code owner November 2, 2021 12:24
@tbg tbg requested review from erikgrinaker and removed request for a team November 2, 2021 12:26
Copy link
Contributor

@erikgrinaker erikgrinaker left a comment

Choose a reason for hiding this comment

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

LGTM

@tbg
Copy link
Member Author

tbg commented Nov 3, 2021

bors r=erikgrinaker
TFTR!

@craig craig bot merged commit 3bc13c2 into cockroachdb:master Nov 3, 2021
@craig
Copy link
Contributor

craig bot commented Nov 3, 2021

Build succeeded:

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.

kvserver: don't send replica state explicitly in snapshot
3 participants