未验证 提交 b59ca310 编写于 作者: N Nikita Koksharov 提交者: GitHub

Merge pull request #3355 from yann9/master

Set connection to fail when all slaves init connections error
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册