diff --git a/HISTORY.md b/HISTORY.md index 9e58ddfaa..58225553c 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -17,6 +17,7 @@ * Fixed a bug where BlobDB was comparing the `ColumnFamilyHandle` pointers themselves instead of only the column family IDs when checking whether an API call uses the default column family or not. * Fix a race condition for cfd->log_number_ between manifest switch and memtable switch (PR 6249) when number of column families is greater than 1. * Fix a bug on fractional cascading index when multiple files at the same level contain the same smallest user key, and those user keys are for merge operands. In this case, Get() the exact key may miss some merge operands. +* Delcare kHashSearch index type feature-incompatible with index_block_restart_interval larger than 1. ### New Features * It is now possible to enable periodic compactions for the base DB when using BlobDB. diff --git a/table/block_based/block_based_table_factory.cc b/table/block_based/block_based_table_factory.cc index a3368610d..cdd121148 100644 --- a/table/block_based/block_based_table_factory.cc +++ b/table/block_based/block_based_table_factory.cc @@ -157,6 +157,8 @@ size_t TailPrefetchStats::GetSuggestedPrefetchSize() { return std::min(kMaxPrefetchSize, max_qualified_size); } +// TODO(myabandeh): We should return an error instead of silently changing the +// options BlockBasedTableFactory::BlockBasedTableFactory( const BlockBasedTableOptions& _table_options) : table_options_(_table_options) { @@ -184,6 +186,11 @@ BlockBasedTableFactory::BlockBasedTableFactory( if (table_options_.index_block_restart_interval < 1) { table_options_.index_block_restart_interval = 1; } + if (table_options_.index_type == BlockBasedTableOptions::kHashSearch && + table_options_.index_block_restart_interval != 1) { + // Currently kHashSearch is incompatible with index_block_restart_interval > 1 + table_options_.index_block_restart_interval = 1; + } if (table_options_.partition_filters && table_options_.index_type != BlockBasedTableOptions::kTwoLevelIndexSearch) { diff --git a/table/block_based/index_builder.cc b/table/block_based/index_builder.cc index f3a4b10e0..ce20c6cf6 100644 --- a/table/block_based/index_builder.cc +++ b/table/block_based/index_builder.cc @@ -39,6 +39,9 @@ IndexBuilder* IndexBuilder::CreateIndexBuilder( table_opt.index_shortening, /* include_first_key */ false); } break; case BlockBasedTableOptions::kHashSearch: { + // Currently kHashSearch is incompatible with index_block_restart_interval + // > 1 + assert(table_opt.index_block_restart_interval == 1); result = new HashIndexBuilder( comparator, int_key_slice_transform, table_opt.index_block_restart_interval, table_opt.format_version,