r85776 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85775‎ | r85776 | r85777 >
Date:00:29, 11 April 2011
Author:reedy
Status:reverted (Comments)
Tags:
Comment:
* (bug 28485) Block::purgeExpired Database returned error "1205: Lock wait timeout exceeded;"

Commit changes per Tims suggestion on the ubg
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Block.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Block.php
@@ -889,8 +889,13 @@
890890 * Purge expired blocks from the ipblocks table
891891 */
892892 public static function purgeExpired() {
893 - $dbw = wfGetDB( DB_MASTER );
 893+ $lb = wfGetLBFactory()->newMainLB();
 894+ $dbw = $lb->getConnection( DB_MASTER );
 895+
894896 $dbw->delete( 'ipblocks', array( 'ipb_expiry < ' . $dbw->addQuotes( $dbw->timestamp() ) ), __METHOD__ );
 897+
 898+ $lb->commitMasterChanges();
 899+ $lb->closeAll();
895900 }
896901
897902 /**
Index: trunk/phase3/RELEASE-NOTES
@@ -235,8 +235,10 @@
236236 * (bug 28372) Fix bogus link to suppressed file versions in ForeignDBRepo
237237 * (bug 27473) Fix regression: bold, italic no longer interfere with linktrail for ca, kaa
238238 * (bug 28444) Fix regression: edit-on-doubleclick retains revision id again
 239+* (bug 28485) Block::purgeExpired Database returned error "1205: Lock wait timeout
 240+ exceeded;"
239241
240 -=== API changes in 1.18 ===
 242+ === API changes in 1.18 ===
241243 * (bug 26339) Throw warning when truncating an overlarge API result
242244 * (bug 14869) Add API module for accessing QueryPage-based special pages
243245 * (bug 14020) API for Special:Unwatchedpages

Follow-up revisions

RevisionCommit summaryAuthorDate
r85782Followup r85776, per Aaron, add documentation showing reason why explicit cre...reedy12:48, 11 April 2011
r85795Made purgeExpiredConfigurations use a separate session ala r85776aaron16:20, 11 April 2011
r85916Revert r85776, r85782 pending better solutionreedy20:27, 12 April 2011
r87118Reverted r85795 since r85776 was brokenaaron06:14, 29 April 2011

Comments

#Comment by Aaron Schulz (talk | contribs)   02:32, 11 April 2011

This needs some code comments.

#Comment by MaxSem (talk | contribs)   06:58, 12 April 2011

Needs to be redone in a proper way or reverted like other similar revisions, because not every DB behaves like MySQL in such cases.

#Comment by Reedy (talk | contribs)   08:26, 12 April 2011

So, to make it more database agnostic, have a couple of methods that return either the DB_MASTER where applicable (Or more probably, the LB), else for sqlite etc, it just returns the current?

Though, I'm still quite confused why it caused more issues for MySQL users...

#Comment by Platonides (talk | contribs)   19:11, 12 April 2011

Breaks tests/phpunit/includes/BlockTest.php

Table 'my_wiki.unittest_ipblocks' doesn't exist

You can't use a separate connection with temporary tables.

Create a purger class?

#Comment by Reedy (talk | contribs)   20:27, 12 April 2011

Reverted pending better solution

Status & tagging log