Search in sources :

Example 1 with TestingOperatorInfo

use of org.apache.flink.runtime.operators.coordination.TestingOperatorInfo 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 TestingOperatorInfo

use of org.apache.flink.runtime.operators.coordination.TestingOperatorInfo in project flink by apache.

the class PendingCheckpointTest method testInitiallyUnacknowledgedCoordinatorStates.

@Test
public void testInitiallyUnacknowledgedCoordinatorStates() throws Exception {
    final PendingCheckpoint checkpoint = createPendingCheckpointWithCoordinators(new TestingOperatorInfo(), new TestingOperatorInfo());
    assertEquals(2, checkpoint.getNumberOfNonAcknowledgedOperatorCoordinators());
    assertFalse(checkpoint.isFullyAcknowledged());
}
Also used : TestingOperatorInfo(org.apache.flink.runtime.operators.coordination.TestingOperatorInfo) Test(org.junit.Test)

Example 3 with TestingOperatorInfo

use of org.apache.flink.runtime.operators.coordination.TestingOperatorInfo 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 4 with TestingOperatorInfo

use of org.apache.flink.runtime.operators.coordination.TestingOperatorInfo 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)

Example 5 with TestingOperatorInfo

use of org.apache.flink.runtime.operators.coordination.TestingOperatorInfo in project flink by apache.

the class PendingCheckpointTest method testAcknowledgeUnknownCoordinator.

@Test
public void testAcknowledgeUnknownCoordinator() throws Exception {
    final PendingCheckpoint checkpoint = createPendingCheckpointWithCoordinators(new TestingOperatorInfo());
    final TaskAcknowledgeResult ack = checkpoint.acknowledgeCoordinatorState(new TestingOperatorInfo(), null);
    assertEquals(TaskAcknowledgeResult.UNKNOWN, ack);
}
Also used : TaskAcknowledgeResult(org.apache.flink.runtime.checkpoint.PendingCheckpoint.TaskAcknowledgeResult) TestingOperatorInfo(org.apache.flink.runtime.operators.coordination.TestingOperatorInfo) Test(org.junit.Test)

Aggregations

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