Page MenuHomePhabricator

deleteBatch.php causes database deadlock
Open, MediumPublic

Description

I was running:

echo "SELECT page_title AS XXXXXXXXXXXXXXXXXXXXXXXXX FROM page WHERE page_random <= .8 and page_namespace = 0;" | mysql -u root -p xxxxwiki | php deleteBatch.php

trying to delete ~80% random articles from DB.

After some of articles were deleted, it said (translated):

Database query syntax error occurred. Recent query was:
“DELETE FROM pagelinks WHERE pl_from = '3108'”
In function “Database::delete”. Database returns error “1213: Deadlock found when trying to get lock; try restarting transaction (localhost)”.


Version: 1.17.x
Severity: normal

Details

Reference
bz23544

Related Objects

StatusSubtypeAssignedTask
OpenNone
OpenNone

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:03 PM
bzimport set Reference to bz23544.
bzimport added a subscriber: Unknown Object (MLST).

AFAIK this is a typical case of "shit happpens, restart script". The deadlock itself is probably caused by another user causing the pagelinks table for that page to be updated; try putting the wiki in read-only mode and see if that helps (hopefully the script will still be able to delete stuff :) ).

It's a test wiki set up for testing new extensions, so I guess no one is doing something on the wiki at that time. I tried to restarted the script but the same error always occurred again and again after deleting some more articles.

need to decide if this deserves more attention/higher priority.