Today I faced with a problem that could arise when dealing with
replication.
I had on the master host a table with 534,587 rows and the
replicated one on one of the slave hosts with 534,603 rows (16
rows more).
This happened because of some old script that made INSERTs
connecting directly to that slave. Unfortunately the replication
didn't stop because new INSERTs made by the master host never
duplicated entries. I discovered this situation just few days
ago.
I wanted to find out how this happened.
I was faced to the problem to determine the IDs of the sixteen
phantom-rows on the slave table.
Instead of writing a Perl script (as I would have done a year
ago) to read all IDs from master and then find mismatching IDs
reading the same values from the slave, I created a Federated
table on a non-replicating database
(binlog-ignore-db=test
in the my.cnf
file):
CREATE …