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_r339087107
##########
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());
Review comment:
This looks like duplicate code. The only difference is the filter condition.
I think it would be better to factor the common parts out into a reusable
method.
----------------------------------------------------------------
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