Publish storage routing from the physical plan - #713
Merged
Merged
Conversation
The physical-plan publication path passed `None` for storage routing, so a deployment planned through `compile-and-publish` installed no routing table. The backend then falls through to its default engine and archive-shape queries (`histogram_quantile`, `delta`, `deriv`, `absent`, `rate_post_hoc`, and `topk`/`count` without a matching sketch) miss. Only the legacy `POST /api/v1/plan` path emitted routing, via `emit_backend_storage_routing`. Derive routing from the compiled plan instead. `build_routing_entry` only ever needed the per-metric sketch algorithms, so it now takes those directly and `storage_routing_document` is the shared entry point. The `BackendStageConfig` emitters project onto it and the physical compiler accumulates algorithms while compiling aggregations, so both publication paths run one classifier over the same decisions. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This was referenced Sep 13, 2026
This was referenced Sep 13, 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.
Prerequisite for #703 item 18 (consolidating onto the ASAPPlanner path). Publishing the physical plan without routing is a live gap, independent of the consolidation.
Problem
compile_and_publish_physical_planpassesNonefor storage routing:So a deployment planned through
POST /api/v1/physical-plan/compile-and-publishinstalls no routing table, the backend falls through to its default engine, and archive-shape queries miss —histogram_quantile,delta,deriv,absent,rate_post_hoc, plustopk/countwhen no matching sketch was planned.Only the legacy
POST /api/v1/planpath emitted routing, throughemit_backend_storage_routinginemit/backend_push.rs.Fix
build_routing_entrynever needed aBackendStageConfig— it immediately projected one down to the per-metric sketch algorithms and classified from those. It now takes&[SketchAlgorithm]directly, andstorage_routing_documentis the shared entry point:BackendStageConfigemitters project onto it (legacy behaviour unchanged)PhysicalCompileraccumulates algorithms per metric while compiling aggregations and builds the document incompile(), exposed asPhysicalPlan::storage_routingBoth publication paths now run one classifier over the same planning decisions, so routing cannot drift from what was actually materialized. It also means the classifier survives the later removal of
BackendStageConfig.Testing
compiled_plan_routes_every_materialized_metricasserts the compiled plan routes every materialized metric and keeps a warm target on each entry.cargo +1.98.0 test -p control_plane --lib— 738 passed, 0 failed.cargo +1.98.0 check -p control_plane --all-targetsclean.Notes for #703 item 18
Two claims in the issue no longer hold on
main, found while scoping this:collector_idsis already optional.PhysicalDeploymentTarget::BackendLocalRemoteWriterequires it empty,DistributedCollectorsrequires it non-empty (main.rs:836-840).MonitorIntentthreads throughpost_typed_backend_for_role→push_documents_coupled→push_cumulative_entriesand is dropped there as_monitors(emit/backend_push.rs:399). It should be deleted with the legacy path, not ported.After this, storage routing is the last backend-facing behaviour the legacy path had and the physical path did not.
🤖 Generated with Claude Code