dlg99 commented on code in PR #3522:
URL: https://github.com/apache/bookkeeper/pull/3522#discussion_r997409889
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieImpl.java:
##########
@@ -112,8 +113,9 @@ public class BookieImpl extends BookieCriticalThread
implements Bookie {
private int exitCode = ExitCode.OK;
- private final ConcurrentLongHashMap<byte[]> masterKeyCache =
- ConcurrentLongHashMap.<byte[]>newBuilder().build();
+ // key: masterKey, values: set of ledgerId
+ private final static ConcurrentOpenHashMap<byte[], ConcurrentLongHashSet>
masterKeyCache
Review Comment:
this flips cache from ledgerId -> key to key -> set of ledgerids.
While it reduces memory usage in cases of the same key, it does not help if
ledgers are stored (not gc'd) for too long, there are too many ledgers etc. It
will slow down rate at which cache eats up the memory.
It also makes get/remove operations for the cache slow.
What's worse is that outside of Pulsar we don't know how people use the
keys, what if some user sets a unique key for each ledger? the problem just got
worse for them.
--
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]