Aaron Schulz has uploaded a new change for review. https://gerrit.wikimedia.org/r/305671
Change subject: Avoid INSERT..SELECT in MovePage ...................................................................... Avoid INSERT..SELECT in MovePage That construct has poor locking characteristics in terms of auto-inc columns as well as not allowing such inserts concurrently for statement-based replication. Also, the INSERT..SELECT did not have an ORDER BY, which could lead to pr_id drift with statement based replication. Change-Id: I47ca89abcbe4598d3b56cf077a47055500a0647f --- M includes/MovePage.php 1 file changed, 16 insertions(+), 10 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/71/305671/1 diff --git a/includes/MovePage.php b/includes/MovePage.php index bc3305a..d17f234 100644 --- a/includes/MovePage.php +++ b/includes/MovePage.php @@ -297,19 +297,25 @@ if ( $protected ) { # Protect the redirect title as the title used to be... - $dbw->insertSelect( 'page_restrictions', 'page_restrictions', - [ - 'pr_page' => $redirid, - 'pr_type' => 'pr_type', - 'pr_level' => 'pr_level', - 'pr_cascade' => 'pr_cascade', - 'pr_user' => 'pr_user', - 'pr_expiry' => 'pr_expiry' - ], + $res = $dbw->select( + 'page_restrictions', + '*', [ 'pr_page' => $pageid ], __METHOD__, - [ 'IGNORE' ] + 'FOR UPDATE' ); + $rowsInsert = []; + foreach ( $res as $row ) { + $rowsInsert[] = [ + 'pr_page' => $redirid, + 'pr_type' => $row->pr_type, + 'pr_level' => $row->pr_level, + 'pr_cascade' => $row->pr_cascade, + 'pr_user' => $row->pr_user, + 'pr_expiry' => $row->pr_expiry + ]; + } + $dbw->insert( 'page_restrictions', $rowsInsert, __METHOD__, [ 'IGNORE' ] ); // Build comment for log $comment = wfMessage( -- To view, visit https://gerrit.wikimedia.org/r/305671 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I47ca89abcbe4598d3b56cf077a47055500a0647f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits