xushiyan commented on code in PR #8876:
URL: https://github.com/apache/hudi/pull/8876#discussion_r1229315454
##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/TimelineUtils.java:
##########
@@ -295,4 +296,27 @@ public static Option<HoodieInstant>
getEarliestInstantForMetadataArchival(
return Option.empty();
}
}
+
+ /**
+ * Find the earliest incomplete commit, deltacommit, or non-clustering
replacecommit,
+ * so that the incremental pulls should be strictly before this instant.
+ * This is to guard around multi-writer scenarios where a commit starting
later than
+ * another commit from a concurrent writer can finish earlier, leaving an
inflight commit
+ * before a completed commit.
+ */
+ public static HoodieTimeline filterTimelineForIncrementalQueryIfNeeded(
+ HoodieTableMetaClient metaClient, HoodieTimeline
completedCommitTimeline, boolean useStateTransitionTime) {
+ if (useStateTransitionTime) {
+ return completedCommitTimeline;
+ }
+ Option<HoodieInstant> firstIncompleteCommit =
metaClient.getCommitsTimeline()
+ .filterInflightsAndRequested()
+ .filter(instant ->
+ !HoodieTimeline.REPLACE_COMMIT_ACTION.equals(instant.getAction())
+ || !ClusteringUtils.getClusteringPlan(metaClient,
instant).isPresent())
Review Comment:
as it's also filtered for inflight/requested
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]