Merge "rdbms: use Database::getDomainId for transaction logging calls"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 16 Aug 2018 05:54:35 +0000 (05:54 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 16 Aug 2018 05:54:35 +0000 (05:54 +0000)
includes/libs/rdbms/database/Database.php
tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php

index d3b1ba8..e35e082 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;
        }