From 271f6a6e99a46667486d7a4450abf75a6b8120c2 Mon Sep 17 00:00:00 2001 From: Arseny Sher Date: Tue, 28 Mar 2023 11:58:51 +0400 Subject: [PATCH] Always sync-safekeepers in neon_local on compute start. Instead of checking neon.safekeepers GUC value in existing pg node data dir, just always run sync-safekeepers when safekeepers are configured. Without this change, creation of new compute didn't run it. That's ok for new timeline/branch (it doesn't return anything useful anyway, and LSN is known by pageserver), but restart of compute for existing timeline bore the risk of getting basebackup not on the latest LSN, i.e. basically broken -- it might not have prev_lsn, and even if it had, walproposer would complain anyway. fixes https://github.com/neondatabase/neon/issues/2963 --- control_plane/src/compute.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/control_plane/src/compute.rs b/control_plane/src/compute.rs index ee504bfaa6..bc81107706 100644 --- a/control_plane/src/compute.rs +++ b/control_plane/src/compute.rs @@ -90,7 +90,6 @@ impl ComputeControlPlane { timeline_id, lsn, tenant_id, - uses_wal_proposer: false, pg_version, }); @@ -115,7 +114,6 @@ pub struct PostgresNode { pub timeline_id: TimelineId, pub lsn: Option, // if it's a read-only node. None for primary pub tenant_id: TenantId, - uses_wal_proposer: bool, pg_version: u32, } @@ -149,7 +147,6 @@ impl PostgresNode { let port: u16 = conf.parse_field("port", &context)?; let timeline_id: TimelineId = conf.parse_field("neon.timeline_id", &context)?; let tenant_id: TenantId = conf.parse_field("neon.tenant_id", &context)?; - let uses_wal_proposer = conf.get("neon.safekeepers").is_some(); // Read postgres version from PG_VERSION file to determine which postgres version binary to use. // If it doesn't exist, assume broken data directory and use default pg version. @@ -172,7 +169,6 @@ impl PostgresNode { timeline_id, lsn: recovery_target_lsn, tenant_id, - uses_wal_proposer, pg_version, }) } @@ -364,7 +360,7 @@ impl PostgresNode { fn load_basebackup(&self, auth_token: &Option) -> Result<()> { let backup_lsn = if let Some(lsn) = self.lsn { Some(lsn) - } else if self.uses_wal_proposer { + } else if !self.env.safekeepers.is_empty() { // LSN 0 means that it is bootstrap and we need to download just // latest data from the pageserver. That is a bit clumsy but whole bootstrap // procedure evolves quite actively right now, so let's think about it again