1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-30 11:22:14 +03:00

BUG#46864 Incorrect update of InnoDB table on slave when using trigger with myisam table

Slave does not correctly handle "expected errors" leading to inconsistencies
between the mater and slave. Specifically, when a statement changes both
transactional and non-transactional tables, the transactional changes are
automatically rolled back on the master but the slave ignores the error and
does not roll them back thus leading to inconsistencies.
      
To fix the problem, we automatically roll back a statement that fails on
the slave but note that the transaction is not rolled back unless a "rollback"
command is in the relay log file.
This commit is contained in:
Alfranio Correia
2009-08-27 13:46:29 +01:00
parent be4b02784a
commit c21fbff338
3 changed files with 46 additions and 55 deletions

View File

@@ -652,8 +652,30 @@ master-bin.000001 # Xid # # COMMIT /* XID */
# There is a bug in the slave that needs to be fixed before enabling
# this part of the test. A bug report will be filed referencing this
# test case.
BEGIN;
INSERT INTO nt_3 VALUES ("new text -28", -28, '');
INSERT INTO tt_3 VALUES ("new text -27", -27, ''), ("new text -28", -28, '');
ERROR 23000: Duplicate entry '-28' for key 'PRIMARY'
INSERT INTO tt_1 VALUES ("new text -27", -27, '');
COMMIT;
BEGIN;
INSERT INTO tt_4 VALUES ("new text -28", -28, '');
INSERT INTO nt_4 VALUES ("new text -27", -27, ''), ("new text -28", -28, '');
ERROR 23000: Duplicate entry '-28' for key 'PRIMARY'
INSERT INTO tt_1 VALUES ("new text -28", -28, '');
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; INSERT INTO nt_3 VALUES ("new text -28", -28, '')
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_3 VALUES ("new text -27", -27, ''), ("new text -28", -28, '')
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -27", -27, '')
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_4 VALUES ("new text -28", -28, '')
master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES ("new text -27", -27, ''), ("new text -28", -28, '')
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -28", -28, '')
master-bin.000001 # Xid # # COMMIT /* XID */
@@ -832,29 +854,6 @@ master-bin.000001 # Query # # use `test`; INSERT INTO tt_4 VALUES ("new text -30
master-bin.000001 # Query # # use `test`; INSERT INTO nt_4 VALUES ("new text -29", -29, ''), ("new text -30", -30, '')
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text -31", -31, '')
master-bin.000001 # Query # # ROLLBACK
#
#14) "B M T R" with error in M generates in the binlog the "B M T R" entries.
#
BEGIN;
INSERT INTO tt_4 VALUES ("new text -32", -32, '');
TRUNCATE TABLE tt_4;
INSERT INTO tt_4 VALUES ("new text -33", -33, '');
ROLLBACK;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_4 VALUES ("new text -32", -32, '')
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_4
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_4 VALUES ("new text -33", -33, '')
master-bin.000001 # Xid # # COMMIT /* XID */
###################################################################################
# CLEAN
###################################################################################