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

wrong statistics of the region tree #5318

Closed
nolouch opened this issue Jul 18, 2022 · 0 comments · Fixed by #5301
Closed

wrong statistics of the region tree #5318

nolouch opened this issue Jul 18, 2022 · 0 comments · Fixed by #5301
Labels
affects-6.1 This bug affects the 6.1.x(LTS) versions. severity/major type/bug The issue is confirmed as a bug.

Comments

@nolouch
Copy link
Contributor

nolouch commented Jul 18, 2022

Bug Report

remove region may cause the wrong result.

// remove removes a region if the region is in the tree.
// It will do nothing if it cannot find the region or the found region
// is not the same with the region.
func (t *regionTree) remove(region *RegionInfo) {
if t.length() == 0 {
return
}
item := &regionItem{region: region}
result := t.tree.Find(item)
if result == nil || result.(*regionItem).region.GetID() != region.GetID() {
return
}
t.totalSize -= region.approximateSize
regionWriteBytesRate, regionWriteKeysRate := region.GetWriteRate()
t.totalWriteBytesRate -= regionWriteBytesRate
t.totalWriteKeysRate -= regionWriteKeysRate
t.tree.Remove(result)
}

@nolouch nolouch added type/bug The issue is confirmed as a bug. severity/major labels Jul 18, 2022
ti-chi-bot pushed a commit that referenced this issue Jul 18, 2022
close #5318

Signed-off-by: Ryan Leung <rleungx@gmail.com>

Co-authored-by: 混沌DM <hundundm@gmail.com>
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this issue Jul 18, 2022
close tikv#5318

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot added a commit that referenced this issue Sep 21, 2022
ref #5301, close #5318

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Signed-off-by: Ryan Leung <rleungx@gmail.com>

Co-authored-by: Ryan Leung <rleungx@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.1 This bug affects the 6.1.x(LTS) versions. severity/major type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants