zentol commented on a change in pull request #8857: 
[FLINK-12960][coordination][shuffle] Move 
ResultPartitionDeploymentDescriptor#releasedOnConsumption to 
PartitionDescriptor#releasedOnConsumption
URL: https://github.com/apache/flink/pull/8857#discussion_r297106424
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/deployment/ResultPartitionDeploymentDescriptor.java
 ##########
 @@ -59,12 +61,42 @@ public ResultPartitionDeploymentDescriptor(
                        ShuffleDescriptor shuffleDescriptor,
                        int maxParallelism,
                        boolean sendScheduleOrUpdateConsumersMessage) {
+               this(
+                       partitionDescriptor,
+                       shuffleDescriptor,
+                       maxParallelism,
+                       sendScheduleOrUpdateConsumersMessage,
+                       // Later we might have to make the scheduling adjust 
automatically
+                       // if certain release type is not supported by shuffle 
service implementation at hand
+                       partitionDescriptor.getPartitionType() != 
ResultPartitionType.BLOCKING);
+       }
+
+       public ResultPartitionDeploymentDescriptor(
+                       PartitionDescriptor partitionDescriptor,
+                       ShuffleDescriptor shuffleDescriptor,
+                       int maxParallelism,
+                       boolean sendScheduleOrUpdateConsumersMessage,
+                       boolean releasedOnConsumption) {
+               
checkReleaseOnConsumptionIsSupportedForPartition(shuffleDescriptor, 
releasedOnConsumption);
                this.partitionDescriptor = checkNotNull(partitionDescriptor);
                this.shuffleDescriptor = checkNotNull(shuffleDescriptor);
                
KeyGroupRangeAssignment.checkParallelismPreconditions(maxParallelism);
                this.maxParallelism = maxParallelism;
                this.sendScheduleOrUpdateConsumersMessage = 
sendScheduleOrUpdateConsumersMessage;
-               this.releasedOnConsumption = 
partitionDescriptor.getPartitionType() != ResultPartitionType.BLOCKING;
+               this.releasedOnConsumption = releasedOnConsumption;
+       }
+
+       private static void checkReleaseOnConsumptionIsSupportedForPartition(
+                       ShuffleDescriptor shuffleDescriptor,
+                       boolean releasedOnConsumption) {
+               checkArgument(
+                       releasedOnConsumption ?
+                               
shuffleDescriptor.getSupportedReleaseTypes().contains(ReleaseType.AUTO) :
+                               
shuffleDescriptor.getSupportedReleaseTypes().contains(ReleaseType.MANUAL),
+                       "Release on consumption <%s> is not supported by the 
shuffle service for this partition, " +
 
 Review comment:
   let's include the result partition ID as well

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