plancement/region_rule_cache: check ValidateRegion&ValidateStores are redundant and preformance underfriendly
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 783
- Avg merge
- 5d 21h
- Merged PRs (30d)
- 36
Description
## Enhancement Task
It is unfriendly for performance and also redundant to check ValidDateRegion & ValidateStores in the function `IsUnchanged`
[https://github.com/tikv/pd/blob/c8775b6176a03eb25cb1622fc46ba1d496872df7/server/schedule/placement/region_rule_cache.go#L93-L98](https://github.com/tikv/pd/blob/c8775b6176a03eb25cb1622fc46ba1d496872df7/server/schedule/placement/region_rule_cache.go#L93-L98)
since, firstly, the only caller of `IsUnchanged` was in `CheckAndGetCache`, it already checked in L61
[https://github.com/tikv/pd/blob/c8775b6176a03eb25cb1622fc46ba1d496872df7/server/schedule/placement/region_rule_cache.go#L58-L71](https://github.com/tikv/pd/blob/c8775b6176a03eb25cb1622fc46ba1d496872df7/server/schedule/placement/region_rule_cache.go#L58-L71)
secondly, L98 will validate it again since all regions into the cache should be validate first.
Contributor guide
Assessment
This issue has not been assessed yet.