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_r340544660
##########
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));
Review comment:
Instead of iterating twice over the stream, one could partition the stream
once into two parts:
```
final Map<Boolean, Set<ResultPartitionID>> splitStream =
partitionDeploymentDescriptors.stream()
.filter(PartitionTrackerImpl::excludePartitionsWithoutLocalResources)
.collect(partitioningBy(
resultPartitionDeploymentDescriptor ->
resultPartitionDeploymentDescriptor.getPartitionType().isPersistent(),
Collectors.mapping(PartitionTrackerImpl::getResultPartitionId,
Collectors.toSet())));
final Set<ResultPartitionID> partitionsRequiringRpcReleaseCalls
= splitStream.get(false);
final Set<ResultPartitionID> partitionsRequiringRpcPromoteCalls
= splitStream.get(true);
```
----------------------------------------------------------------
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