TheR1sing3un commented on code in PR #12344:
URL: https://github.com/apache/hudi/pull/12344#discussion_r1887872833
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/index/bucket/ConsistentBucketIndexUtils.java:
##########
@@ -141,6 +140,16 @@ public static Option<HoodieConsistentHashingMetadata>
loadMetadata(HoodieTable t
// fix the in-consistency between un-committed and committed hashing
metadata files.
List<StoragePathInfo> fixed = new ArrayList<>();
+ if (maxCommitMetaFileTs != null) {
+ // add max committed metadata file to fixed list, we should return max
committed metadata file if there is not any metadata file can be successfully
fixed.
+ Option<StoragePathInfo> maxCommittedMetadataFileOpt =
Option.fromJavaOptional(hashingMetaFiles.stream().filter(hashingMetaFile -> {
+ String timestamp =
getTimestampFromFile(hashingMetaFile.getPath().getName());
+ return maxCommitMetaFileTs.equals(timestamp);
+ }).findFirst());
+ ValidationUtils.checkState(maxCommittedMetadataFileOpt.isPresent(),
+ () -> "Failed to find max committed metadata file but commit
marker file exist with instant: " + maxCommittedMetadataFileOpt);
+ fixed.add(maxCommittedMetadataFileOpt.get());
Review Comment:
> Can we return the `maxCommittedMetadataFileOpt` directly in line 175
instead of adding it to the fixed list.
If we directly return `maxCommittedMetadataFileOpt`, the fixing logic will
never be executed.
--
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]