[GitHub] [hudi] danny0405 commented on a diff in pull request #7561: [HUDI-5477] Optimize timeline loading in Hudi sync client
danny0405 commented on code in PR #7561: URL: https://github.com/apache/hudi/pull/7561#discussion_r1059829655 ## 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: Is this resolved ? -- 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
[GitHub] [hudi] danny0405 commented on a diff in pull request #7561: [HUDI-5477] Optimize timeline loading in Hudi sync client
danny0405 commented on code in PR #7561: URL: https://github.com/apache/hudi/pull/7561#discussion_r1059228760 ## 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 mean if `activeTimeline.isBeforeTimelineStarts(exclusiveStartInstantTime)` is true, the whole merged timeline should be scanned, there is no need to calling `#findInstantsAfter`. -- 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