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

session: add resource group name in stmt context #49422

Merged
merged 6 commits into from Dec 21, 2023

Conversation

glorv
Copy link
Contributor

@glorv glorv commented Dec 13, 2023

What problem does this PR solve?

Issue Number: ref #49318

Problem Summary:

What changed and how does it work?

In the current implementation, in order to support statement level hint /* +RESOURCE_GROUP(name) */ to execute a statement under specific resource group, we change the ResourceGroupName in session ctx during optimization and change back after the statement. This is currently done in the function session.ExecuteStmt(with a defer block). This life time may not be long enough as we have other operations such as query slow-log, query duration metrics, statement summary that depend on statement resource group but is run after session.ExecuteStmt is finished.

So this PR add a new field ResourceGroupName in StmtCtx and the /* Resource_Group() */ hint will change this filed isstead of directly change session context and this value can last until the next statement. The PR changes all statement related operation to use this field.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

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 size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 13, 2023
Copy link

tiprow bot commented Dec 13, 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.

@glorv
Copy link
Contributor Author

glorv commented Dec 13, 2023

/ok-to-test

@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 13, 2023
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 13, 2023
Copy link

codecov bot commented Dec 13, 2023

Codecov Report

Merging #49422 (3c92bc9) into master (161107a) will increase coverage by 0.8268%.
Report is 71 commits behind head on master.
The diff coverage is 76.3157%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #49422        +/-   ##
================================================
+ Coverage   71.0551%   71.8820%   +0.8268%     
================================================
  Files          1368       1423        +55     
  Lines        401291     431329     +30038     
================================================
+ Hits         285138     310048     +24910     
- Misses        96328     102419      +6091     
+ Partials      19825      18862       -963     
Flag Coverage Δ
integration 45.3374% <76.3157%> (?)
unit 71.0527% <ø> (-0.0024%) ⬇️

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

Components Coverage Δ
dumpling 53.9663% <ø> (ø)
parser ∅ <ø> (∅)
br 46.9363% <ø> (-5.9573%) ⬇️

@glorv
Copy link
Contributor Author

glorv commented Dec 14, 2023

/retest

1 similar comment
@glorv
Copy link
Contributor Author

glorv commented Dec 14, 2023

/retest

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

Copy link

ti-chi-bot bot commented Dec 20, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-12-19 15:31:27.871995357 +0000 UTC m=+974978.909222281: ☑️ agreed by nolouch.
  • 2023-12-20 06:23:06.476180107 +0000 UTC m=+1028477.513407031: ☑️ agreed by XuHuaiyu.

@easonn7
Copy link

easonn7 commented Dec 20, 2023

/approve

Copy link

ti-chi-bot bot commented Dec 20, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: easonn7, nolouch, tangenta, XuHuaiyu

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 Dec 20, 2023
@glorv
Copy link
Contributor Author

glorv commented Dec 20, 2023

/retest

3 similar comments
@glorv
Copy link
Contributor Author

glorv commented Dec 20, 2023

/retest

@glorv
Copy link
Contributor Author

glorv commented Dec 20, 2023

/retest

@glorv
Copy link
Contributor Author

glorv commented Dec 20, 2023

/retest

@CabinfeverB
Copy link
Contributor

/test pull-mysql-client-test

Copy link

tiprow bot commented Dec 21, 2023

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

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test pull-mysql-client-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/test-infra repository.

@ti-chi-bot ti-chi-bot bot merged commit b27587e into pingcap:master Dec 21, 2023
18 checks passed
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #51117.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Feb 18, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
glorv added a commit to ti-chi-bot/tidb that referenced this pull request Feb 19, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Apr 18, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.1: #52699.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-7.5 ok-to-test release-note-none size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants