r98756 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98755‎ | r98756 | r98757 >
Date:13:19, 3 October 2011
Author:reedy
Status:ok
Tags:
Comment:
Merge r97687
Modified paths:
  • /trunk/phase3/includes/ExternalStoreDB.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ExternalStoreDB.php
@@ -18,7 +18,7 @@
1919 */
2020 function &getLoadBalancer( $cluster ) {
2121 $wiki = isset($this->mParams['wiki']) ? $this->mParams['wiki'] : false;
22 -
 22+
2323 return wfGetLBFactory()->getExternalLB( $cluster, $wiki );
2424 }
2525
@@ -29,8 +29,18 @@
3030 * @return DatabaseBase object
3131 */
3232 function &getSlave( $cluster ) {
 33+ global $wgDefaultExternalStore;
 34+
3335 $wiki = isset($this->mParams['wiki']) ? $this->mParams['wiki'] : false;
3436 $lb =& $this->getLoadBalancer( $cluster );
 37+
 38+ if ( !in_array( "DB://" . $cluster, $wgDefaultExternalStore ) ) {
 39+ wfDebug( "read only external store" );
 40+ $lb->allowLagged(true);
 41+ } else {
 42+ wfDebug( "writable external store" );
 43+ }
 44+
3545 return $lb->getConnection( DB_SLAVE, array(), $wiki );
3646 }
3747
@@ -139,8 +149,8 @@
140150 function store( $cluster, $data ) {
141151 $dbw = $this->getMaster( $cluster );
142152 $id = $dbw->nextSequenceValue( 'blob_blob_id_seq' );
143 - $dbw->insert( $this->getTable( $dbw ),
144 - array( 'blob_id' => $id, 'blob_text' => $data ),
 153+ $dbw->insert( $this->getTable( $dbw ),
 154+ array( 'blob_id' => $id, 'blob_text' => $data ),
145155 __METHOD__ );
146156 $id = $dbw->insertId();
147157 if ( !$id ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r98865Fix for r98756: $wgDefaultExternalStore can also be a stringialex16:51, 4 October 2011
r99989REL1_18:...reedy22:24, 16 October 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r97687bug 31052 : live hack to support reading from old non-slave external store se...asher01:08, 21 September 2011

Status & tagging log