MediaWiki  master
MySQLMasterPos Class Reference

DBMasterPos class for MySQL/MariaDB. More...

Inheritance diagram for MySQLMasterPos:
Collaboration diagram for MySQLMasterPos:

Public Member Functions

 __construct ($file, $pos, $gtid= '')
 
 __toString ()
 
 asOfTime ()
 
 channelsMatch (DBMasterPos $pos)
 
 hasReached (DBMasterPos $pos)
 

Public Attributes

float $asOfTime = 0.0
 UNIX timestamp. More...
 
string $file
 Binlog file. More...
 
string[] $gtids = []
 GTID list. More...
 
int $pos
 Binglog file position. More...
 

Protected Member Functions

 getBinlogCoordinates ()
 
 getGtidCoordinates ()
 

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).

Definition at line 1489 of file DatabaseMysqlBase.php.

Constructor & Destructor Documentation

MySQLMasterPos::__construct (   $file,
  $pos,
  $gtid = '' 
)
Parameters
string$fileBinlog file name
integer$posBinlog position
string$gtidComma separated GTID set [optional]

Definition at line 1504 of file DatabaseMysqlBase.php.

References $file, $pos, asOfTime(), and file.

Member Function Documentation

MySQLMasterPos::__toString ( )
Returns
string <binlog file>="">/<position>, e.g db1034-bin.000976/843431247

Implements DBMasterPos.

Definition at line 1514 of file DatabaseMysqlBase.php.

MySQLMasterPos::asOfTime ( )
Returns
float UNIX timestamp
Since
1.25

Implements DBMasterPos.

Definition at line 1518 of file DatabaseMysqlBase.php.

References $asOfTime.

Referenced by __construct().

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 DBMasterPos.

Definition at line 1552 of file DatabaseMysqlBase.php.

References getBinlogCoordinates(), and getGtidCoordinates().

Referenced by DatabaseMysqlBaseTest\testChannelsMatch(), and DatabaseMysqlBaseTest\testHasReached().

MySQLMasterPos::getBinlogCoordinates ( )
protected
See Also
http://dev.mysql.com/doc/refman/5.7/en/show-master-status.html
http://dev.mysql.com/doc/refman/5.7/en/show-slave-status.html
Returns
array|bool (binlog, (integer file number, integer position)) or false

Definition at line 1603 of file DatabaseMysqlBase.php.

Referenced by channelsMatch(), and hasReached().

MySQLMasterPos::getGtidCoordinates ( )
protected
Note
: this returns false for multi-source replication GTID sets
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 (domain => integer position) or false

Definition at line 1578 of file DatabaseMysqlBase.php.

References as.

Referenced by channelsMatch(), and hasReached().

MySQLMasterPos::hasReached ( DBMasterPos  $pos)
Parameters
DBMasterPos$pos
Returns
bool Whether this position is at or higher than $pos
Since
1.27

Implements DBMasterPos.

Definition at line 1522 of file DatabaseMysqlBase.php.

References as, getBinlogCoordinates(), and getGtidCoordinates().

Referenced by DatabaseMysqlBaseTest\testHasReached().

Member Data Documentation

float MySQLMasterPos::$asOfTime = 0.0

UNIX timestamp.

Definition at line 1497 of file DatabaseMysqlBase.php.

Referenced by asOfTime().

string MySQLMasterPos::$file

Binlog file.

Definition at line 1491 of file DatabaseMysqlBase.php.

Referenced by __construct().

string [] MySQLMasterPos::$gtids = []

GTID list.

Definition at line 1495 of file DatabaseMysqlBase.php.

int MySQLMasterPos::$pos

Binglog file position.

Definition at line 1493 of file DatabaseMysqlBase.php.

Referenced by __construct().


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