【概述】因为官方文档对于balance时各个region的分数计算没有说的太明确,所以去看源码想弄清楚region具体的得分计算方式。在阅读 pd/server/core/store.go时,发现计算region score时有一个deviation参数,对这个参数的注释没能理解,该参数注释如下:
// Deviation It is used to control the direction of the deviation considered
// when calculating the region score. It is set to -1 when it is the source
// store of balance, 1 when it is the target, and 0 in the rest of cases.
或者能有更具体的文档资料提供吗?
【TiDB 版本】
V5.1.0