Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tide up state pruner validation #8459

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import tech.pegasys.teku.storage.server.ChainStorage;
import tech.pegasys.teku.storage.server.CombinedStorageChannelSplitter;
import tech.pegasys.teku.storage.server.Database;
import tech.pegasys.teku.storage.server.DatabaseVersion;
import tech.pegasys.teku.storage.server.DepositStorage;
import tech.pegasys.teku.storage.server.RetryingStorageUpdateChannel;
import tech.pegasys.teku.storage.server.StorageConfiguration;
Expand Down Expand Up @@ -117,24 +118,28 @@ protected SafeFuture<?> doStart() {
pruningActiveLabelledGauge));
}
if (config.getDataStorageMode().storesFinalizedStates()
&& config.getRetainedSlots() > -1) {
LOG.info(
"State pruner will run every: {} minute(s), retaining states for the last {} finalized slots. Limited to {} state prune per execution. ",
config.getStatePruningInterval().toMinutes(),
config.getRetainedSlots(),
config.getStatePruningLimit());
statePruner =
Optional.of(
new StatePruner(
config.getSpec(),
database,
storagePrunerAsyncRunner,
config.getStatePruningInterval(),
config.getRetainedSlots(),
config.getStatePruningLimit(),
"state",
pruningTimingsLabelledGauge,
pruningActiveLabelledGauge));
&& config.getRetainedSlots() > 0) {
if (config.getDataStorageCreateDbVersion() == DatabaseVersion.LEVELDB_TREE) {
LOG.warn("State pruning is not supported with leveldb_tree database.");
gfukushima marked this conversation as resolved.
Show resolved Hide resolved
} else {
LOG.info(
"State pruner will run every: {} minute(s), retaining states for the last {} finalized slots. Limited to {} state prune per execution. ",
config.getStatePruningInterval().toMinutes(),
config.getRetainedSlots(),
config.getStatePruningLimit());
statePruner =
Optional.of(
new StatePruner(
config.getSpec(),
database,
storagePrunerAsyncRunner,
config.getStatePruningInterval(),
config.getRetainedSlots(),
config.getStatePruningLimit(),
"state",
pruningTimingsLabelledGauge,
pruningActiveLabelledGauge));
}
}
if (config.getSpec().isMilestoneSupported(SpecMilestone.DENEB)) {
blobsPruner =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class StorageConfiguration {
public static final int DEFAULT_BLOCK_PRUNING_LIMIT = 5000;
public static final Duration DEFAULT_BLOBS_PRUNING_INTERVAL = Duration.ofMinutes(1);
public static final Duration DEFAULT_STATE_PRUNING_INTERVAL = Duration.ofMinutes(5);
public static final long DEFAULT_STORAGE_RETAINED_SLOTS = -1;
public static final long DEFAULT_STORAGE_RETAINED_SLOTS = 0;
public static final int DEFAULT_STATE_PRUNING_LIMIT = 1;

// 60/12 = 5 blocks per minute * 6 max blobs per block = 30 blobs per minute at maximum, 15 as
Expand Down Expand Up @@ -275,7 +275,7 @@ public Builder blobsPruningLimit(final int blobsPruningLimit) {
}

public Builder retainedSlots(final long retainedSlots) {
if (retainedSlots < -1) {
gfukushima marked this conversation as resolved.
Show resolved Hide resolved
if (retainedSlots < 0) {
throw new InvalidConfigurationException(
"Invalid number of slots to retain finalized states for");
}
Expand Down