-
Sujatha Sivakumar authored
NON-EXISTS RECORDS Problem: ======== In RBR replication, master deletes a record but the record don't exist on slave. when slave tries to apply the Delete_row_log_event from master, it will result in an assert on slave. Analysis: ======== This problem exists not only with Delete_rows event but also with Update_rows event as well. Trying to update a non existing row on the slave from the master will cause the same assert. This assert occurs only for the tables that doesn't have primary keys and which basically require sequential scan to be done to locate a record. This bug occurs only with innodb engine not with myisam. When update or delete rows is executed on a slave on a table which doesn't have primary key the updated record is stored in a buffer named table->record[0] and the same is copied to table->record[1] so that during sequential scan table->record[0] can reloaded with fetched data from the table and compared against table->record[1]. In a special case where there is no record on the slave side scan will result in EOF in that case we reinit the scan and we try to compare record[0] with record[1] which are basically the same. This comparison is incorrect. Since they both are the same record_compare() will report that record is found and we try to go ahead and try to update/delete non existing row. Ideally if the scan results in EOF means no data found hence no need to do a record_compare() at all. Fix: === Avoid comparision of records on EOF. sql/log_event.cc: Avoid record comparison on end of file. sql/log_event_old.cc: Avoid record comparison on end of file.
14544cef