tikv / pd

Placement driver for TiKV
Apache License 2.0
1.05k stars 719 forks source link

Imbalanced leader when using placement rule to bind the leader #8023

Open rleungx opened 6 months ago

rleungx commented 6 months ago

Enhancement Task

Consider such a case:

  1. we have 3 zones: z1, z2, and z3. Each zone has 3 tikvs.
  2. we have 3 tables: t1, t2, and t3. Each table has 3 replicas which are located in different zones.
  3. t1's leader is bound to z1, t2's leader is bound to z2, and t3's leader is bound to z3.

Assume each table has only 3 regions. In z1, we denote 3 tikv as tikv1, tikv2, tikv3. Each tikv will have 3 regions but it doesn't have the concept of a table. So all tikv1's regions could belong to t1, which leads to the imbalanced leader phenomenon in z1. Besides, the balance leader scheduler can only balance the leader among the zones since each zone only has one replica of a region. It also won't help.

We may need to consider this case.

seiya-annie commented 3 weeks ago

/report customer