fix: plan each root's lifecycle against its own entries - #513
Merged
Merged
Conversation
MajorPass bound every root's lifecycle assembly to all workload entries, so a root's expected reads, accuracy targets and prepared-state eligibility were the whole workload's. Selection already costs each target against the entries whose roots reach it; assembly now uses the same binding (`workload_entries_by_target`), so roots shared by several entries still see all of them and unrelated queries no longer amortize each other's state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
When MajorPass assembled each root, it planned that root's summary-maintenance lifecycle against all workload entries (
0..len). So each root's expected reads, accuracy targets and prepared-state eligibility were those of the whole workload. Selection already costs each target only against its own entries, so assembly disagreed with it.What
Assembly now uses the same per-target entry binding as selection (
workload_entries_by_target). A root shared by several entries still sees all of them.Before / After
Example: one query read every minute and an unrelated query read every ten minutes, over one hour. Expected reads per plan go from
[66, 66]to[60, 6].Validation
each_plan_counts_only_its_own_entries_reads(crates/planner/tests/e2e_plan.rs).cargo fmt --check, clippy with-D warnings, and the MetricsQL baseline. The full workspace test run is in progress locally and in CI.This is a prerequisite for sharing summaries across queries (logical Pass 2 in #509): a shared summary's cost is only right if each root's demand is right.
🤖 Generated with Claude Code