Aaron Schulz has uploaded a new change for review.

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

Change subject: Fixed bug where catching DB errors left ignoreErrors() on
......................................................................

Fixed bug where catching DB errors left ignoreErrors() on

* Also fixed an actual rollback loop possible in postgres

Change-Id: I41508127f74e1bbee4c020546fed85ab53318ab7
---
M includes/db/Database.php
M includes/db/DatabasePostgres.php
2 files changed, 5 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/78/197978/1

diff --git a/includes/db/Database.php b/includes/db/Database.php
index b3c81f9..ef5de7b 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -1226,13 +1226,10 @@
         * @throws DBQueryError
         */
        public function reportQueryError( $error, $errno, $sql, $fname, 
$tempIgnore = false ) {
-               # Ignore errors during error handling to avoid infinite 
recursion
-               $ignore = $this->ignoreErrors( true );
                ++$this->mErrorCount;
 
-               if ( $ignore || $tempIgnore ) {
+               if ( $this->ignoreErrors() || $tempIgnore ) {
                        wfDebug( "SQL ERROR (ignored): $error\n" );
-                       $this->ignoreErrors( $ignore );
                } else {
                        $sql1line = mb_substr( str_replace( "\n", "\\n", $sql 
), 0, 5 * 1024 );
                        wfLogDBError(
@@ -3327,7 +3324,6 @@
                $this->begin( __METHOD__ );
                $args = func_get_args();
                $function = array_shift( $args );
-               $oldIgnore = $this->ignoreErrors( true );
                $tries = self::DEADLOCK_TRIES;
 
                if ( is_array( $function ) ) {
@@ -3351,8 +3347,6 @@
                                }
                        }
                } while ( $this->wasDeadlock() && --$tries > 0 );
-
-               $this->ignoreErrors( $oldIgnore );
 
                if ( $tries <= 0 ) {
                        $this->rollback( __METHOD__ );
diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php
index 3d0ed86..9287f7a 100644
--- a/includes/db/DatabasePostgres.php
+++ b/includes/db/DatabasePostgres.php
@@ -530,10 +530,12 @@
                                return;
                        }
                }
-               /* Transaction stays in the ERROR state until rolledback */
+               /* Transaction stays in the ERROR state until rolled back */
                if ( $this->mTrxLevel ) {
+                       $ignore = $this->ignoreErrors( true );
                        $this->rollback( __METHOD__ );
-               };
+                       $this->ignoreErrors( $ignore );
+               }
                parent::reportQueryError( $error, $errno, $sql, $fname, false );
        }
 

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

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