From b85b6a3c4165f5dc3beb33507619fca869a4bb1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arpad=20M=C3=BCller?= Date: Thu, 12 Dec 2024 23:43:59 +0100 Subject: [PATCH 1/2] Add scheduling_policy column to safekeepers table --- .../2024-12-12-212515_safekeepers_scheduling_policy/down.sql | 1 + .../2024-12-12-212515_safekeepers_scheduling_policy/up.sql | 1 + storage_controller/src/schema.rs | 1 + 3 files changed, 3 insertions(+) create mode 100644 storage_controller/migrations/2024-12-12-212515_safekeepers_scheduling_policy/down.sql create mode 100644 storage_controller/migrations/2024-12-12-212515_safekeepers_scheduling_policy/up.sql diff --git a/storage_controller/migrations/2024-12-12-212515_safekeepers_scheduling_policy/down.sql b/storage_controller/migrations/2024-12-12-212515_safekeepers_scheduling_policy/down.sql new file mode 100644 index 000000000000..e26bff798f94 --- /dev/null +++ b/storage_controller/migrations/2024-12-12-212515_safekeepers_scheduling_policy/down.sql @@ -0,0 +1 @@ +ALTER TABLE safekeepers DROP scheduling_policy; diff --git a/storage_controller/migrations/2024-12-12-212515_safekeepers_scheduling_policy/up.sql b/storage_controller/migrations/2024-12-12-212515_safekeepers_scheduling_policy/up.sql new file mode 100644 index 000000000000..9a4606a999ea --- /dev/null +++ b/storage_controller/migrations/2024-12-12-212515_safekeepers_scheduling_policy/up.sql @@ -0,0 +1 @@ +ALTER TABLE safekeepers ADD scheduling_policy VARCHAR; diff --git a/storage_controller/src/schema.rs b/storage_controller/src/schema.rs index 9e005ab9326c..044f1a1dcc90 100644 --- a/storage_controller/src/schema.rs +++ b/storage_controller/src/schema.rs @@ -39,6 +39,7 @@ diesel::table! { active -> Bool, http_port -> Int4, availability_zone_id -> Text, + scheduling_policy -> Nullable, } } From f0a3d9326c23b3c6650d2b26c3b6fbf97546819c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arpad=20M=C3=BCller?= Date: Thu, 19 Dec 2024 15:23:47 +0100 Subject: [PATCH 2/2] Add it to the structs --- libs/pageserver_api/src/controller_api.rs | 1 + storage_controller/src/persistence.rs | 2 ++ test_runner/regress/test_storage_controller.py | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/pageserver_api/src/controller_api.rs b/libs/pageserver_api/src/controller_api.rs index faf11e487c55..f9dccd5139cc 100644 --- a/libs/pageserver_api/src/controller_api.rs +++ b/libs/pageserver_api/src/controller_api.rs @@ -387,6 +387,7 @@ pub struct SafekeeperDescribeResponse { pub port: i32, pub http_port: i32, pub availability_zone_id: String, + pub scheduling_policy: Option, } #[cfg(test)] diff --git a/storage_controller/src/persistence.rs b/storage_controller/src/persistence.rs index cc377e606ee8..e798af7908f5 100644 --- a/storage_controller/src/persistence.rs +++ b/storage_controller/src/persistence.rs @@ -1227,6 +1227,7 @@ pub(crate) struct SafekeeperPersistence { pub(crate) active: bool, pub(crate) http_port: i32, pub(crate) availability_zone_id: String, + pub(crate) scheduling_policy: Option, } impl SafekeeperPersistence { @@ -1252,6 +1253,7 @@ impl SafekeeperPersistence { port: self.port, http_port: self.http_port, availability_zone_id: self.availability_zone_id.clone(), + scheduling_policy: self.scheduling_policy.clone(), } } } diff --git a/test_runner/regress/test_storage_controller.py b/test_runner/regress/test_storage_controller.py index 7062c35e05ab..02b4c6bf580b 100644 --- a/test_runner/regress/test_storage_controller.py +++ b/test_runner/regress/test_storage_controller.py @@ -3009,7 +3009,7 @@ def test_safekeeper_deployment_time_update(neon_env_builder: NeonEnvBuilder): def eq_safekeeper_records(a: dict[str, Any], b: dict[str, Any]) -> bool: compared = [dict(a), dict(b)] - masked_keys = ["created_at", "updated_at", "active"] + masked_keys = ["created_at", "updated_at", "active", "scheduling_policy"] for d in compared: # keep deleting these in case we are comparing the body as it will be uploaded by real scripts