Skip to content

feat(resourcemanager): load resource groups in the background #9336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JmPotato
Copy link
Member

What problem does this PR solve?

Issue Number: close #9335, ref #9296.

What is changed and how does it work?

Improves resource manager initialization by loading keyspace resource groups asynchronously in a background goroutine instead of blocking the leader startup process.

Check List

Tests

  • Unit test
  • Integration test

Release note

None.

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has signed the dco. labels May 21, 2025
Copy link
Contributor

ti-chi-bot bot commented May 21, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign qiuyesuifeng for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 21, 2025
go func() {
start := time.Now()
log.Info("start to load keyspace resource groups in the background")
if err := m.loadKeyspaceResourceGroups(start); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

This behavior is different from the old one if the background task failed(maybe due to IO errors). Silently omit the error may cause undefined behavior in some cases.

return err
}
// This operation is potentially time-consuming when there are many keyspaces and resource groups.
// So we run it in a new goroutine to prevent it from blocking the leader startup.
Copy link
Contributor

Choose a reason for hiding this comment

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

If we move it to the background, could you please add reporting of resource group loading to the /ready API as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/resource-control dco-signoff: yes Indicates the PR's author has signed the dco. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Load resource group will greatly affect availability of PD
3 participants