-
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
ddl: Drop a local temporary table #26063
Conversation
…nto drop-local-temp-table
…nto drop-local-temp-table # Conflicts: # ddl/db_integration_test.go
executor/ddl.go
Outdated
} | ||
} | ||
// if all tables are local temporary, directly drop those tables. | ||
if len(s.Tables) == existsNum { |
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.
What if some are temporary tables while some are not?
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.
it would be handled in dropTableObject
, normal table would exec origin logic, local temp table handled singlely
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.
How about drop all the temp tables here, and dropTableObject
only drop normal tables?
It seems hard to keep the atomic of the drop statement, so the tables can be reordered.
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.
but if table not exists, it should rollback. and the local temp tables should not drop
executor/ddl.go
Outdated
} | ||
} | ||
|
||
if obt == tableObject && len(localTempTableList) > 0 { |
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.
This part is duplicate with DDLExec.Next
, why?
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 all tables are local temp table, it could be dropped directly, but if tables are consists of local temp and normal tables, it should check whether table exists, then drop it
executor/ddl.go
Outdated
} | ||
} | ||
// if all tables are local temporary, directly drop those tables. | ||
if len(s.Tables) == existsNum { |
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.
How about drop all the temp tables here, and dropTableObject
only drop normal tables?
It seems hard to keep the atomic of the drop statement, so the tables can be reordered.
@@ -2927,3 +2927,79 @@ func (s *testIntegrationSuite3) TestAvoidCreateViewOnLocalTemporaryTable(c *C) { | |||
tk.MustExec("create view vv as select * from v0") | |||
checkCreateView() | |||
} | |||
|
|||
func (s *testIntegrationSuite3) TestDropTemporaryTable(c *C) { |
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.
Try this: drop table normal_table, temp_table;
Where the normal_table doesn't exist, which leads to rollback.
I assume it's both OK that temp_table
exists or not.
/run-check_dev_2 |
@lcwangchao: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments. 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. |
[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: ccdd722
|
What problem does this PR solve?
Issue Number: see #24169
What is changed and how it works?
Proposal: Temporary Table
Check List
Tests
Release note