From 44cf84932fb1f7c06cce8f4ef0c744d6f2dbd4a2 Mon Sep 17 00:00:00 2001 From: Maysam Yabandeh Date: Thu, 31 May 2018 19:16:11 -0700 Subject: [PATCH] Fix the bug of some test scenarios being put after kEnd Summary: DBTestBase::OptionConfig includes the scenarios that unit tests could iterate over them by calling ChangeOptions(). Some of the options have been mistakenly put after kEnd which makes them essentially invisible to ChangeOptions() caller. This patch fixes it except for kUniversalSubcompactions which is left as TODO since it would break some unit tests. Closes https://github.com/facebook/rocksdb/pull/3935 Differential Revision: D8230748 Pulled By: maysamyabandeh fbshipit-source-id: edddb8fffcd161af1809fef24798ce118f8593db --- db/db_test_util.h | 18 +++++++++++------- table/block_based_table_reader.cc | 14 ++++++++------ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/db/db_test_util.h b/db/db_test_util.h index f9d1eca3f..d886a27d4 100644 --- a/db/db_test_util.h +++ b/db/db_test_util.h @@ -694,13 +694,17 @@ class DBTestBase : public testing::Test { kConcurrentSkipList = 29, kPipelinedWrite = 30, kConcurrentWALWrites = 31, - kEnd = 32, - kDirectIO = 33, - kLevelSubcompactions = 34, - kUniversalSubcompactions = 35, - kBlockBasedTableWithIndexRestartInterval = 36, - kBlockBasedTableWithPartitionedIndex = 37, - kPartitionedFilterWithNewTableReaderForCompactions = 38, + kDirectIO, + kLevelSubcompactions, + kBlockBasedTableWithIndexRestartInterval, + kBlockBasedTableWithPartitionedIndex, + kPartitionedFilterWithNewTableReaderForCompactions, + kEnd, + + // TODO: This option although been there for a while was disable due to a + // mistake. Enabling it makes somem tests to fail. We should enable it and + // fix the unit tests. + kUniversalSubcompactions, }; public: diff --git a/table/block_based_table_reader.cc b/table/block_based_table_reader.cc index aa7da6626..4634e5074 100644 --- a/table/block_based_table_reader.cc +++ b/table/block_based_table_reader.cc @@ -1575,11 +1575,12 @@ BlockIter* BlockBasedTable::NewDataBlockIterator( { StopWatch sw(rep->ioptions.env, rep->ioptions.statistics, READ_BLOCK_GET_MICROS); - s = ReadBlockFromFile(rep->file.get(), nullptr /* prefetch_buffer */, - rep->footer, ro, handle, &block_value, rep->ioptions, - rep->blocks_maybe_compressed, compression_dict, - rep->persistent_cache_options, rep->global_seqno, - rep->table_options.read_amp_bytes_per_bit); + s = ReadBlockFromFile( + rep->file.get(), nullptr /* prefetch_buffer */, rep->footer, ro, + handle, &block_value, rep->ioptions, rep->blocks_maybe_compressed, + compression_dict, rep->persistent_cache_options, + is_index ? kDisableGlobalSequenceNumber : rep->global_seqno, + rep->table_options.read_amp_bytes_per_bit); } if (s.ok()) { block.value = block_value.release(); @@ -1678,7 +1679,8 @@ Status BlockBasedTable::MaybeLoadDataBlockToCache( rep->file.get(), prefetch_buffer, rep->footer, ro, handle, &raw_block, rep->ioptions, block_cache_compressed == nullptr && rep->blocks_maybe_compressed, - compression_dict, rep->persistent_cache_options, rep->global_seqno, + compression_dict, rep->persistent_cache_options, + is_index ? kDisableGlobalSequenceNumber : rep->global_seqno, rep->table_options.read_amp_bytes_per_bit); }