Enable skipping blob pruning at each epoch
This commit is contained in:
parent
2f565d25b2
commit
6346c30158
@ -555,10 +555,19 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
|
|||||||
Arg::with_name("prune-blobs")
|
Arg::with_name("prune-blobs")
|
||||||
.long("prune-blobs")
|
.long("prune-blobs")
|
||||||
.help("Prune blobs from Lighthouse's database when they are older than the data \
|
.help("Prune blobs from Lighthouse's database when they are older than the data \
|
||||||
data availability boundary relative to the current head.")
|
data availability boundary relative to the current epoch.")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.default_value("true")
|
.default_value("true")
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("epochs-per-blob-prune")
|
||||||
|
.long("epochs-per-blob-prune")
|
||||||
|
.help("The epoch interval with which to prune blobs from Lighthouse's \
|
||||||
|
database when they are older than the data data availability \
|
||||||
|
boundary relative to the current epoch.")
|
||||||
|
.takes_value(true)
|
||||||
|
.default_value("1")
|
||||||
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Misc.
|
* Misc.
|
||||||
|
@ -415,6 +415,12 @@ pub fn get_config<E: EthSpec>(
|
|||||||
client_config.store.prune_blobs = prune_blobs;
|
client_config.store.prune_blobs = prune_blobs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(epochs_per_blob_prune) =
|
||||||
|
clap_utils::parse_optional(cli_args, "epochs-per-blob-prune")?
|
||||||
|
{
|
||||||
|
client_config.store.epochs_per_blob_prune = epochs_per_blob_prune;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Zero-ports
|
* Zero-ports
|
||||||
*
|
*
|
||||||
|
@ -8,6 +8,7 @@ pub const PREV_DEFAULT_SLOTS_PER_RESTORE_POINT: u64 = 2048;
|
|||||||
pub const DEFAULT_SLOTS_PER_RESTORE_POINT: u64 = 8192;
|
pub const DEFAULT_SLOTS_PER_RESTORE_POINT: u64 = 8192;
|
||||||
pub const DEFAULT_BLOCK_CACHE_SIZE: usize = 5;
|
pub const DEFAULT_BLOCK_CACHE_SIZE: usize = 5;
|
||||||
pub const DEFAULT_BLOB_CACHE_SIZE: usize = 5;
|
pub const DEFAULT_BLOB_CACHE_SIZE: usize = 5;
|
||||||
|
pub const DEFAULT_EPOCHS_PER_BLOB_PRUNE: u64 = 1;
|
||||||
|
|
||||||
/// Database configuration parameters.
|
/// Database configuration parameters.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
@ -28,6 +29,8 @@ pub struct StoreConfig {
|
|||||||
pub prune_payloads: bool,
|
pub prune_payloads: bool,
|
||||||
/// Whether to prune blobs older than the blob data availability boundary.
|
/// Whether to prune blobs older than the blob data availability boundary.
|
||||||
pub prune_blobs: bool,
|
pub prune_blobs: bool,
|
||||||
|
/// Frequency of blob pruning. Default: every epoch.
|
||||||
|
pub epochs_per_blob_prune: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Variant of `StoreConfig` that gets written to disk. Contains immutable configuration params.
|
/// Variant of `StoreConfig` that gets written to disk. Contains immutable configuration params.
|
||||||
@ -53,6 +56,7 @@ impl Default for StoreConfig {
|
|||||||
compact_on_prune: true,
|
compact_on_prune: true,
|
||||||
prune_payloads: true,
|
prune_payloads: true,
|
||||||
prune_blobs: true,
|
prune_blobs: true,
|
||||||
|
epochs_per_blob_prune: DEFAULT_EPOCHS_PER_BLOB_PRUNE,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1721,10 +1721,14 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if blob_info.last_pruned_epoch == blob_info.next_epoch_to_prune && !force {
|
if !force {
|
||||||
|
let epochs_per_blob_prune =
|
||||||
|
Epoch::new(self.get_config().epochs_per_blob_prune * E::slots_per_epoch());
|
||||||
|
if blob_info.last_pruned_epoch + epochs_per_blob_prune > blob_info.next_epoch_to_prune {
|
||||||
info!(self.log, "Blobs sidecars are pruned");
|
info!(self.log, "Blobs sidecars are pruned");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let dab_state_root = blob_info.data_availability_boundary.state_root;
|
let dab_state_root = blob_info.data_availability_boundary.state_root;
|
||||||
|
|
||||||
@ -1840,7 +1844,7 @@ pub fn migrate_database<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prune blobs before migration.
|
// Prune blobs before migration.
|
||||||
store.try_prune_blobs(false)?;
|
store.try_prune_blobs(true)?;
|
||||||
|
|
||||||
let mut hot_db_ops: Vec<StoreOp<E>> = Vec::new();
|
let mut hot_db_ops: Vec<StoreOp<E>> = Vec::new();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user