Integer target = distribution.getIdealDistributorNode(cachedClusterState, bucketId, owningBucketStates); if (persistentFailureChecker.tooManyFailures(target)) { sendRandomReason = "Too many failures detected versus distributor " + target + ". Sending to random instead of using cached state."; target = null;
public void handleErrorReply(Reply reply, Object untypedContext) { MessageContext messageContext = (MessageContext) untypedContext; if (messageContext.calculatedDistributor != null) { persistentFailureChecker.addFailure(messageContext.calculatedDistributor); if (reply.getTrace().shouldTrace(1)) { reply.getTrace().trace(1, "Failed with " + messageContext.toString()); } } } }
private void updateCachedRoutingStateFromWrongDistribution(MessageContext context, ClusterState newState) { if (cachedClusterState == null || newState.getVersion() >= cachedClusterState.getVersion()) { cachedClusterState = newState; if (newState.getClusterState().equals(State.UP)) { hostFetcher.updateValidTargets(newState); } } else if (newState.getVersion() + 2000000000 < cachedClusterState.getVersion()) { cachedClusterState = null; } else if (context.calculatedDistributor != null) { persistentFailureChecker.addFailure(context.calculatedDistributor); } }
public DistributorSelectionLogic(Parameters params, ExternalSlobrokPolicy policy) { this.hostFetcher = params.createHostFetcher(policy); this.hostFetcher.setRequiredUpPercentageToSendToKnownGoodNodes(params.getRequiredUpPercentageToSendToKnownGoodNodes()); this.distribution = params.createDistribution(policy); persistentFailureChecker = new InstabilityChecker(params.getAttemptRandomOnFailuresLimit()); maxOldClusterVersionBeforeSendingRandom = params.maxOldClusterStatesSeenBeforeThrowingCachedState(); }