From e89b1c9c6e1388f6e7eba0b66110492fe3e7623f Mon Sep 17 00:00:00 2001 From: Zhongyi Xie Date: Fri, 16 Aug 2019 16:37:20 -0700 Subject: [PATCH] add missing check for hash index when calling BlockBasedTableIterator (#5712) Summary: Previous PR https://github.com/facebook/rocksdb/pull/3601 added support for making prefix_extractor dynamically mutable. However, there was a missing check for hash index when creating new BlockBasedTableIterator. While the check may be redundant because no other types of IndexReader makes uses of the flag, it is less error-prone to add the missing check so that future index reader implementation will not worry about violating the contract. Pull Request resolved: https://github.com/facebook/rocksdb/pull/5712 Differential Revision: D16842052 Pulled By: miasantreble fbshipit-source-id: aef11c0ff7a690ed248f5b8fe23481cac486b381 --- table/block_based/block_based_table_reader.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/table/block_based/block_based_table_reader.cc b/table/block_based/block_based_table_reader.cc index 119de00f0..65e960f8c 100644 --- a/table/block_based/block_based_table_reader.cc +++ b/table/block_based/block_based_table_reader.cc @@ -3084,7 +3084,8 @@ InternalIterator* BlockBasedTable::NewIterator( arena->AllocateAligned(sizeof(BlockBasedTableIterator)); return new (mem) BlockBasedTableIterator( this, read_options, rep_->internal_comparator, - NewIndexIterator(read_options, need_upper_bound_check, + NewIndexIterator(read_options, need_upper_bound_check && + rep_->index_type == BlockBasedTableOptions::kHashSearch, /*input_iter=*/nullptr, /*get_context=*/nullptr, &lookup_context), !skip_filters && !read_options.total_order_seek &&