use of org.apache.flink.runtime.state.CheckpointedStateScope.EXCLUSIVE in project flink by apache.
the class ChannelStateCheckpointWriterTest method testFileHandleSize.
@Test
public void testFileHandleSize() throws Exception {
int numChannels = 3;
int numWritesPerChannel = 4;
int numBytesPerWrite = 5;
ChannelStateWriteResult result = new ChannelStateWriteResult();
ChannelStateCheckpointWriter writer = createWriter(result, new FsCheckpointStreamFactory(getSharedInstance(), fromLocalFile(temporaryFolder.newFolder("checkpointsDir")), fromLocalFile(temporaryFolder.newFolder("sharedStateDir")), numBytesPerWrite - 1, numBytesPerWrite - 1).createCheckpointStateOutputStream(EXCLUSIVE));
InputChannelInfo[] channels = IntStream.range(0, numChannels).mapToObj(i -> new InputChannelInfo(0, i)).toArray(InputChannelInfo[]::new);
for (int call = 0; call < numWritesPerChannel; call++) {
for (int channel = 0; channel < numChannels; channel++) {
write(writer, channels[channel], getData(numBytesPerWrite));
}
}
writer.completeInput();
writer.completeOutput();
for (InputChannelStateHandle handle : result.inputChannelStateHandles.get()) {
assertEquals((Integer.BYTES + numBytesPerWrite) * numWritesPerChannel, handle.getStateSize());
}
}
Aggregations