Skip to content

Commit bc2757d

Browse files
committed
add paused_actions for INFO stats
Signed-off-by: zhaozhao.zz <[email protected]>
1 parent b3b4bdc commit bc2757d

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/server.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5863,6 +5863,7 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) {
58635863
server.stat_last_eviction_exceeded_time ? (long long)elapsedUs(server.stat_last_eviction_exceeded_time) : 0;
58645864
long long current_active_defrag_time =
58655865
server.stat_last_active_defrag_time ? (long long)elapsedUs(server.stat_last_active_defrag_time) : 0;
5866+
char *paused_actions = server.paused_actions & PAUSE_ACTION_CLIENT_ALL ? "all" : server.paused_actions & PAUSE_ACTION_CLIENT_WRITE ? "write" : "none";
58665867

58675868
if (sections++) info = sdscat(info, "\r\n");
58685869
info = sdscatprintf(
@@ -5930,7 +5931,8 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) {
59305931
"eventloop_duration_sum:%llu\r\n", server.duration_stats[EL_DURATION_TYPE_EL].sum,
59315932
"eventloop_duration_cmd_sum:%llu\r\n", server.duration_stats[EL_DURATION_TYPE_CMD].sum,
59325933
"instantaneous_eventloop_cycles_per_sec:%llu\r\n", getInstantaneousMetric(STATS_METRIC_EL_CYCLE),
5933-
"instantaneous_eventloop_duration_usec:%llu\r\n", getInstantaneousMetric(STATS_METRIC_EL_DURATION)));
5934+
"instantaneous_eventloop_duration_usec:%llu\r\n", getInstantaneousMetric(STATS_METRIC_EL_DURATION),
5935+
"paused_actions:%s\r\n", paused_actions));
59345936
info = genValkeyInfoStringACLStats(info);
59355937
}
59365938

tests/unit/pause.tcl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
start_server {tags {"pause network"}} {
2+
test "Test check paused_actions in info stats" {
3+
assert_equal [s paused_actions] "none"
4+
5+
r client PAUSE 10000 WRITE
6+
assert_equal [s paused_actions] "write"
7+
r client unpause
8+
9+
r multi
10+
r client PAUSE 1000 All
11+
r info stats
12+
assert_match "*paused_actions:all*" [r exec]
13+
14+
r client unpause
15+
}
16+
217
test "Test read commands are not blocked by client pause" {
318
r client PAUSE 100000 WRITE
419
set rd [valkey_deferring_client]

0 commit comments

Comments
 (0)