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

gcworker: fix gc miss locks when region merged during scanning & resolving locks (#22252) #22266

Merged
merged 2 commits into from
Jan 11, 2021

Conversation

ti-srebot
Copy link
Contributor

@ti-srebot ti-srebot commented Jan 7, 2021

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

# In tidb repo:
git pr 550915918

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

git push git@github.com:ti-srebot/tidb.git pr/550915918:ti-srebot:release-3.0-bedd599e06c6-009f8c5c9568

Signed-off-by: lysu sulifx@gmail.com

What problem does this PR solve?

Issue Number: close #22245

Problem Summary:

just as TestResolveLockRangeMeetRegionEnlargeCausedByRegionMerge

  1. region1 with lock1, lock2 and region2 with lock3, lock4
  2. gc scan region1 and get lock1, lock2
  3. region2 merged into region1(so now region1 will have lock1, lock2, lock3, lock4)
  4. gc retry to resolve lock1/lock2 but meet EpochNotMatchError caused by region merge
  5. but due to gc_worker: reduce GC scan locks when meeting region cache miss #18385's bug, it doesn't re-scan region1 and thinking all locks in region1 has be resolved after resolve lock1, lock2
  6. continue resolve lock after new region1's endKey and miss lock3, lock4 which merged from old region2

What is changed and how it works?

What's Changed, How it Works:

we need re-scan region's lock when found merged region's EndKey 's larger than origional region's EndKey

and we no need to re-scan lock when region has be splitted or region's EndKey has no change

Related changes

  • Need to cherry-pick to the release branch 3.0, 4.0, 5.1

Check List

Tests

  • Unit test

Side effects

  • n/a

Release note

  • Fix gc miss locks when region merged during scanning & resolving locks

This change is Reviewable

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot
Copy link
Contributor Author

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

Signed-off-by: lysu <sulifx@gmail.com>
@jebter jebter modified the milestones: v3.0.20, v3.0.21 Jan 7, 2021
@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Jan 8, 2021
Copy link
Member

@jackysp jackysp 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-srebot ti-srebot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jan 11, 2021
@jackysp
Copy link
Member

jackysp commented Jan 11, 2021

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Jan 11, 2021
@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot ti-srebot merged commit 0cc3d77 into pingcap:release-3.0 Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/GC 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/3.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants