Race condition fixes for refreshLinks jobs
authorAaron Schulz <aschulz@wikimedia.org>
Sat, 14 Nov 2015 01:44:49 +0000 (17:44 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Mon, 16 Nov 2015 21:21:05 +0000 (13:21 -0800)
commit9b386d24362a8e6d576448163eb107a0d4f5b263
tree626c2f160c24cc8aa2dac6fbdcd1964373b764c0
parent179009b69eb46499ddd6cb1acced8ad8b4f9c2fd
Race condition fixes for refreshLinks jobs

* Use READ_LATEST when needed to distinguish slave lag
  affecting new pages from page deletions that happened
  after the job was pushed. Run-of-the-mill mass backlink
  updates still typically use "masterPos" and READ_NORMAL.
* Search for the expected revision (via READ_LATEST)
  for jobs triggered by direct page edits. This avoids lag
  problems for edits to existing pages.
* Added a CAS-style check to avoid letting jobs clobber
  the work of other jobs that saw a newer page version.
* Rename and expose WikiPage::lock() method.
* Split out position wait logic to a separate protected
  method and made sure it only got called once instead of
  per-title (which didn't do anything). Note that there is
  normally 1 title per job in any case.
* Add FIXME about a related race-conditions.

Bug: T117332
Change-Id: Ib3fa0fc77040646b9a4e5e4b3dc9ae3c51ac29b3
includes/jobqueue/jobs/RefreshLinksJob.php
includes/page/WikiPage.php