MediaWiki REL1_28
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.
 
string $file
 Binlog file.
 
string[] $gtids = []
 GTID list.
 
int $pos
 Binglog file position.
 

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 10 of file MySQLMasterPos.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 25 of file MySQLMasterPos.php.

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

Member Function Documentation

◆ __toString()

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

Implements DBMasterPos.

Definition at line 35 of file MySQLMasterPos.php.

◆ asOfTime()

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

Implements DBMasterPos.

Definition at line 39 of file MySQLMasterPos.php.

References $asOfTime.

Referenced by __construct().

◆ channelsMatch()

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 73 of file MySQLMasterPos.php.

References $pos, getBinlogCoordinates(), and getGtidCoordinates().

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

◆ getBinlogCoordinates()

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 124 of file MySQLMasterPos.php.

Referenced by channelsMatch(), and hasReached().

◆ getGtidCoordinates()

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 99 of file MySQLMasterPos.php.

References as.

Referenced by channelsMatch(), and hasReached().

◆ 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 43 of file MySQLMasterPos.php.

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

Referenced by DatabaseMysqlBaseTest\testHasReached().

Member Data Documentation

◆ $asOfTime

float MySQLMasterPos::$asOfTime = 0.0

UNIX timestamp.

Definition at line 18 of file MySQLMasterPos.php.

Referenced by asOfTime().

◆ $file

string MySQLMasterPos::$file

Binlog file.

Definition at line 12 of file MySQLMasterPos.php.

Referenced by __construct().

◆ $gtids

string [] MySQLMasterPos::$gtids = []

GTID list.

Definition at line 16 of file MySQLMasterPos.php.

◆ $pos

int MySQLMasterPos::$pos

Binglog file position.

Definition at line 14 of file MySQLMasterPos.php.

Referenced by __construct(), channelsMatch(), and hasReached().


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