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


##########
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/RemoteBlockPushResolver.java:
##########
@@ -342,6 +380,33 @@ void closeAndDeletePartitionFilesIfNeeded(
     if (cleanupLocalDirs) {
       deleteExecutorDirs(appShuffleInfo);
     }
+    if (removeFromDb){
+      removeAppShuffleInfoFromDB(appShuffleInfo);
+    }
+  }
+
+  private void removeAppAttemptPathInfoFromDB(AppAttemptId appAttemptId) {
+    if (db != null) {
+      try {
+        db.delete(getDbAppAttemptPathsKey(appAttemptId));
+      } catch (Exception e) {
+        logger.error("Error deleting {} from application paths info in DB", 
appAttemptId, e);
+      }
+    }
+  }
+
+  private void removeAppShuffleInfoFromDB(AppShuffleInfo appShuffleInfo) {
+    if (db != null) {
+      appShuffleInfo.shuffles
+        .forEach((shuffleId, shuffleInfo) -> shuffleInfo.shuffleMergePartitions
+          .forEach((shuffleMergeId, partitionInfo) -> {
+            synchronized (partitionInfo) {
+              removeAppShufflePartitionInfoFromDB(
+                new AppAttemptShuffleMergeId(
+                  appShuffleInfo.appId, appShuffleInfo.attemptId, shuffleId, 
shuffleMergeId));
+            }

Review Comment:
   Refactored the code



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