Skip to content

Commit

Permalink
make state pruner faster
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdi-aouadi committed Oct 16, 2024
1 parent 2985a96 commit 96e1e5d
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.google.common.annotations.VisibleForTesting;
import java.nio.file.Path;
import java.time.Duration;
import java.util.Optional;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -134,12 +135,16 @@ protected SafeFuture<?> doStart() {
configureStatePruner(
config.getRetainedSlots(),
storagePrunerAsyncRunner,
config.getStatePruningInterval(),
config.getStatePruningLimit(),
pruningTimingsLabelledGauge,
pruningActiveLabelledGauge);
} else if (!config.getDataStorageMode().storesFinalizedStates()) {
configureStatePruner(
StorageConfiguration.DEFAULT_STORAGE_RETAINED_SLOTS,
storagePrunerAsyncRunner,
Duration.ofMinutes(1),
1,
pruningTimingsLabelledGauge,
pruningActiveLabelledGauge);
}
Expand Down Expand Up @@ -221,6 +226,8 @@ protected SafeFuture<?> doStart() {
void configureStatePruner(
final long slotsToRetain,
final AsyncRunner storagePrunerAsyncRunner,
final Duration pruningInterval,
final int pruningLimit,
final SettableLabelledGauge pruningTimingsLabelledGauge,
final SettableLabelledGauge pruningActiveLabelledGauge) {
if (config.getDataStorageCreateDbVersion() == DatabaseVersion.LEVELDB_TREE) {
Expand All @@ -240,9 +247,9 @@ void configureStatePruner(
config.getSpec(),
database,
storagePrunerAsyncRunner,
config.getStatePruningInterval(),
pruningInterval,
slotsToRetain,
config.getStatePruningLimit(),
pruningLimit,
"state",
pruningTimingsLabelledGauge,
pruningActiveLabelledGauge));
Expand Down

0 comments on commit 96e1e5d

Please sign in to comment.