Skip to content

Commit

Permalink
Revert "Execute clean indexes in finally (#3772)"
Browse files Browse the repository at this point in the history
This reverts commit 04e572b.
  • Loading branch information
StevenLuMT committed Apr 7, 2023
1 parent 04e572b commit 306a42a
Showing 1 changed file with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,21 @@ public void checkpoint(Checkpoint checkpoint) throws IOException {
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
Expand All @@ -843,20 +858,6 @@ public void checkpoint(Checkpoint checkpoint) throws IOException {
// 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 {
Expand Down

0 comments on commit 306a42a

Please sign in to comment.