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

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


The following commit(s) were added to refs/heads/master by this push:
     new 0b0b35c8be3 Provide the correct comparison time for evaluating whether 
a segment should be considered in the SegmentStatusChecker (#16496)
0b0b35c8be3 is described below

commit 0b0b35c8be3b6896ee53e14d42d59fc7b536a190
Author: 9aman <[email protected]>
AuthorDate: Mon Aug 4 21:59:03 2025 +0530

    Provide the correct comparison time for evaluating whether a segment should 
be considered in the SegmentStatusChecker (#16496)
---
 .../org/apache/pinot/controller/helix/SegmentStatusChecker.java    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/SegmentStatusChecker.java
 
b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/SegmentStatusChecker.java
index 9b16f66288e..553dada84f8 100644
--- 
a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/SegmentStatusChecker.java
+++ 
b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/SegmentStatusChecker.java
@@ -287,6 +287,7 @@ public class SegmentStatusChecker extends 
ControllerPeriodicTask<SegmentStatusCh
       return;
     }
 
+    long evSnapshotTimestamp = System.currentTimeMillis();
     ExternalView externalView = 
_pinotHelixResourceManager.getTableExternalView(tableNameWithType);
     if (externalView != null) {
       _controllerMetrics.setValueOfTableGauge(tableNameWithType, 
ControllerGauge.EXTERNALVIEW_ZNODE_SIZE,
@@ -349,9 +350,13 @@ public class SegmentStatusChecker extends 
ControllerPeriodicTask<SegmentStatusCh
       //       the ZK metadata; for pushed segments, we use push time from the 
ZK metadata. Both of them are the time
       //       when segment is newly created. For committed segments from 
real-time table, push time doesn't exist, and
       //       creationTimeMs will be Long.MIN_VALUE, which is fine because we 
want to include them in the check.
+      //       The comparison uses evSnapshotTimestamp instead of 
System.currentTimeMillis() because for large tables
+      //       with many segments, the status check can take several minutes. 
A segment updated after
+      //       the EV snapshot was taken but before this individual segment 
check runs could be incorrectly flagged as
+      //       OFFLINE when using current time.
       long creationTimeMs = segmentZKMetadata.getStatus() == 
Status.IN_PROGRESS ? segmentZKMetadata.getCreationTime()
           : segmentZKMetadata.getPushTime();
-      if (creationTimeMs > System.currentTimeMillis() - 
_waitForPushTimeSeconds * 1000L) {
+      if (creationTimeMs > evSnapshotTimestamp - _waitForPushTimeSeconds * 
1000L) {
         continue;
       }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to