diff --git a/compute_tools/src/bin/compute_ctl.rs b/compute_tools/src/bin/compute_ctl.rs
index 5dd8ca4499..d3b779e363 100644
--- a/compute_tools/src/bin/compute_ctl.rs
+++ b/compute_tools/src/bin/compute_ctl.rs
@@ -172,21 +172,13 @@ impl Cli {
}
}
-fn main() -> Result<()> {
+#[tokio::main]
+async fn main() -> Result<()> {
let cli = Cli::parse();
let scenario = failpoint_support::init();
- // For historical reasons, the main thread that processes the config and launches postgres
- // is synchronous, but we always have this tokio runtime available and we "enter" it so
- // that you can use tokio::spawn() and tokio::runtime::Handle::current().block_on(...)
- // from all parts of compute_ctl.
- let runtime = tokio::runtime::Builder::new_multi_thread()
- .enable_all()
- .build()?;
- let _rt_guard = runtime.enter();
-
- runtime.block_on(init())?;
+ init().await?;
// enable core dumping for all child processes
setrlimit(Resource::CORE, rlimit::INFINITY, rlimit::INFINITY)?;
@@ -218,7 +210,7 @@ fn main() -> Result<()> {
config,
)?;
- let exit_code = compute_node.run()?;
+ let exit_code = compute_node.run().await?;
scenario.teardown();
diff --git a/compute_tools/src/compute.rs b/compute_tools/src/compute.rs
index bd6ed910be..bf6a88261a 100644
--- a/compute_tools/src/compute.rs
+++ b/compute_tools/src/compute.rs
@@ -15,9 +15,6 @@ use itertools::Itertools;
use nix::sys::signal::{Signal, kill};
use nix::unistd::Pid;
use once_cell::sync::Lazy;
-use postgres;
-use postgres::NoTls;
-use postgres::error::SqlState;
use remote_storage::{DownloadError, RemotePath};
use std::collections::{HashMap, HashSet};
use std::net::SocketAddr;
@@ -30,6 +27,7 @@ use std::sync::{Arc, Condvar, Mutex, RwLock};
use std::time::{Duration, Instant};
use std::{env, fs};
use tokio::spawn;
+use tokio_postgres::{NoTls, error::SqlState};
use tracing::{Instrument, debug, error, info, instrument, warn};
use url::Url;
use utils::id::{TenantId, TimelineId};
@@ -386,7 +384,7 @@ impl ComputeNode {
/// Top-level control flow of compute_ctl. Returns a process exit code we should
/// exit with.
- pub fn run(self) -> Result