From 6302f0c8796d9750e16cf5386dd845961304e692 Mon Sep 17 00:00:00 2001 From: Anton Avramov Date: Thu, 8 Feb 2024 13:01:46 -0500 Subject: [PATCH 1/2] Fix leave the response for the event consumer Mariadb send Fake ROTATE_EVENT immediately after COM_BINLOG_DUMP https://mariadb.com/kb/en/5-slave-registration/#events-transmission-after-com_binlog_dump If we read it here the Event Consumer doesn't process it. --- src/MySQLReplication/BinLog/BinLogSocketConnect.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/MySQLReplication/BinLog/BinLogSocketConnect.php b/src/MySQLReplication/BinLog/BinLogSocketConnect.php index 5524efc..ca8fafe 100644 --- a/src/MySQLReplication/BinLog/BinLogSocketConnect.php +++ b/src/MySQLReplication/BinLog/BinLogSocketConnect.php @@ -300,7 +300,6 @@ private function setBinLogDump(): void $data .= $binFileName; $this->socket->writeToSocket($data); - $this->getResponse(); $binLogCurrent->setBinLogPosition($binFilePos); $binLogCurrent->setBinFileName($binFileName); From 74048dbd73775ea5130323953f7598d0b8ace673 Mon Sep 17 00:00:00 2001 From: Anton Avramov Date: Tue, 20 Feb 2024 18:19:42 -0500 Subject: [PATCH 2/2] #Fix tests to expect the initial Rotate Event --- tests/Integration/BaseTest.php | 2 ++ tests/Integration/BasicTest.php | 1 + 2 files changed, 3 insertions(+) diff --git a/tests/Integration/BaseTest.php b/tests/Integration/BaseTest.php index 9d00dcd..61f5a5b 100644 --- a/tests/Integration/BaseTest.php +++ b/tests/Integration/BaseTest.php @@ -12,6 +12,7 @@ use MySQLReplication\Event\DTO\EventDTO; use MySQLReplication\Event\DTO\FormatDescriptionEventDTO; use MySQLReplication\Event\DTO\QueryDTO; +use MySQLReplication\Event\DTO\RotateDTO; use MySQLReplication\Event\DTO\TableMapDTO; use MySQLReplication\MySQLReplicationFactory; use PHPUnit\Framework\TestCase; @@ -61,6 +62,7 @@ protected function setUp(): void $this->connect(); + self::assertInstanceOf(RotateDTO::class, $this->getEvent()); self::assertInstanceOf(FormatDescriptionEventDTO::class, $this->getEvent()); self::assertInstanceOf(QueryDTO::class, $this->getEvent()); self::assertInstanceOf(QueryDTO::class, $this->getEvent()); diff --git a/tests/Integration/BasicTest.php b/tests/Integration/BasicTest.php index 58edd19..e1dc3b1 100644 --- a/tests/Integration/BasicTest.php +++ b/tests/Integration/BasicTest.php @@ -401,6 +401,7 @@ private function connectWithProvidedEventDispatcher(EventDispatcherInterface $ev $this->connection->executeStatement('USE ' . $this->database); $this->connection->executeStatement('SET SESSION sql_mode = \'\';'); + self::assertInstanceOf(RotateDTO::class, $this->getEvent()); self::assertInstanceOf(FormatDescriptionEventDTO::class, $this->getEvent()); self::assertInstanceOf(QueryDTO::class, $this->getEvent()); self::assertInstanceOf(QueryDTO::class, $this->getEvent());