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

*: support batch create/drop bindings from plan/sql digest #55315

Merged
merged 21 commits into from
Aug 12, 2024

Conversation

time-and-fate
Copy link
Member

@time-and-fate time-and-fate commented Aug 8, 2024

What problem does this PR solve?

Issue Number: close #55343

What changed and how does it work?

  • Parser
    • Introduce StringLitOrUserVariableList syntax and corresponding struct StringOrUserVar data type.
    • Change the input of "create from plan digest" and "drop for SQL digest" from stringLit to StringLitOrUserVariableList.
  • Planner
    • Split struct SQLBindPlan into struct SQLBindPlan and struct SQLBindOpDetail, and make one SQLBindPlan able to contain multiple SQLBindOpDetail. (common_plans.go)
    • Add collectStrOrUserVarList() to translate []*ast.StringOrUserVar into []string. (planbuilder.go)
    • Extract constructSQLBindOPFromPlanDigest() from buildCreateBindPlanFromPlanDigest(). (planbuilder.go)
    • Make buildCreateBindPlanFromPlanDigest() and buildDropBindPlan() able to handle input from []*ast.StringOrUserVar, which means multiple digests. (planbuilder.go)
  • Executor
    • Switch to use struct SQLBindOpDetail accordingly as stated above.
    • Switch to the new /bindinfo interface as stated below.
  • /bindinfo
    • Input for CreateGlobalBinding(): binding Binding -> bindings []*Binding
    • Input for DropGlobalBinding(): sqlDigest string -> sqlDigests []string
    • Input for CreateSessionBinding(): binding Binding -> bindings []*Binding
    • Input for DropSessionBinding(): sqlDigest string -> sqlDigests []string

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 do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 8, 2024
Copy link

codecov bot commented Aug 8, 2024

Codecov Report

Attention: Patch coverage is 78.89610% with 65 lines in your changes missing coverage. Please review.

Project coverage is 74.6768%. Comparing base (6a34088) to head (7cb79d1).

Current head 7cb79d1 differs from pull request most recent head 404ccdf

Please upload reports for the commit 404ccdf to get more accurate results.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #55315        +/-   ##
================================================
+ Coverage   72.9273%   74.6768%   +1.7495%     
================================================
  Files          1575       1575                
  Lines        440127     440566       +439     
================================================
+ Hits         320973     329001      +8028     
+ Misses        99454      91334      -8120     
- Partials      19700      20231       +531     
Flag Coverage Δ
integration 49.3312% <57.4675%> (?)
unit 71.8199% <78.8961%> (-0.1635%) ⬇️

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

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

@time-and-fate time-and-fate changed the title *: [WIP] support batch create binding from plan digest *: support batch create binding from plan digest Aug 9, 2024
@time-and-fate time-and-fate changed the title *: support batch create binding from plan digest *: support batch create/drop bindings from plan/sql digest Aug 9, 2024
@easonn7
Copy link

easonn7 commented Aug 9, 2024

/approve

@winoros
Copy link
Member

winoros commented Aug 9, 2024

/hold for two approve from planner

@ti-chi-bot ti-chi-bot bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. and removed do-not-merge/needs-linked-issue labels Aug 9, 2024
@time-and-fate
Copy link
Member Author

/retest

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

ti-chi-bot bot commented Aug 12, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-08-12 08:13:39.2496647 +0000 UTC m=+169303.953134367: ☑️ agreed by qw4990.
  • 2024-08-12 09:32:20.366478911 +0000 UTC m=+174025.069948570: ☑️ agreed by tangenta.

Copy link

ti-chi-bot bot commented Aug 12, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: easonn7, qw4990, tangenta, winoros

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

@time-and-fate
Copy link
Member Author

/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 Aug 12, 2024
@ti-chi-bot ti-chi-bot bot merged commit 1f40cb0 into pingcap:master Aug 12, 2024
23 checks passed
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. sig/planner SIG: Planner 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.

Support batch operation for creating/dropping binding by specifying digests
5 participants