Index type doesn't have to be persisted

Summary:

With the recent changes, there is no need to check the property block about the index block type.
If user want to use it, they don't really need any disk format change; everything happens in the fly.

Also another team encountered an error while reading the index type from properties.

Test Plan:

ran all the tests

Reviewers: sdong

CC:

Task ID: #

Blame Rev:
This commit is contained in:
Kai Liu 2014-04-11 13:55:26 -07:00
parent 62551b1c4e
commit e37dd216f9

View File

@ -1030,15 +1030,7 @@ bool BlockBasedTable::TEST_KeyInCache(const ReadOptions& options,
Status BlockBasedTable::CreateIndexReader(IndexReader** index_reader) {
// Some old version of block-based tables don't have index type present in
// table properties. If that's the case we can safely use the kBinarySearch.
auto index_type = BlockBasedTableOptions::kBinarySearch;
if (rep_->table_properties) {
auto& props = rep_->table_properties->user_collected_properties;
auto pos = props.find(BlockBasedTablePropertyNames::kIndexType);
if (pos != props.end()) {
index_type = static_cast<BlockBasedTableOptions::IndexType>(
DecodeFixed32(pos->second.c_str()));
}
}
auto index_type = rep_->index_type;
auto file = rep_->file.get();
const auto& index_handle = rep_->index_handle;