Skip to content
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
4 changes: 4 additions & 0 deletions src/cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -1594,6 +1594,10 @@ void resetClusterStats(void) {
if (!server.cluster_enabled) return;

clusterSlotStatResetAll();

memset(server.cluster->stats_bus_messages_sent, 0, sizeof(server.cluster->stats_bus_messages_sent));
memset(server.cluster->stats_bus_messages_received, 0, sizeof(server.cluster->stats_bus_messages_received));
server.cluster->stat_cluster_links_buffer_limit_exceeded = 0;
}


Expand Down
22 changes: 22 additions & 0 deletions tests/unit/cluster/info.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,28 @@ start_cluster 3 0 {tags {external:skip cluster} overrides {cluster-node-timeout
resume_process [srv -1 pid]
wait_for_cluster_state ok
}

test "CONFIG RESETSTAT resets cluster related stats" {
R 0 config set cluster-link-sendbuf-limit 1
wait_for_condition 1000 10 {
[CI 0 cluster_stats_messages_sent] >= 1 &&
[CI 0 cluster_stats_messages_received] >= 1 &&
[CI 0 total_cluster_links_buffer_limit_exceeded] >= 1
} else {
fail "R 0 related info fields are not as expected"
}

R 0 multi
R 0 config resetstat
R 0 cluster info
set info [lindex [R 0 exec] 1]

assert_equal [getInfoProperty $info cluster_stats_messages_sent] 0
assert_equal [getInfoProperty $info cluster_stats_messages_received] 0
assert_equal [getInfoProperty $info total_cluster_links_buffer_limit_exceeded] 0

R 0 config set cluster-link-sendbuf-limit 0
}
}

start_cluster 3 0 {tags {external:skip cluster} overrides {cluster-node-timeout 1000}} {
Expand Down
Loading