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

Check ScheduledCompactKeyName and FinishedCompactKeyName before writing hash #15985

Merged

Conversation

CaojiamingAlan
Copy link
Contributor

Fix #15919
Commit 1: add an e2e test to reproduce the problem. This test won't pass without the fix.
Commit 2: check ScheduledCompactKeyName and FinishedCompactKeyName
before writing hash to hashstore. If they do not match, then it means this compaction has once been interrupted and its hash value is invalid. In such cases, we won't write the hash values to the hashstore, and avoids the incorrect corruption alarm.

@CaojiamingAlan CaojiamingAlan changed the title Check revision before write hash Check ScheduledCompactKeyName and FinishedCompactKeyName before writing hash May 31, 2023
Copy link
Member

@jmhbnz jmhbnz left a comment

Choose a reason for hiding this comment

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

Thanks for your work on this @CaojiamingAlan!

Still getting my head around the changes and linked issue, a few tiny nitpicks to consider after an initial read through.

server/storage/mvcc/kvstore.go Outdated Show resolved Hide resolved
tests/e2e/corrupt_test.go Outdated Show resolved Hide resolved
tests/e2e/corrupt_test.go Outdated Show resolved Hide resolved
@CaojiamingAlan CaojiamingAlan force-pushed the check_revision_before_write_hash branch from 6dd5b8e to 8601eed Compare May 31, 2023 01:55
@CaojiamingAlan CaojiamingAlan force-pushed the check_revision_before_write_hash branch 2 times, most recently from 24a92a4 to ed987e5 Compare May 31, 2023 22:37
tests/e2e/corrupt_test.go Outdated Show resolved Hide resolved
@CaojiamingAlan CaojiamingAlan force-pushed the check_revision_before_write_hash branch from ed987e5 to de65c9e Compare June 2, 2023 04:25
@serathius
Copy link
Member

Please mark conversations as resolved if you have addressed the comment.

tests/e2e/corrupt_test.go Outdated Show resolved Hide resolved
Copy link
Member

@serathius serathius left a comment

Choose a reason for hiding this comment

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

LGTM, some minor comments

@CaojiamingAlan CaojiamingAlan force-pushed the check_revision_before_write_hash branch from de65c9e to c3edd9c Compare June 2, 2023 20:14
Copy link
Member

@jmhbnz jmhbnz left a comment

Choose a reason for hiding this comment

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

LGTM - Thanks @CaojiamingAlan 👍🏻

@serathius
Copy link
Member

cc @ahrtr

Copy link
Member

@ahrtr ahrtr left a comment

Choose a reason for hiding this comment

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

Overall look good to me, with a couple of minor comments.

tests/e2e/corrupt_test.go Outdated Show resolved Hide resolved
tests/e2e/corrupt_test.go Outdated Show resolved Hide resolved
tests/e2e/corrupt_test.go Outdated Show resolved Hide resolved
tests/e2e/corrupt_test.go Outdated Show resolved Hide resolved
tests/e2e/corrupt_test.go Outdated Show resolved Hide resolved
tests/e2e/corrupt_test.go Outdated Show resolved Hide resolved
tests/e2e/corrupt_test.go Outdated Show resolved Hide resolved
@CaojiamingAlan CaojiamingAlan force-pushed the check_revision_before_write_hash branch 2 times, most recently from c7e1b81 to 1c6eeaf Compare June 7, 2023 15:59
Copy link
Member

@chaochn47 chaochn47 left a comment

Choose a reason for hiding this comment

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

LGTM (non-binding). Thanks! @CaojiamingAlan

tests/e2e/corrupt_test.go Outdated Show resolved Hide resolved
@CaojiamingAlan CaojiamingAlan force-pushed the check_revision_before_write_hash branch from 1c6eeaf to d1c946c Compare June 7, 2023 21:24
Copy link
Member

@ahrtr ahrtr left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks @CaojiamingAlan

tests/e2e/corrupt_test.go Outdated Show resolved Hide resolved
…esuming scheduled compaction.

check ScheduledCompactKeyName and FinishedCompactKeyName
before writing hash to hashstore. If they do not match, then it means this compaction has once been interrupted and its hash value is invalid. In such cases, we won't write the hash values to the hashstore, and avoids the incorrect corruption alarm.

Signed-off-by: caojiamingalan <alan.c.19971111@gmail.com>
@CaojiamingAlan CaojiamingAlan force-pushed the check_revision_before_write_hash branch from d1c946c to b9e30bf Compare June 8, 2023 00:54
@ahrtr ahrtr merged commit 6c5fde5 into etcd-io:main Jun 8, 2023
@ahrtr
Copy link
Member

ahrtr commented Jun 8, 2023

@CaojiamingAlan could you backport this PR to 3.5?

@CaojiamingAlan
Copy link
Contributor Author

@ahrtr Sure, does it mean proposing a PR to merge this change to the release-3.5 branch?

@ahrtr
Copy link
Member

ahrtr commented Jun 8, 2023

@ahrtr Sure, does it mean proposing a PR to merge this change to the release-3.5 branch?

Yes. Please note that release-3.5 has big difference with main branch, so please try not to cherry-pick the commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Incorrect hash when resuming scheduled compaction after etcd restarts
5 participants