You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2021/04/14 21:59:35 UTC

[GitHub] [bookkeeper] mauricebarnum commented on a change in pull request #2686: Rocksdb tombstones

mauricebarnum commented on a change in pull request #2686:
URL: https://github.com/apache/bookkeeper/pull/2686#discussion_r613614077



##########
File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/LedgerMetadataIndex.java
##########
@@ -228,20 +228,28 @@ public void flush() throws IOException {
 
     public void removeDeletedLedgers() throws IOException {
         LongWrapper key = LongWrapper.get();
+        final byte[] startKey = new byte[8];
+        final byte[] endKey = new byte[8];
 
         int deletedLedgers = 0;
         while (!pendingDeletedLedgers.isEmpty()) {
             long ledgerId = pendingDeletedLedgers.poll();
             key.set(ledgerId);
             ledgersDb.delete(key.array);
-            deletedLedgers++;
+            if (deletedLedgers++ == 0) {
+                System.arraycopy(key.array, 0, startKey, 0, startKey.length);
+            }
+            System.arraycopy(key.array, 0, endKey, 0, endKey.length);

Review comment:
       good catch. better: only startKey needs to be copied. endKey can be used directly.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org