Revert to respecting only the read_tier read option for index blocks (#5481)
Summary: PR https://github.com/facebook/rocksdb/issues/5298 subtly changed how read options are applied to the index block during a Get, MultiGet, or iteration. Earlier, only the read_tier option applied to the index block read; since PR https://github.com/facebook/rocksdb/issues/5298, fill_cache and verify_checksums also have an effect. This patch restores the earlier behavior to prevent surprise memory increases for clients due to the index block not being cached. Pull Request resolved: https://github.com/facebook/rocksdb/pull/5481 Test Plan: make check Differential Revision: D15883082 Pulled By: ltamasi fbshipit-source-id: 9a065ec3a6db5a365cf6dd5e95190a20c5756356
This commit is contained in:
parent
317a78197b
commit
0d3679d0af
@ -217,8 +217,7 @@ class BlockBasedTable::IndexReaderCommon : public BlockBasedTable::IndexReader {
|
||||
return properties == nullptr || !properties->index_value_is_delta_encoded;
|
||||
}
|
||||
|
||||
Status GetOrReadIndexBlock(const ReadOptions& read_options,
|
||||
GetContext* get_context,
|
||||
Status GetOrReadIndexBlock(bool no_io, GetContext* get_context,
|
||||
BlockCacheLookupContext* lookup_context,
|
||||
CachableEntry<Block>* index_block) const;
|
||||
|
||||
@ -257,7 +256,7 @@ Status BlockBasedTable::IndexReaderCommon::ReadIndexBlock(
|
||||
}
|
||||
|
||||
Status BlockBasedTable::IndexReaderCommon::GetOrReadIndexBlock(
|
||||
const ReadOptions& read_options, GetContext* get_context,
|
||||
bool no_io, GetContext* get_context,
|
||||
BlockCacheLookupContext* lookup_context,
|
||||
CachableEntry<Block>* index_block) const {
|
||||
assert(index_block != nullptr);
|
||||
@ -267,6 +266,11 @@ Status BlockBasedTable::IndexReaderCommon::GetOrReadIndexBlock(
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
ReadOptions read_options;
|
||||
if (no_io) {
|
||||
read_options.read_tier = kBlockCacheTier;
|
||||
}
|
||||
|
||||
return ReadIndexBlock(table_, /*prefetch_buffer=*/nullptr, read_options,
|
||||
get_context, lookup_context, index_block);
|
||||
}
|
||||
@ -311,9 +315,10 @@ class PartitionIndexReader : public BlockBasedTable::IndexReaderCommon {
|
||||
const ReadOptions& read_options, bool /* disable_prefix_seek */,
|
||||
IndexBlockIter* iter, GetContext* get_context,
|
||||
BlockCacheLookupContext* lookup_context) override {
|
||||
const bool no_io = (read_options.read_tier == kBlockCacheTier);
|
||||
CachableEntry<Block> index_block;
|
||||
const Status s = GetOrReadIndexBlock(read_options, get_context,
|
||||
lookup_context, &index_block);
|
||||
const Status s =
|
||||
GetOrReadIndexBlock(no_io, get_context, lookup_context, &index_block);
|
||||
if (!s.ok()) {
|
||||
if (iter != nullptr) {
|
||||
iter->Invalidate(s);
|
||||
@ -373,7 +378,7 @@ class PartitionIndexReader : public BlockBasedTable::IndexReaderCommon {
|
||||
Statistics* kNullStats = nullptr;
|
||||
|
||||
CachableEntry<Block> index_block;
|
||||
Status s = GetOrReadIndexBlock(ReadOptions(), nullptr /* get_context */,
|
||||
Status s = GetOrReadIndexBlock(false /* no_io */, nullptr /* get_context */,
|
||||
&lookup_context, &index_block);
|
||||
if (!s.ok()) {
|
||||
ROCKS_LOG_WARN(rep->ioptions.info_log,
|
||||
@ -497,9 +502,10 @@ class BinarySearchIndexReader : public BlockBasedTable::IndexReaderCommon {
|
||||
const ReadOptions& read_options, bool /* disable_prefix_seek */,
|
||||
IndexBlockIter* iter, GetContext* get_context,
|
||||
BlockCacheLookupContext* lookup_context) override {
|
||||
const bool no_io = (read_options.read_tier == kBlockCacheTier);
|
||||
CachableEntry<Block> index_block;
|
||||
const Status s = GetOrReadIndexBlock(read_options, get_context,
|
||||
lookup_context, &index_block);
|
||||
const Status s =
|
||||
GetOrReadIndexBlock(no_io, get_context, lookup_context, &index_block);
|
||||
if (!s.ok()) {
|
||||
if (iter != nullptr) {
|
||||
iter->Invalidate(s);
|
||||
@ -639,9 +645,10 @@ class HashIndexReader : public BlockBasedTable::IndexReaderCommon {
|
||||
const ReadOptions& read_options, bool disable_prefix_seek,
|
||||
IndexBlockIter* iter, GetContext* get_context,
|
||||
BlockCacheLookupContext* lookup_context) override {
|
||||
const bool no_io = (read_options.read_tier == kBlockCacheTier);
|
||||
CachableEntry<Block> index_block;
|
||||
const Status s = GetOrReadIndexBlock(read_options, get_context,
|
||||
lookup_context, &index_block);
|
||||
const Status s =
|
||||
GetOrReadIndexBlock(no_io, get_context, lookup_context, &index_block);
|
||||
if (!s.ok()) {
|
||||
if (iter != nullptr) {
|
||||
iter->Invalidate(s);
|
||||
|
Loading…
Reference in New Issue
Block a user