Merge pull request #3760 from JerryWzc/fix_failover

Fix primary update condition for cluster mode.
pull/3770/head
Nikita Koksharov 4 years ago committed by GitHub
commit 6ef75f17e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -566,8 +566,8 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager {
continue; continue;
} }
masterFound = true; masterFound = true;
// current master marked as failed // skip the new master if it is marked as failed or has no slots
if (!newPart.isMasterFail() || newPart.getSlotsAmount() == 0) { if (newPart.isMasterFail() || newPart.getSlotsAmount() == 0) {
continue; continue;
} }
for (Integer slot : currentPart.getSlots()) { for (Integer slot : currentPart.getSlots()) {
@ -593,7 +593,7 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager {
break; break;
} }
if (!masterFound && newPart.getSlotsAmount() > 0) { if (!masterFound && !newPart.isMasterFail() && newPart.getSlotsAmount() > 0) {
addedPartitions.put(newPart.getMasterAddress(), newPart); addedPartitions.put(newPart.getMasterAddress(), newPart);
} }
} }

Loading…
Cancel
Save