Skip to content

Commit

Permalink
[hotfix][runtime] Simplify SlotPoolImpl#maybeRemapOrphanedAllocation
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuzhurk committed Jun 23, 2020
1 parent d45a5f0 commit 480c11c
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -601,13 +601,15 @@ private void maybeRemapOrphanedAllocation(
// if the request of that allocated slot is still pending, it should take over the orphaned allocation.
// this enables the request to fail fast if the remapped allocation fails.
if (!allocationIdOfRequest.equals(allocationIdOfSlot)) {
final SlotRequestId requestIdOfAllocatedSlot = pendingRequests.getKeyAByKeyB(allocationIdOfSlot);
if (requestIdOfAllocatedSlot != null) {
final PendingRequest requestOfAllocatedSlot = pendingRequests.getValueByKeyA(requestIdOfAllocatedSlot);
checkNotNull(requestOfAllocatedSlot).setAllocationId(allocationIdOfRequest);

// this re-insertion of initiatedRequestId will not affect its original insertion order
pendingRequests.put(requestIdOfAllocatedSlot, allocationIdOfRequest, requestOfAllocatedSlot);
final PendingRequest requestOfAllocatedSlot = pendingRequests.getValueByKeyB(allocationIdOfSlot);
if (requestOfAllocatedSlot != null) {
requestOfAllocatedSlot.setAllocationId(allocationIdOfRequest);

// this re-insertion of request will not affect its original insertion order
pendingRequests.put(
requestOfAllocatedSlot.getSlotRequestId(),
allocationIdOfRequest,
requestOfAllocatedSlot);
} else {
// request id of the allocated slot can be null if the slot is returned by scheduler.
// the orphaned allocation will not be adopted in this case, which means it is not needed
Expand Down

0 comments on commit 480c11c

Please sign in to comment.