storcon: provide an az id in metadata.json from neon local (#8897)

## Problem
Neon local set-up does not inject an az id in `metadata.json`. See real
change in https://github.com/neondatabase/neon/pull/8852.

## Summary of changes
We piggyback on the existing `availability_zone` pageserver
configuration in order to avoid making neon local even more complex.
This commit is contained in:
Vlad Lazar
2024-09-03 15:11:30 +01:00
committed by GitHub
parent b37da32c6f
commit c43e664ff5
3 changed files with 28 additions and 10 deletions

View File

@@ -1164,6 +1164,8 @@ class NeonEnv:
"listen_http_addr": f"localhost:{pageserver_port.http}",
"pg_auth_type": pg_auth_type,
"http_auth_type": http_auth_type,
# Default which can be overriden with `NeonEnvBuilder.pageserver_config_override`
"availability_zone": "us-east-2a",
}
if self.pageserver_virtual_file_io_engine is not None:
ps_cfg["virtual_file_io_engine"] = self.pageserver_virtual_file_io_engine
@@ -1192,11 +1194,7 @@ class NeonEnv:
# Create a corresponding NeonPageserver object
self.pageservers.append(
NeonPageserver(
self,
ps_id,
port=pageserver_port,
)
NeonPageserver(self, ps_id, port=pageserver_port, az_id=ps_cfg["availability_zone"])
)
cfg["pageservers"].append(ps_cfg)
@@ -2400,6 +2398,7 @@ class NeonStorageController(MetricsGetter, LogUtils):
"listen_http_port": node.service_port.http,
"listen_pg_addr": "localhost",
"listen_pg_port": node.service_port.pg,
"availability_zone_id": node.az_id,
}
log.info(f"node_register({body})")
self.request(
@@ -2923,10 +2922,11 @@ class NeonPageserver(PgProtocol, LogUtils):
TEMP_FILE_SUFFIX = "___temp"
def __init__(self, env: NeonEnv, id: int, port: PageserverPort):
def __init__(self, env: NeonEnv, id: int, port: PageserverPort, az_id: str):
super().__init__(host="localhost", port=port.pg, user="cloud_admin")
self.env = env
self.id = id
self.az_id = az_id
self.running = False
self.service_port = port
self.version = env.get_binary_version("pageserver")

View File

@@ -109,9 +109,6 @@ DEFAULT_STORAGE_CONTROLLER_ALLOWED_ERRORS = [
# controller's attempts to notify the endpoint).
".*reconciler.*neon_local notification hook failed.*",
".*reconciler.*neon_local error.*",
# Neon local does not provide pageserver with an AZ
# TODO: remove this once neon local does so
".*registering without specific availability zone id.*",
]