diff --git a/develop/dev-guide-transaction-overview.md b/develop/dev-guide-transaction-overview.md index 4e9358707726f..77c6522d14697 100644 --- a/develop/dev-guide-transaction-overview.md +++ b/develop/dev-guide-transaction-overview.md @@ -1,9 +1,13 @@ --- -title: Transaction overview +title: Transaction Overview summary: A brief introduction to transactions in TiDB. --- -# Transaction overview +# Transaction Overview + +> **Warning:** +> +> The [optimistic transaction model](/optimistic-transaction.md) will be deprecated and might be removed in a future release. Starting from TiDB v7.1.0, it is **STRONGLY NOT RECOMMENDED** to set the value of [`tidb_txn_mode`](/system-variables.md#tidb_txn_mode) to `"optimistic"` or `""`. TiDB supports complete distributed transactions, providing [optimistic transactions](/optimistic-transaction.md) and [pessimistic transactions](/pessimistic-transaction.md) (introduced in TiDB 3.0). This article mainly introduces transaction statements, optimistic transactions and pessimistic transactions, transaction isolation levels, and application-side retry and error handling in optimistic transactions. diff --git a/develop/dev-guide-transaction-troubleshoot.md b/develop/dev-guide-transaction-troubleshoot.md index 03d37ceb22c67..d8e22081906b0 100644 --- a/develop/dev-guide-transaction-troubleshoot.md +++ b/develop/dev-guide-transaction-troubleshoot.md @@ -65,6 +65,10 @@ If you only update 1 book in each transaction, you can also avoid deadlocks. How ### Solution 3: use optimistic transactions +> **Warning:** +> +> The [optimistic transaction model](/optimistic-transaction.md) will be deprecated and might be removed in a future release. Starting from TiDB v7.1.0, it is **STRONGLY NOT RECOMMENDED** to set the value of [`tidb_txn_mode`](/system-variables.md#tidb_txn_mode) to `"optimistic"` or `""`. + There are no deadlocks in the optimistic transaction model. But in your application, you need to add the optimistic transaction retry logic in case of failure. For details, see [Application retry and error handling](#application-retry-and-error-handling). ### Solution 4: retry diff --git a/optimistic-transaction.md b/optimistic-transaction.md index 147ad9fa41966..939707b47c7f1 100644 --- a/optimistic-transaction.md +++ b/optimistic-transaction.md @@ -6,6 +6,10 @@ aliases: ['/docs/dev/optimistic-transaction/','/docs/dev/reference/transactions/ # TiDB Optimistic Transaction Model +> **Warning:** +> +> The optimistic transaction model will be deprecated and might be removed in a future release. Starting from TiDB v7.1.0, it is **STRONGLY NOT RECOMMENDED** to set the value of [`tidb_txn_mode`](/system-variables.md#tidb_txn_mode) to `"optimistic"` or `""`. + With optimistic transactions, conflicting changes are detected as part of a transaction commit. This helps improve the performance when concurrent transactions are infrequently modifying the same rows, because the process of acquiring row locks can be skipped. In the case that concurrent transactions frequently modify the same rows (a conflict), optimistic transactions may perform worse than [Pessimistic Transactions](/pessimistic-transaction.md). Before enabling optimistic transactions, make sure that your application correctly handles that a `COMMIT` statement could return errors. If you are unsure of how your application handles this, it is recommended to instead use Pessimistic Transactions. diff --git a/system-variables.md b/system-variables.md index 8915f21e846c1..6c184d1137ccf 100644 --- a/system-variables.md +++ b/system-variables.md @@ -4799,6 +4799,10 @@ For details, see [Identify Slow Queries](/identify-slow-queries.md). ### tidb_txn_mode +> **Warning:** +> +> The [optimistic transaction model](/optimistic-transaction.md) will be deprecated and might be removed in a future release. Starting from TiDB v7.1.0, it is **STRONGLY NOT RECOMMENDED** to set the value of `tidb_txn_mode` to `"optimistic"` or `""`. + - Scope: SESSION | GLOBAL - Persists to cluster: Yes - Type: Enumeration diff --git a/transaction-overview.md b/transaction-overview.md index 3f5860cc0e80b..06084c304f09f 100644 --- a/transaction-overview.md +++ b/transaction-overview.md @@ -6,6 +6,10 @@ aliases: ['/docs/dev/transaction-overview/','/docs/dev/reference/transactions/ov # Transactions +> **Warning:** +> +> The [optimistic transaction model](/optimistic-transaction.md) will be deprecated and might be removed in a future release. Starting from TiDB v7.1.0, it is **STRONGLY NOT RECOMMENDED** to set the value of [`tidb_txn_mode`](/system-variables.md#tidb_txn_mode) to `"optimistic"` or `""`. + TiDB supports distributed transactions using either [pessimistic](/pessimistic-transaction.md) or [optimistic](/optimistic-transaction.md) transaction mode. Starting from TiDB 3.0.8, TiDB uses the pessimistic transaction mode by default. This document introduces commonly used transaction-related statements, explicit and implicit transactions, isolation levels, lazy check for constraints, and transaction sizes.