From 7e63648db43724f9ca216d4c5d07c13e060a4b6b Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Mon, 25 Jul 2005 06:57:12 +0000 Subject: [PATCH] Formalising live performance hack --- includes/Block.php | 16 +++++++++++++--- includes/DefaultSettings.php | 7 +++++++ includes/Defines.php | 1 + 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/includes/Block.php b/includes/Block.php index f97cabce15..0763133249 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -63,7 +63,7 @@ class Block */ function load( $address = '', $user = 0, $killExpired = true ) { - global $wgDBmysql4 ; + global $wgDBmysql4, $wgAntiLockFlags; $fname = 'Block::load'; wfDebug( "Block::load: '$address', '$user', $killExpired\n" ); @@ -71,7 +71,11 @@ class Block $killed = false; if ( $this->forUpdate() ) { $db =& wfGetDB( DB_MASTER ); - $options = 'FOR UPDATE'; + if ( $wgAntiLockFlags & ALF_NO_BLOCK_LOCK ) { + $options = ''; + } else { + $options = 'FOR UPDATE'; + } } else { $db =& wfGetDB( DB_SLAVE ); $options = ''; @@ -169,10 +173,16 @@ class Block */ /*static*/ function enumBlocks( $callback, $tag, $flags = 0 ) { + global $wgAntiLockFlags; + $block = new Block(); if ( $flags & EB_FOR_UPDATE ) { $db =& wfGetDB( DB_MASTER ); - $options = 'FOR UPDATE'; + if ( $wgAntiLockFlags & ALF_NO_BLOCK_LOCK ) { + $options = ''; + } else { + $options = 'FOR UPDATE'; + } $block->forUpdate( true ); } else { $db =& wfGetDB( DB_SLAVE ); diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index cacbf1d487..f2f4836a37 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -959,6 +959,13 @@ $wgUseDumbLinkUpdate = false; * Preload links during link update for save * ALF_PRELOAD_EXISTENCE * Preload cur_id during replaceLinkHolders + * ALF_NO_LINK_LOCK + * Don't use locking reads when updating the link table. This is + * necessary for wikis with a high edit rate for performance + * reasons, but may cause link table inconsistency + * ALF_NO_BLOCK_LOCK + * As for ALF_LINK_LOCK, this flag is a necessity for high-traffic + * wikis. */ $wgAntiLockFlags = 0; diff --git a/includes/Defines.php b/includes/Defines.php index 34231bf153..67789ec966 100644 --- a/includes/Defines.php +++ b/includes/Defines.php @@ -126,6 +126,7 @@ define( 'AV_SCAN_FAILED', false ); #scan failed (scanner not found or error in define( 'ALF_PRELOAD_LINKS', 1 ); define( 'ALF_PRELOAD_EXISTENCE', 2 ); define( 'ALF_NO_LINK_LOCK', 4 ); +define( 'ALF_NO_BLOCK_LOCK', 8 ); /**#@-*/ ?> -- 2.20.1