From cb7c910ba72bdf4c2c2f5fa7e7dd307f98e5138e Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 25 Aug 2017 15:47:01 -0700 Subject: [PATCH] Fix old regression in HTMLCacheUpdate de-duplication * The condition timestamp should be the root job timestamp, as the comments imply, though that was not the case. Only the SET timestamp should be the current timestamp. As it was, jobs effectively did not "see" each other since each one would be expecting newer than the ones that ran prior. The page_touched condition for the UPDATE query was mostly useless, since it was always the current timestamp. * This problem was a regression from f598ca81e3f40166. Change-Id: I1398366e87c959be1c98e4db959c41309b0ac1b8 --- includes/jobqueue/jobs/HTMLCacheUpdateJob.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/jobqueue/jobs/HTMLCacheUpdateJob.php b/includes/jobqueue/jobs/HTMLCacheUpdateJob.php index 9d0f87cc11..4c16d7f25b 100644 --- a/includes/jobqueue/jobs/HTMLCacheUpdateJob.php +++ b/includes/jobqueue/jobs/HTMLCacheUpdateJob.php @@ -113,6 +113,10 @@ class HTMLCacheUpdateJob extends Job { // before the link jobs, so using the current timestamp instead of the root timestamp is // not expected to invalidate these cache entries too often. $touchTimestamp = wfTimestampNow(); + // If page_touched is higher than this, then something else already bumped it after enqueue + $condTimestamp = isset( $this->params['rootJobTimestamp'] ) + ? $this->params['rootJobTimestamp'] + : $touchTimestamp; $dbw = wfGetDB( DB_MASTER ); $factory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); @@ -126,7 +130,7 @@ class HTMLCacheUpdateJob extends Job { [ 'page_touched' => $dbw->timestamp( $touchTimestamp ) ], [ 'page_id' => $batch, // don't invalidated pages that were already invalidated - "page_touched < " . $dbw->addQuotes( $dbw->timestamp( $touchTimestamp ) ) + "page_touched < " . $dbw->addQuotes( $dbw->timestamp( $condTimestamp ) ) ], __METHOD__ ); -- 2.20.1