Mysql – Merge table from master slave replication

MySQLreplication

I have a dual master-slave replication (server1 is master AND slave of server2).

After a problem with server1, the replication broke. After some skipped logs the replication came back to life.
Then I ran a checksum and there was one table with DIFFs:

+----------------+---+-----+--------+------+-------+--------+-----------+
| TS             |ERR|DIFFS|ROWS    |CHUNKS|SKKIPED|TIME    |TABLE
+----------------+---+-----+--------+------+-------+--------+-----------+
| 09-25T21:09:39 | 0 | 2   |5447202 | 181  |0      | 967.269|db1.myTable      
+----------------+---+-----+--------+------+-------+--------+-----------+

I don't want to do a simple table sync from server2 to 1 because I'm afraid there might be data in server1 that it isn't in server2.

So, is there a way to make a merge between tables in a master-slave replication?

Best Answer

You can use pt-table-sync with --verbose to generate the differential sql and verify the data from there. Whichever version you feel is correct you may choose to keep.

I'm not aware of any tool which will merge, as such what will be the merge condition upon conflicts?

Writing on both nodes in master-master can cause bad bad data! I'd try to avoid that.