sst_dump: Set dummy prefix extractor for binary search index in block based table
Summary: Now sst_dump fails in block based tables if binary search index is used, as it requires a prefix extractor. Add it. Test Plan: Run it against such a file to make sure it fixes the problem. Reviewers: yhchiang, kailiu Reviewed By: kailiu Subscribers: ljin, igor, dhruba, haobo, leveldb Differential Revision: https://reviews.facebook.net/D18927
This commit is contained in:
parent
5d870717ae
commit
b92a19a431
@ -266,5 +266,4 @@ uint64_t Compaction::OutputFilePreallocationSize() {
|
||||
return preallocation_size * 1.1;
|
||||
}
|
||||
|
||||
|
||||
} // namespace rocksdb
|
||||
|
@ -132,6 +132,16 @@ Status SstFileReader::SetTableOptionsByMagicNumber(uint64_t table_magic_number,
|
||||
if (table_magic_number == kBlockBasedTableMagicNumber) {
|
||||
options_.table_factory = std::make_shared<BlockBasedTableFactory>();
|
||||
fprintf(stdout, "Sst file format: block-based\n");
|
||||
auto& props = table_properties->user_collected_properties;
|
||||
auto pos = props.find(BlockBasedTablePropertyNames::kIndexType);
|
||||
if (pos != props.end()) {
|
||||
auto index_type_on_file = static_cast<BlockBasedTableOptions::IndexType>(
|
||||
DecodeFixed32(pos->second.c_str()));
|
||||
if (index_type_on_file ==
|
||||
BlockBasedTableOptions::IndexType::kHashSearch) {
|
||||
options_.prefix_extractor.reset(NewNoopTransform());
|
||||
}
|
||||
}
|
||||
} else if (table_magic_number == kPlainTableMagicNumber) {
|
||||
options_.allow_mmap_reads = true;
|
||||
options_.table_factory = std::make_shared<PlainTableFactory>(
|
||||
|
Loading…
Reference in New Issue
Block a user