Skip to content

Commit

Permalink
draft
Browse files Browse the repository at this point in the history
  • Loading branch information
hx235 committed Oct 25, 2023
1 parent dc87847 commit b69c67a
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions db_stress_tool/db_stress_test_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ void StressTest::PreloadDbAndReopenAsReadOnly(int64_t number_of_keys,
}

Status StressTest::SetOptions(ThreadState* thread) {
MutexLock l(thread->shared->GetMutex());
assert(FLAGS_set_options_one_in > 0);
std::unordered_map<std::string, std::string> opts;
std::string name =
Expand Down Expand Up @@ -1784,15 +1785,21 @@ Status StressTest::TestBackupRestore(
if (inplace_not_restore) {
BackupInfo& info = backup_info[thread->rand.Uniform(count)];
restore_options.env = info.env_for_open.get();
s = DB::OpenForReadOnly(DBOptions(restore_options), info.name_for_open,
cf_descriptors, &restored_cf_handles,
&restored_db);
{
MutexLock l(thread->shared->GetMutex());
s = DB::OpenForReadOnly(DBOptions(restore_options), info.name_for_open,
cf_descriptors, &restored_cf_handles,
&restored_db);
}
if (!s.ok()) {
from = "DB::OpenForReadOnly in backup/restore";
}
} else {
s = DB::Open(DBOptions(restore_options), restore_dir, cf_descriptors,
&restored_cf_handles, &restored_db);
{
MutexLock l(thread->shared->GetMutex());
s = DB::Open(DBOptions(restore_options), restore_dir, cf_descriptors,
&restored_cf_handles, &restored_db);
}
if (!s.ok()) {
from = "DB::Open in backup/restore";
}
Expand Down

0 comments on commit b69c67a

Please sign in to comment.