Skip to content
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

parser,ddl: add background job syntax and meta management for resource control #45189

Merged
merged 9 commits into from
Jul 11, 2023

Conversation

glorv
Copy link
Contributor

@glorv glorv commented Jul 5, 2023

What problem does this PR solve?

Issue Number: ref #44517

Problem Summary:

What is changed and how it works?

Resource control add new syntax for background tasks management as following:

// Set background tasks
CREATE RESOURCE GROUP `rg1` ru_per_sec = 1000 BACKGROUND=(TASK_NAMES="br,lightning");
// change settings
ALTER RESOURCE GROUP `rg1` BACKGROUND = (TASK_NAMES="br");
// reset background tasks
ALTER RESOURCE GROUP `rg1` BACKGROUND = NULL;

NOTE: in the first phase, we only support changing the default resource group's background config.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 5, 2023
@tiprow
Copy link

tiprow bot commented Jul 5, 2023

Hi @glorv. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ti-chi-bot ti-chi-bot bot deleted a comment from ti-chi-bot Jul 5, 2023
}

DirectResourceGroupBackgroundOption:
"TASK_NAMES" EqOpt stringLit
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the task name an enumeration type? I find PD and TiDB won't check whether name is valid, user can't get feedback if the name is wrong.

Copy link
Contributor

@HuSharp HuSharp Jul 6, 2023

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

My main concern is that when setting the backgroup, if the user input is wrong, it will not report an error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a check in ddl api

@ti-chi-bot ti-chi-bot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 10, 2023
@ti-chi-bot ti-chi-bot bot deleted a comment from ti-chi-bot Jul 10, 2023
@ti-chi-bot ti-chi-bot bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 10, 2023
@glorv
Copy link
Contributor Author

glorv commented Jul 10, 2023

@CabinfeverB @HuSharp @nolouch PTAL again, thanks

@ti-chi-bot ti-chi-bot bot deleted a comment from ti-chi-bot Jul 10, 2023
Copy link
Member

@nolouch nolouch left a comment

Choose a reason for hiding this comment

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

lgtm

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jul 10, 2023
}
}
case ast.ResourceGroupBackground:
if groupInfo.Name.L != rg.DefaultResourceGroupName {
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed this restriction, so maybe need to update pr description?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a NOTE in the PR description.

Copy link
Contributor

Choose a reason for hiding this comment

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

oops, sorrrry! I must be blind!

ctx.WritePlain(", ")
}
if err := option.Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while splicing ResourceGroup Background Option")
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to unify error with ResourceGroupRunaway to expose i?

Suggested change
return errors.Annotatef(err, "An error occurred while splicing ResourceGroup Background Option")
return errors.Annotatef(err, "An error occurred while splicing ResourceGroup Background Option: [%v]", i")

ctx.WritePlain(" ")
}
if err := option.Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while splicing CreateResourceGroupStmt Option: [%v]", i)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return errors.Annotatef(err, "An error occurred while splicing CreateResourceGroupStmt Option: [%v]", i)
return errors.Annotatef(err, "An error occurred while splicing ResourceGroupRunaway Option: [%v]", i)

@ti-chi-bot ti-chi-bot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 11, 2023
Copy link
Contributor

@HuSharp HuSharp left a comment

Choose a reason for hiding this comment

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

merge master failed, rest LGTM!

@ti-chi-bot
Copy link

ti-chi-bot bot commented Jul 11, 2023

@HuSharp: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

merge master failed, reset LGTM!

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ti-chi-bot ti-chi-bot bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 11, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jul 11, 2023

@glorv: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-br-integration-test fe020f3 link true /test pull-br-integration-test

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@glorv
Copy link
Contributor Author

glorv commented Jul 11, 2023

/retest

@tiprow
Copy link

tiprow bot commented Jul 11, 2023

@glorv: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tiprow
Copy link

tiprow bot commented Jul 11, 2023

@glorv: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test check-dev2

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ti-chi-bot ti-chi-bot bot added the lgtm label Jul 11, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jul 11, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 3pointer, HuSharp, nolouch

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

The pull request process is described 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 approved and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jul 11, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jul 11, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-07-10 09:17:53.274943992 +0000 UTC m=+323565.045282708: ☑️ agreed by nolouch.
  • 2023-07-11 09:01:10.064715895 +0000 UTC m=+408961.835054607: ☑️ agreed by 3pointer.

@hawkingrei
Copy link
Member

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 11, 2023
@tiprow
Copy link

tiprow bot commented Jul 11, 2023

@glorv: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
tiprow_fast_test 7e5236f link true /test tiprow_fast_test

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@hawkingrei
Copy link
Member

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 11, 2023
@ti-chi-bot ti-chi-bot bot merged commit 43763d2 into pingcap:master Jul 11, 2023
3 checks passed
@glorv glorv deleted the background-meta branch July 11, 2023 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants