* http://www.gnu.org/copyleft/gpl.html
*
* @file
- * @ingroup Database
*/
namespace Wikimedia\Rdbms;
private $disabled = false;
/** @var bool */
private $chronProtInitialized = false;
+ /** @var int */
+ private $maxLag = self::MAX_LAG_DEFAULT;
/** @var int Warn when this many connection are held */
const CONN_HELD_WARN_THRESHOLD = 10;
- /** @var int Default 'max lag' when unspecified */
+ /** @var int Default 'maxLag' when unspecified */
const MAX_LAG_DEFAULT = 10;
/** @var int Seconds to cache master server read-only status */
const TTL_CACHE_READONLY = 5;
$this->readOnlyReason = $params['readOnlyReason'];
}
+ if ( isset( $params['maxLag'] ) ) {
+ $this->maxLag = $params['maxLag'];
+ }
+
if ( isset( $params['loadMonitor'] ) ) {
$this->loadMonitorConfig = $params['loadMonitor'];
} else {
$this->loadMonitorConfig = [ 'class' => 'LoadMonitorNull' ];
}
+ $this->loadMonitorConfig += [ 'lagWarnThreshold' => $this->maxLag ];
foreach ( $params['servers'] as $i => $server ) {
$this->mLoads[$i] = $server['load'];
# How much lag this server nominally is allowed to have
$maxServerLag = isset( $this->mServers[$i]['max lag'] )
? $this->mServers[$i]['max lag']
- : self::MAX_LAG_DEFAULT; // default
+ : $this->maxLag; // default
# Constrain that futher by $maxLag argument
$maxServerLag = min( $maxServerLag, $maxLag );
"Server {host} is not replicating?", [ 'host' => $host ] );
unset( $loads[$i] );
} elseif ( $lag > $maxServerLag ) {
- $this->replLogger->warning(
+ $this->replLogger->info(
"Server {host} has {lag} seconds of lag (>= {maxlag})",
[ 'host' => $host, 'lag' => $lag, 'maxlag' => $maxServerLag ]
);