Skip to content

Commit

Permalink
add paused_actions for INFO stats
Browse files Browse the repository at this point in the history
Signed-off-by: zhaozhao.zz <[email protected]>
  • Loading branch information
soloestoy committed Jan 7, 2025
1 parent b3b4bdc commit bc2757d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -5863,6 +5863,7 @@ 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 = server.paused_actions & PAUSE_ACTION_CLIENT_ALL ? "all" : server.paused_actions & PAUSE_ACTION_CLIENT_WRITE ? "write" : "none";

if (sections++) info = sdscat(info, "\r\n");
info = sdscatprintf(
Expand Down Expand Up @@ -5930,7 +5931,8 @@ 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)));
"instantaneous_eventloop_duration_usec:%llu\r\n", getInstantaneousMetric(STATS_METRIC_EL_DURATION),
"paused_actions:%s\r\n", paused_actions));
info = genValkeyInfoStringACLStats(info);
}

Expand Down
15 changes: 15 additions & 0 deletions tests/unit/pause.tcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
start_server {tags {"pause network"}} {
test "Test check paused_actions in info stats" {
assert_equal [s paused_actions] "none"

r client PAUSE 10000 WRITE
assert_equal [s paused_actions] "write"
r client unpause

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

r client unpause
}

test "Test read commands are not blocked by client pause" {
r client PAUSE 100000 WRITE
set rd [valkey_deferring_client]
Expand Down

0 comments on commit bc2757d

Please sign in to comment.