Repository navigation
feat(precompute): event-time barrier for Remote Write producers - #839
Merged
Merged
Conversation
zzylol
force-pushed
the
feat/kept-query-time-results
branch
from
October 20, 2026 23:26
8827771 to
d1feb90
Compare
zzylol
force-pushed
the
feat/watermark-barrier
branch
from
October 20, 2026 23:26
80650bd to
90cd86e
Compare
zzylol
force-pushed
the
feat/kept-query-time-results
branch
from
October 20, 2026 23:46
d1feb90 to
9bfa31f
Compare
zzylol
force-pushed
the
feat/watermark-barrier
branch
from
October 20, 2026 23:46
90cd86e to
7fbd02a
Compare
zzylol
marked this pull request as ready for review
October 20, 2026 23:46
zzylol
force-pushed
the
feat/kept-query-time-results
branch
from
October 20, 2026 23:53
9bfa31f to
185f7db
Compare
zzylol
force-pushed
the
feat/watermark-barrier
branch
from
October 20, 2026 23:53
7fbd02a to
3cb7b7e
Compare
zzylol
force-pushed
the
feat/kept-query-time-results
branch
from
October 20, 2026 23:56
185f7db to
a3fa8e0
Compare
zzylol
force-pushed
the
feat/watermark-barrier
branch
from
October 20, 2026 23:56
3cb7b7e to
defe86d
Compare
zzylol
force-pushed
the
feat/kept-query-time-results
branch
from
October 21, 2026 00:09
a3fa8e0 to
5780d83
Compare
zzylol
force-pushed
the
feat/watermark-barrier
branch
from
October 21, 2026 00:10
defe86d to
4987a39
Compare
Ports #814 to the plan-executing engine. POST /api/v1/precompute/watermark?time_ms=T: the producer states that every sample at or before T has been written. The request queues an AdvanceWatermark command behind every write already acknowledged and answers {"barrier_ms": B}, the barrier in force, once it has run: every pane with end <= T is closed, keeping the left-open (end - width, end] convention, so the last pane of a series that stopped sending is built and its window served from the plan without a later sample. - T is capped at the wall clock, like the sample watermark. - A repeated or lower T does nothing; the answer is the barrier in force. - The closing reuses the expired-pane skip and checked arithmetic, so T = i64::MAX terminates. - Input stays open; a sample arriving later for a pane the barrier closed counts as late. - A missing or non-integer time_ms gets 400 bad_data with the reason. - With several producers, the barrier must follow all of their writes through T; the README says so.
zzylol
force-pushed
the
feat/watermark-barrier
branch
from
October 21, 2026 00:17
4987a39 to
0a5c014
Compare
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Base: #824 (stored outputs built in a
QueryRun). Ports #814 to the plan-executing engine.Why
A pane closes only when a later sample of a routed metric passes its end (plus the allowed lateness). When a series stops sending, its last pane stays open, and every planned query reading that window is forwarded. Remote Write gives the producer no way to say "everything up to T is written". #814 added that statement to the old backend; this PR adds it to the engine that executes the Planner's plan.
What
POST /api/v1/precompute/watermark?time_ms=T. It answers{"barrier_ms": B}, the barrier in force:Tcapped at the wall clock, or a higher earlier barrier. A missing or non-integertime_msgets 400bad_datawith the reason, and a stopped engine gets 500. Input stays open.end <= Tis closed, keeping the left-open(end − width, end]convention. The last pane of a series that stopped sending is built, and a planned query reading it is answered by the plan.Tis capped at the wall clock, like the sample watermark.Tdoes nothing.T = i64::MAXterminates and builds only the retained panes (at most seven for Example 4b).T) counts as late. A later sample in a pane still open is accepted.T; the README says so. The backend keeps no producer roster.Key code interfaces added / modified
Before this PR
Example 4b without raw data, with one series that stops at 69:45 and 15 s allowed lateness: the pane
(60, 70 min]stays open, andquantile_over_time(0.99, latency_ms[60m])at 70 min is forwarded.After this PR
After
POST /api/v1/precompute/watermark?time_ms=4200000, the same query at 70 min is answered by the plan, and later writes are still accepted.Verification
data_plane/tests/answers.rs:barrier_serves_the_window_of_a_stopped_series. It fails before this PR, because the endpoint did not exist. Before the barrier the query is forwarded; after it, the plan answers. Input is still accepted.barrier_msis in the response. A missing, non-numeric or fractionaltime_msgets 400bad_datawith the reason.data_plane/tests/precompute.rs:barrier_closes_the_last_pane_of_a_stopped_seriesbarrier_is_monotonic_and_capped_at_the_wall_clockbarrier_at_i64_max_terminatesinput_stays_open_after_a_barriercargo test --workspace --lockedpasses.