Updating non-index column by point-getting on unique index may cause too many Lock records in Write CF #33393
Labels
affects-5.0
This bug affects 5.0.x versions.
affects-5.1
This bug affects 5.1.x versions.
affects-5.2
This bug affects 5.2.x versions.
affects-5.3
This bug affects 5.3.x versions.
affects-5.4
This bug affects 5.4.x versions.
affects-6.0
affects-6.1
affects-6.2
may-affects-4.0
This bug maybe affects 4.0.x versions.
severity/moderate
sig/transaction
SIG:Transaction
type/bug
The issue is confirmed as a bug.
Bug Report
Please answer these questions before submitting your issue. Thanks!
The problem
It's actually the same problem as stated in #25659 . It's partially fixed by the workaround PR #25730 , However it only optimized the case where the row exists (by changing the Lock records on unique-index key into Put records), and Lock records will still cumulate when trying to update non-exist rows.
We notice that in an inactive TiDB cluster, it keeps updating statistics info internally while there's no user query:
The table id 17 belongs to
mysql.tidb
, and the row doesn't exist.There are many lock records accumulated on the corresponding unique index key:
and in metrics of Scheduler - acquire_pessimisitc_lock:
It seems that the lock records are not GC-ed because compaction is run very infrequently when the cluster is idle.
We didn't find this problem affect any user for now, but it's a problem and has potential risks.
What is your TiDB version?
4.0.10+, 5.x, master
The text was updated successfully, but these errors were encountered: