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

kv: don't load applied index twice during Raft snapshot #68497

Merged

Conversation

nvanbenschoten
Copy link
Member

@nvanbenschoten nvanbenschoten commented Aug 5, 2021

This was harmless, but it was also unnecessary and looked quite
alarming. It would be a major problem if the Raft applied index stored
in a SnapshotMetadata was ever incoherent with the applied state in
the snapshot. However, we're reading from a consistent enging snapshot
in snapshot, so the Raft applied index can't change. Still, better to
avoid questions.

The "members of the Range struct" comment was very stale, dating back
to acc41dd.

@nvanbenschoten nvanbenschoten requested a review from tbg August 5, 2021 19:58
@nvanbenschoten nvanbenschoten requested a review from a team as a code owner August 5, 2021 19:58
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@aliher1911 aliher1911 left a comment

Choose a reason for hiding this comment

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

:lgtm:

Getting that twice looks unnecessary.

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @nvanbenschoten and @tbg)


pkg/kv/kvserver/replica_raftstorage.go, line 553 at r1 (raw file):
Isn't that contradicting that you said in the PR comment

"However, we're holding the raftMu in snapshot, so the Raft applied index can't change."

This was harmless, but it was also unnecessary and looked quite
alarming. It would be a major problem if the Raft applied index stored
in a `SnapshotMetadata` was ever incoherent with the applied state in
the snapshot. However, we're reading from a consistent enging snapshot
in `snapshot`, so the Raft applied index can't change. Still, better to
avoid questions.

The "members of the Range struct" comment was very stale, dating back
to acc41dd.
@nvanbenschoten nvanbenschoten force-pushed the nvanbenschoten/appliedIndexLoad branch from 059d451 to 60ce7be Compare August 9, 2021 15:48
Copy link
Member Author

@nvanbenschoten nvanbenschoten left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @aliher1911 and @tbg)


pkg/kv/kvserver/replica_raftstorage.go, line 553 at r1 (raw file):

Previously, aliher1911 (Oleg) wrote…

Isn't that contradicting that you said in the PR comment

"However, we're holding the raftMu in snapshot, so the Raft applied index can't change."

Yeah, you're completely right. I was missing the fact that we're reading from an engine snapshot. Fixed the commit message.

@nvanbenschoten
Copy link
Member Author

bors r+

@craig
Copy link
Contributor

craig bot commented Aug 9, 2021

Build succeeded:

@craig craig bot merged commit 764a1a9 into cockroachdb:master Aug 9, 2021
@nvanbenschoten nvanbenschoten deleted the nvanbenschoten/appliedIndexLoad branch August 10, 2021 01:24
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