Search in sources :

Example 1 with OperatorInfo

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);
}
Also used : TestingStreamStateHandle(org.apache.flink.runtime.state.TestingStreamStateHandle) TaskAcknowledgeResult(org.apache.flink.runtime.checkpoint.PendingCheckpoint.TaskAcknowledgeResult) OperatorInfo(org.apache.flink.runtime.operators.coordination.OperatorInfo) TestingOperatorInfo(org.apache.flink.runtime.operators.coordination.TestingOperatorInfo) TestingOperatorInfo(org.apache.flink.runtime.operators.coordination.TestingOperatorInfo) Test(org.junit.Test)

Example 2 with OperatorInfo

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()));
}
Also used : TestingStreamStateHandle(org.apache.flink.runtime.state.TestingStreamStateHandle) TaskAcknowledgeResult(org.apache.flink.runtime.checkpoint.PendingCheckpoint.TaskAcknowledgeResult) OperatorInfo(org.apache.flink.runtime.operators.coordination.OperatorInfo) TestingOperatorInfo(org.apache.flink.runtime.operators.coordination.TestingOperatorInfo) TestingOperatorInfo(org.apache.flink.runtime.operators.coordination.TestingOperatorInfo) Test(org.junit.Test)

Example 3 with OperatorInfo

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;
}
Also used : OperatorInfo(org.apache.flink.runtime.operators.coordination.OperatorInfo) TestingOperatorInfo(org.apache.flink.runtime.operators.coordination.TestingOperatorInfo) TestingOperatorInfo(org.apache.flink.runtime.operators.coordination.TestingOperatorInfo)

Aggregations

OperatorInfo (org.apache.flink.runtime.operators.coordination.OperatorInfo)3 TestingOperatorInfo (org.apache.flink.runtime.operators.coordination.TestingOperatorInfo)3 TaskAcknowledgeResult (org.apache.flink.runtime.checkpoint.PendingCheckpoint.TaskAcknowledgeResult)2 TestingStreamStateHandle (org.apache.flink.runtime.state.TestingStreamStateHandle)2 Test (org.junit.Test)2