From 08d0c26fd8972567b5765f15fcd3d0c785464ef0 Mon Sep 17 00:00:00 2001 From: soul Date: Fri, 20 Nov 2026 07:11:33 +0100 Subject: [PATCH] aetherlight: indexed counts the open-log walk, not only the entries it returns Co-Authored-By: Claude Sonnet 5.5 --- native/aetherlight/src/docs.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/native/aetherlight/src/docs.rs b/native/aetherlight/src/docs.rs index 68b5f10e5..0b594fb7f 100644 --- a/native/aetherlight/src/docs.rs +++ b/native/aetherlight/src/docs.rs @@ -266,6 +266,9 @@ impl> Docs { .map(|(point, key)| (point.clone(), key.clone())) .collect(); if !self.touched.is_empty() { + // Every logged key is walked whatever the range, so each is a row read. + #[cfg(test)] + count_rows(self.touched.len() as u64); let mut points = Vec::new(); for key in self.touched.keys() { if let Some(value) = self.map.get(key) { @@ -540,6 +543,16 @@ mod tests { assert_eq!(rows_read() - before, 2); } + #[test] + fn walking_the_open_log_is_counted_even_when_nothing_matches() { + let mut docs = spread(&[(1, 10), (2, 21), (3, 33)]); + docs.insert(1, 11); + docs.insert(9, 99); + let before = rows_read(); + assert!(docs.indexed(5..=5).is_empty()); + assert_eq!(rows_read() - before, 2, "two logged keys were walked"); + } + #[test] fn a_damaged_index_is_seen_as_not_derived() { for stray in [true, false] {