Skip to content

Commit 4f2c6e2

Browse files
committed
Remove changes
1 parent be589e3 commit 4f2c6e2

File tree

13 files changed

+10
-178
lines changed

13 files changed

+10
-178
lines changed

cumulus/test/service/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,6 @@ pub fn node_config(
876876
keystore: KeystoreConfig::InMemory,
877877
database: DatabaseSource::RocksDb { path: root.join("db"), cache_size: 128 },
878878
trie_cache_maximum_size: Some(64 * 1024 * 1024),
879-
warm_up_trie_cache: None,
880879
state_pruning: Some(PruningMode::ArchiveAll),
881880
blocks_pruning: BlocksPruning::KeepAll,
882881
chain_spec: spec,

polkadot/node/test/service/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ pub fn node_config(
205205
keystore: KeystoreConfig::InMemory,
206206
database: DatabaseSource::RocksDb { path: root.join("db"), cache_size: 128 },
207207
trie_cache_maximum_size: Some(64 * 1024 * 1024),
208-
warm_up_trie_cache: None,
209208
state_pruning: Default::default(),
210209
blocks_pruning: BlocksPruning::KeepFinalized,
211210
chain_spec: Box::new(spec),

prdoc/pr_7556.prdoc

Lines changed: 0 additions & 11 deletions
This file was deleted.

substrate/bin/node/cli/benches/block_production.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ fn new_node(tokio_handle: Handle) -> node_cli::service::NewFullBase {
7272
keystore: KeystoreConfig::InMemory,
7373
database: DatabaseSource::RocksDb { path: root.join("db"), cache_size: 128 },
7474
trie_cache_maximum_size: Some(64 * 1024 * 1024),
75-
warm_up_trie_cache: None,
7675
state_pruning: Some(PruningMode::ArchiveAll),
7776
blocks_pruning: BlocksPruning::KeepAll,
7877
chain_spec: spec,

substrate/bin/node/cli/benches/transaction_pool.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ fn new_node(tokio_handle: Handle) -> node_cli::service::NewFullBase {
6363
keystore: KeystoreConfig::InMemory,
6464
database: DatabaseSource::RocksDb { path: root.join("db"), cache_size: 128 },
6565
trie_cache_maximum_size: Some(64 * 1024 * 1024),
66-
warm_up_trie_cache: None,
6766
state_pruning: Some(PruningMode::ArchiveAll),
6867
blocks_pruning: BlocksPruning::KeepAll,
6968
chain_spec: spec,

substrate/client/cli/src/config.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -252,16 +252,6 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
252252
Ok(self.import_params().map(|x| x.trie_cache_maximum_size()).unwrap_or_default())
253253
}
254254

255-
/// Get if we should warm up the trie cache.
256-
///
257-
/// By default this is retrieved from `ImportParams` if it is available. Otherwise its `None`.
258-
fn warm_up_trie_cache(&self) -> Result<Option<sc_service::config::TrieCacheWarmUpStrategy>> {
259-
Ok(self
260-
.import_params()
261-
.map(|x| x.warm_up_trie_cache().map(|x| x.into()))
262-
.unwrap_or_default())
263-
}
264-
265255
/// Get the state pruning mode.
266256
///
267257
/// By default this is retrieved from `PruningMode` if it is available. Otherwise its
@@ -538,7 +528,6 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
538528
database: self.database_config(&config_dir, database_cache_size, database)?,
539529
data_path: config_dir,
540530
trie_cache_maximum_size: self.trie_cache_maximum_size()?,
541-
warm_up_trie_cache: self.warm_up_trie_cache()?,
542531
state_pruning: self.state_pruning()?,
543532
blocks_pruning: self.blocks_pruning()?,
544533
executor: ExecutorConfiguration {

substrate/client/cli/src/params/import_params.rs

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use crate::{
2323
},
2424
params::{DatabaseParams, PruningParams},
2525
};
26-
use clap::{Args, ValueEnum};
26+
use clap::Args;
2727
use std::path::PathBuf;
2828

2929
/// Parameters for block import.
@@ -80,38 +80,6 @@ pub struct ImportParams {
8080
/// Providing `0` will disable the cache.
8181
#[arg(long, value_name = "Bytes", default_value_t = 1024 * 1024 * 1024)]
8282
pub trie_cache_size: usize,
83-
84-
/// Warm up the trie cache.
85-
///
86-
/// No warmup if flag is not present. Using flag without value chooses non-blocking warmup.
87-
#[arg(long, value_name = "STRATEGY", value_enum, num_args = 0..=1, default_missing_value = "non-blocking")]
88-
pub warm_up_trie_cache: Option<TrieCacheWarmUpStrategy>,
89-
}
90-
91-
/// Warmup strategy for the trie cache.
92-
#[derive(Debug, Clone, Copy, ValueEnum)]
93-
pub enum TrieCacheWarmUpStrategy {
94-
/// Warm up the cache in a non-blocking way.
95-
#[clap(name = "non-blocking")]
96-
NonBlocking,
97-
/// Warm up the cache in a blocking way (not recommended for production use).
98-
///
99-
/// When enabled, the trie cache warm-up will block the node startup until complete.
100-
/// This is not recommended for production use as it can significantly delay node startup.
101-
/// Only enable this option for testing or debugging purposes.
102-
#[clap(name = "blocking")]
103-
Blocking,
104-
}
105-
106-
impl From<TrieCacheWarmUpStrategy> for sc_service::config::TrieCacheWarmUpStrategy {
107-
fn from(strategy: TrieCacheWarmUpStrategy) -> Self {
108-
match strategy {
109-
TrieCacheWarmUpStrategy::NonBlocking =>
110-
sc_service::config::TrieCacheWarmUpStrategy::NonBlocking,
111-
TrieCacheWarmUpStrategy::Blocking =>
112-
sc_service::config::TrieCacheWarmUpStrategy::Blocking,
113-
}
114-
}
11583
}
11684

11785
impl ImportParams {
@@ -124,11 +92,6 @@ impl ImportParams {
12492
}
12593
}
12694

127-
/// Specify if we should warm up the trie cache.
128-
pub fn warm_up_trie_cache(&self) -> Option<TrieCacheWarmUpStrategy> {
129-
self.warm_up_trie_cache
130-
}
131-
13295
/// Get the WASM execution method from the parameters
13396
pub fn wasm_method(&self) -> sc_service::config::WasmExecutionMethod {
13497
self.execution_strategies.check_usage_and_print_deprecation_warning();

substrate/client/cli/src/runner.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ mod tests {
252252
keystore: sc_service::config::KeystoreConfig::InMemory,
253253
database: sc_client_db::DatabaseSource::ParityDb { path: root.clone() },
254254
trie_cache_maximum_size: None,
255-
warm_up_trie_cache: None,
256255
state_pruning: None,
257256
blocks_pruning: sc_client_db::BlocksPruning::KeepAll,
258257
chain_spec: Box::new(

substrate/client/db/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ sp-database = { workspace = true, default-features = true }
4343
sp-runtime = { workspace = true, default-features = true }
4444
sp-state-machine = { workspace = true, default-features = true }
4545
sp-trie = { workspace = true, default-features = true }
46-
sysinfo = { workspace = true }
4746

4847
[dev-dependencies]
4948
array-bytes = { workspace = true, default-features = true }

substrate/client/db/src/lib.rs

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ mod upgrade;
4242
mod utils;
4343

4444
use linked_hash_map::LinkedHashMap;
45-
use log::{debug, info, trace, warn};
45+
use log::{debug, trace, warn};
4646
use parking_lot::{Mutex, RwLock};
4747
use prometheus_endpoint::Registry;
4848
use std::{
@@ -1239,22 +1239,6 @@ impl<Block: BlockT> Backend<Block> {
12391239

12401240
let offchain_storage = offchain::LocalStorage::new(db.clone());
12411241

1242-
let shared_trie_cache = config.trie_cache_maximum_size.map(|maximum_size| {
1243-
let system_memory = sysinfo::System::new_all();
1244-
let used_memory = system_memory.used_memory();
1245-
let total_memory = system_memory.total_memory();
1246-
1247-
if maximum_size as u64 > total_memory - used_memory {
1248-
warn!(
1249-
"Not enough memory to initialize shared trie cache. Cache size: {} bytes. System memory: used {} bytes, total {} bytes",
1250-
maximum_size, used_memory, total_memory,
1251-
);
1252-
}
1253-
1254-
debug!("Initializing shared trie cache with size {} bytes, {}% of total memory", maximum_size, (maximum_size as f64 / total_memory as f64 * 100.0));
1255-
Ok(SharedTrieCache::new(sp_trie::cache::CacheSize::new(maximum_size), config.metrics_registry.as_ref()))
1256-
}).transpose()?;
1257-
12581242
let backend = Backend {
12591243
storage: Arc::new(storage_db),
12601244
offchain_storage,
@@ -1266,7 +1250,12 @@ impl<Block: BlockT> Backend<Block> {
12661250
state_usage: Arc::new(StateUsageStats::new()),
12671251
blocks_pruning: config.blocks_pruning,
12681252
genesis_state: RwLock::new(None),
1269-
shared_trie_cache,
1253+
shared_trie_cache: config.trie_cache_maximum_size.map(|maximum_size| {
1254+
SharedTrieCache::new(
1255+
sp_trie::cache::CacheSize::new(maximum_size),
1256+
config.metrics_registry.as_ref(),
1257+
)
1258+
}),
12701259
};
12711260

12721261
// Older DB versions have no last state key. Check if the state is available and set it.

0 commit comments

Comments
 (0)