kl0u commented on a change in pull request #6466: [FLINK-10005][DataStream API]
StreamingFileSink: sets initialPartCounter=maxUsed in new Buckets
URL: https://github.com/apache/flink/pull/6466#discussion_r206782080
##########
File path:
flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/RollingPolicyTest.java
##########
@@ -134,24 +137,67 @@ public void testRollOnCheckpointPolicy() throws
Exception {
// we take a checkpoint so we roll.
testHarness.snapshot(1L, 1L);
+ for (File file: FileUtils.listFiles(outDir, null,
true)) {
+ if
(Objects.equals(file.getParentFile().getName(), "test1")) {
+
Assert.assertTrue(file.getName().contains(".part-0-1.inprogress."));
+ } else if
(Objects.equals(file.getParentFile().getName(), "test2")) {
+
Assert.assertTrue(file.getName().contains(".part-0-0.inprogress."));
+ }
+ }
+
// this will create a new part file
testHarness.processElement(new
StreamRecord<>(Tuple2.of("test1", 4), 4L));
TestUtils.checkLocalFs(outDir, 3, 0);
+ testHarness.notifyOfCompletedCheckpoint(1L);
+ for (File file: FileUtils.listFiles(outDir, null,
true)) {
+ if
(Objects.equals(file.getParentFile().getName(), "test1")) {
+ Assert.assertTrue(
+
file.getName().contains(".part-0-2.inprogress.") ||
file.getName().equals("part-0-1")
+ );
+ } else if
(Objects.equals(file.getParentFile().getName(), "test2")) {
+ Assert.assertEquals("part-0-0",
file.getName());
+ }
+ }
+
// and open and fill .part-0-2.inprogress
testHarness.processElement(new
StreamRecord<>(Tuple2.of("test1", 5), 5L));
testHarness.processElement(new
StreamRecord<>(Tuple2.of("test1", 6), 6L));
- TestUtils.checkLocalFs(outDir, 3, 0);
// nothing committed yet
+ TestUtils.checkLocalFs(outDir, 1, 2);
// we take a checkpoint so we roll.
testHarness.snapshot(2L, 2L);
testHarness.processElement(new
StreamRecord<>(Tuple2.of("test2", 7), 7L));
- TestUtils.checkLocalFs(outDir, 4, 0);
+ TestUtils.checkLocalFs(outDir, 2, 2);
+
+ for (File file: FileUtils.listFiles(outDir, null,
true)) {
+ if
(Objects.equals(file.getParentFile().getName(), "test1")) {
+ Assert.assertTrue(
+
file.getName().contains(".part-0-2.inprogress.") ||
file.getName().equals("part-0-1")
Review comment:
OK.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services