GJL commented on a change in pull request #9860: [FLINK-14331][runtime] Reset 
vertices right after they transition to terminated states
URL: https://github.com/apache/flink/pull/9860#discussion_r333942042
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/DefaultScheduler.java
 ##########
 @@ -235,6 +236,9 @@ public void allocateSlotsAndDeploy(final 
Collection<ExecutionVertexDeploymentOpt
                final Map<ExecutionVertexID, ExecutionVertexDeploymentOption> 
deploymentOptionsByVertex =
                        
groupDeploymentOptionsByVertexId(executionVertexDeploymentOptions);
 
+               checkArgument(executionVertexDeploymentOptions.size() == 
deploymentOptionsByVertex.size(),
 
 Review comment:
   I think this should be part of `groupDeploymentOptionsByVertexId()`. 
However, I believe it is not needed:
   
   ```
   public static void main(String[] args) {
                Arrays
                        .asList("bla", "bla")
                        .stream()
                        .collect(Collectors.toMap(
                                Function.identity(),
                                Function.identity()));
        }
   ```
   
   ```
   Exception in thread "main" java.lang.IllegalStateException: Duplicate key bla
        at 
java.util.stream.Collectors.lambda$throwingMerger$0(Collectors.java:133)
        at java.util.HashMap.merge(HashMap.java:1254)
        at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)
        at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
        at 
java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
        at 
java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
        at 
java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at 
java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
        at 
org.apache.flink.runtime.scheduler.DefaultScheduler.main(DefaultScheduler.java:285)
   ```
   
   If you want, you can add a unit test.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to