[ https://issues.apache.org/jira/browse/FLINK-7832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16212562#comment-16212562 ]
ASF GitHub Bot commented on FLINK-7832: --------------------------------------- Github user tillrohrmann commented on a diff in the pull request: https://github.com/apache/flink/pull/4823#discussion_r145949796 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java --- @@ -556,14 +537,30 @@ private void registerSlot( * @return True if the slot could be updated; otherwise false */ private boolean updateSlot(SlotID slotId, AllocationID allocationId) { - TaskManagerSlot slot = slots.get(slotId); + final TaskManagerSlot slot = slots.get(slotId); - if (null != slot) { - // we assume the given allocation id to be the ground truth (coming from the TM) - slot.setAllocationId(allocationId); + if (slot != null) { + final TaskManagerRegistration taskManagerRegistration = taskManagerRegistrations.get(slot.getInstanceId()); + + if (taskManagerRegistration != null) { + updateSlotInternal(slot, taskManagerRegistration, allocationId); + + return true; + } else { + throw new IllegalStateException("Trying to update a slot from a TaskManager " + + slot.getInstanceId() + " which has not been registered."); + } + } else { + LOG.debug("Trying to update unknown slot with slot id {}.", slotId); - if (null != allocationId) { - if (slot.hasPendingSlotRequest()){ + return false; + } + } + + private void updateSlotInternal(TaskManagerSlot slot, TaskManagerRegistration taskManagerRegistration, @Nullable AllocationID allocationId) { --- End diff -- True. The intention was to have the lookup logic in `updateSlot` because this is not needed for `freeSlot` and `removeSlotRequest`. Will rename `updateSlotInternal` into `updateSlotState`. > SlotManager should return number of registered slots > ---------------------------------------------------- > > Key: FLINK-7832 > URL: https://issues.apache.org/jira/browse/FLINK-7832 > Project: Flink > Issue Type: Improvement > Components: Distributed Coordination > Affects Versions: 1.4.0 > Reporter: Till Rohrmann > Assignee: Till Rohrmann > Labels: flip-6 > Fix For: 1.4.0 > > > The {{SlotManager}} should provide information about the number of registered > slots for a {{TaskExecutor}} and how many of these slots are still free. -- This message was sent by Atlassian JIRA (v6.4.14#64029)