kHashSearch incompatible with index_block_restart_interval>1 (#6294)

Summary:
kHashSearch index type is incompatible with index_block_restart_interval larger than 1. The patch asserts that and also resets index_block_restart_interval value if it is incompatible with kHashSearch.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6294

Differential Revision: D19394229

Pulled By: maysamyabandeh

fbshipit-source-id: 8a12712ab25e81094a7f71ecd43f773dd4fb6acd
main
Maysam Yabandeh 5 years ago committed by Facebook Github Bot
parent 894c6d21af
commit d4b7fbf0d5
  1. 1
      HISTORY.md
  2. 7
      table/block_based/block_based_table_factory.cc
  3. 3
      table/block_based/index_builder.cc

@ -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. * 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 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. * 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 ### New Features
* It is now possible to enable periodic compactions for the base DB when using BlobDB. * It is now possible to enable periodic compactions for the base DB when using BlobDB.

@ -157,6 +157,8 @@ size_t TailPrefetchStats::GetSuggestedPrefetchSize() {
return std::min(kMaxPrefetchSize, max_qualified_size); return std::min(kMaxPrefetchSize, max_qualified_size);
} }
// TODO(myabandeh): We should return an error instead of silently changing the
// options
BlockBasedTableFactory::BlockBasedTableFactory( BlockBasedTableFactory::BlockBasedTableFactory(
const BlockBasedTableOptions& _table_options) const BlockBasedTableOptions& _table_options)
: table_options_(_table_options) { : table_options_(_table_options) {
@ -184,6 +186,11 @@ BlockBasedTableFactory::BlockBasedTableFactory(
if (table_options_.index_block_restart_interval < 1) { if (table_options_.index_block_restart_interval < 1) {
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 && if (table_options_.partition_filters &&
table_options_.index_type != table_options_.index_type !=
BlockBasedTableOptions::kTwoLevelIndexSearch) { BlockBasedTableOptions::kTwoLevelIndexSearch) {

@ -39,6 +39,9 @@ IndexBuilder* IndexBuilder::CreateIndexBuilder(
table_opt.index_shortening, /* include_first_key */ false); table_opt.index_shortening, /* include_first_key */ false);
} break; } break;
case BlockBasedTableOptions::kHashSearch: { case BlockBasedTableOptions::kHashSearch: {
// Currently kHashSearch is incompatible with index_block_restart_interval
// > 1
assert(table_opt.index_block_restart_interval == 1);
result = new HashIndexBuilder( result = new HashIndexBuilder(
comparator, int_key_slice_transform, comparator, int_key_slice_transform,
table_opt.index_block_restart_interval, table_opt.format_version, table_opt.index_block_restart_interval, table_opt.format_version,

Loading…
Cancel
Save