Search in sources :

Example 1 with MockSplitEnumeratorCheckpointSerializer

use of org.apache.flink.api.connector.source.mocks.MockSplitEnumeratorCheckpointSerializer in project flink by apache.

the class SourceCoordinatorTest method createCheckpointDataWithSerdeV0.

// ------------------------------------------------------------------------
// test helpers
// ------------------------------------------------------------------------
private byte[] createCheckpointDataWithSerdeV0(Set<MockSourceSplit> splits) throws Exception {
    final MockSplitEnumeratorCheckpointSerializer enumChkptSerializer = new MockSplitEnumeratorCheckpointSerializer();
    final DataOutputSerializer serializer = new DataOutputSerializer(32);
    serializer.writeInt(SourceCoordinatorSerdeUtils.VERSION_0);
    serializer.writeInt(enumChkptSerializer.getVersion());
    final byte[] serializedEnumChkpt = enumChkptSerializer.serialize(splits);
    serializer.writeInt(serializedEnumChkpt.length);
    serializer.write(serializedEnumChkpt);
    // Version 0 wrote number of reader, see FLINK-21452
    serializer.writeInt(0);
    // Version 0 wrote split assignment tracker
    // SplitSerializer version used in assignment tracker
    serializer.writeInt(0);
    // Number of checkpoint in assignment tracker
    serializer.writeInt(0);
    return serializer.getCopyOfBuffer();
}
Also used : MockSplitEnumeratorCheckpointSerializer(org.apache.flink.api.connector.source.mocks.MockSplitEnumeratorCheckpointSerializer) DataOutputSerializer(org.apache.flink.core.memory.DataOutputSerializer)

Aggregations

MockSplitEnumeratorCheckpointSerializer (org.apache.flink.api.connector.source.mocks.MockSplitEnumeratorCheckpointSerializer)1 DataOutputSerializer (org.apache.flink.core.memory.DataOutputSerializer)1