mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-14 08:47:29 -04:00
The unbatched self-join DELETE takes a row lock on everything it scans, so on a large Frames table it exhausts the lock table and dies with ERROR 1206 whether or not there is anything to delete, leaving the upgrade stopped before the primary key is rebuilt. Look for duplicates first with a plain SELECT ... INTO, which is a non-locking read, and only when there are any delete them 100 event ids at a time so each statement locks just that range. Tested on a scratch database seeded with duplicates at event ids 1, 50, 250 and 999: all duplicates removed, the lowest Id of each (EventId, FrameId) kept, and the no-duplicates path runs clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KLYswrguKc6bBYL8JZbpmZ