mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-14 17:02:56 +00:00
schema
This commit is contained in:
@@ -40,6 +40,7 @@ use crate::metrics::{
|
||||
DatabaseQueryErrorLabelGroup, DatabaseQueryLatencyLabelGroup, METRICS_REGISTRY,
|
||||
};
|
||||
use crate::node::Node;
|
||||
use crate::schema::sk_ps_discovery;
|
||||
use crate::timeline_import::{
|
||||
TimelineImport, TimelineImportUpdateError, TimelineImportUpdateFollowUp,
|
||||
};
|
||||
|
||||
@@ -66,6 +66,7 @@ diesel::table! {
|
||||
shard_number -> Int4,
|
||||
shard_count -> Int4,
|
||||
shard_stripe_size -> Int4,
|
||||
// pageserver generation
|
||||
generation -> Nullable<Int4>,
|
||||
generation_pageserver -> Nullable<Int8>,
|
||||
placement_policy -> Varchar,
|
||||
@@ -92,6 +93,7 @@ diesel::table! {
|
||||
tenant_id -> Varchar,
|
||||
timeline_id -> Varchar,
|
||||
start_lsn -> PgLsn,
|
||||
// sk config generation
|
||||
generation -> Int4,
|
||||
sk_set -> Array<Nullable<Int8>>,
|
||||
new_sk_set -> Nullable<Array<Nullable<Int8>>>,
|
||||
@@ -100,6 +102,25 @@ diesel::table! {
|
||||
}
|
||||
}
|
||||
|
||||
// Operational table that contains pending notifications for Safekeepers
|
||||
// about tenant shard pageserver-side attachments.
|
||||
// Rows are removed when the notification was acknowledged by the Safekeeper.
|
||||
diesel::table! {
|
||||
use diesel::sql_types::*;
|
||||
sk_ps_discovery(tenant_id, shard_number, shard_count, ps_generation, sk_id) {
|
||||
tenant_id -> Varchar,
|
||||
shard_number -> Int4,
|
||||
shard_count -> Int4,
|
||||
ps_generation -> Int4,
|
||||
sk_id -> Int8,
|
||||
// payload
|
||||
ps_id -> Int8,
|
||||
// tracking of reliable delivery
|
||||
created_at -> Timestamptz,
|
||||
last_attempt_at -> Nullable<Timestamptz>,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::allow_tables_to_appear_in_same_query!(
|
||||
controllers,
|
||||
metadata_health,
|
||||
@@ -109,4 +130,5 @@ diesel::allow_tables_to_appear_in_same_query!(
|
||||
tenant_shards,
|
||||
timeline_imports,
|
||||
timelines,
|
||||
sk_ps_discovery,
|
||||
);
|
||||
|
||||
@@ -2,6 +2,7 @@ pub mod chaos_injector;
|
||||
mod context_iterator;
|
||||
pub(crate) mod safekeeper_reconciler;
|
||||
mod safekeeper_service;
|
||||
mod sk_ps_discovery;
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::cmp::Ordering;
|
||||
|
||||
46
storage_controller/src/service/sk_ps_discovery.rs
Normal file
46
storage_controller/src/service/sk_ps_discovery.rs
Normal file
@@ -0,0 +1,46 @@
|
||||
use utils::{
|
||||
generation::Generation,
|
||||
id::{NodeId, TenantId, TimelineId},
|
||||
shard::TenantShardId,
|
||||
};
|
||||
|
||||
use crate::persistence::Persistence;
|
||||
|
||||
pub struct ActorClient {}
|
||||
|
||||
enum Message {
|
||||
PageserverAttachmentNew {
|
||||
tenant_shard_id: TenantShardId,
|
||||
ps_generation: Generation,
|
||||
ps_id: NodeId,
|
||||
},
|
||||
PageserverAttachmentRemoved {
|
||||
tenant_shard_id: TenantShardId,
|
||||
ps_generation: Generation,
|
||||
ps_id: NodeId,
|
||||
},
|
||||
SafekeeperConfigChange {
|
||||
tenant_id: TenantId,
|
||||
timeline_id: TimelineId,
|
||||
safekeeper_ids: Vec<NodeId>,
|
||||
},
|
||||
SafekeeperDelete {
|
||||
safekeeper_id: NodeId,
|
||||
},
|
||||
}
|
||||
|
||||
struct Actor {}
|
||||
|
||||
pub async fn spawn(persistence: Arc<Persistence>) -> ActorClient {
|
||||
let actor = Actor { persistence };
|
||||
tokio::spawn(actor.run());
|
||||
ActorClient {}
|
||||
}
|
||||
|
||||
impl ActorClient {}
|
||||
|
||||
impl Actor {
|
||||
async fn run(self) {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user