return CONFIRMATION_KEY + slaveIndex;
}
public StageResult processAckOnMaster(List<DistStageAck> acks) {
logDurationInfo(acks);
StageResult result = StageResult.SUCCESS;
for (DistStageAck ack : acks) {
if (ack.isError()) {
log.warn("Ack error from remote slave: " + ack);
result = errorResult();
}
if (!(ack instanceof ReplicationAck)) {
log.info("Slave " + ack.getSlaveIndex() + " did not sent any response");
continue;
}
ReplicationAck replicationAck = (ClusterValidationStage.ReplicationAck) ack;
if (partialReplication) {
if (replicationAck.result <= 0) {
log.warn("Replication hasn't occurred on slave: " + ack);
result = errorResult();
}
} else { //total replication expected
int expectedRepl = getExecutingSlaves().size() - 1;
if (!(replicationAck.result == expectedRepl)) {
log.warn("On slave " + ack + " total replication hasn't occurred. Expected " + expectedRepl + " and received " + replicationAck.result);
result = errorResult();
}
}
}
if (result.isError()) log.warn("Cluster hasn't formed!");
return result;
}