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

executor: verify the existence of the resource group before switching #56145

Merged
merged 1 commit into from
Sep 22, 2024

Conversation

JmPotato
Copy link
Member

@JmPotato JmPotato commented Sep 19, 2024

What problem does this PR solve?

Issue Number: ref #54434.

What changed and how does it work?

Before switching, verify the existence of the resource group. If the specified resource group does not exist, take no action.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test

Before:

image

After:

image

Release note

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

None

Signed-off-by: JmPotato <ghzpotato@gmail.com>
@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 19, 2024
@JmPotato
Copy link
Member Author

@nolouch @glorv PTAL

Copy link

codecov bot commented Sep 19, 2024

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Project coverage is 56.6889%. Comparing base (d99d445) to head (7f0e886).
Report is 24 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #56145         +/-   ##
=================================================
- Coverage   72.9601%   56.6889%   -16.2713%     
=================================================
  Files          1611       1754        +143     
  Lines        447502     633131     +185629     
=================================================
+ Hits         326498     358915      +32417     
- Misses       100909     250488     +149579     
- Partials      20095      23728       +3633     
Flag Coverage Δ
integration 38.5170% <0.0000%> (?)
unit 72.7908% <0.0000%> (+0.7237%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.9567% <ø> (ø)
parser ∅ <ø> (∅)
br 52.9055% <ø> (+7.1136%) ⬆️

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.

do we need some tests?

@@ -555,7 +555,12 @@ func (a *ExecStmt) Exec(ctx context.Context) (_ sqlexec.RecordSet, err error) {
return nil, err
}
if len(switchGroupName) > 0 {
stmtCtx.ResourceGroupName = switchGroupName
group, err := rm.ResourceGroupCtl.GetResourceGroup(switchGroupName)
Copy link
Member

Choose a reason for hiding this comment

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

BTW, Have we already checked when setting up a non-existent group?

Copy link
Member Author

Choose a reason for hiding this comment

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

Considering that the records of QUERY WATCH and the resource group are decoupled, there is currently no check on the existence of the resource group when setting up. This allows for a more flexible configuration of QUERY WATCH and simplifies the code. Here are a few typical scenarios: we can set the corresponding resource group after adding SWITCH_GROUP; or after deleting a resource group, the corresponding runaway statements will not fail immediately.

@JmPotato
Copy link
Member Author

do we need some tests?

After trying, I found that the existing unit tests and integration tests could not test this situation well. I first completed the test manually and posted the test results in the PR description. PTAL.

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 20, 2024
Copy link

ti-chi-bot bot commented Sep 20, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: glorv, 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 lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 20, 2024
Copy link

ti-chi-bot bot commented Sep 20, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-09-20 08:35:07.940534368 +0000 UTC m=+1209377.680958304: ☑️ agreed by glorv.
  • 2024-09-20 09:47:05.943914819 +0000 UTC m=+1213695.684338758: ☑️ agreed by nolouch.

@JmPotato
Copy link
Member Author

/test unit-test

Copy link

tiprow bot commented Sep 20, 2024

@JmPotato: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test fast_test_tiprow
  • /test tidb_parser_test

Use /test all to run all jobs.

In response to this:

/test unit-test

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-sigs/prow repository.

@JmPotato
Copy link
Member Author

/test check-dev2

Copy link

tiprow bot commented Sep 21, 2024

@JmPotato: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test fast_test_tiprow
  • /test tidb_parser_test

Use /test all to run all jobs.

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-sigs/prow repository.

@JmPotato
Copy link
Member Author

/test pull-integration-ddl-test

Copy link

tiprow bot commented Sep 22, 2024

@JmPotato: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test fast_test_tiprow
  • /test tidb_parser_test

Use /test all to run all jobs.

In response to this:

/test pull-integration-ddl-test

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-sigs/prow repository.

@JmPotato
Copy link
Member Author

/test unit-test

Copy link

tiprow bot commented Sep 22, 2024

@JmPotato: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test fast_test_tiprow
  • /test tidb_parser_test

Use /test all to run all jobs.

In response to this:

/test unit-test

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-sigs/prow repository.

@ti-chi-bot ti-chi-bot bot merged commit 1acbbec into pingcap:master Sep 22, 2024
23 checks passed
@JmPotato JmPotato deleted the bypass_switch_invalid_group branch September 22, 2024 14:48
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/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants