tikv / pd

Placement driver for TiKV
Apache License 2.0
1.04k stars 718 forks source link

The correction of influence is a bit excessive in`shouldBalance` #5092

Open CabinfeverB opened 2 years ago

CabinfeverB commented 2 years ago

Enhancement Task

If there is some move-peer operator which is from A->B, B's influence will increase. So PD will try to move peers from B to C. But we don't want to balance around. So following code is useful. https://github.com/tikv/pd/blob/d7435da069ab96b91b9e6a6686a394cce6f42390/server/schedulers/utils.go#L91-L97

ps: I think the comments here should be clearer

But I think changing positive value into negative value is a bit excessive. Consider the following scenario

[Score] A,B,C = 5,3,1 [Schedule] A->B, A->C [Score with influence] A,B,C = 3,4,2 [want to Schedule] B->C [Score in shouldBalance] A,B,C = 3,2,2

So we can't move peer from B to C. IMO, we can change positive value into zero

CabinfeverB commented 2 years ago

/cc @bufferflies