mysqljs / mysql

A pure node.js JavaScript Client implementing the MySQL protocol.
MIT License
18.31k stars 2.53k forks source link

Position failed to change replication mode to gtid mode #2536

Closed xuguotong closed 2 years ago

xuguotong commented 2 years ago

The cluster replication mode was originally a dual master gtid mode. Later, someone may manually set one of the node parameters to master auto Position = 0. I want to change the copy mode to gtid mode. However, when setting the parameter to master auto Position = 1 will report an error. The information is: Last_IO_Errno: 1236 Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: '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.' ............ Executed_Gtid_Set: bfa174cb-ec59-11eb-b50f-083a3842f490:1-94251, e076f2d3-a280-11eb-843a-525400e828c6:1-68031420, e1b12c8b-a280-11eb-9499-525400eb5da6:1-77594846:77780816-163459776

So I found that executed Gtid The gtids in the set are discontinuous. When I skip these discontinuous contents. Set it again and it will succeed. What is the reason for this? My MySQL version is 5.7.25

sidorares commented 2 years ago

can you please set some context as how your problem is related to this driver @xuguotong ?

xuguotong commented 2 years ago

can you please set some context as how your problem is related to this driver @xuguotong ?

What information do you need,I don't quite understand what you mean.

dougwilson commented 2 years ago

It might help if you can include a sample od your Javascript code the demonstrates how you are using this module where you are encountering the problem.

xuguotong commented 2 years ago

2021-12-08_184656root@localhost:(none) 5.7.25-log 06:46:42> stop slave; 2021-12-08_184656Query OK, 0 rows affected (0.01 sec) 2021-12-08_184656 2021-12-08_184708root@localhost:(none) 5.7.25-log 06:46:56> change master to master_auto_position=1; 2021-12-08_184708Query OK, 0 rows affected (0.06 sec) 2021-12-08_184708 2021-12-08_184708root@localhost:(none) 5.7.25-log 06:47:07> 2021-12-08_184712root@localhost:(none) 5.7.25-log 06:47:08> start slave; 2021-12-08_184712Query OK, 0 rows affected (0.00 sec) 2021-12-08_184712 2021-12-08_184716root@localhost:(none) 5.7.25-log 06:47:12> show slave status\G; 2021-12-08_184716 1. row 2021-12-08_184716 Slave_IO_State: 2021-12-08_184716 Master_Host: 10.144.253.81 2021-12-08_184716 Master_User: repl 2021-12-08_184716 Master_Port: 3311 2021-12-08_184716 Connect_Retry: 60 2021-12-08_184716 Master_Log_File: mysql-bin.027989 2021-12-08_184716 Read_Master_Log_Pos: 288249889 2021-12-08_184716 Relay_Log_File: mysql-relay-bin.000001 2021-12-08_184716 Relay_Log_Pos: 4 2021-12-08_184716 Relay_Master_Log_File: mysql-bin.027989 2021-12-08_184716 Slave_IO_Running: No 2021-12-08_184716 Slave_SQL_Running: Yes 2021-12-08_184716 Replicate_Do_DB: 2021-12-08_184716 Replicate_Ignore_DB: 2021-12-08_184716 Replicate_Do_Table: 2021-12-08_184716 Replicate_Ignore_Table: 2021-12-08_184716 Replicate_Wild_Do_Table: 2021-12-08_184716 Replicate_Wild_Ignore_Table: 2021-12-08_184716 Last_Errno: 0 2021-12-08_184716 Last_Error: 2021-12-08_184716 Skip_Counter: 0 2021-12-08_184716 Exec_Master_Log_Pos: 288249889 2021-12-08_184716 Relay_Log_Space: 154 2021-12-08_184716 Until_Condition: None 2021-12-08_184716 Until_Log_File: 2021-12-08_184716 Until_Log_Pos: 0 2021-12-08_184716 Master_SSL_Allowed: No 2021-12-08_184716 Master_SSL_CA_File: 2021-12-08_184716 Master_SSL_CA_Path: 2021-12-08_184716 Master_SSL_Cert: 2021-12-08_184716 Master_SSL_Cipher: 2021-12-08_184716 Master_SSL_Key: 2021-12-08_184716 Seconds_Behind_Master: NULL 2021-12-08_184716Master_SSL_Verify_Server_Cert: No 2021-12-08_184716 Last_IO_Errno: 1236 2021-12-08_184716 Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: '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.' 2021-12-08_184716 Last_SQL_Errno: 0 2021-12-08_184716 Last_SQL_Error: 2021-12-08_184716 Replicate_Ignore_Server_Ids: 2021-12-08_184716 Master_Server_Id: 253813311 2021-12-08_184716 Master_UUID: e1b12c8b-a280-11eb-9499-525400eb5da6 2021-12-08_184716 Master_Info_File: mysql.slave_master_info 2021-12-08_184716 SQL_Delay: 0 2021-12-08_184716 SQL_Remaining_Delay: NULL 2021-12-08_184716 Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates 2021-12-08_184716 Master_Retry_Count: 86400 2021-12-08_184716 Master_Bind: 2021-12-08_184716 Last_IO_Error_Timestamp: 211208 18:47:12 2021-12-08_184716 Last_SQL_Error_Timestamp: 2021-12-08_184716 Master_SSL_Crl: 2021-12-08_184716 Master_SSL_Crlpath: 2021-12-08_184716 Retrieved_Gtid_Set: 2021-12-08_184716 Executed_Gtid_Set: bfa174cb-ec59-11eb-b50f-083a3842f490:1-94251, 2021-12-08_184716e076f2d3-a280-11eb-843a-525400e828c6:1-68031420, 2021-12-08_184716e1b12c8b-a280-11eb-9499-525400eb5da6:1-77594846:77780816-163459776 2021-12-08_184716 Auto_Position: 1 2021-12-08_184716 Replicate_Rewrite_DB: 2021-12-08_184716 Channel_Name: 2021-12-08_184716 Master_TLS_Version: 2021-12-08_1847161 row in set (0.00 sec)

dougwilson commented 2 years ago

Thanks, but that is just issuing commands to your mysql server over the mysql cli. Are you having trouble issuing them through this Javascript module? If so, can you show your Javascript code for how you are trying?

xuguotong commented 2 years ago

I didn't publish using JavaScript module, so I don't have JavaScript related code. My question is why the replication mode can be modified when gtid has no breakpoints,if there is a breakpoint, an error will be reported.Can you help me solve my doubts?

dougwilson commented 2 years ago

Hi, unfortunately we can't; this issue tracker is for the Javascript module for the Node.js platform.

xuguotong commented 2 years ago

My fault,it's embarrassing.