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

gc: Fix GcKeys task doesn't work when called with multiple keys (#11248) #11283

Merged
merged 3 commits into from
Nov 25, 2021

Conversation

ti-srebot
Copy link
Contributor

@ti-srebot ti-srebot commented Nov 8, 2021

cherry-pick #11248 to release-5.0
You can switch your code base to this Pull Request by using git-extras:

# In tikv repo:
git pr https://github.com/tikv/tikv/pull/11283

After apply modifications, you can push your change to this PR via:

git push git@github.com:ti-srebot/tikv.git pr/11283:release-5.0-68c7ecb41c8d

What problem does this PR solve?

Issue Number: close #11217

Problem Summary:

The problem is because gc_worker passes the range with z-prefixed keys to get regions in the range, whereas RegionInfoProvider actually accepts keys without z-prefixed. So it causes get_regions_in_range returns incorrect results leading to unexpected behavior of handling GcKeys task.

Apart from that, find two more bugs:

  • the implementation of gc_keys wrongly assume the start key and end key of region are z-prefixed
  • handle_get_regions_in_range doesn't returned all covered regions of the keys.

What is changed and how it works?

Proposal: xxx

What's Changed:

  • Add a wrapper RangeKey to remove confusing z-prefixed keys in RegionInfoProvider
  • Fix the the implementation of gc_keys
  • Fix handle_get_regions_in_range logic
  • Add a metrics to show how many mvcc deletion version is handled
    image

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Manual test: using an update heavy workload, and do select to trigger scan, the key_skipped_count(due to too many mvcc deleted versions left) is greatly reduced.

Before
image

After
image

Release note

Fix mvcc deletion may not be dropped by compaction filter GC 

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Nov 8, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • hicqu
  • yiwu-arbug

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-srebot
Copy link
Contributor Author

/run-all-tests

@ti-chi-bot ti-chi-bot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Nov 8, 2021
@ti-srebot ti-srebot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/bugfix This PR fixes a bug. type/cherry-pick Type: PR - Cherry pick labels Nov 8, 2021
@ti-srebot
Copy link
Contributor Author

@Connor1996 you're already a collaborator in bot's repo.

@ti-chi-bot ti-chi-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 8, 2021
@Connor1996 Connor1996 added this to the v5.0.5 milestone Nov 8, 2021
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 9, 2021
@MyonKeminta
Copy link
Contributor

MyonKeminta commented Nov 9, 2021

@yiwu-arbug The conflicts are not resolved yet in this PR, and the other PR for 5.1 branch.

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
* close tikv#11290 fix compaction guard panic on non-data key

Signed-off-by: Connor1996 <zbk602423539@gmail.com>

* add comment

Signed-off-by: Connor1996 <zbk602423539@gmail.com>
@ti-chi-bot ti-chi-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed do-not-merge/invalid-commit-message size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 10, 2021
@zhouqiang-cl zhouqiang-cl added the cherry-pick-approved Cherry pick PR approved by release team. label Nov 25, 2021
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
@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 Nov 25, 2021
@Connor1996
Copy link
Member

/merge

@ti-chi-bot
Copy link
Member

@Connor1996: 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: 6061b5d

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

/test

@ti-chi-bot ti-chi-bot merged commit 81b96eb into tikv:release-5.0 Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-approved Cherry pick PR approved by release team. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 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. type/bugfix This PR fixes a bug. type/cherry-pick Type: PR - Cherry pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants