Bug#31702 (Missing row on slave causes assertion failure under row-based replication):
When replicating an update pair (before image, after image) under row-based replication, and the before image is not found on the slave, the after image was not discared, and was hence read as a before image for the next row. Eventually, this lead to an after image being read outside the block of rows in the event, causing an assertion to fire. This patch fixes this by reading the after image in the event that the row was not found on the slave, adds some extra debug assertion to catch future errors earlier, and also adds a few non-debug checks to prevent reading outside the block of the event. include/my_base.h: Adding error code HA_ERR_CORRUPT_EVENT. mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result: Result change. mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test: Adding test to try to use row-based replication to replicate an update of a row that doesn't exist on the slave. We should get an apropriate error and the slave should stop. sql/log_event.cc: Adding debug printouts. Adding code to Update_rows_log_event::do_exec_row() so that the after image is read (and ignored) in the event of an error in finding the row. This is necessary so that the second pair of images is read correctly for the next update pair. Changing logic for ignoring errors to not include update events, since a "key not found" error or a "record changed" error is not idempotent for updates, just for deletes and inserts. sql/log_event.h: Adding debug assertions to check that row reading is within the events block of rows.
Showing
Please register or sign in to comment