use of org.apache.flink.runtime.operators.coordination.OperatorInfo in project flink by apache.
the class PendingCheckpointTest method testDuplicateAcknowledgeCoordinator.
@Test
public void testDuplicateAcknowledgeCoordinator() throws Exception {
final OperatorInfo coordinator = new TestingOperatorInfo();
final PendingCheckpoint checkpoint = createPendingCheckpointWithCoordinators(coordinator);
checkpoint.acknowledgeCoordinatorState(coordinator, new TestingStreamStateHandle());
final TaskAcknowledgeResult secondAck = checkpoint.acknowledgeCoordinatorState(coordinator, null);
assertEquals(TaskAcknowledgeResult.DUPLICATE, secondAck);
}
use of org.apache.flink.runtime.operators.coordination.OperatorInfo in project flink by apache.
the class PendingCheckpointTest method testAcknowledgedCoordinatorStates.
@Test
public void testAcknowledgedCoordinatorStates() throws Exception {
final OperatorInfo coord1 = new TestingOperatorInfo();
final OperatorInfo coord2 = new TestingOperatorInfo();
final PendingCheckpoint checkpoint = createPendingCheckpointWithCoordinators(coord1, coord2);
final TaskAcknowledgeResult ack1 = checkpoint.acknowledgeCoordinatorState(coord1, new TestingStreamStateHandle());
final TaskAcknowledgeResult ack2 = checkpoint.acknowledgeCoordinatorState(coord2, null);
assertEquals(TaskAcknowledgeResult.SUCCESS, ack1);
assertEquals(TaskAcknowledgeResult.SUCCESS, ack2);
assertEquals(0, checkpoint.getNumberOfNonAcknowledgedOperatorCoordinators());
assertTrue(checkpoint.isFullyAcknowledged());
assertThat(checkpoint.getOperatorStates().keySet(), containsInAnyOrder(OPERATOR_ID, coord1.operatorId(), coord2.operatorId()));
}
use of org.apache.flink.runtime.operators.coordination.OperatorInfo in project flink by apache.
the class PendingCheckpointTest method createPendingCheckpointWithAcknowledgedCoordinators.
private PendingCheckpoint createPendingCheckpointWithAcknowledgedCoordinators(ByteStreamStateHandle... handles) throws IOException {
final OperatorInfo[] coords = new OperatorInfo[handles.length];
for (int i = 0; i < handles.length; i++) {
coords[i] = new TestingOperatorInfo();
}
final PendingCheckpoint checkpoint = createPendingCheckpointWithCoordinators(coords);
for (int i = 0; i < handles.length; i++) {
checkpoint.acknowledgeCoordinatorState(coords[i], handles[i]);
}
return checkpoint;
}
Aggregations