You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2019/02/14 10:39:48 UTC

[lucene-solr] branch branch_8x updated: SOLR-13155: Minor addition to the "stats" section to make it easier to estimate the distribution of cores across nodes.

This is an automated email from the ASF dual-hosted git repository.

ab pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new b6ebc74  SOLR-13155: Minor addition to the "stats" section to make it easier to estimate the distribution of cores across nodes.
b6ebc74 is described below

commit b6ebc748c9edfbbbdf97da763e83f8d5496e8e8c
Author: Andrzej Bialecki <ab...@apache.org>
AuthorDate: Thu Feb 14 11:35:53 2019 +0100

    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 a892a35..58e24d1 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);
         }