Mysql 1 way replication master lost data replication still has

MySQLreplication

Had a master mysql on (windows) improper shutdown. Many records could not be recovered and investigation found slave had records master did not have. Did not restore over master – left as was. As if by magic, about 6 weeks later the missing data from master re-appeared on the master, and now master>slave agree, with some lingering discrepancies. We're talking thousands of rows across many schemas and many tables within each schema. Looking for theories and data mining is not revealing much of anything. 1st question is knowing MySQL tries to automatically recover data, could something have happened where mysql cached it, then released it 6 weeks later. Anybody encountered this or any known issues like this?

Best Answer

There is no mechanism in MySQL for a master to recapture "lost" (missing, corrupt) data from a slave. Unless replication is circular (or master/master, where each machine is both master of, and slave to, the other... don't try this at home) then the interaction between master and slave is strictly one-way. Even in a circular configuration, there's no "recovery" or resynchronization mechanism.

There is also no mechanism for data to be hidden away and reappear. The comment referencing InnoDB recovering data from log files seems to overlook the fact that this sort of recovery occurs at start-up, and until it is complete, the server doesn't start accepting connections.

The answer should be discoverable in the master's binary logs (you archive those, right?) and the daily backups from master and slave (you archive those, too, right?).

Absent frequent periodic backups and historical binlogs, it seems difficult to speculate further.