You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by lu...@apache.org on 2023/04/07 07:08:51 UTC
[bookkeeper] branch master updated: Execute clean indexes in finally (#3772)
This is an automated email from the ASF dual-hosted git repository.
lushiji pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new 04e572b9bc Execute clean indexes in finally (#3772)
04e572b9bc is described below
commit 04e572b9bccd1502c0f2c4a87f23d760d4d0d9b5
Author: Zhangao <ga...@qq.com>
AuthorDate: Fri Apr 7 15:08:42 2023 +0800
Execute clean indexes in finally (#3772)
Execute clean indexes in finally (#3772)
---
.../ldb/SingleDirectoryDbLedgerStorage.java | 29 +++++++++++-----------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/SingleDirectoryDbLedgerStorage.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/SingleDirectoryDbLedgerStorage.java
index 635a2727f9..9f089d9864 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/SingleDirectoryDbLedgerStorage.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/SingleDirectoryDbLedgerStorage.java
@@ -824,21 +824,6 @@ public class SingleDirectoryDbLedgerStorage implements CompactableLedgerStorage
ledgerIndex.flush();
recordSuccessfulEvent(dbLedgerStorageStats.getFlushLedgerIndexStats(), ledgerIndexStartTime);
- cleanupExecutor.execute(() -> {
- // There can only be one single cleanup task running because the cleanupExecutor
- // is single-threaded
- try {
- if (log.isDebugEnabled()) {
- log.debug("Removing deleted ledgers from db indexes");
- }
-
- entryLocationIndex.removeOffsetFromDeletedLedgers();
- ledgerIndex.removeDeletedLedgers();
- } catch (Throwable t) {
- log.warn("Failed to cleanup db indexes", t);
- }
- });
-
lastCheckpoint = thisCheckpoint;
// Discard all the entry from the write cache, since they're now persisted
@@ -858,6 +843,20 @@ public class SingleDirectoryDbLedgerStorage implements CompactableLedgerStorage
// Leave IOExecption as it is
throw e;
} finally {
+ cleanupExecutor.execute(() -> {
+ // There can only be one single cleanup task running because the cleanupExecutor
+ // is single-threaded
+ try {
+ if (log.isDebugEnabled()) {
+ log.debug("Removing deleted ledgers from db indexes");
+ }
+
+ entryLocationIndex.removeOffsetFromDeletedLedgers();
+ ledgerIndex.removeDeletedLedgers();
+ } catch (Throwable t) {
+ log.warn("Failed to cleanup db indexes", t);
+ }
+ });
try {
isFlushOngoing.set(false);
} finally {