Log warning when application of an updated cluster state fails with an exception

This commit is contained in:
Igor Motov 2011-11-09 21:59:51 -05:00 committed by Shay Banon
parent e7baf30bd2
commit ed8c289dec

View File

@ -212,6 +212,7 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
return;
}
if (previousClusterState != clusterState) {
try {
if (clusterState.nodes().localNodeMaster()) {
// only the master controls the version numbers
Builder builder = ClusterState.builder().state(clusterState).version(clusterState.version() + 1);
@ -293,6 +294,13 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
}
logger.debug("processing [{}]: done applying updated cluster_state", source);
} catch (Exception e) {
StringBuilder sb = new StringBuilder("failed to apply updated cluster state:\nversion [").append(clusterState.version()).append("], source [").append(source).append("]\n");
sb.append(clusterState.nodes().prettyPrint());
sb.append(clusterState.routingTable().prettyPrint());
sb.append(clusterState.readOnlyRoutingNodes().prettyPrint());
logger.warn(sb.toString(), e);
}
} else {
logger.debug("processing [{}]: no change in cluster_state", source);
}