Jackie-Jiang commented on code in PR #19296:
URL: https://github.com/apache/pinot/pull/19296#discussion_r3810793779


##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeSegmentDataManager.java:
##########
@@ -462,12 +462,16 @@ private void handleTransientStreamErrors(Exception e)
           _consecutiveErrorCount, e);
       throw e;
     } else {
-      if (_shouldStop && (e instanceof InterruptedException || e.getCause() 
instanceof InterruptedException)) {
-        _segmentLogger.debug("Interrupted to stop consumption", e);
-      } else {
-        _segmentLogger.warn("Stream transient exception when fetching 
messages, retrying (count={})",
-            _consecutiveErrorCount, e);
+      if (_shouldStop) {
+        // Consumption is being stopped (the transient exception is usually 
the interrupt from the stop), and the
+        // consume loop exits on the next check, so skip the retry sleep and 
the stream consumer recreation. Closing
+        // the current consumer from the interrupted consumer thread would 
just fail with another interrupt; it is
+        // closed by the regular shutdown path instead.
+        _segmentLogger.debug("Interrupted to stop consumption, skipping stream 
consumer recreation", e);
+        return;
       }
+      _segmentLogger.warn("Stream transient exception when fetching messages, 
retrying (count={})",
+          _consecutiveErrorCount, e);
       Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
       recreateStreamConsumer("Too many transient errors");

Review Comment:
   Good catch! Restructured the branch to re-check the stop flag after the 
uninterruptible backoff: a stop() that lands during the sleep now returns 
without recreating the consumer, instead of closing it on the interrupted 
thread.



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