Skip to content

Commit

Permalink
Forbid creation of child timelines of archived timeline (#9122)
Browse files Browse the repository at this point in the history
We don't want to allow any new child timelines of archived timelines. If
you want any new child timelines, you should first un-archive the
timeline.
 
Part of #8088
  • Loading branch information
arpad-m committed Sep 26, 2024
1 parent 7e560dd commit 7bae781
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pageserver/src/http/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,10 @@ async fn timeline_create_handler(
StatusCode::SERVICE_UNAVAILABLE,
HttpErrorBody::from_msg(e.to_string()),
),
Err(e @ tenant::CreateTimelineError::AncestorArchived) => json_response(
StatusCode::NOT_ACCEPTABLE,
HttpErrorBody::from_msg(e.to_string()),
),
Err(tenant::CreateTimelineError::ShuttingDown) => json_response(
StatusCode::SERVICE_UNAVAILABLE,
HttpErrorBody::from_msg("tenant shutting down".to_string()),
Expand Down
7 changes: 7 additions & 0 deletions pageserver/src/tenant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,8 @@ pub enum CreateTimelineError {
AncestorLsn(anyhow::Error),
#[error("ancestor timeline is not active")]
AncestorNotActive,
#[error("ancestor timeline is archived")]
AncestorArchived,
#[error("tenant shutting down")]
ShuttingDown,
#[error(transparent)]
Expand Down Expand Up @@ -1698,6 +1700,11 @@ impl Tenant {
return Err(CreateTimelineError::AncestorNotActive);
}

if ancestor_timeline.is_archived() == Some(true) {
info!("tried to branch archived timeline");
return Err(CreateTimelineError::AncestorArchived);
}

if let Some(lsn) = ancestor_start_lsn.as_mut() {
*lsn = lsn.align();

Expand Down

1 comment on commit 7bae781

@github-actions
Copy link

@github-actions github-actions bot commented on 7bae781 Sep 26, 2024

Choose a reason for hiding this comment

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

5153 tests run: 4978 passed, 1 failed, 174 skipped (full report)


Failures on Postgres 16

  • test_basebackup_with_high_slru_count[github-actions-selfhosted-10-13-30]: release-x86-64
# Run all failed tests locally:
scripts/pytest -vv -n $(nproc) -k "test_basebackup_with_high_slru_count[release-pg16-github-actions-selfhosted-10-13-30]"
Flaky tests (11)

Postgres 17

Postgres 16

Postgres 15

Postgres 14

Code coverage* (full report)

  • functions: 32.0% (7491 of 23396 functions)
  • lines: 50.0% (60484 of 120865 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
7bae781 at 2024-09-26T10:57:04.380Z :recycle:

Please sign in to comment.