diff --git a/crates/autopilot/src/arguments.rs b/crates/autopilot/src/arguments.rs index 6174b51c97..f851f0f373 100644 --- a/crates/autopilot/src/arguments.rs +++ b/crates/autopilot/src/arguments.rs @@ -65,11 +65,6 @@ pub struct Arguments { #[clap(long, env, default_value = "postgresql://")] pub db_write_url: Url, - /// Url of the Postgres database replica. By default it's the same as - /// db_write_url - #[clap(long, env)] - pub db_read_url: Option, - /// The number of order events to insert in a single batch. #[clap(long, env, default_value = "500")] pub insert_batch_size: NonZeroUsize, @@ -389,7 +384,6 @@ impl std::fmt::Display for Arguments { order_events_cleanup_interval, order_events_cleanup_threshold, db_write_url, - db_read_url, insert_batch_size, native_price_estimation_results_required, max_settlement_transaction_wait, @@ -417,7 +411,6 @@ impl std::fmt::Display for Arguments { writeln!(f, "ethflow_indexing_start: {ethflow_indexing_start:?}")?; writeln!(f, "metrics_address: {metrics_address}")?; display_secret_option(f, "db_write_url", Some(&db_write_url))?; - display_secret_option(f, "db_read_url", db_read_url.as_ref())?; writeln!(f, "skip_event_sync: {skip_event_sync}")?; writeln!(f, "allowed_tokens: {allowed_tokens:?}")?; writeln!(f, "unsupported_tokens: {unsupported_tokens:?}")?; diff --git a/crates/autopilot/src/database/mod.rs b/crates/autopilot/src/database/mod.rs index 38bd9a50aa..5f37629277 100644 --- a/crates/autopilot/src/database/mod.rs +++ b/crates/autopilot/src/database/mod.rs @@ -165,7 +165,6 @@ pub fn run_database_metrics_work(db: Postgres) { let span = tracing::info_span!("database_metrics"); // Spawn the task for updating large table statistics tokio::spawn(update_large_tables_stats(db.clone()).instrument(span.clone())); - // Spawn the task for database metrics tokio::task::spawn(database_metrics(db).instrument(span)); } diff --git a/crates/autopilot/src/run.rs b/crates/autopilot/src/run.rs index 25a21e66a8..5823554e7b 100644 --- a/crates/autopilot/src/run.rs +++ b/crates/autopilot/src/run.rs @@ -173,17 +173,9 @@ pub async fn run(args: Arguments, shutdown_controller: ShutdownController) { .await .unwrap(); - let db_read = if let Some(db_read_url) = args.db_read_url - && args.db_write_url != db_read_url - { - Postgres::new(db_read_url.as_str(), args.insert_batch_size) - .await - .expect("failed to create read replica database") - } else { - db_write.clone() - }; - - crate::database::run_database_metrics_work(db_read.clone()); + // If the DB is in read-only mode, running ANALYZE is not possible and will + // trigger and error https://www.postgresql.org/docs/current/hot-standby.html + crate::database::run_database_metrics_work(db_write.clone()); let http_factory = HttpClientFactory::new(&args.http_client); let web3 = shared::ethrpc::web3( diff --git a/crates/e2e/src/setup/services.rs b/crates/e2e/src/setup/services.rs index 3930a37d47..6642297a85 100644 --- a/crates/e2e/src/setup/services.rs +++ b/crates/e2e/src/setup/services.rs @@ -134,8 +134,6 @@ impl<'a> Services<'a> { "--hooks-contract-address={:?}", self.contracts.hooks.address() ), - "--db-read-url".to_string(), - LOCAL_READ_ONLY_DB_URL.clone(), ] .into_iter() } @@ -236,6 +234,8 @@ impl<'a> Services<'a> { "orderbook".to_string(), "--quote-timeout=10s".to_string(), "--quote-verification=enforce-when-possible".to_string(), + "--db-read-url".to_string(), + LOCAL_READ_ONLY_DB_URL.clone(), ] .into_iter() .chain(self.api_autopilot_solver_arguments())