Description
Thanks Sreekanth Sivasankaran – Sreekanth helped to raise attention that the cbgt "node list" nudging algorithm is wrong...
https://github.com/couchbase/cbgt/blob/master/manager_planner.go#L671
manager_planner.go:671
The idea is that it takes the indexName,
then computes a hash num,
then uses that hash num to naively rotate or shift the array of nodes around
so that each index might have a different looking but repeatable-ish array of node names as it goes into the rest of the (blance) partition planning algorithm.
The bug is here...
https://github.com/couchbase/cbgt/blob/master/manager_planner.go#L683
if next >= len(nodeUUIDsAll) {
|
next = 0
|
}
|
It should probably more use a modulus, perhaps like...
if next >= len(nodeUUIDsAll) {
|
next = next mod len(nodeUUIDsAll)
|
}
|
(Related, when the involved numbers are low, like there's only a single partition per index, and only two nodes, then this nudging or list rotation approach might not be enough – but we can consider that separately perhaps in some future improvement ticket.)