More valgrind issues!
Summary: Fix some more CompactionFilterV2 valgrind issues. Maybe it would make sense for CompactionFilterV2 to delete its prefix_extractor? Test Plan: ran CompactionFilterV2* tests with valgrind. issues before patch -> no issues after Reviewers: haobo, sdong, ljin, dhruba Reviewed By: dhruba CC: leveldb, danguo Differential Revision: https://reviews.facebook.net/D17337
This commit is contained in:
parent
550cca7192
commit
8a139a054c
@ -3707,9 +3707,11 @@ TEST(DBTest, CompactionFilterV2) {
|
|||||||
options.num_levels = 3;
|
options.num_levels = 3;
|
||||||
options.max_mem_compaction_level = 0;
|
options.max_mem_compaction_level = 0;
|
||||||
// extract prefix
|
// extract prefix
|
||||||
auto prefix_extractor = NewFixedPrefixTransform(8);
|
std::unique_ptr<const SliceTransform> prefix_extractor;
|
||||||
|
prefix_extractor.reset(NewFixedPrefixTransform(8));
|
||||||
|
|
||||||
options.compaction_filter_factory_v2
|
options.compaction_filter_factory_v2
|
||||||
= std::make_shared<KeepFilterFactoryV2>(prefix_extractor);
|
= std::make_shared<KeepFilterFactoryV2>(prefix_extractor.get());
|
||||||
// In a testing environment, we can only flush the application
|
// In a testing environment, we can only flush the application
|
||||||
// compaction filter buffer using universal compaction
|
// compaction filter buffer using universal compaction
|
||||||
option_config_ = kUniversalCompaction;
|
option_config_ = kUniversalCompaction;
|
||||||
@ -3757,7 +3759,7 @@ TEST(DBTest, CompactionFilterV2) {
|
|||||||
// create a new database with the compaction
|
// create a new database with the compaction
|
||||||
// filter in such a way that it deletes all keys
|
// filter in such a way that it deletes all keys
|
||||||
options.compaction_filter_factory_v2 =
|
options.compaction_filter_factory_v2 =
|
||||||
std::make_shared<DeleteFilterFactoryV2>(prefix_extractor);
|
std::make_shared<DeleteFilterFactoryV2>(prefix_extractor.get());
|
||||||
options.create_if_missing = true;
|
options.create_if_missing = true;
|
||||||
DestroyAndReopen(&options);
|
DestroyAndReopen(&options);
|
||||||
|
|
||||||
@ -3792,9 +3794,10 @@ TEST(DBTest, CompactionFilterV2WithValueChange) {
|
|||||||
Options options = CurrentOptions();
|
Options options = CurrentOptions();
|
||||||
options.num_levels = 3;
|
options.num_levels = 3;
|
||||||
options.max_mem_compaction_level = 0;
|
options.max_mem_compaction_level = 0;
|
||||||
auto prefix_extractor = NewFixedPrefixTransform(8);
|
std::unique_ptr<const SliceTransform> prefix_extractor;
|
||||||
|
prefix_extractor.reset(NewFixedPrefixTransform(8));
|
||||||
options.compaction_filter_factory_v2 =
|
options.compaction_filter_factory_v2 =
|
||||||
std::make_shared<ChangeFilterFactoryV2>(prefix_extractor);
|
std::make_shared<ChangeFilterFactoryV2>(prefix_extractor.get());
|
||||||
// In a testing environment, we can only flush the application
|
// In a testing environment, we can only flush the application
|
||||||
// compaction filter buffer using universal compaction
|
// compaction filter buffer using universal compaction
|
||||||
option_config_ = kUniversalCompaction;
|
option_config_ = kUniversalCompaction;
|
||||||
@ -3832,9 +3835,10 @@ TEST(DBTest, CompactionFilterV2NULLPrefix) {
|
|||||||
Options options = CurrentOptions();
|
Options options = CurrentOptions();
|
||||||
options.num_levels = 3;
|
options.num_levels = 3;
|
||||||
options.max_mem_compaction_level = 0;
|
options.max_mem_compaction_level = 0;
|
||||||
auto prefix_extractor = NewFixedPrefixTransform(8);
|
std::unique_ptr<const SliceTransform> prefix_extractor;
|
||||||
|
prefix_extractor.reset(NewFixedPrefixTransform(8));
|
||||||
options.compaction_filter_factory_v2 =
|
options.compaction_filter_factory_v2 =
|
||||||
std::make_shared<ChangeFilterFactoryV2>(prefix_extractor);
|
std::make_shared<ChangeFilterFactoryV2>(prefix_extractor.get());
|
||||||
// In a testing environment, we can only flush the application
|
// In a testing environment, we can only flush the application
|
||||||
// compaction filter buffer using universal compaction
|
// compaction filter buffer using universal compaction
|
||||||
option_config_ = kUniversalCompaction;
|
option_config_ = kUniversalCompaction;
|
||||||
|
Loading…
Reference in New Issue
Block a user