Bug #31702 Missing row on slave causes assertion failure under row-based replication
Submitted: 18 Oct 2007 20:13 Modified: 28 Nov 2007 10:13
Reporter: Mats Kindahl Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Row Based Replication ( RBR ) Severity:S1 (Critical)
Version:5.1.22 OS:Any
Assigned to: Mats Kindahl CPU Architecture:Any

[18 Oct 2007 20:13] Mats Kindahl
Description:
When trying to replication an update of a row that is missing on the slave, it will lead to an assertion failure.

How to repeat:
connection master;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
sync_slave_with_master;

connection slave;
UPDATE t1 SET a = 5, b = 47 WHERE a = 1;

connection master;
UPDATE t1 SET a = 5, b = 3 WHERE a = 1;
sync_slave_with_master;

Suggested fix:
When before image is not found on slave, read the after image anyway to get to the next pair of images.
[18 Oct 2007 21:59] Miguel Solorzano
Thank you for the bug report.
[19 Oct 2007 8:50] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/35888

ChangeSet@1.2578, 2007-10-19 10:50:25+02:00, mats@kindahl-laptop.dnsalias.net +5 -0
  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.
[20 Oct 2007 16:20] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/35978

ChangeSet@1.2578, 2007-10-20 18:19:55+02:00, mats@kindahl-laptop.dnsalias.net +5 -0
  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.
[24 Oct 2007 13:43] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/36262

ChangeSet@1.2580, 2007-10-24 15:42:27+02:00, mats@kindahl-laptop.dnsalias.net +1 -0
  BUG#31702 (Missing row on slave causes assertion failure under row-based
  replication):
  
  Incremental patch to enable idempotency support for update events again.
  The final handling of errors will be done in BUG#31609, and until then
  the handling of errors should be consistent between the different types
  of changes.
[24 Oct 2007 13:53] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/36263

ChangeSet@1.2580, 2007-10-24 15:53:40+02:00, mats@kindahl-laptop.dnsalias.net +3 -0
  BUG#31702 (Missing row on slave causes assertion failure under row-based
  replication):
  
  Incremental patch to enable idempotency support for update events again.
  The final handling of errors will be done in BUG#31609, and until then
  the handling of errors should be consistent between the different types
  of changes.
[24 Oct 2007 14:05] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/36264

ChangeSet@1.2580, 2007-10-24 16:02:37+02:00, mats@kindahl-laptop.dnsalias.net +5 -0
  BUG#31702 (Missing row on slave causes assertion failure under row-based
  replication):
  
  Incremental patch to enable idempotency support for update events again.
  The final handling of errors will be done in BUG#31609, and until then
  the handling of errors should be consistent between the different types
  of changes.
[27 Nov 2007 10:51] Bugs System
Pushed into 5.1.23-rc
[27 Nov 2007 10:54] Bugs System
Pushed into 6.0.4-alpha
[28 Nov 2007 10:13] Jon Stephens
Documented bugfix in 5.1.23 and 6.0.4 changelogs.