jenkins-bot has submitted this change and it was merged.
Change subject: Made LinksUpdate on edit use the job queue
......................................................................
Made LinksUpdate on edit use the job queue
* LinksUpdate is now an EnqueueableDataUpdate
and can yeild a prioritzed refreshLinks job.
* DeferredUpdates::runUpdates() now takes an enqueue
flag to try to use jobs. This is set in restInPeace().
Updates that change many links will be less likely to
increase lag, as the runners are more strict about that.
* Also made the LinksDeletionUpdate job enqueue happen
post-send on page deletion for consistency
Bug: T95501
Change-Id: I8863caef9c8f03234699d33e4d47d2310a0c8446
---
M includes/MediaWiki.php
M includes/deferred/DeferredUpdates.php
M includes/deferred/LinksUpdate.php
M includes/page/WikiPage.php
4 files changed, 20 insertions(+), 9 deletions(-)
Approvals:
Gilles: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php
index 418ed8b..aee6ee1 100644
--- a/includes/MediaWiki.php
+++ b/includes/MediaWiki.php
@@ -690,7 +690,7 @@
Profiler::instance()->getTransactionProfiler()->resetExpectations();
// Do any deferred jobs
- DeferredUpdates::doUpdates( 'commit' );
+ DeferredUpdates::doUpdates( 'commit', 'enqueue' );
// Make sure any lazy jobs are pushed
JobQueueGroup::pushLazyJobs();
diff --git a/includes/deferred/DeferredUpdates.php
b/includes/deferred/DeferredUpdates.php
index 8b3582d..53312cd 100644
--- a/includes/deferred/DeferredUpdates.php
+++ b/includes/deferred/DeferredUpdates.php
@@ -95,9 +95,10 @@
* Do any deferred updates and clear the list
*
* @param string $commit Set to 'commit' to commit after every update to
+ * @param string $mode Use "enqueue" to use the job queue when possible
[Default: run]
* prevent lock contention
*/
- public static function doUpdates( $commit = '' ) {
+ public static function doUpdates( $commit = '', $mode = 'run' ) {
$updates = self::$updates;
while ( count( $updates ) ) {
@@ -115,12 +116,11 @@
}
// Delegate DataUpdate execution to the DataUpdate class
- DataUpdate::runUpdates( $dataUpdates, 'run' );
+ DataUpdate::runUpdates( $dataUpdates, $mode );
// Execute the non-DataUpdate tasks
foreach ( $otherUpdates as $update ) {
try {
$update->doUpdate();
-
if ( $commit === 'commit' ) {
wfGetLBFactory()->commitMasterChanges();
}
diff --git a/includes/deferred/LinksUpdate.php
b/includes/deferred/LinksUpdate.php
index be5aff3..d996870 100644
--- a/includes/deferred/LinksUpdate.php
+++ b/includes/deferred/LinksUpdate.php
@@ -25,7 +25,7 @@
*
* @todo document (e.g. one-sentence top-level class description).
*/
-class LinksUpdate extends SqlDataUpdate {
+class LinksUpdate extends SqlDataUpdate implements EnqueueableDataUpdate {
// @todo make members protected, but make sure extensions don't break
/** @var int Page ID of the article linked from */
@@ -934,4 +934,16 @@
);
}
}
+
+ public function getAsJobSpecification() {
+ return array(
+ 'wiki' => $this->mDb->getWikiID(),
+ 'job' => new JobSpecification(
+ 'refreshLinks',
+ array( 'prioritize' => true ),
+ array( 'removeDuplicates' => true ),
+ $this->getTitle()
+ )
+ );
+ }
}
diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php
index e47e06c..1ded678 100644
--- a/includes/page/WikiPage.php
+++ b/includes/page/WikiPage.php
@@ -2935,10 +2935,9 @@
// Delete pagelinks, update secondary indexes, etc
$updates = $this->getDeletionUpdates( $content );
- // Make sure an enqueued jobs run after commit so they see the
deletion
- wfGetDB( DB_MASTER )->onTransactionIdle( function() use (
$updates ) {
- DataUpdate::runUpdates( $updates, 'enqueue' );
- } );
+ foreach ( $updates as $update ) {
+ DeferredUpdates::addUpdate( $update );
+ }
// Reparse any pages transcluding this page
LinksUpdate::queueRecursiveJobsForTable( $this->mTitle,
'templatelinks' );
--
To view, visit https://gerrit.wikimedia.org/r/242649
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8863caef9c8f03234699d33e4d47d2310a0c8446
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Gilles <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits