Skip to content

Commit 66a030c

Browse files
committed
Refactor task type name
Signed-off-by: Jin Hai <[email protected]>
1 parent d44be63 commit 66a030c

14 files changed

+43
-47
lines changed

src/executor/operator/physical_command_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ bool PhysicalCommand::Execute(QueryContext *query_context, OperatorState *operat
299299
Status status = Status::InvalidCommand(fmt::format("Attempt to set compact segment interval: {}", interval));
300300
RecoverableError(status);
301301
}
302-
query_context->storage()->periodic_trigger_thread()->compact_segment_trigger_->UpdateInternal(interval);
302+
query_context->storage()->periodic_trigger_thread()->compact_trigger_->UpdateInternal(interval);
303303
config->SetCompactInterval(interval);
304304
break;
305305
}

src/storage/background_process.cppm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import :blocking_queue;
1818

1919
namespace infinity {
2020

21-
class CleanupPeriodicTrigger;
2221
class BGTask;
2322

2423
export class BGTaskProcessor {

src/storage/background_process_impl.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void BGTaskProcessor::Process() {
7575
running = false;
7676
break;
7777
}
78-
case BGTaskType::kNewCheckpoint: {
78+
case BGTaskType::kCheckpoint: {
7979
StorageMode storage_mode = InfinityContext::instance().storage()->GetStorageMode();
8080
if (storage_mode == StorageMode::kUnInitialized) {
8181
UnrecoverableError("Uninitialized storage mode");
@@ -102,7 +102,7 @@ void BGTaskProcessor::Process() {
102102
}
103103
break;
104104
}
105-
case BGTaskType::kNewCleanup: {
105+
case BGTaskType::kCleanup: {
106106
StorageMode storage_mode = InfinityContext::instance().storage()->GetStorageMode();
107107
if (storage_mode == StorageMode::kUnInitialized) {
108108
UnrecoverableError("Uninitialized storage mode");
@@ -122,8 +122,8 @@ void BGTaskProcessor::Process() {
122122
CleanupTxnStore *cleanup_txn_store = static_cast<CleanupTxnStore *>(new_txn_shared->GetTxnStore());
123123
if (cleanup_txn_store != nullptr) {
124124
TxnTimeStamp clean_ts = cleanup_txn_store->timestamp_;
125-
std::shared_ptr<BGTaskInfo> bg_task_info = std::make_shared<BGTaskInfo>(BGTaskType::kNewCleanup);
126-
std::string task_text = fmt::format("NewCleanup task, cleanup timestamp: {}", clean_ts);
125+
std::shared_ptr<BGTaskInfo> bg_task_info = std::make_shared<BGTaskInfo>(BGTaskType::kCleanup);
126+
std::string task_text = fmt::format("Cleanup task, cleanup timestamp: {}", clean_ts);
127127
bg_task_info->task_info_list_.emplace_back(task_text);
128128
if (status.ok()) {
129129
bg_task_info->status_list_.emplace_back("OK");
@@ -133,7 +133,7 @@ void BGTaskProcessor::Process() {
133133
}
134134
new_txn_mgr->AddTaskInfo(bg_task_info);
135135
}
136-
LOG_DEBUG("NewCleanup task in background done");
136+
LOG_DEBUG("Cleanup task in background done");
137137
}
138138
break;
139139
}

src/storage/bg_task/bg_task.cppm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export struct CheckpointTaskBase : public BGTask {
9393
};
9494

9595
export struct NewCheckpointTask final : public CheckpointTaskBase {
96-
NewCheckpointTask(i64 wal_size) : CheckpointTaskBase(BGTaskType::kNewCheckpoint, false), wal_size_(wal_size) {}
96+
NewCheckpointTask(i64 wal_size) : CheckpointTaskBase(BGTaskType::kCheckpoint, false), wal_size_(wal_size) {}
9797

9898
std::string ToString() const final { return "New catalog"; }
9999

@@ -104,11 +104,11 @@ export struct NewCheckpointTask final : public CheckpointTaskBase {
104104
i64 wal_size_{};
105105
};
106106

107-
export class NewCleanupTask final : public BGTask {
107+
export class CleanupTask final : public BGTask {
108108
public:
109-
NewCleanupTask() : BGTask(BGTaskType::kNewCleanup, false) {}
109+
CleanupTask() : BGTask(BGTaskType::kCleanup, false) {}
110110

111-
std::string ToString() const override { return "NewCleanupTask"; }
111+
std::string ToString() const override { return "CleanupTask"; }
112112

113113
Status Execute(TxnTimeStamp last_cleanup_ts, TxnTimeStamp &cur_cleanup_ts);
114114

src/storage/bg_task/bg_task_impl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Status NewCheckpointTask::ExecuteWithNewTxn() {
5757

5858
auto *ckp_idx_store = static_cast<CheckpointTxnStore *>(new_txn_shared->GetTxnStore());
5959
if (ckp_idx_store != nullptr) {
60-
std::shared_ptr<BGTaskInfo> bg_task_info = std::make_shared<BGTaskInfo>(BGTaskType::kNewCheckpoint);
60+
std::shared_ptr<BGTaskInfo> bg_task_info = std::make_shared<BGTaskInfo>(BGTaskType::kCheckpoint);
6161
for (const std::shared_ptr<FlushDataEntry> &flush_data_entry : ckp_idx_store->entries_) {
6262
std::string task_text = fmt::format("Txn: {}, commit: {}, checkpoint data: {}.{}.{}.{} {}",
6363
new_txn_shared->TxnID(),
@@ -76,7 +76,7 @@ Status NewCheckpointTask::ExecuteWithNewTxn() {
7676
return status;
7777
}
7878

79-
Status NewCleanupTask::Execute(TxnTimeStamp last_cleanup_ts, TxnTimeStamp &cur_cleanup_ts) {
79+
Status CleanupTask::Execute(TxnTimeStamp last_cleanup_ts, TxnTimeStamp &cur_cleanup_ts) {
8080
auto *new_txn_mgr = InfinityContext::instance().storage()->new_txn_manager();
8181
auto *txn = new_txn_mgr->BeginTxn(std::make_unique<std::string>("cleanup"), TransactionType::kCleanup);
8282
Status status = txn->Cleanup();
@@ -88,7 +88,7 @@ Status NewCleanupTask::Execute(TxnTimeStamp last_cleanup_ts, TxnTimeStamp &cur_c
8888
}
8989

9090
NewCompactTask::NewCompactTask(NewTxn *new_txn, std::string db_name, std::string table_name)
91-
: BGTask(BGTaskType::kNewCompact, false), new_txn_(new_txn), db_name_(db_name), table_name_(table_name) {}
91+
: BGTask(BGTaskType::kCompact, false), new_txn_(new_txn), db_name_(db_name), table_name_(table_name) {}
9292

9393
DumpMemIndexTask::DumpMemIndexTask(const std::string &db_name,
9494
const std::string &table_name,

src/storage/bg_task/bg_task_type.cppm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ namespace infinity {
2727

2828
export enum class BGTaskType {
2929
kStopProcessor,
30-
kNewCheckpoint,
30+
kCheckpoint,
3131
kNotifyCompact,
32-
kNewCompact,
32+
kCompact,
3333
kNotifyOptimize,
34-
kNewCleanup,
34+
kCleanup,
3535
kUpdateSegmentBloomFilterData, // Not used
3636
kDumpMemIndex,
3737
kAppendMemIndex,

src/storage/bg_task/bg_task_type_impl.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,24 @@ std::string ToString(BGTaskType type) {
3434
return "StopProcessor";
3535
break;
3636
}
37-
case BGTaskType::kNewCheckpoint: {
38-
return "NewCheckpoint";
37+
case BGTaskType::kCheckpoint: {
38+
return "Checkpoint";
3939
break;
4040
}
4141
case BGTaskType::kNotifyCompact: {
4242
return "NotifyCompact";
4343
break;
4444
}
45-
case BGTaskType::kNewCompact: {
46-
return "NewCompact";
45+
case BGTaskType::kCompact: {
46+
return "Compact";
4747
break;
4848
}
4949
case BGTaskType::kNotifyOptimize: {
5050
return "NotifyOptimize";
5151
break;
5252
}
53-
case BGTaskType::kNewCleanup: {
54-
return "NewCleanup";
53+
case BGTaskType::kCleanup: {
54+
return "Cleanup";
5555
break;
5656
}
5757
case BGTaskType::kUpdateSegmentBloomFilterData: {

src/storage/bg_task/periodic_trigger.cppm

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import global_resource_usage;
2626

2727
namespace infinity {
2828

29-
class NewCleanupTask;
29+
class CleanupTask;
3030
class NotifyOptimizeTask;
3131
class NotifyCompactTask;
3232

@@ -58,16 +58,13 @@ protected:
5858
std::atomic_int64_t duration_{0};
5959
};
6060

61-
export class NewCleanupPeriodicTrigger final : public PeriodicTrigger {
61+
export class CleanupPeriodicTrigger final : public PeriodicTrigger {
6262
public:
63-
explicit NewCleanupPeriodicTrigger(const i64 interval) : PeriodicTrigger(interval) {}
63+
explicit CleanupPeriodicTrigger(const i64 interval) : PeriodicTrigger(interval) {}
6464

65-
std::shared_ptr<NewCleanupTask> CreateNewCleanupTask();
65+
std::shared_ptr<CleanupTask> CreateCleanupTask();
6666

6767
void Trigger() override;
68-
69-
private:
70-
//
7168
};
7269

7370
export class CheckpointPeriodicTrigger final : public PeriodicTrigger {
@@ -87,7 +84,7 @@ public:
8784
void Trigger() override;
8885

8986
private:
90-
CompactionProcessor *const compact_processor_{};
87+
CompactionProcessor *compact_processor_{};
9188
std::shared_ptr<NotifyCompactTask> compact_task_{};
9289
};
9390

@@ -101,7 +98,7 @@ public:
10198
void Trigger() override;
10299

103100
private:
104-
CompactionProcessor *const compact_processor_ = nullptr;
101+
CompactionProcessor *compact_processor_{};
105102
std::shared_ptr<NotifyOptimizeTask> optimize_task_{};
106103
};
107104

src/storage/bg_task/periodic_trigger_impl.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ bool PeriodicTrigger::Check() {
4545
return true;
4646
}
4747

48-
std::shared_ptr<NewCleanupTask> NewCleanupPeriodicTrigger::CreateNewCleanupTask() {
48+
std::shared_ptr<CleanupTask> CleanupPeriodicTrigger::CreateCleanupTask() {
4949
auto *bg_processor = InfinityContext::instance().storage()->bg_processor();
5050
auto *new_txn_mgr = InfinityContext::instance().storage()->new_txn_manager();
5151

@@ -55,11 +55,11 @@ std::shared_ptr<NewCleanupTask> NewCleanupPeriodicTrigger::CreateNewCleanupTask(
5555
return nullptr;
5656
}
5757

58-
return std::make_shared<NewCleanupTask>();
58+
return std::make_shared<CleanupTask>();
5959
}
6060

61-
void NewCleanupPeriodicTrigger::Trigger() {
62-
auto cleanup_task = CreateNewCleanupTask();
61+
void CleanupPeriodicTrigger::Trigger() {
62+
auto cleanup_task = CreateCleanupTask();
6363
if (!cleanup_task) {
6464
return;
6565
}

src/storage/compaction_process_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ void CompactionProcessor::Process() {
327327
running = false;
328328
break;
329329
}
330-
case BGTaskType::kNewCompact: {
330+
case BGTaskType::kCompact: {
331331
// Triggered by compact command
332332
StorageMode storage_mode = InfinityContext::instance().storage()->GetStorageMode();
333333
if (storage_mode == StorageMode::kUnInitialized) {

0 commit comments

Comments
 (0)