From: Aaron Schulz Date: Tue, 20 Mar 2018 00:17:24 +0000 (-0700) Subject: rdbms: cleanup runMasterPostTrxCallbacks() transaction check X-Git-Tag: 1.31.0-rc.0~317^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=ee38d9bbe318e42d7eace6e3092fde2069924d3a rdbms: cleanup runMasterPostTrxCallbacks() transaction check This does not actually care about pending callbacks, and indeed there are expected to likely be some (which it runs a few lines later). Change-Id: If966a518893dedeb48bbeca87daedb417e5abd92 --- diff --git a/includes/libs/rdbms/loadbalancer/LoadBalancer.php b/includes/libs/rdbms/loadbalancer/LoadBalancer.php index 35198ac37c..4c5621ab2e 100644 --- a/includes/libs/rdbms/loadbalancer/LoadBalancer.php +++ b/includes/libs/rdbms/loadbalancer/LoadBalancer.php @@ -1373,11 +1373,12 @@ class LoadBalancer implements ILoadBalancer { $e = null; // first exception $this->forEachOpenMasterConnection( function ( Database $conn ) use ( $type, &$e ) { $conn->setTrxEndCallbackSuppression( false ); - if ( $conn->writesOrCallbacksPending() ) { - // This happens if onTransactionIdle() callbacks leave callbacks on *another* DB - // (which finished its callbacks already). Warn and recover in this case. Let the - // callbacks run in the final commitMasterChanges() in LBFactory::shutdown(). - $this->queryLogger->info( __METHOD__ . ": found writes/callbacks pending." ); + // Callbacks run in AUTO-COMMIT mode, so make sure no transactions are pending... + if ( $conn->writesPending() ) { + // This happens if onTransactionIdle() callbacks write to *other* handles + // (which already finished their callbacks). Let any callbacks run in the final + // commitMasterChanges() in LBFactory::shutdown(), when the transaction is gone. + $this->queryLogger->warning( __METHOD__ . ": found writes pending." ); return; } elseif ( $conn->trxLevel() ) { // This happens for single-DB setups where DB_REPLICA uses the master DB,