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

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


The following commit(s) were added to refs/heads/master by this push:
     new 792f21162 [apache/helix] -- Fixes #2590 Removed resetting of the 
missingTopStatePartitionsBeyondThresholdGauge to avoid incorrect accounting.
792f21162 is described below

commit 792f21162be752eada8da8547a107884ff727b88
Author: Himanshu Kandwal <[email protected]>
AuthorDate: Wed Aug 23 13:09:12 2023 -0700

    [apache/helix] -- Fixes #2590 Removed resetting of the 
missingTopStatePartitionsBeyondThresholdGauge to avoid incorrect accounting.
    
     Fixes #2590 Removed resetting of the 
missingTopStatePartitionsBeyondThresholdGauge to avoid incorrect accounting.
    
    ---------
    
    Co-authored-by: Himanshu Kandwal <[email protected]>
---
 .../org/apache/helix/controller/stages/TopStateHandoffReportStage.java | 3 +++
 .../main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java  | 3 +--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/helix-core/src/main/java/org/apache/helix/controller/stages/TopStateHandoffReportStage.java
 
b/helix-core/src/main/java/org/apache/helix/controller/stages/TopStateHandoffReportStage.java
index 8d5cf802a..77a84a448 100644
--- 
a/helix-core/src/main/java/org/apache/helix/controller/stages/TopStateHandoffReportStage.java
+++ 
b/helix-core/src/main/java/org/apache/helix/controller/stages/TopStateHandoffReportStage.java
@@ -494,6 +494,9 @@ public class TopStateHandoffReportStage extends 
AbstractBaseStage {
 
     // In case of recovery after failure, we should decrement the 
missingTopStateBeyondThresholdGauge value.
     if (clusterStatusMonitor != null && record.isFailed()) {
+      LogUtil.logInfo(LOG, _eventId, String.format(
+          "Missing top state recovered for resource %s and partition %s. 
Decrementing missingTopStateBeyondThresholdGauge.",
+          resourceName, partition.getPartitionName()));
       
clusterStatusMonitor.decrementMissingTopStateBeyondThresholdGauge(resourceName);
     }
 
diff --git 
a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
 
b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
index 263d1923c..5064c6481 100644
--- 
a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
+++ 
b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
@@ -480,7 +480,6 @@ public class ResourceMonitor extends DynamicMBeanProvider {
   public void resetMaxTopStateHandoffGauge() {
     if (_lastResetTime + DEFAULT_RESET_INTERVAL_MS <= 
System.currentTimeMillis()) {
       _maxSinglePartitionTopStateHandoffDuration.updateValue(0L);
-      _missingTopStatePartitionsBeyondThresholdGauge.updateValue(0L);
       _lastResetTime = System.currentTimeMillis();
     }
   }
@@ -491,7 +490,7 @@ public class ResourceMonitor extends DynamicMBeanProvider {
   }
 
   public void decrementMissingTopStateBeyondThresholdGauge() {
-    
_missingTopStatePartitionsBeyondThresholdGauge.updateValue(_missingTopStatePartitionsBeyondThresholdGauge.getValue()
 - 1);
+    _missingTopStatePartitionsBeyondThresholdGauge.updateValue(Math.max(0, 
_missingTopStatePartitionsBeyondThresholdGauge.getValue() - 1));
     _lastResetTime = System.currentTimeMillis();
   }
 

Reply via email to