Repository navigation
Conversation
zzylol
force-pushed
the
refactor/layout-eval-deploy
branch
from
November 28, 2026 00:56
7862cb6 to
659d53b
Compare
Bump asap-planner, asap-executor and asap-types from 1d527bc to f2da999 (main), and asap_sketchlib to 01f3333, the revision the Planner pins, so cargo builds one copy; the [patch] to 355093f is dropped (01f3333 contains it). Planner API changes adapted: - storage: view bytes via StateColumn::view_bytes (read from each window batch's own state column), cold reads via StateColumn::from_views, family_has_view_layout; the column kind is renamed VIEW_STATES (same code, 7). - storage::state_codec: the compact DDSketch codec follows the new DDSketch view head (no sum, min, max; 64 bytes). - FORMAT_VERSION 4 -> 5: format 4 segments are set aside on open. - query: a shared query-time slot carries the plan's plan_id and a view_state_key, now required MaterializedView fields. - SketchAlgorithm renames (KLL, CountMinSketch, HLL, ...) in tests and benches; plan files now name sketches by them (wire version 16).
push_precompute_stores_the_window_paths_view_rows trimmed the push side to the oldest window the window path held and compared the rest exactly. Windows older than a view's retention linger by timing (lazy eviction at the next append, a narrower level held until its readers commit, expired windows skipped when the watermark jumps), so when the window path happened to keep an older window than push, the test failed on a window no query reads. Both sides are now cut to the windows the store keeps by retention (ending less than retention_ms before the view's newest window, and the newest), and these must match exactly. No such window is skipped or evicted on either path, so the comparison no longer depends on timing.
zzylol
force-pushed
the
chore/bump-planner-latest
branch
from
November 28, 2026 02:13
cd7ffef to
5f7b20c
Compare
566b35c includes #1518 (KLL and Count-Min sealed into view layouts) and #1543 (DDSketch bounds once). asap_sketchlib d050037 is the rev it pins (branch planner-pin/main-a05b35c-shrink-to-fit-dd-bounds). No backend change: the stored view bytes are the library's to_view_bytes either way, so FORMAT_VERSION stays 5.
This was referenced Nov 28, 2026
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.
Summary
1d527bcand patchedasap_sketchlibto355093f(the MVP demo: agent emits full-attr sketches → no sid match for grouped streaming-config #271 head), ahead of the389530cthe Planner pinned. The backend, the Planner and the collector are meant to use the newest ASAPPlanner main and exactly theasap_sketchlibrev the Planner pins (docs/design/collector-sketch-ingest.md, decision 13, in docs(design): plan sub-DAGs precomputed in the collector (v1: leaf sketch views) #885).asap-planner,asap-executorandasap-typesmove to ASAPPlanner main566b35c(firstf2da999, re-pinned to the newest main, see "Re-pin to566b35c").asap_sketchlibmoves tod050037, the rev566b35cpins (branchplanner-pin/main-a05b35c-shrink-to-fit-dd-bounds: maina05b35c+ feat(query): warm-tier fallback for /api/v1/query_range #267, fix(deploy): MVP smoke-test blockers — dockerignore + OpAMP endpoint default #270, MVP demo: agent emits full-attr sketches → no sid match for grouped streaming-config #271, fix(query): union instances_matching into ASAP-tier sid resolution (schema-retirement #5 step 1) #273; those PRs are not on sketchlib main yet), so cargo builds one copy. The[patch]is dropped because the pin already contains355093f.push_precompute_stores_the_window_paths_view_rows), which failed on every run on refactor: eval/scripts, eval/baselines and deployment Dockerfile (layout step 9) #884. See "T2 test fix" below./metricsnames of the parity dump are byte-identical to refactor: eval/scripts, eval/baselines and deployment Dockerfile (layout step 9) #884 (659d53b).*.stalewhen the data plane opens it; it is not migrated.Review guide
refactor/layout-eval-deploy(refactor: eval/scripts, eval/baselines and deployment Dockerfile (layout step 9) #884, head659d53b, the restacked layout stack). This is a stacked draft. Rebased from7862cb6: the conflicts werestorage::boundary(deleted by the restack, so its test JSON change is dropped with it),FORMAT_VERSION(nowpub(crate)there, kept so, value 5) and the README pin line.crates/storage/src/segment.rs:view_bytesandview_column_of(the write path);COMPACT_STATES/VIEW_STATESarms ofdecode_fragment(the read path);FORMAT_VERSION.crates/storage/src/state_codec.rs: the DDSketch head constants,read_ddandDdContents::view_bytes.crates/storage/src/persist.rs:window_rows, which now returns each row's source batch and row.crates/query/src/lib.rs:query_time_slot.crates/data-plane/tests/planner_executor_parity.rs:within_retention(the T2 test fix, its own commit).SketchAlgorithmrenames in tests and benches;MaterializedViewJSON in tests, which gainsplan_idandview_state_key;Re-pin to
566b35cf2da999→566b35c(ASAPPlanner #1527, #1528, #1543, #1518) and01f3333→d050037(asap_sketchlib#273). OnlyCargo.toml,Cargo.lock(sources only) and the README pin line change; no backend code change was needed.StateColumn::sealed); KLL quantiles and Count-Min totals are read on the views; the cost model charges sealed states at their view layout.view_bytes), so KLL and Count-Min windows are now borrowed too instead of written per state. The bytes are the library'sto_view_byteseither way, so the stored layout is unchanged:FORMAT_VERSIONstays 5 (fragments 2.7 MiB, 7.1 B/row inview_read_benchon both pins; persisted bytes peringest_benchrun 6.11 MB on both).asap_sketchlib#273: a DDSketch computes its indexable bounds once.ddsketch/wire.rschanged).ingest_benchworkloads (same view sets), so no plan-driven difference.Public API between
f2da999and566b35c: onlySearchSpacePruninggained a field, which the backend does not build.Planner changes and how the backend follows them
1d527bcandf2da999)StateColumn::from_mapped,state_view_bytesandfamily_has_mapped_form. #1542 restored them asStateColumn::from_views,StateColumn::view_bytes(index)andfamily_has_view_layout.from_views, still zero-copy over the fragment buffer. Writes read each row's view from its own window batch's state column (view_bytes). That borrows the view when the batch already holds sealed views, and writes it otherwise. The column kind constant is renamedMAPPED_STATES→VIEW_STATES; its on-disk code stays 7.asap_sketchlib#252: a DDSketch keeps nosum/min/max(ASAPv1 kind0x05 0x01). The view head shrinks from 88 to 64 bytes.MaterializedViewgained the required fieldsplan_idandview_state_key(#1536).query_time_slot(shared query-time results) sets the plan'splan_idand a key naming only its node. Without this, any plan with a shared node failed to install with "missing fieldplan_id".SketchAlgorithmvariants were renamed (Kll→KLL,Cms→CountMinSketch,Hll→HLL,HydraCms→HydraCountMinSketch, ...). The plan wire version is 16.from_viewsreports a column'sstate_memory_bytesas the bytes its views span.from_mappedreported 0. Neither charges a run.Batch::memory_bytes, which still charges 0 for these states. One test now asserts the new report.MaterializedView::view_state_key()is public.definition_id. Behavior is kept as it was.Interfaces
crates/storage/src/segment.rs(crate-private)crates/storage/src/persist.rs(private)crates/query/src/lib.rs(private)crates/data-plane/tests/planner_executor_parity.rs(test helper)Cargo.tomlBehavior: before → after
1d527bc;asap_sketchlib389530c, patched to355093f566b35c;asap_sketchlibd050037(the Planner's pin, no patch)*.staleon open, with "a segment of another plan, group or format version (this data plane reads version 5)". The plan hash changes too, because plan files are now wire version 16.from_mapped)from_views); same speed, see the benchmarks belowT2 test fix
T2 checks that push precompute stores the same view rows as the window path.
Problem: the test cut the push side's windows to those at or after the oldest window the window path held, then compared exactly. Windows older than a view's retention stay in the store by timing:
So the count of old windows left at the end differs between runs and between the two modes. The cut only removed extra windows on the push side. When the window path kept an older window than push, the test failed, on a window that no query reads.
Example: on refactor: eval/scripts, eval/baselines and deployment Dockerfile (layout step 9) #884
7862cb6,sketch-plan-quantile-single(raw data not kept), view 1, 10 s panes, retention 300 s. Both sides hold 46 windows. The window path's oldest window ends at1699998610000, push's at1699998670000. The windows the store must keep (ending after1699998900000) are the same on both sides.Fix (test only):
within_retentioncuts both sides to the windows the store keeps by retention. Those are the windows ending less thanretention_msbefore the view's newest window, plus the newest itself (the store'soldest_kept_endrule). These must match exactly. No window that recent is ever skipped or evicted, in either mode, so the check no longer depends on timing. Windows past retention are no longer compared. No query reads them, and neither mode has to keep them.Engine: no change. Eviction (
storage::storepush/oldest_kept_end) and expiry skipping (precompute::ingestionclose_windows) never drop a window within retention, and queries read only those.Since when: the test logic came with push precompute (feat(data_plane): tiered view storage, push precompute by default, faster Remote Write decode #864) and is the same on
origin/main. It passes there (2 of 2 runs,8263b22). In the layout stack it failed on every run (refactor: eval/scripts, eval/baselines and deployment Dockerfile (layout step 9) #8847862cb6, 2 of 2). The window logic did not change, so this is the timing of the old windows, not a regression. The fix fits in the PR that added T2. It is committed here because this is the stack's top.7862cb6,cd7ffef)5f7b20c)cargo test --workspacelooping alongside)How verified
After the re-pin to
566b35c(headc619f61), against #884659d53b:Gate (fmt, clippy
--workspace --all-targets -D warnings, fullcargo test --workspace,ulimit -n 65536): fmt and clippy clean; 236 passed, 0 failed, 3 ignored (56 suites), the same count as at5f7b20cand refactor: eval/scripts, eval/baselines and deployment Dockerfile (layout step 9) #884659d53b. T2 (push_precompute_stores_the_window_paths_view_rows) passed in the suite.Parity dump (fixture below): byte-identical to refactor: eval/scripts, eval/baselines and deployment Dockerfile (layout step 9) #884
659d53band to this PR'sf2da999head (65,517 B each).Benchmarks (release, one idle 40-core host, cores 0–15, refactor: eval/scripts, eval/baselines and deployment Dockerfile (layout step 9) #884 and this PR interleaved, 3 runs each):
659d53b566b35c)view_read_benchKLL, Pread cold (ns/row)view_read_benchKLL, Pread warm (ns/row)view_read_benchKLL, Mmap cold (ns/row)view_read_benchKLL, Mmap warm (ns/row)view_read_benchKLL, write (ns/row)decode_benchone series per sample (µs/sample)decode_bench100 samples per series (µs/sample)ingest_bench 10000 120 views 1 persist, persist-thread CPU (s)ingest_bench, all-thread CPU (s)f2da999(1,407 / 1,415 there), so the re-pin adds nothing; see the notes below.ingest_benchplans the same 15 views as atf2da999(11 at refactor: eval/scripts, eval/baselines and deployment Dockerfile (layout step 9) #884), so it is still not like for like with refactor: eval/scripts, eval/baselines and deployment Dockerfile (layout step 9) #884.At
f2da999(earlier, kept for reference):Gate (fmt, clippy
--workspace --all-targets -D warnings, fullcargo test --workspace,ulimit -n 65536):5f7b20c(rebased onto refactor: eval/scripts, eval/baselines and deployment Dockerfile (layout step 9) #884659d53b): 236 passed, 0 failed, 3 ignored. refactor: eval/scripts, eval/baselines and deployment Dockerfile (layout step 9) #884659d53balso has 236 passed and 3 ignored. The restack deletedstorage::boundaryand its tests, so the count is lower than before the rebase.cargo test --workspace -- --listmatch on both trees (243 each, including ignored), exceptstate_codec::tests::a_ten_sample_ddsketch_state_takes_47_compact_bytes, which is renamed..._23_compact_bytesfor the smaller DDSketch head.Parity dump against refactor: eval/scripts, eval/baselines and deployment Dockerfile (layout step 9) #884 (
659d53b, rerun after the rebase; also byte-identical against7862cb6before it), same fixture as steps 5–9 plus a DDSketch query:sum by (job) (sum_over_time(data[10s]));quantile_over_time(0.9, data[10s])with a 5% accuracy target.--no-forward, covering planned, cached, not-ready (after the barrier) and unplanned queries, Remote Write 400 and empty-body responses,/api/v1/status/asap, the unconfigured ClickHouse/Elasticsearch routes, and the/metricsnames and label sets.Benchmarks (measured before the rebase, against refactor: eval/scripts, eval/baselines and deployment Dockerfile (layout step 9) #884
7862cb6; release, one host, cores 0–15, base and new interleaved, 3 runs; runs 2–3 shown forview_read_benchbecause run 1 of the new tree was disturbed):view_read_benchKLL, Pread cold (ns/row)view_read_benchKLL, Pread warm (ns/row)view_read_benchKLL, Mmap cold (ns/row)view_read_benchKLL, Mmap warm (ns/row)view_read_benchKLL, write (ns/row)decode_benchone series per sample (µs/sample)decode_bench100 samples per series (µs/sample)ingest_bench 10000 120 views 1 persist, persist-thread CPU (s, 3 runs)ingest_bench, all-thread CPU (s, 3 runs)asap_sketchlib's KLLto_view_bytesalone (its source is identical in both revs) takes 264 vs 238 ns/state at01f3333vs355093f. That accounts for part of it.ingest_benchis not like for like. The new Planner plans its workload with 15 views instead of 11, so persisted bytes (5.90 → 6.11 MB per run) and CPU compare different plans. The new plan still spends less CPU.Reviews: four independent reviews (correctness and parity, layering and naming, dead code and duplication, efficiency).
plan_id/view_state_keyinquery_time_slot, a runtime install failure for plans with shared nodes;MAPPED_STATESconstant, renamedVIEW_STATES;Remote build and benchmark directories were deleted afterwards.
Design doc
docs/design/tiered-view-storage.md:README.md: the pin line.