Skip to content

Commit 33f277b

Browse files
authored
br: disable restore checksum (#20847)
1 parent abf8970 commit 33f277b

3 files changed

Lines changed: 49 additions & 4 deletions

File tree

br/br-pitr-manual.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,8 @@ Expected output:
409409
410410
> **Note:**
411411
>
412-
> If you specify `--full-backup-storage` as the incremental backup address for `restore point`, for restores of this backup and any previous incremental backups, you need to set the parameter `--allow-pitr-from-incremental` to `true` to make the incremental backups compatible with the subsequent log backups.
412+
> - If you specify `--full-backup-storage` as the incremental backup address for `restore point`, for restores of this backup and any previous incremental backups, you need to set the parameter `--allow-pitr-from-incremental` to `true` to make the incremental backups compatible with the subsequent log backups.
413+
> - For information about checksum configuration, see [Checksum](/br/br-snapshot-manual.md#checksum).
413414
414415
You can run the `tiup br restore point` command to perform a PITR on a new cluster or just restore the log backup data.
415416

br/br-snapshot-manual.md

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ This document describes the commands of TiDB snapshot backup and restore accordi
2121
- [Restore multiple tables with table filter](#restore-multiple-tables-with-table-filter)
2222
- [Restore execution plan bindings from the `mysql` schema](#restore-execution-plan-bindings-from-the-mysql-schema)
2323
- [Restore encrypted snapshots](#restore-encrypted-snapshots)
24+
- [Checksum](#checksum)
2425

2526
For more information about snapshot backup and restore, refer to:
2627

@@ -46,8 +47,7 @@ In the preceding command:
4647

4748
> **Note:**
4849
>
49-
> - Starting from v8.5.0, the BR tool disables the table-level checksum calculation during full backups by default (`--checksum=false`) to improve backup performance.
50-
> - The BR tool already supports self-adapting to GC. It automatically registers `backupTS` (the latest PD timestamp by default) to PD's `safePoint` to ensure that TiDB's GC Safe Point does not move forward during the backup, thus avoiding manually setting GC configurations.
50+
> The BR tool already supports self-adapting to GC. It automatically registers `backupTS` (the latest PD timestamp by default) to PD's `safePoint` to ensure that TiDB's GC Safe Point does not move forward during the backup, thus avoiding manually setting GC configurations.
5151
5252
During backup, a progress bar is displayed in the terminal, as shown below. When the progress bar advances to 100%, the backup is complete.
5353

@@ -186,7 +186,7 @@ In the preceding command:
186186
- `--ratelimit`: The maximum speed **per TiKV** performing restore tasks. The unit is in MiB/s.
187187
- `--log-file`: The target file where the `br` log is written.
188188

189-
During restore, a progress bar is displayed in the terminal as shown below. When the progress bar advances to 100%, the restore task is completed. Then `br` will verify the restored data to ensure data security.
189+
During restore, a progress bar is displayed in the terminal as shown in the following example. When the progress bar advances to 100%, the restore task is completed. After the restore is complete, if table-level [checksum](#checksum) is enabled, the BR tool performs data verification on the table to ensure logical integrity of the data. Note that file-level checksums are always performed to ensure the basic integrity of the restored files.
190190

191191
```shell
192192
Split&Scatter Region <--------------------------------------------------------------------> 100.00%
@@ -311,3 +311,46 @@ tiup br restore full\
311311
--crypter.method aes128-ctr \
312312
--crypter.key 0123456789abcdef0123456789abcdef
313313
```
314+
315+
## Checksum
316+
317+
Checksum is a method used by the BR tool to verify the integrity of backup and restore data. BR supports two levels of checksums:
318+
319+
1. **File-level checksum**: verifies the backup files themselves to ensure integrity during storage and transmission. This level of checksum is always enabled and cannot be disabled.
320+
2. **Table-level checksum**: verifies the integrity of table data and ensures the business logic consistency of the data. This level of checksum is disabled by default, and you can enable it using a parameter.
321+
322+
The following sections describe how BR handles table-level checksums, balancing performance and data safety considerations.
323+
324+
### Backup checksum
325+
326+
Starting from v8.5.0, when performing full backups, the BR tool does not perform table-level checksum verification (`--checksum=false`) by default to improve backup performance. If you need to perform table-level checksums during backup, you can explicitly specify `--checksum=true`. File-level checksums are always performed to ensure the integrity of backup files.
327+
328+
Performing table-level checksums can verify data integrity during backup but increases backup time. In most cases, it is safe to use the default setting (that is, table-level checksum is disabled) to improve backup speed.
329+
330+
### Restore checksum
331+
332+
Starting from v9.0.0, the BR tool does not perform table-level checksum verification (`--checksum=false`) by default during restore operations to improve restore performance. If you need to perform table-level checksum verification, you can explicitly specify `--checksum=true`. File-level checksum verification is always performed to ensure the basic integrity of restored data.
333+
334+
After the restore is complete, data verification is usually performed to ensure data integrity. If the table-level checksum is disabled, the comprehensive verification of table data is skipped, which accelerates the restore process. For scenarios that require strict data integrity, you can enable the table-level checksum.
335+
336+
### Checksum configuration examples
337+
338+
Enable table-level checksums during backup:
339+
340+
```shell
341+
tiup br backup full \
342+
--pd "${PD_IP}:2379" \
343+
--storage "s3://${backup_collection_addr}/snapshot-${date}?access-key=${access-key}&secret-access-key=${secret-access-key}" \
344+
--checksum=true \
345+
--log-file backupfull.log
346+
```
347+
348+
Enable table-level checksums during restore:
349+
350+
```shell
351+
tiup br restore full \
352+
--pd "${PD_IP}:2379" \
353+
--storage "s3://${backup_collection_addr}/snapshot-${date}?access-key=${access-key}&secret-access-key=${secret-access-key}" \
354+
--checksum=true \
355+
--log-file restorefull.log
356+
```

br/use-br-command-line-tool.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ A `tiup br` command consists of multiple layers of sub-commands. Currently, br c
6262
* `--tikv-max-restore-concurrency`: the maximum number of concurrent tasks per TiKV node during snapshot restore.
6363
* `--compression`: determines the compression algorithm used for generating backup files. It supports `lz4`, `snappy`, and `zstd`, with the default being `zstd` (usually no need to modify). For guidance on choosing different compression algorithms, refer to [this document](https://github.com/EighteenZi/rocksdb_wiki/blob/master/Compression.md).
6464
* `--compression-level`: sets the compression level corresponding to the chosen compression algorithm for backup. The default compression level for `zstd` is 3. In most cases there is no need to set this option.
65+
* `--checksum`: controls whether to perform table-level checksum verification during backup and restore. The default value is `false`, meaning that checksum verification is not performed. For more details, see [Checksum](/br/br-snapshot-manual.md#checksum).
6566

6667
## Commands of full backup
6768

0 commit comments

Comments
 (0)