From cbf442292b44decf7ab7fff77658d81c51b2c93f Mon Sep 17 00:00:00 2001 From: Vlad Lazar Date: Mon, 21 Apr 2025 18:45:16 +0100 Subject: [PATCH] pageserver: handle empty get vectored queries (#11652) ## Problem If all batched requests are excluded from the query by `Timeine::get_rel_page_at_lsn_batched` (e.g. because they are past the end of the relation), the read path would panic since it doesn't expect empty queries. This is a change in behaviour that was introduced with the scattered query implementation. ## Summary of Changes Handle empty queries explicitly. --- pageserver/src/tenant/timeline.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pageserver/src/tenant/timeline.rs b/pageserver/src/tenant/timeline.rs index 5b126d516b..cfeab77598 100644 --- a/pageserver/src/tenant/timeline.rs +++ b/pageserver/src/tenant/timeline.rs @@ -1285,6 +1285,10 @@ impl Timeline { reconstruct_state: &mut ValuesReconstructState, ctx: &RequestContext, ) -> Result>, GetVectoredError> { + if query.is_empty() { + return Ok(BTreeMap::default()); + } + let read_path = if self.conf.enable_read_path_debugging || ctx.read_path_debug() { Some(ReadPath::new( query.total_keyspace(),