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

core: allow cancel load region #4175

Merged
merged 13 commits into from
Oct 14, 2021
Merged

core: allow cancel load region #4175

merged 13 commits into from
Oct 14, 2021

Conversation

disksing
Copy link
Contributor

What problem does this PR solve?

Fix #3936

What is changed and how it works?

  • add cancel support for core.LoadRegion functions
  • replace chan bool with contextes in region syncer client
  • add test case

Check List

Tests

  • Unit test

Release note

Fix the issue that PD may not elect leader as soon as leader step down

Signed-off-by: disksing <[email protected]>
Signed-off-by: disksing <[email protected]>
@disksing disksing added the type/bugfix This PR fixes a bug. label Sep 28, 2021
@disksing disksing requested review from nolouch and Yisaer September 28, 2021 07:35
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Sep 28, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • nolouch
  • rleungx

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 release-note Denotes a PR that will be considered when it comes time to generate release notes. label Sep 28, 2021
server/core/storage_test.go Show resolved Hide resolved
server/region_syncer/server.go Outdated Show resolved Hide resolved
@disksing disksing requested a review from JmPotato October 11, 2021 03:17
This reverts commit 5b69c4a.

Signed-off-by: disksing <[email protected]>
Signed-off-by: disksing <[email protected]>
@codecov
Copy link

codecov bot commented Oct 12, 2021

Codecov Report

Merging #4175 (74758c4) into master (0a32ac8) will decrease coverage by 0.14%.
The diff coverage is 79.31%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4175      +/-   ##
==========================================
- Coverage   74.83%   74.69%   -0.15%     
==========================================
  Files         260      260              
  Lines       26641    26633       -8     
==========================================
- Hits        19937    19893      -44     
- Misses       4923     4954      +31     
- Partials     1781     1786       +5     
Flag Coverage Δ
unittests 74.69% <79.31%> (-0.15%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
server/cluster/cluster.go 82.68% <0.00%> (+0.35%) ⬆️
server/region_syncer/server.go 88.97% <ø> (+5.75%) ⬆️
server/core/storage.go 68.04% <50.00%> (ø)
server/core/region_storage.go 75.26% <71.42%> (-0.32%) ⬇️
server/region_syncer/client.go 82.03% <94.11%> (+0.34%) ⬆️
pkg/errs/errs.go 75.00% <0.00%> (-25.00%) ⬇️
server/tso/local_allocator.go 64.86% <0.00%> (-13.52%) ⬇️
server/election/leadership.go 75.25% <0.00%> (-5.16%) ⬇️
server/schedulers/random_merge.go 60.00% <0.00%> (-3.34%) ⬇️
pkg/dashboard/adapter/manager.go 79.78% <0.00%> (-3.20%) ⬇️
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0a32ac8...74758c4. Read the comment docs.

Signed-off-by: disksing <[email protected]>

Co-authored-by: Ryan Leung <[email protected]>
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Oct 13, 2021
@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 Oct 14, 2021
@disksing
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

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

/run-all-tests

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: 74758c4

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Oct 14, 2021
@ti-chi-bot ti-chi-bot merged commit 335f384 into tikv:master Oct 14, 2021
@disksing disksing deleted the issue-3936 branch October 14, 2021 13:06
@disksing disksing added needs-cherry-pick-release-4.0 The PR needs to cherry pick to release-4.0 branch. needs-cherry-pick-release-5.0 The PR needs to cherry pick to release-5.0 branch. needs-cherry-pick-release-5.1 Type: Need cherry pick to release-5.1 needs-cherry-pick-release-5.2 Type: Need cherry pick to release-5.2 labels Oct 19, 2021
@disksing
Copy link
Contributor Author

/run-cherry-picker

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4217.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4218.

ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this pull request Oct 19, 2021
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4219.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4220.

ti-chi-bot added a commit that referenced this pull request Oct 19, 2021
* allow cancel load region

Signed-off-by: disksing <[email protected]>

* add test

Signed-off-by: disksing <[email protected]>

* minor update

Signed-off-by: disksing <[email protected]>

* address comment

Signed-off-by: disksing <[email protected]>

* Revert "address comment"

This reverts commit 5b69c4a.

Signed-off-by: disksing <[email protected]>

* add log

Signed-off-by: disksing <[email protected]>

* merge clientCtx and regionSyncerCtx

Signed-off-by: HunDunDM <[email protected]>

* Update server/region_syncer/client.go

Signed-off-by: disksing <[email protected]>

Co-authored-by: Ryan Leung <[email protected]>

Co-authored-by: disksing <[email protected]>
Co-authored-by: HunDunDM <[email protected]>
Co-authored-by: Ryan Leung <[email protected]>
hzh0425 pushed a commit to hzh0425/pd that referenced this pull request Nov 16, 2021
* allow cancel load region

Signed-off-by: disksing <[email protected]>

* add test

Signed-off-by: disksing <[email protected]>

* minor update

Signed-off-by: disksing <[email protected]>

* address comment

Signed-off-by: disksing <[email protected]>

* Revert "address comment"

This reverts commit 5b69c4a.

Signed-off-by: disksing <[email protected]>

* add log

Signed-off-by: disksing <[email protected]>

* merge clientCtx and regionSyncerCtx

Signed-off-by: HunDunDM <[email protected]>

* Update server/region_syncer/client.go

Signed-off-by: disksing <[email protected]>

Co-authored-by: Ryan Leung <[email protected]>

Co-authored-by: ShuNing <[email protected]>
Co-authored-by: HunDunDM <[email protected]>
Co-authored-by: Ryan Leung <[email protected]>
Co-authored-by: Ti Chi Robot <[email protected]>
Signed-off-by: hzh0425 <[email protected]>
ti-chi-bot added a commit that referenced this pull request Nov 24, 2021
* This is an automated cherry-pick of #4175

Signed-off-by: ti-chi-bot <[email protected]>

* resolve conflicts

Signed-off-by: disksing <[email protected]>

* fix compile

ref #3936

Signed-off-by: disksing <[email protected]>

* fix test

Signed-off-by: disksing <[email protected]>

* fix build

Signed-off-by: disksing <[email protected]>

Co-authored-by: disksing <[email protected]>
Co-authored-by: ShuNing <[email protected]>
disksing pushed a commit that referenced this pull request Nov 30, 2021
disksing pushed a commit that referenced this pull request Dec 1, 2021
* allow cancel load region

Signed-off-by: disksing <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-4.0 The PR needs to cherry pick to release-4.0 branch. needs-cherry-pick-release-5.0 The PR needs to cherry pick to release-5.0 branch. needs-cherry-pick-release-5.1 Type: Need cherry pick to release-5.1 needs-cherry-pick-release-5.2 Type: Need cherry pick to release-5.2 release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cancel LoadRegionsOnce when exits WatchLeader
6 participants