Apache Solr open-source search software
SOLR-16089: Fix empty columns in Cloud Node UI Screen when replica is in down state.
Chris Hostetter8d164438fb7d
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 17221f7743b..0e149cf1f34 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -51,6 +51,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-15776: Admin UI is now aware of logged-in user's permissions and can adapt accordingly (janhoy)diff --git a/solr/webapp/web/js/angular/controllers/cloud.js b/solr/webapp/web/js/angular/controllers/cloud.jsindex 2769b3ae74d..0e4aea6b612 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 CLUSTERSTATUSvar 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});