From 91984d3625bc3334be811cd32f1628761ac4827b Mon Sep 17 00:00:00 2001 From: Daan Meijer Date: Mon, 26 Oct 2026 13:45:08 +0100 Subject: [PATCH] edge-bench --group: a range after a gap starts its batch at the range a.b.storage's stored 2016 ranges are not contiguous (its 2016 window lies in two article regions); the batch after a gap kept the previous range's end as its start and the harness found no leased range for it. Co-Authored-By: Claude Fable 5.1 --- edge/src/indexer.rs | 9 +++++++++ edge/src/main.rs | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/edge/src/indexer.rs b/edge/src/indexer.rs index c4ba7bd..53073f8 100644 --- a/edge/src/indexer.rs +++ b/edge/src/indexer.rs @@ -937,6 +937,15 @@ impl RangeIndexer { self.batch.next = self.end + 1; } + /// The next range of a group starts after a gap (edge-bench --group, the corpus holding some ranges only): a fresh + /// batch starts there, not at the previous range's end; the window carries on. Nothing when the batch has anything. + pub fn skip_to(&mut self, article: i64) { + if self.batch.headers == 0 && self.batch.releases.is_empty() && self.batch.candidates.is_empty() && self.batch.from < article { + self.batch.from = article; + self.batch.next = article; + } + } + /// Files in the releases finished since the last take (RangeIndexer.pending). pub fn pending(&self) -> usize { self.pending_files diff --git a/edge/src/main.rs b/edge/src/main.rs index 80df678..468579f 100644 --- a/edge/src/main.rs +++ b/edge/src/main.rs @@ -292,6 +292,10 @@ fn main() { for (ri, range) in ranges.iter().enumerate() { let range_wall = Instant::now(); let headers_before = out.0; + // After a gap between stored ranges the batch starts at this range (every range ends with a batch taken). + if ri > 0 { + indexer.skip_to(range.start); + } let mut files: Vec = std::fs::read_dir(&range.dir).unwrap().map(|e| e.unwrap().file_name().into_string().unwrap()).filter(|f| f.ends_with(".gz")).collect(); files.sort(); for (i, file) in files.iter().enumerate() {