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_r339090660
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/PartitionTrackerImplTest.java
##########
@@ -233,6 +233,53 @@ public void testStopTrackingIssuesNoReleaseCalls() {
assertEquals(0,
shuffleMaster.externallyReleasedPartitions.size());
}
+ @Test
+ public void testReleaseOrPromote() {
+ final TestingShuffleMaster shuffleMaster = new
TestingShuffleMaster();
+
+ final Queue<Tuple4<ResourceID, JobID,
Collection<ResultPartitionID>, Collection<ResultPartitionID>>>
taskExecutorReleaseCalls = new ArrayBlockingQueue<>(4);
+ final PartitionTracker partitionTracker = new
PartitionTrackerImpl(
+ new JobID(),
+ shuffleMaster,
+ resourceId ->
Optional.of(createTaskExecutorGateway(resourceId, taskExecutorReleaseCalls))
+ );
+
+ final ResourceID taskExecutorId1 = ResourceID.generate();
+ final ResultPartitionID jobPartitionId = new
ResultPartitionID();
+ final ResultPartitionID clusterPartitionId = new
ResultPartitionID();
+
+ // any partition type that is not BLOCKING_PERSISTENT denotes a
job partition
+ final ResultPartitionDeploymentDescriptor jobPartition =
createResultPartitionDeploymentDescriptor(jobPartitionId,
ResultPartitionType.BLOCKING, true);
+ partitionTracker.startTrackingPartition(
+ taskExecutorId1,
+ jobPartition);
+
+ // BLOCKING_PERSISTENT denotes a cluster partition
+ final ResultPartitionDeploymentDescriptor clusterPartition =
createResultPartitionDeploymentDescriptor(clusterPartitionId,
ResultPartitionType.BLOCKING_PERSISTENT, true);
+ partitionTracker.startTrackingPartition(
+ taskExecutorId1,
+ clusterPartition);
+
+
partitionTracker.stopTrackingAndReleaseOrPromotePartitionsFor(taskExecutorId1);
+
+ // exactly one call should have been made to the hosting task
executor
+ assertEquals(1, taskExecutorReleaseCalls.size());
Review comment:
nit: I think `assertThat(taskExecutorReleaseCalls, hasSize(1))` is a bit
nicer.
----------------------------------------------------------------
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