Refactor GC related PD APIs and GC procedures
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Enhancement
After years of iteration, the GC related code, which originally lacked of proper design, has become a huge historical debt that makes our futher mantainance, development and optimization difficult. Some badly-designed interfaces cause misuses frequently, and these misuses can be dangerous to affect the data correctness. Now, we've planned a refactor to redesign most of these related PD APIs, redefine some terms, and avoid those code that's obscure and easy to misuse. After the refactoring which is expected to make the GC related APIs and concetps more clear and comprehensible, we will then implement a feature named *protected snapshots* over it, which is expected to help PiTR to reduce their cost to maintain ther backup progress.
### Subtasks
- [x] PD API refactorying: https://github.com/tikv/pd/issues/8978
- [ ] TiKV: Adapt to the new PD API
- [x] Next gen
- [ ] master
- [x] Adapt TiDB's GCWorker to the new PD API https://github.com/pingcap/tidb/pull/60632
- [x] Mock PD of unistore: https://github.com/pingcap/tidb/pull/61529
- [x] Required adaption in client-go: https://github.com/tikv/client-go/pull/1634
- [ ] TiKV: Add checks to prevent reading/writing to unsafe snapshots
### Fixes
- https://github.com/pingcap/tidb/pull/61925
(...to be more detailed)
### Next step
After finishing the refactoring, we will then implement *protected snapshots* upon it. We will then track that task in another issue.
Contributor guide
Assessment
This issue has not been assessed yet.