openinx commented on a change in pull request #2042:
URL: https://github.com/apache/iceberg/pull/2042#discussion_r608293956
##########
File path:
flink/src/test/java/org/apache/iceberg/flink/sink/TestIcebergFilesCommitter.java
##########
@@ -140,6 +141,41 @@ public void testCommitTxnWithoutDataFiles() throws
Exception {
}
}
+ @Test
+ public void testEmptyCommits() throws Exception {
+
table.updateProperties().set(IcebergFilesCommitter.MAX_CONTINUOUS_EMPTY_COMMITS,
"3").commit();
+ JobID jobId = new JobID();
+ long checkpointId = 0;
+ long timestamp = 0;
+ try (OneInputStreamOperatorTestHarness<WriteResult, Void> harness =
createStreamSink(jobId)) {
+ int before = snapshotCount();
+ doEmptyCommit(harness, ++checkpointId, ++timestamp);
+ doEmptyCommit(harness, ++checkpointId, ++timestamp);
+ doEmptyCommit(harness, ++checkpointId, ++timestamp);
+ int after = snapshotCount();
+ Assert.assertEquals(1, after - before);
+ }
+ }
+
+ private void doEmptyCommit(
+ OneInputStreamOperatorTestHarness<WriteResult, Void> harness,
+ long checkpointId,
+ long timestamp) throws Exception {
+ harness.setup();
+ harness.open();
+ harness.processElement(WriteResult.builder().build(), ++timestamp);
+ harness.snapshot(++checkpointId, ++timestamp);
+ harness.notifyOfCompletedCheckpoint(checkpointId);
+ }
+
+ private int snapshotCount() {
Review comment:
We've already provided the `assertSnapshotSize` so I think we don't
have to introduce an extra `snapshotCount()` method now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]