Skip to content
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: do not send snapshot request for (batch) point get on temporary table #24804

Merged
merged 5 commits into from
May 25, 2021

Conversation

tiancaiamao
Copy link
Contributor

What problem does this PR solve?

An optimization, continue with #24769, this PR optimize the point get code path.

What is changed and how it works?

For the temporary table, we do not need to send request to the TiKV.
This PR handle the [batch] point get code path.

What's Changed:

If the batch/ point get is on a temporary table, let the snapshot.get() return directly, without sending request to TiKV.

How it Works:

Global temporary table is always empty, so snapshot.get() on it is pointless. We can save a network round trip for those operations.

Check List

Tests

  • Unit test

Release note

  • No release note

@tiancaiamao tiancaiamao requested a review from a team as a code owner May 20, 2021 11:23
@tiancaiamao tiancaiamao requested review from qw4990 and removed request for a team May 20, 2021 11:23
@ti-chi-bot ti-chi-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 20, 2021
@tiancaiamao tiancaiamao mentioned this pull request May 20, 2021
89 tasks
@github-actions github-actions bot added the sig/execution SIG execution label May 20, 2021
Comment on lines 388 to 391
// Global temporary table is always empty, so no need to send the request.
if e.tblInfo.TempTableType == model.TempTableGlobal {
return nil, nil
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about move this part before the PointGetCache block? Do temporary tables support point get cache?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not support PointGetCache for temporary table.
That is meaningless: temporary table is in-memory already, so why should we use a another cache to complicate the problem without improving performance?

@@ -145,6 +149,16 @@ func (e *BatchPointGetExec) Open(context.Context) error {
return nil
}

// Global temporary table would always be empty, so get the snapshot data of it is meanless.
// globalTemporaryTableSnapshot inherits kv.Snapshot and override the BatchGet methods to return empty.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not skip kv request just like other operators (such as point get)? It's very strange to do it in a different way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just because the code is different.
There is no such single line of change in BatchPointGet.

@djshow832
Copy link
Contributor

/lgtm

@ti-chi-bot
Copy link
Member

@djshow832: Thanks for your review. The bot only counts /lgtm from reviewers and higher roles in list, but you're still welcome to leave your comments.

In response to this:

/lgtm

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.

@djshow832 djshow832 added the sig/sql-infra SIG: SQL Infra label May 25, 2021
@djshow832
Copy link
Contributor

/lgtm

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 25, 2021
@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • djshow832
  • qw4990

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 25, 2021
@qw4990
Copy link
Contributor

qw4990 commented May 25, 2021

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 34a0edd

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label May 25, 2021
@ti-chi-bot
Copy link
Member

@tiancaiamao: 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.

@ti-chi-bot ti-chi-bot merged commit 045e18f into pingcap:master May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution sig/sql-infra SIG: SQL Infra size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants