Skip to content

Commit

Permalink
Accept basebackup <tenant> <timeline> --gzip requests (#9456)
Browse files Browse the repository at this point in the history
In #9453, we want to remove the non-gzipped basebackup code in the
computes, and always request gzipped basebackups.

However, right now the pageserver's page service only accepts basebackup
requests in the following formats:

* `basebackup <tenant_id> <timeline_id>`, lsn is determined by the
pageserver as the most recent one (`timeline.get_last_record_rlsn()`)
* `basebackup <tenant_id> <timeline_id> <lsn>`
* `basebackup <tenant_id> <timeline_id> <lsn> --gzip`

We add a fourth case, `basebackup <tenant_id> <timeline_id> --gzip` to
allow gzipping the request for the latest lsn as well.
  • Loading branch information
arpad-m authored Oct 18, 2024
1 parent 62a3348 commit 71d09c7
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions pageserver/src/page_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1326,22 +1326,22 @@ where
.for_command(ComputeCommandKind::Basebackup)
.inc();

let lsn = if let Some(lsn_str) = params.get(2) {
Some(
Lsn::from_str(lsn_str)
.with_context(|| format!("Failed to parse Lsn from {lsn_str}"))?,
)
} else {
None
};

let gzip = match params.get(3) {
Some(&"--gzip") => true,
None => false,
Some(third_param) => {
return Err(QueryError::Other(anyhow::anyhow!(
"Parameter in position 3 unknown {third_param}",
)))
let (lsn, gzip) = match (params.get(2), params.get(3)) {
(None, _) => (None, false),
(Some(&"--gzip"), _) => (None, true),
(Some(lsn_str), gzip_str_opt) => {
let lsn = Lsn::from_str(lsn_str)
.with_context(|| format!("Failed to parse Lsn from {lsn_str}"))?;
let gzip = match gzip_str_opt {
Some(&"--gzip") => true,
None => false,
Some(third_param) => {
return Err(QueryError::Other(anyhow::anyhow!(
"Parameter in position 3 unknown {third_param}",
)))
}
};
(Some(lsn), gzip)
}
};

Expand Down

1 comment on commit 71d09c7

@github-actions
Copy link

Choose a reason for hiding this comment

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

5317 tests run: 5093 passed, 0 failed, 224 skipped (full report)


Flaky tests (2)

Postgres 16

Postgres 14

Code coverage* (full report)

  • functions: 31.2% (7566 of 24247 functions)
  • lines: 48.8% (59910 of 122750 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
71d09c7 at 2024-10-19T00:16:49.654Z :recycle:

Please sign in to comment.