aetherlight: indexed counts the open-log walk, not only the entries it returns
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c901d8b96a
commit
08d0c26fd8
1 changed files with 13 additions and 0 deletions
|
|
@ -266,6 +266,9 @@ impl<K: Ord + Clone, V: Clone + PartialEq, P: Projection<V>> Docs<K, V, P> {
|
|||
.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] {
|
||||
|
|
|
|||
Loading…
Reference in a new issue