提交 635c61fd 编写于 作者: L Leonidas Galanis

Fix problem with create_if_missing option when wal_dir is used

Summary: When wal_dir is used, DestroyDB is not passed the wal_dir option and so we get a Corruption exception.

Test Plan:
Verified manually that the following command line works now:
./db_bench --db=/mnt/db/rocksdb ... --disable_wal=0 --wal_dir=/data/users/rocksdb/WAL... --benchmarks=filluniquerandom --use_existing_db=0...

Reviewers: sdong

Reviewed By: sdong

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D29859
上级 2871bc7b
......@@ -1367,11 +1367,13 @@ class Benchmark {
}
void Run() {
Options open_options; // keep options around to properly destroy db later
if (!SanityCheck()) {
exit(1);
}
PrintHeader();
Open();
Open(&open_options);
const char* benchmarks = FLAGS_benchmarks.c_str();
while (benchmarks != nullptr) {
const char* sep = strchr(benchmarks, ',');
......@@ -1532,15 +1534,15 @@ class Benchmark {
delete db_.db;
db_.db = nullptr;
db_.cfh.clear();
DestroyDB(FLAGS_db, Options());
DestroyDB(FLAGS_db, open_options);
}
for (size_t i = 0; i < multi_dbs_.size(); i++) {
delete multi_dbs_[i].db;
DestroyDB(GetDbNameForMultiple(FLAGS_db, i), Options());
DestroyDB(GetDbNameForMultiple(FLAGS_db, i), open_options);
}
multi_dbs_.clear();
}
Open();
Open(&open_options); // use open_options for the last accessed
}
if (method != nullptr) {
......@@ -1832,9 +1834,11 @@ class Benchmark {
}
}
void Open() {
void Open(Options* opts) {
Options& options = *opts;
assert(db_.db == nullptr);
Options options;
options.create_if_missing = !FLAGS_use_existing_db;
options.create_missing_column_families = FLAGS_num_column_families > 1;
options.db_write_buffer_size = FLAGS_db_write_buffer_size;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册