Aaron Schulz has uploaded a new change for review.

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


Change subject: Cleanups to DB transaction handling
......................................................................

Cleanups to DB transaction handling

* Only do automatic reconnection if there is no trx open instead of doing
  possible half-broken changes and not fully updating trx state variables
* Also made trxLevel() no longer take an argument

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


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/27/93627/1

diff --git a/includes/db/Database.php b/includes/db/Database.php
index cd907e9..9031cf7 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -385,16 +385,15 @@
        }
 
        /**
-        * Gets or sets the current transaction level.
+        * Gets the current transaction level.
         *
         * Historically, transactions were allowed to be "nested". This is no
         * longer supported, so this function really only returns a boolean.
         *
-        * @param int $level An integer (0 or 1), or omitted to leave it 
unchanged.
         * @return int The previous value
         */
-       public function trxLevel( $level = null ) {
-               return wfSetVar( $this->mTrxLevel, $level );
+       public function trxLevel() {
+               return $this->mTrxLevel;
        }
 
        /**
@@ -1021,11 +1020,7 @@
                MWDebug::queryTime( $queryId );
 
                # Try reconnecting if the connection was lost
-               if ( false === $ret && $this->wasErrorReissuable() ) {
-                       # Transaction is gone, like it or not
-                       $this->mTrxLevel = 0;
-                       $this->mTrxIdleCallbacks = array(); // cancel
-                       $this->mTrxPreCommitCallbacks = array(); // cancel
+               if ( false === $ret && !$this->mTrxLevel && 
$this->wasErrorReissuable() ) {
                        wfDebug( "Connection lost, reconnecting...\n" );
 
                        if ( $this->ping() ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I12adfb4fcb28a4832facd63baee2283ead500bd2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

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

Reply via email to