krowinski / php-mysql-replication

Pure PHP Implementation of MySQL replication protocol. This allow you to receive event like insert, update, delete with their data and raw SQL queries.
MIT License
323 stars 98 forks source link

Error while resuming with GTID #64

Open cleancodemonkey opened 4 years ago

cleancodemonkey commented 4 years ago

Steps required to reproduce the problem.

  1. Start replication with an executed gtid set provided using ConfigBuilder::withGtid($gtid_set). You should use an actual gtid set from your mysql master.

Expected Result.

Actual Result.

The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires. Replicate the missing transactions from elsewhere, or provision a new slave from backup. Consider increasing the master's binary log expiration period. The GTID sets and the missing purged transactions are too long to print in this message. For more information, please see the master's error log or the manual for GTID_SUBTRACT.

I've checked master's binlog, it contains required gtid_set.

krowinski commented 4 years ago

hi

can you check

select @@GLOBAL.gtid_executed, @@GLOBAL.gtid_purged

Are you sure that this logs where not purged on master as this message shows ?

I will try to replicate this later but this is first what comes to my mind.

cleancodemonkey commented 4 years ago

The query

select @@GLOBAL.gtid_executed, @@GLOBAL.gtid_purged\G

resulted with:

*************************** 1. row ***************************
@@GLOBAL.gtid_executed: 4af0b40c-6f3c-11e7-ad89-001e673bb989:1-179974,
88fe7c40-5829-11ea-a714-525400d38027:1-3116017
  @@GLOBAL.gtid_purged: 4af0b40c-6f3c-11e7-ad89-001e673bb989:1-179974,
88fe7c40-5829-11ea-a714-525400d38027:1-2808255
1 row in set (0.00 sec)

The gtid set value passed to the library:

4af0b40c-6f3c-11e7-ad89-001e673bb989:1-179974,88fe7c40-5829-11ea-a714-525400d38027:1-3116017
krowinski commented 4 years ago

ok what shows you

show master status

?

column Executed_Gtid_Set

cleancodemonkey commented 4 years ago

The gtid set value passed to the library:

4af0b40c-6f3c-11e7-ad89-001e673bb989:1-179974,88fe7c40-5829-11ea-a714-525400d38027:1-3418495
mysql> select @@GLOBAL.gtid_executed, @@GLOBAL.gtid_purged\G
*************************** 1. row ***************************
@@GLOBAL.gtid_executed: 4af0b40c-6f3c-11e7-ad89-001e673bb989:1-179974,
88fe7c40-5829-11ea-a714-525400d38027:1-3418495
  @@GLOBAL.gtid_purged: 4af0b40c-6f3c-11e7-ad89-001e673bb989:1-179974,
88fe7c40-5829-11ea-a714-525400d38027:1-3093412
1 row in set (0.00 sec)
mysql> show master status;
+------------------+----------+--------------+------------------+-----------------------------------------------------------------------------------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set                                                                             |
+------------------+----------+--------------+------------------+-----------------------------------------------------------------------------------------------+
| mysql-bin.000209 | 17357886 |              |                  | 4af0b40c-6f3c-11e7-ad89-001e673bb989:1-179974,
88fe7c40-5829-11ea-a714-525400d38027:1-3418495 |
+------------------+----------+--------------+------------------+-----------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
luyaotang commented 3 years ago

the issue solved?i have the same problem 。php7.2 mysql 5.6

yaqianghan commented 1 year ago

Does this have any results? I also encountered

yaqianghan commented 1 year ago

@krowinski Does this have any results? I also encountered