-
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
*: infoschema compatibility with prepare #25080
Conversation
[REVIEW NOTIFICATION] This pull request has not been approved. To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Fixing tests |
I think we have an internal discussion for it, and it depends on the MDL feature in TiDB. |
@jackysp I'll pick another approach to fix instead. |
/unhold |
session/session.go
Outdated
ok, err = s.IsCachedExecOk(ctx, preparedStmt) | ||
|
||
var is infoschema.InfoSchema | ||
if preparedStmt.ForUpdateRead { |
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.
I think it's a bit risky currently to change the used schema version in transaction execution. Now the possible inconsistency issue bettwen the current read
and snapshot schema meta
is not resolved completely or it's worked around by a temprora index in https://github.com/pingcap/tidb/pull/22152/files. There are some implicit logic in tidb logic assuming the information schema is always consistent during the executions.
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.
No, it is not a change in this PR. It is a change introduced by #22381. I only extract the logic outside IsCachedExecOK
and optimize
, which is essentially a cleanup. I did nothing to the current logic of execution.
The real change is the removal of tk3
and InfoSchema: is
in ret := &PreprocessorReturn{InfoSchema: is}
. The removal of InfoSchema: is
will lead to the test error again, and the removal of tk3
fixed the test error by avoid concurrent DDL.
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.
The inforschema change for the cached plan short path is ok as it's only for autocommit point get read, the extraction may affect the common path in whch change inforschema version is risky.
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.
OK, it is not a must for me to change that anyway. It is reverted.
Signed-off-by: xhe <[email protected]>
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.
Current changes are not the same as what the pr body describes?
I have no idea why the the new one can take effect:joy:
Same, except that the refine part is removed. In short, I want to remove The cause for But it is actually not My previous PR unify most getters of infoschema to return the infoschema of the transaction, if it is in transactions. This infoschema of transction does not sync among others, and that breaks some tests assuming synchronisation of infoschema amomg multiple transactions. |
@xhebox: 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. |
Closed in favor of #26759 |
Signed-off-by: xhe [email protected]
What problem does this PR solve?
Problem Summary: #24613 has one workaround at
planner/core/common_plans.go:L268
. This PR removed it.How it works
As the new design in #24613, you should never write:
ret := &PreprocessorReturn{InfoSchema: is}
, the introduction of this new struct is to return something fromplanner.Preprocess()
without touching its API definition, instead of passing down something. But without that,TestPlanCacheSchemaChange
will fail.The failure of test is due to the incorrect infoschema. And you could blame the incorrectness to
concurrent DDL leads to stale infoschema in parallel transactions
.It is so hard to solve that we only workaround the problem for some of the cases. Like
prepare/execute
statements does not choose the correct infoschema forupdateRead
(even if there are no parallel transactions), so it picked up the wrong cached plan. #22381 is a workaround for this problem.I came up with the solution of returning the latest infoschema for pessimistic transaction, and it is a direct solution for
concurrent DDL and stale infoschema
problem. But it seems a little risky for @jackysp .So here is another solution, instead of solving the rock hard
concurrent DDL and stale infoschema
problem, the solution of #22381 is refined andconcurrent DDL for tk1 and tk3
in the test is manually removed. The test should be still effective,tk2
will responsible for the wantedSchemaChange
cases: there is stillconcurrent DDL for tk1 and tk2
.Release note