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

statement count 5001 exceeds the transaction limitation, autocommit = false

-- Explanation.
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.
Modify the file parameters.

  # 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: