You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ja...@apache.org on 2023/09/29 23:21:57 UTC

[solr] branch branch_9x updated: Fix the admin UI green core-size graph on nodes screen (#1963)

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

janhoy 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 dace250e2ac Fix the admin UI green core-size graph on nodes screen (#1963)
dace250e2ac is described below

commit dace250e2ac59cacf31193fc5785e3bf10d2007e
Author: Jan Høydahl <ja...@apache.org>
AuthorDate: Sat Sep 30 01:20:48 2023 +0200

    Fix the admin UI green core-size graph on nodes screen (#1963)
    
    (cherry picked from commit d5881569474864ae5105f5a534d8277fc4a8aa58)
---
 solr/CHANGES.txt                                |  2 ++
 solr/webapp/web/js/angular/controllers/cloud.js | 12 ++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 1c313fdc8b2..ac6ad1ce1c9 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -159,6 +159,8 @@ Bug Fixes
 
 * SOLR-16997: OTEL configurator NPE when SOLR_HOST not set (janhoy)
 
+* PR#1963: Fix the admin UI green core-size graph on nodes screen (janhoy)
+
 * SOLR-16980: Connect to SOLR standalone with basic authentication (Alex Deparvu)
 
 * SOLR-16992: Non-reproducible StreamingTest failures -- suggests CloudSolrStream concurency race condition (Alex Deparvu, hossman)
diff --git a/solr/webapp/web/js/angular/controllers/cloud.js b/solr/webapp/web/js/angular/controllers/cloud.js
index ece27cb657a..70b89611614 100644
--- a/solr/webapp/web/js/angular/controllers/cloud.js
+++ b/solr/webapp/web/js/angular/controllers/cloud.js
@@ -423,9 +423,10 @@ var nodesSubController = function($scope, Collections, System, Metrics) {
               // These are the cores we _expect_ to find on this node according to the CLUSTERSTATUS
               var cores = nodes[node]['cores'];
               var indexSizeTotal = 0;
+              var indexSizeMax = 0;
               var docsTotal = 0;
               var graphData = [];
-              for (coreId in cores) {
+              for (let 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
@@ -440,7 +441,8 @@ var nodesSubController = function($scope, Collections, System, Metrics) {
                   size = (typeof size !== 'undefined') ? size : 0;
                   core['sizeInBytes'] = size;
                   core['size'] = bytesToSize(size);
-                  indexSizeTotal += size;
+                  indexSizeTotal = indexSizeTotal + size;
+                  indexSizeMax = size > indexSizeMax ? size : indexSizeMax;
                   var numDocs = coreMetric['SEARCHER.searcher.numDocs'];
                   numDocs = (typeof numDocs !== 'undefined') ? numDocs : 0;
                   core['numDocs'] = numDocs;
@@ -455,12 +457,14 @@ var nodesSubController = function($scope, Collections, System, Metrics) {
                   core['warmupTime'] = warmupTime;
                   docsTotal += core['numDocs'];
                 }
-
+              }
+              for (let coreId in cores) {
+                var core = cores[coreId];
                 var graphObj = {};
                 graphObj['label'] = core['label'];
                 graphObj['size'] = core['sizeInBytes'];
                 graphObj['sizeHuman'] = core['size'];
-                graphObj['pct'] = (core['sizeInBytes'] / indexSizeTotal) * 100;
+                graphObj['pct'] = (core['sizeInBytes'] / indexSizeMax) * 100;
                 graphData.push(graphObj);
               }
               if (cores) {