Skip to content

fix(queryplanner): fix metadata query routing to multiple partitions - #2130

Open
bhavanap1131-cmd wants to merge 7 commits into
filodb:developfrom
bhavanap1131-cmd:multiple_partitions
Open

fix(queryplanner): fix metadata query routing to multiple partitions#2130
bhavanap1131-cmd wants to merge 7 commits into
filodb:developfrom
bhavanap1131-cmd:multiple_partitions

Conversation

@bhavanap1131-cmd

@bhavanap1131-cmd bhavanap1131-cmd commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

Pull Request checklist

  • The commits messages follow the contribution CONTRIBUTING.md
  • Tests for the changes have been added for bug fixes
  • Docs have been added and updated for bug fixes

Current behavior:

Metadata queries (LabelValues, SeriesKeysByFilters, LabelNames, etc.) in MultiPartitionPlanner were
unconditionally routed through getMetadataPartitions (legacy fallback path), regardless of whether the
shard-key filters were sufficient for direct partition routing. SeriesKeysByFilters plans were also not
handled correctly since their filters are stored directly on the plan node rather than on RawSeries
leaves.

New behavior:

Introduced resolveMetadataPartitions which routes directly via getPartitions when all shard-key filters
are present and Equals, falling back to getMetadataPartitions otherwise. SeriesKeysByFilters plans are
now handled explicitly. Test coverage added in MultiPartitionPlannerSpec for all routing conditions
across both plan types. Broken and misplaced tests removed from PlannerHierarchySpec.

Other information:

  • Removed three tests from PlannerHierarchySpec that invoked MultiPartitionPlanner directly without
    processMultiPartition = true -- the partition provider was never called. Behaviour is covered in
    MultiPartitionPlannerSpec.

@amolnayak311 amolnayak311 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the connections given in https://github.com/filodb/FiloDB/blob/develop/CONTRIBUTING.md and update the PR title, and provide the summary of the changes

@alextheimer

Copy link
Copy Markdown
Contributor

@bhavanap1131-cmd Please confirm all review comments are adequately addressed before requesting further reviews.

Comment thread core/src/main/scala/filodb.core/query/QueryConfig.scala Outdated

@alextheimer alextheimer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huge thanks for all the iteration @bhavanap1131-cmd
This PR can be merged after this one last comment is addressed.

@bhavanap1131-cmd bhavanap1131-cmd changed the title Metadata_queries routed to multiple partitions Title: fix(queryplanner): fix metadata query routing to multiple partitions Apr 14, 2026
@amolnayak311 amolnayak311 changed the title Title: fix(queryplanner): fix metadata query routing to multiple partitions fix(queryplanner): fix metadata query routing to multiple partitions Apr 14, 2026
- Add resolveMetadataPartitions with fallback to getMetadataPartitions
  when shard key filters are non-Equals or useLegacyMetadataRouting is set
- Pass TaskWorkUnit to PartitionAssignment
- Add tests for fallback routing in MultiPartitionPlannerSpec
- Add useLegacyMetadataRouting config to QueryConfig/RoutingConfig

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@alextheimer alextheimer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like some tests are still missing. What about should not throw for regex filters on shard keys in metadata queries? That is mentioned in a comment just prior to the force-push.

Couple other tests that look like they are missing (just a few I see in the PR comments):

  • should use getPartitions directly when a shard-key filter is missing
  • should fallback to getMetadataPartitions when one shard-key filter is regex
  • should handle non-equals filters gracefully in getPartitions delegation

There might be others, too. I would recommend using git reflog to find the state of the repo immediately prior to this commit. You can open a separate PR with that state, and I'll take a look. If that looks good, we can hard-reset the state of the original PR to that branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants