mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Consolidate SliceTransform object ownership
Summary: (1) Fix SanitizeOptions() to also check HashLinkList. The current dynamic case just happens to work because the 2 classes have the same layout. (2) Do not delete SliceTransform object in HashSkipListFactory and HashLinkListFactory destructor. Reason: SanitizeOptions() enforces prefix_extractor and SliceTransform to be the same object when Hash**Factory is used. This makes the behavior strange: when Hash**Factory is used, prefix_extractor will be released by RocksDB. If other memtable factory is used, prefix_extractor should be released by user. Test Plan: db_bench && make asan_check Reviewers: haobo, igor, sdong Reviewed By: igor CC: leveldb, dhruba Differential Revision: https://reviews.facebook.net/D16587
This commit is contained in:
@@ -240,8 +240,8 @@ int main(int argc, char** argv) {
|
||||
rocksdb::TableFactory* tf = new rocksdb::BlockBasedTableFactory();
|
||||
rocksdb::Options options;
|
||||
if (FLAGS_prefix_len < 16) {
|
||||
options.prefix_extractor = rocksdb::NewFixedPrefixTransform(
|
||||
FLAGS_prefix_len);
|
||||
options.prefix_extractor.reset(rocksdb::NewFixedPrefixTransform(
|
||||
FLAGS_prefix_len));
|
||||
}
|
||||
rocksdb::ReadOptions ro;
|
||||
rocksdb::EnvOptions env_options;
|
||||
@@ -254,8 +254,8 @@ int main(int argc, char** argv) {
|
||||
env_options.use_mmap_reads = true;
|
||||
tf = new rocksdb::PlainTableFactory(16, (FLAGS_prefix_len == 16) ? 0 : 8,
|
||||
0.75);
|
||||
options.prefix_extractor = rocksdb::NewFixedPrefixTransform(
|
||||
FLAGS_prefix_len);
|
||||
options.prefix_extractor.reset(rocksdb::NewFixedPrefixTransform(
|
||||
FLAGS_prefix_len));
|
||||
} else {
|
||||
tf = new rocksdb::BlockBasedTableFactory();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user