From 87fd914c942bb496209b763db08f8a3b1843ed45 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 19 Mar 2020 11:34:30 +0100 Subject: [PATCH] Increase the default pruning parameters (#11558) * Log block number and earliest available block when snapshots fail to start * Increase default pruning history to 128 Increase default pruning memory to 48Mb * Decrease SNAPSHOT_PERIOD to 200 to get them snapshots started quicker * Sync updates to defaults with the args parser * Fix tests * Restore the SNAPSHOT_PERIOD to 5000 * One more * Update ethcore/src/client/config.rs --- ethcore/snapshot/src/watcher.rs | 3 +++ ethcore/src/client/client.rs | 4 ++-- ethcore/src/client/config.rs | 7 +++++-- parity/cli/mod.rs | 4 ++-- parity/configuration.rs | 20 ++++++++++---------- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/ethcore/snapshot/src/watcher.rs b/ethcore/snapshot/src/watcher.rs index 3a25c449b..8af3b0870 100644 --- a/ethcore/snapshot/src/watcher.rs +++ b/ethcore/snapshot/src/watcher.rs @@ -115,6 +115,9 @@ impl ChainNotify for Watcher { // frequency of snapshots and ensures more snapshots are produced from similar points in // the chain. .filter(|num| num % self.period == 0 ) + .inspect(|num| { + trace!(target: "snapshot_sync", "Candidate for taking a snapshot: #{}", num); + }) // Pick newest of the candidates: this is where we want to snapshot from. .fold(0, ::std::cmp::max); diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index 5303b8582..bbda24b4e 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -737,8 +737,7 @@ impl Client { debug!(target: "client", "Cleanup journal: DB Earliest = {:?}, Latest = {:?}", state_db.journal_db().earliest_era(), state_db.journal_db().latest_era()); let history = if config.history < MIN_HISTORY_SIZE { - info!(target: "client", "Ignoring pruning history parameter of {}\ - , falling back to minimum of {}", + info!(target: "client", "Ignoring pruning history parameter of {} , falling back to minimum of {}", config.history, MIN_HISTORY_SIZE); MIN_HISTORY_SIZE } else { @@ -2558,6 +2557,7 @@ impl SnapshotClient for Client { let block_number = self.block_number(at).ok_or_else(|| SnapshotError::InvalidStartingBlock(at))?; let earliest_era = db.earliest_era().unwrap_or(0); if db.is_prunable() && earliest_era > block_number { + warn!(target: "snapshot", "Tried to take a snapshot at #{} but the earliest available block is #{}", block_number, earliest_era); return Err(SnapshotError::OldBlockPrunedDB.into()); } diff --git a/ethcore/src/client/config.rs b/ethcore/src/client/config.rs index d91d2022d..944767296 100644 --- a/ethcore/src/client/config.rs +++ b/ethcore/src/client/config.rs @@ -99,6 +99,9 @@ pub struct ClientConfig { impl Default for ClientConfig { fn default() -> Self { let mb = 1024 * 1024; + // Note/TODO: the defaults here are overridden by the command line + // argument parser and changes to defaults here must be performed "over + // there" as well (see `cli/mod.rs` and https://github.com/openethereum/openethereum/issues/11574). ClientConfig { queue: Default::default(), blockchain: Default::default(), @@ -113,8 +116,8 @@ impl Default for ClientConfig { verifier_type: VerifierType::Canon, state_cache_size: 1 * mb, jump_table_size: 1 * mb, - history: 64, - history_mem: 32 * mb, + history: 128, + history_mem: 64 * mb, check_seal: true, transaction_verification_queue_size: 8192, max_round_blocks_to_import: 12, diff --git a/parity/cli/mod.rs b/parity/cli/mod.rs index f35e372bb..6f08a0747 100644 --- a/parity/cli/mod.rs +++ b/parity/cli/mod.rs @@ -860,11 +860,11 @@ usage! { "--pruning=[METHOD]", "Configure pruning of the state/storage trie. METHOD may be one of auto, archive, fast: archive - keep all state trie data. No pruning. fast - maintain journal overlay. Fast but 50MB used. auto - use the method most recently synced or default to fast if none synced.", - ARG arg_pruning_history: (u64) = 64u64, or |c: &Config| c.footprint.as_ref()?.pruning_history.clone(), + ARG arg_pruning_history: (u64) = 128u64, or |c: &Config| c.footprint.as_ref()?.pruning_history.clone(), "--pruning-history=[NUM]", "Set a minimum number of recent states to keep in memory when pruning is active.", - ARG arg_pruning_memory: (usize) = 32usize, or |c: &Config| c.footprint.as_ref()?.pruning_memory.clone(), + ARG arg_pruning_memory: (usize) = 64usize, or |c: &Config| c.footprint.as_ref()?.pruning_memory.clone(), "--pruning-memory=[MB]", "The ideal amount of memory in megabytes to use to store recent states. As many states as possible will be kept within this limit, and at least --pruning-history states will always be kept.", diff --git a/parity/configuration.rs b/parity/configuration.rs index 4fb797478..eabe46cef 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -1271,8 +1271,8 @@ mod tests { file_path: Some("blockchain.json".into()), format: Default::default(), pruning: Default::default(), - pruning_history: 64, - pruning_memory: 32, + pruning_history: 128, + pruning_memory: 64, compaction: Default::default(), tracing: Default::default(), fat_db: Default::default(), @@ -1294,8 +1294,8 @@ mod tests { dirs: Default::default(), file_path: Some("blockchain.json".into()), pruning: Default::default(), - pruning_history: 64, - pruning_memory: 32, + pruning_history: 128, + pruning_memory: 64, format: Default::default(), compaction: Default::default(), tracing: Default::default(), @@ -1317,8 +1317,8 @@ mod tests { dirs: Default::default(), file_path: Some("state.json".into()), pruning: Default::default(), - pruning_history: 64, - pruning_memory: 32, + pruning_history: 128, + pruning_memory: 64, format: Default::default(), compaction: Default::default(), tracing: Default::default(), @@ -1342,8 +1342,8 @@ mod tests { dirs: Default::default(), file_path: Some("blockchain.json".into()), pruning: Default::default(), - pruning_history: 64, - pruning_memory: 32, + pruning_history: 128, + pruning_memory: 64, format: Some(DataFormat::Hex), compaction: Default::default(), tracing: Default::default(), @@ -1398,8 +1398,8 @@ mod tests { dirs: Default::default(), spec: Default::default(), pruning: Default::default(), - pruning_history: 64, - pruning_memory: 32, + pruning_history: 128, + pruning_memory: 64, daemon: None, logger_config: Default::default(), miner_options: Default::default(),