Skip to content

Commit

Permalink
Downgrade option sanitiy check level for prefix_extractor
Browse files Browse the repository at this point in the history
Summary:
With c700484, it's safe to open a DB with different prefix extractor. So it's safe to skip prefix extractor check.
Closes facebook#2474

Differential Revision: D5294700

Pulled By: siying

fbshipit-source-id: eeb500da795eecb29b8c9c56a14cfd4afda12ecc
  • Loading branch information
siying authored and facebook-github-bot committed Jun 22, 2017
1 parent 6837a17 commit 88cd2d9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 0 additions & 1 deletion options/options_sanity_check.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ static const std::unordered_map<std::string, OptionsSanityCheckLevel>
static const std::unordered_map<std::string, OptionsSanityCheckLevel>
sanity_level_cf_options = {
{"comparator", kSanityLevelLooselyCompatible},
{"prefix_extractor", kSanityLevelLooselyCompatible},
{"table_factory", kSanityLevelLooselyCompatible},
{"merge_operator", kSanityLevelLooselyCompatible}};

Expand Down
13 changes: 8 additions & 5 deletions options/options_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1462,13 +1462,15 @@ TEST_F(OptionsSanityCheckTest, SanityCheck) {

// use same prefix extractor but with different parameter
opts.prefix_extractor.reset(NewCappedPrefixTransform(15));
// expect pass only in kSanityLevelNone
ASSERT_NOK(SanityCheckCFOptions(opts, kSanityLevelLooselyCompatible));
// expect pass only in kSanityLevelLooselyCompatible
ASSERT_NOK(SanityCheckCFOptions(opts, kSanityLevelExactMatch));
ASSERT_OK(SanityCheckCFOptions(opts, kSanityLevelLooselyCompatible));
ASSERT_OK(SanityCheckCFOptions(opts, kSanityLevelNone));

// repeat the test with FixedPrefixTransform
opts.prefix_extractor.reset(NewFixedPrefixTransform(10));
ASSERT_NOK(SanityCheckCFOptions(opts, kSanityLevelLooselyCompatible));
ASSERT_NOK(SanityCheckCFOptions(opts, kSanityLevelExactMatch));
ASSERT_OK(SanityCheckCFOptions(opts, kSanityLevelLooselyCompatible));
ASSERT_OK(SanityCheckCFOptions(opts, kSanityLevelNone));

// persist the change of prefix_extractor
Expand All @@ -1477,8 +1479,9 @@ TEST_F(OptionsSanityCheckTest, SanityCheck) {

// use same prefix extractor but with different parameter
opts.prefix_extractor.reset(NewFixedPrefixTransform(15));
// expect pass only in kSanityLevelNone
ASSERT_NOK(SanityCheckCFOptions(opts, kSanityLevelLooselyCompatible));
// expect pass only in kSanityLevelLooselyCompatible
ASSERT_NOK(SanityCheckCFOptions(opts, kSanityLevelExactMatch));
ASSERT_OK(SanityCheckCFOptions(opts, kSanityLevelLooselyCompatible));
ASSERT_OK(SanityCheckCFOptions(opts, kSanityLevelNone));

// Change prefix extractor from non-nullptr to nullptr
Expand Down
2 changes: 1 addition & 1 deletion utilities/options/options_util_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ TEST_F(OptionsUtilTest, SanityCheck) {
CheckOptionsCompatibility(dbname_, Env::Default(), db_opt, cf_descs));

cf_descs[1].options.prefix_extractor.reset(new DummySliceTransform());
ASSERT_NOK(
ASSERT_OK(
CheckOptionsCompatibility(dbname_, Env::Default(), db_opt, cf_descs));

cf_descs[1].options.prefix_extractor = prefix_extractor;
Expand Down

0 comments on commit 88cd2d9

Please sign in to comment.