pingcap / pingcap/tidb

BR: Restore pre-split fails with "split key exceeds limit" when restoring to TiDB X (BYOC)

Open
#67,209 2 comments 0 reactions 0 assignees View on GitHub
affects-8.5 component/br contribution may-affects-7.1 may-affects-7.5 may-affects-8.1 severity/major type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

### 1. Minimal reproduce step (Required)

1. Backup a large-scale TiDB cluster with high region density.
2. Restore to **TiDB X (BYOC)** using BR.
3. During **Restore Pre-split**, BR generates > 1024 split keys for a single range/table.
4. BR sends all keys in one RPC batch, which the **rfstore** module rejects (hard limit: 1024).

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

BR should automatically **chunk split key requests** into multiple batches (e.g., max 1024 per RPC) to ensure compatibility with cloud storage engine constraints without manual tuning.

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

Restore fails with "split key count exceeds limit."

Currently, users must use "hacky" workarounds to bypass this:
* `--merge-region-size-bytes=1159296000`
* `--merge-region-key-count=115000000`

These parameters force oversized regions and cause post-restore performance imbalances.

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

v8.5.0

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.