Skip to content

Commit

Permalink
fit: optimize the selection of witness rule candidates (#5904)
Browse files Browse the repository at this point in the history
ref #5568

Signed-off-by: Wenbo Zhang <ethercflow@gmail.com>

Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
  • Loading branch information
ethercflow and ti-chi-bot authored Feb 8, 2023
1 parent 03081c6 commit efa3e31
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/schedule/placement/fit.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,10 @@ func (w *fitWorker) fitRule(index int) bool {
// Only consider stores:
// 1. Match label constraints
// 2. Role match, or can match after transformed.
// 3. Not selected by other rules.
// 3. Don't select leader as witness.
// 4. Not selected by other rules.
for _, p := range w.peers {
if !p.selected && MatchLabelConstraints(p.store, w.rules[index].LabelConstraints) {
if !p.selected && MatchLabelConstraints(p.store, w.rules[index].LabelConstraints) && !(p.isLeader && w.supportWitness && w.rules[index].IsWitness) {
candidates = append(candidates, p)
}
}
Expand Down

0 comments on commit efa3e31

Please sign in to comment.