Skip to content

feat(precompute): merge late samples into committed windows within retention - #892

Draft
zzylol wants to merge 19 commits into
feat/idle-wall-clock-closefrom
feat/late-merge-committed-windows
Draft

zzylol wants to merge 19 commits into
feat/idle-wall-clock-closefrom
feat/late-merge-committed-windows

Conversation

@zzylol

@zzylol zzylol commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Problem: a sample (raw path or push) that arrives after its window was committed is dropped and counted. With feat(precompute): close an idle stream's last windows by wall-clock time #889's idle close, a producer that pauses longer than L + G and then resumes has the windows of its pause closed from part of their samples, and the rest are dropped: those windows are lost for good.
    • Example (ingest_shards.rs::samples_after_a_pause_merge_into_the_window_closed_by_wall_clock): lateness 0, samples through 35 s, then a pause until the clock reads 50 s. The idle watermark (49 s) closes (30, 40] with 31..=35 s only. The producer resumes with 36..=60 s: today the 64 × 5 samples at 36..=40 s are dropped and sum_over_time(data[30s]) at 40 s stays short.
  • Change: late merge into committed windows (design rule in docs(design): repository layout and engine boundaries #874 Ingestion rules / decision 5, and docs(design): plan sub-DAGs precomputed in the collector (v1: leaf sketch views) #885 §6 for collector states).
    • Windows still close by the watermark (or by wall clock) and are queryable at once.
    • A late sample whose closed window is still within retention is merged into that window. Late samples are batched per window by the ingest coordinator, once per pass, and applied by the precompute committer: no store rewrite per sample.
    • The committer runs the window's views over the late samples alone and merges the resulting rows into the committed window: rows with equal plain columns merge their states with each kernel's merge_with; other rows are added. The change is then merged into the committed windows of the groups that read those views (wider chain levels), transitively.
    • The window is replaced in the view store and in its file, and cached query results that read it become stale.
    • Beyond retention, the sample is dropped and counted (samples_dropped_late, as before).
  • Effect: in the example, the answers at 40, 50 and 60 s equal the answers of a stream that never paused. samples_merged_late counts 320 and samples_dropped_late 0.

Follow-ups (2026-11-30, approved), at 3b3eaac

  • Raw samples kept for recompute are compressed (storage::xor_chunk, RawData::compress_through).
    • Format: Prometheus-style XOR (Gorilla) chunks, with delta-of-delta timestamps and XOR'd value bits. It is lossless on any bit pattern.
    • What is compressed: a metric's closed panes behind every window still to close that only windows computed again read. Each such pane becomes one chunk per series (CompressedPane).
    • Reads decode those panes on the fly. A late sample in a compressed pane turns it back into columnar data.
    • The routing carries two cutoffs: compress through the first, evict through the second.
    • No workspace or crate encoder applied: the only Gorilla codec in the repository is on the unmerged land/sample-block-codec branch, in the old layout. The encoder here (~200 lines) uses that codec's bit layout.
  • Narrow levels are kept as long as the levels recomputed from them reach back. A group read by a recomputed chain keeps its windows for its readers' retention plus their width. An order-sensitive group's late-sample floor also takes its readers' floors.
    • So a late counter sample within the widest level's retention always recomputes every level.
    • The "a reader keeps its old rows when its run fails" path is removed.
  • Tests, written first:
    • window_levels.rs::a_late_counter_sample_reaches_the_wide_level_past_the_narrow_retention: a sample at 3 495 s with the newest window at 7 200 s is past the narrow level's own floor (3 540 s) but inside the 15 min window (2 700, 3 600]. The 1 h increase at 6 300 s equals on-time arrival. Before the change it failed with samples_dropped_late: 1 and a 1 011 difference.
    • store.rs::compressed_panes_read_as_the_columnar_ones: compressed panes read row for row as the columnar ones and take fewer bytes, and a late sample of a compressed pane joins it in time order. This is the "recompute from chunks equals recompute from rows" check at the read level.
    • ingest_shards.rs::a_late_counter_sample_recomputes_its_window_from_the_raw_samples now recomputes from compressed panes.
    • xor_chunk.rs::chunks_read_back_exactly: NaN payloads, ±0, ±∞, jitter, backwards timestamps and extreme times all read back exactly.

Memory and ingest CPU

ingest_bench, release build, in process, views in memory. Each binary was built in its own target directory.

Run #889 e6c41e3 #892 8f5588f (raw kept as rows) #892 3b3eaac (raw kept as XOR chunks)
Dashboard plan, 1 h rate/increase, 10k series × 1/s, 3 600 s unpaced: asap_raw_data_bytes 22 MB (no recompute) 2 246 MB 432 MB (5.2×)
Same run, max RSS 1 748 MB 3 451 MB 2 215 MB
W1 shape (collector e2e: 5 queries incl. rate(data_total[1m]), 10k series × 10/s), paced 180 s: asap_raw_data_bytes 148 MB 1 070 MB 236 MB
W1 max RSS 999 MB 1 273 MB 1 007 MB
W1 data-plane CPU, all threads less the bench's sender 56 s / 180 s = 0.31 cores 55.6 s = 0.31 cores 69 s = 0.38 cores
W1 ingest-shard threads CPU 25.2 s 24.5 s 35.8 s (compression runs on the shards)
  • Compression costs about 0.07 cores at 100k counter samples/s, roughly 0.6 µs per sample, encoded once per pane.
  • The e2e's rise comes from outside this change set. Wrong: see "Why e2e ingest CPU on W1 rose" below (push mode lost for W1's group, and pane rebuilds on out-of-order OTLP requests).
  • Both next steps (multi-pane chunks, encoding off the shard thread) are done in the follow-ups below.

Ingest CPU follow-ups (2026-11-30)

Pure efficiency: no answer changes. Commits on top of 3b3eaac:

