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_worker: reduce GC scan locks when meeting region cache miss #18385

Merged
merged 6 commits into from
Jul 30, 2020
Merged

gc_worker: reduce GC scan locks when meeting region cache miss #18385

merged 6 commits into from
Jul 30, 2020

Conversation

lysu
Copy link
Contributor

@lysu lysu commented Jul 6, 2020

What problem does this PR solve?

Issue Number: close #xxx

Problem Summary:

currently, gc worker will rescan locks when meet region cache miss error which makes slow scan job become more slow.

What is changed and how it works?

What's Changed, How it Works:

when region cache miss error(current is a fake epochNotMatch), it just indicates "maybe region has changed and we need to reload region from PD", we can continue resolve scan lock result if all lock still in that region.

this can help situations like:

  • lock and region hasn't changed but region cache expired
  • lock's region's key range didn't change but maybe add new peer(id is same but confVer or ver changed)
  • all lock has changed from region A to region B

but it didn't help the situation that:

  • lock's region has been split into two region

maybe we can improve it later(to avoid complex modification)

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • n/a

Release note

  • Reduce GC scan locks when meeting region cache miss

This change is Reviewable

@lysu lysu added type/enhancement The issue or PR belongs to an enhancement. component/GC labels Jul 6, 2020
@lysu lysu changed the title gcworker: reduce GC scan locks when meeting region cache miss gc_worker: reduce GC scan locks when meeting region cache miss Jul 6, 2020
@codecov
Copy link

codecov bot commented Jul 6, 2020

Codecov Report

Merging #18385 into master will decrease coverage by 0.0165%.
The diff coverage is 62.0689%.

@@               Coverage Diff                @@
##             master     #18385        +/-   ##
================================================
- Coverage   79.1461%   79.1296%   -0.0166%     
================================================
  Files           548        547         -1     
  Lines        147949     147726       -223     
================================================
- Hits         117096     116895       -201     
+ Misses        21369      21361         -8     
+ Partials       9484       9470        -14     

@lysu
Copy link
Contributor Author

lysu commented Jul 6, 2020

/run-all-tests

Copy link
Contributor

@youjiali1995 youjiali1995 left a comment

Choose a reason for hiding this comment

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

Rest lgtm. But it's a little strange that don't solve the problem completely.

store/tikv/gcworker/gc_worker.go Outdated Show resolved Hide resolved
store/tikv/gcworker/gc_worker_test.go Outdated Show resolved Hide resolved
store/tikv/gcworker/gc_worker_test.go Outdated Show resolved Hide resolved
@ti-srebot
Copy link
Contributor

@youjiali1995, @MyonKeminta, PTAL.

1 similar comment
@ti-srebot
Copy link
Contributor

@youjiali1995, @MyonKeminta, PTAL.

@lysu lysu modified the milestones: v3.0.17, v4.0.3 Jul 14, 2020
Copy link
Contributor

@youjiali1995 youjiali1995 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 the status/LGT1 Indicates that a PR has LGTM 1. label Jul 14, 2020
@winoros winoros modified the milestones: v4.0.3, v4.0.4 Jul 15, 2020
@ti-srebot
Copy link
Contributor

@youjiali1995, @coocood, @jackysp, @MyonKeminta, PTAL.

Copy link
Contributor

@MyonKeminta MyonKeminta left a comment

Choose a reason for hiding this comment

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

rest LGTM

store/tikv/gcworker/gc_worker.go Outdated Show resolved Hide resolved
@ti-srebot
Copy link
Contributor

@youjiali1995, @MyonKeminta, @coocood, @jackysp, PTAL.

1 similar comment
@ti-srebot
Copy link
Contributor

@youjiali1995, @MyonKeminta, @coocood, @jackysp, PTAL.

@MyonKeminta
Copy link
Contributor

Can we continue this or just merge this? @youjiali1995 @lysu

@ti-srebot
Copy link
Contributor

@youjiali1995, @MyonKeminta, @coocood, @jackysp, PTAL.

@lysu lysu dismissed stale reviews from ti-srebot and jackysp via 7cc9877 July 30, 2020 05:12
@lysu
Copy link
Contributor Author

lysu commented Jul 30, 2020

/run-all-tests

@jackysp jackysp merged commit 43c2d30 into pingcap:master Jul 30, 2020
@lysu lysu deleted the dev-fix-gc-work-re-scan branch July 30, 2020 05:40
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Jul 30, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-3.0 in PR #18874

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Jul 30, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-3.1 in PR #18875

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Jul 30, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #18876

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/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants