-
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
*: fix a bug that update statement uses point get and update plan with different tblInfo (#54183) #54255
*: fix a bug that update statement uses point get and update plan with different tblInfo (#54183) #54255
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release-8.2 #54255 +/- ##
================================================
Coverage ? 55.9763%
================================================
Files ? 1639
Lines ? 606744
Branches ? 0
================================================
Hits ? 339633
Misses ? 243834
Partials ? 23277
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/test check-dev2 |
@zimulala: No presubmit jobs available for pingcap/[email protected] In response to this:
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-sigs/prow repository. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AilinKid, wjhuang2016 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 |
[LGTM Timeline notifier]Timeline:
|
Signed-off-by: crazycs520 <[email protected]>
Signed-off-by: crazycs520 <[email protected]>
Signed-off-by: crazycs520 <[email protected]>
This is an automated cherry-pick of #54183
What problem does this PR solve?
Issue Number: close #53634
Problem Summary:
Case
Init SQLs:
prepare statements:
run a statement:
begin;
do DDL:
When the DDL is in Write-Only state
exec statements:
Step4. using conn1
Check the result
select * from stock;
Statement execution order table
Conclusion
The update statement in step3 uses point get and update plan, but the tblInfo used by the two plans is inconsistent, resulting in incorrect data in real storage.
After executing step3. select statement, the stock is locked in
GetRelatedTableForMDL
, sostmt.tbls[i].Meta().Revision != newTbl.Meta().Revision
is false. It meansschemaNotMatch
is false. So we needn't toPreprocess
.tidb/pkg/planner/core/plan_cache.go
Lines 114 to 119 in d5b89f8
Step3. update statement using
tblName.TableInfo
(get it when preparing statements,cct_1
is public) innewPointGetPlan
.tidb/pkg/planner/core/point_get_plan.go
Line 1317 in d5b89f8
Step3. update statement using
t
gets fromis.TableByID(tbl.ID)
(cct_1
is write-only)tidb/pkg/planner/core/point_get_plan.go
Lines 1945 to 1950 in d5b89f8
What changed and how does it work?
Add the
Revision
field comparison oftbl
(get from txn infoschema) andnewTbl
to confirm whether reprocess is required.Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.