xiangfu0 commented on code in PR #18784:
URL: https://github.com/apache/pinot/pull/18784#discussion_r3431804906


##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeSegmentDataManager.java:
##########
@@ -484,6 +485,16 @@ protected boolean consumeLoop()
 
     _segmentLogger.info("Starting consumption loop start offset {}, 
finalOffset {}", _currentOffset, _finalOffset);
     while (!_shouldStop && !endCriteriaReached()) {
+      if (_state == State.INITIAL_CONSUMING && 
_serverIngestionOomProtectionManager != null) {
+        boolean waitedForOomProtection =
+            _serverIngestionOomProtectionManager.waitIfProtectionNeeded(() -> 
_shouldStop || endCriteriaReached());
+        if (_shouldStop || endCriteriaReached()) {
+          break;
+        }
+        if (waitedForOomProtection) {
+          _idleTimer.markStreamCreated();
+        }
+      }

Review Comment:
   Done. The OOM wait now uses a side-effect-free 
`shouldStopWaitingForOomProtection()` predicate instead of calling 
`endCriteriaReached()` inside the wait loop. The normal loop still calls 
`endCriteriaReached()` after waiting, so stop reasons and the empty-segment 
time extension remain centralized there. Added 
`testServerIngestionOomProtectionStopPredicateDoesNotMutateEndCriteria` to 
cover this.



-- 
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