zuston commented on code in PR #424:
URL: https://github.com/apache/incubator-uniffle/pull/424#discussion_r1053942401


##########
server/src/main/java/org/apache/uniffle/server/storage/LocalStorageManager.java:
##########
@@ -217,6 +244,34 @@ public void removeResources(PurgeEvent event) {
     deleteHandler.delete(deletePaths.toArray(new String[deletePaths.size()]), 
appId, user);
   }
 
+  private void cleanupStorageSelectionCache(PurgeEvent event) {
+    Function<String, Boolean> deleteConditionFunc = null;
+    if (event instanceof AppPurgeEvent) {
+      deleteConditionFunc = partitionUnionKey -> 
UnionKey.startsWith(partitionUnionKey, event.getAppId());
+    } else if (event instanceof ShufflePurgeEvent) {
+      deleteConditionFunc =
+          partitionUnionKey -> UnionKey.startsWith(
+              partitionUnionKey,
+              event.getAppId(),
+              event.getShuffleIds()
+          );
+    }
+    deleteElement(
+        partitionsOfStorage,
+        deleteConditionFunc
+    );
+  }
+
+  private <K, V> void deleteElement(Map<K, V> map, Function<K, Boolean> 
deleteConditionFunc) {

Review Comment:
   This delete logic is not in the critical path, so it's OK for me.
   
   > Could you add a logging about how much time cost to delete element?
   
   Good idea. I wil



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