Skip to content

refactor: split scheduling facade and harden fallback paths (refactor #25451) - #25496

Merged
XuPeng-SH merged 6 commits into
mainfrom
refactor_schedule_phase3_0707
Jul 7, 2026
Merged

XuPeng-SH merged 6 commits into
mainfrom
refactor_schedule_phase3_0707

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

What this PR does / why we need it:

This PR refactors compile-side scheduling into a dedicated scheduler facade and hardens placement behavior around fallback and unhappy-path handling.

  • Split query scheduling logic out of compile.go into pkg/sql/compile/scheduler.go and extract scan scheduling helpers into pkg/sql/compile/scan_scheduler.go.
  • Harden query scheduling:
    • Add explicit local execution fallback when AP_MULTICN cannot route to any candidate CN.
    • Preserve deterministic CN order under AP_MULTICN (Addr sort) for stable CNCNT/CNIDX assignment.
    • Normalize invalid MCPUs to 1, filter unroutable CN candidates, and avoid blocking/wait side-effects.
    • Add bounded rate-limited log keys for query fallback events to avoid unbounded log growth.
  • Refine query placement reasons in pkg/sql/schedule/placement.go and add/adjust tests to cover no-candidate/required-local/no-worker scenarios.
  • Improve scan node generation robustness and tombstone collection behavior.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

This branch was previously deployed

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

Labels

kind/bug Something isn't working kind/enhancement kind/refactor Code refactor kind/test-ci size/XL Denotes a PR that changes [1000, 1999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Tech Request]: Intelligent Query Execution Scheduling

2 participants