Thesharing commented on a change in pull request #16687:
URL: https://github.com/apache/flink/pull/16687#discussion_r688226405



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/LocalInputPreferredSlotSharingStrategy.java
##########
@@ -214,87 +245,87 @@ private ExecutionSlotSharingGroup 
tryFindAvailableProducerExecutionSlotSharingGr
 
             final ExecutionVertexID executionVertexId = 
executionVertex.getId();
 
-            for (SchedulingResultPartition partition : 
executionVertex.getConsumedResults()) {
-                final ExecutionVertexID producerVertexId = 
partition.getProducer().getId();
-                if (!inSameLogicalSlotSharingGroup(producerVertexId, 
executionVertexId)) {
-                    continue;
-                }
-
-                final ExecutionSlotSharingGroup producerGroup =
-                        executionSlotSharingGroupMap.get(producerVertexId);
-
-                checkState(producerGroup != null);
-                if (isGroupAvailableForVertex(producerGroup, 
executionVertexId)) {
-                    return producerGroup;
+            for (ConsumedPartitionGroup consumedPartitionGroup :
+                    executionVertex.getConsumedPartitionGroups()) {
+
+                Iterator<ExecutionSlotSharingGroup> availableGroupIterator =
+                        getAvailableGroupsForConsumedPartitionGroup(
+                                        executionVertexId.getJobVertexId(), 
consumedPartitionGroup)
+                                .iterator();
+                if (availableGroupIterator.hasNext()) {
+                    ExecutionSlotSharingGroup nextAvailableGroup = 
availableGroupIterator.next();
+                    availableGroupIterator.remove();
+                    return nextAvailableGroup;
                 }
             }
 
             return null;
         }
 
         private boolean inSameLogicalSlotSharingGroup(
-                final ExecutionVertexID executionVertexId1,
-                final ExecutionVertexID executionVertexId2) {
+                final JobVertexID jobVertexId1, final JobVertexID 
jobVertexId2) {
 
             return Objects.equals(
-                    
getSlotSharingGroup(executionVertexId1).getSlotSharingGroupId(),
-                    
getSlotSharingGroup(executionVertexId2).getSlotSharingGroupId());
+                    
checkNotNull(slotSharingGroupMap.get(jobVertexId1)).getSlotSharingGroupId(),
+                    
checkNotNull(slotSharingGroupMap.get(jobVertexId2)).getSlotSharingGroupId());

Review comment:
       Thank you for pointing this out. Resolved.




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


Reply via email to