-
Notifications
You must be signed in to change notification settings - Fork 9.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
Improve snapshot status #15979
Improve snapshot status #15979
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.
Overall lgtm, but needs a test
d634c55
to
de8c7aa
Compare
@lavacat I added a test. Can you take a look again please? |
/cc: @chaochn47 |
If the CI is green, I think this should attract more reviewers to take a look and approve the PR. You can I've tried in #15659 but with no luck. |
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.
Hey @cenkalti - It looks like a minor update to fix the static analysis see below.
Can you also please rebase this pr.
I recall we refactored the |
Sure, I'll rebase this PR and make sure all checks pass. |
32f60ef
to
3b4dfb6
Compare
/retest |
7f32b22
to
91cc26d
Compare
sub := int64(binary.BigEndian.Uint64(bytes[9:])) | ||
if main < -1 || sub < 0 { // finishedCompactRev can be -1 | ||
return BucketKey{}, errors.New("negative revision") | ||
} |
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.
Revision numbers must be positive. Negative values are invalid. I added these extra checks to be able to detect corruptions on database when checking snapshot status on disk.
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.
Suggest not to change the signature. Instead we can add assertion (panicking when it breaks any invariant properties)
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.
Also I see your comment "// finishedCompactRev can be -1
". Can you elaborate in what exact case finishedCompactRev
may be -1?
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.
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.
I don't see any case etcd may persist the -1
.
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.
Reverted back the signature change. Now it's panicking in case of invalid revision bytes.
91cc26d
to
dded93f
Compare
/retest |
All tests passing. Ready for review again. |
ae4b331
to
d3a757d
Compare
@ahrtr I squashed all my commits. |
// TestSnapshotStatus is the happy case. | ||
// It inserts pre-defined number of keys and asserts the output hash of status command. | ||
// The expected hash value must not be changed. | ||
// If it changes, there must be some backwards incompatible change introduced. |
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.
Could we merge the tests before we change logic? It's nice to separate the refactors and tests that are meant to prove nothing changed.
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.
I don't think that's necessary because refactors doesn't affect the hash value in any way. They're only about adding extra error conditions.
574fb2a
to
447c25e
Compare
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.
lgtm
Thanks
2513bd2
to
7ef0a43
Compare
Discussed during sig-etcd triage meeting, it looks like this older pr was very close to merge, @cenkalti could you please rebase to address conflicts? |
I'll do it this weekend. |
7ef0a43
to
2602928
Compare
Rebased. Ready to merge. |
Hi @cenkalti can you please rebase this? Thanks |
/retest |
This PR was very close to merging. It has been rebased a couple of times. Does it make sense to move forward? There is at least an open comment from @fuweid: https://github.com/etcd-io/etcd/pull/15979/files#r1467819098. We have several reviewers but only approval from @ahrtr. What would be required to move forward with this pull request? |
It's just my two cents for using |
Signed-off-by: Cenk Alti <[email protected]>
2ded6d5
to
ea46253
Compare
I fixed the error messages and rebased again. |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files
... and 25 files with indirect coverage changes @@ Coverage Diff @@
## main #15979 +/- ##
==========================================
+ Coverage 68.75% 68.85% +0.10%
==========================================
Files 416 416
Lines 35128 35151 +23
==========================================
+ Hits 24152 24203 +51
+ Misses 9569 9542 -27
+ Partials 1407 1406 -1 Continue to review full report in Codecov by Sentry.
|
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.
LGTM - Thanks @cenkalti
Adding unmarshaling for items in "key" bucket for extra safety.