diff --git a/include/pika_consensus.h b/include/pika_consensus.h index c07312aa27..1dbb2c5ab3 100644 --- a/include/pika_consensus.h +++ b/include/pika_consensus.h @@ -164,14 +164,12 @@ class ConsensusCoordinator { return tmp_stream.str(); } - void IncrUnfinishedAsyncWriteDbTaskCount(int32_t step_size) { - unfinished_async_write_db_task_count_.fetch_add(step_size, std::memory_order::memory_order_seq_cst); - LOG(INFO) << "incur 1, curr:" << unfinished_async_write_db_task_count_.load(); + void IncrAsyncWriteDBTaskCount(int32_t step_size) { + async_write_db_task_count_.fetch_add(step_size, std::memory_order::memory_order_seq_cst); } - void DecrUnfinishedAsyncWriteDbTaskCount(int32_t step_size) { - unfinished_async_write_db_task_count_.fetch_sub(step_size, std::memory_order::memory_order_seq_cst); - LOG(INFO) << "decr 1, curr:" << unfinished_async_write_db_task_count_.load(); + void DecrAsyncWriteDBTaskCount(int32_t step_size) { + async_write_db_task_count_.fetch_sub(step_size, std::memory_order::memory_order_seq_cst); } private: @@ -213,6 +211,6 @@ class ConsensusCoordinator { //queued or being executing by WriteDBWorkers. If a flushdb-binlog need to apply DB, it must wait //util this count drop to zero. you can also check pika discussion #2807 to know more //it is only used in slaveNode when comsuming binlog - std::atomic unfinished_async_write_db_task_count_{0}; + std::atomic async_write_db_task_count_{0}; }; #endif // INCLUDE_PIKA_CONSENSUS_H_ diff --git a/include/pika_repl_client.h b/include/pika_repl_client.h index f03cdd33df..1fc245edd4 100644 --- a/include/pika_repl_client.h +++ b/include/pika_repl_client.h @@ -86,7 +86,7 @@ class PikaReplClient { std::hash str_hash; std::vector> write_binlog_workers_; //[NOTICE] the task queue of WriteDBWorker must never be deliberately cleared, - // because their queue size are related with ConsensusCoordinator::unfinished_async_write_db_task_count_ + // because their queue size are related with ConsensusCoordinator::async_write_db_task_count_ // check PR # /disscussion #2807 to know more std::vector> write_db_workers_; }; diff --git a/src/pika_consensus.cc b/src/pika_consensus.cc index 136b4c9468..28793d33f2 100644 --- a/src/pika_consensus.cc +++ b/src/pika_consensus.cc @@ -358,7 +358,7 @@ Status ConsensusCoordinator::ProcessLeaderLog(const std::shared_ptr& cmd_pt // this is a flushdb-binlog, both apply binlog and apply db are in sync way // ensure all writeDB task that submitted before has finished before we exec this flushdb int32_t wait_ms = 250; - while (unfinished_async_write_db_task_count_.load(std::memory_order::memory_order_seq_cst) > 0) { + while (async_write_db_task_count_.load(std::memory_order::memory_order_seq_cst) > 0) { std::this_thread::sleep_for(std::chrono::milliseconds(wait_ms)); wait_ms *= 2; wait_ms = wait_ms < 3000 ? wait_ms : 3000; diff --git a/src/pika_rm.cc b/src/pika_rm.cc index d55f5dfd80..bca8332eea 100644 --- a/src/pika_rm.cc +++ b/src/pika_rm.cc @@ -37,8 +37,7 @@ std::string SyncDB::DBName() { /* SyncMasterDB*/ SyncMasterDB::SyncMasterDB(const std::string& db_name) - : SyncDB(db_name), coordinator_(db_name) { -} + : SyncDB(db_name), coordinator_(db_name) {} int SyncMasterDB::GetNumberOfSlaveNode() { return coordinator_.SyncPros().SlaveSize(); }