From 4936ab6842e30cc2196556b25fc322c9b303ee4b Mon Sep 17 00:00:00 2001 From: bojanserafimov Date: Mon, 12 Jun 2023 13:57:02 -0400 Subject: [PATCH] compute_ctl: add flag to avoid config step (#4457) Add backwards-compatible flag that cplane can use to speed up startup time --- compute_tools/src/compute.rs | 2 +- control_plane/src/endpoint.rs | 1 + libs/compute_api/src/spec.rs | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/compute_tools/src/compute.rs b/compute_tools/src/compute.rs index 617b330704..977708a18f 100644 --- a/compute_tools/src/compute.rs +++ b/compute_tools/src/compute.rs @@ -442,7 +442,7 @@ impl ComputeNode { let pg = self.start_postgres(spec.storage_auth_token.clone())?; - if spec.spec.mode == ComputeMode::Primary { + if spec.spec.mode == ComputeMode::Primary && !spec.spec.skip_pg_catalog_updates { self.apply_config(&compute_state)?; } diff --git a/control_plane/src/endpoint.rs b/control_plane/src/endpoint.rs index b28315a35d..d3131ac476 100644 --- a/control_plane/src/endpoint.rs +++ b/control_plane/src/endpoint.rs @@ -450,6 +450,7 @@ impl Endpoint { // Create spec file let spec = ComputeSpec { + skip_pg_catalog_updates: false, format_version: 1.0, operation_uuid: None, cluster: Cluster { diff --git a/libs/compute_api/src/spec.rs b/libs/compute_api/src/spec.rs index 4014774a7e..c2ad30f86f 100644 --- a/libs/compute_api/src/spec.rs +++ b/libs/compute_api/src/spec.rs @@ -27,6 +27,12 @@ pub struct ComputeSpec { pub cluster: Cluster, pub delta_operations: Option>, + /// An optinal hint that can be passed to speed up startup time if we know + /// that no pg catalog mutations (like role creation, database creation, + /// extension creation) need to be done on the actual database to start. + #[serde(default)] // Default false + pub skip_pg_catalog_updates: bool, + // Information needed to connect to the storage layer. // // `tenant_id`, `timeline_id` and `pageserver_connstring` are always needed.