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

Too many peers may cause rule-checker to be stuck by fitRegion #6663

Open
JmPotato opened this issue Jun 24, 2023 · 1 comment
Open

Too many peers may cause rule-checker to be stuck by fitRegion #6663

JmPotato opened this issue Jun 24, 2023 · 1 comment
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@JmPotato
Copy link
Member

JmPotato commented Jun 24, 2023

Bug Report

#6662 also exposes another problem. When too many peers are replicated to the redundant TiKV stores, the following code of rule-checker will generate a huge number of loops, resulting in its almost stuck and unable to complete the patrol of the region for a long time.

limit := uint(1<<len(candidates) - 1)
binaryInt := uint(1<<count - 1)
for ; binaryInt <= limit; binaryInt++ {
// there should be exactly `count` number in current binary number `binaryInt`
if bits.OnesCount(binaryInt) != count {
continue
}
selected := pickPeersFromBinaryInt(candidates, binaryInt)
better = w.compareBest(selected, index) || better
// reset the selected items to false.
unSelectPeers(selected)
if w.exit {
break
}
}

If a region owns 36 peers, the limit here will reach 68719476735. We may need to optimize this kind of case to make sure fitRegion could be finished in a reasonable time.

@JmPotato JmPotato added the type/bug The issue is confirmed as a bug. label Jun 24, 2023
@JmPotato JmPotato changed the title Too many peers may cause rule-checker to be stuck by fitRegion. Too many peers may cause rule-checker to be stuck by fitRegion Jun 24, 2023
@nolouch
Copy link
Contributor

nolouch commented Jul 5, 2023

it should be fixed by #6660, and I think this will be a performance improvement, so I remove the bug label.

@nolouch nolouch added type/enhancement The issue or PR belongs to an enhancement. and removed type/bug The issue is confirmed as a bug. severity/major severity/minor labels Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

3 participants