1
0

[HUDI-3369] New ScheduleAndExecute mode for HoodieCompactor and hudi-cli (#4750)

Schedule and execute compaction plan in one single mode.
This commit is contained in:
YueZhang
2022-02-07 17:31:34 +08:00
committed by GitHub
parent 0880a8a5e4
commit de206acbae
4 changed files with 249 additions and 48 deletions

View File

@@ -140,6 +140,33 @@ public class ITTestCompactionCommand extends AbstractShellIntegrationTest {
"Pending compaction must be completed");
}
/**
* Test case for command 'compaction scheduleAndExecute'.
*/
@Test
public void testCompactScheduleAndExecute() throws IOException {
// generate commits
generateCommits();
String schemaPath = Paths.get(basePath, "compaction.schema").toString();
writeSchemaToTmpFile(schemaPath);
CommandResult cr2 = getShell().executeCommand(
String.format("compaction scheduleAndExecute --parallelism %s --schemaFilePath %s --sparkMaster %s",
2, schemaPath, "local"));
assertAll("Command run failed",
() -> assertTrue(cr2.isSuccess()),
() -> assertTrue(
cr2.getResult().toString().startsWith("Schedule and execute compaction successfully completed")));
// assert compaction complete
assertTrue(HoodieCLI.getTableMetaClient().getActiveTimeline().reload()
.filterCompletedInstants().getInstants()
.map(HoodieInstant::getTimestamp).count() > 0,
"Completed compaction couldn't be 0");
}
/**
* Test case for command 'compaction validate'.
*/