From f4b38d5975297c4caa6d7c5a875d74bce3bdcfcf Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Sun, 20 Jul 2025 22:38:07 +0000 Subject: [PATCH] expand comment on why we normalize_lsn --- pageserver/src/tenant/timeline.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pageserver/src/tenant/timeline.rs b/pageserver/src/tenant/timeline.rs index ae062ca326..7afbd14c10 100644 --- a/pageserver/src/tenant/timeline.rs +++ b/pageserver/src/tenant/timeline.rs @@ -1798,8 +1798,14 @@ impl Timeline { _ctx: &RequestContext, ) -> anyhow::Result { let lease = { - // Normalize the requested LSN to be aligned, and move to the first record - // if it points to the beginning of the page (header). + // Static (=fixed-lsn) computes request basebackup @ X + // but pageserver returns basebackup @ normalize_lsn(X). + // Once the postgres process is started, it will therefore + // request pages@normalize_lsn(X). + // But compute_ctl, which isn't aware that the requested + // basebackup lsn != the returned basebackup LSN, will + // call this API with X. + // So, normalize_lsn(X) here as well. let lsn = xlog_utils::normalize_lsn(lsn, WAL_SEGMENT_SIZE); let mut gc_info = self.gc_info.write().unwrap();