From: Aaron Schulz Date: Tue, 10 Jun 2014 20:25:34 +0000 (-0700) Subject: Reduce deadlocks adding log rows to the RC table on delete X-Git-Tag: 1.31.0-rc.0~15398 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;ds=sidebyside;h=46f0261af09839942a4727a3c7853bb3eb00462e;p=lhc%2Fweb%2Fwiklou.git Reduce deadlocks adding log rows to the RC table on delete bug: 56776 Change-Id: Ic75530b25f3fa5668019c76ce59a1dda2768f389 --- 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__ );