jenkins-bot has submitted this change and it was merged.

Change subject: Avoiding implicit transactions when applying
......................................................................


Avoiding implicit transactions when applying

* Some callers get the DB and flip DBO_TRX off, which does not
  help much if simply connecting to the DB starts a transaction.

Change-Id: I2bc90a1cdeade13ccb546db1183ab08f25156da1
---
M includes/db/DatabaseMysqlBase.php
1 file changed, 6 insertions(+), 1 deletion(-)

Approvals:
  Chad: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/db/DatabaseMysqlBase.php 
b/includes/db/DatabaseMysqlBase.php
index e0ad003..1f80aa7 100644
--- a/includes/db/DatabaseMysqlBase.php
+++ b/includes/db/DatabaseMysqlBase.php
@@ -123,7 +123,12 @@
                // Set SQL mode, default is turning them all off, can be 
overridden or skipped with null
                if ( is_string( $wgSQLMode ) ) {
                        $mode = $this->addQuotes( $wgSQLMode );
-                       $this->query( "SET sql_mode = $mode", __METHOD__ );
+                       // Use doQuery() to avoid opening implicit transactions 
(DBO_TRX)
+                       $success = $this->doQuery( "SET sql_mode = $mode", 
__METHOD__ );
+                       if ( !$success ) {
+                               wfLogDBError( "Error setting sql_mode to $mode 
on server {$this->mServer}" );
+                               return $this->reportConnectionError( "Error 
setting sql_mode to $mode" );
+                       }
                }
 
                $this->mOpened = true;

-- 
To view, visit https://gerrit.wikimedia.org/r/96912
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2bc90a1cdeade13ccb546db1183ab08f25156da1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to