From a5292f7e67727307341c1d4a372ee7f69efbb626 Mon Sep 17 00:00:00 2001 From: Gleb Novikov Date: Fri, 27 Oct 2023 14:36:34 +0300 Subject: [PATCH] Some minor renames in attachment service API (#5687) ## Problem ## Summary of changes ## Checklist before requesting a review - [x] I have performed a self-review of my code. - [ ] ~~If it is a core feature, I have added thorough tests.~~ - [ ] ~~Do we need to implement analytics? if so did you add the relevant metrics to the dashboard?~~ - [ ] ~~If this PR requires public announcement, mark it with /release-notes label and add several sentences in this section.~~ ## Checklist before merging - [ ] Do not forget to reformat commit message to not include the above checklist --- control_plane/src/attachment_service.rs | 6 +++--- control_plane/src/bin/attachment_service.rs | 12 ++++++------ libs/pageserver_api/src/control_api.rs | 2 +- pageserver/src/control_plane_client.rs | 2 +- test_runner/fixtures/neon_fixtures.py | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/control_plane/src/attachment_service.rs b/control_plane/src/attachment_service.rs index d7828cdba7..ca632c5eb6 100644 --- a/control_plane/src/attachment_service.rs +++ b/control_plane/src/attachment_service.rs @@ -19,7 +19,7 @@ const COMMAND: &str = "attachment_service"; pub struct AttachHookRequest { #[serde_as(as = "DisplayFromStr")] pub tenant_id: TenantId, - pub pageserver_id: Option, + pub node_id: Option, } #[derive(Serialize, Deserialize)] @@ -85,7 +85,7 @@ impl AttachmentService { .control_plane_api .clone() .unwrap() - .join("attach_hook") + .join("attach-hook") .unwrap(); let client = reqwest::blocking::ClientBuilder::new() .build() @@ -93,7 +93,7 @@ impl AttachmentService { let request = AttachHookRequest { tenant_id, - pageserver_id: Some(pageserver_id), + node_id: Some(pageserver_id), }; let response = client.post(url).json(&request).send()?; diff --git a/control_plane/src/bin/attachment_service.rs b/control_plane/src/bin/attachment_service.rs index 65ed78d20b..0ccd9e75fc 100644 --- a/control_plane/src/bin/attachment_service.rs +++ b/control_plane/src/bin/attachment_service.rs @@ -171,7 +171,7 @@ async fn handle_re_attach(mut req: Request) -> Result, ApiE state.generation += 1; response.tenants.push(ReAttachResponseTenant { id: *t, - generation: state.generation, + gen: state.generation, }); } } @@ -217,14 +217,14 @@ async fn handle_attach_hook(mut req: Request) -> Result, Ap .tenants .entry(attach_req.tenant_id) .or_insert_with(|| TenantState { - pageserver: attach_req.pageserver_id, + pageserver: attach_req.node_id, generation: 0, }); - if attach_req.pageserver_id.is_some() { + if attach_req.node_id.is_some() { tenant_state.generation += 1; } - tenant_state.pageserver = attach_req.pageserver_id; + tenant_state.pageserver = attach_req.node_id; let generation = tenant_state.generation; locked.save().await.map_err(ApiError::InternalServerError)?; @@ -232,7 +232,7 @@ async fn handle_attach_hook(mut req: Request) -> Result, Ap json_response( StatusCode::OK, AttachHookResponse { - gen: attach_req.pageserver_id.map(|_| generation), + gen: attach_req.node_id.map(|_| generation), }, ) } @@ -242,7 +242,7 @@ fn make_router(persistent_state: PersistentState) -> RouterBuilder>()) } diff --git a/test_runner/fixtures/neon_fixtures.py b/test_runner/fixtures/neon_fixtures.py index 7a3e0a9efc..81a7b0750d 100644 --- a/test_runner/fixtures/neon_fixtures.py +++ b/test_runner/fixtures/neon_fixtures.py @@ -1554,8 +1554,8 @@ class NeonAttachmentService: def attach_hook(self, tenant_id: TenantId, pageserver_id: int) -> int: response = requests.post( - f"{self.env.control_plane_api}/attach_hook", - json={"tenant_id": str(tenant_id), "pageserver_id": pageserver_id}, + f"{self.env.control_plane_api}/attach-hook", + json={"tenant_id": str(tenant_id), "node_id": pageserver_id}, ) response.raise_for_status() gen = response.json()["gen"]