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


##########
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:
   
   #1212 This is mainly due to the asynchronous event that once thought the App 
was no longer used, because re-register will be used again (resend heartbeat), 
so when removeResource will check again whether the App has expired.
   
   Considering this issue, here, we want to unregister all shuffles of the app 
at the **"current"** moment, which means that if` AppUnregisterPurgeEvent` is 
introduced, we need to pass all shuffleIds of the current moment into the 
event. If so, why don't we just use `ShufflePurgeEvent` and pass the shuffleIds 
into it.



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