Skip to content

Commit fdffa05

Browse files
committed
Rename cmp_db and cmp_cfhs
1 parent 2479ca0 commit fdffa05

4 files changed

+26
-23
lines changed

db_stress_tool/cf_consistency_stress.cc

+5-5
Original file line numberDiff line numberDiff line change
@@ -1040,17 +1040,17 @@ class CfConsistencyStressTest : public StressTest {
10401040
assert(thread);
10411041
Status status;
10421042

1043-
DB* db_ptr = cmp_db_ ? cmp_db_ : db_;
1044-
const auto& cfhs = cmp_db_ ? cmp_cfhs_ : column_families_;
1043+
DB* db_ptr = secondary_db_ ? secondary_db_ : db_;
1044+
const auto& cfhs = secondary_db_ ? secondary_cfhs_ : column_families_;
10451045

10461046
// Take a snapshot to preserve the state of primary db.
10471047
ManagedSnapshot snapshot_guard(db_);
10481048

10491049
SharedState* shared = thread->shared;
10501050
assert(shared);
10511051

1052-
if (cmp_db_) {
1053-
status = cmp_db_->TryCatchUpWithPrimary();
1052+
if (secondary_db_) {
1053+
status = secondary_db_->TryCatchUpWithPrimary();
10541054
if (!status.ok()) {
10551055
fprintf(stderr, "TryCatchUpWithPrimary: %s\n",
10561056
status.ToString().c_str());
@@ -1083,7 +1083,7 @@ class CfConsistencyStressTest : public StressTest {
10831083
// `FLAGS_rate_limit_user_ops` to avoid slowing any validation.
10841084
ReadOptions ropts(FLAGS_verify_checksum, true);
10851085
ropts.total_order_seek = true;
1086-
if (nullptr == cmp_db_) {
1086+
if (nullptr == secondary_db_) {
10871087
ropts.snapshot = snapshot_guard.snapshot();
10881088
}
10891089
uint32_t crc = 0;

db_stress_tool/db_stress_test_base.cc

+7-6
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ StressTest::StressTest()
6969
new_column_family_name_(1),
7070
num_times_reopened_(0),
7171
db_preload_finished_(false),
72-
cmp_db_(nullptr),
72+
secondary_db_(nullptr),
7373
is_db_stopped_(false) {
7474
if (FLAGS_destroy_db_initially) {
7575
std::vector<std::string> files;
@@ -114,11 +114,11 @@ void StressTest::CleanUp() {
114114
delete db_;
115115
db_ = nullptr;
116116

117-
for (auto* cf : cmp_cfhs_) {
117+
for (auto* cf : secondary_cfhs_) {
118118
delete cf;
119119
}
120-
cmp_cfhs_.clear();
121-
delete cmp_db_;
120+
secondary_cfhs_.clear();
121+
delete secondary_db_;
122122
}
123123

124124
std::shared_ptr<Cache> StressTest::NewCache(size_t capacity,
@@ -3696,9 +3696,10 @@ void StressTest::Open(SharedState* shared, bool reopen) {
36963696
tmp_opts.env = db_stress_env;
36973697
const std::string& secondary_path = FLAGS_secondaries_base;
36983698
s = DB::OpenAsSecondary(tmp_opts, FLAGS_db, secondary_path,
3699-
cf_descriptors, &cmp_cfhs_, &cmp_db_);
3699+
cf_descriptors, &secondary_cfhs_, &secondary_db_);
37003700
assert(s.ok());
3701-
assert(cmp_cfhs_.size() == static_cast<size_t>(FLAGS_column_families));
3701+
assert(secondary_cfhs_.size() ==
3702+
static_cast<size_t>(FLAGS_column_families));
37023703
}
37033704
} else {
37043705
DBWithTTL* db_with_ttl;

db_stress_tool/db_stress_test_base.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,8 @@ class StressTest {
412412
std::atomic<bool> db_preload_finished_;
413413
std::shared_ptr<SstQueryFilterConfigsManager::Factory> sqfc_factory_;
414414

415-
// Fields used for continuous verification from another thread
416-
DB* cmp_db_;
417-
std::vector<ColumnFamilyHandle*> cmp_cfhs_;
415+
DB* secondary_db_;
416+
std::vector<ColumnFamilyHandle*> secondary_cfhs_;
418417
bool is_db_stopped_;
419418
};
420419

db_stress_tool/no_batched_ops_stress.cc

+12-9
Original file line numberDiff line numberDiff line change
@@ -334,11 +334,11 @@ class NonBatchedOpsStressTest : public StressTest {
334334
}
335335

336336
void ContinuouslyVerifyDb(ThreadState* thread) const override {
337-
if (!cmp_db_) {
337+
if (!secondary_db_) {
338338
return;
339339
}
340-
assert(cmp_db_);
341-
assert(!cmp_cfhs_.empty());
340+
assert(secondary_db_);
341+
assert(!secondary_cfhs_.empty());
342342

343343
auto* shared = thread->shared;
344344
assert(shared);
@@ -362,7 +362,7 @@ class NonBatchedOpsStressTest : public StressTest {
362362
pre_read_expected_values.push_back(shared->Get(0, i));
363363
}
364364

365-
Status s = cmp_db_->TryCatchUpWithPrimary();
365+
Status s = secondary_db_->TryCatchUpWithPrimary();
366366
if (!s.ok()) {
367367
assert(false);
368368
exit(1);
@@ -433,22 +433,24 @@ class NonBatchedOpsStressTest : public StressTest {
433433

434434
static Random64 rand64(shared->GetSeed());
435435

436-
for (auto* handle : cmp_cfhs_) {
436+
for (auto* handle : secondary_cfhs_) {
437437
if (thread->rand.OneInOpt(3)) {
438438
// Use Get()
439439
uint64_t key = rand64.Uniform(static_cast<uint64_t>(max_key));
440440
std::string key_str = Key(key);
441441
std::string value;
442442
std::string key_ts;
443-
s = cmp_db_->Get(read_opts, handle, key_str, &value,
444-
FLAGS_user_timestamp_size > 0 ? &key_ts : nullptr);
443+
s = secondary_db_->Get(
444+
read_opts, handle, key_str, &value,
445+
FLAGS_user_timestamp_size > 0 ? &key_ts : nullptr);
445446
s.PermitUncheckedError();
446447
} else if (!FLAGS_inplace_update_support) {
447448
// The combination of inplace_update_support=true and backward iteration
448449
// is not allowed
449450

450451
// Use range scan
451-
std::unique_ptr<Iterator> iter(cmp_db_->NewIterator(read_opts, handle));
452+
std::unique_ptr<Iterator> iter(
453+
secondary_db_->NewIterator(read_opts, handle));
452454
uint32_t rnd = (thread->rand.Next()) % 4;
453455
if (0 == rnd) {
454456
// SeekToFirst() + Next()*5
@@ -480,7 +482,8 @@ class NonBatchedOpsStressTest : public StressTest {
480482
}
481483
} else {
482484
uint32_t crc = 0;
483-
std::unique_ptr<Iterator> it(cmp_db_->NewIterator(read_opts, handle));
485+
std::unique_ptr<Iterator> it(
486+
secondary_db_->NewIterator(read_opts, handle));
484487
s = checksum_column_family(it.get(), &crc);
485488
if (!s.ok()) {
486489
fprintf(stderr, "Computing checksum of default cf: %s\n",

0 commit comments

Comments
 (0)