mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-08 22:12:56 +00:00
Revert "abandoned prototype how it would be if we do what triggers do but in the app"
This reverts commit 24d96e4372.
This commit is contained in:
@@ -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::<diesel::sql_types::VarChar, _>(tenant_shard_id.tenant_id.to_string())
|
||||
.bind::<diesel::sql_types::Integer, _>(tenant_shard_id.shard_number.0 as i32)
|
||||
.bind::<diesel::sql_types::Integer, _>(tenant_shard_id.shard_count.literal() as i32)
|
||||
.bind::<diesel::sql_types::Timestamptz, _>(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<chrono::Utc>,
|
||||
pub(crate) last_attempt_at: Option<chrono::DateTime<chrono::Utc>>,
|
||||
}
|
||||
|
||||
@@ -490,7 +490,6 @@ pub struct Service {
|
||||
config: Config,
|
||||
persistence: Arc<Persistence>,
|
||||
compute_hook: Arc<ComputeHook>,
|
||||
sk_ps_disovery: Arc<sk_ps_discovery::ActorClient>,
|
||||
result_tx: tokio::sync::mpsc::UnboundedSender<ReconcileResultRequest>,
|
||||
|
||||
heartbeater_ps: Heartbeater<Node, PageserverState>,
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user