This log indicates that TiDB sent a region request to TiKV, but the accessed region is not the leader. This might be caused by an expired region cache. It will automatically retry, and if it doesn’t happen frequently, it should not impact the business.
That wasn’t caused by scaling in or out; it should be some other reason leading to a large number of leader migrations. Did it resolve itself after a period of time, or is it still reporting this issue continuously?
Looking at PD, there is an operator page that monitors the generation, checking, processing, and cancellation of operators. Check what the majority of the reasons for processing are.
This is mainly about writing hotspots and balancing regions. If this affects TiDB, you can limit the speed with the following command:
pd-ctl -i
store limit all 5
The default store limit is 15, which means each store handles 15 region actions per minute. Limiting it to 5 can reduce some load. If there are no anomalies, no action is needed. The reason is to adjust the regions with hotspot writes.
The response time is long.
TiDB itself has a cache for the region leader’s location. If the region’s location changes, the TiDB node needs to retrieve it again from PD, which increases the latency.
Other than that, there’s no significant impact.