pltbkd commented on code in PR #28305:
URL: https://github.com/apache/flink/pull/28305#discussion_r3665415294


##########
flink-runtime/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java:
##########
@@ -713,11 +684,21 @@ protected void 
processInput(MailboxDefaultAction.Controller controller) throws E
         }
 
         TaskIOMetricGroup ioMetrics = 
getEnvironment().getMetricGroup().getIOMetricGroup();
-        PeriodTimer timer;
+        PeriodTimer timer = null;
         CompletableFuture<?> resumeFuture;
-        if (!recordWriter.isAvailable()) {
+        if (chainAvailabilityProvider == null && !recordWriter.isAvailable()) {
+            // No chain-availability operator; downstream is the direct 
backpressure source.
             timer = new 
GaugePeriodTimer(ioMetrics.getSoftBackPressuredTimePerSecond());
             resumeFuture = recordWriter.getAvailableFuture();
+        } else if (chainAvailabilityProvider != null && 
!chainAvailabilityProvider.isAvailable()) {
+            if (!recordWriter.isAvailable()) {
+                // Queue full AND downstream unavailable → backpressure (root 
cause: downstream).
+                timer = new 
GaugePeriodTimer(ioMetrics.getSoftBackPressuredTimePerSecond());
+                resumeFuture = recordWriter.getAvailableFuture();
+            } else {
+                // Queue full but downstream available → internal processing; 
fall back to busy.
+                resumeFuture = chainAvailabilityProvider.getAvailableFuture();
+            }

Review Comment:
   There's a slight behavioral difference. If `!recordWriter.isAvailable()` 
while `chainAvailabilityProvider.isAvailable()`, the task can still process new 
inputs (the async operator has capacity), so its status should be 'busy'. When 
reaching this block, the task is actually unavailable due to 
`!chainAvailabilityProvider.isAvailable()`, according to `taskIsAvailable()`.



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

Reply via email to