shauryachats commented on code in PR #18855:
URL: https://github.com/apache/pinot/pull/18855#discussion_r3771220043


##########
pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentmetadata/SegmentZkMetadataFetcher.java:
##########
@@ -130,4 +146,26 @@ public synchronized void refreshSegment(String segment) {
       }
     }
   }
+
+  /**
+   * Returns true if the ZNRecord represents a committed segment with a valid 
startTime.
+   * A null ZNRecord or one with startTime=-1 (consuming, or briefly 
inconsistent after commit)
+   * should not be cached — the segment will be re-fetched on the next 
onAssignmentChange.
+   */
+  private static boolean isCommittedZNRecord(@Nullable ZNRecord znRecord) {
+    return znRecord != null && 
znRecord.getLongField(CommonConstants.Segment.START_TIME, -1L) >= 0L;
+  }
+
+  /**
+   * Returns true if the segment is in CONSUMING state on any server in the 
ExternalView.
+   * Such segments should not be cached in {@code _onlineSegmentsCached} — 
they will be re-evaluated
+   * on the next ExternalView change, at which point they will have 
transitioned to ONLINE (committed).
+   */
+  private static boolean isConsumingInExternalView(ExternalView externalView, 
String segment) {
+    if (externalView == null) {

Review Comment:
   Addressed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to