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

storage: avoid repeating unnecessary checks on flashback keys #13801

Merged
merged 5 commits into from Nov 16, 2022

Conversation

JmPotato
Copy link
Member

@JmPotato JmPotato commented Nov 15, 2022

Signed-off-by: JmPotato ghzpotato@gmail.com

What is changed and how it works?

Issue Number: ref #13800.

What's Changed:

- A tiny refactor to `flashback_to_version_read_write` to reduce the unnecessary checks on flashback keys.
- Check the flashback state while validating the local read request to not let a flashback read phase request bypass.

Check List

Tests

  • Unit test
  • Integration test

Release note

None.

Signed-off-by: JmPotato <ghzpotato@gmail.com>
@JmPotato
Copy link
Member Author

/cc @sticnarf @Connor1996

Please help take a look, thx.

Signed-off-by: JmPotato <ghzpotato@gmail.com>
Signed-off-by: JmPotato <ghzpotato@gmail.com>
Comment on lines 586 to 588
let should_skip = (cur_key.is_some() && cur_key.clone().unwrap() == user_key)
|| !filter(&user_key, commit_ts);
cur_key = Some(user_key.clone());
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you optimize some clones here?

(cur_key.as_ref() == Some(&user_key)) can void the first clone. And we may not assign to cur_key if cur_key equals to user_key.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed. Thanks for the advice.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Nov 15, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Connor1996
  • sticnarf

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 submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added the status/LGT1 Status: PR - There is already 1 approval label Nov 15, 2022
Signed-off-by: JmPotato <ghzpotato@gmail.com>
Copy link
Member

@Connor1996 Connor1996 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot added status/LGT2 Status: PR - There are already 2 approvals and removed status/LGT1 Status: PR - There is already 1 approval labels Nov 15, 2022
@sticnarf
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

@sticnarf: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and 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.

If you have any questions about the PR merge process, please refer to pr process.

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
Copy link
Member

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

Commit hash: 213fb04

@ti-chi-bot ti-chi-bot added the status/can-merge Status: Can merge to base branch label Nov 16, 2022
@ti-chi-bot
Copy link
Member

@JmPotato: 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 fca5a9e into tikv:master Nov 16, 2022
@ti-chi-bot ti-chi-bot added this to the Pool milestone Nov 16, 2022
@JmPotato JmPotato deleted the refine_flashback_commit_ts_check branch November 16, 2022 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none size/L status/can-merge Status: Can merge to base branch status/LGT2 Status: PR - There are already 2 approvals
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants