Skip to content

Commit

Permalink
Cherrypick: Fix no-op pruner setting (#17938)
Browse files Browse the repository at this point in the history
  • Loading branch information
halfprice authored May 25, 2024
1 parent b70e432 commit 10bc661
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion crates/sui-config/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ impl Default for CheckpointExecutorConfig {
}
}

#[derive(Debug, Clone, Copy, Deserialize, Serialize)]
#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")]
pub struct AuthorityStorePruningConfig {
/// number of the latest epoch dbs to retain
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-core/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2596,7 +2596,7 @@ impl AuthorityState {
store.perpetual_tables.clone(),
checkpoint_store.clone(),
store.objects_lock_table.clone(),
config.authority_store_pruning_config,
config.authority_store_pruning_config.clone(),
epoch_store.committee().authority_exists(&name),
epoch_store.epoch_start_state().epoch_duration_ms(),
prometheus_registry,
Expand Down
4 changes: 2 additions & 2 deletions crates/sui-core/src/authority/authority_store_pruner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,12 +670,12 @@ impl AuthorityStorePruner {
loop {
tokio::select! {
_ = objects_prune_interval.tick(), if config.num_epochs_to_retain != u64::MAX => {
if let Err(err) = Self::prune_objects_for_eligible_epochs(&perpetual_db, &checkpoint_store, &objects_lock_table, config, metrics.clone(), indirect_objects_threshold, epoch_duration_ms).await {
if let Err(err) = Self::prune_objects_for_eligible_epochs(&perpetual_db, &checkpoint_store, &objects_lock_table, config.clone(), metrics.clone(), indirect_objects_threshold, epoch_duration_ms).await {
error!("Failed to prune objects: {:?}", err);
}
},
_ = checkpoints_prune_interval.tick(), if !matches!(config.num_epochs_to_retain_for_checkpoints(), None | Some(u64::MAX) | Some(0)) => {
if let Err(err) = Self::prune_checkpoints_for_eligible_epochs(&perpetual_db, &checkpoint_store, &objects_lock_table, config, metrics.clone(), indirect_objects_threshold, archive_readers.clone(), epoch_duration_ms).await {
if let Err(err) = Self::prune_checkpoints_for_eligible_epochs(&perpetual_db, &checkpoint_store, &objects_lock_table, config.clone(), metrics.clone(), indirect_objects_threshold, archive_readers.clone(), epoch_duration_ms).await {
error!("Failed to prune checkpoints: {:?}", err);
}
},
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-core/src/db_checkpoint_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ impl DBCheckpointHandler {
&perpetual_db,
&checkpoint_store,
&lock_table,
self.pruning_config,
self.pruning_config.clone(),
metrics,
self.indirect_objects_threshold,
epoch_duration_ms,
Expand Down
11 changes: 6 additions & 5 deletions crates/sui-node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ impl SuiNode {
DBMetrics::init(&prometheus_registry);
mysten_metrics::init_metrics(&prometheus_registry);

let genesis = config.genesis()?;
let genesis = config.genesis()?.clone();

let secret = Arc::pin(config.protocol_key_pair().copy());
let genesis_committee = genesis.committee()?;
Expand All @@ -447,7 +447,7 @@ impl SuiNode {
.expect("Database read should not fail at init.");

let store =
AuthorityStore::open(perpetual_tables, genesis, &config, &prometheus_registry).await?;
AuthorityStore::open(perpetual_tables, &genesis, &config, &prometheus_registry).await?;

let cur_epoch = store.get_recovery_epoch_at_restart()?;
let committee = committee_store
Expand Down Expand Up @@ -587,13 +587,14 @@ impl SuiNode {
state_snapshot_handle.is_some(),
)?;

let mut pruning_config = config.authority_store_pruning_config;
if !epoch_store
.protocol_config()
.simplified_unwrap_then_delete()
{
// We cannot prune tombstones if simplified_unwrap_then_delete is not enabled.
pruning_config.set_killswitch_tombstone_pruning(true);
config
.authority_store_pruning_config
.set_killswitch_tombstone_pruning(true);
}

let state = AuthorityState::new(
Expand Down Expand Up @@ -921,7 +922,7 @@ impl SuiNode {
.prune_and_compact_before_upload
.unwrap_or(true),
config.indirect_objects_threshold,
config.authority_store_pruning_config,
config.authority_store_pruning_config.clone(),
prometheus_registry,
state_snapshot_enabled,
)?;
Expand Down

0 comments on commit 10bc661

Please sign in to comment.