- return $pos;
- }
-
- /**
- * @return int
- * @throws DBQueryError If the variable doesn't exist for some reason
- */
- protected function getServerId() {
- return $this->srvCache->getWithSetCallback(
- $this->srvCache->makeGlobalKey( 'mysql-server-id', $this->getServer() ),
- self::SERVER_ID_CACHE_TTL,
- function () {
- $res = $this->query( "SELECT @@server_id AS id", __METHOD__ );
- return intval( $this->fetchObject( $res )->id );
- }
- );
- }
-
- /**
- * @return string|null
- */
- protected function getServerUUID() {
- return $this->srvCache->getWithSetCallback(
- $this->srvCache->makeGlobalKey( 'mysql-server-uuid', $this->getServer() ),
- self::SERVER_ID_CACHE_TTL,
- function () {
- $res = $this->query( "SHOW GLOBAL VARIABLES LIKE 'server_uuid'" );
- $row = $this->fetchObject( $res );
-
- return $row ? $row->Value : null;
- }
- );
- }
-
- /**
- * @param string $fname
- * @return string[]
- */
- protected function getServerGTIDs( $fname = __METHOD__ ) {
- $map = [];
- // Get global-only variables like gtid_executed
- $res = $this->query( "SHOW GLOBAL VARIABLES LIKE 'gtid_%'", $fname );
- foreach ( $res as $row ) {
- $map[$row->Variable_name] = $row->Value;
- }
- // Get session-specific (e.g. gtid_domain_id since that is were writes will log)
- $res = $this->query( "SHOW SESSION VARIABLES LIKE 'gtid_%'", $fname );
- foreach ( $res as $row ) {
- $map[$row->Variable_name] = $row->Value;
+ $res = $this->query( 'SHOW MASTER STATUS', __METHOD__ );
+ $row = $this->fetchObject( $res );
+ if ( $row && strlen( $row->File ) ) {
+ return new MySQLMasterPos( "{$row->File}/{$row->Position}", $now );