From 2e5b619cd1a911a6388b7ec799b031fce04d72ce Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Tue, 30 Mar 2021 16:09:24 +0800 Subject: [PATCH] config: update default value of `max-txn-ttl` (#5163) --- grafana-tidb-dashboard.md | 2 +- pessimistic-transaction.md | 2 +- tidb-configuration-file.md | 2 +- troubleshoot-lock-conflicts.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/grafana-tidb-dashboard.md b/grafana-tidb-dashboard.md index 294d5af3504e5..52e04b900ce64 100644 --- a/grafana-tidb-dashboard.md +++ b/grafana-tidb-dashboard.md @@ -72,7 +72,7 @@ To understand the key metrics displayed on the TiDB dashboard, check the followi - Transaction Write Size Bytes Rate and sum: the rate at which bytes are written and the sum of these written bytes in the transaction - Transaction Write Size Bytes: the size of the data written in the transaction - Acquire Pessimistic Locks Duration: the time consumed by adding locks - - TTL Lifetime Reach Counter: the number of transactions that reach the upper limit of TTL. The default value of the TTL upper limit is 10 minutes. It means that 10 minutes have passed since the first lock of a pessimistic transaction or the first prewrite of an optimistic transaction. The default value of the upper limit of TTL is 10 minutes. The upper limit of TTL life can be changed by modifying `max-txn-TTL` in the TiDB configuration file + - TTL Lifetime Reach Counter: the number of transactions that reach the upper limit of TTL. The default value of the TTL upper limit is 1 hour. It means that 1 hour has passed since the first lock of a pessimistic transaction or the first prewrite of an optimistic transaction. The default value of the upper limit of TTL is 1 hour. The upper limit of TTL life can be changed by modifying `max-txn-TTL` in the TiDB configuration file - Load Safepoint OPS: the number of times that `Safepoint` is loaded. `Safepoint` is to ensure that the data before `Safepoint` is not read when the transaction reads data, thus ensuring data safety. The data before `Safepoint` might be cleaned up by the GC - Pessimistic Statement Retry OPS: the number of retry attempts for pessimistic statements. When the statement tries to add lock, it might encounter a write conflict. At this time, the statement will acquire a new snapshot and add lock again - Async Commit Transaction Counter: the number of transactions that have async commit enabled, which has two statuses: successful and failed diff --git a/pessimistic-transaction.md b/pessimistic-transaction.md index 636e75bc48a87..21488266d5f19 100644 --- a/pessimistic-transaction.md +++ b/pessimistic-transaction.md @@ -103,7 +103,7 @@ Pessimistic transactions in TiDB behave similarly to those in MySQL. See the min 6. The data read by `EMBEDDED SELECT` in the statement is not locked. -7. Open transactions in TiDB do not block garbage collection (GC). By default, this limits the maximum execution time of pessimistic transactions to 10 minutes. You can modify this limit by editing `max-txn-ttl` under `[performance]` in the TiDB configuration file. +7. Open transactions in TiDB do not block garbage collection (GC). By default, this limits the maximum execution time of pessimistic transactions to 1 hour. You can modify this limit by editing `max-txn-ttl` under `[performance]` in the TiDB configuration file. ## Isolation level diff --git a/tidb-configuration-file.md b/tidb-configuration-file.md index ca8b0444dfc71..dfd4b1eeeee12 100644 --- a/tidb-configuration-file.md +++ b/tidb-configuration-file.md @@ -323,7 +323,7 @@ Configuration items related to performance. ### `max-txn-ttl` - The longest time that a single transaction can hold locks. If this time is exceeded, the locks of a transaction might be cleared by other transactions so that this transaction cannot be successfully committed. -- Default value: `600000` +- Default value: `3600000` - Unit: Millisecond - The transaction that holds locks longer than this time can only be committed or rolled back. The commit might not be successful. diff --git a/troubleshoot-lock-conflicts.md b/troubleshoot-lock-conflicts.md index a9a57b21be9ed..f12e7084b0c04 100644 --- a/troubleshoot-lock-conflicts.md +++ b/troubleshoot-lock-conflicts.md @@ -205,7 +205,7 @@ Solutions: #### TTL manager has timed out -The transaction execution time can not exceed the GC time limit. In addition, the TTL time of pessimistic transactions has an upper limit, whose default value is 10 minutes. Therefore, a pessimistic transaction executed for more than 10 minutes will fail to commit. This timeout threshold is controlled by the TiDB parameter [performance.max-txn-ttl](https://github.com/pingcap/tidb/blob/master/config/config.toml.example). +The transaction execution time can not exceed the GC time limit. In addition, the TTL time of pessimistic transactions has an upper limit, whose default value is 1 hour. Therefore, a pessimistic transaction executed for more than 1 hour will fail to commit. This timeout threshold is controlled by the TiDB parameter [performance.max-txn-ttl](https://github.com/pingcap/tidb/blob/master/config/config.toml.example). When the execution time of a pessimistic transaction exceeds the TTL time, the following error message occurs in the TiDB log: