[hotfix] Cancel pending slot request when SlotPool is suspended
Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/529b5128 Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/529b5128 Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/529b5128 Branch: refs/heads/master Commit: 529b5128e9f6a7b8f368d6c22b90885667579352 Parents: 4fc3bcf Author: Till Rohrmann <[email protected]> Authored: Thu Feb 22 15:37:37 2018 +0100 Committer: Till Rohrmann <[email protected]> Committed: Sat Feb 24 15:04:56 2018 +0100 ---------------------------------------------------------------------- .../apache/flink/runtime/jobmaster/slotpool/SlotPool.java | 8 ++++++++ 1 file changed, 8 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/529b5128/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPool.java ---------------------------------------------------------------------- diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPool.java b/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPool.java index ea816b5..409f8f7 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPool.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPool.java @@ -227,6 +227,14 @@ public class SlotPool extends RpcEndpoint implements SlotPoolGateway, AllocatedS validateRunsInMainThread(); + // cancel all pending allocations --> we can request these slots + // again after we regained the leadership + Set<AllocationID> allocationIds = pendingRequests.keySetB(); + + for (AllocationID allocationId : allocationIds) { + resourceManagerGateway.cancelSlotRequest(allocationId); + } + // suspend this RPC endpoint stop();
