From 04013929cb0a50a7fd70a7b1a82c59128a207f9f Mon Sep 17 00:00:00 2001 From: Erik Grinaker Date: Wed, 18 Jun 2025 08:48:39 +0200 Subject: [PATCH] pageserver: support full gRPC basebackups (#12269) ## Problem Full basebackups are used in tests, and may be useful for debugging as well, so we should support them in the gRPC API. Touches #11728. ## Summary of changes Add `GetBaseBackupRequest::full` to generate full base backups. The libpq implementation also allows specifying `prev_lsn` for full backups, i.e. the end LSN of the previous WAL record. This is omitted in the gRPC API, since it's not used by any tests, and presumably of limited value since it's autodetected. We can add it later if we find that we need it. --- pageserver/page_api/proto/page_service.proto | 2 ++ pageserver/page_api/src/model.rs | 4 ++++ pageserver/src/page_service.rs | 5 +---- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pageserver/page_api/proto/page_service.proto b/pageserver/page_api/proto/page_service.proto index 7d01dec4ab..81953a710f 100644 --- a/pageserver/page_api/proto/page_service.proto +++ b/pageserver/page_api/proto/page_service.proto @@ -108,6 +108,8 @@ message GetBaseBackupRequest { uint64 lsn = 1; // If true, logical replication slots will not be created. bool replica = 2; + // If true, include relation files in the base backup. Mainly for debugging and tests. + bool full = 3; } // Base backup response chunk, returned as an ordered stream. diff --git a/pageserver/page_api/src/model.rs b/pageserver/page_api/src/model.rs index a01bba0572..ef7f89473f 100644 --- a/pageserver/page_api/src/model.rs +++ b/pageserver/page_api/src/model.rs @@ -189,6 +189,8 @@ pub struct GetBaseBackupRequest { pub lsn: Option, /// If true, logical replication slots will not be created. pub replica: bool, + /// If true, include relation files in the base backup. Mainly for debugging and tests. + pub full: bool, } impl From for GetBaseBackupRequest { @@ -196,6 +198,7 @@ impl From for GetBaseBackupRequest { Self { lsn: (pb.lsn != 0).then_some(Lsn(pb.lsn)), replica: pb.replica, + full: pb.full, } } } @@ -205,6 +208,7 @@ impl From for proto::GetBaseBackupRequest { Self { lsn: request.lsn.unwrap_or_default().0, replica: request.replica, + full: request.full, } } } diff --git a/pageserver/src/page_service.rs b/pageserver/src/page_service.rs index 79c4c0faa9..ff435451c3 100644 --- a/pageserver/src/page_service.rs +++ b/pageserver/src/page_service.rs @@ -3572,9 +3572,6 @@ impl proto::PageService for GrpcPageServiceHandler { } // Spawn a task to run the basebackup. - // - // TODO: do we need to support full base backups, for debugging? This also requires passing - // the prev_lsn parameter. let span = Span::current(); let (mut simplex_read, mut simplex_write) = tokio::io::simplex(CHUNK_SIZE); let jh = tokio::spawn(async move { @@ -3583,7 +3580,7 @@ impl proto::PageService for GrpcPageServiceHandler { &timeline, req.lsn, None, - false, + req.full, req.replica, &ctx, )