From a6bd4a3be6183d63f51b636143b6ee069d09f1aa Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Tue, 27 May 2025 14:13:10 +0200 Subject: [PATCH] Revert "abandoned prototype how it would be if we do what triggers do but in the app" This reverts commit 24d96e4372358a69ef3e84fec088ef39dd608e3a. --- storage_controller/src/persistence.rs | 36 --------------------------- storage_controller/src/service.rs | 4 --- 2 files changed, 40 deletions(-) diff --git a/storage_controller/src/persistence.rs b/storage_controller/src/persistence.rs index ff1096f265..557b4c8df4 100644 --- a/storage_controller/src/persistence.rs +++ b/storage_controller/src/persistence.rs @@ -656,25 +656,6 @@ impl Persistence { .get_result(conn) .await?; - let sk_ps_discovery_update_query = diesel::sql_query(r#" - INSERT INTO sk_ps_discovery (tenant_id, shard_number, shard_count, ps_generation, sk_id, ps_id,created_at, last_attmpt_at) - SELECT ( - WITH sk_timeline_attachments AS ( - SELECT DISTINCT tenant_id,timeline_id,unnest(array_cat(sk_set, new_sk_set)) as sk_id FROM timelines - WHERE tenant_id = $1 - ) - SELECT $1, $2, $3, tenant_shards.generation, sk_timeline_attachments.sk_id, tenant_shards.generation_pageserver, $4, NULL - FROM tenant_shards - INNER JOIN sk_timeline_attachments ON tenant_shards.tenant_id = sk_timeline_attachments.tenant_id - ) - "#); - sk_ps_discovery_update_query.bind::(tenant_shard_id.tenant_id.to_string()) - .bind::(tenant_shard_id.shard_number.0 as i32) - .bind::(tenant_shard_id.shard_count.literal() as i32) - .bind::(chrono::Utc::now()) - .execute(conn) - .await?; - Ok(updated) }) }) @@ -984,8 +965,6 @@ impl Persistence { } } - // TODO: schedule sk_to_ps_discovery - Ok(()) }) }) @@ -1348,8 +1327,6 @@ impl Persistence { .execute(conn) .await?; - // TODO - match inserted_updated { 0 => Ok(false), 1 => Ok(true), @@ -2410,16 +2387,3 @@ pub(crate) struct TimelineImportPersistence { pub(crate) timeline_id: String, pub(crate) shard_statuses: serde_json::Value, } - -#[derive(Insertable, AsChangeset, Clone)] -#[diesel(table_name = crate::schema::sk_ps_discovery)] -pub(crate) struct SkPsDiscoveryPersistence { - pub(crate) tenant_id: String, - pub(crate) shard_number: i32, - pub(crate) shard_count: i32, - pub(crate) ps_generation: i32, - pub(crate) sk_id: i64, - pub(crate) ps_id: i64, - pub(crate) created_at: chrono::DateTime, - pub(crate) last_attempt_at: Option>, -} diff --git a/storage_controller/src/service.rs b/storage_controller/src/service.rs index eac6776b01..c0f48c670b 100644 --- a/storage_controller/src/service.rs +++ b/storage_controller/src/service.rs @@ -490,7 +490,6 @@ pub struct Service { config: Config, persistence: Arc, compute_hook: Arc, - sk_ps_disovery: Arc, result_tx: tokio::sync::mpsc::UnboundedSender, heartbeater_ps: Heartbeater, @@ -1762,8 +1761,6 @@ impl Service { cancel.clone(), ); - let sk_ps_discovery = sk_ps_discovery::spawn(persistence.clone()); - let initial_leadership_status = if config.start_as_candidate { LeadershipStatus::Candidate } else { @@ -1783,7 +1780,6 @@ impl Service { config: config.clone(), persistence, compute_hook: Arc::new(ComputeHook::new(config.clone())?), - sk_ps_disovery, result_tx, heartbeater_ps, heartbeater_sk,