StevenLuMT commented on code in PR #4642:
URL: https://github.com/apache/bookkeeper/pull/4642#discussion_r2244150407
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/ZkLedgerUnderreplicationManager.java:
##########
@@ -567,7 +567,12 @@ private long getLedgerToRereplicateFromHierarchy(String
parent, long depth)
return -1;
}
- Collections.shuffle(children);
+ if (depth == 3) {
+ // Avoid workers want to get the same ledger lock.
+ Collections.shuffle(children);
+ } else {
+ Collections.sort(children, Collections.reverseOrder());
+ }
Review Comment:
This code isn't very readable; I recommend optimizing it.
What does the magic number 3 mean? I recommend including constants to
explain their names.
--
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]