summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranand76 <anand1976@users.noreply.github.com>2024-03-28 13:56:28 -0700
committeranand76 <anand1976@users.noreply.github.com>2024-03-29 13:07:12 -0700
commitf6d01f0f6e31a8be6a52592760345557e980a270 (patch)
treeeab5d2251ec07e3d005333650aa5420b0a626c8f
parente223cd46c618448797b8b9dd8a9fd1d7243124c4 (diff)
Don't swallow errors in BlockBasedTable::MultiGet (#12486)
Summary: Errors were being swallowed in `BlockBasedTable::MultiGet` under some circumstances, such as error when parsing the internal key from the block, or IO error when reading the blob value. We need to set the status for the key to the observed error. Pull Request resolved: https://github.com/facebook/rocksdb/pull/12486 Test Plan: Run db_stress and verify the expected error failure before, and no failures after the change. Reviewed By: jaykorean, ajkr Differential Revision: D55483940 Pulled By: anand1976 fbshipit-source-id: 493e44db507d5db45e8d1ef2e67808d2c4046318
-rw-r--r--table/block_based/block_based_table_reader_sync_and_async.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/table/block_based/block_based_table_reader_sync_and_async.h b/table/block_based/block_based_table_reader_sync_and_async.h
index 6350560c1..30d9884ec 100644
--- a/table/block_based/block_based_table_reader_sync_and_async.h
+++ b/table/block_based/block_based_table_reader_sync_and_async.h
@@ -729,7 +729,7 @@ DEFINE_SYNC_AND_ASYNC(void, BlockBasedTable::MultiGet)
}
// Call the *saver function on each entry/block until it returns false
- for (; biter->Valid(); biter->Next()) {
+ for (; biter->status().ok() && biter->Valid(); biter->Next()) {
ParsedInternalKey parsed_key;
Status pik_status = ParseInternalKey(
biter->key(), &parsed_key, false /* log_err_key */); // TODO
@@ -754,9 +754,6 @@ DEFINE_SYNC_AND_ASYNC(void, BlockBasedTable::MultiGet)
done = true;
break;
}
- if (s.ok()) {
- s = biter->status();
- }
}
// Write the block cache access.
// XXX: There appear to be 'break' statements above that bypass this
@@ -779,8 +776,10 @@ DEFINE_SYNC_AND_ASYNC(void, BlockBasedTable::MultiGet)
*lookup_data_block_context, lookup_data_block_context->block_key,
referenced_key, does_referenced_key_exist, referenced_data_size);
}
- s = biter->status();
- if (done) {
+ if (s.ok()) {
+ s = biter->status();
+ }
+ if (done || !s.ok()) {
// Avoid the extra Next which is expensive in two-level indexes
break;
}