Fix std::out_of_range when DBOptions::keep_log_file_num is zero
Summary: We should validate this option, otherwise we may see std::out_of_range thrown at: db/db_impl.cc:1124 1123 for (unsigned int i = 0; i <= end; i++) { 1124 std::string& to_delete = old_info_log_files.at(i); 1125 std::string full_path_to_delete = 1126 (immutable_db_options_.db_log_dir.empty() Closes https://github.com/facebook/rocksdb/pull/1722 Differential Revision: D4379495 Pulled By: yiwu-arbug fbshipit-source-id: e136552
This commit is contained in:
parent
4e35ffdfab
commit
5ac97314e7
@ -268,6 +268,10 @@ static Status ValidateOptions(
|
|||||||
"then direct I/O writes (use_direct_writes) must be disabled. ");
|
"then direct I/O writes (use_direct_writes) must be disabled. ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (db_options.keep_log_file_num == 0) {
|
||||||
|
return Status::InvalidArgument("keep_log_file_num must be greater than 0");
|
||||||
|
}
|
||||||
|
|
||||||
return Status::OK();
|
return Status::OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user