r40391 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40390‎ | r40391 | r40392 >
Date:20:15, 3 September 2008
Author:hashar
Status:old
Tags:
Comment:
Fix #15460 : One slow extension can block all wiki pages for all users
Backport of trunk@40209 by Tim Starling. Pointed by Dan Barrett.
Modified paths:
  • /branches/REL1_13/phase3/RELEASE-NOTES (modified) (history)
  • /branches/REL1_13/phase3/includes/BagOStuff.php (modified) (history)

Diff [purge]

Index: branches/REL1_13/phase3/includes/BagOStuff.php
@@ -271,12 +271,15 @@
272272 $exptime += time();
273273 $exp = $this->_fromunixtime($exptime);
274274 }
275 - $this->delete( $key );
 275+ $this->_begin();
 276+ $this->_query(
 277+ "DELETE FROM $0 WHERE keyname='$1'", $key );
276278 $this->_doinsert($this->getTableName(), array(
277279 'keyname' => $key,
278280 'value' => $this->_blobencode($this->_serialize($value)),
279281 'exptime' => $exp
280282 ));
 283+ $this->_commit();
281284 return true; /* ? */
282285 }
283286
@@ -284,8 +287,10 @@
285288 if ( $this->_readonly() ) {
286289 return false;
287290 }
 291+ $this->_begin();
288292 $this->_query(
289293 "DELETE FROM $0 WHERE keyname='$1'", $key );
 294+ $this->_commit();
290295 return true; /* ? */
291296 }
292297
@@ -339,6 +344,9 @@
340345
341346 abstract function _readonly();
342347
 348+ function _begin() {}
 349+ function _commit() {}
 350+
343351 function _freeresult($result) {
344352 /* stub */
345353 return false;
@@ -370,7 +378,9 @@
371379 return false;
372380 }
373381 $now = $this->_fromunixtime( time() );
 382+ $this->_begin();
374383 $this->_query( "DELETE FROM $0 WHERE exptime < '$now'" );
 384+ $this->_commit();
375385 }
376386
377387 function deleteall() {
@@ -378,7 +388,9 @@
379389 if ( $this->_readonly() ) {
380390 return false;
381391 }
 392+ $this->_begin();
382393 $this->_query( "DELETE FROM $0" );
 394+ $this->_commit();
383395 }
384396
385397 /**
@@ -422,13 +434,22 @@
423435 */
424436 class MediaWikiBagOStuff extends SqlBagOStuff {
425437 var $tableInitialised = false;
 438+ var $lb, $db;
426439
427440 function _getDB(){
428 - static $db;
429 - if( !isset( $db ) )
430 - $db = wfGetDB( DB_MASTER );
431 - return $db;
 441+ if ( !isset( $this->lb ) ) {
 442+ $this->lb = wfGetLBFactory()->newMainLB();
 443+ $this->db = $this->lb->getConnection( DB_MASTER );
 444+ $this->db->clearFlag( DBO_TRX );
 445+ }
 446+ return $this->db;
432447 }
 448+ function _begin() {
 449+ $this->_getDB()->begin();
 450+ }
 451+ function _commit() {
 452+ $this->_getDB()->commit();
 453+ }
433454 function _doquery($sql) {
434455 return $this->_getDB()->query( $sql, __METHOD__ );
435456 }
Index: branches/REL1_13/phase3/RELEASE-NOTES
@@ -3,6 +3,18 @@
44 Security reminder: MediaWiki does not require PHP's register_globals
55 setting since version 1.2.0. If you have it on, turn it *off* if you can.
66
 7+== MediaWiki 1.13.1 ==
 8+
 9+September XX, 2008
 10+
 11+This is a bugfix release of the Summer 2008 snapshot release of MediaWiki.
 12+
 13+Changes in this release:
 14+
 15+* (bug 15460) Fixed intermittent deadlock errors involving objectcache
 16+ table queries. Use a separate database connection for the objectcache table
 17+ to avoid long-lasting locks on that table.
 18+
719 == MediaWiki 1.13.0 ==
820
921 This is the first stable release of the Summer 2008 quarterly snapshot release