Max-txn-time-use parameter

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: max-txn-time-use参数

| username: liuwenhe

To improve efficiency, please provide the following information. Clear problem descriptions can be resolved faster:
[TiDB Usage Environment] Production Environment 5.1
I saw the following sentence in the official documentation:
txn takes too much time. The transaction takes too long (more than 590s) without committing, and this error is reported when preparing to commit. You can bypass this issue by increasing the [tikv-client] max-txn-time-use = 590 parameter and increasing the GC life time (if there is indeed such a need). Generally, it is recommended to check whether the business really needs to execute such long transactions.
However, when looking for this parameter, I only saw the introduction of this parameter in version 3.0? I couldn’t find this parameter later, was it deprecated?

| username: liuwenhe | Original post link

Increase the [tikv-client] max-txn-time-use = 590 parameter? Where can this be modified?

| username: Kongdom | Original post link

It should be set in the TiDB configuration file.

However, after checking the configuration file instructions starting from version 4.0 and the detailed configuration examples in the git repository, it is true that there is no mention of this configuration anymore.

| username: liuwenhe | Original post link

Has it been replaced with:
max-txn-ttl

The maximum time a single transaction can hold a lock. If this time is exceeded, the lock of the transaction may be cleared by other transactions, causing the transaction to fail to commit successfully.
Default value: 3600000
Unit: milliseconds
Transactions exceeding this time can only execute commit or rollback, and commit may not necessarily succeed.
| username: yilong | Original post link

  1. No
  2. It should not need to be configured anymore. In later versions, the time configured for constants here seems to be long enough.
    store/tikv:move MaxTxnTimeUse from kv to store/tikv (#23995) · pingcap/tidb@6faec86 · GitHub
    // MaxTxnTimeUse is the max time a Txn may use (in ms) from its begin to commit.
    // We use it to abort the transaction to guarantee GC worker will not influence it.
    const MaxTxnTimeUse = 24 * 60 * 60 * 1000
  3. What specific problem did you encounter? Why do you need to modify this parameter?
| username: liuwenhe | Original post link

I am writing TiDB development specifications and came across this parameter, so I want to study it.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.