-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
storage: invalidate cached lastTerm on snapshots #18327
storage: invalidate cached lastTerm on snapshots #18327
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but it strikes me as brittle that we have two values that are tied together but are kept separate.
Maybe a struct lastTermAndIndex
could make it more obvious that changing one without the other is illegal. Just a thought though.
pkg/storage/replica_raftstorage.go
Outdated
// raftpb.SnapshotMetadata. | ||
r.mu.lastIndex = s.RaftAppliedIndex | ||
r.mu.lastTerm = 0 | ||
r.mu.lastIndex, r.mu.lastTerm = lastIndexAndTermInSnapshot(inSnap) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couldn't you just return struct lastIndexAndTerm
from applySnapshot
and save the other call to lastIndexAndTermInSnapshot
? Nit, but I think it might be clearer.
modulo not changing where we retrieve Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions, some commit checks pending. pkg/storage/replica.go, line 3254 at r1 (raw file):
For a 1.1 cherry-pick, I'd prefer doing Comments from Reviewable |
Heh, two opposite recommendations. Should I split it up into two commits, one with just the one line change and one with the rest? Then we can just cherry-pick in the first one. |
I don't feel strongly, we could also just do the beauty refactor later in
the cycle if we track it. Getting a nice contained cherry-pick is the more
important item.
On Thu, Sep 7, 2017 at 12:40 PM Nathan VanBenschoten < ***@***.***> wrote:
Heh, two opposite recommendations. Should I split it up into two commits,
one with just the one line change and one with the rest? Then we can just
cherry-pick in the first one.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#18327 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AE135CcDLYCvbyWfkFySvei4iL12sZn7ks5sgBxwgaJpZM4PQD4f>
.
--
…-- Tobias
|
Agreed on the nicely contained cherry-pick being the priority. That's what @nvanbenschoten and i discussed in person. I think it should be followed up quickly with both the beauty refactor and a test. |
Addresses the current issue in cockroachdb#17524. I'll open an issue to properly test this, but that might take some time. Fow now this seems like a clear fix that we should get in sooner rather than later.
17ff1da
to
e39e856
Compare
Done. PTAL. Opened #18336 to track cleanup and testing. |
Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions, some commit checks pending. Comments from Reviewable |
Addresses the current issue in #17524.
I'll open an issue to properly test this, but that might take some time.
Fow now this seems like a clear fix that we should get in sooner rather
than later.