tillrohrmann commented on a change in pull request #9960: [FLINK-14476] Extend 
PartitionTracker to support promotions
URL: https://github.com/apache/flink/pull/9960#discussion_r339088498
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/PartitionTrackerImpl.java
 ##########
 @@ -146,34 +167,43 @@ public boolean isPartitionTracked(final 
ResultPartitionID resultPartitionID) {
                return Optional.of(partitionInfo);
        }
 
-       private void internalReleasePartitions(
+       private void internalReleaseOrPromotePartitions(
                ResourceID potentialPartitionLocation,
                Collection<ResultPartitionDeploymentDescriptor> 
partitionDeploymentDescriptors) {
 
-               
internalReleasePartitionsOnTaskExecutor(potentialPartitionLocation, 
partitionDeploymentDescriptors);
+               
internalReleaseOrPromotePartitionsOnTaskExecutor(potentialPartitionLocation, 
partitionDeploymentDescriptors);
                
internalReleasePartitionsOnShuffleMaster(partitionDeploymentDescriptors);
        }
 
-       private void internalReleasePartitionsOnTaskExecutor(
+       private void internalReleaseOrPromotePartitionsOnTaskExecutor(
                ResourceID potentialPartitionLocation,
                Collection<ResultPartitionDeploymentDescriptor> 
partitionDeploymentDescriptors) {
 
                final List<ResultPartitionID> 
partitionsRequiringRpcReleaseCalls = partitionDeploymentDescriptors.stream()
+                       .filter(resultPartitionDeploymentDescriptor -> 
!resultPartitionDeploymentDescriptor.getPartitionType().isPersistent())
+                       
.map(ResultPartitionDeploymentDescriptor::getShuffleDescriptor)
+                       .filter(descriptor -> 
descriptor.storesLocalResourcesOn().isPresent())
+                       .map(ShuffleDescriptor::getResultPartitionID)
+                       .collect(Collectors.toList());
+
+               final List<ResultPartitionID> 
partitionsRequiringRpcPromoteCalls = partitionDeploymentDescriptors.stream()
+                       .filter(resultPartitionDeploymentDescriptor -> 
resultPartitionDeploymentDescriptor.getPartitionType().isPersistent())
                        
.map(ResultPartitionDeploymentDescriptor::getShuffleDescriptor)
                        .filter(descriptor -> 
descriptor.storesLocalResourcesOn().isPresent())
                        .map(ShuffleDescriptor::getResultPartitionID)
                        .collect(Collectors.toList());
 
-               if (!partitionsRequiringRpcReleaseCalls.isEmpty()) {
+               if (!partitionsRequiringRpcReleaseCalls.isEmpty() || 
!partitionsRequiringRpcPromoteCalls.isEmpty()) {
                        taskExecutorGatewayLookup
                                .lookup(potentialPartitionLocation)
                                .ifPresent(taskExecutorGateway ->
-                                       
taskExecutorGateway.releaseOrPromotePartitions(jobId, 
partitionsRequiringRpcReleaseCalls, Collections.emptyList()));
+                                       
taskExecutorGateway.releaseOrPromotePartitions(jobId, 
partitionsRequiringRpcReleaseCalls, partitionsRequiringRpcPromoteCalls));
                }
        }
 
        private void 
internalReleasePartitionsOnShuffleMaster(Collection<ResultPartitionDeploymentDescriptor>
 partitionDeploymentDescriptors) {
                partitionDeploymentDescriptors.stream()
+                       .filter(resultPartitionDeploymentDescriptor -> 
!resultPartitionDeploymentDescriptor.getPartitionType().isPersistent())
 
 Review comment:
   We wouldn't need this extra filter condition if we reused the filtered 
partitions created in `internalReleaseOrPromotePartitionsOnTaskExecutor`.

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