1
0

[HUDI-690] Filter out inflight compaction in exporter (#1667)

This commit is contained in:
Raymond Xu
2020-05-26 09:23:34 -07:00
committed by GitHub
parent 46572d04c4
commit 6c450957ce
3 changed files with 7 additions and 6 deletions

View File

@@ -152,8 +152,8 @@ public class HoodieDefaultTimeline implements HoodieTimeline {
}
/**
* Get all instants (commits, delta commits, clean, savepoint, rollback) that result in actions, in the active
* timeline.
* Get all instants (commits, delta commits, compaction, clean, savepoint, rollback) that result in actions,
* in the active timeline.
*/
public HoodieTimeline getAllCommitsTimeline() {
return getTimelineOfActions(CollectionUtils.createSet(COMMIT_ACTION, DELTA_COMMIT_ACTION,

View File

@@ -74,10 +74,10 @@ public class HoodieSnapshotCopier implements Serializable {
final SerializableConfiguration serConf = new SerializableConfiguration(jsc.hadoopConfiguration());
final HoodieTableMetaClient tableMetadata = new HoodieTableMetaClient(fs.getConf(), baseDir);
final BaseFileOnlyView fsView = new HoodieTableFileSystemView(tableMetadata,
tableMetadata.getActiveTimeline().getCommitsTimeline().filterCompletedInstants());
tableMetadata.getActiveTimeline().getCommitsAndCompactionTimeline().filterCompletedInstants());
// Get the latest commit
Option<HoodieInstant> latestCommit =
tableMetadata.getActiveTimeline().getCommitsTimeline().filterCompletedInstants().lastInstant();
tableMetadata.getActiveTimeline().getCommitsAndCompactionTimeline().filterCompletedInstants().lastInstant();
if (!latestCommit.isPresent()) {
LOG.warn("No commits present. Nothing to snapshot");
return;

View File

@@ -146,7 +146,8 @@ public class HoodieSnapshotExporter {
private Option<String> getLatestCommitTimestamp(FileSystem fs, Config cfg) {
final HoodieTableMetaClient tableMetadata = new HoodieTableMetaClient(fs.getConf(), cfg.sourceBasePath);
Option<HoodieInstant> latestCommit = tableMetadata.getActiveTimeline().getCommitsTimeline().filterCompletedInstants().lastInstant();
Option<HoodieInstant> latestCommit = tableMetadata.getActiveTimeline().getCommitsAndCompactionTimeline()
.filterCompletedInstants().lastInstant();
return latestCommit.isPresent() ? Option.of(latestCommit.get().getTimestamp()) : Option.empty();
}
@@ -251,7 +252,7 @@ public class HoodieSnapshotExporter {
FileSystem fs = FSUtils.getFs(cfg.sourceBasePath, jsc.hadoopConfiguration());
HoodieTableMetaClient tableMetadata = new HoodieTableMetaClient(fs.getConf(), cfg.sourceBasePath);
return new HoodieTableFileSystemView(tableMetadata, tableMetadata
.getActiveTimeline().getCommitsTimeline().filterCompletedInstants());
.getActiveTimeline().getCommitsAndCompactionTimeline().filterCompletedInstants());
}
public static void main(String[] args) throws IOException {