Skip to content

Commit

Permalink
Count incompatible states received in exception handler instead
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveCTurner committed Oct 17, 2017
1 parent 3dd4219 commit b589f36
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -389,21 +389,21 @@ protected void handleIncomingClusterStateRequest(BytesTransportRequest request,
logger.debug("received full cluster state version [{}] with size [{}]", incomingState.version(),
request.bytes().length());
} else if (lastSeenClusterState != null) {
incompatibleClusterStateDiffReceivedCount.incrementAndGet();
Diff<ClusterState> diff = ClusterState.readDiffFrom(in, lastSeenClusterState.nodes().getLocalNode());
incomingState = diff.apply(lastSeenClusterState);
incompatibleClusterStateDiffReceivedCount.decrementAndGet();
compatibleClusterStateDiffReceivedCount.incrementAndGet();
logger.debug("received diff cluster state version [{}] with uuid [{}], diff size [{}]",
incomingState.version(), incomingState.stateUUID(), request.bytes().length());
} else {
incompatibleClusterStateDiffReceivedCount.incrementAndGet();
logger.debug("received diff for but don't have any local cluster state - requesting full state");
throw new IncompatibleClusterStateVersionException("have no local cluster state");
}
incomingClusterStateListener.onIncomingClusterState(incomingState);
lastSeenClusterState = incomingState;
}
} catch (IncompatibleClusterStateVersionException e) {
incompatibleClusterStateDiffReceivedCount.incrementAndGet();
throw e;
} finally {
IOUtils.close(in);
}
Expand Down

0 comments on commit b589f36

Please sign in to comment.