Skip to content

Commit

Permalink
disable ignore_unknown_options only for lower version (#256)
Browse files Browse the repository at this point in the history
Only enable force option check when reading options file from lower version.

Signed-off-by: tabokie <xy.tao@outlook.com>
  • Loading branch information
tabokie committed Sep 17, 2021
1 parent 24213c4 commit f236fe4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions options/options_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,11 @@ Status RocksDBOptionsParser::Parse(const ConfigOptions& config_options_in,
return s;
}

// If the option file is not generated by a higher minor version,
// If the option file is generated by a lower minor version,
// there shouldn't be any unknown option.
if (ignore_unknown_options && section == kOptionSectionVersion) {
if (db_version[0] < ROCKSDB_MAJOR || (db_version[0] == ROCKSDB_MAJOR &&
db_version[1] <= ROCKSDB_MINOR)) {
if (db_version[0] < ROCKSDB_MAJOR ||
(db_version[0] == ROCKSDB_MAJOR && db_version[1] < ROCKSDB_MINOR)) {
ignore_unknown_options = false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion options/options_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,7 @@ TEST_F(OptionsParserTest, IgnoreUnknownOptions) {
bool should_ignore = true;
if (case_id == 0) {
// same version
should_ignore = false;
should_ignore = true;
version_string =
ToString(ROCKSDB_MAJOR) + "." + ToString(ROCKSDB_MINOR) + ".0";
} else if (case_id == 1) {
Expand Down

0 comments on commit f236fe4

Please sign in to comment.