tidb-worker: add framework for Starter deploy mode background workload coordination
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Enhancement
Under the Starter deploy mode, TiDB needs to coordinate background workloads (GC, distributed background subtasks, TTL, auto-analyze, remote queries) with an external worker controller so that worker TiDB instances can be scheduled on demand instead of running every workload on the master.
This umbrella issue tracks the work to bring that subsystem to upstream TiDB. The plan is to land it incrementally:
1. **Base framework** — add `pkg/tidbworker` with the `Manager` interface, the gRPC client to the controller, role predicates, the `[tidb-worker]` config section, and the per-worker metric. Wire `InitManager` from `cmd/tidb-server/main.go`, gated by `deploymode.IsStarter()`. No existing TiDB workflow changes outside the Starter deploy mode.
2. **Per-feature integrations** — wire individual workers to the Manager: GC, keyspace-level GC (v2), DDL / batch / IMPORT INTO via the distributed task framework, TTL, auto-analyze, remote query.
3. **Bootstrap integration** — `InitializeGC` over delete-range entries, GCV2 abort during bootstrap upgrade, standby `ActivateRequest` fields, etc.
The protocol buffers for the controller RPC are added to kvproto first; subsequent TiDB PRs build on top.
Suggested labels: `component/config`, `component/server`, `nextgen`.
Contributor guide
Assessment
This issue has not been assessed yet.