You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ho...@apache.org on 2022/03/15 18:02:04 UTC

[solr] branch branch_9x updated: SOLR-16089: Fix empty columns in Cloud Node UI Screen when replica is in down state.

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

hossman pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new b326de2  SOLR-16089: Fix empty columns in Cloud Node UI Screen when replica is in down state.
b326de2 is described below

commit b326de297924c2b92606efe697a9432c76c75b7b
Author: Chris Hostetter <ho...@apache.org>
AuthorDate: Tue Mar 15 10:44:20 2022 -0700

    SOLR-16089: Fix empty columns in Cloud Node UI Screen when replica is in down state.
    
    (cherry picked from commit 8d164438fb7d88b0f544aeeb96f7f2c3f90f23d9)
---
 solr/CHANGES.txt                                |  2 +
 solr/webapp/web/js/angular/controllers/cloud.js | 57 +++++++++++++------------
 2 files changed, 31 insertions(+), 28 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 273a3e6..de5d008 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -28,6 +28,8 @@ Bug Fixes
 
 * SOLR-15116: Support a HEAD request for managed resources. (Eric Pugh)
 
+* SOLR-16089: Fix empty columns in Cloud Node UI Screen when replica is in down state. (hossman)
+
 Other Changes
 ---------------------
 * SOLR-15897: Remove <jmx/> from all unit test solrconfig.xml files. (Eric Pugh)
diff --git a/solr/webapp/web/js/angular/controllers/cloud.js b/solr/webapp/web/js/angular/controllers/cloud.js
index 2769b3a..0e4aea6 100644
--- a/solr/webapp/web/js/angular/controllers/cloud.js
+++ b/solr/webapp/web/js/angular/controllers/cloud.js
@@ -421,54 +421,55 @@ var nodesSubController = function($scope, Collections, System, Metrics) {
               nodes[node]['reqp95_ms'] = Math.floor(r['p95_ms']);
               nodes[node]['reqp99_ms'] = Math.floor(r['p99_ms']);
 
+              // These are the cores we _expect_ to find on this node according to the CLUSTERSTATUS
               var cores = nodes[node]['cores'];
+              if (! cores) {
+                cores = {};
+              }
               var indexSizeTotal = 0;
               var docsTotal = 0;
               var graphData = [];
-              if (cores) {
-                for (coreId in cores) {
-                  var core = cores[coreId];
-                  var keyName = "solr.core." + core['core'].replace(/(.*?)_(shard(\d+_?)+)_(replica.*?)/, '\$1.\$2.\$4');
-                  var nodeMetric = m.metrics[keyName];
-                  var size = nodeMetric['INDEX.sizeInBytes'];
+              for (coreId in cores) {
+                var core = cores[coreId];
+                if (core['shard_state'] !== 'active' || core['state'] !== 'active') {
+                  // If core state is not active, display the real state, or if shard is inactive, display that
+                  var labelState = (core['state'] !== 'active') ? core['state'] : core['shard_state'];
+                  core['label'] += "_(" + labelState + ")";
+                }
+                var coreMetricName = "solr.core." + core['core'].replace(/(.*?)_(shard(\d+_?)+)_(replica.*?)/, '\$1.\$2.\$4');
+                var coreMetric = m.metrics[coreMetricName];
+                // we may not actually get metrics back for every expected core (the core may be down)
+                if (coreMetric) {
+                  var size = coreMetric['INDEX.sizeInBytes'];
                   size = (typeof size !== 'undefined') ? size : 0;
                   core['sizeInBytes'] = size;
                   core['size'] = bytesToSize(size);
-                  if (core['shard_state'] !== 'active' || core['state'] !== 'active') {
-                    // If core state is not active, display the real state, or if shard is inactive, display that
-                    var labelState = (core['state'] !== 'active') ? core['state'] : core['shard_state'];
-                    core['label'] += "_(" + labelState + ")";
-                  }
                   indexSizeTotal += size;
-                  var numDocs = nodeMetric['SEARCHER.searcher.numDocs'];
+                  var numDocs = coreMetric['SEARCHER.searcher.numDocs'];
                   numDocs = (typeof numDocs !== 'undefined') ? numDocs : 0;
                   core['numDocs'] = numDocs;
                   core['numDocsHuman'] = numDocsHuman(numDocs);
                   core['avgSizePerDoc'] = bytesToSize(numDocs === 0 ? 0 : size / numDocs);
-                  var deletedDocs = nodeMetric['SEARCHER.searcher.deletedDocs'];
+                  var deletedDocs = coreMetric['SEARCHER.searcher.deletedDocs'];
                   deletedDocs = (typeof deletedDocs !== 'undefined') ? deletedDocs : 0;
                   core['deletedDocs'] = deletedDocs;
                   core['deletedDocsHuman'] = numDocsHuman(deletedDocs);
-                  var warmupTime = nodeMetric['SEARCHER.searcher.warmupTime'];
+                  var warmupTime = coreMetric['SEARCHER.searcher.warmupTime'];
                   warmupTime = (typeof warmupTime !== 'undefined') ? warmupTime : 0;
                   core['warmupTime'] = warmupTime;
                   docsTotal += core['numDocs'];
                 }
-                for (coreId in cores) {
-                  core = cores[coreId];
-                  var graphObj = {};
-                  graphObj['label'] = core['label'];
-                  graphObj['size'] = core['sizeInBytes'];
-                  graphObj['sizeHuman'] = core['size'];
-                  graphObj['pct'] = (core['sizeInBytes'] / indexSizeTotal) * 100;
-                  graphData.push(graphObj);
-                }
-                cores.sort(function (a, b) {
-                  return b.sizeInBytes - a.sizeInBytes
-                });
-              } else {
-                cores = {};
+
+                var graphObj = {};
+                graphObj['label'] = core['label'];
+                graphObj['size'] = core['sizeInBytes'];
+                graphObj['sizeHuman'] = core['size'];
+                graphObj['pct'] = (core['sizeInBytes'] / indexSizeTotal) * 100;
+                graphData.push(graphObj);
               }
+              cores.sort(function (a, b) {
+                return b.sizeInBytes - a.sizeInBytes
+              });
               graphData.sort(function (a, b) {
                 return b.size - a.size
               });