Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2225bb9
v8.5.5 br: add variable `tidb_advancer_check_point_lag_limit` to cont…
ti-chi-bot Dec 29, 2025
dd233dc
v8.5.5: Add circuit breaker variable (#20129) (#22171)
ti-chi-bot Dec 29, 2025
dd0fb09
v8.5.5 br: add compact log backup (#20342) (#22209)
ti-chi-bot Dec 29, 2025
e9a4dd1
v8.5.5 br: add compatibility between log backup and PITR (#20485) (#2…
ti-chi-bot Dec 29, 2025
8e9d2d2
Merge branch 'release-8.5' into feature/preview-v8.5.5
qiancai Jan 6, 2026
3e6d7e6
v8.5.5 br: remove outdated PITR limitation (#22262) (#22264)
ti-chi-bot Jan 6, 2026
2e6ca82
v8.5.5 br: pitr filter feature release doc (#21109) (#22199)
ti-chi-bot Jan 6, 2026
17b506f
v8.5.5 restore: update the definition of the parameter --load-stats a…
ti-chi-bot Jan 6, 2026
15ee7a0
v8.5.5 br: support pitr filter and concurrent restore (#21835) (#22201)
ti-chi-bot Jan 6, 2026
f9a1834
v8.5.5 br: pitr restore mode (#21254) (#22238)
ti-chi-bot Jan 6, 2026
3d1c460
v8.5.5 br: provide a storage target option for BR restore checkpoint …
ti-chi-bot Jan 7, 2026
14f5dc5
v8.5.5 br: improve visualization of BR (#20493) (#22237)
ti-chi-bot Jan 8, 2026
846f118
Merge branch 'release-8.5' into feature/preview-v8.5.5
qiancai Jan 13, 2026
157a642
v8.5.5 br: add ddl job none error report (#22300) (#22308)
ti-chi-bot Jan 13, 2026
5d9eb98
v8.5.5: add config for graceful shutdown (#22158)
hujiatao0 Jan 13, 2026
d68ac51
Merge branch 'release-8.5' into feature/preview-v8.5.5
qiancai Jan 13, 2026
0a8c7a1
v8.5.5: Add index lookup push down content (#22196) (#22252)
ti-chi-bot Jan 13, 2026
fd00a09
v8.5.5: include storage engines in slow query logs and statements sum…
ti-chi-bot Jan 13, 2026
e33ffab
v8.5.5: add doc for async-batch-get (#22152) (#22311)
ti-chi-bot Jan 13, 2026
7c03ee9
Merge branch 'release-8.5' into feature/preview-v8.5.5
qiancai Jan 13, 2026
28c2a0d
v8.5.5 pd,tidb: support affinity schedule (#22270) (#22315)
ti-chi-bot Jan 14, 2026
d0f71b3
v8.5.5: add store limit support (#22297) (#22314)
ti-chi-bot Jan 14, 2026
d6c3e74
v8.5.5: Add unified.cpu-threshold config (#22167) (#22312)
ti-chi-bot Jan 14, 2026
e42b42f
v8.5.5 scheduler: network slow store scheduler enhancement (#22269) (…
ti-chi-bot Jan 14, 2026
da93fa6
v8.5: bump up the latest version to v8.5.5 (#22322)
qiancai Jan 14, 2026
91a88fa
Merge branch 'release-8.5' into feature/preview-v8.5.5
qiancai Jan 14, 2026
b5b1386
v8.5.5 br: add a new authentication method for Azure (#22267) (#22324)
ti-chi-bot Jan 14, 2026
2c276f6
Update upgrade-tidb-using-tiup.md
qiancai Jan 15, 2026
392f679
Update upgrade-tidb-using-tiup.md
qiancai Jan 15, 2026
e466dbd
Update upgrade-tidb-using-tiup.md
qiancai Jan 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@
- [Use Overview](/br/br-use-overview.md)
- [Snapshot Backup and Restore Guide](/br/br-snapshot-guide.md)
- [Log Backup and PITR Guide](/br/br-pitr-guide.md)
- [Compact Log Backup](/br/br-compact-log-backup.md)
- [Use Cases](/br/backup-and-restore-use-cases.md)
- [Backup Storages](/br/backup-and-restore-storages.md)
- BR CLI Manuals
Expand Down
1 change: 0 additions & 1 deletion br/backup-and-restore-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ This section describes the prerequisites for using TiDB backup and restore, incl
### Restrictions

- PITR only supports restoring data to **an empty cluster**.
- PITR only supports cluster-level restore and does not support database-level or table-level restore.
- PITR does not support restoring the data of user tables or privilege tables from system tables.
- BR does not support running multiple backup tasks on a cluster **at the same time**.
- It is not recommended to back up tables that are being restored, because the backed-up data might be problematic.
Expand Down
4 changes: 3 additions & 1 deletion br/backup-and-restore-use-cases.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ tiup br restore point --pd="${PD_IP}:2379" \
--full-backup-storage='s3://tidb-pitr-bucket/backup-data/snapshot-20220514000000' \
--restored-ts '2022-05-15 18:00:00+0800'

Full Restore <--------------------------------------------------------------------------------------------------------------------------------------------------------> 100.00%
Split&Scatter Region <--------------------------------------------------------------------------------------------------------------------------------------------------------> 100.00%
Download&Ingest SST <--------------------------------------------------------------------------------------------------------------------------------------------------------> 100.00%
Restore Pipeline <--------------------------------------------------------------------------------------------------------------------------------------------------------> 100.00%
[2022/05/29 18:15:39.132 +08:00] [INFO] [collector.go:69] ["Full Restore success summary"] [total-ranges=12] [ranges-succeed=xxx] [ranges-failed=0] [split-region=xxx.xxxµs] [restore-ranges=xxx] [total-take=xxx.xxxs] [restore-data-size(after-compressed)=xxx.xxx] [Size=xxxx] [BackupTS={TS}] [total-kv=xxx] [total-kv-size=xxx] [average-speed=xxx]
Restore Meta Files <--------------------------------------------------------------------------------------------------------------------------------------------------> 100.00%
Restore KV Files <----------------------------------------------------------------------------------------------------------------------------------------------------> 100.00%
Expand Down
82 changes: 78 additions & 4 deletions br/br-checkpoint-restore.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ If your TiDB cluster is large and cannot afford to restore again after a failure

## Implementation principles

The implementation of checkpoint restore is divided into two parts: snapshot restore and log restore. For more information, see [Implementation details](#implementation-details).
The implementation of checkpoint restore is divided into two parts: snapshot restore and log restore. For more information, see [Implementation details: store checkpoint data in the downstream cluster](#implementation-details-store-checkpoint-data-in-the-downstream-cluster) and [Implementation details: store checkpoint data in the external storage](#implementation-details-store-checkpoint-data-in-the-external-storage).

### Snapshot restore

Expand Down Expand Up @@ -65,7 +65,11 @@ After a restore failure, avoid writing, deleting, or creating tables in the clus

Cross-major-version checkpoint recovery is not recommended. For clusters where `br` recovery fails using the Long-Term Support (LTS) versions prior to v8.5.0, recovery cannot be continued with v8.5.0 or later LTS versions, and vice versa.

## Implementation details
## Implementation details: store checkpoint data in the downstream cluster

> **Note:**
>
> Starting from v8.5.5, BR stores checkpoint data in the downstream cluster by default. You can specify an external storage for checkpoint data using the `--checkpoint-storage` parameter.

Checkpoint restore operations are divided into two parts: snapshot restore and PITR restore.

Expand All @@ -81,8 +85,78 @@ If the restore fails and you try to restore backup data with different checkpoin

[PITR (Point-in-time recovery)](/br/br-pitr-guide.md) consists of snapshot restore and log restore phases.

During the initial restore, `br` first enters the snapshot restore phase. This phase follows the same process as the preceding [snapshot restore](#snapshot-restore-1): BR records the checkpoint data, the upstream cluster ID, and BackupTS of the backup data (that is, the start time point `start-ts` of log restore) in the `__TiDB_BR_Temporary_Snapshot_Restore_Checkpoint` database. If restore fails during this phase, you cannot adjust the `start-ts` of log restore when resuming checkpoint restore.
During the initial restore, `br` first enters the snapshot restore phase. BR records the checkpoint data, the upstream cluster ID, BackupTS of the backup data (that is, the start time point `start-ts` of log restore) and the restored time point `restored-ts` of log restore in the `__TiDB_BR_Temporary_Snapshot_Restore_Checkpoint` database. If restore fails during this phase, you cannot adjust the `start-ts` and `restored-ts` of log restore when resuming checkpoint restore.

When entering the log restore phase during the initial restore, `br` creates a `__TiDB_BR_Temporary_Log_Restore_Checkpoint` database in the target cluster. This database records checkpoint data, the upstream cluster ID, and the restore time range (`start-ts` and `restored-ts`). If restore fails during this phase, you need to specify the same `start-ts` and `restored-ts` as recorded in the checkpoint database when retrying. Otherwise, `br` will report an error and prompt that the current specified restore time range or upstream cluster ID is different from the checkpoint record. If the restore cluster has been cleaned, you can manually delete the `__TiDB_BR_Temporary_Log_Restore_Checkpoint` database and retry with a different backup.

Before entering the log restore phase during the initial restore, `br` constructs a mapping of upstream and downstream cluster database and table IDs at the `restored-ts` time point. This mapping is persisted in the system table `mysql.tidb_pitr_id_map` to prevent duplicate allocation of database and table IDs. Deleting data from `mysql.tidb_pitr_id_map` might lead to inconsistent PITR restore data.
Note that before entering the log restore phase during the initial restore, `br` constructs a mapping of upstream and downstream cluster database and table IDs at the `restored-ts` time point. This mapping is persisted in the system table `mysql.tidb_pitr_id_map` to prevent duplicate allocation of database and table IDs. **Deleting data from `mysql.tidb_pitr_id_map` arbitrarily might lead to inconsistent PITR restore data.**

> **Note:**
>
> To ensure compatibility with clusters of earlier versions, starting from v8.5.5, if the system table `mysql.tidb_pitr_id_map` does not exist in the restore cluster, the `pitr_id_map` data will be written to the log backup directory. The file name is `pitr_id_maps/pitr_id_map.cluster_id:{downstream-cluster-ID}.restored_ts:{restored-ts}`.

## Implementation details: store checkpoint data in the external storage

> **Note:**
>
> Starting from v8.5.5, BR stores checkpoint data in the downstream cluster by default. You can specify an external storage for checkpoint data using the `--checkpoint-storage` parameter. For example:
>
> ```shell
> ./br restore full -s "s3://backup-bucket/backup-prefix" --checkpoint-storage "s3://temp-bucket/checkpoints"
> ```

In the external storage, the directory structure of the checkpoint data is as follows:

- Root path `restore-{downstream-cluster-ID}` uses the downstream cluster ID `{downstream-cluster-ID}` to distinguish between different restore clusters.
- Path `restore-{downstream-cluster-ID}/log` stores log file checkpoint data during the log restore phase.
- Path `restore-{downstream-cluster-ID}/sst` stores checkpoint data of the SST files that are not backed up by log backup during the log restore phase.
- Path `restore-{downstream-cluster-ID}/snapshot` stores checkpoint data during the snapshot restore phase.

```
.
`-- restore-{downstream-cluster-ID}
|-- log
| |-- checkpoint.meta
| |-- data
| | |-- {uuid}.cpt
| | |-- {uuid}.cpt
| | `-- {uuid}.cpt
| |-- ingest_index.meta
| `-- progress.meta
|-- snapshot
| |-- checkpoint.meta
| |-- checksum
| | |-- {uuid}.cpt
| | |-- {uuid}.cpt
| | `-- {uuid}.cpt
| `-- data
| |-- {uuid}.cpt
| |-- {uuid}.cpt
| `-- {uuid}.cpt
`-- sst
`-- checkpoint.meta
```

Checkpoint restore operations are divided into two parts: snapshot restore and PITR restore.

### Snapshot restore

During the initial restore, `br` creates a `restore-{downstream-cluster-ID}/snapshot` path in the specified external storage. In this path, `br` records checkpoint data, the upstream cluster ID, and the BackupTS of the backup data.

If the restore fails, you can retry it using the same command. `br` will automatically read the checkpoint information from the specified external storage path and resume from the last restore point.

If the restore fails and you try to restore backup data with different checkpoint information to the same cluster, `br` reports an error. It indicates that the current upstream cluster ID or BackupTS is different from the checkpoint record. If the restore cluster has been cleaned, you can manually clean up the checkpoint data in the external storage or specify another external storage path to store checkpoint data, and retry with a different backup.

### PITR restore

[PITR (Point-in-time recovery)](/br/br-pitr-guide.md) consists of snapshot restore and log restore phases.

During the initial restore, `br` first enters the snapshot restore phase. BR records the checkpoint data, the upstream cluster ID, BackupTS of the backup data (that is, the start time point `start-ts` of log restore) and the restored time point `restored-ts` of log restore in the `restore-{downstream-cluster-ID}/snapshot` path. If restore fails during this phase, you cannot adjust the `start-ts` and `restored-ts` of log restore when resuming checkpoint restore.

When entering the log restore phase during the initial restore, `br` creates a `restore-{downstream-cluster-ID}/log` path in the specified external storage. This path records checkpoint data, the upstream cluster ID, and the restore time range (`start-ts` and `restored-ts`). If restore fails during this phase, you need to specify the same `start-ts` and `restored-ts` as recorded in the checkpoint database when retrying. Otherwise, `br` will report an error and prompt that the current specified restore time range or upstream cluster ID is different from the checkpoint record. If the restore cluster has been cleaned, you can manually clean up the checkpoint data in the external storage or specify another external storage path to store checkpoint data, and retry with a different backup.

Note that before entering the log restore phase during the initial restore, `br` constructs a mapping of the database and table IDs in the upstream and downstream clusters at the `restored-ts` time point. This mapping is persisted in the checkpoint storage with the file name `pitr_id_maps/pitr_id_map.cluster_id:{downstream-cluster-ID}.restored_ts:{restored-ts}` to prevent duplicate allocation of database and table IDs. **Deleting files from the directory `pitr_id_maps` arbitrarily might lead to inconsistent PITR restore data.**

> **Note:**
>
> To ensure compatibility with clusters of earlier versions, starting from v8.5.5, if the system table `mysql.tidb_pitr_id_map` does not exist in the restore cluster and the `--checkpoint-storage` parameter is not specified, the `pitr_id_map` data will be written to the log backup directory. The file name is `pitr_id_maps/pitr_id_map.cluster_id:{downstream-cluster-ID}.restored_ts:{restored-ts}`.
85 changes: 85 additions & 0 deletions br/br-compact-log-backup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
title: Compact Log Backup
summary: Learn how to improve Point-in-time Recovery (PITR) efficiency by compacting log backups into the SST format.
---

# Compact Log Backup

This document describes how to improve the efficiency of point-in-time recovery ([PITR](/glossary.md#point-in-time-recovery-pitr)) by compacting log backups into the [SST](/glossary.md#static-sorted-table--sorted-string-table-sst) format.

## Overview

Traditional log backups store write operations in a highly unstructured manner, which can lead to the following issues:

- **Reduced recovery performance**: unordered data has to be written to the cluster one by one through the Raft protocol.
- **Write amplification**: all writes must be compacted from L0 to the bottommost level by level.
- **Dependency on full backups**: frequent full backups are required to control the amount of recovery data, which can impact application operations.

Starting from v8.5.5, the compact log backup feature provides offline compaction capabilities, converting unstructured log backup data into structured SST files. This results in the following improvements:

- SST files can be quickly imported into the cluster, **improving recovery performance**.
- Redundant data is removed during compaction, **reducing storage space consumption**.
- You can set longer full backup intervals while ensuring the Recovery Time Objective (RTO), **reducing the impact on applications**.

## Limitations

- Compact log backup is not a replacement for full backups. It must be used in conjunction with periodic full backups. To ensure PITR capability, the compacting process retains all MVCC versions. Failing to perform full backups for a long time can lead to excessive storage usage and might cause issues when restoring data later.
- Currently, compacting backups with local encryption enabled is not supported.

## Use compact log backup

Currently, only manual compaction of log backups is supported, and the process is complex. **It is recommended to use the upcoming TiDB Operator solution for compacting log backups in production environments.**

### Manual compaction

This section describes the steps for manually compacting log backups.

#### Prerequisites

Manual compaction of log backups requires two tools: `tikv-ctl` and `br`.

#### Step 1: Encode storage to Base64

Execute the following encoding command:

```shell
br operator base64ify --storage "s3://your/log/backup/storage/here" --load-creds
```

> **Note:**
>
> - If the `--load-creds` option is included when you execute the preceding command, the encoded Base64 string contains credential information loaded from the current BR environment. Note to ensure proper security and access control.
> - The `--storage` value matches the storage output from the `log status` command of the log backup task.
#### Step 2: Execute log compaction

With the Base64-encoded storage, you can initiate the compaction using `tikv-ctl`. Note that the default log level of `tikv-ctl` is `warning`. Use `--log-level info` to obtain more detailed information:

```shell
tikv-ctl --log-level info compact-log-backup \
--from "<start-tso>" --until "<end-tso>" \
-s 'bAsE64==' -N 8
```

Parameter descriptions:

- `-s`: the Base64-encoded storage string obtained earlier.
- `-N`: the maximum number of concurrent log compaction tasks.
- `--from`: the start timestamp for compaction.
- `--until`: the end timestamp for compaction.

The `--from` and `--until` parameters define the time range for the compaction operation. The compaction operation handles all log files containing write operations within the specified time range, so the generated SST files might include data outside this range.

To obtain the timestamp for a specific point in time, execute the following command:

```shell
echo $(( $(date --date '2004-05-06 15:02:01Z' +%s%3N) << 18 ))
```

> **Note:**
>
> If you are a macOS user, you need to install `coreutils` via Homebrew and use `gdate` instead of `date`.
>
> ```shell
> echo $(( $(gdate --date '2004-05-06 15:02:01Z' +%s%3N) << 18 ))
> ```
6 changes: 5 additions & 1 deletion br/br-pitr-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,17 @@ tiup br restore point --pd "${PD_IP}:2379" \
During data restore, you can view the progress through the progress bar in the terminal. The restore is divided into two phases, full restore and log restore (restore meta files and restore KV files). After each phase is completed, `br` outputs information such as restore time and data size.

```shell
Full Restore <--------------------------------------------------------------------------------------------------------------------------------------------------------> 100.00%
Split&Scatter Region <--------------------------------------------------------------------------------------------------------------------------------------------------------> 100.00%
Download&Ingest SST <--------------------------------------------------------------------------------------------------------------------------------------------------------> 100.00%
Restore Pipeline <--------------------------------------------------------------------------------------------------------------------------------------------------------> 100.00%
*** ["Full Restore success summary"] ****** [total-take=xxx.xxxs] [restore-data-size(after-compressed)=xxx.xxx] [Size=xxxx] [BackupTS={TS}] [total-kv=xxx] [total-kv-size=xxx] [average-speed=xxx]
Restore Meta Files <--------------------------------------------------------------------------------------------------------------------------------------------------> 100.00%
Restore KV Files <----------------------------------------------------------------------------------------------------------------------------------------------------> 100.00%
*** ["restore log success summary"] [total-take=xxx.xx] [restore-from={TS}] [restore-to={TS}] [total-kv-count=xxx] [total-size=xxx]
```

During data restore, the table mode of the target table is automatically set to `restore`. Tables in `restore` mode do not allow any read or write operations. After data restore is complete, the table mode automatically switches back to `normal`, and you can read and write the table normally. This mechanism ensures task stability and data consistency throughout the restore process.

## Clean up outdated data

As described in the [Usage Overview of TiDB Backup and Restore](/br/br-use-overview.md):
Expand Down
Loading