Wrong usage sdscatprintf in redis-cli. (#8604)

The result of `sdscatprintf` is doubled when using argument twice.
This commit is contained in:
Pavlo Yatsukhnenko 2021-03-08 12:57:27 +02:00 committed by GitHub
parent f491eee2a1
commit 20377a6f3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2953,8 +2953,12 @@ static int clusterManagerGetAntiAffinityScore(clusterManagerNodeArray *ipnodes,
else types = sdsempty();
/* Master type 'm' is always set as the first character of the
* types string. */
if (!node->replicate) types = sdscatprintf(types, "m%s", types);
else types = sdscat(types, "s");
if (node->replicate) types = sdscat(types, "s");
else {
sds s = sdscatsds(sdsnew("m"), types);
sdsfree(types);
types = s;
}
dictReplace(related, key, types);
}
/* Now it's trivial to check, for each related group having the