Skip to content

fix(intent): rounds read one pinned store, wait for their data, evaluate on clock multiples - #906

Draft
zzylol wants to merge 1 commit into
feat/table-series-keyfrom
fix/intent-round-snapshot
Draft

zzylol wants to merge 1 commit into
feat/table-series-keyfrom
fix/intent-round-snapshot

Conversation

@zzylol

@zzylol zzylol commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Why

The first network runs found intent-round failures in the data plane:

  1. Evicted window starts. A 1-hour query that runs after a slow query in the same round (fanout_1h, ~150 s) finds its window's raw samples already evicted: the raw samples of packets at or before … are evicted. N5 full: fanin/ports/entropy_1h failed every round.
  2. Answers from undelivered data. fanout_1m was 12% low in one round, identically in both modes. The feeder lagged up to 13.4 s (max_lag_ms), the round issued at T + 6 s, and the query answered from a window whose last seconds had not arrived yet.
  3. Clocks off the window grid. In query-at-a-time mode, materialized view N has no rows tiling hit every round of the 5-minute clock. That run's first evaluation time (…070000) was not a multiple of 60 s or 300 s, so the 1-minute chain windows could never tile the queries' ranges.

The fourth finding, EXACT proto_1h being 3.5–8% high (28% for one rare proto), is not a data-plane bug. All protos were high by about 140 s / 3600 s. The exact reference (net_exact rounds) dropped seconds from its window cache when round lines arrived out of evaluation-time order (a slow clock's line is written when its round ends). That is fixed in the eval tool, not here.

What

  • Pinned store. Every query of a round reads one store snapshot pinned when the round starts (QueryRunner::pin_round, answer_in, answer_bound_in; EngineHandle::pin_round_snapshot, evaluate_in). A late query in a slow round reads what was kept at the round's start, so the raw-retention margin only has to cover the issue delay. This replaces growing it by query timeout × queries per round.
  • Data wait. Before its queries run, a round waits up to --intent-data-wait-ms (default 30 s) for two things: the watermark passing T (every sample at or before T delivered), and the windows ending by then being refreshed (a barrier at T, which by then only waits for commits). The wait is recorded as RoundRecord::data_wait_ms and is included in duration_ms. In-process IntentLoop::new defaults to no wait; use with_data_wait to set one.
  • Clock alignment. Each clock evaluates on multiples of its interval: the first such time at or after --intent-first-evaluation-ms, started that much later.

Tests

  • intent_sil_modes::a_round_waits_for_its_late_data_and_answers_exactly (query-at-a-time and full): the last 30 s of rows arrive after the round starts. Without a wait the answer is not exact, which reproduces the bug; with a wait it is exact and records the wait.
  • intent_sil_modes::a_round_reads_the_store_pinned_when_it_started: after ingestion moves 3 h ahead, the newest store fails q1 at T, while the pinned snapshot answers it exactly.
  • intent::each_clock_evaluates_on_multiples_of_its_interval; the expectation in clocks_run_concurrently_each_on_its_own_rounds is updated (the 3 s clock now evaluates at 12 s and 15 s).
  • cargo test -p data_plane --lib --test intent_sil_modes --test intent_rounds passes.

Deferred

  • The intent loop's concurrency (feat/parallel-rounds) has to keep one pinned snapshot per round when it runs queries concurrently.

🤖 Generated with Claude Code

https://claude.ai/code/session_01K1M6boFpwkpMtRc1FnZuYi

…ate on clock multiples

Three failures of the network runs:
- a 1-hour query run late in a slow round found its window's raw samples
  evicted: every query of a round now reads one store snapshot pinned when
  the round starts (QueryRunner::pin_round / answer_in);
- a round answered from data its producer had not delivered yet (feeder
  lag 13 s > issue delay 6 s; fanout_1m 12% low): a round first waits, at
  most --intent-data-wait-ms (default 30 s), for the watermark to pass its
  evaluation time and the windows ending by then to be refreshed; the
  wait is recorded (RoundRecord::data_wait_ms);
- a clock whose first evaluation was not on a multiple of its interval
  could never tile its views' windows (QaT proto_5m/p99_5m failed every
  round): each clock evaluates on multiples of its interval.

packets_bench: whole-hour epoch, all clocks, per-proto exact check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6boFpwkpMtRc1FnZuYi
@zzylol zzylol added bug Something isn't working area: data plane Runtime ingestion, storage, and query-serving data paths labels Dec 4, 2026
zzylol added a commit that referenced this pull request Dec 4, 2026
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 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant