1
0

[HUDI-1749] Clean/Compaction/Rollback command maybe never exit when operation fail (#2752)

This commit is contained in:
li36909
2021-04-06 14:23:15 +08:00
committed by GitHub
parent e970e1f483
commit 920537cac8
3 changed files with 137 additions and 118 deletions

View File

@@ -110,6 +110,12 @@ public class HoodieCleaner {
String dirName = new Path(cfg.basePath).getName();
JavaSparkContext jssc = UtilHelpers.buildSparkContext("hoodie-cleaner-" + dirName, cfg.sparkMaster);
new HoodieCleaner(cfg, jssc).run();
try {
new HoodieCleaner(cfg, jssc).run();
} catch (Throwable throwable) {
LOG.error("Fail to run cleaning for " + cfg.basePath, throwable);
} finally {
jssc.stop();
}
}
}

View File

@@ -103,8 +103,14 @@ public class HoodieCompactor {
System.exit(1);
}
final JavaSparkContext jsc = UtilHelpers.buildSparkContext("compactor-" + cfg.tableName, cfg.sparkMaster, cfg.sparkMemory);
HoodieCompactor compactor = new HoodieCompactor(jsc, cfg);
compactor.compact(cfg.retry);
try {
HoodieCompactor compactor = new HoodieCompactor(jsc, cfg);
compactor.compact(cfg.retry);
} catch (Throwable throwable) {
LOG.error("Fail to run compaction for " + cfg.tableName, throwable);
} finally {
jsc.stop();
}
}
public int compact(int retry) {