Skip to content

Commit

Permalink
add filterMorCompactionInstants for append
Browse files Browse the repository at this point in the history
  • Loading branch information
XuQianJin-Stars committed Sep 18, 2022
1 parent 649283e commit 2ebd741
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ private void init(HoodieRecord record) {
List<String> logFiles = new ArrayList<>();

Option<HoodieInstant> maxCompleteInstant = hoodieTable.getMetaClient().getActiveTimeline().getWriteTimeline()
.filterCompletedCompactionInstants().lastInstant();
.filterMorCompactionInstants().lastInstant();
if (maxCompleteInstant.isPresent()) {
if (fileSlice.isPresent()) {
baseInstantTime = fileSlice.get().getBaseInstantTime();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ public HoodieTimeline filterCompletedAndCompactionInstants() {
}

@Override
public HoodieTimeline filterCompletedCompactionInstants() {
public HoodieTimeline filterMorCompactionInstants() {
// Note: use for mor.
return new HoodieDefaultTimeline(instants.stream().filter(s -> s.isCompleted()
&& s.getAction().equals(HoodieTimeline.COMMIT_ACTION)), details);
return new HoodieDefaultTimeline(instants.stream().filter(s ->
((s.isRequested() || s.isInflight()) && s.getAction().equals(HoodieTimeline.COMPACTION_ACTION))
|| (s.isCompleted() && s.getAction().equals(HoodieTimeline.COMMIT_ACTION))), details);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public interface HoodieTimeline extends Serializable {
*
* @return New instance of HoodieTimeline with just completed compaction instants
*/
HoodieTimeline filterCompletedCompactionInstants();
HoodieTimeline filterMorCompactionInstants();

/**
* Timeline to just include commits (commit/deltacommit), compaction and replace actions.
Expand Down

0 comments on commit 2ebd741

Please sign in to comment.