# Update state tracking to reflect transaction loss due to disconnection
$this->handleSessionLoss();
if ( $this->reconnect() ) {
- $msg = __METHOD__ . ": lost connection to {$this->getServer()}; reconnected";
- $this->connLogger->warning( $msg );
+ $msg = __METHOD__ . ': lost connection to {dbserver}; reconnected';
+ $params = [ 'dbserver' => $this->getServer() ];
+ $this->connLogger->warning( $msg, $params );
$this->queryLogger->warning(
- "$msg:\n" . ( new RuntimeException() )->getTraceAsString() );
+ "$msg:\n" . ( new RuntimeException() )->getTraceAsString(),
+ $params );
if ( !$recoverable ) {
# Callers may catch the exception and continue to use the DB
$ret = $this->doProfiledQuery( $sql, $commentedSql, $isNonTempWrite, $fname );
}
} else {
- $msg = __METHOD__ . ": lost connection to {$this->getServer()} permanently";
- $this->connLogger->error( $msg );
+ $msg = __METHOD__ . ': lost connection to {dbserver} permanently';
+ $this->connLogger->error( $msg, [ 'dbserver' => $this->getServer() ] );
}
}
$knownReachedPos->hasReached( $this->mWaitForPos )
) {
$this->replLogger->debug( __METHOD__ .
- ": replica DB $server known to be caught up (pos >= $knownReachedPos)." );
+ ': replica DB {dbserver} known to be caught up (pos >= $knownReachedPos).',
+ [ 'dbserver' => $server ] );
return true;
}
$conn = $this->getAnyOpenConnection( $index );
if ( !$conn ) {
if ( !$open ) {
- $this->replLogger->debug( __METHOD__ . ": no connection open for $server" );
+ $this->replLogger->debug( __METHOD__ . ': no connection open for {dbserver}',
+ [ 'dbserver' => $server ] );
return false;
} else {
$conn = $this->openConnection( $index, self::DOMAIN_ANY );
if ( !$conn ) {
- $this->replLogger->warning( __METHOD__ . ": failed to connect to $server" );
+ $this->replLogger->warning( __METHOD__ . ': failed to connect to {dbserver}',
+ [ 'dbserver' => $server ] );
return false;
}
}
}
- $this->replLogger->info( __METHOD__ . ": Waiting for replica DB $server to catch up..." );
+ $this->replLogger->info( __METHOD__ . ': Waiting for replica DB {dbserver} to catch up...',
+ [ 'dbserver' => $server ] );
$timeout = $timeout ?: $this->mWaitTimeout;
$result = $conn->masterPosWait( $this->mWaitForPos, $timeout );