-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Conversation
Hi @zimulala. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. 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. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #54183 +/- ##
=================================================
- Coverage 72.8112% 56.3875% -16.4237%
=================================================
Files 1519 1642 +123
Lines 434856 614373 +179517
=================================================
+ Hits 316624 346430 +29806
- Misses 98607 244567 +145960
- Partials 19625 23376 +3751
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/ok-to-test |
ccd113f
to
376973b
Compare
Great to see the root cause is located and fixed! :) |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: qw4990, 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 |
In response to a cherrypick label: new pull request created to branch |
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <[email protected]>
Signed-off-by: ti-chi-bot <[email protected]>
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <[email protected]>
In response to a cherrypick label: new pull request created to branch |
Related issue: #51897 |
/cherry-pick release-6.5-20241009-v6.5.10 |
@Lloyd-Pottiger: new pull request created to branch 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 ti-community-infra/tichi repository. |
Signed-off-by: ti-chi-bot <[email protected]>
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.