-
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
executor: avoid distsql request for TableReader/IndexReader/IndexLookup on temporary table #24769
Conversation
…up on temporary table
PTAL @djshow832 @qw4990 |
@@ -196,6 +196,10 @@ type IndexReaderExecutor struct { | |||
|
|||
// Close clears all resources hold by current object. | |||
func (e *IndexReaderExecutor) Close() error { | |||
if e.table != nil && e.table.Meta().TempTableType != model.TempTableNone { |
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 implementing a new function in table/table.go
for the logic about checking whether the table is a TmpTable?
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.
In general, we do not need to check e.table != nil
.
It's special here because a test case construct the IndexReaderExecutor
manually and don't set e.table
field.
The remain part is e.table.Meta().TempTableType != model.TempTableNone
.
Define a one line function for that does not seems beneficial: the change will introduce a new exported function without simplifying the code much.
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.
Almost LGTM, please address comments.
Please refer the pull request to its issue #24169 and it would be better if we create a dedicated sub-issue for this pr. |
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.
LGTM
[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 |
A data race is detected... I need to fix it. |
/merge cancel |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: daaf042
|
/run-integration-ddl-test |
What problem does this PR solve?
Problem Summary:
For the global temporary table, we use
UnionScan
on an empty table to read the data.The temporary table data are actually stored in the transaction's membuffer.
Before this PR, although the result is always empty, we still send the distsql requests to the TiKV.
This PR is an optimization to avoid that.
What is changed and how it works?
What's Changed:
Do not send distsql request for TableReader/IndexReader/IndexLookup on temporary table
How it Works:
After the
kv
range is calculated, return immediately, without sending distsql request or fetching the result.Check List
Tests
Release note