cockroach
cockroach copied to clipboard
workload/tpcc: fix N^2 row updates during long-duration reset
Summary
- Fixed a bug where the TPC-C reset worker goroutine was started once per worker instead of once total
- With 10 workers per warehouse by default, a workload with W warehouses would spawn (10*W) goroutines, each updating all W rows every 24 hours
- This change uses
sync.Onceto ensure only one reset worker is started, reducing the 24-hour reset from (10*W)*W to W row updates - For a 1,200 warehouse cluster, this reduces the reset from 14,400,000 row updates to 1,200 row updates
Test plan
- Manual verification on a running cluster using
curl http://localhost:33333/debug/pprof/goroutine?debug=2 | grep -c startResetValueWorker- Before fix: 2400 matches (1200 goroutines × 2 matches per stack)
- After fix: should show 2 matches (1 goroutine × 2 matches per stack)
Informs: #124259
🤖 Generated with Claude Code
Your pull request contains more than 1000 changes. It is strongly encouraged to split big PRs into smaller chunks.
:owl: Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.