见pd/pkg/schedule/placement/fit.go
func compareRuleFit(a, b *RuleFit) int {
switch {
case len(a.Peers) < len(b.Peers):
return -1
case len(a.Peers) > len(b.Peers):
return 1
case len(a.PeersWithDifferentRole) > len(b.PeersWithDifferentRole):
return -1
case len(a.PeersWithDifferentRole) < len(b.PeersWithDifferentRole):
return 1
case a.IsolationScore < b.IsolationScore:
return -1
case a.IsolationScore > b.IsolationScore:
return 1
case a.WitnessScore > b.WitnessScore:
return -1
case a.WitnessScore < b.WitnessScore:
return 1
default:
return 0
}
}
IsolationScore越大的RuleFit越好, 这个合理
但是, 为什么len(Peers)越大的RuleFit越好
说到底, 什么情况下这里的两个 RuleFit 会有不同的len(Peers)