use of org.apache.flink.runtime.state.changelog.SequenceNumber in project flink by apache.
the class FsStateChangelogWriterTest method testPersistAgain.
@Test
public void testPersistAgain() throws Exception {
withWriter((writer, uploader) -> {
byte[] bytes = getBytes();
SequenceNumber sqn = append(writer, bytes);
writer.persist(sqn);
uploader.reset();
writer.confirm(sqn, writer.lastAppendedSqnUnsafe().next());
writer.persist(sqn);
assertNoUpload(uploader, "confirmed changes shouldn't be re-uploaded");
});
}
use of org.apache.flink.runtime.state.changelog.SequenceNumber in project flink by apache.
the class FsStateChangelogWriterTest method testPersistFailure.
@Test(expected = IOException.class)
public void testPersistFailure() throws Exception {
withWriter((writer, uploader) -> {
byte[] bytes = getBytes();
SequenceNumber sqn = append(writer, bytes);
CompletableFuture<ChangelogStateHandleStreamImpl> future = writer.persist(sqn);
uploader.failUpload(new RuntimeException("test"));
try {
future.get();
} catch (ExecutionException e) {
rethrowIOException(e.getCause());
}
});
}
use of org.apache.flink.runtime.state.changelog.SequenceNumber in project flink by apache.
the class FsStateChangelogWriterTest method testNoReUploadBeforeCompletion.
@Test
public void testNoReUploadBeforeCompletion() throws Exception {
withWriter((writer, uploader) -> {
byte[] bytes = getBytes();
SequenceNumber sqn = append(writer, bytes);
writer.persist(sqn);
uploader.reset();
writer.persist(sqn);
assertNoUpload(uploader, "no re-upload should happen");
});
}
use of org.apache.flink.runtime.state.changelog.SequenceNumber in project flink by apache.
the class FsStateChangelogWriterTest method testPreUpload.
@Test
public void testPreUpload() throws Exception {
int threshold = 1000;
withWriter(threshold, (writer, uploader) -> {
byte[] bytes = getBytes(threshold);
SequenceNumber sqn = append(writer, bytes);
assertSubmittedOnly(uploader, bytes);
uploader.reset();
writer.persist(sqn);
assertNoUpload(uploader, "changes should have been pre-uploaded");
});
}
use of org.apache.flink.runtime.state.changelog.SequenceNumber in project flink by apache.
the class FsStateChangelogWriterTest method testPersistAfterReset.
/**
* Emulates checkpoint abortion followed by a new checkpoint.
*/
@Test
public void testPersistAfterReset() throws Exception {
withWriter((writer, uploader) -> {
byte[] bytes = getBytes();
SequenceNumber sqn = append(writer, bytes);
writer.reset(sqn, SequenceNumber.of(Long.MAX_VALUE));
uploader.reset();
writer.persist(sqn);
assertSubmittedOnly(uploader, bytes);
});
}
Aggregations