From: Aaron Schulz Date: Wed, 4 Oct 2017 18:24:11 +0000 (-0700) Subject: Make Database::rollback() also suppress callback errors X-Git-Tag: 1.31.0-rc.0~1870^2 X-Git-Url: http://git.cyclocoop.org/%22.%24image2.%22?a=commitdiff_plain;h=95e9115858b4e8bded9772ce092b6a762d029bc5;p=lhc%2Fweb%2Fwiklou.git Make Database::rollback() also suppress callback errors This is consistent with query error suppression, let the listener callbacks have a chance to run. This also makes LoadBalancer::rollbackMasterChanges move on to the other connections. Change-Id: Ic8b9dd4b868bfe69b04fb20f7be5fce11d864fc4 --- diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index 3c0a2ad771..bc1454baec 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -3078,8 +3078,16 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware $this->mTrxIdleCallbacks = []; // clear $this->mTrxPreCommitCallbacks = []; // clear - $this->runOnTransactionIdleCallbacks( self::TRIGGER_ROLLBACK ); - $this->runTransactionListenerCallbacks( self::TRIGGER_ROLLBACK ); + try { + $this->runOnTransactionIdleCallbacks( self::TRIGGER_ROLLBACK ); + } catch ( Exception $e ) { + // already logged; finish and let LoadBalancer move on during mass-rollback + } + try { + $this->runTransactionListenerCallbacks( self::TRIGGER_ROLLBACK ); + } catch ( Exception $e ) { + // already logged; let LoadBalancer move on during mass-rollback + } } /** diff --git a/includes/libs/rdbms/database/IDatabase.php b/includes/libs/rdbms/database/IDatabase.php index 5d0e03fc24..67e8e85518 100644 --- a/includes/libs/rdbms/database/IDatabase.php +++ b/includes/libs/rdbms/database/IDatabase.php @@ -1594,6 +1594,8 @@ interface IDatabase { * throwing an Exception is preferrable, using a pre-installed error handler to trigger * rollback (in any case, failure to issue COMMIT will cause rollback server-side). * + * Query, connection, and onTransaction* callback errors will be suppressed and logged. + * * @param string $fname Calling function name * @param string $flush Flush flag, set to a situationally valid IDatabase::FLUSHING_* * constant to disable warnings about calling rollback when no transaction is in