From 46f0261af09839942a4727a3c7853bb3eb00462e Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 10 Jun 2014 13:25:34 -0700 Subject: [PATCH] Reduce deadlocks adding log rows to the RC table on delete bug: 56776 Change-Id: Ic75530b25f3fa5668019c76ce59a1dda2768f389 --- includes/WikiPage.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 52c5cccdfa..cedbcf9445 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -2874,7 +2874,11 @@ class WikiPage implements Page, IDBAccessObject { $logEntry->setTarget( $logTitle ); $logEntry->setComment( $reason ); $logid = $logEntry->insert(); - $logEntry->publish( $logid ); + + $dbw->onTransactionPreCommitOrIdle( function() use ( $dbw, $logEntry, $logid ) { + // Bug 56776: avoid deadlocks (especially from FileDeleteForm) + $logEntry->publish( $logid ); + } ); if ( $commit ) { $dbw->commit( __METHOD__ ); -- 2.20.1