MediaWiki master
|
Inherited by Wikimedia\Rdbms\Replication\MysqlReplicationReporter.
Public Member Functions | |
__construct ( $topologyRole, $logger, $srvCache) | |
getLag (IDatabase $conn) | |
getPrimaryPos (IDatabase $conn) | |
getReplicaPos (IDatabase $conn) | |
getSessionLagStatus (IDatabase $conn) | |
getTopologyBasedReadOnlyReason () | |
getTopologyRole () | |
primaryPosWait (IDatabase $conn, DBPrimaryPos $pos, $timeout) | |
resetReplicationLagStatus (IDatabase $conn) | |
Protected Member Functions | |
doGetLag (IDatabase $conn) | |
Get the amount of replication lag for this database server. | |
getApproximateLagStatus (IDatabase $conn) | |
Get a replica DB lag estimate for this server at the start of a transaction. | |
getLogContext (IDatabase $conn, array $extras=[]) | |
Create a log context to pass to PSR-3 logger functions. | |
getRecordedTransactionLagStatus (IDatabase $conn) | |
Get the replica DB lag when the current transaction started. | |
Protected Attributes | |
LoggerInterface | $logger |
BagOStuff | $srvCache |
string | $topologyRole |
Replication topology role of the server; one of the class ROLE_* constants. | |
Wikimedia\Rdbms\Replication\ReplicationReporter::__construct | ( | $topologyRole, | |
$logger, | |||
$srvCache ) |
Definition at line 43 of file ReplicationReporter.php.
References Wikimedia\Rdbms\Replication\ReplicationReporter\$logger, Wikimedia\Rdbms\Replication\ReplicationReporter\$srvCache, and Wikimedia\Rdbms\Replication\ReplicationReporter\$topologyRole.
|
protected |
Get the amount of replication lag for this database server.
Callers should avoid using this method while a transaction is active
IDatabase | $conn | To make queries |
DBError |
Reimplemented in Wikimedia\Rdbms\Replication\MysqlReplicationReporter.
Definition at line 74 of file ReplicationReporter.php.
Referenced by Wikimedia\Rdbms\Replication\ReplicationReporter\getLag().
|
protected |
Get a replica DB lag estimate for this server at the start of a transaction.
This is a no-op unless the server is known a priori to be a replica DB
IDatabase | $conn | To make queries |
Reimplemented in Wikimedia\Rdbms\Replication\MysqlReplicationReporter.
Definition at line 87 of file ReplicationReporter.php.
References Wikimedia\Rdbms\Replication\ReplicationReporter\getLag(), and Wikimedia\Rdbms\IDatabase\ROLE_STREAMING_REPLICA.
Referenced by Wikimedia\Rdbms\Replication\ReplicationReporter\getSessionLagStatus(), and Wikimedia\Rdbms\Replication\ReplicationReporter\resetReplicationLagStatus().
Wikimedia\Rdbms\Replication\ReplicationReporter::getLag | ( | IDatabase | $conn | ) |
Definition at line 53 of file ReplicationReporter.php.
References Wikimedia\Rdbms\Replication\ReplicationReporter\doGetLag(), Wikimedia\Rdbms\IDatabase\ROLE_STATIC_CLONE, and Wikimedia\Rdbms\IDatabase\ROLE_STREAMING_MASTER.
Referenced by Wikimedia\Rdbms\Replication\ReplicationReporter\getApproximateLagStatus().
|
protected |
Create a log context to pass to PSR-3 logger functions.
IDatabase | $conn | To make queries |
array | $extras | Additional data to add to context |
Definition at line 169 of file ReplicationReporter.php.
References Wikimedia\Rdbms\IReadableDatabase\getDBname(), and Wikimedia\Rdbms\IReadableDatabase\getServerName().
Referenced by Wikimedia\Rdbms\Replication\MysqlReplicationReporter\getLagFromPtHeartbeat(), and Wikimedia\Rdbms\Replication\MysqlReplicationReporter\primaryPosWait().
Wikimedia\Rdbms\Replication\ReplicationReporter::getPrimaryPos | ( | IDatabase | $conn | ) |
Reimplemented in Wikimedia\Rdbms\Replication\MysqlReplicationReporter.
Definition at line 112 of file ReplicationReporter.php.
|
finalprotected |
Get the replica DB lag when the current transaction started.
This is useful given that transactions might use point-in-time read snapshots, in which case the lag estimate should be recorded just before the transaction establishes the read snapshot (either BEGIN or the first SELECT/write query).
If snapshots are not used, it is still safe to be pessimistic.
This returns null if there is no transaction or the lag status was not yet recorded.
IDatabase | $conn | To make queries |
Definition at line 154 of file ReplicationReporter.php.
References Wikimedia\Rdbms\IDatabase\trxLevel().
Referenced by Wikimedia\Rdbms\Replication\MysqlReplicationReporter\getLagFromPtHeartbeat(), and Wikimedia\Rdbms\Replication\ReplicationReporter\getSessionLagStatus().
Wikimedia\Rdbms\Replication\ReplicationReporter::getReplicaPos | ( | IDatabase | $conn | ) |
Reimplemented in Wikimedia\Rdbms\Replication\MysqlReplicationReporter.
Definition at line 107 of file ReplicationReporter.php.
Wikimedia\Rdbms\Replication\ReplicationReporter::getSessionLagStatus | ( | IDatabase | $conn | ) |
Definition at line 158 of file ReplicationReporter.php.
References Wikimedia\Rdbms\Replication\ReplicationReporter\getApproximateLagStatus(), and Wikimedia\Rdbms\Replication\ReplicationReporter\getRecordedTransactionLagStatus().
Wikimedia\Rdbms\Replication\ReplicationReporter::getTopologyBasedReadOnlyReason | ( | ) |
Definition at line 120 of file ReplicationReporter.php.
References Wikimedia\Rdbms\IDatabase\ROLE_STATIC_CLONE, and Wikimedia\Rdbms\IDatabase\ROLE_STREAMING_REPLICA.
Wikimedia\Rdbms\Replication\ReplicationReporter::getTopologyRole | ( | ) |
Definition at line 49 of file ReplicationReporter.php.
References Wikimedia\Rdbms\Replication\ReplicationReporter\$topologyRole.
Wikimedia\Rdbms\Replication\ReplicationReporter::primaryPosWait | ( | IDatabase | $conn, |
DBPrimaryPos | $pos, | ||
$timeout ) |
Reimplemented in Wikimedia\Rdbms\Replication\MysqlReplicationReporter.
Definition at line 102 of file ReplicationReporter.php.
Wikimedia\Rdbms\Replication\ReplicationReporter::resetReplicationLagStatus | ( | IDatabase | $conn | ) |
Definition at line 130 of file ReplicationReporter.php.
References Wikimedia\Rdbms\Replication\ReplicationReporter\getApproximateLagStatus().
|
protected |
Definition at line 37 of file ReplicationReporter.php.
Referenced by Wikimedia\Rdbms\Replication\ReplicationReporter\__construct(), and Wikimedia\Rdbms\Replication\MysqlReplicationReporter\__construct().
|
protected |
Definition at line 39 of file ReplicationReporter.php.
Referenced by Wikimedia\Rdbms\Replication\ReplicationReporter\__construct(), and Wikimedia\Rdbms\Replication\MysqlReplicationReporter\__construct().
|
protected |
Replication topology role of the server; one of the class ROLE_* constants.
Definition at line 35 of file ReplicationReporter.php.
Referenced by Wikimedia\Rdbms\Replication\ReplicationReporter\__construct(), Wikimedia\Rdbms\Replication\MysqlReplicationReporter\__construct(), and Wikimedia\Rdbms\Replication\ReplicationReporter\getTopologyRole().