pingcap / pingcap/tidb

GC: Support TiDB server with different keyspace to advance GC safe point separately

Open
#51,593 0 comments 0 reactions 0 assignees View on GitHub
type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement
Support TiDB with different keyspace to advance gc separately.

## Background
TiDB already supports deploying multiple clusters with different keyspaces on a single PD TiKV cluster.

Previously, we have implemented multiple TiDB clusters with a single TiDB GC Worker that does not configure Keyspace to advance the global GC safe point. Each keyspace TiDB only depends on the global GC safepoint. Do your own deleteRange cleanup.

The PR https://github.com/pingcap/tidb/pull/51300 Implement that the keyspace TiDB cluster can advance the GC safe point of the current Keyspace in the Keyspace dimension by itself after enabling keyspace level GC. In this way, the GC safe points between keyspaces are separated, so that if one Keyspace GC safe point is advancing slowly, it can not affect the GC safe points of other keyspaces.

## Implementation
1. If the `keyspace-name` is not configured in TiDB, nothing will be changed.
2. If the keyspace meta doesn't configure keyspace level GC, it will still use the global GC, nothing will be changed.
3. The following storage and GC and safe point ETCD keys are distinguished by keyspace:
* Minstartts
* Saved safe point
* GC safe point
* Service safe point
5. One limitation: If either TiDB with keyspace sets keyspace level GC, then this keyspace cannot be returned global GC.

## Related Tasks
### TiDB Server support keyspace level GC
- [] https://github.com/pingcap/tidb/pull/51300

### TiDB BR,Lightning,Dumpling,CDC implementation

- [ ] https://github.com/pingcap/tidb/issues/51622

### PD interface implementation

- [x] https://github.com/tikv/pd/pull/6419

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.