Unverified Commit 18ff8cd1 authored by Pavlo Yatsukhnenko's avatar Pavlo Yatsukhnenko Committed by GitHub
Browse files

Fix div by 0 in redis-cli cluster creation (#8553)

This could happen on an invalid use, when trying to create a cluster with
a single node and provide it's address 3 time to satisfy redis-cli requirements.
parent 17c226b0
...@@ -2972,7 +2972,7 @@ static void clusterManagerOptimizeAntiAffinity(clusterManagerNodeArray *ipnodes, ...@@ -2972,7 +2972,7 @@ static void clusterManagerOptimizeAntiAffinity(clusterManagerNodeArray *ipnodes,
ip_count, ip_count,
&offenders, &offenders,
&offending_len); &offending_len);
if (score == 0) break; // Optimal anti affinity reached if (score == 0 || offending_len == 0) break; // Optimal anti affinity reached
/* We'll try to randomly swap a slave's assigned master causing /* We'll try to randomly swap a slave's assigned master causing
* an affinity problem with another random slave, to see if we * an affinity problem with another random slave, to see if we
* can improve the affinity. */ * can improve the affinity. */
......
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