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: simplify regionSubTree and regionMap #3693

Merged
merged 4 commits into from
Jun 2, 2021

Conversation

HunDunDM
Copy link
Member

Signed-off-by: HunDunDM [email protected]

What problem does this PR solve?

The functions of regionTree, regionSubTree, and regionMap are duplicated.

What is changed and how it works?

  • Remove unnecessary totalKeys statistics
  • Merge regionSubTree into regionTree
  • Remove the statistical function of regionMap

Check List

Tests

  • Unit test

Release note

None

@ti-chi-bot ti-chi-bot added the release-note-none Denotes a PR that doesn't merit a release note. label May 20, 2021
@ti-chi-bot ti-chi-bot requested review from disksing and rleungx May 20, 2021 07:53
@sonarcloud
Copy link

sonarcloud bot commented May 21, 2021

SonarCloud Quality Gate failed.

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
4.1% 4.1% Duplication

followers map[uint64]*regionSubTree // storeID -> regionSubTree
learners map[uint64]*regionSubTree // storeID -> regionSubTree
pendingPeers map[uint64]*regionSubTree // storeID -> regionSubTree
regions regionMap // regionID -> regionInfo
Copy link
Contributor

Choose a reason for hiding this comment

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

can use map directly

Copy link
Member Author

@HunDunDM HunDunDM May 28, 2021

Choose a reason for hiding this comment

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

This is a split PR. After that, there are other changes to the function of the regionMap, which will become more complicated.

Copy link
Contributor

Choose a reason for hiding this comment

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

cool.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 31, 2021
Copy link
Contributor

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

@nolouch: Please use GitHub review feature instead of /lgtm [cancel] when you want to submit review to the pull request.
For how to use GitHub review feature, see also this document provided by GitHub.

For the reason we drop support to the commands, see also this page.
This reply is being used as a temporary reply during the migration of review process and will be removed on July 1st.

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

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • disksing
  • nolouch

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 status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jun 1, 2021
@disksing
Copy link
Contributor

disksing commented Jun 1, 2021

/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: 27fc869

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 1, 2021
@codecov
Copy link

codecov bot commented Jun 1, 2021

Codecov Report

Merging #3693 (7686a61) into master (037d673) will increase coverage by 0.04%.
The diff coverage is 97.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3693      +/-   ##
==========================================
+ Coverage   74.89%   74.94%   +0.04%     
==========================================
  Files         244      244              
  Lines       24404    24374      -30     
==========================================
- Hits        18277    18266      -11     
+ Misses       4506     4487      -19     
  Partials     1621     1621              
Flag Coverage Δ
unittests 74.94% <97.77%> (+0.04%) ⬆️

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

Impacted Files Coverage Δ
server/core/region.go 89.52% <93.75%> (-0.18%) ⬇️
server/core/region_tree.go 94.57% <100.00%> (+3.22%) ⬆️
server/tso/local_allocator.go 80.55% <0.00%> (-9.73%) ⬇️
server/tso/global_allocator.go 70.55% <0.00%> (-5.00%) ⬇️
server/tso/tso.go 70.78% <0.00%> (-2.25%) ⬇️
server/member/member.go 68.81% <0.00%> (-1.08%) ⬇️
client/base_client.go 82.98% <0.00%> (+0.51%) ⬆️
server/grpc_service.go 48.27% <0.00%> (+0.57%) ⬆️
server/cluster/coordinator.go 72.89% <0.00%> (+0.70%) ⬆️
server/tso/allocator_manager.go 81.30% <0.00%> (+1.66%) ⬆️
... and 3 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 037d673...7686a61. Read the comment docs.

@ti-chi-bot ti-chi-bot merged commit ab8b5b3 into tikv:master Jun 2, 2021
@HunDunDM HunDunDM deleted the region-tree branch June 3, 2021 11:39
bufferflies pushed a commit to bufferflies/pd that referenced this pull request Jul 9, 2021
* core: simplify regionSubTree and regionMap

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

* fix stat error

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

Co-authored-by: Ti Chi Robot <[email protected]>
bufferflies pushed a commit to bufferflies/pd that referenced this pull request Jul 9, 2021
* core: simplify regionSubTree and regionMap

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

* fix stat error

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

Co-authored-by: Ti Chi Robot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants