From abcda8282c8cdff66ff00e4476de7926a9ec0587 Mon Sep 17 00:00:00 2001 From: Andrzej Bialecki Date: Thu, 14 Feb 2019 11:35:53 +0100 Subject: [PATCH] SOLR-13155: Minor addition to the "stats" section to make it easier to estimate the distribution of cores across nodes. --- solr/core/src/java/org/apache/solr/util/SolrCLI.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/solr/core/src/java/org/apache/solr/util/SolrCLI.java b/solr/core/src/java/org/apache/solr/util/SolrCLI.java index a892a3553c4..58e24d11809 100755 --- a/solr/core/src/java/org/apache/solr/util/SolrCLI.java +++ b/solr/core/src/java/org/apache/solr/util/SolrCLI.java @@ -1061,12 +1061,15 @@ public class SolrCLI { perColl.put("minCoresPerNode", minCoresPerNode); }); Map> nodeStats = new TreeMap<>(); + Map coreStats = new TreeMap<>(); for (Row row : session.getSortedNodes()) { Map nodeStat = nodeStats.computeIfAbsent(row.node, n -> new LinkedHashMap<>()); nodeStat.put("isLive", row.isLive()); nodeStat.put("freedisk", row.getVal("freedisk", 0)); nodeStat.put("totaldisk", row.getVal("totaldisk", 0)); - nodeStat.put("cores", row.getVal("cores", 0)); + int cores = ((Number)row.getVal("cores", 0)).intValue(); + nodeStat.put("cores", cores); + coreStats.computeIfAbsent(cores, num -> new AtomicInteger()).incrementAndGet(); Map>> collReplicas = new TreeMap<>(); row.forEachReplica(ri -> { Map perReplica = collReplicas.computeIfAbsent(ri.getCollection(), c -> new TreeMap<>()) @@ -1107,6 +1110,7 @@ public class SolrCLI { } Map stats = new LinkedHashMap<>(); results.put("STATISTICS", stats); + stats.put("coresPerNodes", coreStats); stats.put("nodeStats", nodeStats); stats.put("collectionStats", collStats); }