azagrebin commented on a change in pull request #9250:
[FLINK-13371][coordination] Prevent leaks of blocking partitions
URL: https://github.com/apache/flink/pull/9250#discussion_r308671467
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/Execution.java
##########
@@ -1311,16 +1312,47 @@ private void startTrackingPartitions(final ResourceID
taskExecutorId, final Coll
}
}
+ void stopTrackingPartitions() {
+ stopTrackingAndReleasePartitions(false);
+ }
+
void stopTrackingAndReleasePartitions() {
LOG.info("Discarding the results produced by task execution
{}.", attemptId);
+ stopTrackingAndReleasePartitions(true);
+ }
+
+ private void stopTrackingAndReleasePartitions(boolean release) {
if (producedPartitions != null && producedPartitions.size() >
0) {
final PartitionTracker partitionTracker =
getVertex().getExecutionGraph().getPartitionTracker();
final List<ResultPartitionID> producedPartitionIds =
producedPartitions.values().stream()
.map(ResultPartitionDeploymentDescriptor::getShuffleDescriptor)
.map(ShuffleDescriptor::getResultPartitionID)
.collect(Collectors.toList());
-
partitionTracker.stopTrackingAndReleasePartitions(producedPartitionIds);
+ if (release) {
+
partitionTracker.stopTrackingAndReleasePartitions(producedPartitionIds);
+ } else {
+
partitionTracker.stopTrackingPartitions(producedPartitionIds);
+ }
+ }
+ }
+
+ private void sendReleaseIntermediateResultPartitionsRpcCall() {
+ LOG.info("Discarding the results produced by task execution
{}.", attemptId);
+ final LogicalSlot slot = assignedResource;
+
+ if (slot != null) {
+ final TaskManagerGateway taskManagerGateway =
slot.getTaskManagerGateway();
+
+ Collection<ResultPartitionID> partitionIds =
producedPartitions.values().stream()
+
.map(ResultPartitionDeploymentDescriptor::getShuffleDescriptor)
+ .map(ShuffleDescriptor::getResultPartitionID)
+ .collect(Collectors.toList());
+
+ if (!partitionIds.isEmpty()) {
+ // TODO For some tests this could be a problem
when querying too early if all resources were released
+
taskManagerGateway.releasePartitions(getVertex().getJobId(), partitionIds);
Review comment:
the remote resources should be also released then (similar to
`internalReleasePartitionsOnShuffleMaster`):
```
producedPartitions
.values()
.forEach(p -> vertex
.getExecutionGraph()
.getShuffleMaster().releasePartitionExternally(p.getShuffleDescriptor()));
```
----------------------------------------------------------------
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