tikv / tikv/pd

plancement/region_rule_cache: check ValidateRegion&ValidateStores are redundant and preformance underfriendly

Open
#5,241 1 comment 0 reactions 0 assignees View on GitHub
difficulty/easy good first issue type/enhancement
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

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.