eolivelli commented on code in PR #3522:
URL: https://github.com/apache/bookkeeper/pull/3522#discussion_r1002944554
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java:
##########
@@ -181,6 +181,7 @@ public GarbageCollectorThread(ServerConfiguration conf,
}
gcStats.getDeletedLedgerCounter().inc();
ledgerStorage.deleteLedger(ledgerId);
+ BookieImpl.removeLedgerIdFromMasterKeyCache(ledgerId);
Review Comment:
have to at least move this to a Consumer<Long> and decuple
GarbageCollectorThread from BookieImpl
also, having a static variables means that if you run multiple bookies in a
test case (here in the BK repository) the values of the cache a messed up.
Probably it is not a big deal but it is a big code smell
##########
bookkeeper-server/src/test/java/org/apache/bookkeeper/util/collections/ConcurrentLongHashMapTest.java:
##########
@@ -117,6 +119,41 @@ public void testClear() {
assertTrue(map.capacity() == 4);
}
+ private void addSpecifyIncrement(ConcurrentLongHashMap<byte[]> mkc, int
start, int end) {
+ for (int i = start; i <= end; i++) {
+ assertNull(mkc.put(i, ("comment:" + i).getBytes(UTF_8)));
+ System.out.println("i=" + i + ",mkc.size=" + mkc.size() +
",mkc.capacity=" + mkc.capacity());
+ }
+ }
+
+ private void removeSpecifyIncrement(ConcurrentLongHashMap<byte[]> mkc, int
start, int end) {
+ for (int i = end; i >= start; i--) {
+ assertNotNull(mkc.remove(i));
+ System.out.println("i=" + i + ",mkc.size=" + mkc.size() +
",mkc.capacity=" + mkc.capacity());
Review Comment:
nit: use logger
##########
bookkeeper-server/src/test/java/org/apache/bookkeeper/util/collections/ConcurrentLongHashMapTest.java:
##########
@@ -117,6 +119,41 @@ public void testClear() {
assertTrue(map.capacity() == 4);
}
+ private void addSpecifyIncrement(ConcurrentLongHashMap<byte[]> mkc, int
start, int end) {
+ for (int i = start; i <= end; i++) {
+ assertNull(mkc.put(i, ("comment:" + i).getBytes(UTF_8)));
+ System.out.println("i=" + i + ",mkc.size=" + mkc.size() +
",mkc.capacity=" + mkc.capacity());
Review Comment:
nit: use logger
--
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]