yihua commented on code in PR #7561: URL: https://github.com/apache/hudi/pull/7561#discussion_r1061210337
########## hudi-common/src/main/java/org/apache/hudi/common/table/timeline/TimelineUtils.java: ########## @@ -210,11 +210,30 @@ public static HoodieDefaultTimeline getTimeline(HoodieTableMetaClient metaClient return activeTimeline; } + /** + * Returns a Hudi timeline with commits after the given instant time (exclusive). + * + * @param metaClient {@link HoodieTableMetaClient} instance. + * @param exclusiveStartInstantTime Start instant time (exclusive). + * @return Hudi timeline. + */ + public static HoodieTimeline getCommitsTimelineAfter( + HoodieTableMetaClient metaClient, String exclusiveStartInstantTime) { + HoodieActiveTimeline activeTimeline = metaClient.getActiveTimeline(); + HoodieDefaultTimeline timeline = + activeTimeline.isBeforeTimelineStarts(exclusiveStartInstantTime) + ? metaClient.getArchivedTimeline(exclusiveStartInstantTime) + .mergeTimeline(activeTimeline) + : activeTimeline; + return timeline.getCommitsTimeline() + .findInstantsAfter(exclusiveStartInstantTime, Integer.MAX_VALUE); + } Review Comment: I think I misunderstood your comment before. When `activeTimeline.isBeforeTimelineStarts(exclusiveStartInstantTime)` is true, `metaClient.getArchivedTimeline(exclusiveStartInstantTime)` is called to return the archived timeline, which still contains the instant exclusiveStartInstantTime (inclusive). So we still need `#findInstantsAfter` as the last step to exclude that instant. -- 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: commits-unsubscr...@hudi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org