-
Notifications
You must be signed in to change notification settings - Fork 726
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: fix empty region count when resuming #7009
Conversation
Signed-off-by: Cabinfever_B <[email protected]>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
pkg/statistics/region_collection.go
Outdated
@@ -198,7 +198,9 @@ func (r *RegionStatistics) Observe(region *core.RegionInfo, stores []*core.Store | |||
return false | |||
}(), | |||
LearnerPeer: len(region.GetLearners()) > 0, | |||
EmptyRegion: region.GetApproximateSize() <= core.EmptyRegionApproximateSize, | |||
// When cluster resumes, the region size may be not initialized, but region heartbeat is send. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the region size is not initialized, will it inherit from the original one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will not because the approximate size of original region is zero after pause.
Signed-off-by: Cabinfever_B <[email protected]>
Signed-off-by: Cabinfever_B <[email protected]>
Signed-off-by: Cabinfever_B <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #7009 +/- ##
==========================================
- Coverage 74.38% 74.36% -0.03%
==========================================
Files 436 436
Lines 46437 46435 -2
==========================================
- Hits 34544 34530 -14
- Misses 8869 8875 +6
- Partials 3024 3030 +6
Flags with carried forward coverage won't be shown. Click here to find out more. |
pkg/statistics/region.go
Outdated
@@ -59,7 +59,7 @@ func (s *RegionStats) Observe(r *core.RegionInfo) { | |||
approximateKeys := r.GetApproximateKeys() | |||
approximateSize := r.GetApproximateSize() | |||
approximateKvSize := r.GetApproximateKvSize() | |||
if approximateSize <= core.EmptyRegionApproximateSize { | |||
if approximateSize == core.EmptyRegionApproximateSize { | |||
s.EmptyCount++ | |||
} | |||
s.StorageSize += approximateSize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approximateSize == 1 means empty, should we add it to storage size?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do u mean current storage size? If so, it is calculated from the used size of store
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean
if approximateSize > core.EmptyRegionApproximateSize {
s.StorageSize += approximateSize
}
pkg/statistics/region.go
Outdated
@@ -59,7 +59,7 @@ func (s *RegionStats) Observe(r *core.RegionInfo) { | |||
approximateKeys := r.GetApproximateKeys() | |||
approximateSize := r.GetApproximateSize() | |||
approximateKvSize := r.GetApproximateKvSize() | |||
if approximateSize <= core.EmptyRegionApproximateSize { | |||
if approximateSize == core.EmptyRegionApproximateSize { | |||
s.EmptyCount++ | |||
} | |||
s.StorageSize += approximateSize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean
if approximateSize > core.EmptyRegionApproximateSize {
s.StorageSize += approximateSize
}
pkg/statistics/region_collection.go
Outdated
EmptyRegion: region.GetApproximateSize() <= core.EmptyRegionApproximateSize, | ||
// When cluster resumes, the region size may be not initialized, but region heartbeat is send. | ||
// So use `==` here. | ||
EmptyRegion: region.GetApproximateSize() == core.EmptyRegionApproximateSize, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we extract a function IsEmptyRegion()
for regionInfo
Signed-off-by: Cabinfever_B <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/merge |
@CabinfeverB: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger
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. |
This pull request has been accepted and is ready to merge. Commit hash: c1e170e
|
@CabinfeverB: Your PR was out of date, I have automatically updated it for you. If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. 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. |
In response to a cherrypick label: new pull request created to branch |
close tikv#7008 Signed-off-by: ti-chi-bot <[email protected]>
In response to a cherrypick label: new pull request created to branch |
close tikv#7008 Signed-off-by: ti-chi-bot <[email protected]>
In response to a cherrypick label: new pull request created to branch |
close tikv#7008 Signed-off-by: ti-chi-bot <[email protected]>
close #7008 Signed-off-by: ti-chi-bot <[email protected]> Signed-off-by: Cabinfever_B <[email protected]> Co-authored-by: Yongbo Jiang <[email protected]> Co-authored-by: Cabinfever_B <[email protected]>
This reverts commit 74ead5c. Signed-off-by: Cabinfever_B <[email protected]>
…ikv#7055)" This reverts commit 8c5859e. Signed-off-by: Cabinfever_B <[email protected]>
) close #7148 Signed-off-by: Cabinfever_B <[email protected]>
#7150) ref #7148 Signed-off-by: Cabinfever_B <[email protected]>
What problem does this PR solve?
Issue Number: Close #7008 #5273
What is changed and how does it work?
We only save
meta
when save regions, so the approximate size of the original region is zero when restarting andInherit
is useless.Check List
Tests
Code changes
Side effects
Related changes
pingcap/docs
/pingcap/docs-cn
:pingcap/tiup
:Release note