LuciferYang commented on code in PR #43371:
URL: https://github.com/apache/spark/pull/43371#discussion_r1359100137


##########
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/RemoteBlockPushResolver.java:
##########
@@ -1933,6 +1933,39 @@ public RoaringBitmap getMapTracker() {
     int getNumIOExceptions() {
       return numIOExceptions;
     }
+
+    private record ResourceCleaner(
+        File dataFile,
+        FileChannel dataChannel,
+        MergeShuffleFile indexFile,
+        MergeShuffleFile metaFile,
+        AppAttemptShuffleMergeId appAttemptShuffleMergeId,
+        int reduceId) implements Runnable {
+
+      @Override
+      public void run() {
+        try {

Review Comment:
   My only question is that this introduces some duplicate code with the 
`AppShufflePartitionInfo#closeAllFilesAndDeleteIfNeeded` method. Is there 
really no way to eliminate this duplication?
   
   



##########
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/RemoteBlockPushResolver.java:
##########
@@ -1756,6 +1759,8 @@ public static class AppShufflePartitionInfo {
       this.dataFilePos = 0;
       this.mapTracker = new RoaringBitmap();
       this.chunkTracker = new RoaringBitmap();
+      CLEANER.register(this, new ResourceCleaner(dataFile, dataChannel, 
indexFile,
+              metaFile, appAttemptShuffleMergeId, reduceId));

Review Comment:
   Indentation: 2 spaces



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