dlg99 commented on a change in pull request #2975:
URL: https://github.com/apache/bookkeeper/pull/2975#discussion_r779193772
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieImpl.java
##########
@@ -1259,7 +1261,17 @@ LedgerDescriptor getLedgerForEntry(ByteBuf entry, final
byte[] masterKey)
}
private Journal getJournal(long ledgerId) {
- return journals.get(MathUtils.signSafeMod(ledgerId, journals.size()));
+ String dividendString = Double.toString(ledgerId);
+ byte[] secretBytes = null;
+ int index = 0;
+ try {
+ secretBytes =
MessageDigest.getInstance("md5").digest(dividendString.getBytes());
+ BigInteger md5Code = new BigInteger(1, secretBytes);
Review comment:
+1 for the performance concern.
Would something like
```
final int PRIME = 31;
return journals.get(MathUtils.signSafeMod(ledgerId, PRIME *
journals.size()));
```
work well enough?
--
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]