PD should not assign leaders to TiKV in preparing state
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 783
- Avg merge
- 5d 21h
- Merged PRs (30d)
- 36
Description
## Feature Request
### Describe your feature request related problem
1. When a new TiKV joins the cluster, it bootstraps data from other TiKVs. PD starts immediately assigning leaders to it although it might have not reached similar region counts as other nodes. Since bootstrapping can occupy the host's resource, if the host starts to serve queries, it will affect query latencies.
2. When a node goes down for more than `max-store-down-time`, its state becomes `DOWN`, and regions have all been moved out of it. If the node comes back, it might start bootstrapping again and now we face the same issue as in 1 above.
### Describe the feature you'd like
1. PD should move stores coming back from `DOWN` into `PREPARING` node state
2. PD should filter leader candidates based on `PREPARING` node state
### Describe alternatives you've considered
Orchestrations like tidb-operator could do this, but since PD makes the centralized decision about scheduling, it's best to make PD handle it directly.
### Teachability, Documentation, Adoption, Migration Strategy
Contributor guide
Assessment
This issue has not been assessed yet.