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

domain: record runaway and quarantine query #44654

Merged
merged 78 commits into from
Jun 18, 2023

Conversation

CabinfeverB
Copy link
Contributor

@CabinfeverB CabinfeverB commented Jun 13, 2023

What problem does this PR solve?

Issue Number: ref #43691

Problem Summary:

What is changed and how it works?

Persist the runaway query records in KV data by the admin table

Once identified or watched quarantined are recorded in mysql.RUNAWAY_QUERIES. mysql.QUARANTINED_WATCH only active watch are kept

Check List

Tests

  • Unit test

  • Integration test

  • Manual test (add detailed scripts or steps below)
    image
    image

  • 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

Connor1996 and others added 30 commits June 1, 2023 14:10
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@CabinfeverB
Copy link
Contributor Author

CabinfeverB commented Jun 17, 2023

seems stale quarantined watch record is not cleaned

Can we keep the history for now? Users can use select * from mysql.quarantined_watch where end_time >= now(); to query the active rules.

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@CabinfeverB
Copy link
Contributor Author

cc @glorv @nolouch

@Connor1996
Copy link
Member

seems stale quarantined watch record is not cleaned

Can we keep the history for now? Users can use select * from mysql.quarantined_watch where end_time >= now(); to query the active rules.

Is it temporary? otherwise I need to change the doc.

Copy link
Member

@Connor1996 Connor1996 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
Copy link

ti-chi-bot bot commented Jun 17, 2023

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

In response to this:

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.

@glorv
Copy link
Contributor

glorv commented Jun 17, 2023

/retest

@CabinfeverB
Copy link
Contributor Author

IMO, it's not temporary. What do u think? @glorv

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@CabinfeverB
Copy link
Contributor Author

/retest-required

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@@ -604,6 +604,31 @@ const (
KEY (create_time),
KEY (create_user));`

// CreateRunawayTable stores the query which is identified as runaway or quarantined because of in watch list.
CreateRunawayTable = `CREATE TABLE IF NOT EXISTS mysql.runaway_queries (
Copy link
Member

@nolouch nolouch Jun 17, 2023

Choose a reason for hiding this comment

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

Suggested change
CreateRunawayTable = `CREATE TABLE IF NOT EXISTS mysql.runaway_queries (
CreateRunawayTable = `CREATE TABLE IF NOT EXISTS mysql.tidb_runaway_queries (

I suggest using tidb_xxx as the name indicates tidb specific table.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1.

) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;`

// CreateQuarantineWatchTable stores the condition which is used to check whether query should be quarantined.
CreateQuarantineWatchTable = `CREATE TABLE IF NOT EXISTS mysql.quarantined_watch (
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 tidb_runaway_quarantined_watch

@glorv
Copy link
Contributor

glorv commented Jun 17, 2023

IMO, it's not temporary. What do u think? @glorv

As each quarantined query has a TLL, I think that means they should be GCed over time. We may treat them as logs, gc them after a period of time, e.g. after 30 days or so.

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@CabinfeverB
Copy link
Contributor Author

/test check-dev2

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jun 18, 2023
@ti-chi-bot ti-chi-bot bot added lgtm approved and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jun 18, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jun 18, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-06-18 07:42:34.845022903 +0000 UTC m=+503551.259626982: ☑️ agreed by nolouch.
  • 2023-06-18 08:02:48.089140563 +0000 UTC m=+504764.503744630: ☑️ agreed by glorv.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Jun 18, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Connor1996, glorv, nolouch, qw4990

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 merged commit 0f48433 into pingcap:master Jun 18, 2023
@CabinfeverB CabinfeverB deleted the resource_manager/runaway_record branch June 19, 2023 06:52
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants