-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
planner: "for update" should not work in a single autocommit statement #11715
Conversation
LGTM |
Codecov Report
@@ Coverage Diff @@
## master #11715 +/- ##
===========================================
Coverage 81.4966% 81.4966%
===========================================
Files 432 432
Lines 93194 93194
===========================================
Hits 75950 75950
Misses 11839 11839
Partials 5405 5405 |
@@ -95,6 +95,9 @@ func (p *PointGetPlan) ExplainInfo() string { | |||
fmt.Fprintf(buffer, ", handle:%d", p.Handle) | |||
} | |||
} | |||
if p.Lock { | |||
fmt.Fprintf(buffer, ", lock") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you print more information about this lock
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests |
cherry pick to release-3.0 in PR #11736 |
What problem does this PR solve?
What is changed and how it works?
The bug is introduced in this PR #10972
The root cause of the panic is the mismatch of the life span between statement and executor.
We close the statement (or Txn in the auto-commit case) after
Execute
returns aRecordSet
.However,
RecordSet.Next
is still using the Txn, so the panic occurs.This fix is actually a workaround: change
select ... for update
statement to normalselect ...
statement in the auto-commit case.Check List
Tests
Related changes