Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank945946 committed Dec 11, 2024
2 parents 1f852bb + cae5e85 commit b52f047
Show file tree
Hide file tree
Showing 99 changed files with 1,153 additions and 625 deletions.
19 changes: 0 additions & 19 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -1,36 +1,17 @@
# See the OWNERS docs at https://go.k8s.io/owners
approvers:
- breezewish
- CaitinChen
- CharLotteiu
- cofyc
- csuzhangxc
- DanielZhangQD
- dcalvin
- dragonly
- en-jin19
- hfxsd
- Icemap
- jackysp
- kissmydb
- lance6716
- lichunzhu
- lilin90
- Liuxiaozhen12
- morgo
- Oreoxmt
- overvenus
- qiancai
- queenypingcap
- ran-huang
- shichun-0415
- SunRunAway
- tangenta
- TomShawn
- toutdesuite
- WangXiangUSTC
- yikeke
- YiniXu9506
reviewers:
- 3pointer
- amyangfei
Expand Down
2 changes: 2 additions & 0 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@
- [TiKV 线程调优](/tune-tikv-thread-performance.md)
- [TiKV 内存调优](/tune-tikv-memory-performance.md)
- [TiKV Follower Read](/follower-read.md)
- [TiKV MVCC 内存引擎](/tikv-in-memory-engine.md)
- [Region 性能调优](/tune-region-performance.md)
- [TiFlash 调优](/tiflash/tune-tiflash-performance.md)
- [下推计算结果缓存](/coprocessor-cache.md)
Expand Down Expand Up @@ -735,6 +736,7 @@
- SQL 语句
- [概览](/sql-statements/sql-statement-overview.md)
- [`ADMIN`](/sql-statements/sql-statement-admin.md)
- [`ADMIN ALTER DDL JOBS`](/sql-statements/sql-statement-admin-alter-ddl.md)
- [`ADMIN CANCEL DDL`](/sql-statements/sql-statement-admin-cancel-ddl.md)
- [`ADMIN CHECKSUM TABLE`](/sql-statements/sql-statement-admin-checksum-table.md)
- [`ADMIN CHECK [TABLE|INDEX]`](/sql-statements/sql-statement-admin-check-table-index.md)
Expand Down
8 changes: 3 additions & 5 deletions accelerated-table-creation.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@ TiDB v7.6.0 引入了系统变量 [`tidb_ddl_version`](https://docs.pingcap.com/

合并后的批量建表语句在同一个事务内执行,如果其中一个语句失败,所有语句都会失败。

> **警告:**
>
> TiDB 加速建表目前为实验特性,不建议在生产环境中使用。该功能可能会在未事先通知的情况下发生变化或删除。如果发现 bug,请在 GitHub 上提 [issue](https://github.com/pingcap/tidb/issues) 反馈。
## 与 TiDB 工具的兼容性

- [TiCDC](/ticdc/ticdc-overview.md) 暂不支持同步通过 TiDB 加速创建的表。
- 在 TiDB v8.3.0 之前的版本中,[TiCDC](/ticdc/ticdc-overview.md) 不支持同步通过 TiDB 加速创建的表。从 v8.3.0 开始,TiCDC 可以正常同步这类表

## 限制

Expand All @@ -28,6 +24,8 @@ TiDB 加速建表目前仅适用于 [`CREATE TABLE`](/sql-statements/sql-stateme

你可以通过设置系统变量 [`tidb_enable_fast_create_table`](/system-variables.md#tidb_enable_fast_create_table-从-v800-版本开始引入) 的值来开启或关闭加速建表的功能。

从 TiDB v8.5.0 开始,新创建的集群默认开启 TiDB 加速建表功能,即 `tidb_enable_fast_create_table` 默认值为 `ON`。如果从 v8.4.0 及之前版本的集群升级至 v8.5.0 及之后的版本,`tidb_enable_fast_create_table` 的默认值不发生变化。

要开启该功能,将该变量的值设置为 `ON`

```sql
Expand Down
6 changes: 4 additions & 2 deletions analyze-slow-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ summary: 学习如何定位和分析慢查询。

如上图,发给 `10.6.131.78` 的一个 `cop-task` 等待了 110ms 才被执行,可以判断是当时该实例忙,此时可以打开当时的 CPU 监控辅助判断。

#### 过期 key
#### 过期 MVCC 版本和 key 过多

如果 TiKV 上过期的数据比较多,在扫描的时候则需要处理这些不必要的数据,影响处理速度
如果 TiKV 上过期 MVCC 版本过多,或 GC 历史版本数据的保留时间长,导致累积了过多 MVCC。处理这些不必要的 MVCC 版本会影响扫描速度

这可以通过 `Total_keys``Processed_keys` 判断,如果两者相差较大,则说明旧版本的 key 太多:

Expand All @@ -108,6 +108,8 @@ summary: 学习如何定位和分析慢查询。
...
```

TiDB v8.5.0 引入了内存引擎功能,可以加速这类慢查询。详见 [TiKV MVCC 内存引擎](/tikv-in-memory-engine.md)

### 其他关键阶段慢

#### 取 TS 慢
Expand Down
2 changes: 1 addition & 1 deletion auto-increment.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ SHOW CREATE TABLE t;
| Table | Create Table |
+-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| t | CREATE TABLE `t` (
`a` int(11) NOT NULL AUTO_INCREMENT,
`a` int NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`a`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=101 /*T![auto_id_cache] AUTO_ID_CACHE=100 */ |
+-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Expand Down
2 changes: 1 addition & 1 deletion auto-random.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ tidb> SHOW CREATE TABLE t;
| Table | Create Table |
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| t | CREATE TABLE `t` (
`a` bigint(20) NOT NULL /*T![auto_rand] AUTO_RANDOM(5) */,
`a` bigint NOT NULL /*T![auto_rand] AUTO_RANDOM(5) */,
`b` varchar(255) DEFAULT NULL,
PRIMARY KEY (`a`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin /*T! PRE_SPLIT_REGIONS=2 */ |
Expand Down
2 changes: 1 addition & 1 deletion basic-sql-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ CREATE TABLE table_name column_name data_type constraint;

```sql
CREATE TABLE person (
id INT(11),
id INT,
name VARCHAR(255),
birthday DATE
);
Expand Down
2 changes: 1 addition & 1 deletion best-practices/high-concurrency-best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ ORDER BY
以下全局变量会影响 `PRE_SPLIT_REGIONS` 的行为,需要特别注意:

+ `tidb_scatter_region`:该变量用于控制建表完成后是否等待预切分和打散 Region 完成后再返回结果。如果建表后有大批量写入,需要设置该变量值为 `1`,表示等待所有 Region 都切分和打散完成后再返回结果给客户端。否则未打散完成就进行写入会对写入性能影响有较大的影响。
+ [`tidb_scatter_region`](/system-variables.md#tidb_scatter_region):该变量用于控制建表完成后是否等待预切分和打散 Region 完成后再返回结果。如果建表后有大批量写入,需要设置该变量值为 `global`,表示等待所有 Region 都切分和打散完成后再返回结果给客户端。否则未打散完成就进行写入会对写入性能影响有较大的影响。

示例:

Expand Down
24 changes: 8 additions & 16 deletions br/br-pitr-manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ tiup br log start \
### 加密日志备份数据
> **警告:**
>
> 当前该功能为实验特性,不建议在生产环境中使用。如果发现 bug,请在 GitHub 上提 [issue](https://github.com/pingcap/tidb/issues) 反馈。
BR 支持在上传到备份存储之前对日志备份数据进行加密。
自 TiDB v8.4.0 起,你可以在日志备份命令中传入以下参数来加密日志备份数据,类似于[快照备份加密](/br/br-snapshot-manual.md#备份数据加密):
Expand Down Expand Up @@ -360,7 +356,7 @@ Global Flags:
```shell
tiup br log truncate --until='2022-07-26 21:20:00+0800' \
–-storage='s3://backup-101/logbackup?access-key=${access-key}&secret-access-key=${secret-access-key}"'
--storage='s3://backup-101/logbackup?access-key=${access-key}&secret-access-key=${secret-access-key}'
```
该子命令运行后输出以下信息:
Expand Down Expand Up @@ -400,7 +396,7 @@ Global Flags:
使用示例:
```shell
tiup br log metadata –-storage='s3://backup-101/logbackup?access-key=${access-key}&secret-access-key=${secret-access-key}"'
tiup br log metadata --storage='s3://backup-101/logbackup?access-key=${access-key}&secret-access-key=${secret-access-key}'
```
该子命令运行后输出以下信息:
Expand Down Expand Up @@ -454,8 +450,8 @@ Global Flags:
```shell
tiup br restore point --pd="${PD_IP}:2379"
--storage='s3://backup-101/logbackup?access-key=${access-key}&secret-access-key=${secret-access-key}"'
--full-backup-storage='s3://backup-101/snapshot-202205120000?access-key=${access-key}&secret-access-key=${secret-access-key}"'
--storage='s3://backup-101/logbackup?access-key=${access-key}&secret-access-key=${secret-access-key}'
--full-backup-storage='s3://backup-101/snapshot-202205120000?access-key=${access-key}&secret-access-key=${secret-access-key}'

Full Restore <--------------------------------------------------------------------------------------------------------------------------------------------------------> 100.00%
*** ***["Full Restore success summary"] ****** [total-take=3.112928252s] [restore-data-size(after-compressed)=5.056kB] [Size=5056] [BackupTS=434693927394607136] [total-kv=4] [total-kv-size=290B] [average-speed=93.16B/s]
Expand All @@ -472,18 +468,14 @@ Restore KV Files <--------------------------------------------------------------
### 恢复加密的日志备份数据
> **警告:**
>
> 当前该功能为实验特性,不建议在生产环境中使用。如果发现 bug,请在 GitHub 上提 [issue](https://github.com/pingcap/tidb/issues) 反馈。
要恢复加密的日志备份数据,你需要在恢复命令中传入相应的解密参数。解密参数需要与加密时使用的参数一致。如果解密算法或密钥不正确,则无法恢复数据。
示例如下:
```shell
tiup br restore point --pd="${PD_IP}:2379"
--storage='s3://backup-101/logbackup?access-key=${ACCESS-KEY}&secret-access-key=${SECRET-ACCESS-KEY}"'
--full-backup-storage='s3://backup-101/snapshot-202205120000?access-key=${ACCESS-KEY}&secret-access-key=${SECRET-ACCESS-KEY}"'
--storage='s3://backup-101/logbackup?access-key=${ACCESS-KEY}&secret-access-key=${SECRET-ACCESS-KEY}'
--full-backup-storage='s3://backup-101/snapshot-202205120000?access-key=${ACCESS-KEY}&secret-access-key=${SECRET-ACCESS-KEY}'
--crypter.method aes128-ctr
--crypter.key 0123456789abcdef0123456789abcdef
--log.crypter.method aes128-ctr
Expand All @@ -494,8 +486,8 @@ tiup br restore point --pd="${PD_IP}:2379"
```shell
tiup br restore point --pd="${PD_IP}:2379"
--storage='s3://backup-101/logbackup?access-key=${ACCESS-KEY}&secret-access-key=${SECRET-ACCESS-KEY}"'
--full-backup-storage='s3://backup-101/snapshot-202205120000?access-key=${ACCESS-KEY}&secret-access-key=${SECRET-ACCESS-KEY}"'
--storage='s3://backup-101/logbackup?access-key=${ACCESS-KEY}&secret-access-key=${SECRET-ACCESS-KEY}'
--full-backup-storage='s3://backup-101/snapshot-202205120000?access-key=${ACCESS-KEY}&secret-access-key=${SECRET-ACCESS-KEY}'
--crypter.method aes128-ctr
--crypter.key 0123456789abcdef0123456789abcdef
--master-key-crypter-method aes128-ctr
Expand Down
11 changes: 2 additions & 9 deletions br/br-snapshot-manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ tiup br backup full \

> **注意:**
>
> BR 工具已支持自适应 GC,会自动将 `backupTS`(默认是最新的 PD timestamp)注册到 PD 的 `safePoint`,保证 TiDB 的 GC Safe Point 在备份期间不会向前移动,即可避免手动设置 GC。
> - 从 v8.5.0 起,在进行全量备份时,BR 工具默认不计算表级别的 checksum (`--checksum=false`) 以提升备份性能。
> - BR 工具已支持自适应 GC,会自动将 `backupTS`(默认是最新的 PD timestamp)注册到 PD 的 `safePoint`,保证 TiDB 的 GC Safe Point 在备份期间不会向前移动,即可避免手动设置 GC。
备份期间终端会显示进度条,效果如下。当进度条达到 100% 时,表示备份完成。

Expand Down Expand Up @@ -135,10 +136,6 @@ tiup br restore full \

## 备份数据加密

> **警告:**
>
> 当前该功能为实验特性,不建议在生产环境中使用。
br 命令行工具支持在备份端,或备份到 Amazon S3 的时候在[存储服务端进行备份数据加密](/br/backup-and-restore-storages.md#amazon-s3-存储服务端加密备份数据),你可以根据自己情况选择其中一种使用。

自 TiDB v5.3.0 起,你可配置下列参数在备份过程中实现数据加密:
Expand Down Expand Up @@ -278,10 +275,6 @@ ADMIN RELOAD BINDINGS;

## 恢复加密的快照备份数据

> **警告:**
>
> 当前该功能为实验特性,不建议在生产环境中使用。
在对数据做加密备份后,恢复操作需传入相应的解密参数,解密算法或密钥不正确则无法恢复,解密参数和加密参数一致即可。解密恢复的示例如下:

```shell
Expand Down
8 changes: 4 additions & 4 deletions cached-tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ SHOW CREATE TABLE users;
| Table | Create Table |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| users | CREATE TABLE `users` (
`id` bigint(20) NOT NULL,
`id` bigint NOT NULL,
`name` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin /* CACHED ON */ |
Expand Down Expand Up @@ -170,10 +170,10 @@ SHOW CREATE TABLE mysql.table_cache_meta\G
*************************** 1. row ***************************
Table: table_cache_meta
Create Table: CREATE TABLE `table_cache_meta` (
`tid` bigint(11) NOT NULL DEFAULT '0',
`tid` bigint NOT NULL DEFAULT '0',
`lock_type` enum('NONE','READ','INTEND','WRITE') NOT NULL DEFAULT 'NONE',
`lease` bigint(20) NOT NULL DEFAULT '0',
`oldReadLease` bigint(20) NOT NULL DEFAULT '0',
`lease` bigint NOT NULL DEFAULT '0',
`oldReadLease` bigint NOT NULL DEFAULT '0',
PRIMARY KEY (`tid`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
1 row in set (0.00 sec)
Expand Down
2 changes: 1 addition & 1 deletion clustered-indexes.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ mysql> SHOW CREATE TABLE t;
| Table | Create Table |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| t | CREATE TABLE `t` (
`a` bigint(20) NOT NULL,
`a` bigint NOT NULL,
`b` varchar(255) DEFAULT NULL,
PRIMARY KEY (`a`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
Expand Down
Loading

0 comments on commit b52f047

Please sign in to comment.