Merge pull request #3355 from yann9/master

Set connection to fail when all slaves init connections error
pull/3384/head
Nikita Koksharov 4 years ago committed by GitHub
commit b59ca3101b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -313,11 +313,16 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager {
if (!config.checkSkipSlavesInit()) {
List<RFuture<Void>> fs = entry.initSlaveBalancer(partition.getFailedSlaveAddresses(), masterClient);
AtomicInteger counter = new AtomicInteger(fs.size());
AtomicInteger errorCounter = new AtomicInteger(fs.size());
for (RFuture<Void> future : fs) {
future.onComplete((r, ex) -> {
if (ex != null) {
log.error("unable to add slave for: " + partition.getMasterAddress()
+ " slot ranges: " + partition.getSlotRanges(), ex);
if (errorCounter.decrementAndGet() == 0) {
result.tryFailure(ex);
return;
}
}
if (counter.decrementAndGet() == 0) {

Loading…
Cancel
Save