mridulm commented on code in PR #35906:
URL: https://github.com/apache/spark/pull/35906#discussion_r895292260


##########
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/RemoteBlockPushResolver.java:
##########
@@ -317,22 +353,24 @@ public void applicationRemoved(String appId, boolean 
cleanupLocalDirs) {
     logger.info("Application {} removed, cleanupLocalDirs = {}", appId, 
cleanupLocalDirs);
     AppShuffleInfo appShuffleInfo = appsShuffleInfo.remove(appId);
     if (null != appShuffleInfo) {
-      mergedShuffleCleaner.execute(
-        () -> closeAndDeletePartitionFilesIfNeeded(appShuffleInfo, 
cleanupLocalDirs));
+      submitCleanupTask(
+        () -> closeAndDeletePartitions(appShuffleInfo, cleanupLocalDirs, 
true));
     }
+    removeAppAttemptPathInfoFromDB(
+        new AppAttemptId(appShuffleInfo.appId, appShuffleInfo.attemptId));

Review Comment:
   We are relying on DB being consistent with `appsShuffleInfo` map when 
reloading.
   Given this, we should move the removal of the DB entry  to be atomic w.r.t 
`appsShuffleInfo.remove`.
   
   Something like:
   ```
   AtomicReference<AppShuffleInfo> ref = new AtomicReference<>(null);
   appsShuffleInfo.compute( appId, (id, info) -> {
       if (null != info) {
         removeAppAttemptPathInfoFromDB(new AppAttemptId(info.appId, 
info.attemptId));
         ref.set(info);
       }
       // always remove
       return null;
     } );
   AppShuffleInfo appShuffleInfo = ref.get
   ```
   



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