Fixed Database error when attempting to merge users

Jawsh

Active member
Affected version
2.1.2
XF\Db\DeadlockException: MySQL query error [1213]: Deadlock found when trying to get lock; try restarting transaction
src/XF/Db/AbstractStatement.php:217

Code:
            UPDATE (
                SELECT content_id FROM xf_reaction_content
                WHERE content_type = ?
                AND reaction_user_id = ?
            ) AS temp
            INNER JOIN xf_post AS reaction_table ON (reaction_table.`post_id` = temp.content_id)
            SET reaction_table.`reaction_users` = REPLACE(reaction_table.`reaction_users`, ?, ?)

Should be noted xf_reaction_content has a row count of 31m and xf_post has a row count of 4.7m

I've tried increasing lock timeouts but it really looks like it's just an issue with the query being too slow. The end result is the merge never completes and the CRON will re-attempt it every so often indefinitely.
 
If you need urgent support with something, please submit a ticket or post in the troubleshooting/support forum.

Bug reports are dealt with periodically and cannot always be guaranteed to be resolved quickly.
 
We suffer the same issue, merging users cannot be completed and just return an error:
Lock wait timeout exceeded
 
Maybe my fix helps here as well:

Thanks, I already applied that and it helps a lot now :).
Just deleted 5k inactive users.
 
Back
Top Bottom