X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Flibs%2Frdbms%2Floadmonitor%2FLoadMonitor.php;h=1666c275c7b430fe57f53c26ffc1b6d2267d59f3;hp=180baed753716b33ddc543bae0971dc8e935d31d;hb=dfec83932fd38a9086eb5a2e212889ad00f35b0e;hpb=902738b40005f6b849408365e7ed4a3b26fca1aa diff --git a/includes/libs/rdbms/loadmonitor/LoadMonitor.php b/includes/libs/rdbms/loadmonitor/LoadMonitor.php index 180baed753..1666c275c7 100644 --- a/includes/libs/rdbms/loadmonitor/LoadMonitor.php +++ b/includes/libs/rdbms/loadmonitor/LoadMonitor.php @@ -154,12 +154,12 @@ class LoadMonitor implements ILoadMonitor { # Handles with open transactions are avoided since they might be subject # to REPEATABLE-READ snapshots, which could affect the lag estimate query. - $flags = ILoadBalancer::CONN_TRX_AUTOCOMMIT; + $flags = ILoadBalancer::CONN_TRX_AUTOCOMMIT | ILoadBalancer::CONN_SILENCE_ERRORS; $conn = $this->parent->getAnyOpenConnection( $i, $flags ); if ( $conn ) { $close = false; // already open } else { - $conn = $this->parent->openConnection( $i, ILoadBalancer::DOMAIN_ANY, $flags ); + $conn = $this->parent->getConnection( $i, [], ILoadBalancer::DOMAIN_ANY, $flags ); $close = true; // new connection } @@ -181,25 +181,21 @@ class LoadMonitor implements ILoadMonitor { continue; } - if ( $conn->getLBInfo( 'is static' ) ) { - $lagTimes[$i] = 0; - } else { - $lagTimes[$i] = $conn->getLag(); - if ( $lagTimes[$i] === false ) { - $this->replLogger->error( - __METHOD__ . ": host {db_server} is not replicating?", - [ 'db_server' => $host ] - ); - } elseif ( $lagTimes[$i] > $this->lagWarnThreshold ) { - $this->replLogger->warning( - "Server {host} has {lag} seconds of lag (>= {maxlag})", - [ - 'host' => $host, - 'lag' => $lagTimes[$i], - 'maxlag' => $this->lagWarnThreshold - ] - ); - } + $lagTimes[$i] = $conn->getLag(); + if ( $lagTimes[$i] === false ) { + $this->replLogger->error( + __METHOD__ . ": host {db_server} is not replicating?", + [ 'db_server' => $host ] + ); + } elseif ( $lagTimes[$i] > $this->lagWarnThreshold ) { + $this->replLogger->warning( + "Server {host} has {lag} seconds of lag (>= {maxlag})", + [ + 'host' => $host, + 'lag' => $lagTimes[$i], + 'maxlag' => $this->lagWarnThreshold + ] + ); } if ( $close ) {