You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/12/16 15:58:25 UTC

[GitHub] [flink] tillrohrmann commented on a change in pull request #14393: [FLINK-20605][coordination] Rework cancellation of slot allocation futures

tillrohrmann commented on a change in pull request #14393:
URL: https://github.com/apache/flink/pull/14393#discussion_r544412421



##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/DeclarativeSlotManager.java
##########
@@ -505,17 +496,12 @@ private void allocateSlot(TaskManagerSlotInformation taskManagerSlot, JobID jobI
 			resourceManagerId,
 			taskManagerRequestTimeout);
 
-		requestFuture.whenComplete(
+		CompletableFuture<Void> slotAllocationResponseProcessingFuture = requestFuture.handleAsync(
 			(Acknowledge acknowledge, Throwable throwable) -> {
-				if (acknowledge != null) {
-					completableFuture.complete(acknowledge);
-				} else {
-					completableFuture.completeExceptionally(throwable);
+				if (!pendingSlotAllocations.contains(slotId)) {
+					LOG.debug("Ignoring slot allocation update from task executor {} for slot {} and job {}, because the allocation was already completed or cancelled.", instanceId, slotId, jobId);
+					return null;
 				}
-			});
-
-		CompletableFuture<Void> slotAllocationResponseProcessingFuture = completableFuture.handleAsync(
-			(Acknowledge acknowledge, Throwable throwable) -> {
 				if (acknowledge != null) {
 					LOG.trace("Completed allocation of slot {} for job {}.", slotId, jobId);
 					slotTracker.notifyAllocationComplete(slotId, jobId);

Review comment:
       Do we still have to distinguish between `CancellationException` and others in the else branch?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org