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

Ensure VerifyFileChecksums reads don't exceed readahead_size #11328

Closed
wants to merge 4 commits into from

Conversation

anand1976
Copy link
Contributor

VerifyFileChecksums currently interprets the readahead_size as a payload of readahead_size for calculating the checksum, plus a prefetch of an additional readahead_size. Hence each read is readahead_size * 2. This change treats it as chunks of readahead_size for checksum calculation.

Test plan:
Add a unit test

}
ASSERT_OK(Flush());

ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack(
Copy link
Contributor

Choose a reason for hiding this comment

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

The test should fail if somehow the callback stops being called at all. Perhaps declare last_read outside the callback and ASSERT_TRUE at the end of the test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suppose I can count the bytes read and assert outside the callback that its equal to the file size.

ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack(
"GenerateOneFileChecksum::Chunk:0", [&](void* /*arg*/) {
static bool last_read = false;
if (env_->random_read_bytes_counter_.load() & (256 * 1024 - 1)) {
Copy link
Contributor

@pdillinger pdillinger Apr 4, 2023

Choose a reason for hiding this comment

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

This seems to be allowing only one read that is not a multiple of 256KB. I'm not sure why that's necessary and sufficient.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The expected pattern is a bunch of aligned reads, followed by 0 or 1 unaligned read at the tail of the file.

@facebook-github-bot
Copy link
Contributor

@anand1976 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@pdillinger pdillinger 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 the fix!

@facebook-github-bot
Copy link
Contributor

@anand1976 has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@anand1976 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@anand1976 merged this pull request in 0623c5b.

anand1976 added a commit that referenced this pull request Apr 6, 2023
Summary:
VerifyFileChecksums currently interprets the readahead_size as a payload of readahead_size for calculating the checksum, plus a prefetch of an additional readahead_size. Hence each read is readahead_size * 2. This change treats it as chunks of readahead_size for checksum calculation.

Pull Request resolved: #11328

Test Plan: Add a unit test

Reviewed By: pdillinger

Differential Revision: D44718781

Pulled By: anand1976

fbshipit-source-id: 79bae1ebaa27de2a13bc86f5910bf09356936e63
pdillinger added a commit to pdillinger/rocksdb that referenced this pull request Jan 4, 2024
Summary: I suspect the issue called out in facebook#9357 was fixed in facebook#11328

Test Plan: `make blackbox_crash_test` for hours
facebook-github-bot pushed a commit that referenced this pull request Jan 4, 2024
Summary:
I suspect the issue called out in #9357 was fixed in #11328

Pull Request resolved: #12201

Test Plan: `make blackbox_crash_test` for hours

Reviewed By: ajkr

Differential Revision: D52543075

Pulled By: pdillinger

fbshipit-source-id: b705a6bdb2799a5f51ad2746df2083aa82f360a2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants