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_r340541055
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/PartitionTrackerImpl.java
 ##########
 @@ -173,12 +199,69 @@ private void internalReleasePartitionsOnTaskExecutor(
                }
        }
 
-       private void 
internalReleasePartitionsOnShuffleMaster(Collection<ResultPartitionDeploymentDescriptor>
 partitionDeploymentDescriptors) {
-               partitionDeploymentDescriptors.stream()
+       private void internalReleaseOrPromotePartitionsOnTaskExecutor(
+               ResourceID potentialPartitionLocation,
+               Collection<ResultPartitionDeploymentDescriptor> 
partitionDeploymentDescriptors) {
+
+               final Set<ResultPartitionID> partitionsRequiringRpcReleaseCalls 
=
+                       getPartitionsToReleaseOrPromote(
+                               partitionDeploymentDescriptors,
+                               filterByPersistence(false));
+
+               final Set<ResultPartitionID> partitionsRequiringRpcPromoteCalls 
=
+                       getPartitionsToReleaseOrPromote(
+                               partitionDeploymentDescriptors,
+                               filterByPersistence(true));
+
+               if (!partitionsRequiringRpcReleaseCalls.isEmpty() || 
!partitionsRequiringRpcPromoteCalls.isEmpty()) {
+                       taskExecutorGatewayLookup
+                               .lookup(potentialPartitionLocation)
+                               .ifPresent(taskExecutorGateway ->
+                                       
taskExecutorGateway.releaseOrPromotePartitions(jobId, 
partitionsRequiringRpcReleaseCalls, partitionsRequiringRpcPromoteCalls));
+               }
+       }
+
+       private static Set<ResultPartitionID> getPartitionsToReleaseOrPromote(
+                       Collection<ResultPartitionDeploymentDescriptor> 
partitionDeploymentDescriptors,
+                       Predicate<ResultPartitionDeploymentDescriptor> 
persistenceFilter) {
+
+               return partitionDeploymentDescriptors.stream()
+                       
.filter(PartitionTrackerImpl::excludePartitionsWithoutLocalResources)
 
 Review comment:
   What happens with cluster partitions which don't have local resources? Are 
we gonna tell the `ShuffleMaster` about them?

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