add nullptr check to internal_prefix_transform

Summary: patch for D62361

Test Plan: make all check

Reviewers: sdong

Reviewed By: sdong

Subscribers: andrewkr, dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D62883
main
Aaron Gao 8 years ago
parent 4e395e875e
commit b18f9c9eac
  1. 3
      table/block_based_table_reader.cc

@ -556,8 +556,10 @@ Status BlockBasedTable::Open(const ImmutableCFOptions& ioptions,
rep->hash_index_allow_collision = table_options.hash_index_allow_collision; rep->hash_index_allow_collision = table_options.hash_index_allow_collision;
// We need to wrap data with internal_prefix_transform to make sure it can // We need to wrap data with internal_prefix_transform to make sure it can
// handle prefix correctly. // handle prefix correctly.
if (rep->ioptions.prefix_extractor != nullptr) {
rep->internal_prefix_transform.reset( rep->internal_prefix_transform.reset(
new InternalKeySliceTransform(rep->ioptions.prefix_extractor)); new InternalKeySliceTransform(rep->ioptions.prefix_extractor));
}
SetupCacheKeyPrefix(rep, file_size); SetupCacheKeyPrefix(rep, file_size);
unique_ptr<BlockBasedTable> new_table(new BlockBasedTable(rep)); unique_ptr<BlockBasedTable> new_table(new BlockBasedTable(rep));
@ -1690,6 +1692,7 @@ Status BlockBasedTable::CreateIndexReader(
meta_index_iter = meta_iter_guard.get(); meta_index_iter = meta_iter_guard.get();
} }
assert(rep_->internal_prefix_transform);
return HashIndexReader::Create( return HashIndexReader::Create(
rep_->internal_prefix_transform.get(), footer, file, rep_->ioptions, rep_->internal_prefix_transform.get(), footer, file, rep_->ioptions,
comparator, footer.index_handle(), meta_index_iter, index_reader, comparator, footer.index_handle(), meta_index_iter, index_reader,

Loading…
Cancel
Save