Skip to content

Commit

Permalink
update async commit related configurations
Browse files Browse the repository at this point in the history
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
  • Loading branch information
sticnarf committed Dec 28, 2020
1 parent f9193b3 commit 209c995
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 31 deletions.
40 changes: 37 additions & 3 deletions system-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ SET GLOBAL tidb_distsql_scan_concurrency = 10;
>
> `max_execution_time` 目前对所有类型的语句生效,并非只对 `SELECT` 语句生效,与 MySQL 不同(只对`SELECT` 语句生效)。实际精度在 100ms 级别,而非更准确的毫秒级别。
## `interactive_timeout`
### `interactive_timeout`

- 作用域:SESSION | GLOBAL
- 默认值:28800
- 该变量表示交互式用户会话的空闲超时,单位为秒。交互式用户会话是指使用 `CLIENT_INTERACTIVE` 选项调用 [`mysql_real_connect()`](https://dev.mysql.com/doc/c-api/5.7/en/mysql-real-connect.html) API 建立的会话(例如:MySQL shell 客户端)。该变量与 MySQL 完全兼容。

## `sql_mode`
### `sql_mode`

- 作用域:SESSION | GLOBAL
- 默认值:`ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION`
Expand Down Expand Up @@ -261,7 +261,7 @@ SET GLOBAL tidb_distsql_scan_concurrency = 10;
- 默认值:512
- 这个变量用来控制 DDL 操作失败重试的次数。失败重试次数超过该参数的值后,会取消出错的 DDL 操作。

## `tidb_ddl_reorg_batch_size`
### `tidb_ddl_reorg_batch_size`

- 作用域:GLOBAL
- 默认值:256
Expand Down Expand Up @@ -1005,3 +1005,37 @@ explain select * from t where age=5;
- 作用域:SESSION | GLOBAL
- 默认值:OFF
- 这个变量表示是否追踪聚合函数的内存使用情况。当开启该功能时,聚合函数的内存使用情况会被统计,进而可能会造成整个 SQL 内存统计值超阈值 [`mem-quota-query`](/tidb-configuration-file.md#mem-quota-query),然后被 [`oom-action`](/tidb-configuration-file.md#oom-action) 定义的行为影响。

### `tidb_enable_async_commit` <span class="version-mark">从 v5.0.0-rc 版本开始引入</span>

> **警告:**
>
> 当前该功能为实验特性,不建议在生产环境中使用。目前存在已知问题有:
>
> + 暂时与 [Compaction Filter](/tikv-configuration-file.md#enable-compaction-filter) 不兼容,共同使用时有小概率发生写丢失。

- 作用域:SESSION | GLOBAL
- 默认值:OFF
- 该变量控制是否启用 Async Commit 特性,使事务两阶段提交的第二阶段于后台异步进行。开启本特性能降低事务提交的延迟。本特性与 TiDB Binlog 不兼容,开启 binlog 时本配置将没有效果。
- **注意:开启本特性时,默认不保证事务的外部一致性。具体请参考 [`tidb_guarantee_external_consistency`](#tidb_guarantee_external_consistency) 系统变量。**

<!--
### `tidb_enable_1pc` <span class="version-mark">从 v5.0.0-rc 版本开始引入</span>

> **警告:**
>
> 当前该功能为实验特性,不建议在生产环境中使用。目前存在已知问题有:
>
> + 暂时与 [TiCDC](/ticdc/ticdc-overview.md) 不兼容,可能导致 TiCDC 运行不正常。
> + 暂时与 [Compaction Filter](/tikv-configuration-file.md#enable-compaction-filter) 不兼容,共同使用时有小概率发生数据损坏。

+ 作用域:SESSION | GLOBAL
+ 默认值:OFF
+ 指定是否在只涉及一个 Region 的事务上使用一阶段提交特性。比起传统两阶段提交,一阶段提交能大幅降低事务提交延迟并提升吞吐。
-->

### `tidb_guarantee_external_consistency` <span class="version-mark">从 v5.0.0-rc 版本开始引入</span>

- 作用域:SESSION | GLOBAL
- 默认值:OFF
- 该变量控制在开启 Async Commit <!--和一阶段提交-->特性时,是否需要保证外部一致性。该选项关闭时,如果两个事务修改的内容没有交集,其他事务观测到它们的提交顺序可能与它们实际的提交顺序不一致。在不使用 Async Commit <!--或一阶段提交-->特性时,无论该选项是否开启,都能保证外部一致性。
29 changes: 1 addition & 28 deletions tidb-configuration-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -455,26 +455,7 @@ prepare 语句的 plan cache 设置。
+ TiKV 的负载阈值,如果超过此阈值,会收集更多的 batch 封包,来减轻 TiKV 的压力。仅在 `tikv-client.max-batch-size` 值大于 0 时有效,不推荐修改该值。
+ 默认值:200

### `enable-one-pc` <!-- 从 v5.0 版本开始引入 -->

+ 指定是否在只涉及一个 Region 的事务上使用一阶段提交特性。比起传统两阶段提交,一阶段提交能大幅降低事务提交延迟并提升吞吐。
+ 默认值:false

> **警告:**
>
> 当前该功能为实验特性,不建议在生产环境中使用。目前存在已知问题有:
>
> + 暂时与 [TiCDC](/ticdc/ticdc-overview.md) 不兼容,可能导致 TiCDC 运行不正常。
> + 暂时与 [Follower Read](/follower-read.md)[TiFlash](/tiflash/tiflash-overview.md) 不兼容,使用时无法保证快照隔离。
> + 无法保证外部一致性。
> + 如果在执行 DDL 操作的同时,由于 TiDB 机器宕机等原因导致事务提交异常中断,可能造成数据格式不正确。
## tikv-client.async-commit <!-- 从 v5.0 版本开始引入 -->

### `enable`

+ 指定是否启用 Async Commit 特性,使事务两阶段提交的第二阶段于后台异步进行。开启本特性能降低事务提交的延迟。本特性与 [TiDB Binlog](/tidb-binlog/tidb-binlog-overview.md) 不兼容,开启 binlog 时本配置将没有效果。
+ 默认值:false
## tikv-client.async-commit <span class="version-mark">从 v5.0.0-rc 版本开始引入</span>

### `keys-limit`

Expand All @@ -487,14 +468,6 @@ prepare 语句的 plan cache 设置。
+ 默认值:4096
+ 单位:字节

> **警告:**
>
> 当前该功能为实验特性,不建议在生产环境中使用。目前存在已知问题有:
>
> + 暂时与 [Follower Read](/follower-read.md)[TiFlash](/tiflash/tiflash-overview.md) 不兼容,使用时无法保证快照隔离。
> + 无法保证外部一致性。
> + 如果在执行 DDL 操作的同时,由于 TiDB 机器宕机等原因导致事务提交异常中断,可能造成数据格式不正确。
## tikv-client.copr-cache <span class="version-mark">从 v4.0.0 版本开始引入</span>

本部分介绍 Coprocessor Cache 相关的配置项。
Expand Down

0 comments on commit 209c995

Please sign in to comment.