Search in sources :

Example 61 with BufferOrEvent

use of org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent in project flink by apache.

the class CheckpointBarrierTrackerTest method testSingleChannelWithSkippedBarriers.

@Test
public void testSingleChannelWithSkippedBarriers() throws Exception {
    BufferOrEvent[] sequence = { createBuffer(0), createBarrier(1, 0), createBuffer(0), createBuffer(0), createBarrier(3, 0), createBuffer(0), createBarrier(4, 0), createBarrier(6, 0), createBuffer(0), createBarrier(7, 0), createBuffer(0), createBarrier(10, 0), createBuffer(0) };
    CheckpointSequenceValidator validator = new CheckpointSequenceValidator(1, 3, 4, 6, 7, 10);
    inputGate = createCheckpointedInputGate(1, sequence, validator);
    for (BufferOrEvent boe : sequence) {
        assertEquals(boe, inputGate.pollNext().get());
    }
}
Also used : BufferOrEvent(org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent) Test(org.junit.Test)

Example 62 with BufferOrEvent

use of org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent in project flink by apache.

the class CheckpointBarrierTrackerTest method testAbortCheckpointsAfterEndOfPartitionReceived.

@Test
public void testAbortCheckpointsAfterEndOfPartitionReceived() throws Exception {
    BufferOrEvent[] sequence = { /* 0 */
    createEndOfPartition(2), /* 1 */
    createBarrier(5, 0), /* 2 */
    createBarrier(6, 0), /* 3 */
    createCancellationBarrier(6, 1), /* 4 */
    createEndOfPartition(1), /* 5 */
    createCancellationBarrier(7, 0) };
    ValidatingCheckpointHandler validator = new ValidatingCheckpointHandler(-1);
    inputGate = createCheckpointedInputGate(3, sequence, validator);
    for (BufferOrEvent boe : sequence) {
        assertEquals(boe, inputGate.pollNext().get());
    }
    assertThat(validator.abortedCheckpoints, contains(5L, 6L, 7L));
    assertEquals(0, validator.getTriggeredCheckpointCounter());
}
Also used : BufferOrEvent(org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent) Test(org.junit.Test)

Example 63 with BufferOrEvent

use of org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent in project flink by apache.

the class CheckpointBarrierTrackerTest method testMultiChannelNoBarriers.

@Test
public void testMultiChannelNoBarriers() throws Exception {
    BufferOrEvent[] sequence = { createBuffer(2), createBuffer(2), createBuffer(0), createBuffer(1), createBuffer(0), createBuffer(3), createBuffer(1), createBuffer(1), createBuffer(2) };
    inputGate = createCheckpointedInputGate(4, sequence);
    for (BufferOrEvent boe : sequence) {
        assertEquals(boe, inputGate.pollNext().get());
    }
}
Also used : BufferOrEvent(org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent) Test(org.junit.Test)

Example 64 with BufferOrEvent

use of org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent in project flink by apache.

the class CheckpointBarrierTrackerTest method testSingleChannelNoBarriers.

@Test
public void testSingleChannelNoBarriers() throws Exception {
    BufferOrEvent[] sequence = { createBuffer(0), createBuffer(0), createBuffer(0) };
    inputGate = createCheckpointedInputGate(1, sequence);
    for (BufferOrEvent boe : sequence) {
        assertEquals(boe, inputGate.pollNext().get());
    }
}
Also used : BufferOrEvent(org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent) Test(org.junit.Test)

Example 65 with BufferOrEvent

use of org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent in project flink by apache.

the class CheckpointBarrierTrackerTest method testTriggerCheckpointsAfterReceivedEndOfPartition.

@Test
public void testTriggerCheckpointsAfterReceivedEndOfPartition() throws Exception {
    BufferOrEvent[] sequence = { /* 0 */
    createEndOfPartition(2), /* 1 */
    createBarrier(5, 0), /* 2 */
    createBarrier(6, 0), /* 3 */
    createBarrier(6, 1), /* 4 */
    createEndOfPartition(1), /* 5 */
    createBarrier(7, 0) };
    ValidatingCheckpointHandler validator = new ValidatingCheckpointHandler(-1);
    inputGate = createCheckpointedInputGate(3, sequence, validator);
    for (BufferOrEvent boe : sequence) {
        assertEquals(boe, inputGate.pollNext().get());
    }
    assertThat(validator.triggeredCheckpoints, contains(6L, 7L));
    assertEquals(0, validator.getAbortedCheckpointCounter());
}
Also used : BufferOrEvent(org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent) Test(org.junit.Test)

Aggregations

BufferOrEvent (org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent)73 Test (org.junit.Test)57 CheckpointBarrier (org.apache.flink.runtime.io.network.api.CheckpointBarrier)11 CheckpointOptions (org.apache.flink.runtime.checkpoint.CheckpointOptions)9 StatefulTask (org.apache.flink.runtime.jobgraph.tasks.StatefulTask)9 IOException (java.io.IOException)8 CheckpointMetrics (org.apache.flink.runtime.checkpoint.CheckpointMetrics)8 CheckpointDeclineOnCancellationBarrierException (org.apache.flink.runtime.checkpoint.decline.CheckpointDeclineOnCancellationBarrierException)8 Random (java.util.Random)7 ArrayList (java.util.ArrayList)6 CheckpointDeclineSubsumedException (org.apache.flink.runtime.checkpoint.decline.CheckpointDeclineSubsumedException)5 CheckpointMetaData (org.apache.flink.runtime.checkpoint.CheckpointMetaData)4 InputChannelInfo (org.apache.flink.runtime.checkpoint.channel.InputChannelInfo)4 Buffer (org.apache.flink.runtime.io.network.buffer.Buffer)4 MemorySegment (org.apache.flink.core.memory.MemorySegment)3 AbstractEvent (org.apache.flink.runtime.event.AbstractEvent)3 CancelCheckpointMarker (org.apache.flink.runtime.io.network.api.CancelCheckpointMarker)3 EndOfPartitionEvent (org.apache.flink.runtime.io.network.api.EndOfPartitionEvent)3 DeserializationResult (org.apache.flink.runtime.io.network.api.serialization.RecordDeserializer.DeserializationResult)3 NetworkBufferPool (org.apache.flink.runtime.io.network.buffer.NetworkBufferPool)3