From 168a6a87d705cfe17d9a76fda420d7107bb5d43f Mon Sep 17 00:00:00 2001 From: Anastasia Lubennikova Date: Fri, 13 Sep 2024 03:31:54 +0100 Subject: [PATCH] Fix wal-redo unwrap() failure for timeline chains that have 0 records in some timeline --- pageserver/src/tenant/timeline.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pageserver/src/tenant/timeline.rs b/pageserver/src/tenant/timeline.rs index 6809cb1da4..6806f0ac9f 100644 --- a/pageserver/src/tenant/timeline.rs +++ b/pageserver/src/tenant/timeline.rs @@ -5206,10 +5206,18 @@ impl Timeline { .cloned() .collect::>(); records = &records[scratch.len()..]; + if later.is_none() { assert!(records.is_empty()); } + // if we don't have any records for this timeline (which is possible) + // go to the previous one + if scratch.is_empty() { + tracing::info!("no records for timeline {}", older.timeline_id); + continue; + } + // this is only used for logging on the next round let last_lsn = scratch.last().unwrap().0;