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

statistics: add more test for hot statistics #4499

Merged
merged 8 commits into from
Jan 10, 2022

Conversation

lhy1024
Copy link
Contributor

@lhy1024 lhy1024 commented Dec 24, 2021

Signed-off-by: lhy1024 admin@liudos.us

What problem does this PR solve?

  • add more test
    • add checkIntervalSum to check whether interval sums are different
    • add checkIntervalSumContinuous to check whether the interval sum of the peer is continuous
    • add test for cool down transfer leader
  • some refactor
    • use buildRegion
    • add one heartbeat in add replica and remove replica in move peer

Check List

Tests

  • Unit test

Release note

 None.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Dec 24, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • disksing
  • 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.

@codecov
Copy link

codecov bot commented Dec 27, 2021

Codecov Report

Merging #4499 (e40dc69) into master (6f8edf2) will decrease coverage by 0.06%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4499      +/-   ##
==========================================
- Coverage   74.78%   74.72%   -0.07%     
==========================================
  Files         265      265              
  Lines       27845    27845              
==========================================
- Hits        20825    20807      -18     
- Misses       5150     5163      +13     
- Partials     1870     1875       +5     
Flag Coverage Δ
unittests 74.72% <ø> (-0.07%) ⬇️

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

Impacted Files Coverage Δ
server/schedulers/shuffle_hot_region.go 53.53% <0.00%> (-12.13%) ⬇️
server/region_syncer/client.go 79.68% <0.00%> (-3.91%) ⬇️
server/member/member.go 63.10% <0.00%> (-3.75%) ⬇️
pkg/etcdutil/etcdutil.go 85.88% <0.00%> (-2.36%) ⬇️
server/election/leadership.go 75.25% <0.00%> (-2.07%) ⬇️
server/tso/tso.go 63.06% <0.00%> (-1.71%) ⬇️
server/server.go 71.49% <0.00%> (-1.50%) ⬇️
server/schedule/operator_controller.go 82.92% <0.00%> (-1.22%) ⬇️
server/core/storage.go 69.31% <0.00%> (-0.76%) ⬇️
server/cluster/cluster.go 82.87% <0.00%> (-0.47%) ⬇️
... and 8 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 6f8edf2...e40dc69. Read the comment docs.

core.WithInterval(&pdpb.TimeInterval{StartTimestamp: 0, EndTimestamp: 10}),
core.SetReadBytes(30000*10),
core.SetReadKeys(300000*10))
region := buildRegion(Read, 3, 10)
Copy link
Member

Choose a reason for hiding this comment

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

It changes the original value. Is it expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't matter, just make sure it's hot

core.SetReportInterval(interval),
core.SetWrittenBytes(interval*100*1024))

region := buildRegion(Write, 3, interval)
Copy link
Member

Choose a reason for hiding this comment

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

ditto

server/statistics/hot_peer_cache_test.go Outdated Show resolved Hide resolved
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
for i := 1; i <= 200; i++ {
checker(c, cache, region)
rets := checker(c, cache, region)
checkIntervalSumContinuous(c, intervalSums, rets, interval)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
checkIntervalSumContinuous(c, intervalSums, rets, interval)
checkIntervalSumContinuous(c, intervalSums, checker(c, cache, region), interval)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it will be too long and difficult to understand.

server/statistics/hot_peer_cache_test.go Outdated Show resolved Hide resolved
}

// prepare with random move peer to make the interval sum of peers are different
Copy link
Member

Choose a reason for hiding this comment

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

Does the comment need to be changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we need to change it because the actual move peer is to add replica in the target store and then remove replica from the source store

Signed-off-by: lhy1024 <admin@liudos.us>
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jan 10, 2022
Signed-off-by: lhy1024 <admin@liudos.us>
@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 Jan 10, 2022
@disksing
Copy link
Contributor

/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: bfac82d

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jan 10, 2022
@lhy1024
Copy link
Contributor Author

lhy1024 commented Jan 10, 2022

/rebuild

1 similar comment
@lhy1024
Copy link
Contributor Author

lhy1024 commented Jan 10, 2022

/rebuild

@HunDunDM
Copy link
Member

/run-unit-test

@lhy1024
Copy link
Contributor Author

lhy1024 commented Jan 10, 2022

/rebuild

1 similar comment
@lhy1024
Copy link
Contributor Author

lhy1024 commented Jan 10, 2022

/rebuild

@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Jan 10, 2022
@lhy1024
Copy link
Contributor Author

lhy1024 commented Jan 10, 2022

/merge

@ti-chi-bot
Copy link
Member

@lhy1024: 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: e40dc69

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jan 10, 2022
@ti-chi-bot ti-chi-bot merged commit cfb909d into tikv:master Jan 10, 2022
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.

5 participants