@@ -258,24 +258,24 @@ Status Storage::AdminToWriter() {
258
258
if (system_start_ts == 0 ) {
259
259
// Init database, need to create default_db
260
260
LOG_INFO (fmt::format (" Init a new catalog" ));
261
- new_catalog_ = Catalog::NewCatalog ();
261
+ catalog_ = Catalog::NewCatalog ();
262
262
}
263
263
264
264
i64 compact_interval = config_ptr_->CompactInterval () > 0 ? config_ptr_->CompactInterval () : 0 ;
265
265
if (compact_interval > 0 ) {
266
266
LOG_INFO (fmt::format (" Init compaction alg" ));
267
- new_catalog_ ->InitCompactionAlg (system_start_ts);
267
+ catalog_ ->InitCompactionAlg (system_start_ts);
268
268
} else {
269
269
LOG_INFO (fmt::format (" Skip init compaction alg" ));
270
270
}
271
271
272
- BuiltinFunctions builtin_functions (new_catalog_ );
272
+ BuiltinFunctions builtin_functions (catalog_ );
273
273
builtin_functions.Init ();
274
274
// Catalog finish init here.
275
275
if (bg_processor_ != nullptr ) {
276
276
UnrecoverableError (" Background processor was initialized before." );
277
277
}
278
- bg_processor_ = MakeUnique<BGTaskProcessor>(wal_mgr_.get (), new_catalog_ .get ());
278
+ bg_processor_ = MakeUnique<BGTaskProcessor>(wal_mgr_.get (), catalog_ .get ());
279
279
280
280
// Construct txn manager
281
281
if (txn_mgr_ != nullptr ) {
@@ -294,7 +294,7 @@ Status Storage::AdminToWriter() {
294
294
if (memory_index_tracer_ != nullptr ) {
295
295
UnrecoverableError (" Memory index tracer was initialized before." );
296
296
}
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 ());
298
298
cleanup_info_tracer_ = MakeUnique<CleanupInfoTracer>();
299
299
300
300
bg_processor_->Start ();
@@ -308,12 +308,12 @@ Status Storage::AdminToWriter() {
308
308
UnrecoverableError (" compact processor was initialized before." );
309
309
}
310
310
311
- compact_processor_ = MakeUnique<CompactionProcessor>(new_catalog_ .get (), txn_mgr_.get ());
311
+ compact_processor_ = MakeUnique<CompactionProcessor>(catalog_ .get (), txn_mgr_.get ());
312
312
compact_processor_->Start ();
313
313
314
314
// 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);
317
317
318
318
if (periodic_trigger_thread_ != nullptr ) {
319
319
UnrecoverableError (" periodic trigger was initialized before." );
@@ -331,7 +331,7 @@ Status Storage::AdminToWriter() {
331
331
periodic_trigger_thread_->optimize_index_trigger_ = MakeShared<OptimizeIndexPeriodicTrigger>(optimize_interval, compact_processor_.get ());
332
332
333
333
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 ());
335
335
bg_processor_->SetCleanupTrigger (periodic_trigger_thread_->cleanup_trigger_ );
336
336
337
337
auto txn = txn_mgr_->BeginTxn (MakeUnique<String>(" ForceCheckpointTask" ), TransactionType::kNormal );
@@ -366,7 +366,7 @@ Status Storage::UnInitFromReader() {
366
366
bg_processor_.reset ();
367
367
}
368
368
369
- new_catalog_ .reset ();
369
+ catalog_ .reset ();
370
370
371
371
if (memory_index_tracer_ != nullptr ) {
372
372
memory_index_tracer_.reset ();
@@ -448,7 +448,7 @@ Status Storage::ReaderToWriter() {
448
448
UnrecoverableError (" compact processor was initialized before." );
449
449
}
450
450
451
- compact_processor_ = MakeUnique<CompactionProcessor>(new_catalog_ .get (), txn_mgr_.get ());
451
+ compact_processor_ = MakeUnique<CompactionProcessor>(catalog_ .get (), txn_mgr_.get ());
452
452
compact_processor_->Start ();
453
453
454
454
periodic_trigger_thread_->Stop ();
@@ -484,7 +484,7 @@ Status Storage::WriterToAdmin() {
484
484
bg_processor_.reset ();
485
485
}
486
486
487
- new_catalog_ .reset ();
487
+ catalog_ .reset ();
488
488
489
489
memory_index_tracer_.reset ();
490
490
@@ -538,7 +538,7 @@ Status Storage::WriterToReader() {
538
538
539
539
periodic_trigger_thread_ = MakeUnique<PeriodicTriggerThread>();
540
540
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 ());
542
542
bg_processor_->SetCleanupTrigger (periodic_trigger_thread_->cleanup_trigger_ );
543
543
periodic_trigger_thread_->Start ();
544
544
@@ -563,7 +563,7 @@ Status Storage::UnInitFromWriter() {
563
563
bg_processor_.reset ();
564
564
}
565
565
566
- new_catalog_ .reset ();
566
+ catalog_ .reset ();
567
567
568
568
memory_index_tracer_.reset ();
569
569
@@ -712,13 +712,13 @@ Status Storage::AdminToReaderBottom(TxnTimeStamp system_start_ts) {
712
712
UnrecoverableError (fmt::format (" Expect current storage mode is READER with Phase1" ));
713
713
}
714
714
715
- BuiltinFunctions builtin_functions (new_catalog_ );
715
+ BuiltinFunctions builtin_functions (catalog_ );
716
716
builtin_functions.Init ();
717
717
// Catalog finish init here.
718
718
if (bg_processor_ != nullptr ) {
719
719
UnrecoverableError (" Background processor was initialized before." );
720
720
}
721
- bg_processor_ = MakeUnique<BGTaskProcessor>(wal_mgr_.get (), new_catalog_ .get ());
721
+ bg_processor_ = MakeUnique<BGTaskProcessor>(wal_mgr_.get (), catalog_ .get ());
722
722
723
723
// Construct txn manager
724
724
if (txn_mgr_ != nullptr ) {
@@ -733,11 +733,11 @@ Status Storage::AdminToReaderBottom(TxnTimeStamp system_start_ts) {
733
733
if (memory_index_tracer_ != nullptr ) {
734
734
UnrecoverableError (" Memory index tracer was initialized before." );
735
735
}
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 ());
737
737
cleanup_info_tracer_ = MakeUnique<CleanupInfoTracer>();
738
738
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);
741
741
742
742
bg_processor_->Start ();
743
743
@@ -748,7 +748,7 @@ Status Storage::AdminToReaderBottom(TxnTimeStamp system_start_ts) {
748
748
749
749
i64 cleanup_interval = config_ptr_->CleanupInterval () > 0 ? config_ptr_->CleanupInterval () : 0 ;
750
750
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 ());
752
752
bg_processor_->SetCleanupTrigger (periodic_trigger_thread_->cleanup_trigger_ );
753
753
754
754
periodic_trigger_thread_->Start ();
@@ -759,16 +759,16 @@ Status Storage::AdminToReaderBottom(TxnTimeStamp system_start_ts) {
759
759
}
760
760
761
761
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 ());
763
763
}
764
764
765
765
void Storage::LoadFullCheckpoint (const String &checkpoint_path) {
766
- if (new_catalog_ .get () != nullptr ) {
766
+ if (catalog_ .get () != nullptr ) {
767
767
UnrecoverableError (" Catalog was already initialized before." );
768
768
}
769
- new_catalog_ = Catalog::LoadFullCheckpoint (checkpoint_path);
769
+ catalog_ = Catalog::LoadFullCheckpoint (checkpoint_path);
770
770
}
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); }
772
772
773
773
void Storage::CreateDefaultDB () {
774
774
Txn *new_txn = txn_mgr_->BeginTxn (MakeUnique<String>(" create db1" ), TransactionType::kNormal );
0 commit comments