danny0405 commented on code in PR #8896:
URL: https://github.com/apache/hudi/pull/8896#discussion_r1228979598
##########
hudi-common/src/main/java/org/apache/hudi/common/model/HoodieConsistentHashingMetadata.java:
##########
@@ -83,14 +83,34 @@ public
HoodieConsistentHashingMetadata(@JsonProperty("version") short version, @
* Construct default metadata with all bucket's file group uuid initialized
*/
public HoodieConsistentHashingMetadata(String partitionPath, int numBuckets)
{
- this((short) 0, partitionPath, HoodieTimeline.INIT_INSTANT_TS, numBuckets,
0, constructDefaultHashingNodes(numBuckets));
+ this((short) 0, partitionPath, HoodieTimeline.INIT_INSTANT_TS, numBuckets,
0, constructDefaultHashingNodes(partitionPath, numBuckets));
this.firstCreated = true;
}
- private static List<ConsistentHashingNode> constructDefaultHashingNodes(int
numBuckets) {
+ private static List<ConsistentHashingNode>
constructDefaultHashingNodes(String partitionPath, int numBuckets) {
long step = ((long) HASH_VALUE_MASK + numBuckets - 1) / numBuckets;
+ String uuidPostfix = partitionPathToUuidPostfix(partitionPath);
return IntStream.range(1, numBuckets + 1)
- .mapToObj(i -> new ConsistentHashingNode((int) Math.min(step * i,
HASH_VALUE_MASK), FSUtils.createNewFileIdPfx())).collect(Collectors.toList());
+ .mapToObj(i -> new ConsistentHashingNode((int) Math.min(step * i,
HASH_VALUE_MASK), String.format("%08d-%s", i - 1,
uuidPostfix))).collect(Collectors.toList());
+ }
+
+ /**
+ * Format partition path to simulate an UUID. E.g.,
+ * - part2/part3 -> 0000-0000-0000-00part2part3
+ * - part1/part2/part3 -> 0000-0000-0par-t1part2part3
+ *
+ * @VisibleForTesting
Review Comment:
Is the method visible?
--
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]