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
This commit is contained in:
John Spray
2025-03-12 10:23:41 +00:00
committed by GitHub
parent f60ffe3021
commit 7bf6397334
3 changed files with 5 additions and 11 deletions

View File

@@ -1225,9 +1225,10 @@ pub struct TimelineInfo {
pub last_record_lsn: Lsn, pub last_record_lsn: Lsn,
pub prev_record_lsn: Option<Lsn>, pub prev_record_lsn: Option<Lsn>,
/// Legacy field for compat with control plane. Synonym of `min_readable_lsn`. /// Legacy field, retained for one version to enable old storage controller to
/// TODO: remove once control plane no longer reads it. /// decode (it was a mandatory field).
pub latest_gc_cutoff_lsn: Lsn, #[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. /// 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, /// This LSN is not suitable for deciding where to create branches etc: use [`TimelineInfo::min_readable_lsn`] instead,

View File

@@ -1079,7 +1079,6 @@ components:
- last_record_lsn - last_record_lsn
- disk_consistent_lsn - disk_consistent_lsn
- state - state
- latest_gc_cutoff_lsn
properties: properties:
timeline_id: timeline_id:
type: string type: string
@@ -1123,9 +1122,6 @@ components:
min_readable_lsn: min_readable_lsn:
type: string type: string
format: hex format: hex
latest_gc_cutoff_lsn:
type: string
format: hex
applied_gc_cutoff_lsn: applied_gc_cutoff_lsn:
type: string type: string
format: hex format: hex

View File

@@ -460,10 +460,7 @@ async fn build_timeline_info_common(
initdb_lsn, initdb_lsn,
last_record_lsn, last_record_lsn,
prev_record_lsn: Some(timeline.get_prev_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 _unused: Default::default(), // Unused, for legacy decode only
// 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,
min_readable_lsn, min_readable_lsn,
applied_gc_cutoff_lsn: *timeline.get_applied_gc_cutoff_lsn(), applied_gc_cutoff_lsn: *timeline.get_applied_gc_cutoff_lsn(),
current_logical_size: current_logical_size.size_dont_care_about_accuracy(), current_logical_size: current_logical_size.size_dont_care_about_accuracy(),