jsbali commented on a change in pull request #2677:
URL: https://github.com/apache/hudi/pull/2677#discussion_r600461519
##########
File path:
hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/io/TestHoodieTimelineArchiveLog.java
##########
@@ -388,6 +391,31 @@ public void testArchiveCommitSavepointNoHole() throws
IOException {
"Archived commits should always be safe");
}
+ @Test
+ public void testArchiveRollbacks() throws IOException {
+ HoodieWriteConfig cfg = HoodieWriteConfig.newBuilder().withPath(basePath)
+
.withSchema(HoodieTestDataGenerator.TRIP_EXAMPLE_SCHEMA).withParallelism(2,
2).forTable("test-trip-table")
+
.withCompactionConfig(HoodieCompactionConfig.newBuilder().retainCommits(1).archiveCommitsWith(2,
3).build())
+ .build();
+
+ createCommitAndRollbackFile("100", "101", false);
+ createCommitAndRollbackFile("102", "103", false);
+ createCommitAndRollbackFile("104", "105", false);
+ createCommitAndRollbackFile("106", "107", false);
+
+ HoodieTable table = HoodieSparkTable.create(cfg, context);
+ HoodieTimelineArchiveLog archiveLog = new HoodieTimelineArchiveLog(cfg,
table);
+
+ assertTrue(archiveLog.archiveIfRequired(context));
+ HoodieTimeline timeline =
metaClient.getActiveTimeline().reload().getCommitsTimeline().filterCompletedInstants();
+ assertEquals(2, timeline.countInstants(),
+ "first two commits must have been archived");
+ assertFalse(metaClient.getActiveTimeline().containsInstant(new
HoodieInstant(false, HoodieTimeline.ROLLBACK_ACTION, "101")),
+ "first rollback must have been archived");
+ assertFalse(metaClient.getActiveTimeline().containsInstant(new
HoodieInstant(false, HoodieTimeline.ROLLBACK_ACTION, "103")),
Review comment:
Done
--
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]