Skip to content

Commit

Permalink
fix(pageserver): is_archived should be optional (#8902)
Browse files Browse the repository at this point in the history
Set the field to optional, otherwise there will be decode errors when
newer version of the storage controller receives the JSON from older
version of the pageservers.

Signed-off-by: Alex Chi Z <[email protected]>
  • Loading branch information
skyzh authored Sep 3, 2024
1 parent 1a874a3 commit 3d9001d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion libs/pageserver_api/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -716,12 +716,17 @@ pub struct TimelineInfo {
pub pg_version: u32,

pub state: TimelineState,
pub is_archived: bool,

pub walreceiver_status: String,

// ALWAYS add new fields at the end of the struct with `Option` to ensure forward/backward compatibility.
// Backward compatibility: you will get a JSON not containing the newly-added field.
// Forward compatibility: a previous version of the pageserver will receive a JSON. serde::Deserialize does
// not deny unknown fields by default so it's safe to set the field to some value, though it won't be
// read.
/// The last aux file policy being used on this timeline
pub last_aux_file_policy: Option<AuxFilePolicy>,
pub is_archived: Option<bool>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
Expand Down
2 changes: 1 addition & 1 deletion pageserver/src/http/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ async fn build_timeline_info_common(
pg_version: timeline.pg_version,

state,
is_archived,
is_archived: Some(is_archived),

walreceiver_status,

Expand Down

1 comment on commit 3d9001d

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3903 tests run: 3787 passed, 0 failed, 116 skipped (full report)


Flaky tests (2)

Postgres 16

Postgres 15

Code coverage* (full report)

  • functions: 32.5% (7427 of 22880 functions)
  • lines: 50.6% (60176 of 118977 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
3d9001d at 2024-09-03T20:10:34.582Z :recycle:

Please sign in to comment.