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

executor: fix SelectForUpdate in decorrelated subquery under pessimistic mode #22372

Closed
wants to merge 1 commit into from
Closed

executor: fix SelectForUpdate in decorrelated subquery under pessimistic mode #22372

wants to merge 1 commit into from

Conversation

lysu
Copy link
Contributor

@lysu lysu commented Jan 12, 2021

Signed-off-by: lysu [email protected]

What problem does this PR solve?

Issue Number: close #22345

Problem Summary:

just as issue described, we need handle pessimistic error when SFU in decorrelated subquery

What is changed and how it works?

What's Changed, How it Works::

  • refactor (a *ExecStmt) handlePessimisticLockError to handlePessimisticLockError without change logic
  • call it in EvalSubqueryFirstRow

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test

Side effects

  • n/a

Release note

  • Fix SelectForUpdate in decorrelated subquery return unexpected WriteConflictError under pessimistic mode

This change is Reviewable

@lysu lysu added the type/bugfix This PR fixes a bug. label Jan 12, 2021
@lysu lysu requested a review from a team as a code owner January 12, 2021 16:37
@lysu lysu requested review from lzmhhh123 and removed request for a team January 12, 2021 16:37
@github-actions github-actions bot added sig/execution SIG execution sig/sql-infra SIG: SQL Infra labels Jan 12, 2021
@ichn-hu ichn-hu mentioned this pull request Jan 13, 2021
@lysu lysu requested review from you06 and cfzjywxk January 13, 2021 02:36
@cfzjywxk
Copy link
Contributor

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Jan 13, 2021
if err != nil {
return nil, err
}
if chk.NumRows() == 0 {
return nil, nil
for {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it execute the whole query inside EvalSubqueryFirstRow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO, it only execute subplan subquery for example:

select v from t where id = 1 for update of select (select v from t where id = 1 for update) v1, (select v from t where id = 2) from dual

Copy link
Contributor

@you06 you06 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-srebot
Copy link
Contributor

@you06, Thanks for your review. The bot only counts LGTMs from Reviewers and higher roles, but you're still welcome to leave your comments. See the corresponding SIG page for more information. Related SIGs: execution(slack),sql-infra(slack).

@ti-srebot
Copy link
Contributor

@youjiali1995, Thanks for your review. The bot only counts LGTMs from Reviewers and higher roles, but you're still welcome to leave your comments. See the corresponding SIG page for more information. Related SIGs: execution(slack),sql-infra(slack).

@youjiali1995 youjiali1995 requested a review from a team January 27, 2021 07:31
@ti-chi-bot
Copy link
Member

@lysu: PR needs rebase.

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 added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 21, 2021
@wshwsh12 wshwsh12 removed the request for review from a team June 4, 2021 11:01
@lzmhhh123 lzmhhh123 removed their request for review June 28, 2021 02:38
@lysu lysu closed this Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. sig/execution SIG execution sig/sql-infra SIG: SQL Infra status/LGT1 Indicates that a PR has LGTM 1. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Select For Update" in decorrelated subquery return WriteConflictError in pessimistic mode
6 participants