reswqa commented on code in PR #20796:
URL: https://github.com/apache/flink/pull/20796#discussion_r969078015


##########
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/hybrid/HsFileDataManager.java:
##########
@@ -192,19 +192,22 @@ public void 
releaseSubpartitionReader(HsSubpartitionFileReader subpartitionFileR
 
     /** Releases this file data manager and delete shuffle data after all 
readers is removed. */
     public void release() {
+        List<HsSubpartitionFileReader> pendingReaders;
         synchronized (lock) {
             if (isReleased) {
                 return;
             }
             isReleased = true;
 
-            List<HsSubpartitionFileReader> pendingReaders = new 
ArrayList<>(allReaders);
+            pendingReaders = new ArrayList<>(allReaders);
             mayNotifyReleased();
+            // delete the shuffle file only when no reader is reading now.
+            releaseFuture.thenRun(this::deleteShuffleFile);
+        }
+        if (!pendingReaders.isEmpty()) {

Review Comment:
   done.



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to