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

Jackie-Jiang 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 2482813c3ee Skip stream consumer recreation when consumption is being 
stopped (#19296)
2482813c3ee is described below

commit 2482813c3ee924a8052b034cd51ebc737908d1c5
Author: Xiaotian (Jackie) Jiang <[email protected]>
AuthorDate: Wed Aug 19 10:03:23 2026 -0700

    Skip stream consumer recreation when consumption is being stopped (#19296)
---
 .../data/manager/realtime/RealtimeSegmentDataManager.java | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git 
a/pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeSegmentDataManager.java
 
b/pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeSegmentDataManager.java
index 5beff4e116e..71a61b92d5b 100644
--- 
a/pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeSegmentDataManager.java
+++ 
b/pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeSegmentDataManager.java
@@ -462,13 +462,20 @@ public class RealtimeSegmentDataManager extends 
SegmentDataManager {
           _consecutiveErrorCount, e);
       throw e;
     } else {
-      if (_shouldStop && (e instanceof InterruptedException || e.getCause() 
instanceof InterruptedException)) {
-        _segmentLogger.debug("Interrupted to stop consumption", e);
-      } else {
+      if (!_shouldStop) {
         _segmentLogger.warn("Stream transient exception when fetching 
messages, retrying (count={})",
             _consecutiveErrorCount, e);
+        Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
+      }
+      // Consumption being stopped is checked both before and after the 
uninterruptible retry backoff: the transient
+      // exception is usually the interrupt from the stop, and stop() can also 
interrupt the backoff itself. Either
+      // way the consume loop exits on the next check, so skip 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.
+      if (_shouldStop) {
+        _segmentLogger.debug("Interrupted to stop consumption, skipping stream 
consumer recreation", e);
+        return;
       }
-      Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
       recreateStreamConsumer("Too many transient errors");
     }
   }


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

Reply via email to