-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Fix kBlockCacheTier read when merge-chain base value is in a blob file #12462
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c50789a
Fix kBlockCacheTier read for on-disk blob value
ajkr e0c31bf
replayGetContextLog status handling
ajkr 54e2b81
GetFromRowCache status handling
ajkr 98894cd
repro test case
ajkr 1466dfb
use CO_RETURN
ajkr 9310c93
release note
ajkr 542c5fe
try to satisfy linter
ajkr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -221,7 +221,7 @@ void GetContext::ReportCounters() { | |
|
||
bool GetContext::SaveValue(const ParsedInternalKey& parsed_key, | ||
const Slice& value, bool* matched, | ||
Cleanable* value_pinner) { | ||
Status* read_status, Cleanable* value_pinner) { | ||
assert(matched); | ||
assert((state_ != kMerge && parsed_key.type != kTypeMerge) || | ||
merge_context_ != nullptr); | ||
|
@@ -356,8 +356,8 @@ bool GetContext::SaveValue(const ParsedInternalKey& parsed_key, | |
// merge_context_->operand_list | ||
if (type == kTypeBlobIndex) { | ||
PinnableSlice pin_val; | ||
if (GetBlobValue(parsed_key.user_key, unpacked_value, &pin_val) == | ||
false) { | ||
if (GetBlobValue(parsed_key.user_key, unpacked_value, &pin_val, | ||
read_status) == false) { | ||
return false; | ||
} | ||
Slice blob_value(pin_val); | ||
|
@@ -383,8 +383,8 @@ bool GetContext::SaveValue(const ParsedInternalKey& parsed_key, | |
assert(merge_operator_ != nullptr); | ||
if (type == kTypeBlobIndex) { | ||
PinnableSlice pin_val; | ||
if (GetBlobValue(parsed_key.user_key, unpacked_value, &pin_val) == | ||
false) { | ||
if (GetBlobValue(parsed_key.user_key, unpacked_value, &pin_val, | ||
read_status) == false) { | ||
return false; | ||
} | ||
Slice blob_value(pin_val); | ||
|
@@ -547,14 +547,14 @@ void GetContext::MergeWithWideColumnBaseValue(const Slice& entity) { | |
} | ||
|
||
bool GetContext::GetBlobValue(const Slice& user_key, const Slice& blob_index, | ||
PinnableSlice* blob_value) { | ||
PinnableSlice* blob_value, Status* read_status) { | ||
constexpr FilePrefetchBuffer* prefetch_buffer = nullptr; | ||
constexpr uint64_t* bytes_read = nullptr; | ||
|
||
Status status = blob_fetcher_->FetchBlob( | ||
user_key, blob_index, prefetch_buffer, blob_value, bytes_read); | ||
if (!status.ok()) { | ||
if (status.IsIncomplete()) { | ||
*read_status = blob_fetcher_->FetchBlob(user_key, blob_index, prefetch_buffer, | ||
blob_value, bytes_read); | ||
if (!read_status->ok()) { | ||
if (read_status->IsIncomplete()) { | ||
// FIXME: this code is not covered by unit tests | ||
MarkKeyMayExist(); | ||
return false; | ||
|
@@ -577,9 +577,9 @@ void GetContext::push_operand(const Slice& value, Cleanable* value_pinner) { | |
} | ||
} | ||
|
||
void replayGetContextLog(const Slice& replay_log, const Slice& user_key, | ||
GetContext* get_context, Cleanable* value_pinner, | ||
SequenceNumber seq_no) { | ||
Status replayGetContextLog(const Slice& replay_log, const Slice& user_key, | ||
GetContext* get_context, Cleanable* value_pinner, | ||
SequenceNumber seq_no) { | ||
Slice s = replay_log; | ||
Slice ts; | ||
size_t ts_sz = get_context->TimestampSize(); | ||
|
@@ -610,8 +610,13 @@ void replayGetContextLog(const Slice& replay_log, const Slice& user_key, | |
|
||
(void)ret; | ||
|
||
get_context->SaveValue(ikey, value, &dont_care, value_pinner); | ||
Status read_status; | ||
get_context->SaveValue(ikey, value, &dont_care, &read_status, value_pinner); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we check the return value from SaveValue() ? |
||
if (!read_status.ok()) { | ||
return read_status; | ||
} | ||
} | ||
return Status::OK(); | ||
} | ||
|
||
} // namespace ROCKSDB_NAMESPACE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
unreleased_history/bug_fixes/blockcachetier_blob_as_mergebase.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Fixed `kBlockCacheTier` reads to return `Status::Incomplete` when I/O is needed to fetch a merge chain's base value from a blob file. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should we check the return value from
SaveValue()
?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 haven't thought about it. Do you have an explanation of what can go wrong without it and/or proposal of what to do with it?
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 think we should check the return value as is done in the vicinity of this code.