Skip to content

Conversation

bb7133
Copy link
Member

@bb7133 bb7133 commented Nov 15, 2024

What problem does this PR solve?

Issue Number: close #53490

Problem Summary:

What changed and how does it work?

See #53490 (comment), for statement like:

with t_f as (
         select id,pid,name,'AAA' fullname from test.tt1 )
         update test.tt1 inner join t_f
         set tt1.fullname=t_f.fullname
         where tt1.id=t_f.id;

The privilege check for CTE in the update statement should be avoided.

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

Therocially it consumes more CPU to remove the privilege check, but I believe the real world performance will not be impacted.

Documentation

  • NA

Release note

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

Fix a wrong privilege check when using the `UPDATE` statement with CTE

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/needs-triage-completed sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed do-not-merge/needs-triage-completed labels Nov 15, 2024
Copy link

codecov bot commented Nov 16, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 73.4165%. Comparing base (bd20f66) to head (25798fd).
Report is 1 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #57430        +/-   ##
================================================
+ Coverage   72.8127%   73.4165%   +0.6038%     
================================================
  Files          1676       1676                
  Lines        463751     463793        +42     
================================================
+ Hits         337670     340501      +2831     
+ Misses       105205     102526      -2679     
+ Partials      20876      20766       -110     
Flag Coverage Δ
integration 43.4762% <83.3333%> (?)
unit 72.2244% <83.3333%> (+0.0105%) ⬆️

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

Components Coverage Δ
dumpling 52.7673% <ø> (ø)
parser ∅ <ø> (∅)
br 45.4468% <ø> (+0.0090%) ⬆️
---- 🚨 Try these New Features:

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 16, 2024
@hawkingrei hawkingrei requested a review from winoros November 16, 2024 10:57
select id,pid,name,'AAA' fullname from privilege__privileges.tt1 )
update privilege__privileges.tt1 inner join t_f
set t_f.fullname=t_f.fullname
where tt1.id=t_f.id;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please disconnect u53490 and switch to connection default.

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed, PTAL

@ti-chi-bot ti-chi-bot bot added the needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. label Nov 20, 2024
Copy link

ti-chi-bot bot commented Nov 21, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Defined2014, hawkingrei

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 Nov 21, 2024
Copy link

ti-chi-bot bot commented Nov 21, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-11-16 06:43:11.842919092 +0000 UTC m=+684154.033788085: ☑️ agreed by hawkingrei.
  • 2024-11-21 04:53:24.855017273 +0000 UTC m=+93792.474671790: ☑️ agreed by Defined2014.

@Defined2014
Copy link
Contributor

/retest

@ti-chi-bot ti-chi-bot bot merged commit 14ff938 into pingcap:master Nov 22, 2024
24 checks passed
@ti-chi-bot
Copy link
Member

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

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-8.5 Should cherry pick this PR to release-8.5 branch. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"ERROR 8121 (HY000): privilege check for 'Select' fail" occurs with an UPDATE statement that includes a CTE
4 participants