WikiPage: Avoid locking comment and actor tables in doDeleteArticleReal
authorBrad Jorsch <bjorsch@wikimedia.org>
Tue, 10 Apr 2018 14:39:22 +0000 (10:39 -0400)
committerAnomie <bjorsch@wikimedia.org>
Wed, 11 Apr 2018 15:26:54 +0000 (15:26 +0000)
commitb3f258c360a35ef0697cf7a5d8bdc3c0ef99c48d
tree76580a39f7fe81c2d6086a4383d7c5c6f0b6e325
parentd13aa39760f9de5ab9c638ae417f94c786244ee7
WikiPage: Avoid locking comment and actor tables in doDeleteArticleReal

The existing code was using FOR UPDATE when selecting the revision table
rows to be added to the archive table, which meant it was locking not
only `revision`, `revision_comment_temp`, and `revision_actor_temp` that
are being updated but also `comment` and `actor` that we have no
intention of touching. And since those both are intended to be widely
shared, that's likely to lead to unnecessary lock contention.

To avoid that, we make two queries: one against only the rows we want to
lock with FOR UPDATE, and the second to actually fetch the data without
FOR UPDATE.

Bug: T191892
Change-Id: I40ecf1786249c886a5ff25f29ec01edee3ff205d
includes/page/WikiPage.php