Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Commit 87fd914

Browse files
authored
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
1 parent 874462b commit 87fd914

File tree

5 files changed

+22
-16
lines changed

5 files changed

+22
-16
lines changed

ethcore/snapshot/src/watcher.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ impl ChainNotify for Watcher {
115115
// frequency of snapshots and ensures more snapshots are produced from similar points in
116116
// the chain.
117117
.filter(|num| num % self.period == 0 )
118+
.inspect(|num| {
119+
trace!(target: "snapshot_sync", "Candidate for taking a snapshot: #{}", num);
120+
})
118121
// Pick newest of the candidates: this is where we want to snapshot from.
119122
.fold(0, ::std::cmp::max);
120123

ethcore/src/client/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,8 +737,7 @@ impl Client {
737737
debug!(target: "client", "Cleanup journal: DB Earliest = {:?}, Latest = {:?}", state_db.journal_db().earliest_era(), state_db.journal_db().latest_era());
738738

739739
let history = if config.history < MIN_HISTORY_SIZE {
740-
info!(target: "client", "Ignoring pruning history parameter of {}\
741-
, falling back to minimum of {}",
740+
info!(target: "client", "Ignoring pruning history parameter of {} , falling back to minimum of {}",
742741
config.history, MIN_HISTORY_SIZE);
743742
MIN_HISTORY_SIZE
744743
} else {
@@ -2558,6 +2557,7 @@ impl SnapshotClient for Client {
25582557
let block_number = self.block_number(at).ok_or_else(|| SnapshotError::InvalidStartingBlock(at))?;
25592558
let earliest_era = db.earliest_era().unwrap_or(0);
25602559
if db.is_prunable() && earliest_era > block_number {
2560+
warn!(target: "snapshot", "Tried to take a snapshot at #{} but the earliest available block is #{}", block_number, earliest_era);
25612561
return Err(SnapshotError::OldBlockPrunedDB.into());
25622562
}
25632563

ethcore/src/client/config.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ pub struct ClientConfig {
9999
impl Default for ClientConfig {
100100
fn default() -> Self {
101101
let mb = 1024 * 1024;
102+
// Note/TODO: the defaults here are overridden by the command line
103+
// argument parser and changes to defaults here must be performed "over
104+
// there" as well (see `cli/mod.rs` and https://github.com/openethereum/openethereum/issues/11574).
102105
ClientConfig {
103106
queue: Default::default(),
104107
blockchain: Default::default(),
@@ -113,8 +116,8 @@ impl Default for ClientConfig {
113116
verifier_type: VerifierType::Canon,
114117
state_cache_size: 1 * mb,
115118
jump_table_size: 1 * mb,
116-
history: 64,
117-
history_mem: 32 * mb,
119+
history: 128,
120+
history_mem: 64 * mb,
118121
check_seal: true,
119122
transaction_verification_queue_size: 8192,
120123
max_round_blocks_to_import: 12,

parity/cli/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,11 +860,11 @@ usage! {
860860
"--pruning=[METHOD]",
861861
"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.",
862862

863-
ARG arg_pruning_history: (u64) = 64u64, or |c: &Config| c.footprint.as_ref()?.pruning_history.clone(),
863+
ARG arg_pruning_history: (u64) = 128u64, or |c: &Config| c.footprint.as_ref()?.pruning_history.clone(),
864864
"--pruning-history=[NUM]",
865865
"Set a minimum number of recent states to keep in memory when pruning is active.",
866866

867-
ARG arg_pruning_memory: (usize) = 32usize, or |c: &Config| c.footprint.as_ref()?.pruning_memory.clone(),
867+
ARG arg_pruning_memory: (usize) = 64usize, or |c: &Config| c.footprint.as_ref()?.pruning_memory.clone(),
868868
"--pruning-memory=[MB]",
869869
"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.",
870870

parity/configuration.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,8 +1271,8 @@ mod tests {
12711271
file_path: Some("blockchain.json".into()),
12721272
format: Default::default(),
12731273
pruning: Default::default(),
1274-
pruning_history: 64,
1275-
pruning_memory: 32,
1274+
pruning_history: 128,
1275+
pruning_memory: 64,
12761276
compaction: Default::default(),
12771277
tracing: Default::default(),
12781278
fat_db: Default::default(),
@@ -1294,8 +1294,8 @@ mod tests {
12941294
dirs: Default::default(),
12951295
file_path: Some("blockchain.json".into()),
12961296
pruning: Default::default(),
1297-
pruning_history: 64,
1298-
pruning_memory: 32,
1297+
pruning_history: 128,
1298+
pruning_memory: 64,
12991299
format: Default::default(),
13001300
compaction: Default::default(),
13011301
tracing: Default::default(),
@@ -1317,8 +1317,8 @@ mod tests {
13171317
dirs: Default::default(),
13181318
file_path: Some("state.json".into()),
13191319
pruning: Default::default(),
1320-
pruning_history: 64,
1321-
pruning_memory: 32,
1320+
pruning_history: 128,
1321+
pruning_memory: 64,
13221322
format: Default::default(),
13231323
compaction: Default::default(),
13241324
tracing: Default::default(),
@@ -1342,8 +1342,8 @@ mod tests {
13421342
dirs: Default::default(),
13431343
file_path: Some("blockchain.json".into()),
13441344
pruning: Default::default(),
1345-
pruning_history: 64,
1346-
pruning_memory: 32,
1345+
pruning_history: 128,
1346+
pruning_memory: 64,
13471347
format: Some(DataFormat::Hex),
13481348
compaction: Default::default(),
13491349
tracing: Default::default(),
@@ -1398,8 +1398,8 @@ mod tests {
13981398
dirs: Default::default(),
13991399
spec: Default::default(),
14001400
pruning: Default::default(),
1401-
pruning_history: 64,
1402-
pruning_memory: 32,
1401+
pruning_history: 128,
1402+
pruning_memory: 64,
14031403
daemon: None,
14041404
logger_config: Default::default(),
14051405
miner_options: Default::default(),

0 commit comments

Comments
 (0)