r70977 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70976‎ | r70977 | r70978 >
Date:18:25, 12 August 2010
Author:platonides
Status:ok
Tags:
Comment:
Make $wgExternalBlobCache a local static variable.
Remove $wgExternalLoadBalancers, unused since r32578 (birth of LBFactory)
Modified paths:
  • /trunk/phase3/includes/ExternalStoreDB.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ExternalStoreDB.php
@@ -1,26 +1,6 @@
22 <?php
33
44 /**
5 - * External database storage will use one (or more) separate connection pools
6 - * from what the main wiki uses. If we load many revisions, such as when doing
7 - * bulk backups or maintenance, we want to keep them around over the lifetime
8 - * of the script.
9 - *
10 - * Associative array of LoadBalancer objects, indexed by cluster name.
11 - */
12 -global $wgExternalLoadBalancers;
13 -$wgExternalLoadBalancers = array();
14 -
15 -/**
16 - * One-step cache variable to hold base blobs; operations that
17 - * pull multiple revisions may often pull multiple times from
18 - * the same blob. By keeping the last-used one open, we avoid
19 - * redundant unserialization and decompression overhead.
20 - */
21 -global $wgExternalBlobCache;
22 -$wgExternalBlobCache = array();
23 -
24 -/**
255 * DB accessable external objects
266 * @ingroup ExternalStorage
277 */
@@ -113,11 +93,18 @@
11494 * @private
11595 */
11696 function &fetchBlob( $cluster, $id, $itemID ) {
117 - global $wgExternalBlobCache;
 97+ /**
 98+ * One-step cache variable to hold base blobs; operations that
 99+ * pull multiple revisions may often pull multiple times from
 100+ * the same blob. By keeping the last-used one open, we avoid
 101+ * redundant unserialization and decompression overhead.
 102+ */
 103+ static $externalBlobCache = array();
 104+
118105 $cacheID = ( $itemID === false ) ? "$cluster/$id" : "$cluster/$id/";
119 - if( isset( $wgExternalBlobCache[$cacheID] ) ) {
 106+ if( isset( $externalBlobCache[$cacheID] ) ) {
120107 wfDebug( "ExternalStoreDB::fetchBlob cache hit on $cacheID\n" );
121 - return $wgExternalBlobCache[$cacheID];
 108+ return $externalBlobCache[$cacheID];
122109 }
123110
124111 wfDebug( "ExternalStoreDB::fetchBlob cache miss on $cacheID\n" );
@@ -138,7 +125,7 @@
139126 $ret = unserialize( $ret );
140127 }
141128
142 - $wgExternalBlobCache = array( $cacheID => &$ret );
 129+ $externalBlobCache = array( $cacheID => &$ret );
143130 return $ret;
144131 }
145132

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r32578* Introduced LBFactory -- an abstract class for configuring database load bal...tstarling09:48, 30 March 2008

Status & tagging log