Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduce a new task code for replicas stat #2169

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/common/replication.codes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 4 additions & 7 deletions src/replica/replica_stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand Down
3 changes: 2 additions & 1 deletion src/replica/replica_stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ class replica_stub : public serverlet<replica_stub>, public ref_counter
//
void on_meta_server_connected();
void on_meta_server_disconnected();
void on_replicas_stat();
void on_disk_stat();

//
Expand Down Expand Up @@ -385,6 +384,8 @@ class replica_stub : public serverlet<replica_stub>, public ref_counter
};
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,
Expand Down
Loading