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


##########
server/src/main/java/org/apache/uniffle/server/ShuffleServerGrpcService.java:
##########
@@ -99,6 +102,37 @@ public ShuffleServerGrpcService(ShuffleServer 
shuffleServer) {
     this.shuffleServer = shuffleServer;
   }
 
+  @Override
+  public void unregisterApp(
+      RssProtos.AppUnregisterRequest request,
+      StreamObserver<RssProtos.AppUnregisterResponse> responseStreamObserver) {
+    String appId = request.getAppId();
+
+    StatusCode result = StatusCode.SUCCESS;
+    String responseMessage = "OK";
+    try {
+      Map<Integer, RangeMap<Integer, ShuffleBuffer>> shuffleIdToBuffers =
+          shuffleServer.getShuffleBufferManager().getBufferPool().get(appId);
+      if (shuffleIdToBuffers != null) {
+        HashSet<Integer> shuffleIds = 
Sets.newHashSet(shuffleIdToBuffers.keySet());
+        shuffleIds.forEach(
+            shuffleId ->
+                
shuffleServer.getShuffleTaskManager().removeShuffleDataAsync(appId, shuffleId));

Review Comment:
   I think the deleting all shuffleIds  one by one is not a good way.
   
   You could follow the next step to extend
   1. create a new method in ShuffleTaskManager, like this:
   ```
   public void removeShuffleDataAsync(String appId) {
       expiredAppIdQueue.add(
           new AppPurgeEvent(appId, getUserByAppId(appId));
     }
   ```
   2. use above method in grpc service.



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