Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/59866


Change subject: Pass a limit to BackLinkCache::getNumLinks() in some places to 
avoid OOMs.
......................................................................

Pass a limit to BackLinkCache::getNumLinks() in some places to avoid OOMs.

Change-Id: Idf1042c083837a9e4a380bb20ecdf3043ea9ab09
---
M includes/job/jobs/HTMLCacheUpdateJob.php
M includes/job/jobs/RefreshLinksJob.php
2 files changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/66/59866/1

diff --git a/includes/job/jobs/HTMLCacheUpdateJob.php 
b/includes/job/jobs/HTMLCacheUpdateJob.php
index 1a2143e..376b388 100644
--- a/includes/job/jobs/HTMLCacheUpdateJob.php
+++ b/includes/job/jobs/HTMLCacheUpdateJob.php
@@ -82,7 +82,8 @@
                global $wgMaxBacklinksInvalidate;
 
                # Get an estimate of the number of rows from the BacklinkCache
-               $numRows = $this->blCache->getNumLinks( $this->params['table'] 
);
+               $max = max( $this->rowsPerJob * 2, $wgMaxBacklinksInvalidate ) 
+ 1;
+               $numRows = $this->blCache->getNumLinks( $this->params['table'], 
$max );
                if ( $wgMaxBacklinksInvalidate !== false && $numRows > 
$wgMaxBacklinksInvalidate ) {
                        wfDebug( "Skipped HTML cache invalidation of 
{$this->title->getPrefixedText()}." );
                        return true;
diff --git a/includes/job/jobs/RefreshLinksJob.php 
b/includes/job/jobs/RefreshLinksJob.php
index 9dbe827..2ba855d 100644
--- a/includes/job/jobs/RefreshLinksJob.php
+++ b/includes/job/jobs/RefreshLinksJob.php
@@ -158,7 +158,7 @@
                        $jobs = array_merge( $jobs, $this->getSingleTitleJobs( 
$table, $masterPos ) );
                } else {
                        # This is a base job to trigger the insertion of 
partitioned jobs...
-                       if ( $tbc->getNumLinks( $table ) <= $wgUpdateRowsPerJob 
) {
+                       if ( $tbc->getNumLinks( $table, $wgUpdateRowsPerJob + 1 
) <= $wgUpdateRowsPerJob ) {
                                # Just directly insert the single per-title jobs
                                $jobs = array_merge( $jobs, 
$this->getSingleTitleJobs( $table, $masterPos ) );
                        } else {

-- 
To view, visit https://gerrit.wikimedia.org/r/59866
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idf1042c083837a9e4a380bb20ecdf3043ea9ab09
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to