From: Umherirrender Date: Sun, 30 Sep 2018 15:09:58 +0000 (+0200) Subject: Fix caller name in DatabaseMysqlBase::getMasterServerInfo/getServerId X-Git-Tag: 1.34.0-rc.0~3946 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=a33827a61ff011501b5952a01da27a34af0948b7;p=lhc%2Fweb%2Fwiklou.git Fix caller name in DatabaseMysqlBase::getMasterServerInfo/getServerId Seeing {closure} in the logs as caller is not helpful Change-Id: I63adbfcf4944747670a3a30182f6bd5cb6d0e48b --- diff --git a/includes/libs/rdbms/database/DatabaseMysqlBase.php b/includes/libs/rdbms/database/DatabaseMysqlBase.php index 0f575516b4..8d82965fb9 100644 --- a/includes/libs/rdbms/database/DatabaseMysqlBase.php +++ b/includes/libs/rdbms/database/DatabaseMysqlBase.php @@ -824,11 +824,12 @@ abstract class DatabaseMysqlBase extends Database { // Using one key for all cluster replica DBs is preferable $this->getLBInfo( 'clusterMasterHost' ) ?: $this->getServer() ); + $fname = __METHOD__; return $cache->getWithSetCallback( $key, $cache::TTL_INDEFINITE, - function () use ( $cache, $key ) { + function () use ( $cache, $key, $fname ) { // Get and leave a lock key in place for a short period if ( !$cache->lock( $key, 0, 10 ) ) { return false; // avoid master connection spike slams @@ -841,7 +842,7 @@ abstract class DatabaseMysqlBase extends Database { // Connect to and query the master; catch errors to avoid outages try { - $res = $conn->query( 'SELECT @@server_id AS id', __METHOD__ ); + $res = $conn->query( 'SELECT @@server_id AS id', $fname ); $row = $res ? $res->fetchObject() : false; $id = $row ? (int)$row->id : 0; } catch ( DBError $e ) { @@ -1043,11 +1044,12 @@ abstract class DatabaseMysqlBase extends Database { * @throws DBQueryError If the variable doesn't exist for some reason */ protected function getServerId() { + $fname = __METHOD__; return $this->srvCache->getWithSetCallback( $this->srvCache->makeGlobalKey( 'mysql-server-id', $this->getServer() ), self::SERVER_ID_CACHE_TTL, - function () { - $res = $this->query( "SELECT @@server_id AS id", __METHOD__ ); + function () use ( $fname ) { + $res = $this->query( "SELECT @@server_id AS id", $fname ); return intval( $this->fetchObject( $res )->id ); } );