Unverified Commit 6413e5f8 authored by Wang Yuan's avatar Wang Yuan Committed by GitHub
Browse files

[Redis-benchmark] Use IP from CLUSTER NODE reply for first node too (#8154)

If we only has one node in cluster or before 8fdc857a, we don't know myself ip, so we should use config.hostip for myself.
However, we should use the IP from the command response to update node->ip if it exists and is different from config.hostip

otherwise, when there's more than one node in cluster, if we use -h with virtual IP or DNS, benchmark doesn't show node real ip and port of myself even though it could get right IP and port by CLUSTER NODES command.
parent 4f67d0b6
...@@ -1182,8 +1182,8 @@ static int fetchClusterConfiguration() { ...@@ -1182,8 +1182,8 @@ static int fetchClusterConfiguration() {
} }
if (myself) { if (myself) {
node = firstNode; node = firstNode;
if (node->ip == NULL && ip != NULL) { if (ip != NULL && strcmp(node->ip, ip) != 0) {
node->ip = ip; node->ip = sdsnew(ip);
node->port = port; node->port = port;
} }
} else { } else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment