function channelsMatch(DBMasterPos $pos) { if (!$pos instanceof self) { throw new InvalidArgumentException("Position not an instance of " . __CLASS__); } // Prefer GTID comparisons, which work with multi-tier replication $thisPosDomains = array_keys($this->getGtidCoordinates()); $thatPosDomains = array_keys($pos->getGtidCoordinates()); if ($thisPosDomains && $thatPosDomains) { // Check that this has GTIDs for all domains in $pos return !array_diff($thatPosDomains, $thisPosDomains); } // Fallback to the binlog file comparisons $thisBinPos = $this->getBinlogCoordinates(); $thatBinPos = $pos->getBinlogCoordinates(); return $thisBinPos && $thatBinPos && $thisBinPos['binlog'] === $thatBinPos['binlog']; }
function hasReached(DBMasterPos $pos) { if (!$pos instanceof self) { throw new InvalidArgumentException("Position not an instance of " . __CLASS__); } $thisPos = $this->getCoordinates(); $thatPos = $pos->getCoordinates(); return $thisPos && $thatPos && $thisPos >= $thatPos; }
function channelsMatch(DBMasterPos $pos) { if (!$pos instanceof self) { throw new InvalidArgumentException("Position not an instance of " . __CLASS__); } $thisBinlog = $this->getBinlogName(); $thatBinlog = $pos->getBinlogName(); return $thisBinlog !== false && $thisBinlog === $thatBinlog; }