-
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
*: add TestLocalTemporaryTableInfoSchema to store local temporary table schemas #25518
Conversation
infoschema/infoschema.go
Outdated
type LocalTemporaryTable struct { | ||
table.Table | ||
Schema *model.DBInfo | ||
} | ||
|
||
type localTempSchemaTables struct { | ||
tables map[string]*LocalTemporaryTable | ||
} | ||
|
||
// localTemporaryTableInfoSchema implements LocalTemporaryTableInfoSchema | ||
type localTemporaryTableInfoSchema struct { | ||
schemaMap map[string]*localTempSchemaTables | ||
idx2table map[int64]*LocalTemporaryTable | ||
} |
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.
Any reasons why not reuse infoSchema
and schemaTables
?
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.
If we drop a database and then create a now one with a same name in a single session, it can happens that two temporary tables belong to different databases but with the same name. Though it works well when using schemaTables because db information for local temporary table is not very useful, but it is clear to present the real situation to store a dbinfo in each table.
Another reason why not using infoSchema is that it is immutable and has many method we do not need (we also need to add some methods such as AddTable or RemoveTable), it more simple to define a new structure.
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.
Define another LocalTemporaryTableInfoSchema
interface is unnecessary.
It's easy to override the InfoSchema
interface providing a different implementation.
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.
@tiancaiamao I'm ok to remove interface LocalTemporaryTableInfoSchema and override InfoSchema. But because session use function GetInfoSchema to get a final infoschema instead of just getting it from TxnCtx, I should rethink how to store it in the sessionvars
… localtempinfoschema
It's more complex than necessary but it lack something... |
[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: bb4ddb0
|
@lcwangchao: Your PR was out of date, I have automatically updated it for you. At the same time I will also trigger all tests for you: /run-all-tests If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. 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. |
What problem does this PR solve?
see #24169
add TestLocalTemporaryTableInfoSchema to store local temporary table schemas
What is changed and how it works?
Introduce TestLocalTemporaryTableInfoSchema to store store local temporary table schemas
Related changes
Check List
Tests
Side effects
Release note