This is an automated email from the ASF dual-hosted git repository. yong pushed a commit to branch branch-4.15 in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
commit d93069d4183fb43295c657fb3d74300752b90246 Author: zymap <[email protected]> AuthorDate: Tue Feb 21 09:51:45 2023 +0800 Revert "Speed up the rebuildinding of RocksDB index (#3458)" This reverts commit a6a407487ae4bd64caf25c06e27cfbe7c64c3f5d. --- .../bookie/storage/ldb/LocationsIndexRebuildOp.java | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/LocationsIndexRebuildOp.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/LocationsIndexRebuildOp.java index e15457ca8e..55c5c90c31 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/LocationsIndexRebuildOp.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/LocationsIndexRebuildOp.java @@ -32,8 +32,7 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.Set; import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicReference; + import org.apache.bookkeeper.bookie.BookieImpl; import org.apache.bookkeeper.bookie.EntryLogger; import org.apache.bookkeeper.bookie.EntryLogger.EntryLogScanner; @@ -56,8 +55,6 @@ public class LocationsIndexRebuildOp { this.conf = conf; } - private static final int BATCH_COMMIT_SIZE = 10_000; - public void initiate() throws IOException { LOG.info("Starting locations index rebuilding"); @@ -85,8 +82,6 @@ public class LocationsIndexRebuildOp { int totalEntryLogs = entryLogs.size(); int completedEntryLogs = 0; LOG.info("Scanning {} entry logs", totalEntryLogs); - AtomicReference<KeyValueStorage.Batch> batch = new AtomicReference<>(newIndex.newBatch()); - AtomicInteger count = new AtomicInteger(); for (long entryLogId : entryLogs) { entryLogger.scanEntryLog(entryLogId, new EntryLogScanner() { @@ -105,15 +100,7 @@ public class LocationsIndexRebuildOp { // Update the ledger index page LongPairWrapper key = LongPairWrapper.get(ledgerId, entryId); LongWrapper value = LongWrapper.get(location); - batch.get().put(key.array, value.array); - - if (count.incrementAndGet() > BATCH_COMMIT_SIZE) { - batch.get().flush(); - batch.get().close(); - - batch.set(newIndex.newBatch()); - count.set(0); - } + newIndex.put(key.array, value.array); } @Override @@ -125,8 +112,6 @@ public class LocationsIndexRebuildOp { ++completedEntryLogs; LOG.info("Completed scanning of log {}.log -- {} / {}", Long.toHexString(entryLogId), completedEntryLogs, totalEntryLogs); - batch.get().flush(); - batch.get().close(); } newIndex.sync();
