pvary commented on code in PR #16545:
URL: https://github.com/apache/iceberg/pull/16545#discussion_r3311858834


##########
flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/source/reader/ArrayPoolDataIteratorBatcher.java:
##########
@@ -118,7 +131,28 @@ public void close() throws IOException {
       inputIterator.close();
     }
 
+    /**
+     * Polls for an available entry from the pool. If a wakeup flag is set, 
uses non-blocking
+     * tryPollEntry with sleep-retry loop so the thread can be interrupted 
during cancellation.
+     * Returns null if the wakeup flag is set, indicating that the reader 
should stop processing.
+     */
     private T[] getCachedEntry() {
+      if (wakeup != null) {
+        while (!wakeup.get()) {
+          T[] entry = pool.tryPollEntry();
+          if (entry != null) {
+            return entry;
+          }
+          try {
+            Thread.sleep(POLL_RETRY_INTERVAL_MS);

Review Comment:
   Why don't we put the active polling to the `IcebergSourceSplitReader`?
   
   This is not a strong opinion at this point, just trying to understand the 
desing.
   
   It feels very strange for me that we push down the `wakeup` flag here 
instead of acting on it where we receive the wakeup



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