0

My transaction logs became corrupted and I had to skip 50 insert records from master. I've exported the data and am planning to update the slaves manually, with the slave stopped. The auto-increment value on the slave stayed in sync with master to my surprise so I think I can just re-populate the missing rows. Are there any potential issues with this plan?

So for example on master I run:

SELECT count(*) FROM `users` WHERE userid between 20 and 69;

and I get back 50. When I run it on slave I get "Empty set". So I did:

SELECT * FROM `users` WHERE userid between 20 and 69;

Then constructed the resulting CSV from PHPMyAdmin into an insert query:

insert ignore into users (userid, name, passwordhash, active)
values
(....,...,...,...)

Prior to insert on the slaves I will run:

stop slave;

and then after

start slave;

I can't think of issues with this may cause but I don't have a testing replication environment so can't test this thoroughly.

1 Answer 1

3

My recommendations would be to invest some time in learning how to use the pt-table-checksum and pt-table-sync tools from the Percona toolkit. This takes much of the work out of your hands in a much more reliable way.

https://www.percona.com/downloads/percona-toolkit/LATEST/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.