You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by eo...@apache.org on 2022/03/31 07:09:12 UTC

[bookkeeper] branch branch-4.14 updated: Revert rocksdb compaction on checkpoint to reduce cpu intensive (#3144)

This is an automated email from the ASF dual-hosted git repository.

eolivelli pushed a commit to branch branch-4.14
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/branch-4.14 by this push:
     new d3f9438  Revert rocksdb compaction on checkpoint to reduce cpu intensive (#3144)
d3f9438 is described below

commit d3f9438cf157194814f77973f7617c3d6890be57
Author: Hang Chen <ch...@apache.org>
AuthorDate: Thu Mar 31 15:08:13 2022 +0800

    Revert rocksdb compaction on checkpoint to reduce cpu intensive (#3144)
    
    (cherry picked from commit ef0b5cc7726b929aa1fc9c617f2130afae527c18)
---
 .../apache/bookkeeper/bookie/storage/ldb/EntryLocationIndex.java   | 7 -------
 .../apache/bookkeeper/bookie/storage/ldb/LedgerMetadataIndex.java  | 7 -------
 2 files changed, 14 deletions(-)

diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/EntryLocationIndex.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/EntryLocationIndex.java
index b658bc0..6936ef0 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/EntryLocationIndex.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/EntryLocationIndex.java
@@ -194,7 +194,6 @@ public class EntryLocationIndex implements Closeable {
         long deletedEntriesInBatch = 0;
 
         Batch batch = locationsDb.newBatch();
-        final byte[] firstDeletedKey = new byte[keyToDelete.array.length];
 
         try {
             for (long ledgerId : ledgersToDelete) {
@@ -237,9 +236,6 @@ public class EntryLocationIndex implements Closeable {
                     }
                     batch.remove(keyToDelete.array);
                     ++deletedEntriesInBatch;
-                    if (deletedEntries++ == 0) {
-                        System.arraycopy(keyToDelete.array, 0, firstDeletedKey, 0, firstDeletedKey.length);
-                    }
                 }
 
                 if (deletedEntriesInBatch > DELETE_ENTRIES_BATCH_SIZE) {
@@ -252,9 +248,6 @@ public class EntryLocationIndex implements Closeable {
             try {
                 batch.flush();
                 batch.clear();
-                if (deletedEntries != 0) {
-                    locationsDb.compact(firstDeletedKey, keyToDelete.array);
-                }
             } finally {
                 firstKeyWrapper.recycle();
                 lastKeyWrapper.recycle();
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/LedgerMetadataIndex.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/LedgerMetadataIndex.java
index 6012d33..f416187 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/LedgerMetadataIndex.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/LedgerMetadataIndex.java
@@ -226,16 +226,12 @@ public class LedgerMetadataIndex implements Closeable {
 
     public void removeDeletedLedgers() throws IOException {
         LongWrapper key = LongWrapper.get();
-        final byte[] startKey = new byte[key.array.length];
 
         int deletedLedgers = 0;
         while (!pendingDeletedLedgers.isEmpty()) {
             long ledgerId = pendingDeletedLedgers.poll();
             key.set(ledgerId);
             ledgersDb.delete(key.array);
-            if (deletedLedgers++ == 0) {
-                System.arraycopy(key.array, 0, startKey, 0, startKey.length);
-            }
         }
 
         if (log.isDebugEnabled()) {
@@ -243,9 +239,6 @@ public class LedgerMetadataIndex implements Closeable {
         }
 
         ledgersDb.sync();
-        if (deletedLedgers != 0) {
-            ledgersDb.compact(startKey, key.array);
-        }
         key.recycle();
     }