Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add documentation for tidb_enable_amend_pessimistic_txn. #4979

Merged
merged 6 commits into from
Dec 10, 2020
Merged
Changes from all commits
Commits
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
14 changes: 13 additions & 1 deletion system-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,18 @@ SET GLOBAL tidb_distsql_scan_concurrency = 10;
- 这个变量的值大于 `0` 时,TiDB 会将 `INSERT` 或 `LOAD DATA` 等语句在更小的事务中批量提交。这样可减少内存使用,确保大批量修改时事务大小不会达到 `txn-total-size-limit` 限制。
- 只有变量值为 `0` 时才符合 ACID 要求。否则无法保证 TiDB 的原子性和隔离性要求。

### `tidb_enable_amend_pessimistic_txn` <span class="version-mark">从 v4.0.7 版本开始引入</span>

- 作用域:SESSION | GLOBAL
- 默认值: 0
- 这个变量用于控制是否开启 `AMEND TRANSACTION` 特性。在[悲观事务模式](/pessimistic-transaction.md)下开启该特性后,如果该事务相关的表存在并发 DDL 操作和 SCHEMA VERSION 变更,TiDB 会尝试对该事务进行 amend 操作,修正该事务的提交内容,使其和最新的有效 SCHEMA VERSION 保持一致,从而成功提交该事务而不返回 `Information schema is changed` 报错。该特性对以下并发 DDL 变更生效:

- `ADD COLUMN` 或 `DROP COLUMN` 类型的 DDL 操作。
- `MODIFY COLUMN` 或 `CHANGE COLUMN` 类型的 DDL 操作,且只对增大字段长度的操作生效。
- `ADD INDEX` 或 `DROP INDEX` 类型的 DDL 操作,且操作的索引列须在事务开启之前创建。

目前该特性可能造成事务语义的变化,且与 TiDB Binlog 存在部分不兼容的场景,可以参考[事务语义行为区别](https://github.com/pingcap/tidb/issues/21069)和[与 TiDB Binlog 兼容问题汇总](https://github.com/pingcap/tidb/issues/20996)了解更多关于该特性的使用注意事项。

### `tidb_enable_cascades_planner`

- 作用域:SESSION | GLOBAL
Expand Down Expand Up @@ -972,4 +984,4 @@ explain select * from t where age=5;
- 作用域:SESSION
- 默认值:0.8
- TiDB 内存使用占总内存的比例超过一定阈值时会报警。该功能的详细介绍和使用方法可以参考 [`memory-usage-alarm-ratio`](/tidb-configuration-file.md#memory-usage-alarm-ratio)。
- 该变量的初始值可通过 [`memory-usage-alarm-ratio`](/tidb-configuration-file.md#memory-usage-alarm-ratio) 进行配置。
- 该变量的初始值可通过 [`memory-usage-alarm-ratio`](/tidb-configuration-file.md#memory-usage-alarm-ratio) 进行配置。