Add option to disable background_reconcile for storage controller

This commit is contained in:
Arpad Müller
2024-07-15 17:08:24 +02:00
parent 4184685721
commit 8bb3fd3fa5
4 changed files with 29 additions and 10 deletions

View File

@@ -75,6 +75,10 @@ struct Cli {
#[arg(long)]
reconciler_concurrency: Option<usize>,
/// Whether to spawn a background reconciliation task (enabled by default)
#[arg(long)]
background_reconcile: Option<bool>,
/// How long to wait for the initial database connection to be available.
#[arg(long, default_value = "5s")]
db_connect_timeout: humantime::Duration,
@@ -266,6 +270,7 @@ async fn async_main() -> anyhow::Result<()> {
reconciler_concurrency: args
.reconciler_concurrency
.unwrap_or(RECONCILER_CONCURRENCY_DEFAULT),
background_reconcile: args.background_reconcile.unwrap_or(true),
split_threshold: args.split_threshold,
neon_local_repo_dir: args.neon_local_repo_dir,
};

View File

@@ -240,6 +240,8 @@ pub struct Config {
/// How many Reconcilers may be spawned concurrently
pub reconciler_concurrency: usize,
pub background_reconcile: bool,
/// How large must a shard grow in bytes before we split it?
/// None disables auto-splitting.
pub split_threshold: Option<u64>,
@@ -1229,14 +1231,16 @@ impl Service {
}
});
tokio::task::spawn({
let this = this.clone();
let startup_complete = startup_complete.clone();
async move {
startup_complete.wait().await;
this.background_reconcile().await;
}
});
if config.background_reconcile {
tokio::task::spawn({
let this = this.clone();
let startup_complete = startup_complete.clone();
async move {
startup_complete.wait().await;
this.background_reconcile().await;
}
});
}
tokio::task::spawn({
let this = this.clone();