Commit What
perf(storage): raw data keeps running sample and byte totals … RawData keeps its sample and byte totals, updated on append, compaction, compression, decompression and eviction. The coordinator no longer walks every pane per pass for the raw-data gauges.
perf(storage): sealing and compressing visit only the panes not done yet Each metric remembers how far it is sealed, plus the sealed panes a late sample changed. Compressing returns at once when no columnar pane is at or before its cutoff.
perf(storage): appended samples grouped by the interned metric; ahash for chunk building The interner keeps one name per metric (Series::metric_key), so RawData::append and the routing compare metrics by pointer. Chunk::new uses ahash instead of SipHash.
perf(storage): counter raw kept for recompute compressed in multi-pane blocks, off the ingest shards A compressed block covers consecutive closed panes with at least 120 samples per series, one XOR chunk per series. A late sample inside a block's span turns its panes back into columnar data. Encoding runs on one raw-compress thread: a shard's maintenance takes the panes, and the shard installs each block at its next maintenance, unless a late sample changed those panes in the meantime.
test(storage): out-of-order requests … (failing first) + perf(storage): a request older than its pane's newest sample adds a chunk … Before: each request older than its pane's newest sample rebuilt the whole pane (collect, sort, Chunk::new over every row so far). Now it adds its own chunk and marks the pane unsorted. The first read of the pane merges its chunks in time order (equal times in arrival order, as before) and keeps the merged chunk. Sealing then compacts the pane.

asap_raw_data_bytes no longer counts the series identity column that a read builds lazily on a chunk. That column is a read cache, and leaving it out lets the total stay exact.

