From: Umherirrender Date: Sun, 30 Sep 2018 15:19:21 +0000 (+0200) Subject: Fix logged method in LoadBalancer X-Git-Tag: 1.34.0-rc.0~3944 X-Git-Url: http://git.cyclocoop.org//%27http:/code.google.com/p/ie7-js//%27?a=commitdiff_plain;h=b4016f14d1620acaac8e2e7763948e7d9e48c5d1;p=lhc%2Fweb%2Fwiklou.git Fix logged method in LoadBalancer Seeing {closure} in the logs as caller is not helpful Change-Id: I45d9be25acdcc70c7d9755c15f68f7bc6887e166 --- diff --git a/includes/libs/rdbms/loadbalancer/LoadBalancer.php b/includes/libs/rdbms/loadbalancer/LoadBalancer.php index 00b413017b..f36d98e70d 100644 --- a/includes/libs/rdbms/loadbalancer/LoadBalancer.php +++ b/includes/libs/rdbms/loadbalancer/LoadBalancer.php @@ -1256,10 +1256,11 @@ class LoadBalancer implements ILoadBalancer { } public function closeAll() { - $this->forEachOpenConnection( function ( IDatabase $conn ) { + $fname = __METHOD__; + $this->forEachOpenConnection( function ( IDatabase $conn ) use ( $fname ) { $host = $conn->getServer(); $this->connLogger->debug( - __METHOD__ . ": closing connection to database '$host'." ); + $fname . ": closing connection to database '$host'." ); $conn->close(); } ); @@ -1447,6 +1448,7 @@ class LoadBalancer implements ILoadBalancer { } ); $e = null; // first exception + $fname = __METHOD__; // Loop until callbacks stop adding callbacks on other connections do { // Run any pending callbacks for each connection... @@ -1464,13 +1466,13 @@ class LoadBalancer implements ILoadBalancer { } ); // Clear out any active transactions left over from callbacks... - $this->forEachOpenMasterConnection( function ( Database $conn ) use ( &$e ) { + $this->forEachOpenMasterConnection( function ( Database $conn ) use ( &$e, $fname ) { if ( $conn->writesPending() ) { // A callback from another handle wrote to this one and DBO_TRX is set - $this->queryLogger->warning( __METHOD__ . ": found writes pending." ); + $this->queryLogger->warning( $fname . ": found writes pending." ); $fnames = implode( ', ', $conn->pendingWriteAndCallbackCallers() ); $this->queryLogger->warning( - __METHOD__ . ": found writes pending ($fnames).", + $fname . ": found writes pending ($fnames).", [ 'db_server' => $conn->getServer(), 'db_name' => $conn->getDBname() @@ -1479,10 +1481,10 @@ class LoadBalancer implements ILoadBalancer { } elseif ( $conn->trxLevel() ) { // A callback from another handle read from this one and DBO_TRX is set, // which can easily happen if there is only one DB (no replicas) - $this->queryLogger->debug( __METHOD__ . ": found empty transaction." ); + $this->queryLogger->debug( $fname . ": found empty transaction." ); } try { - $conn->commit( __METHOD__, $conn::FLUSHING_ALL_PEERS ); + $conn->commit( $fname, $conn::FLUSHING_ALL_PEERS ); } catch ( Exception $ex ) { $e = $e ?: $ex; }