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

masaori pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 597e2e87ce Fix stripe metrics in the exclusive span case (#11023)
597e2e87ce is described below

commit 597e2e87ce256231e633619b82bae104ddfdd6c4
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Thu Feb 1 09:07:06 2024 +0900

    Fix stripe metrics in the exclusive span case (#11023)
---
 src/iocore/cache/Cache.cc                             |  5 +----
 .../cache/gold/storage_metrics_2_stdout.gold          |  7 +++++++
 tests/gold_tests/cache/storage-metrics.test.py        | 19 ++++++++++++++++---
 3 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/src/iocore/cache/Cache.cc b/src/iocore/cache/Cache.cc
index 5811a0577f..3e0beecbde 100644
--- a/src/iocore/cache/Cache.cc
+++ b/src/iocore/cache/Cache.cc
@@ -1492,7 +1492,6 @@ cplist_reconfigure()
   int volume_number;
   off_t size_in_blocks;
   ConfigVol *config_vol;
-  int assignedVol = 0; // Number of assigned volumes
 
   gnstripes = 0;
   if (config_volumes.num_volumes == 0) {
@@ -1550,8 +1549,6 @@ cplist_reconfigure()
       // in such a way forced volumes will not impact volume percentage 
calculations.
       if (-1 == gdisks[i]->forced_volume_num) {
         tot_space_in_blks += (gdisks[i]->num_usable_blocks / blocks_per_vol) * 
blocks_per_vol;
-      } else {
-        ++assignedVol;
       }
     }
 
@@ -1721,7 +1718,7 @@ cplist_reconfigure()
     }
   }
 
-  Metrics::Gauge::store(cache_rsb.stripes, gnstripes + assignedVol);
+  Metrics::Gauge::store(cache_rsb.stripes, gnstripes);
 
   return 0;
 }
diff --git a/tests/gold_tests/cache/gold/storage_metrics_2_stdout.gold 
b/tests/gold_tests/cache/gold/storage_metrics_2_stdout.gold
new file mode 100644
index 0000000000..2d018dada8
--- /dev/null
+++ b/tests/gold_tests/cache/gold/storage_metrics_2_stdout.gold
@@ -0,0 +1,7 @@
+``
+proxy.process.cache.stripes 1
+``
+proxy.process.cache.span.online 1
+``
+proxy.process.cache.volume_1.stripes 1
+``
diff --git a/tests/gold_tests/cache/storage-metrics.test.py 
b/tests/gold_tests/cache/storage-metrics.test.py
index 87c5451d35..27a293f379 100644
--- a/tests/gold_tests/cache/storage-metrics.test.py
+++ b/tests/gold_tests/cache/storage-metrics.test.py
@@ -32,8 +32,7 @@ storage 256M
         "volume": '''
 # empty
 '''
-    },
-    {
+    }, {
         "case": 1,
         "description": "four equally devided volumes",
         "storage": '''
@@ -46,7 +45,19 @@ volume=2 scheme=http size=25%
 volume=3 scheme=http size=25%
 volume=4 scheme=http size=25%
 '''
-    },
+    }, {
+        "case": 2,
+        "description": "exclusive span",
+        "storage": '''
+storage 256M volume=1
+''',
+        "volume": '''
+volume=1 scheme=http size=262144
+''',
+        "hosting": '''
+hostname=* volume=1
+'''
+    }
 ]
 
 
@@ -65,6 +76,8 @@ class StorageMetricsTest:
             ts = Test.MakeATSProcess(f"ts_{i}")
             ts.Disk.storage_config.AddLine(config["storage"])
             ts.Disk.volume_config.AddLine(config["volume"])
+            if "hosting" in config:
+                ts.Disk.hosting_config.AddLine(config["hosting"])
             ts.Disk.records_config.update({
                 'proxy.config.diags.debug.enabled': 1,
                 'proxy.config.diags.debug.tags': 'cache',

Reply via email to