12

I have added an extra Slave server to an existing MySQL Replication. The Master server and the old Slave server are working fine without any issue, but the newly added server is stoping with the following error:

Last_SQL_Errno: 1032
Last_SQL_Error: Could not execute Update_rows event on table xxx.email_events; Can't find record in 'email_events', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysqld-bin.000410, end_log_pos 368808733

It will be fine for some hours after repairing.

Questions

  • Can we permanently skip Last_SQL_Errno: 1032?
  • Is there any issue with skipping this error?
adminz
  • 397
  • 2
  • 4
  • 19

3 Answers3

9

You can locate the sql clause code like /usr/bin/mysqlbinlog -v --start-position=142743807 --stop-position=147399325 /data/mysql/data/master-bin.000010 > temp.log

Then compare slave and master database difference according to temp.log on specific pos. Then update slave database.

Then skip that line with mysql -e "stop slave; SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; start slave;";

LF00
  • 333
  • 3
  • 10
2

You can set the following in your slave's my.cnf: [mysqld] slave-skip-errors=1032

But as the documentation says: Do not use this option unless you fully understand why you are getting errors. One of the possible reason for this error could be due to “Slave_IO_Running: Yes” but “Slave_SQL_Running: No” that means your Slave IO process is running and retrieving data from Master but couldn’t execute due to Slave_SQL_Running process is stopped. A monitoring tool like Monyog can be used to proactively monitor the replication and alert you to the error or a lag or disconnection between the Master and Slave servers.

user428494
  • 29
  • 1
  • For some reason this doesn't seem to work for me in spite of adding that to the slave. Which version of MySQL are you using? The problem I have on my system is that doing this solves the immediate problem: `mysql -e "stop slave; SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; start slave;";` However, the new errors always appear. – Eugene van der Merwe Feb 15 '20 at 12:01
  • This answer doesn't make sense to me. _"that means your Slave IO process is running and retrieving data from Master but couldn’t execute due to Slave_SQL_Running process is stopped"_ in particular because the Slave IO thread doesn't _execute_ anything on the slave. That is the job of the SQL thread. The IO thread just retrieves events from the master (as I understand). – Dusty Vargas Mar 10 '20 at 21:00
2

For people who have this as a one off error, you can try skipping the item:

SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;

START SLAVE;

Steve
  • 21
  • 2