Skip to content

Commit 188a3eb

Browse files
authored
Rename catalog_ member name (#2508)
### What problem does this PR solve? Rename member var ### Type of change - [x] Refactoring Signed-off-by: Jin Hai <[email protected]>
1 parent 3b8a13f commit 188a3eb

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

src/storage/storage.cpp

+24-24
Original file line numberDiff line numberDiff line change
@@ -258,24 +258,24 @@ Status Storage::AdminToWriter() {
258258
if (system_start_ts == 0) {
259259
// Init database, need to create default_db
260260
LOG_INFO(fmt::format("Init a new catalog"));
261-
new_catalog_ = Catalog::NewCatalog();
261+
catalog_ = Catalog::NewCatalog();
262262
}
263263

264264
i64 compact_interval = config_ptr_->CompactInterval() > 0 ? config_ptr_->CompactInterval() : 0;
265265
if (compact_interval > 0) {
266266
LOG_INFO(fmt::format("Init compaction alg"));
267-
new_catalog_->InitCompactionAlg(system_start_ts);
267+
catalog_->InitCompactionAlg(system_start_ts);
268268
} else {
269269
LOG_INFO(fmt::format("Skip init compaction alg"));
270270
}
271271

272-
BuiltinFunctions builtin_functions(new_catalog_);
272+
BuiltinFunctions builtin_functions(catalog_);
273273
builtin_functions.Init();
274274
// Catalog finish init here.
275275
if (bg_processor_ != nullptr) {
276276
UnrecoverableError("Background processor was initialized before.");
277277
}
278-
bg_processor_ = MakeUnique<BGTaskProcessor>(wal_mgr_.get(), new_catalog_.get());
278+
bg_processor_ = MakeUnique<BGTaskProcessor>(wal_mgr_.get(), catalog_.get());
279279

280280
// Construct txn manager
281281
if (txn_mgr_ != nullptr) {
@@ -294,7 +294,7 @@ Status Storage::AdminToWriter() {
294294
if (memory_index_tracer_ != nullptr) {
295295
UnrecoverableError("Memory index tracer was initialized before.");
296296
}
297-
memory_index_tracer_ = MakeUnique<BGMemIndexTracer>(config_ptr_->MemIndexMemoryQuota(), new_catalog_.get(), txn_mgr_.get());
297+
memory_index_tracer_ = MakeUnique<BGMemIndexTracer>(config_ptr_->MemIndexMemoryQuota(), catalog_.get(), txn_mgr_.get());
298298
cleanup_info_tracer_ = MakeUnique<CleanupInfoTracer>();
299299

300300
bg_processor_->Start();
@@ -308,12 +308,12 @@ Status Storage::AdminToWriter() {
308308
UnrecoverableError("compact processor was initialized before.");
309309
}
310310

311-
compact_processor_ = MakeUnique<CompactionProcessor>(new_catalog_.get(), txn_mgr_.get());
311+
compact_processor_ = MakeUnique<CompactionProcessor>(catalog_.get(), txn_mgr_.get());
312312
compact_processor_->Start();
313313

314314
// recover index after start compact process
315-
new_catalog_->StartMemoryIndexCommit();
316-
new_catalog_->MemIndexRecover(buffer_mgr_.get(), system_start_ts);
315+
catalog_->StartMemoryIndexCommit();
316+
catalog_->MemIndexRecover(buffer_mgr_.get(), system_start_ts);
317317

318318
if (periodic_trigger_thread_ != nullptr) {
319319
UnrecoverableError("periodic trigger was initialized before.");
@@ -331,7 +331,7 @@ Status Storage::AdminToWriter() {
331331
periodic_trigger_thread_->optimize_index_trigger_ = MakeShared<OptimizeIndexPeriodicTrigger>(optimize_interval, compact_processor_.get());
332332

333333
periodic_trigger_thread_->cleanup_trigger_ =
334-
MakeShared<CleanupPeriodicTrigger>(cleanup_interval, bg_processor_.get(), new_catalog_.get(), txn_mgr_.get());
334+
MakeShared<CleanupPeriodicTrigger>(cleanup_interval, bg_processor_.get(), catalog_.get(), txn_mgr_.get());
335335
bg_processor_->SetCleanupTrigger(periodic_trigger_thread_->cleanup_trigger_);
336336

337337
auto txn = txn_mgr_->BeginTxn(MakeUnique<String>("ForceCheckpointTask"), TransactionType::kNormal);
@@ -366,7 +366,7 @@ Status Storage::UnInitFromReader() {
366366
bg_processor_.reset();
367367
}
368368

369-
new_catalog_.reset();
369+
catalog_.reset();
370370

371371
if (memory_index_tracer_ != nullptr) {
372372
memory_index_tracer_.reset();
@@ -448,7 +448,7 @@ Status Storage::ReaderToWriter() {
448448
UnrecoverableError("compact processor was initialized before.");
449449
}
450450

451-
compact_processor_ = MakeUnique<CompactionProcessor>(new_catalog_.get(), txn_mgr_.get());
451+
compact_processor_ = MakeUnique<CompactionProcessor>(catalog_.get(), txn_mgr_.get());
452452
compact_processor_->Start();
453453

454454
periodic_trigger_thread_->Stop();
@@ -484,7 +484,7 @@ Status Storage::WriterToAdmin() {
484484
bg_processor_.reset();
485485
}
486486

487-
new_catalog_.reset();
487+
catalog_.reset();
488488

489489
memory_index_tracer_.reset();
490490

@@ -538,7 +538,7 @@ Status Storage::WriterToReader() {
538538

539539
periodic_trigger_thread_ = MakeUnique<PeriodicTriggerThread>();
540540
periodic_trigger_thread_->cleanup_trigger_ =
541-
MakeShared<CleanupPeriodicTrigger>(cleanup_interval, bg_processor_.get(), new_catalog_.get(), txn_mgr_.get());
541+
MakeShared<CleanupPeriodicTrigger>(cleanup_interval, bg_processor_.get(), catalog_.get(), txn_mgr_.get());
542542
bg_processor_->SetCleanupTrigger(periodic_trigger_thread_->cleanup_trigger_);
543543
periodic_trigger_thread_->Start();
544544

@@ -563,7 +563,7 @@ Status Storage::UnInitFromWriter() {
563563
bg_processor_.reset();
564564
}
565565

566-
new_catalog_.reset();
566+
catalog_.reset();
567567

568568
memory_index_tracer_.reset();
569569

@@ -712,13 +712,13 @@ Status Storage::AdminToReaderBottom(TxnTimeStamp system_start_ts) {
712712
UnrecoverableError(fmt::format("Expect current storage mode is READER with Phase1"));
713713
}
714714

715-
BuiltinFunctions builtin_functions(new_catalog_);
715+
BuiltinFunctions builtin_functions(catalog_);
716716
builtin_functions.Init();
717717
// Catalog finish init here.
718718
if (bg_processor_ != nullptr) {
719719
UnrecoverableError("Background processor was initialized before.");
720720
}
721-
bg_processor_ = MakeUnique<BGTaskProcessor>(wal_mgr_.get(), new_catalog_.get());
721+
bg_processor_ = MakeUnique<BGTaskProcessor>(wal_mgr_.get(), catalog_.get());
722722

723723
// Construct txn manager
724724
if (txn_mgr_ != nullptr) {
@@ -733,11 +733,11 @@ Status Storage::AdminToReaderBottom(TxnTimeStamp system_start_ts) {
733733
if (memory_index_tracer_ != nullptr) {
734734
UnrecoverableError("Memory index tracer was initialized before.");
735735
}
736-
memory_index_tracer_ = MakeUnique<BGMemIndexTracer>(config_ptr_->MemIndexMemoryQuota(), new_catalog_.get(), txn_mgr_.get());
736+
memory_index_tracer_ = MakeUnique<BGMemIndexTracer>(config_ptr_->MemIndexMemoryQuota(), catalog_.get(), txn_mgr_.get());
737737
cleanup_info_tracer_ = MakeUnique<CleanupInfoTracer>();
738738

739-
new_catalog_->StartMemoryIndexCommit();
740-
new_catalog_->MemIndexRecover(buffer_mgr_.get(), system_start_ts);
739+
catalog_->StartMemoryIndexCommit();
740+
catalog_->MemIndexRecover(buffer_mgr_.get(), system_start_ts);
741741

742742
bg_processor_->Start();
743743

@@ -748,7 +748,7 @@ Status Storage::AdminToReaderBottom(TxnTimeStamp system_start_ts) {
748748

749749
i64 cleanup_interval = config_ptr_->CleanupInterval() > 0 ? config_ptr_->CleanupInterval() : 0;
750750
periodic_trigger_thread_->cleanup_trigger_ =
751-
MakeShared<CleanupPeriodicTrigger>(cleanup_interval, bg_processor_.get(), new_catalog_.get(), txn_mgr_.get());
751+
MakeShared<CleanupPeriodicTrigger>(cleanup_interval, bg_processor_.get(), catalog_.get(), txn_mgr_.get());
752752
bg_processor_->SetCleanupTrigger(periodic_trigger_thread_->cleanup_trigger_);
753753

754754
periodic_trigger_thread_->Start();
@@ -759,16 +759,16 @@ Status Storage::AdminToReaderBottom(TxnTimeStamp system_start_ts) {
759759
}
760760

761761
void Storage::AttachCatalog(const FullCatalogFileInfo &full_ckp_info, const Vector<DeltaCatalogFileInfo> &delta_ckp_infos) {
762-
new_catalog_ = Catalog::LoadFromFiles(full_ckp_info, delta_ckp_infos, buffer_mgr_.get());
762+
catalog_ = Catalog::LoadFromFiles(full_ckp_info, delta_ckp_infos, buffer_mgr_.get());
763763
}
764764

765765
void Storage::LoadFullCheckpoint(const String &checkpoint_path) {
766-
if (new_catalog_.get() != nullptr) {
766+
if (catalog_.get() != nullptr) {
767767
UnrecoverableError("Catalog was already initialized before.");
768768
}
769-
new_catalog_ = Catalog::LoadFullCheckpoint(checkpoint_path);
769+
catalog_ = Catalog::LoadFullCheckpoint(checkpoint_path);
770770
}
771-
void Storage::AttachDeltaCheckpoint(const String &checkpoint_path) { new_catalog_->AttachDeltaCheckpoint(checkpoint_path); }
771+
void Storage::AttachDeltaCheckpoint(const String &checkpoint_path) { catalog_->AttachDeltaCheckpoint(checkpoint_path); }
772772

773773
void Storage::CreateDefaultDB() {
774774
Txn *new_txn = txn_mgr_->BeginTxn(MakeUnique<String>("create db1"), TransactionType::kNormal);

src/storage/storage.cppm

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public:
4949

5050
~Storage();
5151

52-
[[nodiscard]] inline Catalog *catalog() noexcept { return new_catalog_.get(); }
52+
[[nodiscard]] inline Catalog *catalog() noexcept { return catalog_.get(); }
5353

5454
[[nodiscard]] inline BufferManager *buffer_manager() noexcept { return buffer_mgr_.get(); }
5555

@@ -112,7 +112,7 @@ private:
112112
UniquePtr<PersistenceManager> persistence_manager_{};
113113
UniquePtr<ResultCacheManager> result_cache_manager_{};
114114
UniquePtr<BufferManager> buffer_mgr_{};
115-
UniquePtr<Catalog> new_catalog_{};
115+
UniquePtr<Catalog> catalog_{};
116116
UniquePtr<BGMemIndexTracer> memory_index_tracer_{};
117117
UniquePtr<TxnManager> txn_mgr_{};
118118
UniquePtr<BGTaskProcessor> bg_processor_{};

0 commit comments

Comments
 (0)