X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2Frdbms%2Fdatabase%2FDatabase.php;h=a9dd07483f679ab5116cd0f769f3e5d3e8fdb63f;hb=0f3226654343a78c4b58ba3f1032bc031ce7b8eb;hp=7a97dcb7027c8b21bffcf4d9459d9dd9d69b1a78;hpb=4d5e5a49583caf2a6273e00be5bf16895566a5ea;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index 7a97dcb702..a9dd07483f 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -945,10 +945,12 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware # 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 @@ -958,8 +960,8 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware $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() ] ); } } @@ -1138,6 +1140,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware * * @param string $error Error text * @param int $errno Error number + * @return bool */ protected function wasQueryTimeout( $error, $errno ) { return false; @@ -2014,11 +2017,21 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware // No alias? Set it equal to the table name $alias = $table; } + + if ( is_array( $table ) ) { + // A parenthesized group + $joinedTable = '(' + . $this->tableNamesWithIndexClauseOrJOIN( $table, $use_index, $ignore_index, $join_conds ) + . ')'; + } else { + $joinedTable = $this->tableNameWithAlias( $table, $alias ); + } + // Is there a JOIN clause for this table? if ( isset( $join_conds[$alias] ) ) { list( $joinType, $conds ) = $join_conds[$alias]; $tableClause = $joinType; - $tableClause .= ' ' . $this->tableNameWithAlias( $table, $alias ); + $tableClause .= ' ' . $joinedTable; if ( isset( $use_index[$alias] ) ) { // has USE INDEX? $use = $this->useIndexClause( implode( ',', (array)$use_index[$alias] ) ); if ( $use != '' ) { @@ -2040,7 +2053,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware $retJOIN[] = $tableClause; } elseif ( isset( $use_index[$alias] ) ) { // Is there an INDEX clause for this table? - $tableClause = $this->tableNameWithAlias( $table, $alias ); + $tableClause = $joinedTable; $tableClause .= ' ' . $this->useIndexClause( implode( ',', (array)$use_index[$alias] ) ); @@ -2048,14 +2061,14 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware $ret[] = $tableClause; } elseif ( isset( $ignore_index[$alias] ) ) { // Is there an INDEX clause for this table? - $tableClause = $this->tableNameWithAlias( $table, $alias ); + $tableClause = $joinedTable; $tableClause .= ' ' . $this->ignoreIndexClause( implode( ',', (array)$ignore_index[$alias] ) ); $ret[] = $tableClause; } else { - $tableClause = $this->tableNameWithAlias( $table, $alias ); + $tableClause = $joinedTable; $ret[] = $tableClause; } @@ -3077,8 +3090,16 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware $this->mTrxIdleCallbacks = []; // clear $this->mTrxPreCommitCallbacks = []; // clear - $this->runOnTransactionIdleCallbacks( self::TRIGGER_ROLLBACK ); - $this->runTransactionListenerCallbacks( self::TRIGGER_ROLLBACK ); + try { + $this->runOnTransactionIdleCallbacks( self::TRIGGER_ROLLBACK ); + } catch ( Exception $e ) { + // already logged; finish and let LoadBalancer move on during mass-rollback + } + try { + $this->runTransactionListenerCallbacks( self::TRIGGER_ROLLBACK ); + } catch ( Exception $e ) { + // already logged; let LoadBalancer move on during mass-rollback + } } /**