From 55b3920bdf68dd847f6071009ff21d1ee208eb2f Mon Sep 17 00:00:00 2001 From: ekexium Date: Wed, 19 Oct 2022 11:53:53 +0800 Subject: [PATCH 1/3] This is an automated cherry-pick of #10872 Signed-off-by: ti-chi-bot --- non-transactional-dml.md | 2 +- system-variables.md | 54 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/non-transactional-dml.md b/non-transactional-dml.md index fd3f48645885e..9a322213c13f9 100644 --- a/non-transactional-dml.md +++ b/non-transactional-dml.md @@ -251,7 +251,7 @@ batch-dml is a mechanism for splitting a transaction into multiple transaction c > **Note:** > -> It is not recommended to use batch-dml. When the batch-dml feature is not properly used, there is a risk of data index inconsistency. batch-dml will be deprecated in a later release of TiDB. +> It is not recommended to use batch-dml which has been deprecated. When the batch-dml feature is not properly used, there is a risk of data index inconsistency. Non-transactional DML statements are not yet a replacement for all batch-dml usage scenarios. Their main differences are as follows: diff --git a/system-variables.md b/system-variables.md index 544b1d9b33f58..17456b34ea5bd 100644 --- a/system-variables.md +++ b/system-variables.md @@ -716,6 +716,42 @@ MPP is a distributed computing framework provided by the TiFlash engine, which a In the case of a poor network environment, appropriately increasing the value of this variable can effectively alleviate error reporting to the application end caused by timeout. If the application end wants to receive the error information more quickly, minimize the value of this variable. +### tidb_batch_commit + +> **Warning:** +> +> It is **NOT** recommended to enable this variable. + +- Scope: Session +- Persists to cluster: No +- Type: Boolean +- Default value: `OFF` +- The variable is used to control whether to enable the deprecated batch-commit feature. When this variable is enabled, a transaction might be split into multiple transactions by grouping a few statements and committed non-atomically, which is not recommended. + +### tidb_batch_delete + +> **Warning:** +> +> This variable is associated with the deprecated batch-dml feature, which might cause data corruption. Therefore, it is not recommended to enable this variable for batch-dml. Instead, use [non-transactional DML](/non-transactional-dml.md). + +- Scope: Session +- Persists to cluster: No +- Type: Boolean +- Default value: `OFF` +- This variable is used to control whether to enable the batch-delete feature, which is a part of the deprecated batch-dml feature. When this variable is enabled, `DELETE` statements might be split into multiple transactions and committed non-atomically. To make it work, you also need to enable `tidb_enable_batch_dml` and set a positive value for `tidb_dml_batch_size`, which is not recommended. + +### tidb_batch_insert + +> **Warning:** +> +> This variable is associated with the deprecated batch-dml feature, which might cause data corruption. Therefore, it is not recommended to enable this variable for batch-dml. Instead, use [non-transactional DML](/non-transactional-dml.md). + +- Scope: Session +- Persists to cluster: No +- Type: Boolean +- Default value: `OFF` +- This variable is used to control whether to enable the batch-insert feature, which is a part of the deprecated batch-dml feature. When this variable is enabled, `INSERT` statements might be split into multiple transactions and committed non-atomically. To make it work, you also need to enable `tidb_enable_batch_dml` and set a positive value for `tidb_dml_batch_size`, which is not recommended. + ### tidb_batch_pending_tiflash_count New in v6.0 - Scope: SESSION | GLOBAL @@ -928,6 +964,10 @@ Constraint checking is always performed in place for pessimistic transactions (d ### tidb_dml_batch_size +> **Warning:** +> +> This variable is associated with the deprecated batch-dml feature, which might cause data corruption. Therefore, it is not recommended to enable this variable for batch-dml. Instead, use [non-transactional DML](/non-transactional-dml.md). + - Scope: SESSION | GLOBAL - Persists to cluster: Yes - Type: Integer @@ -936,6 +976,7 @@ Constraint checking is always performed in place for pessimistic transactions (d - Unit: Rows - When this value is greater than `0`, TiDB will batch commit statements such as `INSERT` or `LOAD DATA` into smaller transactions. This reduces memory usage and helps ensure that the `txn-total-size-limit` is not reached by bulk modifications. - Only the value `0` provides ACID compliance. Setting this to any other value will break the atomicity and isolation guarantees of TiDB. +- To make this variable work, you also need to enable `tidb_enable_batch_dml` and at least one of `tidb_batch_insert` and `tidb_batch_delete`. ### tidb_enable_1pc New in v5.0 @@ -998,21 +1039,34 @@ Constraint checking is always performed in place for pessimistic transactions (d - Default value: `OFF` - This variable is used to determine whether to include the `AUTO_INCREMENT` columns when creating a generated column or an expression index. +<<<<<<< HEAD ### tidb_enable_change_multi_schema > **Warning:** > > TiDB will support more types of multi-schema changes in the future. This system variable will be deleted in a future release of TiDB. +======= +### tidb_enable_batch_dml + +> **Warning:** +> +> This variable is associated with the deprecated batch-dml feature, which might cause data corruption. Therefore, it is not recommended to enable this variable for batch-dml. Instead, use [non-transactional DML](/non-transactional-dml.md). +>>>>>>> 95c07bcea (add the variables of batch-dml (#10872)) - Scope: GLOBAL - Persists to cluster: Yes - Type: Boolean +<<<<<<< HEAD - Default value: `OFF` - This variable is used to control whether multiple columns or indexes can be altered in one `ALTER TABLE` statement. When the value of this variable is `ON`, only the following multi-schema changes are supported: - Add multiple columns. For example, `ATLER TABLE t ADD COLUMN c1 INT, ADD COLUMN c2 INT;`. - Drop multiple columns. For example, `ATLER TABLE t DROP COLUMN c1, DROP COLUMN c2;`. - Drop multiple indexes. For example, `ATLER TABLE t DROP INDEX i1, DROP INDEX i2;`. - Drop a column covered by a single-column index. For example, `ALTER TABLE t DROP COLUMN c1`, in which the schema contains `INDEX idx(c1)`. +======= +- Default values: `OFF` +- This variable controls whether to enable the deprecated batch-dml feature. When it is enabled, certain statements might be split into multiple transactions, which is non-atomic and should be used with care. When using batch-dml, you must ensure that there are no concurrent operations on the data you are operating on. To make it work, you must also specify a positive value for `tidb_batch_dml_size` and enable at least one of `tidb_batch_insert` and `tidb_batch_delete`. +>>>>>>> 95c07bcea (add the variables of batch-dml (#10872)) ### tidb_enable_cascades_planner From 9eade43de2bebb1e04d85bfb1d7c999436e12fe9 Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Wed, 19 Oct 2022 13:06:57 +0800 Subject: [PATCH 2/3] Update system-variables.md --- system-variables.md | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/system-variables.md b/system-variables.md index 17456b34ea5bd..2faf57a377ff9 100644 --- a/system-variables.md +++ b/system-variables.md @@ -1039,34 +1039,32 @@ Constraint checking is always performed in place for pessimistic transactions (d - Default value: `OFF` - This variable is used to determine whether to include the `AUTO_INCREMENT` columns when creating a generated column or an expression index. -<<<<<<< HEAD -### tidb_enable_change_multi_schema +### tidb_enable_batch_dml > **Warning:** > -> TiDB will support more types of multi-schema changes in the future. This system variable will be deleted in a future release of TiDB. -======= -### tidb_enable_batch_dml +> This variable is associated with the deprecated batch-dml feature, which might cause data corruption. Therefore, it is not recommended to enable this variable for batch-dml. Instead, use [non-transactional DML](/non-transactional-dml.md). +- Scope: GLOBAL +- Persists to cluster: Yes +- Type: Boolean +- Default values: `OFF` +- This variable controls whether to enable the deprecated batch-dml feature. When it is enabled, certain statements might be split into multiple transactions, which is non-atomic and should be used with care. When using batch-dml, you must ensure that there are no concurrent operations on the data you are operating on. To make it work, you must also specify a positive value for `tidb_batch_dml_size` and enable at least one of `tidb_batch_insert` and `tidb_batch_delete`. + +### tidb_enable_change_multi_schema > **Warning:** > -> This variable is associated with the deprecated batch-dml feature, which might cause data corruption. Therefore, it is not recommended to enable this variable for batch-dml. Instead, use [non-transactional DML](/non-transactional-dml.md). ->>>>>>> 95c07bcea (add the variables of batch-dml (#10872)) +> TiDB will support more types of multi-schema changes in the future. This system variable will be deleted in a future release of TiDB. - Scope: GLOBAL - Persists to cluster: Yes - Type: Boolean -<<<<<<< HEAD - Default value: `OFF` - This variable is used to control whether multiple columns or indexes can be altered in one `ALTER TABLE` statement. When the value of this variable is `ON`, only the following multi-schema changes are supported: - Add multiple columns. For example, `ATLER TABLE t ADD COLUMN c1 INT, ADD COLUMN c2 INT;`. - Drop multiple columns. For example, `ATLER TABLE t DROP COLUMN c1, DROP COLUMN c2;`. - Drop multiple indexes. For example, `ATLER TABLE t DROP INDEX i1, DROP INDEX i2;`. - Drop a column covered by a single-column index. For example, `ALTER TABLE t DROP COLUMN c1`, in which the schema contains `INDEX idx(c1)`. -======= -- Default values: `OFF` -- This variable controls whether to enable the deprecated batch-dml feature. When it is enabled, certain statements might be split into multiple transactions, which is non-atomic and should be used with care. When using batch-dml, you must ensure that there are no concurrent operations on the data you are operating on. To make it work, you must also specify a positive value for `tidb_batch_dml_size` and enable at least one of `tidb_batch_insert` and `tidb_batch_delete`. ->>>>>>> 95c07bcea (add the variables of batch-dml (#10872)) ### tidb_enable_cascades_planner From c0de1c5af722ee3a4a25eec6a227bcdb0eaf31a0 Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Wed, 19 Oct 2022 13:12:33 +0800 Subject: [PATCH 3/3] Update system-variables.md --- system-variables.md | 1 + 1 file changed, 1 insertion(+) diff --git a/system-variables.md b/system-variables.md index 2faf57a377ff9..51f21c4b484c9 100644 --- a/system-variables.md +++ b/system-variables.md @@ -1044,6 +1044,7 @@ Constraint checking is always performed in place for pessimistic transactions (d > **Warning:** > > This variable is associated with the deprecated batch-dml feature, which might cause data corruption. Therefore, it is not recommended to enable this variable for batch-dml. Instead, use [non-transactional DML](/non-transactional-dml.md). + - Scope: GLOBAL - Persists to cluster: Yes - Type: Boolean