r106543 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106542‎ | r106543 | r106544 >
Date:01:28, 18 December 2011
Author:aaron
Status:deferred
Tags:
Comment:
* Removed DBLockManager::checkUptime() as it's way overkill
* Fixed outdated comments
* Fixed AutoLoader entry
Modified paths:
  • /branches/FileBackend/phase3/includes/AutoLoader.php (modified) (history)
  • /branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/DBLockManager.php (modified) (history)

Diff [purge]

Index: branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/DBLockManager.php
@@ -198,12 +198,9 @@
199199 if ( !$this->doLockingQuery( $lockDb, $keys, $type ) ) {
200200 return 'cantacquire'; // vetoed; resource locked
201201 }
202 - // Check that DB has no signs of lock loss
203 - if ( $this->checkUptime( $lockDb ) ) {
204 - ++$yesVotes; // success for this peer
205 - if ( $yesVotes >= $quorum ) {
206 - return true; // lock obtained
207 - }
 202+ ++$yesVotes; // success for this peer
 203+ if ( $yesVotes >= $quorum ) {
 204+ return true; // lock obtained
208205 }
209206 } catch ( DBConnectionError $e ) {
210207 $this->cacheRecordFailure( $lockDb );
@@ -301,28 +298,8 @@
302299 }
303300
304301 /**
305 - * Checks if the DB server did not recently restart.
306 - * This curtails the problem of locks falling off when DB servers restart.
307 - *
308 - * @param $lockDb string
309 - * @return bool
310 - * @throws DBError
311 - */
312 - protected function checkUptime( $lockDb ) {
313 - if ( isset( $this->conns[$lockDb] ) ) { // sanity
314 - if ( $this->safeDelay > 0 ) {
315 - $db = $this->conns[$lockDb];
316 - return ( $db->getServerUptime() > $this->safeDelay );
317 - }
318 - return true;
319 - }
320 - return false;
321 - }
322 -
323 - /**
324302 * Checks if the DB has not recently had connection/query errors.
325 - * When in "trust cache" mode, this curtails the problem of peers occasionally
326 - * missing locks. Otherwise, it just avoids wasting time on connection attempts.
 303+ * This just avoids wasting time on doomed connection attempts.
327304 *
328305 * @param $lockDb string
329306 * @return bool
@@ -337,12 +314,8 @@
338315 }
339316
340317 /**
341 - * Log a lock request failure to the cache.
 318+ * Log a lock request failure to the cache
342319 *
343 - * Worst case scenario is that a resource lock was only
344 - * on one peer and then that peer is restarted or goes down.
345 - * Clients trying to get locks need to know if a DB server is down.
346 - *
347320 * @param $lockDb string
348321 * @return bool Success
349322 */
Index: branches/FileBackend/phase3/includes/AutoLoader.php
@@ -496,7 +496,7 @@
497497 'ScopedLock' => 'includes/filerepo/backend/lockmanager/LockManager.php',
498498 'FSLockManager' => 'includes/filerepo/backend/lockmanager/FSLockManager.php',
499499 'DBLockManager' => 'includes/filerepo/backend/lockmanager/DBLockManager.php',
500 - 'MySqlLockManager'=> 'includes/filerepo/backend/lockmanager/LockManager.php',
 500+ 'MySqlLockManager'=> 'includes/filerepo/backend/lockmanager/DBLockManager.php',
501501 'NullLockManager' => 'includes/filerepo/backend/lockmanager/LockManager.php',
502502 'FileOp' => 'includes/filerepo/backend/FileOp.php',
503503 'StoreFileOp' => 'includes/filerepo/backend/FileOp.php',

Status & tagging log