Fixes db_bench with blob db

Summary:
* Create info log before db open to make blob db able to log to LOG file.
* Properly destroy blob db.
Closes https://github.com/facebook/rocksdb/pull/2567

Differential Revision: D5400034

Pulled By: yiwu-arbug

fbshipit-source-id: a49cfaf4b5c67d42d4cbb872bd5a9441828c17ce
This commit is contained in:
Yi Wu 2017-07-11 14:05:39 -07:00 committed by Facebook Github Bot
parent fcd99d27c9
commit c32f27223b

View file

@ -2136,6 +2136,11 @@ class Benchmark {
if (!FLAGS_wal_dir.empty()) { if (!FLAGS_wal_dir.empty()) {
options.wal_dir = FLAGS_wal_dir; options.wal_dir = FLAGS_wal_dir;
} }
#ifndef ROCKSDB_LITE
if (use_blob_db_) {
blob_db::DestroyBlobDB(FLAGS_db, options, blob_db::BlobDBOptions());
}
#endif // !ROCKSDB_LITE
DestroyDB(FLAGS_db, options); DestroyDB(FLAGS_db, options);
if (!FLAGS_wal_dir.empty()) { if (!FLAGS_wal_dir.empty()) {
FLAGS_env->DeleteDir(FLAGS_wal_dir); FLAGS_env->DeleteDir(FLAGS_wal_dir);
@ -3238,7 +3243,7 @@ void VerifyDBFromDB(std::string& truth_db_name) {
InitializeOptionsGeneral(opts); InitializeOptionsGeneral(opts);
} }
void OpenDb(const Options& options, const std::string& db_name, void OpenDb(Options options, const std::string& db_name,
DBWithColumnFamilies* db) { DBWithColumnFamilies* db) {
Status s; Status s;
// Open with column families if necessary. // Open with column families if necessary.
@ -3293,14 +3298,20 @@ void VerifyDBFromDB(std::string& truth_db_name) {
} else if (FLAGS_transaction_db) { } else if (FLAGS_transaction_db) {
TransactionDB* ptr; TransactionDB* ptr;
TransactionDBOptions txn_db_options; TransactionDBOptions txn_db_options;
s = TransactionDB::Open(options, txn_db_options, db_name, &ptr); s = CreateLoggerFromOptions(db_name, options, &options.info_log);
if (s.ok()) {
s = TransactionDB::Open(options, txn_db_options, db_name, &ptr);
}
if (s.ok()) { if (s.ok()) {
db->db = ptr; db->db = ptr;
} }
} else if (FLAGS_use_blob_db) { } else if (FLAGS_use_blob_db) {
blob_db::BlobDBOptions blob_db_options; blob_db::BlobDBOptions blob_db_options;
blob_db::BlobDB* ptr; blob_db::BlobDB* ptr;
s = blob_db::BlobDB::Open(options, blob_db_options, db_name, &ptr); s = CreateLoggerFromOptions(db_name, options, &options.info_log);
if (s.ok()) {
s = blob_db::BlobDB::Open(options, blob_db_options, db_name, &ptr);
}
if (s.ok()) { if (s.ok()) {
db->db = ptr; db->db = ptr;
} }