Downgrade option sanitiy check level for prefix_extractor

Summary:
With c7004840d2, it's safe to open a DB with different prefix extractor. So it's safe to skip prefix extractor check.
Closes https://github.com/facebook/rocksdb/pull/2474

Differential Revision: D5294700

Pulled By: siying

fbshipit-source-id: eeb500da795eecb29b8c9c56a14cfd4afda12ecc
main
Siying Dong 8 years ago committed by Facebook Github Bot
parent 6837a17621
commit 88cd2d96e7
  1. 1
      options/options_sanity_check.h
  2. 13
      options/options_test.cc
  3. 2
      utilities/options/options_util_test.cc

@ -29,7 +29,6 @@ static const std::unordered_map<std::string, OptionsSanityCheckLevel>
static const std::unordered_map<std::string, OptionsSanityCheckLevel> static const std::unordered_map<std::string, OptionsSanityCheckLevel>
sanity_level_cf_options = { sanity_level_cf_options = {
{"comparator", kSanityLevelLooselyCompatible}, {"comparator", kSanityLevelLooselyCompatible},
{"prefix_extractor", kSanityLevelLooselyCompatible},
{"table_factory", kSanityLevelLooselyCompatible}, {"table_factory", kSanityLevelLooselyCompatible},
{"merge_operator", kSanityLevelLooselyCompatible}}; {"merge_operator", kSanityLevelLooselyCompatible}};

@ -1462,13 +1462,15 @@ TEST_F(OptionsSanityCheckTest, SanityCheck) {
// use same prefix extractor but with different parameter // use same prefix extractor but with different parameter
opts.prefix_extractor.reset(NewCappedPrefixTransform(15)); opts.prefix_extractor.reset(NewCappedPrefixTransform(15));
// expect pass only in kSanityLevelNone // expect pass only in kSanityLevelLooselyCompatible
ASSERT_NOK(SanityCheckCFOptions(opts, kSanityLevelLooselyCompatible)); ASSERT_NOK(SanityCheckCFOptions(opts, kSanityLevelExactMatch));
ASSERT_OK(SanityCheckCFOptions(opts, kSanityLevelLooselyCompatible));
ASSERT_OK(SanityCheckCFOptions(opts, kSanityLevelNone)); ASSERT_OK(SanityCheckCFOptions(opts, kSanityLevelNone));
// repeat the test with FixedPrefixTransform // repeat the test with FixedPrefixTransform
opts.prefix_extractor.reset(NewFixedPrefixTransform(10)); 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)); ASSERT_OK(SanityCheckCFOptions(opts, kSanityLevelNone));
// persist the change of prefix_extractor // persist the change of prefix_extractor
@ -1477,8 +1479,9 @@ TEST_F(OptionsSanityCheckTest, SanityCheck) {
// use same prefix extractor but with different parameter // use same prefix extractor but with different parameter
opts.prefix_extractor.reset(NewFixedPrefixTransform(15)); opts.prefix_extractor.reset(NewFixedPrefixTransform(15));
// expect pass only in kSanityLevelNone // expect pass only in kSanityLevelLooselyCompatible
ASSERT_NOK(SanityCheckCFOptions(opts, kSanityLevelLooselyCompatible)); ASSERT_NOK(SanityCheckCFOptions(opts, kSanityLevelExactMatch));
ASSERT_OK(SanityCheckCFOptions(opts, kSanityLevelLooselyCompatible));
ASSERT_OK(SanityCheckCFOptions(opts, kSanityLevelNone)); ASSERT_OK(SanityCheckCFOptions(opts, kSanityLevelNone));
// Change prefix extractor from non-nullptr to nullptr // Change prefix extractor from non-nullptr to nullptr

@ -234,7 +234,7 @@ TEST_F(OptionsUtilTest, SanityCheck) {
CheckOptionsCompatibility(dbname_, Env::Default(), db_opt, cf_descs)); CheckOptionsCompatibility(dbname_, Env::Default(), db_opt, cf_descs));
cf_descs[1].options.prefix_extractor.reset(new DummySliceTransform()); cf_descs[1].options.prefix_extractor.reset(new DummySliceTransform());
ASSERT_NOK( ASSERT_OK(
CheckOptionsCompatibility(dbname_, Env::Default(), db_opt, cf_descs)); CheckOptionsCompatibility(dbname_, Env::Default(), db_opt, cf_descs));
cf_descs[1].options.prefix_extractor = prefix_extractor; cf_descs[1].options.prefix_extractor = prefix_extractor;

Loading…
Cancel
Save