| Bug #40221 | Replication failure on RBR + UPDATE the primary key | ||
|---|---|---|---|
| Submitted: | 21 Oct 2008 22:47 | Modified: | 20 Jan 22:33 |
| Reporter: | Philip Stoev | ||
| Status: | Closed | ||
| Category: | Server: RBR | Severity: | S2 (Serious) |
| Version: | 5.1-bzr, 5.1-rpl, 6.0-bzr | OS: | Any |
| Assigned to: | Andrei Elkin | Target Version: | 5.1.31 |
| Triage: | Triaged: D2 (Serious) | ||
[21 Oct 2008 22:47]
Philip Stoev
[22 Oct 2008 0:01]
Sveta Smirnova
Thank you for the report. Verified as described.
[3 Nov 2008 19:53]
Omer BarNir
triage: This is a very common and simple scenario that people are likely to hit soon after starting to use RBR/MBR replication. Not likely to be a regression from 5.1.29 but given the common use case recommending to be fixed by 5,1 GA (same logic as with bug*40360 that wasn't a 5.1.29 regression either). Setting tag to SR51GA
[20 Nov 2008 9:45]
Andrei Elkin
The distilled test for the bug has merely 6 executive instuctions: CREATE TABLE `t1` (pk int auto_increment primary key) ENGINE=innodb; START TRANSACTION; /* empty */ INSERT INTO `t1` ( `pk` ) VALUES ( 1 ); INSERT INTO `t1` ( `pk` ) VALUES ( 2 ); UPDATE `t1` SET `pk` = 3 WHERE `pk` < 3; commit; In the end, the slave and the master are inconsistent: connection master; select * from t1; pk 1 2 connection slave; select * from t1; pk 2 3
[20 Nov 2008 9:48]
Andrei Elkin
Trudy, Omer, fyi. The case is not a regression of 5.1.29 as far as I have verified. Still, it's inconsistency issue which can be gained as simple as to run the 6 lines I provided in comments earlier. br, Andrei
[20 Nov 2008 17:14]
Andrei Elkin
Analysis showed that on the place of UPDATE there can be INSERT or other type of query that modifies more that one prim key value and ends up with the dup key error.
[21 Nov 2008 2:24]
Omer BarNir
triage: discussion following new information, however most believe there is not enough here to ask for a re-excalation (after was already rejected and given the state of 5.1.30 - keeping values/target/tag as is
[21 Nov 2008 13:42]
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/59514 2701 Andrei Elkin 2008-11-21 Bug #40221 Replication failure on RBR + UPDATE the primary key A transaction could result in having an extra event after a query that errored e.g because of a dup key. Such a query is rolled back in innodb, as specified, but has not been in binlog. It appeares that the binlog engine did not always register for a query (statement) because the previous query had not reset at its statement commit time. Because of that fact there was no roll-back to the trx_data->before_stmt_pos position and a the pending event of the errorred query could become flushed to the binlog file. Fixed with deploying the reset of trx_data->before_stmt_pos at the end of the query processing.
[26 Nov 2008 16:18]
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/59952 2712 Andrei Elkin 2008-11-26 Bug #40221 Replication failure on RBR + UPDATE the primary key A transaction could result in having an extra event after a query that errored e.g because of a dup key. Such a query is rolled back in innodb, as specified, but has not been in binlog. It appeares that the binlog engine did not always register for a query (statement) because the previous query had not reset at its statement commit time. Because of that fact there was no roll-back to the trx_data->before_stmt_pos position and a the pending event of the errorred query could become flushed to the binlog file. Fixed with deploying the reset of trx_data->before_stmt_pos at the end of the query processing.
[28 Nov 2008 17:56]
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/60205 2712 Andrei Elkin 2008-11-28 Bug #40221 Replication failure on RBR + UPDATE the primary key A transaction could result in having an extra event after a query that errored e.g because of a dup key. Such a query is rolled back in innodb, as specified, but has not been in binlog. It appeares that the binlog engine did not always register for a query (statement) because the previous query had not reset at its statement commit time. Because of that fact there was no roll-back to the trx_data->before_stmt_pos position and a the pending event of the errorred query could become flushed to the binlog file. Fixed with deploying the reset of trx_data->before_stmt_pos at the end of the query processing.
[2 Dec 2008 18:32]
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/60414 2727 Andrei Elkin 2008-12-02 Bug #40221 Replication failure on RBR + UPDATE the primary key A transaction could result in having an extra event after a query that errored e.g because of a dup key. Such a query is rolled back in innodb, as specified, but has not been in binlog. It appeares that the binlog engine did not always register for a query (statement) because the previous query had not reset at its statement commit time. Because of that fact there was no roll-back to the trx_data->before_stmt_pos position and a the pending event of the errorred query could become flushed to the binlog file. Fixed with deploying the reset of trx_data->before_stmt_pos at the end of the query processing.
[8 Dec 2008 16:07]
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/60955 2728 Andrei Elkin 2008-12-08 Bug #40221 Replication failure on RBR + UPDATE the primary key Extending bug#40221 regression test: 1. include INSERT 2. convert prim key + autoinc to unique.
[9 Dec 2008 18:48]
Andrei Elkin
pushed to bugteam trees, starting from 5.1.
[15 Jan 7:34]
Bugs System
Pushed into 5.1.31 (revid:joro@sun.com-20090115053147-tx1oapthnzgvs1ro) (version source revid:azundris@mysql.com-20081230114838-cn52tu180wcrvh0h) (merge vers: 5.1.31) (pib:6)
[16 Jan 14:42]
Jon Stephens
Documented in the 5.1.31 changelog as follows:
When using row-based replication, an update of a primary key that was
rolled back on the master due to a duplicate key error was not rolled
back on the slave.
Set status to NDI pending merge to 6.0 tree.
[19 Jan 12:21]
Bugs System
Pushed into 5.1.31-ndb-6.2.17 (revid:tomas.ulin@sun.com-20090119095303-uwwvxiibtr38djii) (version source revid:tomas.ulin@sun.com-20090115073240-1wanl85vlvw2she1) (merge vers: 5.1.31-ndb-6.2.17) (pib:6)
[19 Jan 13:59]
Bugs System
Pushed into 5.1.31-ndb-6.3.21 (revid:tomas.ulin@sun.com-20090119104956-guxz190n2kh31fxl) (version source revid:tomas.ulin@sun.com-20090119104956-guxz190n2kh31fxl) (merge vers: 5.1.31-ndb-6.3.21) (pib:6)
[19 Jan 14:59]
Jon Stephens
Set status back to NDI pending merge to 6.0 tree.
[19 Jan 17:04]
Bugs System
Pushed into 5.1.31-ndb-6.4.1 (revid:tomas.ulin@sun.com-20090119144033-4aylstx5czzz88i5) (version source revid:tomas.ulin@sun.com-20090119144033-4aylstx5czzz88i5) (merge vers: 5.1.31-ndb-6.4.1) (pib:6)
[19 Jan 18:05]
Jon Stephens
Set back to NDI pending merge to 6.0.
[20 Jan 19:52]
Bugs System
Pushed into 6.0.10-alpha (revid:joro@sun.com-20090119171328-2hemf2ndc1dxl0et) (version source revid:azundris@mysql.com-20081230114916-c290n83z25wkt6e4) (merge vers: 6.0.9-alpha) (pib:6)
[20 Jan 22:33]
Jon Stephens
Fix also documented in 6.0.10 changelog; closed.
