Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ private static int doBootstrap(JavaSparkContext jsc, String tableName, String ta
}

private static int rollback(JavaSparkContext jsc, String instantTime, String basePath, Boolean rollbackUsingMarkers) throws Exception {
SparkRDDWriteClient client = createHoodieClient(jsc, basePath, rollbackUsingMarkers);
SparkRDDWriteClient client = createHoodieClient(jsc, basePath, rollbackUsingMarkers, false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this patch fixing for ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call here is supposed to call method at L529 here, but currently it's calling method at L534 here, and it's passing rollbackUsingMarkers as lazyCleanPolicy, which would cause issues when rollbackUsingMarkers is passed in hudi-cli

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any possibility we write a test here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can but adding a test is non-trival work, as it involves another option introduced in this PR
We might want to file a seperate jira to add a test.

Apart from that, I tested this fix manually on AWS EMR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's try to see if we can add a test please. would be helpful in general.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a test for this change. Could you take a look again? Also I've noticed a flink IT test has been failing: https://dev.azure.com/apache-hudi-ci-org/apache-hudi-ci/_build/results?buildId=9375&view=logs&j=3b6e910d-b98f-5de6-b9cb-1e5ff571f5de&t=30b5aae4-0ea0-5566-42d0-febf71a7061a&l=120490

I don't think my change would affect this test, but not sure if this is a flaky test, could you also take a look?

if (client.rollback(instantTime)) {
LOG.info(String.format("The commit \"%s\" rolled back.", instantTime));
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,22 @@ public void testRollbackCommit() throws Exception {

HoodieActiveTimeline timeline2 = metaClient.reloadActiveTimeline();
assertEquals(1, timeline2.getCommitsTimeline().countInstants(), "There should have 1 instants.");

// rollback with rollbackUsingMarkers==false
CommandResult cr3 = getShell().executeCommand(
String.format("commit rollback --commit %s --rollbackUsingMarkers false --sparkMaster %s --sparkMemory %s",
"100", "local", "4G"));

assertAll("Command run failed",
() -> assertTrue(cr3.isSuccess()),
() -> assertEquals("Commit 100 rolled back", cr3.getResult().toString()));

metaClient = HoodieTableMetaClient.reload(HoodieCLI.getTableMetaClient());

HoodieActiveTimeline rollbackTimeline3 = new RollbacksCommand.RollbackTimeline(metaClient);
assertEquals(3, rollbackTimeline3.getRollbackTimeline().countInstants(), "There should have 3 rollback instant.");

HoodieActiveTimeline timeline3 = metaClient.reloadActiveTimeline();
assertEquals(0, timeline3.getCommitsTimeline().countInstants(), "There should have 0 instants.");
}
}