pingcap / pingcap/tidb

br: pitr restore may be stuck when only few of regions and splitting triggered

Open
#61,579 1 comment 0 reactions 0 assignees View on GitHub
component/br severity/major type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

From [AskTUG](https://asktug.com/t/topic/1042889/21).

### 1. Minimal reproduce step (Required)

1. Start a cluster.
2. Start a log backup task.
3. Write data immediately with enough throughput (maybe `sysbench prepare`) to generate log files huge enough to trigger split when restoring.
4. Drop existing databases and restore.

### 2. What did you expect to see? (Required)

Restore successed.

### 3. What did you see instead (Required)

Restore was stuck at splitting tables.

```
github.com/tikv/pd/client.(*client).ScanRegions(/*pd_client*/0xc000cf40a0, /*ctx*/{0x56808b0, 0xc003539740}, /*start_key*/{0x0, 0x0, 0x0}, /*end_key*/{0xc0031279f8, 0x12, 0x12}, /*limit*/0x40)
/go/pkg/mod/github.com/tikv/pd/client@v0.0.0-20230213111801-7d0389306a8b/client.go:1519+0x637
```

### 4. What is your TiDB version? (Required)

v6.6.0

### Notes

Here:
https://github.com/pingcap/tidb/blob/a165d9fd7c01dbde901701ea9312ccd41b0268dc/br/pkg/restore/split/splitter.go#L275-L299

If last of scanned region is the last region (end key = ""), this may be sutck in an infinite loop.

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.