Apache Lucene open-source search software
SOLR-13155: Minor addition to the "stats" section to make it easier to estimate the distribution of cores across nodes.
Andrzej Bialeckiabcda8282c8c
diff --git a/solr/core/src/java/org/apache/solr/util/SolrCLI.java b/solr/core/src/java/org/apache/solr/util/SolrCLI.javaindex 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<String, Map<String, Object>> nodeStats = new TreeMap<>();+ Map<Integer, AtomicInteger> coreStats = new TreeMap<>();for (Row row : session.getSortedNodes()) {Map<String, Object> 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<String, Map<String, Map<String, Object>>> collReplicas = new TreeMap<>();row.forEachReplica(ri -> {Map<String, Object> perReplica = collReplicas.computeIfAbsent(ri.getCollection(), c -> new TreeMap<>())@@ -1107,6 +1110,7 @@ public class SolrCLI {}Map<String, Object> stats = new LinkedHashMap<>();results.put("STATISTICS", stats);+ stats.put("coresPerNodes", coreStats);stats.put("nodeStats", nodeStats);stats.put("collectionStats", collStats);}