tikv / tikv/pd

global GC barrier invariant can be break when disable/enable the keyspaces

Open
#9,672 1 comment 0 reactions 0 assignees View on GitHub
contribution may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 may-affects-8.5 severity/major type/bug
Dominant language
Go
Stars
1.2k
Forks
783
Avg merge
5d 21h
Merged PRs (30d)
36

Description

## Bug Report

### What did you do?

By design, [global GC barrier](https://github.com/tikv/pd/pull/9636) API should have the invariance that:

```
txn safe point of all keyspaces < any global GC barrier
```

I found a case this invariant no longer hold, when keyspace disable and enable.

For example, we have ks1, ks2, ks3 ... and their txn safe point is 100, 200, 300 respectively.

If we set a global GC barrier now, the value must be greater than 300.

Then, assume that keyspace ks3 is disabled.
And we set a global GC barrier with barrier ts = 250,
this operation could success because this barrier ts is greater than all keyspaces' txn safe point.

Then, we enable keyspace ks3.
The invariance is broken!

### What did you expect to see?

This rule should always hold:

```
txn safe point of all keyspaces < any global GC barrier
```

### What did you see instead?

keyspace disable and enable, we can break the rule.

### What version of PD are you using (`pd-server -V`)?

master 2025-08-19
The API is not on any released pd version yet.

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.