swuferhong commented on code in PR #1443:
URL: https://github.com/apache/fluss/pull/1443#discussion_r2255777485


##########
fluss-client/src/main/java/com/alibaba/fluss/client/table/scanner/log/RemoteLogDownloader.java:
##########
@@ -140,44 +137,55 @@ void recycleRemoteLog(RemoteLogSegment segment) {
      * to fetch.
      */
     void fetchOnce() throws Exception {
-        // wait until there is a remote fetch request
-        RemoteLogDownloadRequest request = segmentsToFetch.poll(pollTimeout, 
TimeUnit.MILLISECONDS);
-        if (request == null) {
+        int availablePermits = prefetchSemaphore.availablePermits();
+        List<RemoteLogDownloadRequest> requests = new 
ArrayList<>(availablePermits);
+        segmentsToFetch.drainTo(requests, availablePermits);
+        if (requests.size() <= 0) {
+            Thread.sleep(pollSleepTimeout);
             return;
         }
-        // blocks until there is capacity (the fetched file is consumed)
-        prefetchSemaphore.acquire();
+
+        prefetchSemaphore.acquire(requests.size());

Review Comment:
   After offline discussion, this case will not happen.



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