From 7bf639733417e122b68e1d9dbfe23e71d23ae1b0 Mon Sep 17 00:00:00 2001 From: John Spray Date: Wed, 12 Mar 2025 10:23:41 +0000 Subject: [PATCH] pageserver: remove legacy `TimelineInfo::latest_gc_cutoff` field (1/2) (#11149) ## Problem This field was retained for backward compat only in https://github.com/neondatabase/neon/pull/10707. Once https://github.com/neondatabase/cloud/pull/25233 is released, nothing external will be reading this field. Internally, this was a mandatory field so storage controller is still trying to decode it, so we must do this removal in two steps: this PR makes the field optional, and after one release we can fully remove it. Related: https://github.com/neondatabase/cloud/issues/24250 ## Summary of changes - Rename field to `_unused` - Remove field from swagger - Make field optional --- libs/pageserver_api/src/models.rs | 7 ++++--- pageserver/src/http/openapi_spec.yml | 4 ---- pageserver/src/http/routes.rs | 5 +---- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/libs/pageserver_api/src/models.rs b/libs/pageserver_api/src/models.rs index b1ebad83b1..5e5bcf5338 100644 --- a/libs/pageserver_api/src/models.rs +++ b/libs/pageserver_api/src/models.rs @@ -1225,9 +1225,10 @@ pub struct TimelineInfo { pub last_record_lsn: Lsn, pub prev_record_lsn: Option, - /// Legacy field for compat with control plane. Synonym of `min_readable_lsn`. - /// TODO: remove once control plane no longer reads it. - pub latest_gc_cutoff_lsn: Lsn, + /// Legacy field, retained for one version to enable old storage controller to + /// decode (it was a mandatory field). + #[serde(default, rename = "latest_gc_cutoff_lsn")] + pub _unused: Lsn, /// The LSN up to which GC has advanced: older data may still exist but it is not available for clients. /// This LSN is not suitable for deciding where to create branches etc: use [`TimelineInfo::min_readable_lsn`] instead, diff --git a/pageserver/src/http/openapi_spec.yml b/pageserver/src/http/openapi_spec.yml index 0fb9a240d5..e799efcce3 100644 --- a/pageserver/src/http/openapi_spec.yml +++ b/pageserver/src/http/openapi_spec.yml @@ -1079,7 +1079,6 @@ components: - last_record_lsn - disk_consistent_lsn - state - - latest_gc_cutoff_lsn properties: timeline_id: type: string @@ -1123,9 +1122,6 @@ components: min_readable_lsn: type: string format: hex - latest_gc_cutoff_lsn: - type: string - format: hex applied_gc_cutoff_lsn: type: string format: hex diff --git a/pageserver/src/http/routes.rs b/pageserver/src/http/routes.rs index e5848bfd25..ba5fb521ff 100644 --- a/pageserver/src/http/routes.rs +++ b/pageserver/src/http/routes.rs @@ -460,10 +460,7 @@ async fn build_timeline_info_common( initdb_lsn, last_record_lsn, prev_record_lsn: Some(timeline.get_prev_record_lsn()), - // Externally, expose the lowest LSN that can be used to create a branch as the "GC cutoff", although internally - // we distinguish between the "planned" GC cutoff (PITR point) and the "latest" GC cutoff (where we - // actually trimmed data to), which can pass each other when PITR is changed. - latest_gc_cutoff_lsn: min_readable_lsn, + _unused: Default::default(), // Unused, for legacy decode only min_readable_lsn, applied_gc_cutoff_lsn: *timeline.get_applied_gc_cutoff_lsn(), current_logical_size: current_logical_size.size_dont_care_about_accuracy(),