Page MenuHomePhabricator

cleanupTitles, cleanupImages fail on Wikimedia sites
Closed, ResolvedPublic

Description

A number of maintenance scripts such as cleanupTitles and cleanupImages currently fail on Wikimedia sites, due to incorrect database connection setup:

$ php maintenance/cleanupTitles.php aawiki
DB connection error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) (localhost)

This ain't good, as it's blocking running of these cleanups...


Version: unspecified
Severity: normal

Details

Reference
bz16656

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:28 PM
bzimport set Reference to bz16656.

Fixed in r44639.

Lots of cleanup scripts are based on the FiveUpgrade class created for the 1.5 schema upgrade -- this provides a utility class designed around pulling data from a second, unbuffered connection, processing it, and stuffing it into a master connection.

Originally, both connections were created by manually instantiating the Database class. This worked as long as $wgDBserver was set, but at some point we apparently stopped setting it in our fancy-ass load-balanced environment where we're exclusively using the $wgDBservers array.
As a result, the connections used the default $wgDBserver of 'localhost' which inconveniently fails on Wikimedia's servers. ;)

Now uses the Tim-approved method of getting a new database connection -- creates a new LoadBalancer via wfGetLBFactory()->newMainLB(), then asks it for a fresh connection.