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

filter: replace region.Clone in filter (#2794) #2801

Merged
merged 3 commits into from
Aug 20, 2020

Conversation

ti-srebot
Copy link
Contributor

cherry-pick #2794 to release-4.0


Signed-off-by: Song Gao disxiaofei@163.com

What problem does this PR solve?

ref #2783

region.Clone consumes too much cpu resources.

What is changed and how it works?

replace region.Clone with a self-maintained clone function as FitRegion only need partial information of a region.

BenchmarkCloneRegionTest is using new clone method and BenchmarkCloneRegionTest2 is using region.Clone

$ go test -bench=. -run=none
goos: darwin
goarch: amd64
pkg: github.com/tikv/pd/server/schedule/filter
BenchmarkCloneRegionTest-4       4356267               267 ns/op
BenchmarkCloneRegionTest2-4       316604              3292 ns/op
PASS
ok      github.com/tikv/pd/server/schedule/filter       2.555s

Check List

Tests

  • Unit test

Related changes

  • Need to cherry-pick to the release branch

Release note

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot ti-srebot added status/LGT1 Indicates that a PR has LGTM 1. and removed status/LGT3 The PR has already had 3 LGTM. labels Aug 19, 2020
@nolouch
Copy link
Contributor

nolouch commented Aug 19, 2020

plz resolve the conflict.

Signed-off-by: Song Gao <disxiaofei@163.com>
@codecov
Copy link

codecov bot commented Aug 20, 2020

Codecov Report

Merging #2801 into release-4.0 will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##           release-4.0    #2801   +/-   ##
============================================
  Coverage        77.46%   77.47%           
============================================
  Files              206      206           
  Lines            22652    22674   +22     
============================================
+ Hits             17547    17566   +19     
- Misses            3789     3790    +1     
- Partials          1316     1318    +2     
Impacted Files Coverage Δ
server/schedule/filter/filters.go 84.24% <100.00%> (+1.19%) ⬆️
server/kv/etcd_kv.go 84.41% <0.00%> (-3.90%) ⬇️
pkg/dashboard/adapter/manager.go 83.01% <0.00%> (-3.78%) ⬇️
server/member/leader.go 72.76% <0.00%> (-1.56%) ⬇️
server/core/storage.go 74.38% <0.00%> (-0.83%) ⬇️
client/client.go 71.95% <0.00%> (-0.49%) ⬇️
server/cluster/coordinator.go 70.02% <0.00%> (-0.48%) ⬇️
server/cluster/cluster.go 80.87% <0.00%> (-0.41%) ⬇️
server/server.go 76.22% <0.00%> (ø)
server/schedule/operator_controller.go 81.41% <0.00%> (+0.16%) ⬆️
... and 6 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 7e31082...e9f4284. Read the comment docs.

@nolouch nolouch modified the milestones: v4.0.6, v4.0.5 Aug 20, 2020
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-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 Aug 20, 2020
@Yisaer
Copy link
Contributor

Yisaer commented Aug 20, 2020

/run-all-tests

Signed-off-by: Song Gao <disxiaofei@163.com>
@Yisaer
Copy link
Contributor

Yisaer commented Aug 20, 2020

/run-all-tests

@Yisaer Yisaer merged commit 0ef1e1c into tikv:release-4.0 Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/scheduler Scheduler logic. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants