feat(rpc): Add flags to disable read tx timeout (#11856)

This commit is contained in:
Francis Li
2024-10-22 05:43:25 -07:00
committed by GitHub
parent df57aedba6
commit 60337d9614
19 changed files with 67 additions and 1 deletions

3
book/cli/reth/db.md vendored
View File

@ -81,6 +81,9 @@ Database:
[possible values: true, false] [possible values: true, false]
--db.read-transaction-timeout <READ_TRANSACTION_TIMEOUT>
Read transaction timeout in seconds, 0 means no timeout
Logging: Logging:
--log.stdout.format <FORMAT> --log.stdout.format <FORMAT>
The format to use for logs written to stdout The format to use for logs written to stdout

View File

@ -45,6 +45,9 @@ Database:
[possible values: true, false] [possible values: true, false]
--db.read-transaction-timeout <READ_TRANSACTION_TIMEOUT>
Read transaction timeout in seconds, 0 means no timeout
--table <TABLE> --table <TABLE>
The table name to diff. If not specified, all tables are diffed. The table name to diff. If not specified, all tables are diffed.

View File

@ -69,6 +69,9 @@ Database:
[possible values: true, false] [possible values: true, false]
--db.read-transaction-timeout <READ_TRANSACTION_TIMEOUT>
Read transaction timeout in seconds, 0 means no timeout
--trusted-setup-file <PATH> --trusted-setup-file <PATH>
Overrides the KZG trusted setup by reading from the supplied file Overrides the KZG trusted setup by reading from the supplied file

View File

@ -69,6 +69,9 @@ Database:
[possible values: true, false] [possible values: true, false]
--db.read-transaction-timeout <READ_TRANSACTION_TIMEOUT>
Read transaction timeout in seconds, 0 means no timeout
Networking: Networking:
-d, --disable-discovery -d, --disable-discovery
Disable the discovery service Disable the discovery service

View File

@ -69,6 +69,9 @@ Database:
[possible values: true, false] [possible values: true, false]
--db.read-transaction-timeout <READ_TRANSACTION_TIMEOUT>
Read transaction timeout in seconds, 0 means no timeout
Networking: Networking:
-d, --disable-discovery -d, --disable-discovery
Disable the discovery service Disable the discovery service

View File

@ -69,6 +69,9 @@ Database:
[possible values: true, false] [possible values: true, false]
--db.read-transaction-timeout <READ_TRANSACTION_TIMEOUT>
Read transaction timeout in seconds, 0 means no timeout
Networking: Networking:
-d, --disable-discovery -d, --disable-discovery
Disable the discovery service Disable the discovery service

View File

@ -69,6 +69,9 @@ Database:
[possible values: true, false] [possible values: true, false]
--db.read-transaction-timeout <READ_TRANSACTION_TIMEOUT>
Read transaction timeout in seconds, 0 means no timeout
Networking: Networking:
-d, --disable-discovery -d, --disable-discovery
Disable the discovery service Disable the discovery service

View File

@ -69,6 +69,9 @@ Database:
[possible values: true, false] [possible values: true, false]
--db.read-transaction-timeout <READ_TRANSACTION_TIMEOUT>
Read transaction timeout in seconds, 0 means no timeout
--no-state --no-state
Disables stages that require state. Disables stages that require state.

View File

@ -69,6 +69,9 @@ Database:
[possible values: true, false] [possible values: true, false]
--db.read-transaction-timeout <READ_TRANSACTION_TIMEOUT>
Read transaction timeout in seconds, 0 means no timeout
<STATE_DUMP_FILE> <STATE_DUMP_FILE>
JSONL file with state dump. JSONL file with state dump.

View File

@ -69,6 +69,9 @@ Database:
[possible values: true, false] [possible values: true, false]
--db.read-transaction-timeout <READ_TRANSACTION_TIMEOUT>
Read transaction timeout in seconds, 0 means no timeout
Logging: Logging:
--log.stdout.format <FORMAT> --log.stdout.format <FORMAT>
The format to use for logs written to stdout The format to use for logs written to stdout

View File

@ -590,6 +590,9 @@ Database:
[possible values: true, false] [possible values: true, false]
--db.read-transaction-timeout <READ_TRANSACTION_TIMEOUT>
Read transaction timeout in seconds, 0 means no timeout
Dev testnet: Dev testnet:
--dev --dev
Start the node in dev mode Start the node in dev mode

View File

@ -247,6 +247,9 @@ Database:
[possible values: true, false] [possible values: true, false]
--db.read-transaction-timeout <READ_TRANSACTION_TIMEOUT>
Read transaction timeout in seconds, 0 means no timeout
Logging: Logging:
--log.stdout.format <FORMAT> --log.stdout.format <FORMAT>
The format to use for logs written to stdout The format to use for logs written to stdout

View File

@ -69,6 +69,9 @@ Database:
[possible values: true, false] [possible values: true, false]
--db.read-transaction-timeout <READ_TRANSACTION_TIMEOUT>
Read transaction timeout in seconds, 0 means no timeout
Logging: Logging:
--log.stdout.format <FORMAT> --log.stdout.format <FORMAT>
The format to use for logs written to stdout The format to use for logs written to stdout

View File

@ -69,6 +69,9 @@ Database:
[possible values: true, false] [possible values: true, false]
--db.read-transaction-timeout <READ_TRANSACTION_TIMEOUT>
Read transaction timeout in seconds, 0 means no timeout
Logging: Logging:
--log.stdout.format <FORMAT> --log.stdout.format <FORMAT>
The format to use for logs written to stdout The format to use for logs written to stdout

View File

@ -69,6 +69,9 @@ Database:
[possible values: true, false] [possible values: true, false]
--db.read-transaction-timeout <READ_TRANSACTION_TIMEOUT>
Read transaction timeout in seconds, 0 means no timeout
<STAGE> <STAGE>
Possible values: Possible values:
- headers: The headers stage within the pipeline - headers: The headers stage within the pipeline

View File

@ -76,6 +76,9 @@ Database:
[possible values: true, false] [possible values: true, false]
--db.read-transaction-timeout <READ_TRANSACTION_TIMEOUT>
Read transaction timeout in seconds, 0 means no timeout
Logging: Logging:
--log.stdout.format <FORMAT> --log.stdout.format <FORMAT>
The format to use for logs written to stdout The format to use for logs written to stdout

View File

@ -69,6 +69,9 @@ Database:
[possible values: true, false] [possible values: true, false]
--db.read-transaction-timeout <READ_TRANSACTION_TIMEOUT>
Read transaction timeout in seconds, 0 means no timeout
--metrics <SOCKET> --metrics <SOCKET>
Enable Prometheus metrics. Enable Prometheus metrics.

View File

@ -74,6 +74,9 @@ Database:
[possible values: true, false] [possible values: true, false]
--db.read-transaction-timeout <READ_TRANSACTION_TIMEOUT>
Read transaction timeout in seconds, 0 means no timeout
Networking: Networking:
-d, --disable-discovery -d, --disable-discovery
Disable the discovery service Disable the discovery service

View File

@ -1,12 +1,14 @@
//! clap [Args](clap::Args) for database configuration //! clap [Args](clap::Args) for database configuration
use std::time::Duration;
use crate::version::default_client_version; use crate::version::default_client_version;
use clap::{ use clap::{
builder::{PossibleValue, TypedValueParser}, builder::{PossibleValue, TypedValueParser},
error::ErrorKind, error::ErrorKind,
Arg, Args, Command, Error, Arg, Args, Command, Error,
}; };
use reth_db::ClientVersion; use reth_db::{mdbx::MaxReadTransactionDuration, ClientVersion};
use reth_storage_errors::db::LogLevel; use reth_storage_errors::db::LogLevel;
/// Parameters for database configuration /// Parameters for database configuration
@ -20,6 +22,9 @@ pub struct DatabaseArgs {
/// NFS volume. /// NFS volume.
#[arg(long = "db.exclusive")] #[arg(long = "db.exclusive")]
pub exclusive: Option<bool>, pub exclusive: Option<bool>,
/// Read transaction timeout in seconds, 0 means no timeout.
#[arg(long = "db.read-transaction-timeout")]
pub read_transaction_timeout: Option<u64>,
} }
impl DatabaseArgs { impl DatabaseArgs {
@ -33,9 +38,16 @@ impl DatabaseArgs {
&self, &self,
client_version: ClientVersion, client_version: ClientVersion,
) -> reth_db::mdbx::DatabaseArguments { ) -> reth_db::mdbx::DatabaseArguments {
let max_read_transaction_duration = match self.read_transaction_timeout {
None => None, // if not specified, use default value
Some(0) => Some(MaxReadTransactionDuration::Unbounded), // if 0, disable timeout
Some(secs) => Some(MaxReadTransactionDuration::Set(Duration::from_secs(secs))),
};
reth_db::mdbx::DatabaseArguments::new(client_version) reth_db::mdbx::DatabaseArguments::new(client_version)
.with_log_level(self.log_level) .with_log_level(self.log_level)
.with_exclusive(self.exclusive) .with_exclusive(self.exclusive)
.with_max_read_transaction_duration(max_read_transaction_duration)
} }
} }