Skip to content

Commit

Permalink
[Redis-benchmark] Use IP from CLUSTER NODE reply for first node too (r…
Browse files Browse the repository at this point in the history
…edis#8154)

If we only has one node in cluster or before 8fdc857, 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.
  • Loading branch information
ShooterIT committed Dec 17, 2020
1 parent 5a7254f commit 4db3640
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/redis-benchmark.c
Expand Up @@ -1182,8 +1182,8 @@ static int fetchClusterConfiguration() {
}
if (myself) {
node = firstNode;
if (node->ip == NULL && ip != NULL) {
node->ip = ip;
if (ip != NULL && strcmp(node->ip, ip) != 0) {
node->ip = sdsnew(ip);
node->port = port;
}
} else {
Expand Down

0 comments on commit 4db3640

Please sign in to comment.