Search in sources :

Example 1 with TaskAcknowledgeResult

use of org.apache.flink.runtime.checkpoint.PendingCheckpoint.TaskAcknowledgeResult 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 TaskAcknowledgeResult

use of org.apache.flink.runtime.checkpoint.PendingCheckpoint.TaskAcknowledgeResult 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 TaskAcknowledgeResult

use of org.apache.flink.runtime.checkpoint.PendingCheckpoint.TaskAcknowledgeResult 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

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