Tidb2.1 reports Error statement count 5001 exceeded the transaction limit, autocommit = false

Error:
statement count 5001 exceeds the transaction limitation, autocommit = false


-- Explanation.
stmt-count-limit
Limit on the maximum number of statements allowed in a TiDB transaction.
Default: 5000
TiDB will return statement count 5001 exceeds the transaction limitation if there is no rollback or commit after more than stmt-count-limit statements in a transaction, autocommit = false error.

-- Solution.
conf/tidb.yml
Modify the file parameters.

 txn_local_latches:
  # Enable local latches for transactions. Enable it when
  # there are lots of conflicts between transactions.
  # enabled: true
  # capacity: 1024000

Method 1: Comment out the parameter enabled: true and set it to false
Method 2: Set the parameter capacity: 1024000 to very

Restart tidb after the parameters are modified.


Read More: