BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
Wikimedia\Rdbms\MySQLMasterPos Class Reference
Inheritance diagram for Wikimedia\Rdbms\MySQLMasterPos:
Collaboration diagram for Wikimedia\Rdbms\MySQLMasterPos:

Public Member Functions

 __construct ($position, $asOfTime)
 
 asOfTime ()
 
 hasReached (DBMasterPos $pos)
 
 channelsMatch (DBMasterPos $pos)
 
 getLogName ()
 
 getLogPosition ()
 
 getLogFile ()
 
 getGTIDs ()
 
 setActiveDomain ($id)
 
 setActiveOriginServerId ($id)
 
 setActiveOriginServerUUID ($id)
 
 serialize ()
 
 unserialize ($serialized)
 
 __toString ()
 

Static Public Member Functions

static getCommonDomainGTIDs (MySQLMasterPos $pos, MySQLMasterPos $refPos)
 

Public Attributes

const BINARY_LOG = 'binary-log'
 
const GTID_MARIA = 'gtid-maria'
 
const GTID_MYSQL = 'gtid-mysql'
 
const CORD_INDEX = 0
 
const CORD_EVENT = 1
 

Protected Member Functions

 init ($position, $asOfTime)
 
 getActiveGtidCoordinates ()
 
 getBinlogCoordinates ()
 

Static Protected Member Functions

static parseGTID ($id)
 

Detailed Description

DBMasterPos class for MySQL/MariaDB

Note that master positions and sync logic here make some assumptions:

  • Binlog-based usage assumes single-source replication and non-hierarchical replication.
  • GTID-based usage allows getting/syncing with multi-source replication. It is assumed that GTID sets are complete (e.g. include all domains on the server).
See Also
https://mariadb.com/kb/en/library/gtid/
https://dev.mysql.com/doc/refman/5.6/en/replication-gtids-concepts.html

Constructor & Destructor Documentation

Wikimedia\Rdbms\MySQLMasterPos::__construct (   $position,
  $asOfTime 
)
Parameters
string$positionOne of (comma separated GTID list, <binlog file>="">/<integer>)
float$asOfTimeUNIX timestamp

Member Function Documentation

Wikimedia\Rdbms\MySQLMasterPos::__toString ( )
Returns
string GTID set or <binary log="" file>="">/<position> (e.g db1034-bin.000976/843431247)

Implements Wikimedia\Rdbms\DBMasterPos.

Wikimedia\Rdbms\MySQLMasterPos::asOfTime ( )
Returns
float UNIX timestamp
Since
1.25

Implements Wikimedia\Rdbms\DBMasterPos.

Wikimedia\Rdbms\MySQLMasterPos::channelsMatch ( DBMasterPos  $pos)
Parameters
DBMasterPos$pos
Returns
bool Whether this position appears to be for the same channel as another
Since
1.27

Implements Wikimedia\Rdbms\DBMasterPos.

Wikimedia\Rdbms\MySQLMasterPos::getActiveGtidCoordinates ( )
protected
See Also
https://mariadb.com/kb/en/mariadb/gtid
https://dev.mysql.com/doc/refman/5.6/en/replication-gtids-concepts.html
Returns
array Map of (server_uuid/gtid_domain_id => integer position); possibly empty
Wikimedia\Rdbms\MySQLMasterPos::getBinlogCoordinates ( )
protected
See Also
https://dev.mysql.com/doc/refman/5.7/en/show-master-status.html
https://dev.mysql.com/doc/refman/5.7/en/show-slave-status.html
Returns
array|bool Map of (binlog:<string>, pos:(<integer>, <integer>)) or false
static Wikimedia\Rdbms\MySQLMasterPos::getCommonDomainGTIDs ( MySQLMasterPos  $pos,
MySQLMasterPos  $refPos 
)
static
Parameters
MySQLMasterPos$pos
MySQLMasterPos$refPos
Returns
string[] List of GTIDs from $pos that have domains in $refPos
Since
1.31
Wikimedia\Rdbms\MySQLMasterPos::getGTIDs ( )
Returns
string[] Map of (server_uuid/gtid_domain_id => GTID)
Since
1.31
Wikimedia\Rdbms\MySQLMasterPos::getLogFile ( )
Returns
string|null Name of the binary log file for this position
Since
1.31
Wikimedia\Rdbms\MySQLMasterPos::getLogName ( )
Returns
string|null Base name of binary log files
Since
1.31
Wikimedia\Rdbms\MySQLMasterPos::getLogPosition ( )
Returns
int[]|null Tuple of (binary log file number, event number)
Since
1.31
Wikimedia\Rdbms\MySQLMasterPos::hasReached ( DBMasterPos  $pos)
Parameters
DBMasterPos$pos
Returns
bool Whether this position is at or higher than $pos
Since
1.27

Implements Wikimedia\Rdbms\DBMasterPos.

Wikimedia\Rdbms\MySQLMasterPos::init (   $position,
  $asOfTime 
)
protected
Parameters
string$position
float$asOfTime
static Wikimedia\Rdbms\MySQLMasterPos::parseGTID (   $id)
staticprotected
Parameters
string$idGTID
Returns
array|null [domain ID or server UUID, sequence number, server ID/UUID] or null
Wikimedia\Rdbms\MySQLMasterPos::serialize ( )
Wikimedia\Rdbms\MySQLMasterPos::setActiveDomain (   $id)
Parameters
int | null$id@gtid_domain_id of the active replication stream
Since
1.31
Wikimedia\Rdbms\MySQLMasterPos::setActiveOriginServerId (   $id)
Parameters
int | null$id@server_id of the server were writes originate
Since
1.31
Wikimedia\Rdbms\MySQLMasterPos::setActiveOriginServerUUID (   $id)
Parameters
string | null$id@server_uuid of the server were writes originate
Since
1.31
Wikimedia\Rdbms\MySQLMasterPos::unserialize (   $serialized)

Constructs the object string $serialized The string representation of the object.

Returns
void
Since
5.1.0

Implements Serializable.


The documentation for this class was generated from the following file: