* http://www.gnu.org/copyleft/gpl.html
*
* @file
- * @ingroup Database
*/
namespace Wikimedia\Rdbms;
} else {
$this->loadMonitorConfig = [ 'class' => 'LoadMonitorNull' ];
}
+ $this->loadMonitorConfig += [ 'lagWarnThreshold' => $this->maxLag ];
foreach ( $params['servers'] as $i => $server ) {
$this->mLoads[$i] = $server['load'];
$this->host = isset( $params['hostname'] )
? $params['hostname']
: ( gethostname() ?: 'unknown' );
- $this->cliMode = isset( $params['cliMode'] ) ? $params['cliMode'] : PHP_SAPI === 'cli';
+ $this->cliMode = isset( $params['cliMode'] )
+ ? $params['cliMode']
+ : ( PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg' );
$this->agent = isset( $params['agent'] ) ? $params['agent'] : '';
if ( isset( $params['chronologyProtector'] ) ) {
}
}
+ /**
+ * Get the local (and default) database domain ID of connection handles
+ *
+ * @see DatabaseDomain
+ * @return string Database domain ID; this specifies DB name, schema, and table prefix
+ * @since 1.31
+ */
+ public function getLocalDomainID() {
+ return $this->localDomain->getId();
+ }
+
/**
* Get a LoadMonitor instance
*
"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 ]
);
* @return bool
*/
private function isOpen( $index ) {
- if ( !is_integer( $index ) ) {
+ if ( !is_int( $index ) ) {
return false;
}
return isset( $this->mServers[$i]['type'] ) ? $this->mServers[$i]['type'] : 'unknown';
}
- /**
- * @deprecated Since 1.30, no alternative
- */
- public function getServerInfo( $i ) {
- wfDeprecated( __METHOD__, '1.30' );
- if ( isset( $this->mServers[$i] ) ) {
- return $this->mServers[$i];
- } else {
- return false;
- }
- }
-
- /**
- * @deprecated Since 1.30, construct new object
- */
- public function setServerInfo( $i, array $serverInfo ) {
- wfDeprecated( __METHOD__, '1.30' );
- $this->mServers[$i] = $serverInfo;
- }
-
public function getMasterPos() {
# If this entire request was served from a replica DB without opening a connection to the
# master (however unlikely that may be), then we can fetch the position from the replica DB.