Added meta data and routing version to cluster state's pretty print

This commit is contained in:
Boaz Leskes 2014-05-15 15:54:50 +02:00
parent dc07ece790
commit 84593f0d7c
3 changed files with 5 additions and 5 deletions

View File

@ -239,6 +239,8 @@ public class ClusterState implements ToXContent {
public String prettyPrint() { public String prettyPrint() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("version: ").append(version).append("\n");
sb.append("meta data version: ").append(metaData.version()).append("\n");
sb.append(nodes().prettyPrint()); sb.append(nodes().prettyPrint());
sb.append(routingTable().prettyPrint()); sb.append(routingTable().prettyPrint());
sb.append(readOnlyRoutingNodes().prettyPrint()); sb.append(readOnlyRoutingNodes().prettyPrint());

View File

@ -447,7 +447,7 @@ public class RoutingTable implements Iterable<IndexRoutingTable> {
} }
public String prettyPrint() { public String prettyPrint() {
StringBuilder sb = new StringBuilder("routing_table:\n"); StringBuilder sb = new StringBuilder("routing_table (version ").append(version).append("):\n");
for (Map.Entry<String, IndexRoutingTable> entry : indicesRouting.entrySet()) { for (Map.Entry<String, IndexRoutingTable> entry : indicesRouting.entrySet()) {
sb.append(entry.getValue().prettyPrint()).append('\n'); sb.append(entry.getValue().prettyPrint()).append('\n');
} }

View File

@ -379,10 +379,8 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
newClusterState.status(ClusterState.ClusterStateStatus.BEING_APPLIED); newClusterState.status(ClusterState.ClusterStateStatus.BEING_APPLIED);
if (logger.isTraceEnabled()) { if (logger.isTraceEnabled()) {
StringBuilder sb = new StringBuilder("cluster state updated:\nversion [").append(newClusterState.version()).append("], source [").append(source).append("]\n"); StringBuilder sb = new StringBuilder("cluster state updated, source [").append(source).append("]\n");
sb.append(newClusterState.nodes().prettyPrint()); sb.append(newClusterState.prettyPrint());
sb.append(newClusterState.routingTable().prettyPrint());
sb.append(newClusterState.readOnlyRoutingNodes().prettyPrint());
logger.trace(sb.toString()); logger.trace(sb.toString());
} else if (logger.isDebugEnabled()) { } else if (logger.isDebugEnabled()) {
logger.debug("cluster state updated, version [{}], source [{}]", newClusterState.version(), source); logger.debug("cluster state updated, version [{}], source [{}]", newClusterState.version(), source);