-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Update MultiGet to provide consistent CF view for kPersistedTier #13433
Conversation
@cbi42 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
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.
Nice fix! Just one nit comment.
@@ -2753,29 +2753,30 @@ Status DBImpl::MultiCFSnapshot(const ReadOptions& read_options, | |||
// sure. | |||
constexpr int num_retries = 3; | |||
for (int i = 0; i < num_retries; ++i) { | |||
last_try = (i == num_retries - 1); | |||
acquire_mutex = ((i == num_retries - 1) && !read_options.snapshot) || |
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.
nit: I'd change the order.
acquire_mutex = read_options.read_tier == kPersistedTier || ((i == num_retries - 1) && !read_options.snapshot);
Also consider updating the comment above that if read_tier is kPersistentTier we won't bother do the two first try without lock and just acquire the mutex and get the SV.
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 added some comment. read_options.read_tier == kPersistedTier
is usually false so I ordered it last.
@cbi42 has updated the pull request. You must reimport the pull request before landing. |
@cbi42 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: when reading with ReadOptions::read_tier = kPersistedTier and with a snapshot, MultiGet allows the case where some CF is read before a flush and some CF is read after the flush. This is not desirable, especially when atomic_flush is enabled and users use MultiGet to do some consistency checks on the data in SST files. This PR updates the code path for SuperVersion acquisition to get a consistent view across when kPersistedTier is used.
Test plan: a new unit test that could be flaky without this change.