* http://www.gnu.org/copyleft/gpl.html
*
* @file
- * @author Aaron Schulz
*/
+use Wikimedia\Rdbms\IDatabase;
+use Wikimedia\Rdbms\DBConnRef;
+use Wikimedia\Rdbms\DBConnectionError;
+use Wikimedia\Rdbms\DBError;
use MediaWiki\MediaWikiServices;
use Wikimedia\ScopedCallback;
* @return void
*/
protected function doBatchPush( array $jobs, $flags ) {
- $dbw = $this->getMasterDB();
-
- $method = __METHOD__;
- $dbw->onTransactionIdle(
- function () use ( $dbw, $jobs, $flags, $method ) {
- $this->doBatchPushInternal( $dbw, $jobs, $flags, $method );
- },
- __METHOD__
+ DeferredUpdates::addUpdate(
+ new AutoCommitUpdate(
+ $this->getMasterDB(),
+ __METHOD__,
+ function ( IDatabase $dbw, $fname ) use ( $jobs, $flags ) {
+ $this->doBatchPushInternal( $dbw, $jobs, $flags, $fname );
+ }
+ ),
+ DeferredUpdates::PRESEND
);
}
$invertedDirection = false; // whether one job_random direction was already scanned
// This uses a replication safe method for acquiring jobs. One could use UPDATE+LIMIT
// instead, but that either uses ORDER BY (in which case it deadlocks in MySQL) or is
- // not replication safe. Due to http://bugs.mysql.com/bug.php?id=6980, subqueries cannot
+ // not replication safe. Due to https://bugs.mysql.com/bug.php?id=6980, subqueries cannot
// be used here with MySQL.
do {
if ( $tinyQueue ) { // queue has <= MAX_OFFSET rows
continue; // try the other direction
}
} else { // table *may* have >= MAX_OFFSET rows
- // Bug 42614: "ORDER BY job_random" with a job_random inequality causes high CPU
+ // T44614: "ORDER BY job_random" with a job_random inequality causes high CPU
// in MySQL if there are many rows for some reason. This uses a small OFFSET
// instead of job_random for reducing excess claim retries.
$row = $dbw->selectRow( 'job', self::selectFields(), // find a random job
$row = false; // the row acquired
do {
if ( $dbw->getType() === 'mysql' ) {
- // Per http://bugs.mysql.com/bug.php?id=6980, we can't use subqueries on the
+ // Per https://bugs.mysql.com/bug.php?id=6980, we can't use subqueries on the
// same table being changed in an UPDATE query in MySQL (gives Error: 1093).
// Oracle and Postgre have no such limitation. However, MySQL offers an
// alternative here by supporting ORDER BY + LIMIT for UPDATE queries.