Tests: running_totals_equal_a_walk_over_the_panes, multi_pane_blocks_read_as_the_columnar_ones (late samples in a block's first, middle and last pane and on a block boundary, compressing again, a late sample while a block is being encoded, evicting part of a block), out_of_order_requests_read_as_one_sorted_pane (reads give the rows of one sorted pane, in the same order), and series_of_one_metric_share_its_name. The storage, precompute, ingest_shards, window_levels, push_precompute, server and ingest_protocols tests pass. One parity test, push_precompute_answers_what_the_planner_executor_answers, fails with EMFILE (Too many open files) under a 1024 open-files limit. It fails the same way on 3b3eaac, so this change did not cause it.

Measured (ingest_bench, in process, release; each binary built in its own target directory; one 56-core host; 3 runs at once on disjoint cores; median of 3)

W1 shape: the collector e2e's 5 queries, including rate(data_total[1m]). 10k series × 10/s for each of 2 metrics, paced, 200 s, lateness 2 s, 2 ingest shards and 2 precompute threads, views in memory. CPU is in seconds over the 200 s run.

Head Ingest shards Coordinator raw-compress Precompute workers All data-plane threads asap_raw_data_bytes Max RSS
3b3eaac (before) 23.8 2.56 – 33.6 60.5 129 MB 938 MB
+ running totals 23.4 0.11 – 33.2 59.7 129 MB 940 MB
+ incremental seal/compress 22.8 0.12 – 33.0 56.9 129 MB 945 MB
+ interned grouping, ahash 17.9 0.13 – 33.0 51.1 129 MB 946 MB
+ multi-pane blocks off-thread 11.1 0.12 5.4 33.6 51.2 136 MB 991 MB
+ out-of-order requests add chunks 11.1 0.12 5.8 37.0 † 54.6 136 MB 991 MB

† This row ran while another benchmark used the host's other cores, so its precompute times are not comparable. The in-process feeder sends requests in order, so the last commit changes nothing here. Over OTLP (below) it is the one that matters.

"All data-plane threads" is the run total minus the bench's own sender thread.

W1 shape over OTLP/HTTP: the paced feeder, 2 metrics × 10k series × 10/s, 4 requests in flight per metric, as the e2e feeds it. Data plane at the restacked #891, CPU over 100 s of steady state:

Ingest shards raw-compress Precompute OTLP threads Per sample, end to end
fixes 1–4 0.248 cores 0.092 0.113 0.083 2.74 µs
+ out-of-order requests add chunks 0.066 cores 0.096 0.138 0.074 1.92 µs

Dashboard shape: 1 h rate/increase and the lat gauge, 10k series × 1/s per metric.

Run Head asap_raw_data_bytes at the end Max RSS Ingest shards raw-compress
3 600 s of data, unpaced 3b3eaac 497 MB 2.82 GB 32.5 s –
final 285 MB 4.79 GB ‡ 15.9 s 13.4 s
600 s, paced 3b3eaac 90 MB 415 MB 7.4 s –
per-pane, inline (fixes 1–3) 90 MB 418 MB 5.8 s –
final 121 MB § 469 MB 3.7 s 1.6 s

‡ Unpaced, ingest runs at 2–4 M samples/s, faster than the single raw-compress thread encodes (about 3 M samples/s of CPU). Panes therefore wait columnar until the thread catches up. Before, the shards encoded inline, which throttled ingest instead (3 716 vs 691 Remote Write 503 retries; every write acknowledged after 32.7 s vs 19.0 s). At live rates (100k samples/s) the thread keeps up.

§ At 1 sample/s, a block needs 8 panes (2 min) to reach 120 samples per series, so up to 8 counter panes wait columnar. With 10 min of data that wait outweighs the saving. With 1 h kept, the saving wins: 497 → 285 MB, −43 %.

Why e2e ingest CPU on W1 rose from 0.19–0.20 to 0.59–0.61 cores (b8a6b34 → #891), and the in-process bench rose only ~0.06

This corrects the earlier note above ("comes from outside this change set"). There are two causes, and both come from this PR.

  1. W1's one refresh group left push mode. data_plane defaults to --precompute-mode push. 712272c excludes from push any group that recomputes from raw samples (!precompute.recomputes(g) in InstalledPrecompute::start). W1 plans all 5 views into one 5 s group (views="1,6,10,15,20"), and that group includes the order-sensitive rate(data_total[1m]). So the whole group falls back to window mode: raw samples are kept, and every window is a per-window ingestion run.
  2. Over OTLP, requests arrive out of time order, and each such request rebuilt its whole pane. With raw kept, RawData::append re-sorted and re-chunked the open pane for every request older than the pane's newest sample. The collector exporter and the feeder keep several requests in flight, so this is the common case. The in-process bench sends requests in order and never hit it.
    • Profiled over OTLP, the ingest shards were 0.25 cores, 22 % in Chunk::new and 8.5 % in the row collect.
    • The "out-of-order requests add chunks" commit removes the rebuild: shards 0.248 → 0.066 cores.

The OTLP decode path is not the cause. The OTLP adapter is identical between b8a6b34 and #891, and the e2e otlp_decode phase was 11.0 s at b8a6b34 and 11.1 s at #891.

Expected e2e effect on W1 now: ingest shards about 0.07 cores, plus raw-compress about 0.1 and per-window precompute about 0.14. That is still above b8a6b34's push mode. The remaining gap is cause 1.

Resolved in Follow-ups 2: the backend splits the group's execution, and the planner is unchanged.

Follow-ups 2 (2026-11-30, approved): push kept beside recompute, bounded compression queue

Commit What
test(precompute): order-sensitive views leave the rest of their group pushed (failing first) + feat(precompute): a refresh group's order-sensitive views run apart, so the rest stays pushed Ingestion::new now splits a refresh group that mixes order-sensitive views (counter / irate state) with other views into two groups with the same window. The order-sensitive part takes the window path, keeps its raw samples and is recomputed on late data. The other part is pushed when it qualifies. Whichever part the other reads goes first. A group whose two parts read each other stays whole. The planner is unchanged; this is execution only.
perf(precompute): the raw-compress queue is bounded; past it, shards encode their panes themselves A metric can now have several compression batches in flight, and a take gets only panes newer than all of them. The shards count the samples queued for the raw-compress thread. Past 4 M samples (about 64 MiB columnar), a shard encodes its batch itself. That is backpressure on ingest instead of memory growth.

Tests:

  • push_precompute.rs::order_sensitive_views_leave_the_rest_of_their_group_pushed. It plans sum_over_time(data[30s]) and rate(data_total[30s]) into one group. In push mode it checks that push runs happen and that every answer equals the window path's, late samples included. Before the change it failed: no push runs.
  • store.rs::batches_in_flight_install_in_any_order.
  • At c6401d9, with ulimit -n 65536: push_precompute 17, ingest_shards 17, window_levels 4, server 10, result_cache 6, view_persistence 8, ingest_protocols 6, planner_executor_parity 6 pass.

W1 over OTLP: b8a6b34 vs now

Paced feeder, 2 metrics × 10k series × 10/s, 4 requests in flight per metric, straight to data_plane (push mode, the default) with the e2e's flags: lateness 2 s, 2/2/2 threads, no view persistence. CPU is over 100 s of steady state, median of 3, alternating core sets.

Head Per sample, end to end Ingest shards OTLP threads Ingest + decode raw-compress Precompute workers
b8a6b34 (e2e baseline) 1.17 µs 0.147 cores 0.080 0.22 – –
#892 before this round (0867ce6, window mode for W1) 1.92 µs 0.066 0.074 0.14 0.096 0.138
#892 now 1.64 µs 0.166 0.074 0.24 0.044 0.031
  • Ingest + decode, the e2e's measure, is back near b8a6b34's: 0.24 vs 0.22 cores. The e2e measured 0.59–0.61 at the old Collector views: control plane rule and collector-views file, data plane --collector-views #891.
  • The remaining +0.47 µs/sample end to end is what late-merge correctness costs:
    • The counter's raw samples are kept and compressed: 0.044 cores.
    • Its 5 s rate windows run on the window path: 0.031 cores.
    • A little more shard work.
  • The gauge's raw samples are no longer kept. In process, W1 raw bytes went from 136 to 89 MB.

Dashboard shape: compression backpressure

1 h rate/increase and the lat gauge, 10k series × 1/s per metric, in-process bench.

Run Head Max RSS asap_raw_data_bytes at the end Ingest shards raw-compress Precompute Every write acknowledged after
3 600 s unpaced 3b3eaac 2.82 GB 497 MB 32.5 s – 60.1 s 32.7 s
0867ce6 (no bound), 3 runs 4.79–4.89 GB 285–478 MB 11.9–15.9 s 9.8–13.4 s 52.8–62.2 s 11.9–19.0 s
now, 2 runs 2.87–2.90 GB 173–241 MB 12.3–12.4 s 5.1 s 48.3–48.5 s 29.1–30.1 s
600 s paced 3b3eaac 415 MB 90 MB 7.4 s – 9.6 s –
0867ce6, 2 runs 463–469 MB 121 MB 3.7 s 1.5–1.6 s 8.9–9.7 s –
now 423 MB 73 MB 3.6 s 0.8 s 8.6 s –
  • Unpaced, the bound brings max RSS back to the original's (2.9 vs 2.8 GB). Ingest then runs at about the original's rate (30 vs 33 s), because the shards encode whatever the thread cannot take, and the CPU stays below the original's.
  • Paced, raw bytes drop below the original's (73 vs 90 MB) and RSS is within 2 %. The split also keeps the lat gauge's raw samples only as long as its own windows need them.
  • The bound runs used 139e38ef. The pushed head 5da5b6c differs only by counting the queue with fetch_add/fetch_sub instead of fetch_update, which newer toolchains deprecate.

Routing wait (approved follow-up 3)

ingest_bench 10000 600 raw, #889 e6c41e3 vs #892 3b3eaac, alternating:

  • 1 shard, 5 rounds: every write acknowledged in 0.82–0.89 s vs 0.81–0.89 s; every window refreshed in 1.85–1.93 s vs 1.78–1.88 s.
  • 8 shards, 8 requests per scrape, 3 rounds: acknowledged 0.95–1.03 s vs 0.91–0.95 s; refreshed 1.72–1.78 s vs 1.74–1.75 s.

No measurable cost, so no optimization is proposed. A paced 120 s run had no precompute backlog on either. (An earlier comparison mistakenly ran #889's code for both binaries, because worktrees shared one release target. It was redone with separate target directories.)

Review guide

  • Base: feat/idle-wall-clock-close (feat(precompute): close an idle stream's last windows by wall-clock time #889, e6c41e3), stacked on chore: range step cap in the query engine, one plan test helper, QueryOutcome as Result #888 → fix(otlp): OTLP/HTTP replies, Prometheus resource-attribute labels, DELTA sums rejected, in-place decoder #887 → chore: pin ASAPPlanner 566b35c and its asap_sketchlib d050037 (view format 5) #886. Draft; do not merge.
  • Read first:
    1. crates/precompute/src/ingestion.rs:
      • Routing::route: a sample in a closed window of a raw-path group that is still kept goes to Routed::late. A raw sample at or before late_through is still not stored as raw data; it is dropped only if no window takes it.
      • Ingestion::kept_after_ms: a group's floor is the lowest of its own and its readers' floors, so a change still reaches a wider level after the narrow window itself is gone.
      • Precompute::late_ready and Precompute::merge_late.
    2. crates/storage/src/store.rs: ViewStore::merge_late, merged_rows, revision and changed_since.
    3. crates/precompute/src/engine.rs:
      • ShardReport::late and the coordinator's per-window batches: PrecomputeJob::Late.
      • On the committer: the pending map in serve_precompute, and merge_late.
      • ToPersist now carries the slots taken at commit time.
    4. crates/precompute/src/push.rs: PushShard::push keeps the samples of windows the shard already sealed (take_late); the shard routes those still kept to the same merge.
  • When a merge is applied (late_ready): once no window holding it, of its group or of a group reading it (transitively), is closed and not yet committed. So no run still in flight read the window before the merge.
    • A reader's window not closed yet takes no change: it reads the changed window when it closes (closed_through on the committer).
    • A barrier answers once the merges ready in its pass are applied.
  • Exactness, merged: a group's change is its own ingestion run over the late samples alone, with every view it reads empty except the windows that changed. That run's rows are merged into the stored rows. This equals the on-time state when the view's state is a fold that merges: counts, min/max, and the DDSketch, Count-Min, HLL and KMV families.
    • KLL keeps the merge: compaction is randomized, so the merged state differs from the on-time one within the sketch's error bound.
    • Float sums keep the merge: Kahan sums of non-integer values may differ in the last bits.
  • Exactness, computed again (approved follow-up): a group whose views hold an order-sensitive state (ExactAggregate(Counter | IRate): rate, increase, irate) is not merged. Merging would take a late sample between two on-time ones as coming after them, and miss a reset.
    • Such a group keeps its raw samples for its views' retention, and a late sample of it is also stored as raw data.
    • Its window is computed again from the raw data whole (the coordinator's snapshot of the pass, late samples included) and replaces the stored one (ViewStore::replace_window).
    • Every window read from it is computed again from the views as they then stand.
    • Such a group is not built by push.
    • A pane's raw rows now stay in time order: an out-of-order append rebuilds the pane as one sorted chunk. The run requires each series' samples in time order, and an out-of-order on-time sample (within the allowed lateness) hit the same error before this change.
  • Missing windows (for Collector view states: ingest OTLP states of the views a collector builds, staged and committed as the view's windows #890): ViewStore::replace_window and merge_late can insert a window that is missing behind the newest, within retention. Collector view states: ingest OTLP states of the views a collector builds, staged and committed as the view's windows #890 uses this for a collector window whose first states come after a later window's; the raw path never inserts.
  • Routing race (approved follow-up, here rather than a separate PR because it is the same coordinator/shard code): after answering a flush, a shard holds its samples until it gets that pass's routing. The coordinator now sends Maintain after every flushed pass. So no sample is routed by windows the pass has closed, which would leave it in neither the window nor a late merge. The cost: a shard waits for one coordinator pass per flush before routing more.

Design choices

Persistence

The merged window is written again as a new record at a higher revision. Nothing is rewritten in place:

  • RecordHead gains #[serde(default)] revision: u64. Records written before this change read as 0, so FORMAT_VERSION stays 5 and existing files load.
  • ViewFiles::index keeps, per view and range, the record with the highest revision, whatever segment it is in. After a restart, the next append of an old window can start a segment named by an older end than the original's, so segment order cannot decide which record wins.
  • The revision is per window: the highest revision among the group's views, plus 1. It is kept in WindowLocation and WindowKey, so it survives restarts and the window cache never serves the rows of an older revision under the new key.
  • The old record stays in its segment until that segment expires.

Cache invalidation

Invalidation is lazy, and is checked against the reader's snapshot:

  • ViewStore counts the late merges (revision) and remembers the window end of the newest 4096 merges.
  • A result-cache entry and a query-time result record the revision of the views they were computed from. A lookup through a newer snapshot treats the entry as stale when a window ending at or before its time was revised since (changed_since). If the merge is older than the 4096 remembered, the entry is also treated as stale.
  • There is no race between publishing and invalidating: a stale entry is caught by any reader that sees the new views, and a reader still on the old snapshot reads answers consistent with that snapshot.
  • CompiledQueries::cached takes the snapshot. The range path now takes its snapshot before the cache lookups, and the instant path takes one for its lookup.

Other choices

  • Push mode: a push shard used to drop the samples of windows it had sealed. They now go to the same merge. The window-path and push answers stay equal, and both report the same merged_late count (T13).
  • Deleted, now dead: IngestionStats::samples_late_for_views, Routing::views_closed_through, the per-sample "late for views" check, and PushShard::fold's late count. The /metrics outcome late_for_views becomes merged_late.

Behavior: before → after

Situation Before After
Producer pauses past the idle close of (30, 40], then resumes with 36..=60 s 320 samples dropped; the answer at 40 s is short merged; the answers at 40/50/60 s equal the no-pause answers
Late sample of a closed window within retention (barrier-closed) dropped (samples_dropped_late) merged (samples_merged_late); answer as if on time
Late sample past retention (25 s at 200 s; retention 30 s + 60 s margin) dropped dropped (unchanged)
Cached answer at T that read a revised window kept stale; recomputed on the next request
Narrow chain window already dropped, wide level still kept dropped the change goes into the wide level
Restart after a merge n/a the merged window is loaded
Push mode: sample of a sealed window dropped (late_for_views) merged, as on the window path
Counter increase: on time 10 @ 2 s, 12 @ 8 s; late 3 @ 5 s (a reset) dropped (merging would give an increase of 2) window computed again from raw: 3 + 9 = 12, equal to on-time arrival
A sample admitted right after its shard answered the flush of the pass that closes its window stored as raw data only; lost from the window held until that pass's routing, then merged
Query-time raw data a sample at or before the watermark is not stored unchanged

Interfaces

crates/storage/src/store.rs

 impl ViewStore {
+    pub fn merge_late(&mut self, view: &MaterializedView, time_range_ms: (i64, i64), revision: u64, late: Vec<Batch>, insert: bool) -> Result<Option<Vec<Batch>>, Error>;
+    pub fn replace_window(&mut self, view: &MaterializedView, time_range_ms: (i64, i64), revision: u64, batches: Vec<Batch>, insert: bool) -> Result<Option<Vec<Batch>>, Error>;
+    pub fn window_revision(&self, view: PhysicalASAPNodeId, end_ms: i64) -> Option<u64>;
+    pub fn revision(&self) -> u64;
+    pub fn changed_since(&self, revision: u64, time_ms: i64) -> bool;
 }
 impl RawData {
+    pub fn emptied(&self) -> Self;
 }
 impl<E: Clone> QueryTimeResults<E> {
-    pub fn get_or_compute(&self, node, time_ms, watermark_ms, compute) -> …;
+    pub fn get_or_compute(&self, node, time_ms, watermark_ms, views: &ViewStore, compute) -> …;
 }

crates/storage/src/window_cache.rs, segment.rs, persist.rs, persist_pool.rs

 pub struct WindowKey {
     pub view: PhysicalASAPNodeId,
     pub end_ms: i64,
+    pub revision: u64,
 }
 pub(crate) struct RecordHead {
+    #[serde(default)]
+    pub revision: u64,
 }
 impl WindowLocation {
+    pub fn revision(&self) -> u64;
 }
 impl ViewFiles {
-    pub fn append(&mut self, group, range_ms, views) -> std::io::Result<Written>;
+    pub fn append(&mut self, group, range_ms, views, revision: u64) -> std::io::Result<Written>;
 }
 impl PersistPool {
-    pub fn queue(&self, group, range_ms, views, slots);
+    pub fn queue(&self, group, range_ms, views, slots, revision: u64);
 }

crates/precompute/src/ingestion.rs

 pub struct IngestionStats {
-    pub samples_late_for_views: u64,
+    /// Samples merged into a window already committed, counted once per group window they changed.
+    pub samples_merged_late: u64,
 }

crates/query/src/result_cache.rs, lib.rs

 impl ResultCache {
-    pub fn get(&self, root, time_ms) -> Option<Answer>;
-    pub fn insert(&self, root, time_ms, answer, watermark_ms);
+    pub fn get(&self, root, time_ms, views: &ViewStore) -> Option<Answer>;
+    pub fn insert(&self, root, time_ms, answer, watermark_ms, revision: u64);
 }
 impl CompiledQueries {
-    pub fn cached(&self, root, time_ms) -> Option<Answer>;
+    pub fn cached(&self, root, time_ms, snapshot: &Snapshot) -> Option<Answer>;
 }

crates/precompute/src/engine.rs, crates/data-plane/src/engine.rs (test hook)

 pub struct PrecomputeOptions {
+    pub routing_delay_after_flush_ms: u64,
 }
 pub struct EngineOptions {
+    #[doc(hidden)] pub routing_delay_after_flush_ms: u64,
 }

/metrics:

-asap_samples_total{outcome="late_for_views"} 0
+asap_samples_total{outcome="merged_late"} 0

Tests

Test-first: the first commit adds the tests below; on the base, (a), (c), (d) and the merged-on-any-shard test fail (answers short / cache stale / restart loads the unmerged window), (b) passes (it guards the unchanged drop).

  • (a) ingest_shards.rs::samples_after_a_pause_merge_into_the_window_closed_by_wall_clock: manual clock; pause past the idle close, resume; answers at 40/50/60 s equal the no-pause answers; 320 merged, 0 dropped.
  • (b) ingest_shards.rs::a_late_sample_past_retention_is_dropped: merged 0, dropped 1, answer unchanged.
  • (c) result_cache.rs::a_late_merge_drops_the_cached_answers_reading_its_window: a cached range answer is recomputed after the merge and equals the on-time data plane's.
  • (d) view_persistence.rs::a_merged_window_is_loaded_merged_after_a_restart: a new series merged into the window ending at 600 s; the restarted data plane answers with it.
  • ingest_shards.rs::a_late_sample_merges_into_its_closed_window_on_any_shard_count (was a_late_sample_is_dropped_on_any_shard_count), 1 and 8 shards.
  • window_levels.rs::a_late_sample_reaches_the_wider_levels_built_from_its_window: a sample 40 min late reaches the 1 h sum's wider levels after the narrow window was dropped; every answer equals the samples'.
  • persist.rs::the_highest_revision_of_a_window_is_indexed (unit): revision precedence across segments after a restart; a pre-revision head decodes as 0.
  • push_precompute.rs T13: window path and push give equal windows and equal merged_late.
  • persist.rs::appends_never_truncate_an_existing_segment: a window appended twice indexes as one window (was 2 entries).
  • Follow-up, test-first (commit 10659b35, both failed on the previous head):
    • ingest_shards.rs::a_late_counter_sample_recomputes_its_window_from_the_raw_samples: on time 10 @ 2 s, 12 @ 8 s, then 3 @ 5 s late. The answer equals the data plane that got all three on time. Before: merged, 3.67 vs 19 extrapolated.
    • ingest_shards.rs::a_sample_routed_while_its_window_closes_is_not_lost: needs the test hook routing_delay_after_flush_ms. The coordinator waits 1 s between the flush and the routing, and series 5's sample of (20, 30] comes in that gap. Before: job1 14 short.
    • store.rs::a_missing_window_is_inserted_behind_the_newest (unit): insert behind the newest; no insert without insert, when overlapping, or past retention.
    • Collector view states: ingest OTLP states of the views a collector builds, staged and committed as the view's windows #890's a_window_whose_first_states_come_after_a_later_windows_is_stored exercises the insert and the reader rebuild end to end.

Gates

At 8f5588f:

  • cargo fmt --all --check and cargo clippy --workspace --all-targets --locked -D warnings: clean.
  • Unit tests: storage lib 46, precompute lib 10, query lib 4.
  • data_plane integration (ulimit -n 65536), all pass:
    • ingest_shards 17, window_levels 3, push_precompute 16 (+3 ignored), result_cache 6, view_persistence 8, server 10;
    • view_tiering 9, view_memory 1, ingest_protocols 6, precompute_pool 6;
    • planner_executor_parity 6 (1055 s).
  • T12 failed once on the first follow-up commit (its counter queries were no longer pushed) and was scoped to the gauge queries in 8f5588f.
  • Not rerun: the parity dump and ingest_bench.
    • The hot path adds one lookup of the metric's closed groups per batch, and one window-end computation per sample per group that has closed a window.
    • A shard now waits once per flush for that pass's routing.

Open questions

Resolved (approved 2026-11-29):

Still open:

  1. Resolved 2026-11-30: narrow levels are kept as long as the levels recomputed from them reach back.
  2. Memory: raw counter samples are kept for retention as XOR chunks. The table above measures 432 MB for the dashboard's 1 h counters at 10k series. Coarser chunks would cut this further.
  3. Retention floor: a group's late samples are routed while its own or any reader's window is kept. The view-retention margin (60 s) is the only lateness allowance beyond the plan's retention.

🤖 Generated with Claude Code

https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf

zzylol and others added 3 commits November 29, 2026 00:09
…first)

A sample of a window already committed, still within its view's
retention, is to merge into that window: after a producer's pause past
the idle close, after a barrier, through the result cache, and across a
restart over the view files. One past retention is still dropped and
counted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
…tention

A sample of a window already committed, while that window (or a window
of a group reading it) is within retention, is merged into it instead of
being dropped. The ingest coordinator batches a window's late samples per
pass; the precompute committer runs the window's views over them alone
and merges the rows into the stored window (equal plain columns merge
their states by each kernel's merge), then the change into the committed
windows of the groups reading those views. It applies a merge once those
groups have committed through it, so no run in flight read the window
first. Push shards hand the samples of their sealed windows to the same
merge.

The merged window replaces the stored one in memory and is written again
as a record of a higher revision; the view files index the highest
revision of each window (record heads without one read as 0, so the
format stays 5). The window cache keys windows by revision, and the
result cache and query-time results record the views' revision they were
computed from and recompute an answer that read a window revised since.

Beyond retention a late sample is still dropped and counted. The
samples_late_for_views counter becomes samples_merged_late
(asap_samples_total{outcome="merged_late"}).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
…bench call site

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
@zzylol zzylol added enhancement New feature or request area: data plane Runtime ingestion, storage, and query-serving data paths area: summary execution Warm-summary binding, readout, composition, and result decoding labels Nov 29, 2026
Push mode merges the samples of sealed windows as the window path does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
zzylol added a commit that referenced this pull request Nov 29, 2026
…within retention

A collector request's staged windows close when the request ends, and
the request is answered once they are committed: no commit grace (the
8 s grace cost every window about 6 s of freshness, while states arrive
within half a second of the window's end). A state that comes later for
a committed window still kept merges into it through the late merge of
#892 (and into the windows of the groups reading the view); one of a
window past retention, or closed without states, is dropped as late.

The hashes of each committed window's states are kept while the window
is, per series, so a resent state or request merges nothing twice.

CollectorViewOptions::commit_grace_ms is removed; the report and
asap_collector_states_total gain late_merged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
zzylol and others added 4 commits November 29, 2026 17:11
…le routed while its window closes is kept (failing first)

The second test needs a test hook, routing_delay_after_flush_ms: the
coordinator waits between the flush every shard answered and the
routing it publishes, which is when the race happens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
… insert missing windows; shards wait for a pass's routing

- A group whose states depend on the order of their samples (Counter for
  rate/increase, IRate) keeps its raw samples for its views' retention.
  A late sample of it is stored as raw data too, and its window is
  computed again from the raw data whole and replaces the stored one;
  the windows built from it are computed again from the views. Such a
  group is not built by push. KLL and float sums keep the merge.
- A pane's raw rows stay in time order: an out-of-order append (a late
  sample) rebuilds the pane as one chunk sorted by time.
- ViewStore::replace_window replaces a window, or inserts one missing
  behind the newest within retention (for a collector view's window
  whose first states come late, #890); merge_late can insert likewise.
- After answering a flush, a shard holds its samples until the routing
  of that pass (the Maintain the coordinator now sends after every
  flushed pass), so no sample is routed by windows a pass has closed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
…rs not closed yet take no change

A merge waited until every reader group had committed through the
window holding it, which never happens when that reader's window failed
(it read a window still missing). It now waits while a window holding
it is closed and not committed, and a reader's window not closed yet
takes no change: it reads the changed window when it closes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
…s; T12 over the gauge queries

A window read from a late-changed window is computed again from the
views; when that run fails (a window it reads is already gone) the
reader keeps its rows and the change already made stays, instead of
failing the whole merge after the store changed.

T12 measures the raw buffer of pushed pipelines over the dashboard's
gauge queries: its counter queries are no longer pushed (their windows
are computed again from raw samples kept for retention).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
zzylol added a commit that referenced this pull request Nov 29, 2026
… window's is stored

Collector states of a closed window still kept that was never stored
(its first states came after a later window committed, e.g. from a
collector lagging more than a window) go to the late path with insert
set: the window is stored behind the newest (#892's replace_window /
merge_late), and the wider windows read from it that closed meanwhile
are computed again (inserted when their first run failed on the
missing window). They count as late_merged; only a window past
retention is late_dropped. Collector windows also count in the
committer's closed-through, which decides which readers take a change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
zzylol and others added 2 commits November 30, 2026 01:53
…tion reaches the wide level (failing first)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
…w levels kept as long as the levels computed again from them

- storage::xor_chunk: one series' samples as a Prometheus-style XOR
  (Gorilla) chunk, delta-of-delta timestamps and XOR'd value bits,
  lossless on any bit pattern.
- RawData keeps a metric's closed panes that only windows computed again
  read (behind every window still to close, within an order-sensitive
  group's floor) as CompressedPanes, one XOR chunk per series; a read
  decodes them, and a late sample of one makes the pane columnar again.
  The routing carries both cutoffs: compress, then evict.
- A group a chain computed again reads keeps its windows as long as the
  readers' windows reach back (their retention plus their width), and the
  late-sample floor of an order-sensitive group takes its readers' floors,
  so a late sample within the widest level's retention always has the
  narrow windows to compute every level again from. The path that kept a
  reader's old rows when its run failed is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
zzylol added a commit that referenced this pull request Nov 30, 2026
… window's is stored

Collector states of a closed window still kept that was never stored
(its first states came after a later window committed, e.g. from a
collector lagging more than a window) go to the late path with insert
set: the window is stored behind the newest (#892's replace_window /
merge_late), and the wider windows read from it that closed meanwhile
are computed again (inserted when their first run failed on the
missing window). They count as late_merged; only a window past
retention is late_dropped. Collector windows also count in the
committer's closed-through, which decides which readers take a change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
zzylol added a commit that referenced this pull request Nov 30, 2026
…k and are stored empty

Collector windows closed only when states arrived, so while a collector
stream was idle none closed and every range over the idle period failed
("has no rows tiling", HTTP 422), for good if the stream never resumed.
As #889's idle close does for samples, a collector view's group now has
an idle watermark on the monotonic clock: the newest state's window end
(capped at its arrival's wall-clock time) plus the monotonic time since
it arrived, less the collector's close delay and skew allowance
(CollectorViewOptions::idle_close_ms, default 6 s + 2 s). Windows it
passes close with no state and are stored empty; states or corrections
of them coming later merge in (#892). Nothing closes on the clock before
a group's first states.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
zzylol and others added 6 commits November 30, 2026 04:13
…of walking every pane

- RawData keeps its samples and bytes held, updated as panes are appended,
  compacted, compressed, made columnar again and evicted. The ingest
  coordinator reads them after every flush for the raw-data gauges; it no
  longer walks every stored pane and chunk each pass.
- A compressed pane's bytes are taken once, when it is made.
- A chunk's bytes no longer count the series identity column a read builds
  later: it is a read cache, and a chunk's bytes must be fixed when it is
  made for a running total. `asap_raw_data_bytes` is lower by those
  identity columns.
- Test: the running totals equal a walk over every pane after appends in
  and out of order, late samples of sealed and compressed panes, sealing,
  compressing and evicting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
- Each metric remembers how far its panes are sealed; a seal visits only
  the panes after that and the sealed panes a late sample gave another
  chunk since (kept in a set by the append). Since the shards get a
  maintenance message after every flush, the seal no longer walks every
  pane each pass.
- Compressing returns at once when no columnar pane ends at or before its
  cutoff: compressed panes leave the columnar map, so only newly closed
  panes, or ones a late sample made columnar again, are left there.
- Test: a late chunk in a sealed pane is compacted by the next seal; the
  running totals still equal a walk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
… for chunk building

- The series interner keeps one name per metric, shared by its series, so
  two series' metrics are equal exactly when the pointers are
  (`Series::metric_key`).
- RawData::append groups a request's samples by (metric pointer, pane),
  checking the last group first, instead of a BTreeMap keyed by the metric
  name that compared the names byte by byte per sample. The routing finds
  a sample's metric by pointer too.
- Chunk::new maps series ids to codes with ahash instead of SipHash.
- Test: series of one metric share its name; other metrics do not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
…e blocks, off the ingest shards

- A compressed block takes consecutive closed panes of a metric, enough
  for 120 samples per series (COMPRESSED_SAMPLES_PER_SERIES), and keeps one
  XOR chunk per series over all of them: at 1 sample/s a 15 s pane gave
  each series a chunk of 15 samples, whose header and slack dominated. The
  newest panes that do not fill a block yet stay columnar.
- A late sample within a block's span makes the block's panes columnar
  again (one chunk per pane), so a window computed again reads exactly the
  samples it did; the panes are compressed again later. A read decodes the
  blocks overlapping its range and keeps the rows in it; an eviction drops
  the blocks ending at or before the cutoff.
- Compression runs on one thread of its own (`raw-compress`), not on the
  ingest shards: a shard's maintenance takes the panes to compress
  (RawData::panes_to_compress) and sends them; the shard installs the
  encoded blocks at its next maintenance (RawData::install_compressed),
  each only if its panes are as they were taken, else the panes are taken
  again later. One metric has at most one batch in flight.
- RawData::compress_through still compresses here and now (tests).
- Test: blocks of several panes
  read back as the columnar panes over ranges inside, across and outside
  blocks, after late samples in a block's first, middle and last pane and
  on a block boundary, after compressing again, after a late sample while
  a block was encoded, and after evicting part of a block; running totals
  and pane counts equal a walk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
…d pane (failing first)

Concurrent senders deliver requests out of time order. Today each such
request rebuilds its whole pane (every row so far, sorted again), so a
window-mode raw store does work in the pane's size per request. The test
swaps each pair of requests, checks no pane is rebuilt, and that reads
return exactly the rows, in the order, of one pane sorted by time (equal
times in arrival order), before and after sealing and after a late request
into sealed panes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
…hunk; the pane is merged in time order when read or sealed

- Concurrent senders (an OTLP exporter, a feeder with several requests in
  flight) deliver requests out of time order. Each such request used to
  rebuild its whole pane: every row so far collected, sorted and made one
  chunk again, work in the pane's size per request. With the raw samples
  kept (window mode), this was most of the ingest shards' CPU over OTLP.
- Now the request's rows (sorted among themselves if needed) become a
  chunk of their own, and the pane is marked unsorted. The first read of
  an unsorted pane merges its chunks in time order (equal times in arrival
  order, as the rebuild did) and keeps the merged chunk for later reads
  and clones; an append replaces it. Sealing compacts the pane in time
  order, reusing that merged chunk when a read built it. Panes not sealed
  in time order yet are not compressed.
- Reads return the same rows in the same order as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
zzylol added a commit that referenced this pull request Nov 30, 2026
… window's is stored

Collector states of a closed window still kept that was never stored
(its first states came after a later window committed, e.g. from a
collector lagging more than a window) go to the late path with insert
set: the window is stored behind the newest (#892's replace_window /
merge_late), and the wider windows read from it that closed meanwhile
are computed again (inserted when their first run failed on the
missing window). They count as late_merged; only a window past
retention is late_dropped. Collector windows also count in the
committer's closed-through, which decides which readers take a change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
zzylol added a commit that referenced this pull request Nov 30, 2026
…k and are stored empty

Collector windows closed only when states arrived, so while a collector
stream was idle none closed and every range over the idle period failed
("has no rows tiling", HTTP 422), for good if the stream never resumed.
As #889's idle close does for samples, a collector view's group now has
an idle watermark on the monotonic clock: the newest state's window end
(capped at its arrival's wall-clock time) plus the monotonic time since
it arrived, less the collector's close delay and skew allowance
(CollectorViewOptions::idle_close_ms, default 6 s + 2 s). Windows it
passes close with no state and are stored empty; states or corrections
of them coming later merge in (#892). Nothing closes on the clock before
a group's first states.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
zzylol and others added 2 commits November 30, 2026 06:25
… pushed (failing first)

A refresh group mixing a counter's rate (computed again from raw samples
on late data) with other views is not pushed at all today, so in push mode
the whole group falls back to the window path and keeps raw samples for
every metric it scans. The test plans sum_over_time(data[30s]) with
rate(data_total[30s]) in one group and checks that in push mode the other
views are built by push, with every answer equal to the window path's,
late samples included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
…so the rest stays pushed

A group was pushed only if none of its views was order-sensitive (a
counter's or an instant rate's state, computed again from raw samples on
late data). One rate(...) in a group therefore sent all its views to the
window path, and raw samples of every metric they scan were kept: the
collector e2e's W1 plans its five views into one 5 s group, so at the
data plane's default push mode W1 lost push entirely.

Ingestion::new now runs such a group as two groups of the same window:
the order-sensitive views (window path, raw samples kept, recomputed) and
the others (pushed when they qualify). The part read by the other comes
first; a group whose two parts read each other stays whole.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
…encode their panes themselves

When ingest outran the one raw-compress thread (an unpaced backfill at
2-4 M samples/s), each metric had one batch in flight and the panes behind
it waited columnar until it came back: the dashboard shape's max RSS went
from 2.8 to 4.8 GB.

- A metric may now have several batches in flight: a take gets only panes
  newer than every batch in flight (RawData keeps their newest ends), so
  panes no longer wait for an earlier batch to come back.
- The shards count the samples queued for the thread; past 4 M samples
  (about 64 MiB columnar) a shard encodes and installs its batch itself,
  which slows its ingest instead of growing memory (backpressure).
- Test: two batches in flight, installed in either order, read as the
  columnar panes; a block a late sample changed in flight is taken again
  once the newest batch is installed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
zzylol added a commit that referenced this pull request Nov 30, 2026
… window's is stored

Collector states of a closed window still kept that was never stored
(its first states came after a later window committed, e.g. from a
collector lagging more than a window) go to the late path with insert
set: the window is stored behind the newest (#892's replace_window /
merge_late), and the wider windows read from it that closed meanwhile
are computed again (inserted when their first run failed on the
missing window). They count as late_merged; only a window past
retention is late_dropped. Collector windows also count in the
committer's closed-through, which decides which readers take a change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
zzylol added a commit that referenced this pull request Nov 30, 2026
…k and are stored empty

Collector windows closed only when states arrived, so while a collector
stream was idle none closed and every range over the idle period failed
("has no rows tiling", HTTP 422), for good if the stream never resumed.
As #889's idle close does for samples, a collector view's group now has
an idle watermark on the monotonic clock: the newest state's window end
(capped at its arrival's wall-clock time) plus the monotonic time since
it arrived, less the collector's close delay and skew allowance
(CollectorViewOptions::idle_close_ms, default 6 s + 2 s). Windows it
passes close with no state and are stored empty; states or corrections
of them coming later merge in (#892). Nothing closes on the clock before
a group's first states.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: data plane Runtime ingestion, storage, and query-serving data paths area: summary execution Warm-summary binding, readout, composition, and result decoding enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant