Skip to content

Commit

Permalink
add documentation for tidb_enable_amend_pessimistic_txn. (#4979) (#5075)
Browse files Browse the repository at this point in the history
* cherry pick #4979 to release-4.0

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>

* Apply suggestions from code review

Co-authored-by: cfzjywxk <lsswxr@163.com>
Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 10, 2020
1 parent 9bca06b commit 81ce666
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions system-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,18 @@ SET GLOBAL tidb_distsql_scan_concurrency = 10;

关于是否需要禁用自动重试,请参考[重试的局限性](/optimistic-transaction.md#重试的局限性)。

### `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

0 comments on commit 81ce666

Please sign in to comment.