This is an automated email from the ASF dual-hosted git repository. wangdan pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git
The following commit(s) were added to refs/heads/master by this push: new a65d1f472 feat: introduce a new task code for replicas stat (#2169) a65d1f472 is described below commit a65d1f472e895cd5c2d7211a120acb09753c98d4 Author: Dan Wang <wang...@apache.org> AuthorDate: Tue Dec 17 15:02:58 2024 +0800 feat: introduce a new task code for replicas stat (#2169) Currently calculating stats for replicas is still controlled by a configuration of `gc_disabled` and based on the task code of "garbage collect", which is already the legacy for GC of shared logs. We could introduce individual controller and task code for the replicas stats. Configurations are changed as follows: ```diff [replication] + replicas_stat_disabled = false - gc_disabled = false ``` --- src/common/replication.codes.h | 1 + src/replica/replica_stub.cpp | 11 ++++------- src/replica/replica_stub.h | 3 ++- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/common/replication.codes.h b/src/common/replication.codes.h index a2c29ef45..7bbb775b1 100644 --- a/src/common/replication.codes.h +++ b/src/common/replication.codes.h @@ -199,6 +199,7 @@ MAKE_EVENT_CODE(LPC_OPEN_REPLICA, TASK_PRIORITY_COMMON) MAKE_EVENT_CODE(LPC_CLOSE_REPLICA, TASK_PRIORITY_COMMON) MAKE_EVENT_CODE(LPC_CHECKPOINT_REPLICA, TASK_PRIORITY_COMMON) MAKE_EVENT_CODE(LPC_CATCHUP_WITH_PRIVATE_LOGS, TASK_PRIORITY_COMMON) +MAKE_EVENT_CODE(LPC_REPLICAS_STAT, TASK_PRIORITY_COMMON) MAKE_EVENT_CODE(LPC_DISK_STAT, TASK_PRIORITY_COMMON) MAKE_EVENT_CODE(LPC_BACKGROUND_COLD_BACKUP, TASK_PRIORITY_COMMON) MAKE_EVENT_CODE(LPC_PARTITION_SPLIT_ASYNC_LEARN, TASK_PRIORITY_COMMON) diff --git a/src/replica/replica_stub.cpp b/src/replica/replica_stub.cpp index 7a51ee4ca..2e4eec66e 100644 --- a/src/replica/replica_stub.cpp +++ b/src/replica/replica_stub.cpp @@ -276,11 +276,6 @@ DSN_DEFINE_bool(replication, mem_release_enabled, true, "whether to enable periodic memory release"); -DSN_DEFINE_bool( - replication, - gc_disabled, - false, - "Whether to disable replica statistics. The name contains 'gc' is for legacy reason"); DSN_DEFINE_bool(replication, disk_stat_disabled, false, "whether to disable disk stat"); DSN_DEFINE_bool( replication, @@ -341,6 +336,8 @@ bool check_mem_release_max_reserved_mem_percentage(int32_t value) DSN_DEFINE_validator(mem_release_max_reserved_mem_percentage, &check_mem_release_max_reserved_mem_percentage); +DSN_DEFINE_bool(replication, replicas_stat_disabled, false, "whether to disable replicas stat"); + DSN_DEFINE_uint32(replication, replicas_stat_interval_ms, 30000, @@ -630,9 +627,9 @@ void replica_stub::initialize(const replication_options &opts, bool clear /* = f } // replicas stat - if (!FLAGS_gc_disabled) { + if (!FLAGS_replicas_stat_disabled) { _replicas_stat_timer_task = tasking::enqueue_timer( - LPC_GARBAGE_COLLECT_LOGS_AND_REPLICAS, + LPC_REPLICAS_STAT, &_tracker, [this] { on_replicas_stat(); }, std::chrono::milliseconds(FLAGS_replicas_stat_interval_ms), diff --git a/src/replica/replica_stub.h b/src/replica/replica_stub.h index 328e97502..d3b860076 100644 --- a/src/replica/replica_stub.h +++ b/src/replica/replica_stub.h @@ -184,7 +184,6 @@ public: // void on_meta_server_connected(); void on_meta_server_disconnected(); - void on_replicas_stat(); void on_disk_stat(); // @@ -385,6 +384,8 @@ private: }; using replica_stat_info_by_gpid = std::unordered_map<gpid, replica_stat_info>; + void on_replicas_stat(); + void response_client(gpid id, bool is_read, dsn::message_ex *request, --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pegasus.apache.org For additional commands, e-mail: commits-h...@pegasus.apache.org