Skip to content

Scatter peer should consider the group #6962

@rleungx

Description

@rleungx

Bug Report

Right now, the scatter region consists of two parts: peer and leader. But the behavior is different. The scatter peer is according to the count of all groups, however, the scatter leader will use the count of a single group. It might cause the leader to be not balanced due to the wrong usage of TiDB. See pingcap/tidb#46135.

for _, store := range stores {
count := context.selectedPeer.TotalCountByStore(store.GetID())
if count > maxStoreTotalCount {
maxStoreTotalCount = count
}
if count < minStoreTotalCount {
minStoreTotalCount = count
}
}

for _, storeID := range leaderCandidateStores {
store := r.cluster.GetStore(storeID)
if store == nil {
continue
}
storeGroupLeaderCount := context.selectedLeader.Get(storeID, group)
if minStoreGroupLeader > storeGroupLeaderCount {
minStoreGroupLeader = storeGroupLeaderCount
id = storeID
}
}

Metadata

Metadata

Assignees

Labels

affects-6.1This bug affects the 6.1.x(LTS) versions.affects-6.5This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.severity/minortype/bugThe issue is confirmed as a bug.

Type

No type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions