Conversation
zzylol
force-pushed
the
stack/528-14-raw-latency
branch
from
October 3, 2026 04:08
902d3b5 to
a331146
Compare
zzylol
force-pushed
the
stack/528-13-summary-merge
branch
from
October 3, 2026 04:08
5f2b829 to
5391107
Compare
This was referenced Oct 3, 2026
zzylol
marked this pull request as draft
October 3, 2026 19:28
Contributor
Author
|
Parked as draft: PR priorities changed (see #528). Order is now (A) finish #511 operator sharing, (B) the #572 crate/module reorganization, (C) #509 end-to-end stages. This PR sits on the old 🤖 Generated with Claude Code |
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.
Problem: raw recomputation bypasses the response-latency bound
#509 §3 Plan selection:
The rule applies to every candidate, including the exact (no-summary) one. #509 Example 1, Stage 3 uses exactly this case: "Its cost model estimates Q2's latency against the 100 ms bound; for example, an exact top 10 rebuilt from one million series at every refresh may miss it." In #509 Example 4 Pattern B, B2 (rescan raw data on each read) is one of the candidates selection compares.
#554 added the latency check for summary lifecycle alternatives only. Raw recomputation was still compared on amortized cost alone. Two failures follow, both with this workload and a deployment cost model:
quantile_over_time(0.99, lat[5m])EphemeralExceedsLatencyBound). Final assembly then falls back to raw recomputation, which is just as slow, and planning succeeds with a plan that misses the bound.Scope. This PR completes the latency-bound part of #509 §3 for the raw (exact) alternative in lifecycle selection. It leaves out: per-candidate reasons for valid plans that lose selection (#526 part 2), latency of anything other than the original query executed once, and any built-in latency estimate.
Proposed method
All changes are in the lifecycle stage (
crates/asap-aware-mapping/src/summary_maintenance_lifecycle.rs), at the two points where raw recomputation is compared with summaries.CostModel::raw_query_response_latency_ms(target) -> Option<f64>: the latency of executing the original query once. It is separate fromraw_query_recompute_total_cost, because a plan that is cheap over the horizon can still miss a per-response deadline. DefaultNone.raw_response_latency_violation(target, demand, cost_model) -> Option<(bound_ms, estimate_ms)>:ExplicitMaxMsover the workload entries indemand.entry_indices; if none, returnNone(no check);None, returnNone(unchecked, as in feat(planner): enforce summary response latency bounds #554);global_selection_with_summary_maintenance_lifecycles). Before, the comparison was atomic: if raw cost was unknown, no summary override was recorded. Now:plan_assembled_dag). If raw violates the bound:summary_total_costisNone): returnNoLatencyFeasiblePlan { bound_ms, estimate_ms };Key code interfaces
crates/asap-aware-mapping/src/cost_model.rscrates/asap-aware-mapping/src/summary_maintenance_lifecycle.rsplan_assembled_dagreturnsSummaryMaintenanceLifecycleAssemblyError; the new variant reaches it through.into(), andMajorPassreports it asOptimizeError::LifecycleAssembly.Fields
CostModel::raw_query_response_latency_mstarget&OperatorNodeOption<f64>None= no estimate, bound unchecked. A non-finite or negative value counts as a violation.Implemented by the deployment's cost model. The default (and
DefaultCostModel) returnsNone.SummaryMaintenanceLifecyclePlanError::NoLatencyFeasiblePlanbound_msf64ExplicitMaxMsamong the target's consuming workload entriesestimate_msf64Returned only by final assembly, when raw violates the bound and no costed summary alternative is left (or raw was selected).
raw_response_latency_violation(private)targetdemand: WorkloadDemandworkload+data_workload+entry_indices; onlyworkloadandentry_indicesare read, to find the boundcost_modelSome((bound_ms, estimate_ms))NoneExamples
Both tests are in
crates/planner/tests/summary_sharing.rsand use the workload above. Test cost model:FixedCosts { build: 100.0, raw_per_read: 0.01, latency_estimates: true }. Itsraw_query_response_latency_msreturns 250 ms; itssummary_read_latency_ms(from #554) returns 250 ms forEphemeraland 50 ms otherwise.1. Cheap slow raw cannot win.
slow_cheap_raw_recompute_cannot_bypass_the_response_bound:ALL).Ephemeralis rejected by feat(planner): enforce summary response latency bounds #554; a 50 ms lifecycle stays legal.selected_raw_recompute == falseandsummary_total_cost.is_some().2. Only raw is left.
slow_raw_only_query_reports_no_latency_feasible_plan:PlanningModels::builtin().with_cost(&costs).with_capabilities(...)with onlysupports_ephemeral = true.Ephemeral(250 ms) is rejected, so no summary alternative has a cost. Raw (250 ms) violates the bound.e2e_planreturns an error whose text contains"no latency-feasible plan".NoneNoLatencyFeasiblePlan(test 2)Note the asymmetry with #554: an invalid summary estimate is treated as "no estimate", while an invalid raw estimate is treated as a violation.
Out of scope
Stack and validation
Legacy physical stack: … ← #554 ← #555 ← #556 ← #557 … · Base: #555 (
stack/528-13-summary-merge) · Next: #557 · Tracker: #528Part of #526 (latency bounds; follows #554). Documented in
docs/develop_docs/operator-design-acceptance.md("Planner-layering follow-up: raw response latency").Validation: both new public-planner E2E regressions fail before the fix and pass afterward; planner and mapping suites (524 tests passed); formatting; Clippy for planner and mapping, all targets, warnings denied.
🤖 Generated with Claude Code