yihua commented on code in PR #18489:
URL: https://github.com/apache/hudi/pull/18489#discussion_r3066962712
##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/TimelineUtils.java:
##########
@@ -647,4 +647,28 @@ public static <T> Option<HoodieInstantWriter>
getHoodieInstantWriterOption(Hoodi
}
return writerOption;
}
+
+ public static Option<Pair<String, HoodieCommitMetadata>>
getLatestInstantAndCommitMetadataWithValidCheckpointInfo(HoodieTimeline
timeline,
+
String... checkpointKeys) throws
IOException {
+ return (Option<Pair<String, HoodieCommitMetadata>>)
timeline.getReverseOrderedInstants().map(instant -> {
Review Comment:
🤖 The old code used `timeline.readCommitMetadata(instant)` while this uses
`HoodieCommitMetadata.fromBytes(...)` directly. `readCommitMetadata` may handle
additional cases (e.g., different commit metadata subtypes like
`HoodieReplaceCommitMetadata`). Could you check whether bypassing
`readCommitMetadata` causes any metadata to be deserialized incorrectly?
<sub><i>- Generated by an AI agent and may contain mistakes. Please verify
any suggestions before applying.</i></sub>
##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/TimelineUtils.java:
##########
@@ -647,4 +647,28 @@ public static <T> Option<HoodieInstantWriter>
getHoodieInstantWriterOption(Hoodi
}
return writerOption;
}
+
+ public static Option<Pair<String, HoodieCommitMetadata>>
getLatestInstantAndCommitMetadataWithValidCheckpointInfo(HoodieTimeline
timeline,
+
String... checkpointKeys) throws
IOException {
+ return (Option<Pair<String, HoodieCommitMetadata>>)
timeline.getReverseOrderedInstants().map(instant -> {
+ try {
+ HoodieCommitMetadata commitMetadata = HoodieCommitMetadata
+ .fromBytes(timeline.getInstantDetails(instant).get(),
HoodieCommitMetadata.class);
+ boolean hasCheckpointMetadata = false;
Review Comment:
🤖 The old code returned `instant.toString()` (which includes action type and
state, e.g. `20230101000000__commit__COMPLETED`), but this now returns
`instant.getTimestamp()` (just the timestamp). Callers that relied on the full
instant string representation would see different values. Could you verify this
doesn't break any downstream consumers of the pair's left value?
<sub><i>- Generated by an AI agent and may contain mistakes. Please verify
any suggestions before applying.</i></sub>
--
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]