cockroachdb / cockroachdb/cockroach
persistedsqlstats: delete-old-sql-stats locks too many rows
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
This log was observed on a production cluster (on 23.2.6-rc):
```
E240604 18:00:01.675762 364555157 jobs/adopt.go:482 ⋮ [T1,Vsystem,n910] 41520 job 974695957267448729: adoption completed with error ‹delete-old-sql-stats›: ‹the transaction is locking too many rows and exceeded its lock-tracking memory budget; lock spans: 9030624 bytes > budget: 4194304 bytes. Request pushing transaction over the edge: 54467 Del. Transaction details: "sql txn" meta={id=cbcf522c key=/Table/42/6/"\x8e虜:y?\xde"/"!\x8c\x19\xfa\xbcx\x88\x01"/0/2024-02-02T22:00:00Z/"\x1e\xa7b\xfe\xeb\xe1\xc3!"/"PostgreSQL JDBC Driver"/580/0 iso=Serializable pri=0.00128569 epo=0 ts=1717524001.019766721,0 min=1717524001.019766721,0 seq=0} lock=true stat=PENDING rts=1717524001.019766721,0 wto=false gul=1717524001.519766721,0.›
```
It would be good to understand how we can get in this situation, but in any case it would be smart to break up the transaction into batches of reasonable size.
Also, are there any cluster settings we can tune to reduce the amount of transactions related to persisted sql stats?
Jira issue: CRDB-39219
Epic CRDB-39776
Contributor guide
Assessment
This issue has not been assessed yet.