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

pkg/parser: support SWITCH_GROUP syntax for runaway watch #54804

Merged
merged 6 commits into from
Sep 4, 2024

Conversation

JmPotato
Copy link
Member

@JmPotato JmPotato commented Jul 22, 2024

What problem does this PR solve?

Issue Number: ref #54434. Should merge after pingcap/kvproto#1254.

What changed and how does it work?

Add SWITCH_GROUP(<name>) syntax for runaway watch.

Check List

Tests

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

By QUERY WATCH ADD:

图片

图片

Release note

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

None

Copy link

ti-chi-bot bot commented Jul 22, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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 22, 2024
Copy link

tiprow bot commented Jul 22, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@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 25, 2024
@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 25, 2024
@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 26, 2024
@JmPotato JmPotato force-pushed the switch_group_runaway branch 2 times, most recently from cf16f00 to fc94505 Compare August 2, 2024 06:45
@JmPotato JmPotato force-pushed the switch_group_runaway branch 3 times, most recently from 5925721 to 8a7ba0a Compare August 7, 2024 12:35
@JmPotato JmPotato marked this pull request as ready for review August 7, 2024 12:35
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 7, 2024
@JmPotato
Copy link
Member Author

JmPotato commented Aug 7, 2024

/retest

Copy link

codecov bot commented Aug 7, 2024

Codecov Report

Attention: Patch coverage is 72.97297% with 30 lines in your changes missing coverage. Please review.

Project coverage is 56.7529%. Comparing base (e77d4a1) to head (bd7b88f).
Report is 1 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #54804         +/-   ##
=================================================
- Coverage   72.8344%   56.7529%   -16.0816%     
=================================================
  Files          1598       1748        +150     
  Lines        444284     627973     +183689     
=================================================
+ Hits         323592     356393      +32801     
- Misses       100778     246949     +146171     
- Partials      19914      24631       +4717     
Flag Coverage Δ
integration 39.4583% <2.7027%> (?)
unit 72.0134% <72.9729%> (+0.0641%) ⬆️

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

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

@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 Aug 19, 2024
@@ -480,38 +513,47 @@ func newRunawayChecker(
}

// BeforeExecutor checks whether query is in watch list before executing and after compiling.
func (r *RunawayChecker) BeforeExecutor() error {
func (r *RunawayChecker) BeforeExecutor() (string, error) {
Copy link
Member

Choose a reason for hiding this comment

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

How about BeforeExecutor(stmt Ctx)?

Copy link
Member Author

Choose a reason for hiding this comment

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

It can be, but introducing *stmtctx.StatementContext in RunawayChecker will have the circular dependency problem. Though we could use an interface like resourceGroupNameSetter to resolve this, it's also simple to just directly return the switch resource group here.

@@ -127,6 +148,7 @@ func (r *QuarantineRecord) GenInsertionStmt() (string, []any) {
params = append(params, r.WatchText)
params = append(params, r.Source)
params = append(params, r.Action)
params = append(params, r.GetSwitchGroupName())
Copy link
Member

Choose a reason for hiding this comment

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

Does action already contain the switch group name here?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, since r.Action of type rmpb.RunawayAction only contains the action type information, extending it in kvproto could cause backward compatibility issues. Therefore, I chose to add a new column to store the switch group name instead.

@JmPotato
Copy link
Member Author

JmPotato commented Sep 2, 2024

/cc @HuSharp @nolouch @glorv

PTAL, thx!

@glorv
Copy link
Contributor

glorv commented Sep 2, 2024

/retest

Copy link

ti-chi-bot bot commented Sep 3, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-09-03 06:41:26.034246855 +0000 UTC m=+340210.552299781: ☑️ agreed by nolouch.
  • 2024-09-03 08:23:22.567014551 +0000 UTC m=+346327.085067476: ☑️ agreed by glorv.

pkg/session/bootstrap.go Outdated Show resolved Hide resolved
@D3Hunter
Copy link
Contributor

D3Hunter commented Sep 4, 2024

/approve

for ddl/parser pkg

@JmPotato JmPotato force-pushed the switch_group_runaway branch 3 times, most recently from 1aca797 to 0fb089e Compare September 4, 2024 05:56
@HuSharp
Copy link
Contributor

HuSharp commented Sep 4, 2024

/retest-required

Copy link
Contributor

@GMHDBJD GMHDBJD left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@yudongusa yudongusa left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented Sep 4, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: D3Hunter, glorv, GMHDBJD, HuSharp, lcwangchao, nolouch, yudongusa, YuJuncen

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 the approved label Sep 4, 2024
Copy link

tiprow bot commented Sep 4, 2024

@JmPotato: 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
fast_test_tiprow bd7b88f link true /test fast_test_tiprow

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-sigs/prow repository. I understand the commands that are listed here.

@JmPotato
Copy link
Member Author

JmPotato commented Sep 4, 2024

/test unit-test

Copy link

tiprow bot commented Sep 4, 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

JmPotato commented Sep 4, 2024

/test unit-test

Copy link

tiprow bot commented Sep 4, 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 c9baef4 into pingcap:master Sep 4, 2024
24 of 25 checks passed
@JmPotato JmPotato deleted the switch_group_runaway branch September 4, 2024 17:01
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.

9 participants