rdbms: use Database::getDomainId for transaction logging calls
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 15 Aug 2018 08:20:30 +0000 (01:20 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 15 Aug 2018 08:29:39 +0000 (01:29 -0700)
Change-Id: I360ca633b145dc8e510bb00b542ac44933283943

includes/libs/rdbms/database/Database.php
tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php

index 2673b2c..2fc3638 100644 (file)
@@ -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
index 8f4aae3..abde37a 100644 (file)
@@ -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;
        }