From a1e58d245584c7a3281b3ec721ad3e3cbbd5dd4b Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Fri, 2 Mar 2018 19:54:45 -0800 Subject: [PATCH] Fix master/replica race condition when creating null revisions RevisionStore::newFromNullRevision() carefully reads the latest revision from the master, but then forgets to instruct emulateMainSlot_1_29() to do the same, so the lookup query for rev_text_id in the text table is done against a replica. This is not usually a problem for null revisions, but it is a problem when editing a page and then immediately moving it: this causes a null revision to be created based on a freshly created revision, which doesn't yet exist on the replica. Bug: T184670 Change-Id: Ied4db5ee770716ff3edb918d2be722934c79d0c7 --- includes/Storage/RevisionStore.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Storage/RevisionStore.php b/includes/Storage/RevisionStore.php index e13fc1fe7a..e00deef6cc 100644 --- a/includes/Storage/RevisionStore.php +++ b/includes/Storage/RevisionStore.php @@ -613,7 +613,7 @@ class RevisionStore $fields['title'] = Title::makeTitle( $current->page_namespace, $current->page_title ); - $mainSlot = $this->emulateMainSlot_1_29( $fields, 0, $title ); + $mainSlot = $this->emulateMainSlot_1_29( $fields, self::READ_LATEST, $title ); $revision = new MutableRevisionRecord( $title, $this->wikiId ); $this->initializeMutableRevisionFromArray( $revision, $fields ); $revision->setSlot( $mainSlot ); -- 2.20.1