tikv / tikv/pd

rule_list: should we consider a peer should be leader and follower in 2 rules in `checkApplyRules`

Open
#8,313 0 comments 0 reactions 0 assignees View on GitHub
affects-8.5 may-affects-5.4 may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 severity/major type/bug
Dominant language
Go
Stars
1.2k
Forks
783
Avg merge
5d 21h
Merged PRs (30d)
36

Description

## Bug Report

when we try to add new placement-rule into the cluster, we would use the following function to check whether the new rule has conflictions with some exist rules.
https://github.com/tikv/pd/blob/fca469ca33eb5d8b5e0891b507c87709a00b0e81/pkg/schedule/placement/rule_list.go#L27-L46)

however, the above function miss the following corner case, which would save conflict placement-rule in the system:

both zone has only 1 tikv instance and the rule defines as the following:
leader should in tikv1, follower should in tikv1, for example:
```
CREATE PLACEMENT POLICY leader_follower_in_1 LEADER_CONSTRAINTS="[+zone=bj1]" FOLLOWER_CONSTRAINTS="{+zone=bj1: 1,+zone=bj3: 1}";
```

the above function will return success, while we could never make the replica on tikv1 meet these 2 rules at the same time.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.