From 5358c41e86a6862b6a9d0326c6544becad516af2 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 15 Aug 2018 01:20:30 -0700 Subject: [PATCH] rdbms: use Database::getDomainId for transaction logging calls Change-Id: I360ca633b145dc8e510bb00b542ac44933283943 --- includes/libs/rdbms/database/Database.php | 8 ++++---- .../phpunit/includes/libs/rdbms/database/DatabaseTest.php | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index 2673b2c001..2fc36385fe 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -1132,11 +1132,11 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware if ( $this->trxLevel && !$this->trxDoneWrites && $isWrite ) { $this->trxDoneWrites = true; $this->trxProfiler->transactionWritingIn( - $this->server, $this->dbName, $this->trxShortId ); + $this->server, $this->getDomainID(), $this->trxShortId ); } if ( $this->getFlag( self::DBO_DEBUG ) ) { - $this->queryLogger->debug( "{$this->dbName} {$commentedSql}" ); + $this->queryLogger->debug( "{$this->getDomainID()} {$commentedSql}" ); } # Send the query to the server and fetch any corresponding errors @@ -3856,7 +3856,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware $this->lastWriteTime = microtime( true ); $this->trxProfiler->transactionWritingOut( $this->server, - $this->dbName, + $this->getDomainID(), $this->trxShortId, $writeTime, $this->trxWriteAffectedRows @@ -3907,7 +3907,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware if ( $this->trxDoneWrites ) { $this->trxProfiler->transactionWritingOut( $this->server, - $this->dbName, + $this->getDomainID(), $this->trxShortId, $writeTime, $this->trxWriteAffectedRows diff --git a/tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php b/tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php index 8f4aae365f..abde37aed2 100644 --- a/tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php +++ b/tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php @@ -2,6 +2,7 @@ use Wikimedia\Rdbms\Database; use Wikimedia\Rdbms\IDatabase; +use Wikimedia\Rdbms\DatabaseDomain; use Wikimedia\Rdbms\DatabaseMysqli; use Wikimedia\Rdbms\LBFactorySingle; use Wikimedia\Rdbms\TransactionProfiler; @@ -453,6 +454,7 @@ class DatabaseTest extends PHPUnit\Framework\TestCase { $wdb->trxProfiler = new TransactionProfiler(); $wdb->connLogger = new \Psr\Log\NullLogger(); $wdb->queryLogger = new \Psr\Log\NullLogger(); + $wdb->currentDomain = DatabaseDomain::newUnspecified(); return $db; } -- 2.20.1