diff --git a/crates/ethereum/cli/src/interface.rs b/crates/ethereum/cli/src/interface.rs index 7b5bbc2c2b..ee4fbdfd60 100644 --- a/crates/ethereum/cli/src/interface.rs +++ b/crates/ethereum/cli/src/interface.rs @@ -241,7 +241,6 @@ impl Cli { /// Commands to be executed #[derive(Debug, Subcommand)] -#[expect(clippy::large_enum_variant)] pub enum Commands { /// Start the node #[command(name = "node")] diff --git a/crates/node/core/src/args/database.rs b/crates/node/core/src/args/database.rs index 1a490bc272..09b8f15ef6 100644 --- a/crates/node/core/src/args/database.rs +++ b/crates/node/core/src/args/database.rs @@ -31,6 +31,9 @@ pub struct DatabaseArgs { /// Read transaction timeout in seconds, 0 means no timeout. #[arg(long = "db.read-transaction-timeout")] pub read_transaction_timeout: Option, + /// Maximum number of readers allowed to access the database concurrently. + #[arg(long = "db.max-readers")] + pub max_readers: Option, } impl DatabaseArgs { @@ -57,6 +60,7 @@ impl DatabaseArgs { .with_max_read_transaction_duration(max_read_transaction_duration) .with_geometry_max_size(self.max_size) .with_growth_step(self.growth_step) + .with_max_readers(self.max_readers) } } diff --git a/crates/optimism/cli/src/commands/mod.rs b/crates/optimism/cli/src/commands/mod.rs index 161aa1d0ba..32e531a671 100644 --- a/crates/optimism/cli/src/commands/mod.rs +++ b/crates/optimism/cli/src/commands/mod.rs @@ -20,7 +20,6 @@ pub mod test_vectors; /// Commands to be executed #[derive(Debug, Subcommand)] -#[expect(clippy::large_enum_variant)] pub enum Commands { /// Start the node diff --git a/crates/storage/db/src/implementation/mdbx/mod.rs b/crates/storage/db/src/implementation/mdbx/mod.rs index 3234666e7c..faa784de69 100644 --- a/crates/storage/db/src/implementation/mdbx/mod.rs +++ b/crates/storage/db/src/implementation/mdbx/mod.rs @@ -99,6 +99,9 @@ pub struct DatabaseArguments { /// /// This flag affects only at environment opening but can't be changed after. exclusive: Option, + /// MDBX allows up to 32767 readers (`MDBX_READERS_LIMIT`). This arg is to configure the max + /// readers. + max_readers: Option, } impl Default for DatabaseArguments { @@ -121,6 +124,7 @@ impl DatabaseArguments { log_level: None, max_read_transaction_duration: None, exclusive: None, + max_readers: None, } } @@ -169,6 +173,12 @@ impl DatabaseArguments { self } + /// Set `max_readers` flag. + pub const fn with_max_readers(mut self, max_readers: Option) -> Self { + self.max_readers = max_readers; + self + } + /// Returns the client version if any. pub const fn client_version(&self) -> &ClientVersion { &self.client_version @@ -375,7 +385,7 @@ impl DatabaseEnv { ..Default::default() }); // Configure more readers - inner_env.set_max_readers(DEFAULT_MAX_READERS); + inner_env.set_max_readers(args.max_readers.unwrap_or(DEFAULT_MAX_READERS)); // This parameter sets the maximum size of the "reclaimed list", and the unit of measurement // is "pages". Reclaimed list is the list of freed pages that's populated during the // lifetime of DB transaction, and through which MDBX searches when it needs to insert new diff --git a/docs/vocs/docs/pages/cli/reth/db.mdx b/docs/vocs/docs/pages/cli/reth/db.mdx index e0079bf261..608ed6388b 100644 --- a/docs/vocs/docs/pages/cli/reth/db.mdx +++ b/docs/vocs/docs/pages/cli/reth/db.mdx @@ -79,6 +79,9 @@ Database: --db.read-transaction-timeout Read transaction timeout in seconds, 0 means no timeout + --db.max-readers + Maximum number of readers allowed to access the database concurrently + Logging: --log.stdout.format The format to use for logs written to stdout diff --git a/docs/vocs/docs/pages/cli/reth/db/diff.mdx b/docs/vocs/docs/pages/cli/reth/db/diff.mdx index cf726a03b7..1d3235781d 100644 --- a/docs/vocs/docs/pages/cli/reth/db/diff.mdx +++ b/docs/vocs/docs/pages/cli/reth/db/diff.mdx @@ -43,6 +43,9 @@ Database: --db.read-transaction-timeout Read transaction timeout in seconds, 0 means no timeout + --db.max-readers + Maximum number of readers allowed to access the database concurrently + --table The table name to diff. If not specified, all tables are diffed. diff --git a/docs/vocs/docs/pages/cli/reth/download.mdx b/docs/vocs/docs/pages/cli/reth/download.mdx index e170a321a4..107e412a59 100644 --- a/docs/vocs/docs/pages/cli/reth/download.mdx +++ b/docs/vocs/docs/pages/cli/reth/download.mdx @@ -67,6 +67,9 @@ Database: --db.read-transaction-timeout Read transaction timeout in seconds, 0 means no timeout + --db.max-readers + Maximum number of readers allowed to access the database concurrently + -u, --url Specify a snapshot URL or let the command propose a default one. diff --git a/docs/vocs/docs/pages/cli/reth/export-era.mdx b/docs/vocs/docs/pages/cli/reth/export-era.mdx index 165970638b..9b8b313059 100644 --- a/docs/vocs/docs/pages/cli/reth/export-era.mdx +++ b/docs/vocs/docs/pages/cli/reth/export-era.mdx @@ -67,6 +67,9 @@ Database: --db.read-transaction-timeout Read transaction timeout in seconds, 0 means no timeout + --db.max-readers + Maximum number of readers allowed to access the database concurrently + --first-block-number Optional first block number to export from the db. It is by default 0. diff --git a/docs/vocs/docs/pages/cli/reth/import-era.mdx b/docs/vocs/docs/pages/cli/reth/import-era.mdx index 9dc2cb7ad4..a8e5fc9766 100644 --- a/docs/vocs/docs/pages/cli/reth/import-era.mdx +++ b/docs/vocs/docs/pages/cli/reth/import-era.mdx @@ -67,6 +67,9 @@ Database: --db.read-transaction-timeout Read transaction timeout in seconds, 0 means no timeout + --db.max-readers + Maximum number of readers allowed to access the database concurrently + --path The path to a directory for import. diff --git a/docs/vocs/docs/pages/cli/reth/import.mdx b/docs/vocs/docs/pages/cli/reth/import.mdx index 958fedf38d..7884e2e4a3 100644 --- a/docs/vocs/docs/pages/cli/reth/import.mdx +++ b/docs/vocs/docs/pages/cli/reth/import.mdx @@ -67,6 +67,9 @@ Database: --db.read-transaction-timeout Read transaction timeout in seconds, 0 means no timeout + --db.max-readers + Maximum number of readers allowed to access the database concurrently + --no-state Disables stages that require state. diff --git a/docs/vocs/docs/pages/cli/reth/init-state.mdx b/docs/vocs/docs/pages/cli/reth/init-state.mdx index 8154798828..3886414fac 100644 --- a/docs/vocs/docs/pages/cli/reth/init-state.mdx +++ b/docs/vocs/docs/pages/cli/reth/init-state.mdx @@ -67,6 +67,9 @@ Database: --db.read-transaction-timeout Read transaction timeout in seconds, 0 means no timeout + --db.max-readers + Maximum number of readers allowed to access the database concurrently + --without-evm Specifies whether to initialize the state without relying on EVM historical data. diff --git a/docs/vocs/docs/pages/cli/reth/init.mdx b/docs/vocs/docs/pages/cli/reth/init.mdx index 80e1558ffa..369747e36f 100644 --- a/docs/vocs/docs/pages/cli/reth/init.mdx +++ b/docs/vocs/docs/pages/cli/reth/init.mdx @@ -67,6 +67,9 @@ Database: --db.read-transaction-timeout Read transaction timeout in seconds, 0 means no timeout + --db.max-readers + Maximum number of readers allowed to access the database concurrently + Logging: --log.stdout.format The format to use for logs written to stdout diff --git a/docs/vocs/docs/pages/cli/reth/node.mdx b/docs/vocs/docs/pages/cli/reth/node.mdx index d059f35e40..fce7bff8bf 100644 --- a/docs/vocs/docs/pages/cli/reth/node.mdx +++ b/docs/vocs/docs/pages/cli/reth/node.mdx @@ -671,6 +671,9 @@ Database: --db.read-transaction-timeout Read transaction timeout in seconds, 0 means no timeout + --db.max-readers + Maximum number of readers allowed to access the database concurrently + Dev testnet: --dev Start the node in dev mode diff --git a/docs/vocs/docs/pages/cli/reth/prune.mdx b/docs/vocs/docs/pages/cli/reth/prune.mdx index 5b604fa6ce..e082305640 100644 --- a/docs/vocs/docs/pages/cli/reth/prune.mdx +++ b/docs/vocs/docs/pages/cli/reth/prune.mdx @@ -67,6 +67,9 @@ Database: --db.read-transaction-timeout Read transaction timeout in seconds, 0 means no timeout + --db.max-readers + Maximum number of readers allowed to access the database concurrently + Logging: --log.stdout.format The format to use for logs written to stdout diff --git a/docs/vocs/docs/pages/cli/reth/re-execute.mdx b/docs/vocs/docs/pages/cli/reth/re-execute.mdx index 22883e9d61..4549dbbd09 100644 --- a/docs/vocs/docs/pages/cli/reth/re-execute.mdx +++ b/docs/vocs/docs/pages/cli/reth/re-execute.mdx @@ -67,6 +67,9 @@ Database: --db.read-transaction-timeout Read transaction timeout in seconds, 0 means no timeout + --db.max-readers + Maximum number of readers allowed to access the database concurrently + --from The height to start at diff --git a/docs/vocs/docs/pages/cli/reth/recover/storage-tries.mdx b/docs/vocs/docs/pages/cli/reth/recover/storage-tries.mdx index aafce28907..d95ba81292 100644 --- a/docs/vocs/docs/pages/cli/reth/recover/storage-tries.mdx +++ b/docs/vocs/docs/pages/cli/reth/recover/storage-tries.mdx @@ -67,6 +67,9 @@ Database: --db.read-transaction-timeout Read transaction timeout in seconds, 0 means no timeout + --db.max-readers + Maximum number of readers allowed to access the database concurrently + Logging: --log.stdout.format The format to use for logs written to stdout diff --git a/docs/vocs/docs/pages/cli/reth/stage/drop.mdx b/docs/vocs/docs/pages/cli/reth/stage/drop.mdx index 5d3312b3ea..71439a28dd 100644 --- a/docs/vocs/docs/pages/cli/reth/stage/drop.mdx +++ b/docs/vocs/docs/pages/cli/reth/stage/drop.mdx @@ -67,6 +67,9 @@ Database: --db.read-transaction-timeout Read transaction timeout in seconds, 0 means no timeout + --db.max-readers + Maximum number of readers allowed to access the database concurrently + Possible values: - headers: The headers stage within the pipeline diff --git a/docs/vocs/docs/pages/cli/reth/stage/dump.mdx b/docs/vocs/docs/pages/cli/reth/stage/dump.mdx index 8af42029fa..3c4122232a 100644 --- a/docs/vocs/docs/pages/cli/reth/stage/dump.mdx +++ b/docs/vocs/docs/pages/cli/reth/stage/dump.mdx @@ -74,6 +74,9 @@ Database: --db.read-transaction-timeout Read transaction timeout in seconds, 0 means no timeout + --db.max-readers + Maximum number of readers allowed to access the database concurrently + Logging: --log.stdout.format The format to use for logs written to stdout diff --git a/docs/vocs/docs/pages/cli/reth/stage/run.mdx b/docs/vocs/docs/pages/cli/reth/stage/run.mdx index 5a7a9ad10c..f6acd81447 100644 --- a/docs/vocs/docs/pages/cli/reth/stage/run.mdx +++ b/docs/vocs/docs/pages/cli/reth/stage/run.mdx @@ -67,6 +67,9 @@ Database: --db.read-transaction-timeout Read transaction timeout in seconds, 0 means no timeout + --db.max-readers + Maximum number of readers allowed to access the database concurrently + --metrics Enable Prometheus metrics. diff --git a/docs/vocs/docs/pages/cli/reth/stage/unwind.mdx b/docs/vocs/docs/pages/cli/reth/stage/unwind.mdx index d0671040dc..e9036beab1 100644 --- a/docs/vocs/docs/pages/cli/reth/stage/unwind.mdx +++ b/docs/vocs/docs/pages/cli/reth/stage/unwind.mdx @@ -72,6 +72,9 @@ Database: --db.read-transaction-timeout Read transaction timeout in seconds, 0 means no timeout + --db.max-readers + Maximum number of readers allowed to access the database concurrently + --offline If this is enabled, then all stages except headers, bodies, and sender recovery will be unwound