mirror of https://mirror.osredm.com/root/redis.git
Fix port update not reflected in CLUSTER SLOTS (#13932)
Close https://github.com/redis/redis/issues/13892 config set port cmd updates server.port. cluster slot retrieves information about cluster slots and their associated nodes. the fix updates this info when config set port cmd is done, so cluster slots cmd returns the right value.
This commit is contained in:
parent
24080114cc
commit
38e9e8ed38
|
@ -2450,6 +2450,7 @@ static int updatePort(const char **err) {
|
|||
listener->bindaddr = server.bindaddr;
|
||||
listener->bindaddr_count = server.bindaddr_count;
|
||||
listener->port = server.port;
|
||||
clusterUpdateMyselfAnnouncedPorts();
|
||||
listener->ct = connectionByType(CONN_TYPE_SOCKET);
|
||||
if (changeListener(listener) == C_ERR) {
|
||||
*err = "Unable to listen on this port. Check server logs.";
|
||||
|
|
|
@ -47,4 +47,20 @@ start_cluster 2 2 {tags {external:skip cluster}} {
|
|||
R 0 config set cluster-announce-bus-port 0
|
||||
assert_match "*@$base_bus_port *" [R 0 CLUSTER NODES]
|
||||
}
|
||||
|
||||
test "CONFIG SET port updates cluster-announced port" {
|
||||
# Get the original port and change to new_port
|
||||
set orig_port [lindex [R 0 config get port] 1]
|
||||
assert {$orig_port != ""}
|
||||
|
||||
set new_port [find_available_port $baseport $count]
|
||||
R 0 config set port $new_port
|
||||
|
||||
# Verify that the new port appears in the output of cluster slots
|
||||
wait_for_condition 50 100 {
|
||||
[string match "*$new_port*" [R 0 cluster slots]]
|
||||
} else {
|
||||
fail "Cluster announced port was not updated in cluster slots"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue