mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-14 19:50:38 +00:00
storcon: make pageserver AZ id mandatory (#8856)
## Problem https://github.com/neondatabase/neon/pull/8852 introduced a new nullable column for the `nodes` table: `availability_zone_id` ## Summary of changes * Make neon local and the test suite always provide an az id * Make the az id field in the ps registration request mandatory * Migrate the column to non-nullable and adjust in memory state accordingly * Remove the code that was used to populate the az id for pre-existing nodes
This commit is contained in:
@@ -36,7 +36,7 @@ pub(crate) struct Node {
|
||||
listen_pg_addr: String,
|
||||
listen_pg_port: u16,
|
||||
|
||||
availability_zone_id: Option<String>,
|
||||
availability_zone_id: String,
|
||||
|
||||
// This cancellation token means "stop any RPCs in flight to this node, and don't start
|
||||
// any more". It is not related to process shutdown.
|
||||
@@ -63,8 +63,9 @@ impl Node {
|
||||
self.id
|
||||
}
|
||||
|
||||
pub(crate) fn get_availability_zone_id(&self) -> Option<&str> {
|
||||
self.availability_zone_id.as_deref()
|
||||
#[allow(unused)]
|
||||
pub(crate) fn get_availability_zone_id(&self) -> &str {
|
||||
self.availability_zone_id.as_str()
|
||||
}
|
||||
|
||||
pub(crate) fn get_scheduling(&self) -> NodeSchedulingPolicy {
|
||||
@@ -78,22 +79,12 @@ impl Node {
|
||||
/// Does this registration request match `self`? This is used when deciding whether a registration
|
||||
/// request should be allowed to update an existing record with the same node ID.
|
||||
pub(crate) fn registration_match(&self, register_req: &NodeRegisterRequest) -> bool {
|
||||
let az_ids_match = {
|
||||
match (
|
||||
self.availability_zone_id.as_deref(),
|
||||
register_req.availability_zone_id.as_deref(),
|
||||
) {
|
||||
(Some(current_az), Some(register_req_az)) => current_az == register_req_az,
|
||||
_ => true,
|
||||
}
|
||||
};
|
||||
|
||||
az_ids_match
|
||||
&& self.id == register_req.node_id
|
||||
self.id == register_req.node_id
|
||||
&& self.listen_http_addr == register_req.listen_http_addr
|
||||
&& self.listen_http_port == register_req.listen_http_port
|
||||
&& self.listen_pg_addr == register_req.listen_pg_addr
|
||||
&& self.listen_pg_port == register_req.listen_pg_port
|
||||
&& self.availability_zone_id == register_req.availability_zone_id
|
||||
}
|
||||
|
||||
/// For a shard located on this node, populate a response object
|
||||
@@ -190,7 +181,7 @@ impl Node {
|
||||
listen_http_port: u16,
|
||||
listen_pg_addr: String,
|
||||
listen_pg_port: u16,
|
||||
availability_zone_id: Option<String>,
|
||||
availability_zone_id: String,
|
||||
) -> Self {
|
||||
Self {
|
||||
id,
|
||||
|
||||
Reference in New Issue
Block a user