global $wgUpdateRowsPerQuery;
$dbw = $this->getConnection( DB_MASTER );
+ $factory = wfGetLBFactory();
$watchersChunks = array_chunk( $watchers, $wgUpdateRowsPerQuery );
foreach ( $watchersChunks as $watchersChunk ) {
], $fname
);
if ( count( $watchersChunks ) > 1 ) {
- $dbw->commit( __METHOD__, 'flush' );
- wfGetLBFactory()->waitForReplication( [ 'wiki' => $dbw->getWikiID() ] );
+ $factory->commitMasterChanges( __METHOD__ );
+ $factory->waitForReplication( [ 'wiki' => $dbw->getWikiID() ] );
}
}
$this->uncacheLinkTarget( $target );
$this->reuseConnection( $dbw );
- }
+ },
+ DeferredUpdates::POSTSEND,
+ $dbw
);
}
" performing implicit commit before closing connection!" );
}
- $this->commit( __METHOD__, 'flush' );
+ $this->commit( __METHOD__, self::FLUSHING_INTERNAL );
}
$closed = $this->closeConnection();
/**
* Gets an array of aliased table names
*
- * @param array $tables Array( [alias] => table )
+ * @param array $tables [ [alias] => table ]
* @return string[] See tableNameWithAlias()
*/
public function tableNamesWithAlias( $tables ) {
/**
* Gets an array of aliased field names
*
- * @param array $fields Array( [alias] => field )
+ * @param array $fields [ [alias] => field ]
* @return string[] See fieldNameWithAlias()
*/
public function fieldNamesWithAlias( $fields ) {
}
if ( !$this->mTrxAtomicLevels && $this->mTrxAutomaticAtomic ) {
- $this->commit( $fname, 'flush' );
+ $this->commit( $fname, self::FLUSHING_INTERNAL );
}
}
);
}
- if ( $flush === 'flush' ) {
+ if ( $flush === self::FLUSHING_INTERNAL || $flush === self::FLUSHING_ALL_PEERS ) {
if ( !$this->mTrxLevel ) {
return; // nothing to do
} elseif ( !$this->mTrxAutomatic ) {
}
final public function rollback( $fname = __METHOD__, $flush = '' ) {
- if ( $flush !== 'flush' ) {
+ if ( $flush !== self::FLUSHING_INTERNAL && $flush !== self::FLUSHING_ALL_PEERS ) {
if ( !$this->mTrxLevel ) {
wfWarn( "$fname: No transaction to rollback, something got out of sync!" );
return; // nothing to do
}
$unlocker = new ScopedCallback( function () use ( $lockKey, $fname ) {
- $this->commit( __METHOD__, 'flush' );
+ $this->commit( __METHOD__, self::FLUSHING_INTERNAL );
$this->unlock( $lockKey, $fname );
} );
- $this->commit( __METHOD__, 'flush' );
+ $this->commit( __METHOD__, self::FLUSHING_INTERNAL );
return $unlocker;
}