[HUDI-716] Exception: Not an Avro data file when running HoodieCleanClient.runClean (#1432)
This commit is contained in:
@@ -85,7 +85,11 @@ public class HoodieCleanClient<T extends HoodieRecordPayload> extends AbstractHo
|
||||
// If there are inflight(failed) or previously requested clean operation, first perform them
|
||||
table.getCleanTimeline().filterInflightsAndRequested().getInstants().forEach(hoodieInstant -> {
|
||||
LOG.info("There were previously unfinished cleaner operations. Finishing Instant=" + hoodieInstant);
|
||||
runClean(table, hoodieInstant);
|
||||
try {
|
||||
runClean(table, hoodieInstant);
|
||||
} catch (Exception e) {
|
||||
LOG.warn("Failed to perform previous clean operation, instant: " + hoodieInstant, e);
|
||||
}
|
||||
});
|
||||
|
||||
Option<HoodieCleanerPlan> cleanerPlanOpt = scheduleClean(startCleanTime);
|
||||
|
||||
@@ -984,6 +984,25 @@ public class TestCleaner extends TestHoodieClientBase {
|
||||
testPendingCompactions(config, 36, 9, retryFailure);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test clean previous corrupted cleanFiles.
|
||||
*/
|
||||
@Test
|
||||
public void testCleanPreviousCorruptedCleanFiles() {
|
||||
HoodieWriteConfig config =
|
||||
HoodieWriteConfig.newBuilder()
|
||||
.withPath(basePath).withAssumeDatePartitioning(true)
|
||||
.withCompactionConfig(HoodieCompactionConfig.newBuilder()
|
||||
.withCleanerPolicy(HoodieCleaningPolicy.KEEP_LATEST_FILE_VERSIONS).retainFileVersions(1).build())
|
||||
.build();
|
||||
|
||||
HoodieTestUtils.createCorruptedPendingCleanFiles(metaClient, getNextInstant());
|
||||
metaClient = HoodieTableMetaClient.reload(metaClient);
|
||||
|
||||
List<HoodieCleanStat> cleanStats = runCleaner(config);
|
||||
assertEquals("Must not clean any files", 0, cleanStats.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Common test method for validating pending compactions.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user