Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/180702

Change subject: Avoiding starting transactions for SHOW MASTER/SLAVE STATUS
......................................................................

Avoiding starting transactions for SHOW MASTER/SLAVE STATUS

Change-Id: Ie5b116bc726b47c68459e6525a1bb43b96bd9f30
---
M includes/db/Database.php
1 file changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/02/180702/1

diff --git a/includes/db/Database.php b/includes/db/Database.php
index 6d27d86..ed46c59 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -1088,10 +1088,11 @@
                // Or, for one-word queries (like "BEGIN" or COMMIT") add it to 
the end (bug 42598)
                $commentedSql = preg_replace( '/\s|$/', " /* $fname $userName 
*/ ", $sql, 1 );
 
+               static $noTrxVerbs = array( 'BEGIN', 'COMMIT', 'ROLLBACK', 
'SHOW' );
+
+               $verb = substr( $sql, 0, strcspn( $sql, " \t\r\n" ) );
                # If DBO_TRX is set, start a transaction
-               if ( ( $this->mFlags & DBO_TRX ) && !$this->mTrxLevel &&
-                       $sql != 'BEGIN' && $sql != 'COMMIT' && $sql != 
'ROLLBACK'
-               ) {
+               if ( $this->getFlag( DBO_TRX ) && !$this->mTrxLevel && 
!in_array( $verb, $noTrxVerbs ) ) {
                        # Avoid establishing transactions for SHOW and SET 
statements too -
                        # that would delay transaction initializations to once 
connection
                        # is really used by application

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie5b116bc726b47c68459e6525a1bb43b96bd9f30
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

Reply via email to