提交 e3149358 编写于 作者: P Peter Dillinger 提交者: Facebook GitHub Bot

More backup/restore stress test fixes (#7361)

Summary:
(a) Missed a case in updating handling of rand_keys
(b) Only opening restored db with DB::Open so don't (yet)
attempt to open restored BlobDB or TransactionDB.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/7361

Test Plan: better than being broken

Reviewed By: ajkr

Differential Revision: D23592570

Pulled By: pdillinger

fbshipit-source-id: dd1d999bcc0c852ee77cb6041964ec4abc0fd4fd
上级 7b1d6c43
......@@ -1313,7 +1313,8 @@ Status StressTest::TestBackupRestore(
}
DB* restored_db = nullptr;
std::vector<ColumnFamilyHandle*> restored_cf_handles;
if (s.ok()) {
// Not yet implemented: opening restored BlobDB or TransactionDB
if (s.ok() && !FLAGS_use_txn && !FLAGS_use_blob_db) {
Options restore_options(options_);
restore_options.listeners.clear();
std::vector<ColumnFamilyDescriptor> cf_descriptors;
......@@ -1337,7 +1338,8 @@ Status StressTest::TestBackupRestore(
//
// For simplicity, currently only verifies existence/non-existence of a
// single key
for (size_t i = 0; from_latest && s.ok() && i < rand_column_families.size();
for (size_t i = 0;
from_latest && restored_db && s.ok() && i < rand_column_families.size();
++i) {
std::string key_str = Key(rand_keys[0]);
Slice key = key_str;
......@@ -1345,7 +1347,7 @@ Status StressTest::TestBackupRestore(
Status get_status = restored_db->Get(
ReadOptions(), restored_cf_handles[rand_column_families[i]], key,
&restored_value);
bool exists = thread->shared->Exists(rand_column_families[i], rand_keys[i]);
bool exists = thread->shared->Exists(rand_column_families[i], rand_keys[0]);
if (get_status.ok()) {
if (!exists) {
s = Status::Corruption("key exists in restore but not in original db");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册