-
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
executor: set the txn provider before building plan in 'show columns' #36540
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
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. |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 5303ab7
|
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/5303ab7a754374a8ec30f3a70f4c7cc7ecd7ba5e |
/hold |
The issue will be closed by #36613. |
What problem does this PR solve?
Issue Number: close #36426.
Problem Summary:
The problem is from txnManager's "context provider not set". Here is the stack trace:
To get the accurate field types of a view, we need to build a plan for the SQL in the view(see
tryFillViewColumnType
). An internal session is used to build the plan to prevent concurrent access to the same sesssion(this can happen in join scenarios, see #32459).The transaction context is not needed in normal cases. However, for the views that contain scalar subquery, an executor is built and run for the scalar subquery evaluation, which requires a
startTS
from the transaction. Because no transaction is set before using the system session, the error "context provider not set" occurs.What is changed and how it works?
We can solve the issue by setting up a new transaction before using the internal session.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.