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 a0df597ec Adding a logs to report missing top state beyond threshold 
set as well top state recovered on same instance. (#2553)
a0df597ec is described below

commit a0df597ec48b69a074dc1973d0b56327b09f3e4a
Author: Rahul Rane <[email protected]>
AuthorDate: Wed Jul 12 11:25:18 2023 -0700

    Adding a logs to report missing top state beyond threshold set as well top 
state recovered on same instance. (#2553)
    
    
    Co-authored-by: Rahul Rane <[email protected]>
---
 .../controller/stages/TopStateHandoffReportStage.java      | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 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 9588d1801..3ba7773fd 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
@@ -67,7 +67,7 @@ public class TopStateHandoffReportStage extends 
AbstractBaseStage {
     // TODO: remove this if-else after splitting controller
     if (cache instanceof WorkflowControllerDataProvider) {
       throw new StageException("TopStateHandoffReportStage can only be used in 
resource pipeline");
-    } 
+    }
     updateTopStateStatus((ResourceControllerDataProvider) cache, 
clusterStatusMonitor,
         resourceMap, currentStateOutput, lastPipelineFinishTimestamp);
   }
@@ -317,12 +317,18 @@ public class TopStateHandoffReportStage extends 
AbstractBaseStage {
     String partitionName = partition.getPartitionName();
     MissingTopStateRecord record = 
missingTopStateMap.get(resourceName).get(partitionName);
     long startTime = record.getStartTimeStamp();
-    if (startTime > 0 && System.currentTimeMillis() - startTime > 
durationThreshold && !record
-        .isFailed()) {
+    long missingDuration = System.currentTimeMillis() - startTime;
+    if (startTime > 0 && missingDuration > durationThreshold && 
!record.isFailed()) {
       record.setFailed();
       missingTopStateMap.get(resourceName).put(partitionName, record);
+      // Since top state handoff has not completed yet we can't log helix top 
state latency but can log since how long
+      // top state is missing.
+      LogUtil.logInfo(LOG, _eventId, String.format(
+          "Missing top state for partition %s beyond %s time. Graceful: %s",
+          partitionName, missingDuration, false));
       if (clusterStatusMonitor != null) {
-        clusterStatusMonitor.updateMissingTopStateDurationStats(resourceName, 
0L, 0L, false, false);
+        clusterStatusMonitor.updateMissingTopStateDurationStats(resourceName, 
0L, 0L,
+            false, false);
       }
     }
   }

Reply via email to