From 58cac3d8dd2c257281d7db30954e673a4c017594 Mon Sep 17 00:00:00 2001 From: Lee Hinman Date: Tue, 24 Feb 2015 16:45:33 -0700 Subject: [PATCH] Add a .toString() method to RoutingNode Previously this would log: ``` [2015-02-24 11:13:45,105][TRACE][cluster.routing.allocation.allocator] [Poltergeist] Try moving shard [[test][2], node[HFn4dJ7fQAyfSAB8BquaSQ], [R], s[STARTED]] from [org.elasticsearch.cluster.routing.RoutingNode@6df2c498] ``` Now it will log: ``` [2015-02-25 11:32:45,182][TRACE][cluster.routing.allocation.allocator] [Solarr] Try moving shard [[my_index][2], node[HDhbU4D9Rx27MSr_72bmWQ], [P], s[STARTED]] from [routingNode ([Solarr][HDhbU4D9Rx27MSr_72bmWQ][Xanadu.domain][192.168.0.4], [5 assigned shards])] ``` --- .../cluster/routing/RoutingNode.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/org/elasticsearch/cluster/routing/RoutingNode.java b/src/main/java/org/elasticsearch/cluster/routing/RoutingNode.java index 1e5ef15b28a..6f8341087e7 100644 --- a/src/main/java/org/elasticsearch/cluster/routing/RoutingNode.java +++ b/src/main/java/org/elasticsearch/cluster/routing/RoutingNode.java @@ -175,6 +175,22 @@ public class RoutingNode implements Iterable { return sb.toString(); } + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("routingNode (["); + sb.append(node.getName()); + sb.append("]["); + sb.append(node.getId()); + sb.append("]["); + sb.append(node.getHostName()); + sb.append("]["); + sb.append(node.getHostAddress()); + sb.append("], ["); + sb.append(shards.size()); + sb.append(" assigned shards])"); + return sb.toString(); + } + public MutableShardRouting get(int i) { return shards.get(i) ; }