Skip to content

Commit

Permalink
Fix no-op pruner setting (MystenLabs#17928)
Browse files Browse the repository at this point in the history
## Description 

Describe the changes or additions included in this PR.

## Test plan 

How did you test the new or updated feature?

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
  • Loading branch information
halfprice committed May 24, 2024
1 parent 963f30c commit 02fefde
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 @@ -564,7 +564,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 @@ -2599,7 +2599,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 02fefde

Please sign in to comment.