mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-31 12:00:42 +00:00
Don't unarchive a timeline if its ancestor is archived (#8853)
If a timeline unarchival request comes in, give an error if the parent timeline is archived. This prevents us from the situation of having an archived timeline with children that are not archived. Follow up of #8824 Part of #8088 --------- Co-authored-by: Joonas Koivunen <joonas@neon.tech>
This commit is contained in:
@@ -94,3 +94,29 @@ def test_timeline_archive(neon_simple_env: NeonEnv):
|
||||
timeline_id=parent_timeline_id,
|
||||
state=TimelineArchivalState.ARCHIVED,
|
||||
)
|
||||
|
||||
# Test that the leaf can't be unarchived
|
||||
with pytest.raises(
|
||||
PageserverApiException,
|
||||
match="ancestor is archived",
|
||||
) as exc:
|
||||
assert timeline_path.exists()
|
||||
|
||||
ps_http.timeline_archival_config(
|
||||
tenant_id=env.initial_tenant,
|
||||
timeline_id=leaf_timeline_id,
|
||||
state=TimelineArchivalState.UNARCHIVED,
|
||||
)
|
||||
|
||||
# Unarchive works for the leaf if the parent gets unarchived first
|
||||
ps_http.timeline_archival_config(
|
||||
tenant_id=env.initial_tenant,
|
||||
timeline_id=parent_timeline_id,
|
||||
state=TimelineArchivalState.UNARCHIVED,
|
||||
)
|
||||
|
||||
ps_http.timeline_archival_config(
|
||||
tenant_id=env.initial_tenant,
|
||||
timeline_id=leaf_timeline_id,
|
||||
state=TimelineArchivalState.UNARCHIVED,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user