Skip to content

Commit

Permalink
move paused status to clients section
Browse files Browse the repository at this point in the history
Signed-off-by: zhaozhao.zz <[email protected]>
  • Loading branch information
soloestoy committed Jan 14, 2025
1 parent 29e5c74 commit 035d8a5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
28 changes: 15 additions & 13 deletions src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -5649,6 +5649,17 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) {
unsigned long blocking_keys, blocking_keys_on_nokey, watched_keys;
getExpansiveClientsInfo(&maxin, &maxout);
totalNumberOfStatefulKeys(&blocking_keys, &blocking_keys_on_nokey, &watched_keys);

char *paused_actions = "none";
long long paused_timeout = 0;
if (server.paused_actions & PAUSE_ACTION_CLIENT_ALL) {
paused_actions = "all";
paused_timeout = getPausedActionTimeout(PAUSE_ACTION_CLIENT_ALL);
} else if (server.paused_actions & PAUSE_ACTION_CLIENT_WRITE) {
paused_actions = "write";
paused_timeout = getPausedActionTimeout(PAUSE_ACTION_CLIENT_WRITE);
}

if (sections++) info = sdscat(info, "\r\n");
info = sdscatprintf(
info,
Expand All @@ -5665,7 +5676,9 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) {
"clients_in_timeout_table:%llu\r\n", (unsigned long long)raxSize(server.clients_timeout_table),
"total_watched_keys:%lu\r\n", watched_keys,
"total_blocking_keys:%lu\r\n", blocking_keys,
"total_blocking_keys_on_nokey:%lu\r\n", blocking_keys_on_nokey));
"total_blocking_keys_on_nokey:%lu\r\n", blocking_keys_on_nokey,
"paused_actions:%s\r\n", paused_actions,
"paused_timeout_milliseconds:%lld\r\n", paused_timeout));
}

/* Memory */
Expand Down Expand Up @@ -5863,15 +5876,6 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) {
server.stat_last_eviction_exceeded_time ? (long long)elapsedUs(server.stat_last_eviction_exceeded_time) : 0;
long long current_active_defrag_time =
server.stat_last_active_defrag_time ? (long long)elapsedUs(server.stat_last_active_defrag_time) : 0;
char *paused_actions = "none";
long long paused_timeout = 0;
if (server.paused_actions & PAUSE_ACTION_CLIENT_ALL) {
paused_actions = "all";
paused_timeout = getPausedActionTimeout(PAUSE_ACTION_CLIENT_ALL);
} else if (server.paused_actions & PAUSE_ACTION_CLIENT_WRITE) {
paused_actions = "write";
paused_timeout = getPausedActionTimeout(PAUSE_ACTION_CLIENT_WRITE);
}

if (sections++) info = sdscat(info, "\r\n");
info = sdscatprintf(
Expand Down Expand Up @@ -5939,9 +5943,7 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) {
"eventloop_duration_sum:%llu\r\n", server.duration_stats[EL_DURATION_TYPE_EL].sum,
"eventloop_duration_cmd_sum:%llu\r\n", server.duration_stats[EL_DURATION_TYPE_CMD].sum,
"instantaneous_eventloop_cycles_per_sec:%llu\r\n", getInstantaneousMetric(STATS_METRIC_EL_CYCLE),
"instantaneous_eventloop_duration_usec:%llu\r\n", getInstantaneousMetric(STATS_METRIC_EL_DURATION),
"paused_actions:%s\r\n", paused_actions,
"paused_timeout_milliseconds:%lld\r\n", paused_timeout));
"instantaneous_eventloop_duration_usec:%llu\r\n", getInstantaneousMetric(STATS_METRIC_EL_DURATION)));
info = genValkeyInfoStringACLStats(info);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/pause.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ start_server {tags {"pause network"}} {

r multi
r client PAUSE 1000 ALL
r info stats
r info clients
assert_match "*paused_actions:all*" [r exec]

r client unpause
Expand Down

0 comments on commit 035d8a5

Please sign in to comment.