}
}
}
+
+ /* Issue COMMIT only on master, only if queries were done on connection */
+ function commitMasterChanges() {
+ // Always 0, but who knows.. :)
+ $i = $this->getWriterIndex;
+ if (array_key_exists($i,$this->mConnections)) {
+ if ($this->mConnections[$i]->lastQuery != '') {
+ $this->mConnections[$i]->immediateCommit();
+ }
+ }
+ }
function waitTimeout( $value = NULL ) {
return wfSetVar( $this->mWaitTimeout, $value );
$this->doJobs();
$loadBalancer->saveMasterPos();
# Now commit any transactions, so that unreported errors after output() don't roll back the whole thing
- $loadBalancer->commitAll();
+ $loadBalancer->commitMasterChanges();
$output->output();
wfProfileOut( 'MediaWiki::finalCleanup' );
}
*/
function doUpdates ( &$updates ) {
wfProfileIn( 'MediaWiki::doUpdates' );
+ /* No need to get master connections in case of empty updates array */
+ if (!$updates) {
+ wfProfileOut('MediaWiki::doUpdates');
+ return;
+ }
+
$dbw = wfGetDB( DB_MASTER );
foreach( $updates as $up ) {
$up->doUpdate();
*/
function restInPeace ( &$loadBalancer ) {
wfLogProfilingData();
- $loadBalancer->closeAll();
wfDebug( "Request ended normally\n" );
}