redict/tests/unit/cluster/human-announced-nodename.tcl
Wen Hui 070453eef3
Cluster human readable nodename feature (#9564)
This PR adds a human readable name to a node in clusters that are visible as part of error logs. This is useful so that admins and operators of Redis cluster have better visibility into failures without having to cross-reference the generated ID with some logical identifier (such as pod-ID or EC2 instance ID). This is mentioned in #8948. Specific nodenames can be set by using the variable cluster-announce-human-nodename. The nodename is gossiped using the clusterbus extension in #9530.

Co-authored-by: Madelyn Olson <madelyneolson@gmail.com>
2023-06-17 21:16:51 -07:00

31 lines
1.3 KiB
Tcl

# Check if cluster's view of human announced nodename is reported in logs
start_cluster 3 0 {tags {external:skip cluster}} {
test "Set cluster human announced nodename and let it propagate" {
for {set j 0} {$j < [llength $::servers]} {incr j} {
R $j config set cluster-announce-human-nodename "nodename-$j"
}
# We wait for everyone to agree on the epoch bump, which means everyone
# has exchanged messages so they know about the nodenames.
R 0 CLUSTER BUMPEPOCH
wait_for_condition 1000 50 {
[CI 0 cluster_current_epoch] == [CI 1 cluster_current_epoch] &&
[CI 0 cluster_current_epoch] == [CI 2 cluster_current_epoch]
} else {
fail "Cluster did not converge"
}
}
test "Human nodenames are visible in log messages" {
# Pause instance 0, so everyone thinks it is dead
pause_process [srv 0 pid]
# We're going to use a message we will know will be sent, node unreachable,
# since it includes the other node gossiping.
wait_for_log_messages -1 {"*Node * (nodename-2) reported node * (nodename-0) as not reachable*"} 0 10 500
wait_for_log_messages -2 {"*Node * (nodename-1) reported node * (nodename-0) as not reachable*"} 0 10 500
resume_process [srv 0 pid]
}
}