mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
mysql-5.1-bugteam (local) --> mysql-5.1-bugteam
This commit is contained in:
300
mysql-test/extra/binlog_tests/binlog_failure_mixing_engines.test
Normal file
300
mysql-test/extra/binlog_tests/binlog_failure_mixing_engines.test
Normal file
@ -0,0 +1,300 @@
|
|||||||
|
################################################################################
|
||||||
|
# Let
|
||||||
|
# - B be begin, C commit and R rollback.
|
||||||
|
# - T a statement that accesses and changes only transactional tables, i.e.
|
||||||
|
# T-tables
|
||||||
|
# - N a statement that accesses and changes only non-transactional tables,
|
||||||
|
# i.e, N-tables.
|
||||||
|
# - M be a mixed statement, i.e. a statement that updates both T- and
|
||||||
|
# N-tables.
|
||||||
|
# - M* be a mixed statement that fails while updating either a T
|
||||||
|
# or N-table.
|
||||||
|
# - N* be a statement that fails while updating a N-table.
|
||||||
|
#
|
||||||
|
# In this test case, when changes are logged as rows either in the RBR or MIXED
|
||||||
|
# modes, we check if a M* statement that happens early in a transaction is
|
||||||
|
# written to the binary log outside the boundaries of the transaction and
|
||||||
|
# wrapped up in a BEGIN/ROLLBACK. This is done to keep the slave consistent with
|
||||||
|
# the master as the rollback will keep the changes on N-tables and undo them on
|
||||||
|
# T-tables. In particular, we expect the following behavior:
|
||||||
|
#
|
||||||
|
# 1. B M* T C would generate in the binlog B M* R B T C.
|
||||||
|
# 2. B M M* C would generate in the binlog B M M* C.
|
||||||
|
# 3. B M* M* T C would generate in the binlog B M* R B M* R B T C.
|
||||||
|
#
|
||||||
|
# SBR is not considered in this test because a failing statement is written to
|
||||||
|
# the binary along with the error code such that a slave executes and rolls it
|
||||||
|
# back, thus undoing the effects on T-tables.
|
||||||
|
#
|
||||||
|
# Note that, in the first case, we are not preserving history from the master as
|
||||||
|
# we are introducing a rollback that never happened. However, this seems to be
|
||||||
|
# more acceptable than making the slave diverge. In the second case, the slave
|
||||||
|
# will diverge as the changes on T-tables that originated from the M statement
|
||||||
|
# are rolled back on the master but not on the slave. Unfortunately, we cannot
|
||||||
|
# simply roll the transaction back as this would undo any uncommitted changes
|
||||||
|
# on T-tables.
|
||||||
|
#
|
||||||
|
# We check two more cases. First, INSERT...SELECT* which produces the following
|
||||||
|
# results:
|
||||||
|
#
|
||||||
|
# 1. B T INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates in
|
||||||
|
# the binlog the following entries: "Nothing".
|
||||||
|
# 2. B INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates in
|
||||||
|
# the binlog the following entries: B INSERT M...SELECT* R.
|
||||||
|
#
|
||||||
|
# Finally, we also check if any N statement that happens early in a transaction
|
||||||
|
# (i.e. before any T or M statement) is written to the binary log outside the
|
||||||
|
# boundaries of the transaction. In particular, we expect the following
|
||||||
|
# behavior:
|
||||||
|
#
|
||||||
|
# 1. B N N T C would generate in the binlog B N C B N C B T C.
|
||||||
|
# 2. B N N T R would generate in the binlog B N C B N C B T R.
|
||||||
|
# 3. B N* N* T C would generate in the binlog B N R B N R B T C.
|
||||||
|
# 4. B N* N* T R would generate in the binlog B N R B N R B T R.
|
||||||
|
# 5. B N N T N T C would generate in the binlog B N C B N C B T N T C.
|
||||||
|
# 6. B N N T N T R would generate in the binlog the B N C B N C B T N T R.
|
||||||
|
#
|
||||||
|
# Such issues do not happen in SBR. In RBR and MBR, a full-fledged fix will be
|
||||||
|
# pushed after the WL#2687.
|
||||||
|
#
|
||||||
|
# Please, remove this test case after pushing WL#2687.
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
--echo ###################################################################################
|
||||||
|
--echo # CONFIGURATION
|
||||||
|
--echo ###################################################################################
|
||||||
|
CREATE TABLE nt_1 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
|
||||||
|
CREATE TABLE nt_2 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
|
||||||
|
CREATE TABLE tt_1 (a text, b int PRIMARY KEY) ENGINE = Innodb;
|
||||||
|
CREATE TABLE tt_2 (a text, b int PRIMARY KEY) ENGINE = Innodb;
|
||||||
|
|
||||||
|
DELIMITER |;
|
||||||
|
|
||||||
|
CREATE TRIGGER tr_i_tt_1_to_nt_1 BEFORE INSERT ON tt_1 FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO nt_1 VALUES (NEW.a, NEW.b);
|
||||||
|
END|
|
||||||
|
|
||||||
|
CREATE TRIGGER tr_i_nt_2_to_tt_2 BEFORE INSERT ON nt_2 FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO tt_2 VALUES (NEW.a, NEW.b);
|
||||||
|
END|
|
||||||
|
|
||||||
|
DELIMITER ;|
|
||||||
|
|
||||||
|
--echo ###################################################################################
|
||||||
|
--echo # CHECK HISTORY IN BINLOG
|
||||||
|
--echo ###################################################################################
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo *** "B M* T C" with error in M* generates in the binlog the "B M* R B T C" entries
|
||||||
|
--echo
|
||||||
|
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||||
|
INSERT INTO nt_1 VALUES ("new text 1", 1);
|
||||||
|
BEGIN;
|
||||||
|
--error ER_DUP_ENTRY
|
||||||
|
INSERT INTO tt_1 VALUES (USER(), 2), (USER(), 1);
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 3", 3);
|
||||||
|
COMMIT;
|
||||||
|
--source include/show_binlog_events.inc
|
||||||
|
|
||||||
|
--echo
|
||||||
|
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 4", 4);
|
||||||
|
BEGIN;
|
||||||
|
--error ER_DUP_ENTRY
|
||||||
|
INSERT INTO nt_2 VALUES (USER(), 5), (USER(), 4);
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 6", 6);
|
||||||
|
COMMIT;
|
||||||
|
--source include/show_binlog_events.inc
|
||||||
|
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo *** "B M M* T C" with error in M* generates in the binlog the "B M M* T C" entries
|
||||||
|
--echo
|
||||||
|
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||||
|
INSERT INTO nt_1 VALUES ("new text 10", 10);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO tt_1 VALUES ("new text 7", 7), ("new text 8", 8);
|
||||||
|
--error ER_DUP_ENTRY
|
||||||
|
INSERT INTO tt_1 VALUES (USER(), 9), (USER(), 10);
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 11", 11);
|
||||||
|
COMMIT;
|
||||||
|
--source include/show_binlog_events.inc
|
||||||
|
|
||||||
|
--echo
|
||||||
|
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 15", 15);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_2 VALUES ("new text 12", 12), ("new text 13", 13);
|
||||||
|
--error ER_DUP_ENTRY
|
||||||
|
INSERT INTO nt_2 VALUES (USER(), 14), (USER(), 15);
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 16", 16);
|
||||||
|
COMMIT;
|
||||||
|
--source include/show_binlog_events.inc
|
||||||
|
|
||||||
|
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo *** "B M* M* T C" with error in M* generates in the binlog the "B M* R B M* R B T C" entries
|
||||||
|
--echo
|
||||||
|
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||||
|
INSERT INTO nt_1 VALUES ("new text 18", 18);
|
||||||
|
INSERT INTO nt_1 VALUES ("new text 20", 20);
|
||||||
|
BEGIN;
|
||||||
|
--error ER_DUP_ENTRY
|
||||||
|
INSERT INTO tt_1 VALUES (USER(), 17), (USER(), 18);
|
||||||
|
--error ER_DUP_ENTRY
|
||||||
|
INSERT INTO tt_1 VALUES (USER(), 19), (USER(), 20);
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 21", 21);
|
||||||
|
COMMIT;
|
||||||
|
--source include/show_binlog_events.inc
|
||||||
|
|
||||||
|
--echo
|
||||||
|
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 23", 23);
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 25", 25);
|
||||||
|
BEGIN;
|
||||||
|
--error ER_DUP_ENTRY
|
||||||
|
INSERT INTO nt_2 VALUES (USER(), 22), (USER(), 23);
|
||||||
|
--error ER_DUP_ENTRY
|
||||||
|
INSERT INTO nt_2 VALUES (USER(), 24), (USER(), 25);
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 26", 26);
|
||||||
|
COMMIT;
|
||||||
|
--source include/show_binlog_events.inc
|
||||||
|
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo *** "B T INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates
|
||||||
|
--echo *** in the binlog the following entries: "Nothing".
|
||||||
|
--echo *** There is a bug in that will be fixed after WL#2687. Please, check BUG#47175 for further details.
|
||||||
|
--echo
|
||||||
|
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||||
|
TRUNCATE TABLE nt_2;
|
||||||
|
TRUNCATE TABLE tt_2;
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 7", 7);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 27", 27);
|
||||||
|
--error ER_DUP_ENTRY
|
||||||
|
INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 28", 28);
|
||||||
|
ROLLBACK;
|
||||||
|
--source include/show_binlog_events.inc
|
||||||
|
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo *** "B INSERT M..SELECT* C" with an error in INSERT M...SELECT* generates
|
||||||
|
--echo *** in the binlog the following entries: "B INSERT M..SELECT* R".
|
||||||
|
--echo
|
||||||
|
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||||
|
TRUNCATE TABLE nt_2;
|
||||||
|
TRUNCATE TABLE tt_2;
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 7", 7);
|
||||||
|
BEGIN;
|
||||||
|
--error ER_DUP_ENTRY
|
||||||
|
INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
|
||||||
|
COMMIT;
|
||||||
|
--source include/show_binlog_events.inc
|
||||||
|
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo *** "B N N T C" generates in the binlog the "B N C B N C B T C" entries
|
||||||
|
--echo
|
||||||
|
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||||
|
TRUNCATE TABLE nt_1;
|
||||||
|
TRUNCATE TABLE tt_2;
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 1);
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 2);
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 3);
|
||||||
|
COMMIT;
|
||||||
|
--source include/show_binlog_events.inc
|
||||||
|
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo *** "B N N T R" generates in the binlog the "B N C B N C B T R" entries
|
||||||
|
--echo
|
||||||
|
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 4);
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 5);
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 6);
|
||||||
|
ROLLBACK;
|
||||||
|
--source include/show_binlog_events.inc
|
||||||
|
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo *** "B N* N* T C" with error in N* generates in the binlog the "B N R B N R B T C" entries
|
||||||
|
--echo
|
||||||
|
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||||
|
BEGIN;
|
||||||
|
--error ER_DUP_ENTRY
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 7), (USER(), 1);
|
||||||
|
--error ER_DUP_ENTRY
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 8), (USER(), 1);
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 9);
|
||||||
|
COMMIT;
|
||||||
|
--source include/show_binlog_events.inc
|
||||||
|
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo *** "B N* N* T R" with error in N* generates in the binlog the "B N R B N R B T R" entries
|
||||||
|
--echo
|
||||||
|
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||||
|
BEGIN;
|
||||||
|
--error ER_DUP_ENTRY
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 10), (USER(), 1);
|
||||||
|
--error ER_DUP_ENTRY
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 11), (USER(), 1);
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 12);
|
||||||
|
ROLLBACK;
|
||||||
|
--source include/show_binlog_events.inc
|
||||||
|
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo *** "B N N T N T C" generates in the binlog the "B N C B N C B T N T C" entries
|
||||||
|
--echo
|
||||||
|
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 13);
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 14);
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 15);
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 16);
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 17);
|
||||||
|
COMMIT;
|
||||||
|
--source include/show_binlog_events.inc
|
||||||
|
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo *** "B N N T N T R" generates in the binlog the "B N C B N C B T N T R" entries
|
||||||
|
--echo
|
||||||
|
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 18);
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 19);
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 20);
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 21);
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 22);
|
||||||
|
ROLLBACK;
|
||||||
|
--source include/show_binlog_events.inc
|
||||||
|
|
||||||
|
--echo ###################################################################################
|
||||||
|
--echo # CLEAN
|
||||||
|
--echo ###################################################################################
|
||||||
|
|
||||||
|
DROP TABLE tt_1;
|
||||||
|
DROP TABLE tt_2;
|
||||||
|
DROP TABLE nt_1;
|
||||||
|
DROP TABLE nt_2;
|
@ -0,0 +1,406 @@
|
|||||||
|
###################################################################################
|
||||||
|
# CONFIGURATION
|
||||||
|
###################################################################################
|
||||||
|
CREATE TABLE nt_1 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
|
||||||
|
CREATE TABLE nt_2 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
|
||||||
|
CREATE TABLE tt_1 (a text, b int PRIMARY KEY) ENGINE = Innodb;
|
||||||
|
CREATE TABLE tt_2 (a text, b int PRIMARY KEY) ENGINE = Innodb;
|
||||||
|
CREATE TRIGGER tr_i_tt_1_to_nt_1 BEFORE INSERT ON tt_1 FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO nt_1 VALUES (NEW.a, NEW.b);
|
||||||
|
END|
|
||||||
|
CREATE TRIGGER tr_i_nt_2_to_tt_2 BEFORE INSERT ON nt_2 FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO tt_2 VALUES (NEW.a, NEW.b);
|
||||||
|
END|
|
||||||
|
###################################################################################
|
||||||
|
# CHECK HISTORY IN BINLOG
|
||||||
|
###################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B M* T C" with error in M* generates in the binlog the "B M* R B T C" entries
|
||||||
|
|
||||||
|
INSERT INTO nt_1 VALUES ("new text 1", 1);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO tt_1 VALUES (USER(), 2), (USER(), 1);
|
||||||
|
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 3", 3);
|
||||||
|
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_1 VALUES ("new text 1", 1)
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 3", 3)
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 4", 4);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_2 VALUES (USER(), 5), (USER(), 4);
|
||||||
|
ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 6", 6);
|
||||||
|
COMMIT;
|
||||||
|
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_2 VALUES ("new text 4", 4)
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 6", 6)
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B M M* T C" with error in M* generates in the binlog the "B M M* T C" entries
|
||||||
|
|
||||||
|
INSERT INTO nt_1 VALUES ("new text 10", 10);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO tt_1 VALUES ("new text 7", 7), ("new text 8", 8);
|
||||||
|
INSERT INTO tt_1 VALUES (USER(), 9), (USER(), 10);
|
||||||
|
ERROR 23000: Duplicate entry '10' for key 'PRIMARY'
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 11", 11);
|
||||||
|
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_1 VALUES ("new text 10", 10)
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 7", 7), ("new text 8", 8)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 11", 11)
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 15", 15);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_2 VALUES ("new text 12", 12), ("new text 13", 13);
|
||||||
|
INSERT INTO nt_2 VALUES (USER(), 14), (USER(), 15);
|
||||||
|
ERROR 23000: Duplicate entry '15' for key 'PRIMARY'
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 16", 16);
|
||||||
|
COMMIT;
|
||||||
|
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_2 VALUES ("new text 15", 15)
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; INSERT INTO nt_2 VALUES ("new text 12", 12), ("new text 13", 13)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 16", 16)
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B M* M* T C" with error in M* generates in the binlog the "B M* R B M* R B T C" entries
|
||||||
|
|
||||||
|
INSERT INTO nt_1 VALUES ("new text 18", 18);
|
||||||
|
INSERT INTO nt_1 VALUES ("new text 20", 20);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO tt_1 VALUES (USER(), 17), (USER(), 18);
|
||||||
|
ERROR 23000: Duplicate entry '18' for key 'PRIMARY'
|
||||||
|
INSERT INTO tt_1 VALUES (USER(), 19), (USER(), 20);
|
||||||
|
ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 21", 21);
|
||||||
|
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_1 VALUES ("new text 18", 18)
|
||||||
|
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 20", 20)
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 21", 21)
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 23", 23);
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 25", 25);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_2 VALUES (USER(), 22), (USER(), 23);
|
||||||
|
ERROR 23000: Duplicate entry '23' for key 'PRIMARY'
|
||||||
|
INSERT INTO nt_2 VALUES (USER(), 24), (USER(), 25);
|
||||||
|
ERROR 23000: Duplicate entry '25' for key 'PRIMARY'
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 26", 26);
|
||||||
|
COMMIT;
|
||||||
|
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_2 VALUES ("new text 23", 23)
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 25", 25)
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 26", 26)
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B T INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates
|
||||||
|
*** in the binlog the following entries: "Nothing".
|
||||||
|
*** There is a bug in that will be fixed after WL#2687. Please, check BUG#47175 for further details.
|
||||||
|
|
||||||
|
TRUNCATE TABLE nt_2;
|
||||||
|
TRUNCATE TABLE tt_2;
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 7", 7);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 27", 27);
|
||||||
|
INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
|
||||||
|
ERROR 23000: Duplicate entry '7' for key 'PRIMARY'
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 28", 28);
|
||||||
|
ROLLBACK;
|
||||||
|
show binlog events from <binlog_start>;
|
||||||
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE nt_2
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_2
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 7", 7)
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B INSERT M..SELECT* C" with an error in INSERT M...SELECT* generates
|
||||||
|
*** in the binlog the following entries: "B INSERT M..SELECT* R".
|
||||||
|
|
||||||
|
TRUNCATE TABLE nt_2;
|
||||||
|
TRUNCATE TABLE tt_2;
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 7", 7);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
|
||||||
|
ERROR 23000: Duplicate entry '7' for key 'PRIMARY'
|
||||||
|
COMMIT;
|
||||||
|
show binlog events from <binlog_start>;
|
||||||
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE nt_2
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_2
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 7", 7)
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B N N T C" generates in the binlog the "B N C B N C B T C" entries
|
||||||
|
|
||||||
|
TRUNCATE TABLE nt_1;
|
||||||
|
TRUNCATE TABLE tt_2;
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 1);
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 2);
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 3);
|
||||||
|
COMMIT;
|
||||||
|
show binlog events from <binlog_start>;
|
||||||
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE nt_1
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_2
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B N N T R" generates in the binlog the "B N C B N C B T R" entries
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 4);
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 5);
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 6);
|
||||||
|
ROLLBACK;
|
||||||
|
Warnings:
|
||||||
|
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||||
|
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 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B N* N* T C" with error in N* generates in the binlog the "B N R B N R B T C" entries
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 7), (USER(), 1);
|
||||||
|
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 8), (USER(), 1);
|
||||||
|
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 9);
|
||||||
|
COMMIT;
|
||||||
|
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 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B N* N* T R" with error in N* generates in the binlog the "B N R B N R B T R" entries
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 10), (USER(), 1);
|
||||||
|
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 11), (USER(), 1);
|
||||||
|
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 12);
|
||||||
|
ROLLBACK;
|
||||||
|
Warnings:
|
||||||
|
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||||
|
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 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B N N T N T C" generates in the binlog the "B N C B N C B T N T C" entries
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 13);
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 14);
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 15);
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 16);
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 17);
|
||||||
|
COMMIT;
|
||||||
|
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 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B N N T N T R" generates in the binlog the "B N C B N C B T N T R" entries
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 18);
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 19);
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 20);
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 21);
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 22);
|
||||||
|
ROLLBACK;
|
||||||
|
Warnings:
|
||||||
|
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||||
|
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 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
###################################################################################
|
||||||
|
# CLEAN
|
||||||
|
###################################################################################
|
||||||
|
DROP TABLE tt_1;
|
||||||
|
DROP TABLE tt_2;
|
||||||
|
DROP TABLE nt_1;
|
||||||
|
DROP TABLE nt_2;
|
@ -0,0 +1,440 @@
|
|||||||
|
###################################################################################
|
||||||
|
# CONFIGURATION
|
||||||
|
###################################################################################
|
||||||
|
CREATE TABLE nt_1 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
|
||||||
|
CREATE TABLE nt_2 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
|
||||||
|
CREATE TABLE tt_1 (a text, b int PRIMARY KEY) ENGINE = Innodb;
|
||||||
|
CREATE TABLE tt_2 (a text, b int PRIMARY KEY) ENGINE = Innodb;
|
||||||
|
CREATE TRIGGER tr_i_tt_1_to_nt_1 BEFORE INSERT ON tt_1 FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO nt_1 VALUES (NEW.a, NEW.b);
|
||||||
|
END|
|
||||||
|
CREATE TRIGGER tr_i_nt_2_to_tt_2 BEFORE INSERT ON nt_2 FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO tt_2 VALUES (NEW.a, NEW.b);
|
||||||
|
END|
|
||||||
|
###################################################################################
|
||||||
|
# CHECK HISTORY IN BINLOG
|
||||||
|
###################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B M* T C" with error in M* generates in the binlog the "B M* R B T C" entries
|
||||||
|
|
||||||
|
INSERT INTO nt_1 VALUES ("new text 1", 1);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO tt_1 VALUES (USER(), 2), (USER(), 1);
|
||||||
|
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 3", 3);
|
||||||
|
COMMIT;
|
||||||
|
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 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 4", 4);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_2 VALUES (USER(), 5), (USER(), 4);
|
||||||
|
ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 6", 6);
|
||||||
|
COMMIT;
|
||||||
|
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 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B M M* T C" with error in M* generates in the binlog the "B M M* T C" entries
|
||||||
|
|
||||||
|
INSERT INTO nt_1 VALUES ("new text 10", 10);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO tt_1 VALUES ("new text 7", 7), ("new text 8", 8);
|
||||||
|
INSERT INTO tt_1 VALUES (USER(), 9), (USER(), 10);
|
||||||
|
ERROR 23000: Duplicate entry '10' for key 'PRIMARY'
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 11", 11);
|
||||||
|
COMMIT;
|
||||||
|
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 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 15", 15);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_2 VALUES ("new text 12", 12), ("new text 13", 13);
|
||||||
|
INSERT INTO nt_2 VALUES (USER(), 14), (USER(), 15);
|
||||||
|
ERROR 23000: Duplicate entry '15' for key 'PRIMARY'
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 16", 16);
|
||||||
|
COMMIT;
|
||||||
|
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 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B M* M* T C" with error in M* generates in the binlog the "B M* R B M* R B T C" entries
|
||||||
|
|
||||||
|
INSERT INTO nt_1 VALUES ("new text 18", 18);
|
||||||
|
INSERT INTO nt_1 VALUES ("new text 20", 20);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO tt_1 VALUES (USER(), 17), (USER(), 18);
|
||||||
|
ERROR 23000: Duplicate entry '18' for key 'PRIMARY'
|
||||||
|
INSERT INTO tt_1 VALUES (USER(), 19), (USER(), 20);
|
||||||
|
ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 21", 21);
|
||||||
|
COMMIT;
|
||||||
|
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 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 23", 23);
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 25", 25);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_2 VALUES (USER(), 22), (USER(), 23);
|
||||||
|
ERROR 23000: Duplicate entry '23' for key 'PRIMARY'
|
||||||
|
INSERT INTO nt_2 VALUES (USER(), 24), (USER(), 25);
|
||||||
|
ERROR 23000: Duplicate entry '25' for key 'PRIMARY'
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 26", 26);
|
||||||
|
COMMIT;
|
||||||
|
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 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B T INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates
|
||||||
|
*** in the binlog the following entries: "Nothing".
|
||||||
|
*** There is a bug in that will be fixed after WL#2687. Please, check BUG#47175 for further details.
|
||||||
|
|
||||||
|
TRUNCATE TABLE nt_2;
|
||||||
|
TRUNCATE TABLE tt_2;
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 7", 7);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 27", 27);
|
||||||
|
INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
|
||||||
|
ERROR 23000: Duplicate entry '7' for key 'PRIMARY'
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 28", 28);
|
||||||
|
ROLLBACK;
|
||||||
|
show binlog events from <binlog_start>;
|
||||||
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE nt_2
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_2
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B INSERT M..SELECT* C" with an error in INSERT M...SELECT* generates
|
||||||
|
*** in the binlog the following entries: "B INSERT M..SELECT* R".
|
||||||
|
|
||||||
|
TRUNCATE TABLE nt_2;
|
||||||
|
TRUNCATE TABLE tt_2;
|
||||||
|
INSERT INTO tt_2 VALUES ("new text 7", 7);
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
|
||||||
|
ERROR 23000: Duplicate entry '7' for key 'PRIMARY'
|
||||||
|
COMMIT;
|
||||||
|
show binlog events from <binlog_start>;
|
||||||
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE nt_2
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_2
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: #
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B N N T C" generates in the binlog the "B N C B N C B T C" entries
|
||||||
|
|
||||||
|
TRUNCATE TABLE nt_1;
|
||||||
|
TRUNCATE TABLE tt_2;
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 1);
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 2);
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 3);
|
||||||
|
COMMIT;
|
||||||
|
show binlog events from <binlog_start>;
|
||||||
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE nt_1
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_2
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B N N T R" generates in the binlog the "B N C B N C B T R" entries
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 4);
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 5);
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 6);
|
||||||
|
ROLLBACK;
|
||||||
|
Warnings:
|
||||||
|
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||||
|
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 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B N* N* T C" with error in N* generates in the binlog the "B N R B N R B T C" entries
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 7), (USER(), 1);
|
||||||
|
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 8), (USER(), 1);
|
||||||
|
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 9);
|
||||||
|
COMMIT;
|
||||||
|
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 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B N* N* T R" with error in N* generates in the binlog the "B N R B N R B T R" entries
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 10), (USER(), 1);
|
||||||
|
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 11), (USER(), 1);
|
||||||
|
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 12);
|
||||||
|
ROLLBACK;
|
||||||
|
Warnings:
|
||||||
|
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||||
|
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 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B N N T N T C" generates in the binlog the "B N C B N C B T N T C" entries
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 13);
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 14);
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 15);
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 16);
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 17);
|
||||||
|
COMMIT;
|
||||||
|
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 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** "B N N T N T R" generates in the binlog the "B N C B N C B T N T R" entries
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 18);
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 19);
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 20);
|
||||||
|
INSERT INTO nt_1 VALUES (USER(), 21);
|
||||||
|
INSERT INTO tt_2 VALUES (USER(), 22);
|
||||||
|
ROLLBACK;
|
||||||
|
Warnings:
|
||||||
|
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||||
|
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 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
###################################################################################
|
||||||
|
# CLEAN
|
||||||
|
###################################################################################
|
||||||
|
DROP TABLE tt_1;
|
||||||
|
DROP TABLE tt_2;
|
||||||
|
DROP TABLE nt_1;
|
||||||
|
DROP TABLE nt_2;
|
@ -133,6 +133,10 @@ master-bin.000001 # Query # # BEGIN
|
|||||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.t2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
insert into t1 values(11);
|
insert into t1 values(11);
|
||||||
commit;
|
commit;
|
||||||
show binlog events from <binlog_start>;
|
show binlog events from <binlog_start>;
|
||||||
@ -144,6 +148,8 @@ master-bin.000001 # Xid # # COMMIT /* XID */
|
|||||||
master-bin.000001 # Query # # BEGIN
|
master-bin.000001 # Query # # BEGIN
|
||||||
master-bin.000001 # Table_map # # table_id: # (test.t2)
|
master-bin.000001 # Table_map # # table_id: # (test.t2)
|
||||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
@ -272,6 +278,10 @@ master-bin.000001 # Query # # BEGIN
|
|||||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.t2)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
master-bin.000001 # Query # # use `test`; drop table t1,t2
|
master-bin.000001 # Query # # use `test`; drop table t1,t2
|
||||||
master-bin.000001 # Query # # use `test`; create table t0 (n int)
|
master-bin.000001 # Query # # use `test`; create table t0 (n int)
|
||||||
master-bin.000001 # Query # # BEGIN
|
master-bin.000001 # Query # # BEGIN
|
||||||
@ -372,7 +382,7 @@ master-bin.000001 # Query # # use `test`; DROP TABLE if exists t2
|
|||||||
master-bin.000001 # Query # # BEGIN
|
master-bin.000001 # Query # # BEGIN
|
||||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Query # # ROLLBACK
|
master-bin.000001 # Query # # COMMIT
|
||||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2
|
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2
|
||||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb
|
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb
|
||||||
master-bin.000001 # Query # # BEGIN
|
master-bin.000001 # Query # # BEGIN
|
||||||
@ -390,9 +400,7 @@ master-bin.000001 # Query # # use `test`; DROP TABLE t2
|
|||||||
master-bin.000001 # Query # # BEGIN
|
master-bin.000001 # Query # # BEGIN
|
||||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
master-bin.000001 # Query # # COMMIT
|
||||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
|
||||||
master-bin.000001 # Query # # ROLLBACK
|
|
||||||
master-bin.000001 # Query # # BEGIN
|
master-bin.000001 # Query # # BEGIN
|
||||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
@ -400,7 +408,11 @@ master-bin.000001 # Query # # COMMIT
|
|||||||
master-bin.000001 # Query # # BEGIN
|
master-bin.000001 # Query # # BEGIN
|
||||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Query # # ROLLBACK
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||||
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
|
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
|
||||||
master-bin.000001 # Query # # BEGIN
|
master-bin.000001 # Query # # BEGIN
|
||||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
--source include/have_binlog_format_mixed.inc
|
||||||
|
--source include/have_innodb.inc
|
||||||
|
|
||||||
|
--source extra/binlog_tests/binlog_failure_mixing_engines.test
|
@ -0,0 +1,4 @@
|
|||||||
|
--source include/have_binlog_format_row.inc
|
||||||
|
--source include/have_innodb.inc
|
||||||
|
|
||||||
|
--source extra/binlog_tests/binlog_failure_mixing_engines.test
|
@ -176,7 +176,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
|
|||||||
# 106 Query # 174 BEGIN
|
# 106 Query # 174 BEGIN
|
||||||
# 174 Table_map # 216 table_id: # (test.t7)
|
# 174 Table_map # 216 table_id: # (test.t7)
|
||||||
# 216 Write_rows # 272 table_id: # flags: STMT_END_F
|
# 216 Write_rows # 272 table_id: # flags: STMT_END_F
|
||||||
# 272 Query # 343 ROLLBACK
|
# 272 Query # 341 COMMIT
|
||||||
SELECT * FROM t7 ORDER BY a,b;
|
SELECT * FROM t7 ORDER BY a,b;
|
||||||
a b
|
a b
|
||||||
1 2
|
1 2
|
||||||
@ -327,7 +327,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
|
|||||||
# 1329 Query # 1397 BEGIN
|
# 1329 Query # 1397 BEGIN
|
||||||
# 1397 Table_map # 1438 table_id: # (test.t1)
|
# 1397 Table_map # 1438 table_id: # (test.t1)
|
||||||
# 1438 Write_rows # 1482 table_id: # flags: STMT_END_F
|
# 1438 Write_rows # 1482 table_id: # flags: STMT_END_F
|
||||||
# 1482 Query # 1553 ROLLBACK
|
# 1482 Query # 1551 COMMIT
|
||||||
SHOW TABLES;
|
SHOW TABLES;
|
||||||
Tables_in_test
|
Tables_in_test
|
||||||
t1
|
t1
|
||||||
|
30
sql/log.cc
30
sql/log.cc
@ -153,7 +153,7 @@ private:
|
|||||||
class binlog_trx_data {
|
class binlog_trx_data {
|
||||||
public:
|
public:
|
||||||
binlog_trx_data()
|
binlog_trx_data()
|
||||||
: at_least_one_stmt(0), incident(FALSE), m_pending(0),
|
: at_least_one_stmt_committed(0), incident(FALSE), m_pending(0),
|
||||||
before_stmt_pos(MY_OFF_T_UNDEF)
|
before_stmt_pos(MY_OFF_T_UNDEF)
|
||||||
{
|
{
|
||||||
trans_log.end_of_file= max_binlog_cache_size;
|
trans_log.end_of_file= max_binlog_cache_size;
|
||||||
@ -182,7 +182,10 @@ public:
|
|||||||
{
|
{
|
||||||
DBUG_PRINT("info", ("truncating to position %lu", (ulong) pos));
|
DBUG_PRINT("info", ("truncating to position %lu", (ulong) pos));
|
||||||
DBUG_PRINT("info", ("before_stmt_pos=%lu", (ulong) pos));
|
DBUG_PRINT("info", ("before_stmt_pos=%lu", (ulong) pos));
|
||||||
|
if (pending())
|
||||||
|
{
|
||||||
delete pending();
|
delete pending();
|
||||||
|
}
|
||||||
set_pending(0);
|
set_pending(0);
|
||||||
reinit_io_cache(&trans_log, WRITE_CACHE, pos, 0, 0);
|
reinit_io_cache(&trans_log, WRITE_CACHE, pos, 0, 0);
|
||||||
trans_log.end_of_file= max_binlog_cache_size;
|
trans_log.end_of_file= max_binlog_cache_size;
|
||||||
@ -192,12 +195,12 @@ public:
|
|||||||
/*
|
/*
|
||||||
The only valid positions that can be truncated to are at the
|
The only valid positions that can be truncated to are at the
|
||||||
beginning of a statement. We are relying on this fact to be able
|
beginning of a statement. We are relying on this fact to be able
|
||||||
to set the at_least_one_stmt flag correctly. In other word, if
|
to set the at_least_one_stmt_committed flag correctly. In other word, if
|
||||||
we are truncating to the beginning of the transaction cache,
|
we are truncating to the beginning of the transaction cache,
|
||||||
there will be no statements in the cache, otherwhise, we will
|
there will be no statements in the cache, otherwhise, we will
|
||||||
have at least one statement in the transaction cache.
|
have at least one statement in the transaction cache.
|
||||||
*/
|
*/
|
||||||
at_least_one_stmt= (pos > 0);
|
at_least_one_stmt_committed= (pos > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -239,7 +242,7 @@ public:
|
|||||||
Boolean that is true if there is at least one statement in the
|
Boolean that is true if there is at least one statement in the
|
||||||
transaction cache.
|
transaction cache.
|
||||||
*/
|
*/
|
||||||
bool at_least_one_stmt;
|
bool at_least_one_stmt_committed;
|
||||||
bool incident;
|
bool incident;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -1272,7 +1275,7 @@ static bool stmt_has_updated_trans_table(THD *thd)
|
|||||||
{
|
{
|
||||||
Ha_trx_info *ha_info;
|
Ha_trx_info *ha_info;
|
||||||
|
|
||||||
for (ha_info= thd->transaction.stmt.ha_list; ha_info; ha_info= ha_info->next())
|
for (ha_info= thd->transaction.stmt.ha_list; ha_info && ha_info->is_started(); ha_info= ha_info->next())
|
||||||
{
|
{
|
||||||
if (ha_info->is_trx_read_write() && ha_info->ht() != binlog_hton)
|
if (ha_info->is_trx_read_write() && ha_info->ht() != binlog_hton)
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
@ -1535,13 +1538,17 @@ static int binlog_commit(handlerton *hton, THD *thd, bool all)
|
|||||||
YESNO(in_transaction),
|
YESNO(in_transaction),
|
||||||
YESNO(thd->transaction.all.modified_non_trans_table),
|
YESNO(thd->transaction.all.modified_non_trans_table),
|
||||||
YESNO(thd->transaction.stmt.modified_non_trans_table)));
|
YESNO(thd->transaction.stmt.modified_non_trans_table)));
|
||||||
if (!in_transaction || all)
|
if (!in_transaction || all ||
|
||||||
|
(!all && !trx_data->at_least_one_stmt_committed &&
|
||||||
|
!stmt_has_updated_trans_table(thd) &&
|
||||||
|
thd->transaction.stmt.modified_non_trans_table))
|
||||||
{
|
{
|
||||||
Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, TRUE, 0);
|
Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, TRUE, 0);
|
||||||
error= binlog_end_trans(thd, trx_data, &qev, all);
|
error= binlog_end_trans(thd, trx_data, &qev, all);
|
||||||
goto end;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trx_data->at_least_one_stmt_committed = my_b_tell(&trx_data->trans_log) > 0;
|
||||||
|
|
||||||
end:
|
end:
|
||||||
if (!all)
|
if (!all)
|
||||||
trx_data->before_stmt_pos = MY_OFF_T_UNDEF; // part of the stmt commit
|
trx_data->before_stmt_pos = MY_OFF_T_UNDEF; // part of the stmt commit
|
||||||
@ -1608,15 +1615,18 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
We flush the cache with a rollback, wrapped in a beging/rollback if:
|
We flush the cache with a rollback, wrapped in a beging/rollback if:
|
||||||
. aborting a transcation that modified a non-transactional table or;
|
. aborting a transaction that modified a non-transactional table;
|
||||||
. aborting a statement that modified both transactional and
|
. aborting a statement that modified both transactional and
|
||||||
non-transctional tables but which is not in the boundaries of any
|
non-transactional tables but which is not in the boundaries of any
|
||||||
transaction;
|
transaction or there was no early change;
|
||||||
. the OPTION_KEEP_LOG is activate.
|
. the OPTION_KEEP_LOG is activate.
|
||||||
*/
|
*/
|
||||||
if ((all && thd->transaction.all.modified_non_trans_table) ||
|
if ((all && thd->transaction.all.modified_non_trans_table) ||
|
||||||
(!all && thd->transaction.stmt.modified_non_trans_table &&
|
(!all && thd->transaction.stmt.modified_non_trans_table &&
|
||||||
!(thd->options & (OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT))) ||
|
!(thd->options & (OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT))) ||
|
||||||
|
(!all && thd->transaction.stmt.modified_non_trans_table &&
|
||||||
|
!trx_data->at_least_one_stmt_committed &&
|
||||||
|
thd->current_stmt_binlog_row_based) ||
|
||||||
((thd->options & OPTION_KEEP_LOG)))
|
((thd->options & OPTION_KEEP_LOG)))
|
||||||
{
|
{
|
||||||
Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, TRUE, 0);
|
Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, TRUE, 0);
|
||||||
|
Reference in New Issue
Block a user