mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
Manual merge of mysql-trunk into mysql-trunk-merge.
Conflicts: Text conflict in client/mysqlbinlog.cc Text conflict in mysql-test/Makefile.am Text conflict in mysql-test/collections/default.daily Text conflict in mysql-test/r/mysqlbinlog_row_innodb.result Text conflict in mysql-test/suite/rpl/r/rpl_typeconv_innodb.result Text conflict in mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test Text conflict in mysql-test/suite/rpl/t/rpl_row_create_table.test Text conflict in mysql-test/suite/rpl/t/rpl_slave_skip.test Text conflict in mysql-test/suite/rpl/t/rpl_typeconv_innodb.test Text conflict in mysys/charset.c Text conflict in sql/field.cc Text conflict in sql/field.h Text conflict in sql/item.h Text conflict in sql/item_func.cc Text conflict in sql/log.cc Text conflict in sql/log_event.cc Text conflict in sql/log_event_old.cc Text conflict in sql/mysqld.cc Text conflict in sql/rpl_utility.cc Text conflict in sql/rpl_utility.h Text conflict in sql/set_var.cc Text conflict in sql/share/Makefile.am Text conflict in sql/sql_delete.cc Text conflict in sql/sql_plugin.cc Text conflict in sql/sql_select.cc Text conflict in sql/sql_table.cc Text conflict in storage/example/ha_example.h Text conflict in storage/federated/ha_federated.cc Text conflict in storage/myisammrg/ha_myisammrg.cc Text conflict in storage/myisammrg/myrg_open.c
This commit is contained in:
@@ -29,9 +29,13 @@ show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int)
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (a int)
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # drop database if exists mysqltest1
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; drop table tt1, t1
|
||||
FLUSH STATUS;
|
||||
set binlog_format=mixed;
|
||||
@@ -65,9 +69,13 @@ show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int)
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (a int)
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # drop database if exists mysqltest1
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; drop table tt1, t1
|
||||
FLUSH STATUS;
|
||||
set binlog_format=row;
|
||||
@@ -116,4 +124,5 @@ Database
|
||||
information_schema
|
||||
mtr
|
||||
mysql
|
||||
performance_schema
|
||||
test
|
||||
|
@@ -0,0 +1,78 @@
|
||||
SELECT @@SESSION.binlog_format;
|
||||
@@SESSION.binlog_format
|
||||
MIXED
|
||||
CREATE TABLE t1 (a VARCHAR(100));
|
||||
CREATE TEMPORARY TABLE t2 (a VARCHAR(100));
|
||||
# Test allow switching @@SESSION.binlog_format from MIXED to STATEMENT
|
||||
# when there are open temp tables and we are logging in statement based format.
|
||||
SET SESSION binlog_format = STATEMENT;
|
||||
SELECT @@SESSION.binlog_format;
|
||||
@@SESSION.binlog_format
|
||||
STATEMENT
|
||||
# Test allow switching @@SESSION.binlog_format from STATEMENT to
|
||||
# STATEMENT when there are open temp tables.
|
||||
SET SESSION binlog_format = STATEMENT;
|
||||
SELECT @@SESSION.binlog_format;
|
||||
@@SESSION.binlog_format
|
||||
STATEMENT
|
||||
INSERT INTO t1 VALUES ('statement based');
|
||||
SELECT @@SESSION.binlog_format;
|
||||
@@SESSION.binlog_format
|
||||
STATEMENT
|
||||
# Test allow switching @@SESSION.binlog_format from STATEMENT to
|
||||
# MIXED when there are open temp tables.
|
||||
SET SESSION binlog_format = MIXED;
|
||||
SELECT @@SESSION.binlog_format;
|
||||
@@SESSION.binlog_format
|
||||
MIXED
|
||||
# Test allow switching @@SESSION.binlog_format from MIXED to MIXED
|
||||
# when there are open temp tables.
|
||||
SET SESSION binlog_format = MIXED;
|
||||
SELECT @@SESSION.binlog_format;
|
||||
@@SESSION.binlog_format
|
||||
MIXED
|
||||
INSERT INTO t2 VALUES (UUID());
|
||||
SELECT @@SESSION.binlog_format;
|
||||
@@SESSION.binlog_format
|
||||
MIXED
|
||||
# Test forbit switching @@SESSION.binlog_format from MIXED to STATEMENT
|
||||
# when there are open temp tables and we are logging in row based format.
|
||||
SET SESSION binlog_format = STATEMENT;
|
||||
ERROR HY000: Cannot switch out of the row-based binary log format when the session has open temporary tables
|
||||
SELECT @@SESSION.binlog_format;
|
||||
@@SESSION.binlog_format
|
||||
MIXED
|
||||
SET SESSION binlog_format = ROW;
|
||||
SELECT @@SESSION.binlog_format;
|
||||
@@SESSION.binlog_format
|
||||
ROW
|
||||
INSERT INTO t1 VALUES ('row based');
|
||||
# Test allow switching @@SESSION.binlog_format from ROW to MIXED
|
||||
# when there are open temp tables.
|
||||
SET SESSION binlog_format = MIXED;
|
||||
SELECT @@SESSION.binlog_format;
|
||||
@@SESSION.binlog_format
|
||||
MIXED
|
||||
INSERT INTO t1 VALUES ('row based');
|
||||
# Test allow switching @@SESSION.binlog_format from MIXED to ROW
|
||||
# when there are open temp tables.
|
||||
SET SESSION binlog_format = ROW;
|
||||
SELECT @@SESSION.binlog_format;
|
||||
@@SESSION.binlog_format
|
||||
ROW
|
||||
# Test allow switching @@SESSION.binlog_format from ROW to ROW
|
||||
# when there are open temp tables.
|
||||
SET SESSION binlog_format = ROW;
|
||||
SELECT @@SESSION.binlog_format;
|
||||
@@SESSION.binlog_format
|
||||
ROW
|
||||
INSERT INTO t1 VALUES ('row based');
|
||||
# Test forbit switching @@SESSION.binlog_format from ROW to STATEMENT
|
||||
# when there are open temp tables.
|
||||
SET SESSION binlog_format = STATEMENT;
|
||||
ERROR HY000: Cannot switch out of the row-based binary log format when the session has open temporary tables
|
||||
SELECT @@SESSION.binlog_format;
|
||||
@@SESSION.binlog_format
|
||||
ROW
|
||||
DROP TEMPORARY TABLE t2;
|
||||
DROP TABLE t1;
|
@@ -6,12 +6,8 @@ Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
**** Variable SQL_LOG_BIN ****
|
||||
[root]
|
||||
set global sql_log_bin = 1;
|
||||
ERROR HY000: Variable 'sql_log_bin' is a SESSION variable and can't be used with SET GLOBAL
|
||||
set session sql_log_bin = 1;
|
||||
[plain]
|
||||
set global sql_log_bin = 1;
|
||||
ERROR HY000: Variable 'sql_log_bin' is a SESSION variable and can't be used with SET GLOBAL
|
||||
set session sql_log_bin = 1;
|
||||
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
|
||||
**** Variable BINLOG_FORMAT ****
|
||||
|
@@ -14,12 +14,12 @@ SET BINLOG_FORMAT=STATEMENT;
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
UPDATE t1 SET b = 1*a WHERE a > 1;
|
||||
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-UNCOMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
|
||||
ERROR HY000: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
UPDATE t1 SET b = 2*a WHERE a > 2;
|
||||
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
|
||||
ERROR HY000: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
||||
@@ -123,7 +123,7 @@ Binlog_cache_disk_use 0
|
||||
create table t1 (a int) engine=innodb;
|
||||
show status like "binlog_cache_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_use 1
|
||||
Binlog_cache_use 2
|
||||
show status like "binlog_cache_disk_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_disk_use 1
|
||||
@@ -132,7 +132,7 @@ delete from t1;
|
||||
commit;
|
||||
show status like "binlog_cache_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_use 2
|
||||
Binlog_cache_use 4
|
||||
show status like "binlog_cache_disk_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_disk_use 1
|
||||
|
@@ -1,3 +1,4 @@
|
||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||
create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
|
||||
create table t2 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=MyISAM;
|
||||
create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
|
||||
@@ -87,8 +88,10 @@ select @b /* must be 1 at the end of a stmt calling bug27563() */;
|
||||
must have the update query event more to FD
|
||||
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 # User var # # @`b`=0
|
||||
master-bin.000001 # Query # # use `test`; update t4 set b=b + bug27563(b)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
select
|
||||
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
|
||||
is not null;
|
||||
@@ -123,8 +126,10 @@ select @b /* must be 1 at the end of a stmt calling bug27563() */;
|
||||
must have the delete query event more to FD
|
||||
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 # User var # # @`b`=0
|
||||
master-bin.000001 # Query # # use `test`; delete from t4 where b=bug27563(1) or b=bug27563(2)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
select
|
||||
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
|
||||
is not null;
|
||||
|
@@ -18,8 +18,10 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "kil
|
||||
ERROR 70100: Query execution was interrupted
|
||||
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 # Begin_load_query # # ;file_id=#;block_len=#
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t2` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, `b`) ;file_id=#
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
select
|
||||
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
|
||||
is not null;
|
||||
|
8
mysql-test/suite/binlog/r/binlog_max_extension.result
Normal file
8
mysql-test/suite/binlog/r/binlog_max_extension.result
Normal file
@@ -0,0 +1,8 @@
|
||||
call mtr.add_suppression("Next log extension: 2147483647. Remaining log filename extensions: 0.");
|
||||
call mtr.add_suppression("Log filename extension number exhausted:");
|
||||
call mtr.add_suppression("Can't generate a unique log-filename");
|
||||
RESET MASTER;
|
||||
FLUSH LOGS;
|
||||
Warnings:
|
||||
Warning 1098 Can't generate a unique log-filename master-bin.(1-999)
|
||||
|
@@ -9,7 +9,7 @@ drop table if exists t1;
|
||||
create table t1 (a int) engine=innodb;
|
||||
show status like "binlog_cache_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_use 1
|
||||
Binlog_cache_use 2
|
||||
show status like "binlog_cache_disk_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_disk_use 1
|
||||
@@ -18,7 +18,7 @@ delete from t1;
|
||||
commit;
|
||||
show status like "binlog_cache_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_use 2
|
||||
Binlog_cache_use 4
|
||||
show status like "binlog_cache_disk_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_disk_use 1
|
||||
|
@@ -1,406 +0,0 @@
|
||||
###################################################################################
|
||||
# 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;
|
@@ -1,3 +1,4 @@
|
||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||
CREATE TABLE t1m (m INT, n INT) ENGINE=MYISAM;
|
||||
CREATE TABLE t1b (b INT, c INT) ENGINE=BLACKHOLE;
|
||||
CREATE TABLE t1n (e INT, f INT) ENGINE=NDB;
|
||||
@@ -6,10 +7,15 @@ SET SESSION BINLOG_FORMAT=STATEMENT;
|
||||
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
|
||||
The last event before the COMMIT is use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c
|
||||
*** Please look in binlog_multi_engine.test if you have a diff here ****
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
|
||||
UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
|
||||
COMMIT;
|
||||
TRUNCATE t1m;
|
||||
@@ -20,12 +26,18 @@ Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query # # BEGIN
|
||||
mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2)
|
||||
mysqld-bin.000001 # Query # # COMMIT
|
||||
mysqld-bin.000001 # Query # # BEGIN
|
||||
mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2)
|
||||
mysqld-bin.000001 # Query # # COMMIT
|
||||
mysqld-bin.000001 # Query # # BEGIN
|
||||
mysqld-bin.000001 # Query # # use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c
|
||||
mysqld-bin.000001 # Query # # COMMIT
|
||||
mysqld-bin.000001 # Query # # BEGIN
|
||||
mysqld-bin.000001 # Query # # use `test`; UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c
|
||||
mysqld-bin.000001 # Query # # COMMIT
|
||||
mysqld-bin.000001 # Query # # BEGIN
|
||||
mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2)
|
||||
mysqld-bin.000001 # Query # # use `test`; UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f
|
||||
mysqld-bin.000001 # Query # # use `test`; UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c
|
||||
mysqld-bin.000001 # Query # # COMMIT
|
||||
mysqld-bin.000001 # Query # # BEGIN
|
||||
mysqld-bin.000001 # Table_map # # table_id: # (test.t1n)
|
||||
@@ -39,10 +51,11 @@ RESET MASTER;
|
||||
SET SESSION BINLOG_FORMAT=MIXED;
|
||||
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
The last event before the COMMIT is use `test`; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2)
|
||||
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
|
||||
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging
|
||||
ERROR HY000: Cannot execute statement: binlogging impossible since more than one engine is involved and at least one engine is self-logging.
|
||||
TRUNCATE t1m;
|
||||
TRUNCATE t1b;
|
||||
TRUNCATE t1n;
|
||||
@@ -51,14 +64,15 @@ Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query # # BEGIN
|
||||
mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2)
|
||||
mysqld-bin.000001 # Query # # COMMIT
|
||||
mysqld-bin.000001 # Query # # BEGIN
|
||||
mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2)
|
||||
mysqld-bin.000001 # Query # # COMMIT
|
||||
mysqld-bin.000001 # Query # # BEGIN
|
||||
mysqld-bin.000001 # Table_map # # table_id: # (test.t1n)
|
||||
mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
|
||||
mysqld-bin.000001 # Write_rows # # table_id: #
|
||||
mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
mysqld-bin.000001 # Query # # COMMIT
|
||||
mysqld-bin.000001 # Query # # use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c
|
||||
mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1m
|
||||
mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1b
|
||||
mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1n
|
||||
@@ -68,9 +82,9 @@ INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging
|
||||
ERROR HY000: Cannot execute statement: binlogging impossible since more than one engine is involved and at least one engine is self-logging.
|
||||
UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
|
||||
ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging
|
||||
ERROR HY000: Cannot execute statement: binlogging impossible since more than one engine is involved and at least one engine is self-logging.
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query # # BEGIN
|
||||
|
@@ -16,7 +16,7 @@ DELIMITER /*!*/;
|
||||
ROLLBACK/*!*/;
|
||||
SET TIMESTAMP=10000/*!*/;
|
||||
SET @@session.pseudo_thread_id=999999999/*!*/;
|
||||
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
|
||||
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
|
||||
SET @@session.sql_mode=0/*!*/;
|
||||
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
|
||||
/*!\C latin1 *//*!*/;
|
||||
|
16
mysql-test/suite/binlog/r/binlog_row_drop_tbl.result
Normal file
16
mysql-test/suite/binlog/r/binlog_row_drop_tbl.result
Normal file
@@ -0,0 +1,16 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
RESET MASTER;
|
||||
CREATE TABLE t1 (a INT);
|
||||
SET AUTOCOMMIT=OFF;
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
DROP TABLE t1;;
|
||||
COMMIT;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
|
||||
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`; DROP TABLE t1
|
@@ -1,440 +0,0 @@
|
||||
###################################################################################
|
||||
# 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;
|
@@ -9,7 +9,7 @@ drop table if exists t1;
|
||||
create table t1 (a int) engine=innodb;
|
||||
show status like "binlog_cache_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_use 1
|
||||
Binlog_cache_use 2
|
||||
show status like "binlog_cache_disk_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_disk_use 1
|
||||
@@ -18,7 +18,7 @@ delete from t1;
|
||||
commit;
|
||||
show status like "binlog_cache_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_use 2
|
||||
Binlog_cache_use 4
|
||||
show status like "binlog_cache_disk_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_disk_use 1
|
||||
|
@@ -11,7 +11,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
|
||||
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 # # ROLLBACK
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
|
@@ -1,3 +1,4 @@
|
||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||
drop table if exists t1, t2;
|
||||
create table t1 (a int) engine=innodb;
|
||||
create table t2 (a int) engine=myisam;
|
||||
@@ -9,10 +10,12 @@ 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.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
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 # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
@@ -26,11 +29,9 @@ 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.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
@@ -46,13 +47,15 @@ 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.t2)
|
||||
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 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # use `test`; savepoint my_savepoint
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # use `test`; rollback to savepoint my_savepoint
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
delete from t1;
|
||||
@@ -75,13 +78,15 @@ a
|
||||
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.t2)
|
||||
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 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # use `test`; savepoint my_savepoint
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # use `test`; rollback to savepoint my_savepoint
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
@@ -101,11 +106,9 @@ get_lock("a",10)
|
||||
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.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
@@ -238,6 +241,7 @@ select (@after:=unix_timestamp())*0;
|
||||
select (@after-@before) >= 2;
|
||||
(@after-@before) >= 2
|
||||
1
|
||||
commit;
|
||||
drop table t1,t2;
|
||||
commit;
|
||||
begin;
|
||||
@@ -389,9 +393,7 @@ 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 # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
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
|
||||
@@ -431,19 +433,8 @@ select get_lock("a",10);
|
||||
get_lock("a",10)
|
||||
1
|
||||
flush logs;
|
||||
select
|
||||
(@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
|
||||
is not null;
|
||||
(@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
|
||||
is not null
|
||||
1
|
||||
select
|
||||
@a like "%#%error_code=0%ROLLBACK\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" OR
|
||||
@a like "%#%error_code=0%ROLLBACK\r\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%",
|
||||
@a not like "%#%error_code=%error_code=%";
|
||||
@a like "%#%error_code=0%ROLLBACK\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" OR
|
||||
@a like "%#%error_code=0%ROLLBACK\r\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%"
|
||||
1 1
|
||||
This does not matter in ROW mode as the rolled back changes do not contain transactional changes as these
|
||||
were previously flushed upon committing/rolling back each statement.
|
||||
drop table t1, t2;
|
||||
create temporary table tt (a int unique);
|
||||
create table ti (a int) engine=innodb;
|
||||
@@ -460,12 +451,6 @@ count(*)
|
||||
2
|
||||
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.ti)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Table_map # # table_id: # (test.ti)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
select count(*) from ti /* zero */;
|
||||
count(*)
|
||||
0
|
||||
@@ -483,6 +468,8 @@ insert into ti values (2) /* to make the dup error in the following */;
|
||||
insert into tt select * from ti /* one affected and error */;
|
||||
ERROR 23000: Duplicate entry '2' for key 'a'
|
||||
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
|
||||
select count(*) from ti /* zero */;
|
||||
@@ -516,7 +503,7 @@ master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
/* only (!) with fixes for #23333 will show there is the query */;
|
||||
select count(*) from t1 /* must be 3 */;
|
||||
count(*)
|
||||
@@ -558,10 +545,9 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
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.t2)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
/* the output must denote there is the query */;
|
||||
select count(*) from t1 /* must be 1 */;
|
||||
count(*)
|
||||
@@ -575,11 +561,9 @@ ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
|
||||
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.t2)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
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 # # COMMIT
|
||||
/* the output must denote there is the query */;
|
||||
select count(*) from t1 /* must be 2 */;
|
||||
count(*)
|
||||
@@ -597,7 +581,7 @@ master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: #
|
||||
master-bin.000001 # Update_rows # # table_id: #
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
/* the output must denote there is the query */;
|
||||
select count(*) from t1 /* must be 2 */;
|
||||
count(*)
|
||||
@@ -612,10 +596,9 @@ ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
|
||||
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.t4)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
/* the output must denote there is the query */;
|
||||
select count(*) from t1 /* must be 4 */;
|
||||
count(*)
|
||||
@@ -645,11 +628,10 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
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.t2)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t3)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
/* the output must denote there is the query */;
|
||||
select count(*) from t1 /* must be 1 */;
|
||||
count(*)
|
||||
@@ -668,12 +650,9 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
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.t2)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Delete_rows # # table_id: #
|
||||
master-bin.000001 # Write_rows # # table_id: #
|
||||
master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
/* the output must denote there is the query */;
|
||||
select count(*) from t1 /* must be 1 */;
|
||||
count(*)
|
||||
@@ -693,12 +672,9 @@ count(*)
|
||||
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.t4)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
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
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
/* the output must denote there is the query */;
|
||||
drop trigger trg_del_t2;
|
||||
drop table t1,t2,t3,t4,t5;
|
||||
@@ -719,12 +695,6 @@ count(*)
|
||||
2
|
||||
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.ti)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Table_map # # table_id: # (test.ti)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
select count(*) from ti /* zero */;
|
||||
count(*)
|
||||
0
|
||||
@@ -742,6 +712,8 @@ insert into ti values (2) /* to make the dup error in the following */;
|
||||
insert into tt select * from ti /* one affected and error */;
|
||||
ERROR 23000: Duplicate entry '2' for key 'a'
|
||||
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
|
||||
select count(*) from ti /* zero */;
|
||||
@@ -775,7 +747,7 @@ master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
select count(*) from t1 /* must be 3 */;
|
||||
count(*)
|
||||
3
|
||||
@@ -815,10 +787,9 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
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.t2)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
select count(*) from t1 /* must be 1 */;
|
||||
count(*)
|
||||
1
|
||||
@@ -831,11 +802,9 @@ ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
|
||||
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.t2)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
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 # # COMMIT
|
||||
select count(*) from t1 /* must be 2 */;
|
||||
count(*)
|
||||
2
|
||||
@@ -852,7 +821,7 @@ master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: #
|
||||
master-bin.000001 # Update_rows # # table_id: #
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
select count(*) from t1 /* must be 2 */;
|
||||
count(*)
|
||||
2
|
||||
@@ -866,10 +835,9 @@ ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
|
||||
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.t4)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
select count(*) from t1 /* must be 4 */;
|
||||
count(*)
|
||||
4
|
||||
@@ -898,11 +866,10 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
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.t2)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t3)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
select count(*) from t1 /* must be 1 */;
|
||||
count(*)
|
||||
1
|
||||
@@ -920,12 +887,9 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
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.t2)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Delete_rows # # table_id: #
|
||||
master-bin.000001 # Write_rows # # table_id: #
|
||||
master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
select count(*) from t1 /* must be 1 */;
|
||||
count(*)
|
||||
1
|
||||
@@ -944,12 +908,9 @@ count(*)
|
||||
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.t4)
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
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
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
drop trigger trg_del_t2;
|
||||
drop table t1,t2,t3,t4,t5;
|
||||
drop function bug27417;
|
||||
|
@@ -5,14 +5,27 @@ insert delayed into t1 values (300);
|
||||
FLUSH TABLES;
|
||||
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 `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_latin1'Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT' COLLATE 'latin1_swedish_ci'))
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; insert delayed into t1 values (207)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Intvar # # INSERT_ID=208
|
||||
master-bin.000001 # Query # # use `test`; insert delayed into t1 values (null)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; insert delayed into t1 values (300)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; FLUSH TABLES
|
||||
insert delayed into t1 values (null),(null),(null),(null);
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
|
||||
insert delayed into t1 values (null),(null),(400),(null);
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
|
||||
select * from t1;
|
||||
a
|
||||
207
|
||||
|
@@ -592,8 +592,10 @@ show binlog events from 0;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 107 Server version, Binlog ver: 4
|
||||
master-bin.000001 107 Query 1 228 use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned)
|
||||
master-bin.000001 228 Query 1 352 use `test`; insert into t1 values (9999999999999999,14632475938453979136)
|
||||
master-bin.000001 352 Query 1 428 use `test`; drop table t1
|
||||
master-bin.000001 228 Query 1 296 BEGIN
|
||||
master-bin.000001 296 Query 1 420 use `test`; insert into t1 values (9999999999999999,14632475938453979136)
|
||||
master-bin.000001 420 Query 1 489 COMMIT
|
||||
master-bin.000001 489 Query 1 565 use `test`; drop table t1
|
||||
reset master;
|
||||
CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
|
||||
USE bug39182;
|
||||
@@ -699,16 +701,24 @@ use test;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key)
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Intvar # # INSERT_ID=127
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values(null)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; drop table t1
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (a int)
|
||||
master-bin.000001 # Query # # use `test`; create table if not exists t2 select * from t1
|
||||
master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int)
|
||||
master-bin.000001 # Query # # use `test`; create table if not exists t3 like tt1
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `mysql`; INSERT INTO user SET host='localhost', user='@#@', password=password('Just a test')
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `mysql`; UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@'
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@'
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
drop table t1,t2,t3,tt1;
|
||||
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
|
||||
insert delayed into t1 values (207);
|
||||
@@ -718,16 +728,24 @@ FLUSH TABLES;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key)
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Intvar # # INSERT_ID=127
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values(null)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; drop table t1
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (a int)
|
||||
master-bin.000001 # Query # # use `test`; create table if not exists t2 select * from t1
|
||||
master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int)
|
||||
master-bin.000001 # Query # # use `test`; create table if not exists t3 like tt1
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `mysql`; INSERT INTO user SET host='localhost', user='@#@', password=password('Just a test')
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `mysql`; UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@'
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@'
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; drop table t1,t2,t3,tt1
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
@@ -799,7 +817,9 @@ SHOW BINLOG EVENTS;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
# # Format_desc 1 # Server ver: #, Binlog ver: #
|
||||
# # Query 1 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY)
|
||||
# # Query 1 # BEGIN
|
||||
# # Query 1 # use `test`; INSERT INTO t1 VALUES (1)
|
||||
# # Query 1 # COMMIT
|
||||
# # Query 1 # BEGIN
|
||||
# # Table_map 1 # table_id: # (test.t1)
|
||||
# # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||
|
@@ -1,3 +1,4 @@
|
||||
CALL mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||
drop table if exists t1,t2;
|
||||
CREATE TABLE t1 (
|
||||
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
|
||||
@@ -62,9 +63,9 @@ INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
|
||||
('Function MATCH ... AGAINST()','is used to do a search'),
|
||||
('Full-text search in MySQL', 'implements vector space model');
|
||||
SHOW INDEX FROM t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 a 1 a NULL NULL NULL NULL YES FULLTEXT
|
||||
t1 1 a 2 b NULL NULL NULL NULL YES FULLTEXT
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||
t1 1 a 1 a NULL NULL NULL NULL YES FULLTEXT
|
||||
t1 1 a 2 b NULL NULL NULL NULL YES FULLTEXT
|
||||
select * from t1 where MATCH(a,b) AGAINST ("collections");
|
||||
a b
|
||||
Only MyISAM tables support collections
|
||||
|
@@ -5,26 +5,34 @@ reset master;
|
||||
insert into t2 values (@v);
|
||||
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 # User var # # @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
|
||||
master-bin.000001 # Query # # use `test`; insert into t2 values (@v)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
flush logs;
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||
DELIMITER /*!*/;
|
||||
ROLLBACK/*!*/;
|
||||
SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`/*!*/;
|
||||
use test/*!*/;
|
||||
SET TIMESTAMP=10000/*!*/;
|
||||
SET @@session.pseudo_thread_id=999999999/*!*/;
|
||||
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
|
||||
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
|
||||
SET @@session.sql_mode=0/*!*/;
|
||||
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
|
||||
/*!\C latin1 *//*!*/;
|
||||
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||
SET @@session.lc_time_names=0/*!*/;
|
||||
SET @@session.collation_database=DEFAULT/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`/*!*/;
|
||||
use test/*!*/;
|
||||
SET TIMESTAMP=10000/*!*/;
|
||||
insert into t2 values (@v)
|
||||
/*!*/;
|
||||
SET TIMESTAMP=10000/*!*/;
|
||||
COMMIT
|
||||
/*!*/;
|
||||
DELIMITER ;
|
||||
# End of log file
|
||||
ROLLBACK /* added by mysqlbinlog */;
|
||||
|
@@ -25,11 +25,11 @@ use b42829;
|
||||
### binlog-do-db is not filtering used database
|
||||
BEGIN;
|
||||
INSERT INTO t2 VALUES (1,2), (1,3), (1,4);
|
||||
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
|
||||
ERROR HY000: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
|
||||
UPDATE b42829_filtered.t1 ft1, b42829.t1 nft1 SET ft1.x=1, nft1.x=2;
|
||||
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
|
||||
ERROR HY000: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
|
||||
INSERT INTO t1 SELECT * FROM t2;
|
||||
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
|
||||
ERROR HY000: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
|
||||
COMMIT;
|
||||
### assertion: filtered events did not make into the binlog
|
||||
show binlog events from <binlog_start>;
|
||||
|
15
mysql-test/suite/binlog/r/binlog_stm_drop_tbl.result
Normal file
15
mysql-test/suite/binlog/r/binlog_stm_drop_tbl.result
Normal file
@@ -0,0 +1,15 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
RESET MASTER;
|
||||
CREATE TABLE t1 (a INT);
|
||||
SET AUTOCOMMIT=OFF;
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
DROP TABLE t1;;
|
||||
COMMIT;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(1)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t1
|
@@ -9,7 +9,7 @@ drop table if exists t1;
|
||||
create table t1 (a int) engine=innodb;
|
||||
show status like "binlog_cache_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_use 1
|
||||
Binlog_cache_use 2
|
||||
show status like "binlog_cache_disk_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_disk_use 1
|
||||
@@ -18,7 +18,7 @@ delete from t1;
|
||||
commit;
|
||||
show status like "binlog_cache_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_use 2
|
||||
Binlog_cache_use 4
|
||||
show status like "binlog_cache_disk_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_disk_use 1
|
||||
|
@@ -8,7 +8,9 @@ insert into t1 select * from t2;
|
||||
ERROR 23000: Duplicate entry '2' for key 'a'
|
||||
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 t1 select * from t2
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
|
@@ -1,4 +1,5 @@
|
||||
CALL mtr.add_suppression("Statement may not be safe to log in statement format.");
|
||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||
drop table if exists t1, t2;
|
||||
create table t1 (a int) engine=innodb;
|
||||
create table t2 (a int) engine=myisam;
|
||||
@@ -6,6 +7,8 @@ reset master;
|
||||
begin;
|
||||
insert into t1 values(1);
|
||||
insert into t2 select * from t1;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
|
||||
commit;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
@@ -19,6 +22,8 @@ reset master;
|
||||
begin;
|
||||
insert into t1 values(2);
|
||||
insert into t2 select * from t1;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
|
||||
rollback;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
@@ -36,6 +41,8 @@ insert into t1 values(3);
|
||||
savepoint my_savepoint;
|
||||
insert into t1 values(4);
|
||||
insert into t2 select * from t1;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
|
||||
rollback to savepoint my_savepoint;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
@@ -57,6 +64,8 @@ insert into t1 values(5);
|
||||
savepoint my_savepoint;
|
||||
insert into t1 values(6);
|
||||
insert into t2 select * from t1;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
|
||||
rollback to savepoint my_savepoint;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
@@ -85,6 +94,8 @@ get_lock("a",10)
|
||||
begin;
|
||||
insert into t1 values(8);
|
||||
insert into t2 select * from t1;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
|
||||
select get_lock("a",10);
|
||||
get_lock("a",10)
|
||||
1
|
||||
@@ -99,24 +110,32 @@ delete from t2;
|
||||
reset master;
|
||||
insert into t1 values(9);
|
||||
insert into t2 select * from t1;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
|
||||
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 t1 values(9)
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
insert into t1 values(10);
|
||||
begin;
|
||||
insert into t2 select * from t1;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
|
||||
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 t1 values(10)
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
insert into t1 values(11);
|
||||
commit;
|
||||
show binlog events from <binlog_start>;
|
||||
@@ -124,7 +143,9 @@ Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values(10)
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values(11)
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
@@ -208,6 +229,7 @@ select (@after:=unix_timestamp())*0;
|
||||
select (@after-@before) >= 2;
|
||||
(@after-@before) >= 2
|
||||
1
|
||||
commit;
|
||||
drop table t1,t2;
|
||||
commit;
|
||||
begin;
|
||||
@@ -226,7 +248,7 @@ insert t0 select * from t1;
|
||||
set autocommit=1;
|
||||
insert into t0 select GET_LOCK("lock1",null);
|
||||
Warnings:
|
||||
Note 1592 Statement may not be safe to log in statement format.
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
|
||||
set autocommit=0;
|
||||
create table t2 (n int) engine=innodb;
|
||||
insert into t2 values (3);
|
||||
@@ -249,17 +271,29 @@ master-bin.000001 # Query # # use `test`; alter table t2 engine=MyISAM
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; insert into t2 values (20)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; drop table t1,t2
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; create temporary table ti (a int) engine=innodb
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; insert into ti values(1)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; create temporary table t1 (a int) engine=myisam
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; insert t1 values (1)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; create table t0 (n int)
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; insert t0 select * from t1
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; insert into t0 select GET_LOCK("lock1",null)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; create table t2 (n int) engine=innodb
|
||||
master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t1`,`ti`
|
||||
do release_lock("lock1");
|
||||
@@ -343,24 +377,42 @@ a b
|
||||
DROP TABLE t1,t2;
|
||||
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 t1 values (1,1),(1,2)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE if exists t2
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (3,3)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
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`; INSERT INTO t1 VALUES (4,4)
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4,4)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5,5)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t2
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (6,6)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a)) engine=innodb
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (7,7)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (8,8)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (9,9)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (10,10)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t2 values (100,100)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
@@ -374,6 +426,8 @@ get_lock("a",10)
|
||||
begin;
|
||||
insert into t1 values(8);
|
||||
insert into t2 select * from t1;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
|
||||
select get_lock("a",10);
|
||||
get_lock("a",10)
|
||||
1
|
||||
@@ -399,6 +453,8 @@ begin;
|
||||
insert into ti values (1);
|
||||
insert into ti values (2) ;
|
||||
insert into tt select * from ti;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
|
||||
rollback;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
@@ -416,6 +472,8 @@ select count(*) from ti /* zero */;
|
||||
count(*)
|
||||
0
|
||||
insert into ti select * from tt;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
|
||||
select * from ti /* that is what slave would miss - a bug */;
|
||||
a
|
||||
1
|
||||
@@ -442,6 +500,8 @@ select count(*) from ti /* zero */;
|
||||
count(*)
|
||||
0
|
||||
insert into ti select * from tt;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
|
||||
select * from tt /* that is what otherwise slave missed - the bug */;
|
||||
a
|
||||
1
|
||||
@@ -459,14 +519,20 @@ return n;
|
||||
end|
|
||||
reset master;
|
||||
insert into t2 values (bug27417(1));
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically.
|
||||
insert into t2 select bug27417(2);
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically.
|
||||
reset master;
|
||||
insert into t2 values (bug27417(2));
|
||||
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
|
||||
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 # Intvar # # INSERT_ID=3
|
||||
master-bin.000001 # Query # # use `test`; insert into t2 values (bug27417(2))
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
/* only (!) with fixes for #23333 will show there is the query */;
|
||||
select count(*) from t1 /* must be 3 */;
|
||||
count(*)
|
||||
@@ -476,19 +542,25 @@ select count(*) from t2;
|
||||
count(*)
|
||||
2
|
||||
delete from t2 where a=bug27417(3);
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically.
|
||||
select count(*) from t2 /* nothing got deleted */;
|
||||
count(*)
|
||||
2
|
||||
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 # Intvar # # INSERT_ID=4
|
||||
master-bin.000001 # Query # # use `test`; delete from t2 where a=bug27417(3)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
/* the query must be in regardless of #23333 */;
|
||||
select count(*) from t1 /* must be 5 */;
|
||||
count(*)
|
||||
5
|
||||
delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */;
|
||||
affected rows: 0
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically.
|
||||
select count(*) from t1 /* must be 7 */;
|
||||
count(*)
|
||||
7
|
||||
@@ -535,8 +607,10 @@ update t3 set b=b+bug27417(1);
|
||||
ERROR 23000: Duplicate entry '4' for key 'b'
|
||||
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 # Intvar # # INSERT_ID=4
|
||||
master-bin.000001 # Query # # use `test`; update t3 set b=b+bug27417(1)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
/* the output must denote there is the query */;
|
||||
select count(*) from t1 /* must be 2 */;
|
||||
count(*)
|
||||
@@ -643,6 +717,8 @@ begin;
|
||||
insert into ti values (1);
|
||||
insert into ti values (2) ;
|
||||
insert into tt select * from ti;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
|
||||
rollback;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
@@ -660,6 +736,8 @@ select count(*) from ti /* zero */;
|
||||
count(*)
|
||||
0
|
||||
insert into ti select * from tt;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
|
||||
select * from ti /* that is what slave would miss - bug#28960 */;
|
||||
a
|
||||
1
|
||||
@@ -686,6 +764,8 @@ select count(*) from ti /* zero */;
|
||||
count(*)
|
||||
0
|
||||
insert into ti select * from tt;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
|
||||
select * from tt /* that is what otherwise slave missed - the bug */;
|
||||
a
|
||||
1
|
||||
@@ -703,14 +783,20 @@ return n;
|
||||
end|
|
||||
reset master;
|
||||
insert into t2 values (bug27417(1));
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically.
|
||||
insert into t2 select bug27417(2);
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically.
|
||||
reset master;
|
||||
insert into t2 values (bug27417(2));
|
||||
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
|
||||
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 # Intvar # # INSERT_ID=3
|
||||
master-bin.000001 # Query # # use `test`; insert into t2 values (bug27417(2))
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
select count(*) from t1 /* must be 3 */;
|
||||
count(*)
|
||||
3
|
||||
@@ -719,18 +805,24 @@ select count(*) from t2;
|
||||
count(*)
|
||||
2
|
||||
delete from t2 where a=bug27417(3);
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically.
|
||||
select count(*) from t2 /* nothing got deleted */;
|
||||
count(*)
|
||||
2
|
||||
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 # Intvar # # INSERT_ID=4
|
||||
master-bin.000001 # Query # # use `test`; delete from t2 where a=bug27417(3)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
select count(*) from t1 /* must be 5 */;
|
||||
count(*)
|
||||
5
|
||||
delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */;
|
||||
affected rows: 0
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically.
|
||||
select count(*) from t1 /* must be 7 */;
|
||||
count(*)
|
||||
7
|
||||
@@ -775,8 +867,10 @@ update t3 set b=b+bug27417(1);
|
||||
ERROR 23000: Duplicate entry '4' for key 'b'
|
||||
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 # Intvar # # INSERT_ID=4
|
||||
master-bin.000001 # Query # # use `test`; update t3 set b=b+bug27417(1)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
select count(*) from t1 /* must be 2 */;
|
||||
count(*)
|
||||
2
|
||||
|
@@ -11,12 +11,18 @@ prepare s from "insert into t1 select 100 limit ?";
|
||||
set @a=100;
|
||||
execute s using @a;
|
||||
Warnings:
|
||||
Note 1592 Statement may not be safe to log in statement format.
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (a int)
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # User var # # @`a`=98
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values (@a),(98)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values (99)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 select 100 limit 100
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
drop table t1;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
CALL mtr.add_suppression("Statement may not be safe to log in statement format.");
|
||||
CALL mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
set @saved_global_binlog_format = @@global.binlog_format;
|
||||
@@ -31,7 +31,7 @@ RELEASE_LOCK('Bug#34306')
|
||||
1
|
||||
# con2
|
||||
Warnings:
|
||||
Note 1592 Statement may not be safe to log in statement format.
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
|
||||
SELECT RELEASE_LOCK('Bug#34306');
|
||||
RELEASE_LOCK('Bug#34306')
|
||||
1
|
||||
@@ -63,11 +63,21 @@ master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t1
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 LIKE t1
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(1)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES(2)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 SELECT * FROM t2 WHERE GET_LOCK('Bug#34306', 120)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES (3)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES (4)
|
||||
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
|
||||
|
@@ -1,13 +1,16 @@
|
||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. .*");
|
||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. .*");
|
||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column");
|
||||
### NOT filtered database => assertion: warnings ARE shown
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (a int, b int, primary key (a));
|
||||
INSERT INTO t1 VALUES (1,2), (2,3);
|
||||
UPDATE t1 SET b='4' WHERE a=1 LIMIT 1;
|
||||
Warnings:
|
||||
Note 1592 Statement may not be safe to log in statement format.
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
|
||||
UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1;
|
||||
Warnings:
|
||||
Note 1592 Statement may not be safe to log in statement format.
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
|
||||
DROP TABLE t1;
|
||||
### NOT filtered database => assertion: binlog disabled and warnings ARE NOT shown
|
||||
SET SQL_LOG_BIN= 0;
|
||||
@@ -38,13 +41,39 @@ CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(10));
|
||||
SET GLOBAL LOG_WARNINGS = 0;
|
||||
INSERT INTO t1 VALUES(UUID(), 'Bug#46265');
|
||||
Warnings:
|
||||
Note 1592 Statement may not be safe to log in statement format.
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
|
||||
SET GLOBAL LOG_WARNINGS = 1;
|
||||
INSERT INTO t1 VALUES(UUID(), 'Bug#46265');
|
||||
Warnings:
|
||||
Note 1592 Statement may not be safe to log in statement format.
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
|
||||
DROP TABLE t1;
|
||||
SET GLOBAL log_warnings = @old_log_warnings;
|
||||
# Count the number of times the "Unsafe" message was printed
|
||||
# to the error log.
|
||||
Occurrences: 1
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE TABLE t2 (a int auto_increment primary key, b int);
|
||||
CREATE TRIGGER tr_bug50192 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 (b) VALUES (1);
|
||||
CREATE FUNCTION sf_bug50192() RETURNS INTEGER
|
||||
BEGIN
|
||||
INSERT INTO t2(b) VALUES(2);
|
||||
RETURN 1;
|
||||
END |
|
||||
INSERT INTO t1 VALUES (0);
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically.
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically.
|
||||
SELECT sf_bug50192();
|
||||
sf_bug50192()
|
||||
1
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically.
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column which is unsafe to binlog in STATEMENT format because slave may execute it non-deterministically.
|
||||
DROP FUNCTION sf_bug50192;
|
||||
DROP TRIGGER tr_bug50192;
|
||||
DROP TABLE t1, t2;
|
||||
|
157
mysql-test/suite/binlog/r/binlog_stm_user_variables.result
Normal file
157
mysql-test/suite/binlog/r/binlog_stm_user_variables.result
Normal file
@@ -0,0 +1,157 @@
|
||||
RESET MASTER;
|
||||
SET @positive= 18446744073709551615;
|
||||
SET @negative= -9223372036854775808;
|
||||
CREATE TABLE t1 (`tinyint` TINYINT,
|
||||
`smallint` SMALLINT,
|
||||
`mediumint` MEDIUMINT,
|
||||
`integer` INTEGER,
|
||||
`bigint` BIGINT,
|
||||
`utinyint` TINYINT UNSIGNED,
|
||||
`usmallint` SMALLINT UNSIGNED,
|
||||
`umediumint` MEDIUMINT UNSIGNED,
|
||||
`uinteger` INTEGER UNSIGNED,
|
||||
`ubigint` BIGINT UNSIGNED,
|
||||
`double` DOUBLE,
|
||||
`float` FLOAT,
|
||||
`real` REAL(30,2),
|
||||
`decimal` DECIMAL(30,2)) ENGINE = MyISAM;
|
||||
### insert max unsigned
|
||||
### a) declarative
|
||||
INSERT INTO t1 VALUES (18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615,18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615);;
|
||||
TRUNCATE t1;
|
||||
### b) user var
|
||||
INSERT INTO t1 VALUES (@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive);
|
||||
## assertion: checks that User_var_log_event::pack_info
|
||||
## correctly displays the binlog content by taking into
|
||||
## account the unsigned_flag
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (`tinyint` TINYINT,
|
||||
`smallint` SMALLINT,
|
||||
`mediumint` MEDIUMINT,
|
||||
`integer` INTEGER,
|
||||
`bigint` BIGINT,
|
||||
`utinyint` TINYINT UNSIGNED,
|
||||
`usmallint` SMALLINT UNSIGNED,
|
||||
`umediumint` MEDIUMINT UNSIGNED,
|
||||
`uinteger` INTEGER UNSIGNED,
|
||||
`ubigint` BIGINT UNSIGNED,
|
||||
`double` DOUBLE,
|
||||
`float` FLOAT,
|
||||
`real` REAL(30,2),
|
||||
`decimal` DECIMAL(30,2)) ENGINE = MyISAM
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615,18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE t1
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # User var # # @`positive`=18446744073709551615
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
### insert min signed
|
||||
### a) declarative
|
||||
INSERT INTO t1 VALUES (-9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808,-9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808);;
|
||||
TRUNCATE t1;
|
||||
### b) user var
|
||||
INSERT INTO t1 VALUES (@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative);
|
||||
## assertion: checks that User_var_log_event::pack_info
|
||||
## correctly displays the binlog content by taking into
|
||||
## account the unsigned_flag
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (`tinyint` TINYINT,
|
||||
`smallint` SMALLINT,
|
||||
`mediumint` MEDIUMINT,
|
||||
`integer` INTEGER,
|
||||
`bigint` BIGINT,
|
||||
`utinyint` TINYINT UNSIGNED,
|
||||
`usmallint` SMALLINT UNSIGNED,
|
||||
`umediumint` MEDIUMINT UNSIGNED,
|
||||
`uinteger` INTEGER UNSIGNED,
|
||||
`ubigint` BIGINT UNSIGNED,
|
||||
`double` DOUBLE,
|
||||
`float` FLOAT,
|
||||
`real` REAL(30,2),
|
||||
`decimal` DECIMAL(30,2)) ENGINE = MyISAM
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615,18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE t1
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # User var # # @`positive`=18446744073709551615
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (-9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808,-9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE t1
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # User var # # @`negative`=-9223372036854775808
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
DROP TABLE t1;
|
139
mysql-test/suite/binlog/r/binlog_switch_inside_trans.result
Normal file
139
mysql-test/suite/binlog/r/binlog_switch_inside_trans.result
Normal file
@@ -0,0 +1,139 @@
|
||||
set @save_binlog_format= @@global.binlog_format;
|
||||
set @save_binlog_dirct= @@global.binlog_direct_non_transactional_updates;
|
||||
create table t1 (a int) engine= myisam;
|
||||
create table t2 (a int) engine= innodb;
|
||||
SELECT @@session.binlog_format;
|
||||
@@session.binlog_format
|
||||
ROW
|
||||
SET AUTOCOMMIT=1;
|
||||
# Test that the session variable 'binlog_format'
|
||||
# is writable outside a transaction.
|
||||
set @@session.binlog_format= statement;
|
||||
set @@session.binlog_direct_non_transactional_updates= TRUE;
|
||||
SELECT @@session.binlog_format;
|
||||
@@session.binlog_format
|
||||
STATEMENT
|
||||
SELECT @@session.binlog_direct_non_transactional_updates;
|
||||
@@session.binlog_direct_non_transactional_updates
|
||||
1
|
||||
begin;
|
||||
# Test that the session variable 'binlog_format' is read-only
|
||||
# inside a transaction with no preceding updates.
|
||||
set @@session.binlog_format= mixed;
|
||||
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
|
||||
set @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||
ERROR HY000: Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction
|
||||
insert into t2 values (1);
|
||||
# Test that the session variable 'binlog_format' is read-only
|
||||
# inside a transaction with preceding transactional updates.
|
||||
set @@session.binlog_format= row;
|
||||
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
|
||||
set @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||
ERROR HY000: Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction
|
||||
commit;
|
||||
begin;
|
||||
insert into t1 values (2);
|
||||
# Test that the session variable 'binlog_format' is read-only
|
||||
# inside a transaction with preceding non-transactional updates.
|
||||
set @@session.binlog_format= statement;
|
||||
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
|
||||
set @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||
ERROR HY000: Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction
|
||||
commit;
|
||||
# Test that the session variable 'binlog_format' is writable
|
||||
# when AUTOCOMMIT=0, before a transaction has started.
|
||||
set AUTOCOMMIT=0;
|
||||
set @@session.binlog_format= row;
|
||||
set @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||
SELECT @@session.binlog_format;
|
||||
@@session.binlog_format
|
||||
ROW
|
||||
SELECT @@session.binlog_direct_non_transactional_updates;
|
||||
@@session.binlog_direct_non_transactional_updates
|
||||
0
|
||||
insert into t1 values (4);
|
||||
# Test that the session variable 'binlog_format' is read-only inside an
|
||||
# AUTOCOMMIT=0 transaction with preceding non-transactional updates.
|
||||
set @@session.binlog_format= statement;
|
||||
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
|
||||
set @@session.binlog_direct_non_transactional_updates= TRUE;
|
||||
ERROR HY000: Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction
|
||||
SELECT @@session.binlog_format;
|
||||
@@session.binlog_format
|
||||
ROW
|
||||
SELECT @@session.binlog_direct_non_transactional_updates;
|
||||
@@session.binlog_direct_non_transactional_updates
|
||||
0
|
||||
commit;
|
||||
insert into t2 values (5);
|
||||
# Test that the session variable 'binlog_format' is read-only inside an
|
||||
# AUTOCOMMIT=0 transaction with preceding transactional updates.
|
||||
set @@session.binlog_format= row;
|
||||
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
|
||||
set @@session.binlog_direct_non_transactional_updates= TRUE;
|
||||
ERROR HY000: Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction
|
||||
SELECT @@session.binlog_format;
|
||||
@@session.binlog_format
|
||||
ROW
|
||||
SELECT @@session.binlog_direct_non_transactional_updates;
|
||||
@@session.binlog_direct_non_transactional_updates
|
||||
0
|
||||
commit;
|
||||
begin;
|
||||
insert into t2 values (6);
|
||||
# Test that the global variable 'binlog_format' is writable
|
||||
# inside a transaction.
|
||||
SELECT @@global.binlog_format;
|
||||
@@global.binlog_format
|
||||
ROW
|
||||
set @@global.binlog_format= statement;
|
||||
set @@global.binlog_direct_non_transactional_updates= TRUE;
|
||||
SELECT @@global.binlog_format;
|
||||
@@global.binlog_format
|
||||
STATEMENT
|
||||
SELECT @@global.binlog_direct_non_transactional_updates;
|
||||
@@global.binlog_direct_non_transactional_updates
|
||||
1
|
||||
commit;
|
||||
set @@global.binlog_format= @save_binlog_format;
|
||||
set @@global.binlog_direct_non_transactional_updates= @save_binlog_dirct;
|
||||
create table t3(a int, b int) engine= innodb;
|
||||
create table t4(a int) engine= innodb;
|
||||
create table t5(a int) engine= innodb;
|
||||
create trigger tr1 after insert on t3 for each row begin
|
||||
insert into t4(a) values(1);
|
||||
set @@session.binlog_format= statement;
|
||||
insert into t4(a) values(2);
|
||||
insert into t5(a) values(3);
|
||||
end |
|
||||
# Test that the session variable 'binlog_format' is read-only
|
||||
# in sub-statements.
|
||||
insert into t3(a,b) values(1,1);
|
||||
ERROR HY000: Cannot change the binary logging format inside a stored function or trigger
|
||||
SELECT @@session.binlog_format;
|
||||
@@session.binlog_format
|
||||
ROW
|
||||
create table t6(a int, b int) engine= innodb;
|
||||
create table t7(a int) engine= innodb;
|
||||
create table t8(a int) engine= innodb;
|
||||
create trigger tr2 after insert on t6 for each row begin
|
||||
insert into t7(a) values(1);
|
||||
set @@global.binlog_direct_non_transactional_updates= FALSE;
|
||||
insert into t7(a) values(2);
|
||||
insert into t8(a) values(3);
|
||||
end |
|
||||
# Test that the session variable 'binlog_format' is read-only
|
||||
# in sub-statements.
|
||||
insert into t6(a,b) values(1,1);
|
||||
ERROR HY000: Cannot change the binlog direct flag inside a stored function or trigger
|
||||
SELECT @@session.binlog_direct_non_transactional_updates;
|
||||
@@session.binlog_direct_non_transactional_updates
|
||||
0
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop table t4;
|
||||
drop table t5;
|
||||
drop table t6;
|
||||
drop table t7;
|
||||
drop table t8;
|
@@ -1,4 +1,3 @@
|
||||
RESET MASTER;
|
||||
create table foo (a int);
|
||||
flush logs;
|
||||
create temporary table tmp1_foo like foo;
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,76 @@
|
||||
#
|
||||
# Bug #45855 row events in binlog after switch from binlog_fmt=mix to stmt with open tmp tbl
|
||||
# Bug #45856 can't switch from binlog_format=row to mix with open tmp tbl
|
||||
# This test verfies if the program will generate ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR
|
||||
# error and forbid switching @@SESSION.binlog_format from MIXED or ROW to
|
||||
# STATEMENT when there are open temp tables and we are logging in row format.
|
||||
# There is no error in any other case.
|
||||
#
|
||||
|
||||
source include/have_binlog_format_mixed.inc;
|
||||
|
||||
SELECT @@SESSION.binlog_format;
|
||||
CREATE TABLE t1 (a VARCHAR(100));
|
||||
CREATE TEMPORARY TABLE t2 (a VARCHAR(100));
|
||||
|
||||
--echo # Test allow switching @@SESSION.binlog_format from MIXED to STATEMENT
|
||||
--echo # when there are open temp tables and we are logging in statement based format.
|
||||
SET SESSION binlog_format = STATEMENT;
|
||||
SELECT @@SESSION.binlog_format;
|
||||
|
||||
--echo # Test allow switching @@SESSION.binlog_format from STATEMENT to
|
||||
--echo # STATEMENT when there are open temp tables.
|
||||
SET SESSION binlog_format = STATEMENT;
|
||||
SELECT @@SESSION.binlog_format;
|
||||
|
||||
INSERT INTO t1 VALUES ('statement based');
|
||||
SELECT @@SESSION.binlog_format;
|
||||
--echo # Test allow switching @@SESSION.binlog_format from STATEMENT to
|
||||
--echo # MIXED when there are open temp tables.
|
||||
SET SESSION binlog_format = MIXED;
|
||||
SELECT @@SESSION.binlog_format;
|
||||
|
||||
--echo # Test allow switching @@SESSION.binlog_format from MIXED to MIXED
|
||||
--echo # when there are open temp tables.
|
||||
SET SESSION binlog_format = MIXED;
|
||||
SELECT @@SESSION.binlog_format;
|
||||
|
||||
INSERT INTO t2 VALUES (UUID());
|
||||
SELECT @@SESSION.binlog_format;
|
||||
|
||||
--echo # Test forbit switching @@SESSION.binlog_format from MIXED to STATEMENT
|
||||
--echo # when there are open temp tables and we are logging in row based format.
|
||||
--ERROR ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR
|
||||
SET SESSION binlog_format = STATEMENT;
|
||||
SELECT @@SESSION.binlog_format;
|
||||
|
||||
SET SESSION binlog_format = ROW;
|
||||
SELECT @@SESSION.binlog_format;
|
||||
|
||||
INSERT INTO t1 VALUES ('row based');
|
||||
--echo # Test allow switching @@SESSION.binlog_format from ROW to MIXED
|
||||
--echo # when there are open temp tables.
|
||||
SET SESSION binlog_format = MIXED;
|
||||
SELECT @@SESSION.binlog_format;
|
||||
|
||||
INSERT INTO t1 VALUES ('row based');
|
||||
--echo # Test allow switching @@SESSION.binlog_format from MIXED to ROW
|
||||
--echo # when there are open temp tables.
|
||||
SET SESSION binlog_format = ROW;
|
||||
SELECT @@SESSION.binlog_format;
|
||||
|
||||
--echo # Test allow switching @@SESSION.binlog_format from ROW to ROW
|
||||
--echo # when there are open temp tables.
|
||||
SET SESSION binlog_format = ROW;
|
||||
SELECT @@SESSION.binlog_format;
|
||||
|
||||
INSERT INTO t1 VALUES ('row based');
|
||||
--echo # Test forbit switching @@SESSION.binlog_format from ROW to STATEMENT
|
||||
--echo # when there are open temp tables.
|
||||
--ERROR ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR
|
||||
SET SESSION binlog_format = STATEMENT;
|
||||
SELECT @@SESSION.binlog_format;
|
||||
|
||||
DROP TEMPORARY TABLE t2;
|
||||
DROP TABLE t1;
|
||||
|
@@ -22,14 +22,10 @@ connect (root,localhost,root,,test);
|
||||
|
||||
connection root;
|
||||
--echo [root]
|
||||
--error ER_LOCAL_VARIABLE
|
||||
set global sql_log_bin = 1;
|
||||
set session sql_log_bin = 1;
|
||||
|
||||
connection plain;
|
||||
--echo [plain]
|
||||
--error ER_LOCAL_VARIABLE
|
||||
set global sql_log_bin = 1;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
set session sql_log_bin = 1;
|
||||
|
||||
|
@@ -27,13 +27,13 @@ SET BINLOG_FORMAT=STATEMENT;
|
||||
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
error ER_BINLOG_LOGGING_IMPOSSIBLE;
|
||||
error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE;
|
||||
UPDATE t1 SET b = 1*a WHERE a > 1;
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
error ER_BINLOG_LOGGING_IMPOSSIBLE;
|
||||
error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE;
|
||||
UPDATE t1 SET b = 2*a WHERE a > 2;
|
||||
COMMIT;
|
||||
|
||||
|
@@ -1,6 +1,8 @@
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
|
||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||
|
||||
# You cannot use `KILL' with the Embedded MySQL Server library,
|
||||
# because the embedded server merely runs inside the threads of the host
|
||||
# application. -- the docs
|
||||
@@ -51,7 +53,7 @@ reap;
|
||||
let $rows= `select count(*) from t2 /* must be 2 or 0 */`;
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
--exec $MYSQL_BINLOG --force-if-open --start-position=135 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
|
||||
--exec $MYSQL_BINLOG --force-if-open --start-position=175 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval select
|
||||
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))
|
||||
|
@@ -52,7 +52,7 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "kil
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
--exec $MYSQL_BINLOG --force-if-open --start-position=107 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
|
||||
--exec $MYSQL_BINLOG --force-if-open --start-position=210 --stop-position=387 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval select
|
||||
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
|
||||
|
92
mysql-test/suite/binlog/t/binlog_max_extension.test
Normal file
92
mysql-test/suite/binlog/t/binlog_max_extension.test
Normal file
@@ -0,0 +1,92 @@
|
||||
# BUG#40611: MySQL cannot make a binary log after sequential number beyond
|
||||
# unsigned long.
|
||||
#
|
||||
# Problem statement
|
||||
# =================
|
||||
#
|
||||
# Extension for log file names might be created with negative
|
||||
# numbers (when counter used would wrap around), causing server
|
||||
# failure when incrementing -00001 (reaching number 000000
|
||||
# extension).
|
||||
#
|
||||
# Test
|
||||
# ====
|
||||
# This tests aims at testing the a patch that removes negatives
|
||||
# numbers from log name extensions and checks that the server
|
||||
# reports gracefully that the limit has been reached.
|
||||
#
|
||||
# It instruments index file to point to a log file close to
|
||||
# the new maximum and calls flush logs to get warning.
|
||||
#
|
||||
|
||||
call mtr.add_suppression("Next log extension: 2147483647. Remaining log filename extensions: 0.");
|
||||
call mtr.add_suppression("Log filename extension number exhausted:");
|
||||
call mtr.add_suppression("Can't generate a unique log-filename");
|
||||
|
||||
|
||||
-- source include/have_log_bin.inc
|
||||
RESET MASTER;
|
||||
|
||||
-- let $MYSQLD_DATADIR= `select @@datadir`
|
||||
|
||||
###############################################
|
||||
# check hitting maximum file name extension:
|
||||
###############################################
|
||||
|
||||
##########
|
||||
# Prepare
|
||||
##########
|
||||
|
||||
# 1. Stop master server
|
||||
-- write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
wait
|
||||
EOF
|
||||
-- shutdown_server 10
|
||||
-- source include/wait_until_disconnected.inc
|
||||
|
||||
# 2. Prepare log and index file
|
||||
-- copy_file $MYSQLD_DATADIR/master-bin.index $MYSQLD_DATADIR/master-bin.index.orig
|
||||
-- copy_file $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.2147483646
|
||||
-- append_file $MYSQLD_DATADIR/master-bin.index
|
||||
master-bin.2147483646
|
||||
EOF
|
||||
|
||||
# 3. Restart the server
|
||||
-- append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
restart
|
||||
EOF
|
||||
-- enable_reconnect
|
||||
-- source include/wait_until_connected_again.inc
|
||||
|
||||
###########
|
||||
# Assertion
|
||||
###########
|
||||
|
||||
# assertion: should throw warning
|
||||
FLUSH LOGS;
|
||||
|
||||
##############
|
||||
# Clean up
|
||||
##############
|
||||
|
||||
# 1. Stop the server
|
||||
-- write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
wait
|
||||
EOF
|
||||
-- shutdown_server 10
|
||||
-- source include/wait_until_disconnected.inc
|
||||
|
||||
# 2. Undo changes to index and log files
|
||||
-- remove_file $MYSQLD_DATADIR/master-bin.index
|
||||
-- copy_file $MYSQLD_DATADIR/master-bin.index.orig $MYSQLD_DATADIR/master-bin.index
|
||||
-- remove_file $MYSQLD_DATADIR/master-bin.index.orig
|
||||
|
||||
-- remove_file $MYSQLD_DATADIR/master-bin.2147483646
|
||||
-- remove_file $MYSQLD_DATADIR/master-bin.2147483647
|
||||
|
||||
# 3. Restart the server
|
||||
-- append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
restart
|
||||
EOF
|
||||
-- enable_reconnect
|
||||
-- source include/wait_until_connected_again.inc
|
@@ -1,4 +0,0 @@
|
||||
--source include/have_binlog_format_mixed.inc
|
||||
--source include/have_innodb.inc
|
||||
|
||||
--source extra/binlog_tests/binlog_failure_mixing_engines.test
|
@@ -7,6 +7,8 @@ source include/have_blackhole.inc;
|
||||
source include/have_ndb.inc;
|
||||
source include/have_log_bin.inc;
|
||||
|
||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||
|
||||
CREATE TABLE t1m (m INT, n INT) ENGINE=MYISAM;
|
||||
CREATE TABLE t1b (b INT, c INT) ENGINE=BLACKHOLE;
|
||||
CREATE TABLE t1n (e INT, f INT) ENGINE=NDB;
|
||||
@@ -22,8 +24,10 @@ UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
|
||||
|
||||
# Here and below we need to wait when some event appears in binlog
|
||||
# to avoid unsrted mixing local events and from NDB
|
||||
let $wait_binlog_event= t1m, t1b;
|
||||
let $wait_binlog_event= COMMIT;
|
||||
source include/wait_for_binlog_event.inc;
|
||||
let $event= query_get_value(SHOW BINLOG EVENTS, Info, 9);
|
||||
--echo The last event before the COMMIT is $event
|
||||
|
||||
echo *** Please look in binlog_multi_engine.test if you have a diff here ****;
|
||||
START TRANSACTION;
|
||||
@@ -51,8 +55,10 @@ SET SESSION BINLOG_FORMAT=MIXED;
|
||||
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
|
||||
let $wait_binlog_event= t1m;
|
||||
let $wait_binlog_event= COMMIT;
|
||||
source include/wait_for_binlog_event.inc;
|
||||
let $event= query_get_value(SHOW BINLOG EVENTS, Info, 6);
|
||||
--echo The last event before the COMMIT is $event
|
||||
|
||||
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
|
||||
@@ -60,7 +66,7 @@ let $wait_binlog_event= COMMIT;
|
||||
source include/wait_for_binlog_event.inc;
|
||||
|
||||
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
|
||||
error ER_BINLOG_LOGGING_IMPOSSIBLE;
|
||||
error ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE;
|
||||
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
|
||||
# Not possible to test this since NDB writes its own binlog, which
|
||||
@@ -84,7 +90,7 @@ INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
|
||||
error ER_BINLOG_LOGGING_IMPOSSIBLE;
|
||||
error ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE;
|
||||
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
|
||||
# Not possible to test this since NDB writes its own binlog, which
|
||||
@@ -93,7 +99,7 @@ UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
|
||||
#UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
|
||||
error ER_BINLOG_LOGGING_IMPOSSIBLE;
|
||||
error ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE;
|
||||
UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
|
@@ -1 +1 @@
|
||||
-O max_binlog_size=4096
|
||||
--max_binlog_size=4096
|
||||
|
5
mysql-test/suite/binlog/t/binlog_row_drop_tbl.test
Normal file
5
mysql-test/suite/binlog/t/binlog_row_drop_tbl.test
Normal file
@@ -0,0 +1,5 @@
|
||||
# This is a wrapper for drop_table.test so that the same test case can be used
|
||||
# For both statement and row based bin logs
|
||||
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source extra/binlog_tests/drop_table.test
|
@@ -1,4 +0,0 @@
|
||||
--source include/have_binlog_format_row.inc
|
||||
--source include/have_innodb.inc
|
||||
|
||||
--source extra/binlog_tests/binlog_failure_mixing_engines.test
|
@@ -6,4 +6,7 @@
|
||||
-- disable_query_log
|
||||
reset master; # get rid of previous tests binlog
|
||||
-- enable_query_log
|
||||
disable_query_log;
|
||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||
enable_query_log;
|
||||
-- source extra/binlog_tests/binlog_insert_delayed.test
|
||||
|
@@ -1 +1 @@
|
||||
-O max_binlog_size=4096
|
||||
--max_binlog_size=4096
|
||||
|
@@ -74,11 +74,11 @@ INSERT INTO t1 SELECT * FROM t2;
|
||||
-- echo ### assertion: the statements *will* raise log error because
|
||||
-- echo ### binlog-do-db is not filtering used database
|
||||
BEGIN;
|
||||
-- error ER_BINLOG_LOGGING_IMPOSSIBLE
|
||||
-- error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE
|
||||
INSERT INTO t2 VALUES (1,2), (1,3), (1,4);
|
||||
-- error ER_BINLOG_LOGGING_IMPOSSIBLE
|
||||
-- error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE
|
||||
-- eval UPDATE $filtered.t1 ft1, $not_filtered.t1 nft1 SET ft1.x=1, nft1.x=2
|
||||
-- error ER_BINLOG_LOGGING_IMPOSSIBLE
|
||||
-- error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE
|
||||
INSERT INTO t1 SELECT * FROM t2;
|
||||
COMMIT;
|
||||
|
||||
|
5
mysql-test/suite/binlog/t/binlog_stm_drop_tbl.test
Normal file
5
mysql-test/suite/binlog/t/binlog_stm_drop_tbl.test
Normal file
@@ -0,0 +1,5 @@
|
||||
# This is a wrapper for drop_table.test so that the same test case can be used
|
||||
# For both statement and row based bin logs
|
||||
|
||||
-- source include/have_binlog_format_mixed_or_statement.inc
|
||||
-- source extra/binlog_tests/drop_table.test
|
@@ -1 +1 @@
|
||||
--innodb_lock_wait_timeout=2
|
||||
--innodb_lock_wait_timeout=2 --binlog-direct-non-transactional-updates=FALSE
|
||||
|
@@ -3,6 +3,10 @@
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
|
||||
disable_query_log;
|
||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||
enable_query_log;
|
||||
|
||||
-- disable_query_log
|
||||
reset master; # get rid of previous tests binlog
|
||||
-- enable_query_log
|
||||
|
@@ -2,7 +2,7 @@
|
||||
# Test sets its own binlog_format, so we restrict it to run only once
|
||||
--source include/have_binlog_format_row.inc
|
||||
|
||||
CALL mtr.add_suppression("Statement may not be safe to log in statement format.");
|
||||
CALL mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||
|
||||
# Get rid of previous tests binlog
|
||||
--disable_query_log
|
||||
@@ -60,7 +60,7 @@ let $wait_condition=
|
||||
--echo # con1
|
||||
let $wait_condition=
|
||||
SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE
|
||||
state = "Locked" and info = "INSERT INTO t2 VALUES (3)";
|
||||
state = "Table lock" and info = "INSERT INTO t2 VALUES (3)";
|
||||
--source include/wait_condition.inc
|
||||
SELECT RELEASE_LOCK('Bug#34306');
|
||||
--connection con2
|
||||
|
@@ -25,6 +25,9 @@
|
||||
|
||||
-- source include/have_log_bin.inc
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. .*");
|
||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. .*");
|
||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement invokes a trigger or a stored function that inserts into AUTO_INCREMENT column");
|
||||
|
||||
-- echo ### NOT filtered database => assertion: warnings ARE shown
|
||||
|
||||
@@ -115,3 +118,34 @@ perl;
|
||||
print "Occurrences: $count\n";
|
||||
close(FILE);
|
||||
EOF
|
||||
|
||||
# bug#50192: diplaying the unsafe warning comes out to the user warning stack
|
||||
|
||||
-- disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
-- enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE TABLE t2 (a int auto_increment primary key, b int);
|
||||
CREATE TRIGGER tr_bug50192 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 (b) VALUES (1);
|
||||
|
||||
DELIMITER |;
|
||||
|
||||
CREATE FUNCTION sf_bug50192() RETURNS INTEGER
|
||||
BEGIN
|
||||
INSERT INTO t2(b) VALUES(2);
|
||||
RETURN 1;
|
||||
END |
|
||||
|
||||
DELIMITER ;|
|
||||
|
||||
INSERT INTO t1 VALUES (0);
|
||||
SHOW WARNINGS;
|
||||
SELECT sf_bug50192();
|
||||
SHOW WARNINGS;
|
||||
|
||||
# cleanup
|
||||
|
||||
DROP FUNCTION sf_bug50192;
|
||||
DROP TRIGGER tr_bug50192;
|
||||
DROP TABLE t1, t2;
|
||||
|
87
mysql-test/suite/binlog/t/binlog_stm_user_variables.test
Normal file
87
mysql-test/suite/binlog/t/binlog_stm_user_variables.test
Normal file
@@ -0,0 +1,87 @@
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
RESET MASTER;
|
||||
#
|
||||
# BUG#49562: SBR out of sync when using numeric data types + user variable
|
||||
#
|
||||
|
||||
-- let $max_unsigned_long= 18446744073709551615
|
||||
-- let $min_signed_long= -9223372036854775808
|
||||
-- eval SET @positive= $max_unsigned_long
|
||||
-- eval SET @negative= $min_signed_long
|
||||
|
||||
CREATE TABLE t1 (`tinyint` TINYINT,
|
||||
`smallint` SMALLINT,
|
||||
`mediumint` MEDIUMINT,
|
||||
`integer` INTEGER,
|
||||
`bigint` BIGINT,
|
||||
`utinyint` TINYINT UNSIGNED,
|
||||
`usmallint` SMALLINT UNSIGNED,
|
||||
`umediumint` MEDIUMINT UNSIGNED,
|
||||
`uinteger` INTEGER UNSIGNED,
|
||||
`ubigint` BIGINT UNSIGNED,
|
||||
`double` DOUBLE,
|
||||
`float` FLOAT,
|
||||
`real` REAL(30,2),
|
||||
`decimal` DECIMAL(30,2)) ENGINE = MyISAM;
|
||||
|
||||
-- echo ### insert max unsigned
|
||||
-- echo ### a) declarative
|
||||
-- disable_warnings
|
||||
-- eval INSERT INTO t1 VALUES ($max_unsigned_long, $max_unsigned_long, $max_unsigned_long, $max_unsigned_long, $max_unsigned_long, $max_unsigned_long, $max_unsigned_long,$max_unsigned_long, $max_unsigned_long, $max_unsigned_long, $max_unsigned_long, $max_unsigned_long, $max_unsigned_long, $max_unsigned_long);
|
||||
-- enable_warnings
|
||||
TRUNCATE t1;
|
||||
|
||||
-- echo ### b) user var
|
||||
-- disable_warnings
|
||||
INSERT INTO t1 VALUES (@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive);
|
||||
-- enable_warnings
|
||||
|
||||
-- echo ## assertion: checks that User_var_log_event::pack_info
|
||||
-- echo ## correctly displays the binlog content by taking into
|
||||
-- echo ## account the unsigned_flag
|
||||
-- source include/show_binlog_events.inc
|
||||
|
||||
-- echo ### insert min signed
|
||||
-- echo ### a) declarative
|
||||
-- disable_warnings
|
||||
-- eval INSERT INTO t1 VALUES ($min_signed_long, $min_signed_long, $min_signed_long, $min_signed_long, $min_signed_long, $min_signed_long, $min_signed_long,$min_signed_long, $min_signed_long, $min_signed_long, $min_signed_long, $min_signed_long, $min_signed_long, $min_signed_long);
|
||||
-- enable_warnings
|
||||
TRUNCATE t1;
|
||||
|
||||
-- echo ### b) user var
|
||||
-- disable_warnings
|
||||
INSERT INTO t1 VALUES (@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative);
|
||||
-- enable_warnings
|
||||
|
||||
-- echo ## assertion: checks that User_var_log_event::pack_info
|
||||
-- echo ## correctly displays the binlog content by taking into
|
||||
-- echo ## account the unsigned_flag
|
||||
-- source include/show_binlog_events.inc
|
||||
|
||||
DROP TABLE t1;
|
138
mysql-test/suite/binlog/t/binlog_switch_inside_trans.test
Normal file
138
mysql-test/suite/binlog/t/binlog_switch_inside_trans.test
Normal file
@@ -0,0 +1,138 @@
|
||||
#
|
||||
# BUG#47863
|
||||
# This test verifies if the session variable 'binlog_format'
|
||||
# is read-only inside a transaction and in sub-statements.
|
||||
#
|
||||
|
||||
source include/have_innodb.inc;
|
||||
source include/have_binlog_format_row.inc;
|
||||
|
||||
set @save_binlog_format= @@global.binlog_format;
|
||||
set @save_binlog_dirct= @@global.binlog_direct_non_transactional_updates;
|
||||
create table t1 (a int) engine= myisam;
|
||||
create table t2 (a int) engine= innodb;
|
||||
|
||||
SELECT @@session.binlog_format;
|
||||
SET AUTOCOMMIT=1;
|
||||
--echo # Test that the session variable 'binlog_format'
|
||||
--echo # is writable outside a transaction.
|
||||
set @@session.binlog_format= statement;
|
||||
set @@session.binlog_direct_non_transactional_updates= TRUE;
|
||||
SELECT @@session.binlog_format;
|
||||
SELECT @@session.binlog_direct_non_transactional_updates;
|
||||
|
||||
begin;
|
||||
--echo # Test that the session variable 'binlog_format' is read-only
|
||||
--echo # inside a transaction with no preceding updates.
|
||||
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
|
||||
set @@session.binlog_format= mixed;
|
||||
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT
|
||||
set @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||
|
||||
insert into t2 values (1);
|
||||
--echo # Test that the session variable 'binlog_format' is read-only
|
||||
--echo # inside a transaction with preceding transactional updates.
|
||||
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
|
||||
set @@session.binlog_format= row;
|
||||
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT
|
||||
set @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||
commit;
|
||||
|
||||
begin;
|
||||
insert into t1 values (2);
|
||||
--echo # Test that the session variable 'binlog_format' is read-only
|
||||
--echo # inside a transaction with preceding non-transactional updates.
|
||||
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
|
||||
set @@session.binlog_format= statement;
|
||||
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT
|
||||
set @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||
commit;
|
||||
|
||||
--echo # Test that the session variable 'binlog_format' is writable
|
||||
--echo # when AUTOCOMMIT=0, before a transaction has started.
|
||||
set AUTOCOMMIT=0;
|
||||
set @@session.binlog_format= row;
|
||||
set @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||
SELECT @@session.binlog_format;
|
||||
SELECT @@session.binlog_direct_non_transactional_updates;
|
||||
|
||||
insert into t1 values (4);
|
||||
--echo # Test that the session variable 'binlog_format' is read-only inside an
|
||||
--echo # AUTOCOMMIT=0 transaction with preceding non-transactional updates.
|
||||
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
|
||||
set @@session.binlog_format= statement;
|
||||
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT
|
||||
set @@session.binlog_direct_non_transactional_updates= TRUE;
|
||||
SELECT @@session.binlog_format;
|
||||
SELECT @@session.binlog_direct_non_transactional_updates;
|
||||
commit;
|
||||
|
||||
insert into t2 values (5);
|
||||
--echo # Test that the session variable 'binlog_format' is read-only inside an
|
||||
--echo # AUTOCOMMIT=0 transaction with preceding transactional updates.
|
||||
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
|
||||
set @@session.binlog_format= row;
|
||||
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT
|
||||
set @@session.binlog_direct_non_transactional_updates= TRUE;
|
||||
SELECT @@session.binlog_format;
|
||||
SELECT @@session.binlog_direct_non_transactional_updates;
|
||||
commit;
|
||||
|
||||
begin;
|
||||
insert into t2 values (6);
|
||||
--echo # Test that the global variable 'binlog_format' is writable
|
||||
--echo # inside a transaction.
|
||||
SELECT @@global.binlog_format;
|
||||
set @@global.binlog_format= statement;
|
||||
set @@global.binlog_direct_non_transactional_updates= TRUE;
|
||||
SELECT @@global.binlog_format;
|
||||
SELECT @@global.binlog_direct_non_transactional_updates;
|
||||
commit;
|
||||
|
||||
set @@global.binlog_format= @save_binlog_format;
|
||||
set @@global.binlog_direct_non_transactional_updates= @save_binlog_dirct;
|
||||
|
||||
create table t3(a int, b int) engine= innodb;
|
||||
create table t4(a int) engine= innodb;
|
||||
create table t5(a int) engine= innodb;
|
||||
delimiter |;
|
||||
eval create trigger tr1 after insert on t3 for each row begin
|
||||
insert into t4(a) values(1);
|
||||
set @@session.binlog_format= statement;
|
||||
insert into t4(a) values(2);
|
||||
insert into t5(a) values(3);
|
||||
end |
|
||||
delimiter ;|
|
||||
|
||||
--echo # Test that the session variable 'binlog_format' is read-only
|
||||
--echo # in sub-statements.
|
||||
--error ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT
|
||||
insert into t3(a,b) values(1,1);
|
||||
SELECT @@session.binlog_format;
|
||||
|
||||
create table t6(a int, b int) engine= innodb;
|
||||
create table t7(a int) engine= innodb;
|
||||
create table t8(a int) engine= innodb;
|
||||
delimiter |;
|
||||
eval create trigger tr2 after insert on t6 for each row begin
|
||||
insert into t7(a) values(1);
|
||||
set @@global.binlog_direct_non_transactional_updates= FALSE;
|
||||
insert into t7(a) values(2);
|
||||
insert into t8(a) values(3);
|
||||
end |
|
||||
delimiter ;|
|
||||
|
||||
--echo # Test that the session variable 'binlog_format' is read-only
|
||||
--echo # in sub-statements.
|
||||
--error ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT
|
||||
insert into t6(a,b) values(1,1);
|
||||
SELECT @@session.binlog_direct_non_transactional_updates;
|
||||
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop table t4;
|
||||
drop table t5;
|
||||
drop table t6;
|
||||
drop table t7;
|
||||
drop table t8;
|
@@ -30,7 +30,6 @@ source include/have_binlog_format_mixed_or_statement.inc;
|
||||
|
||||
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
||||
connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
||||
RESET MASTER;
|
||||
|
||||
create table foo (a int);
|
||||
|
||||
|
1
mysql-test/suite/binlog/t/binlog_unsafe-master.opt
Normal file
1
mysql-test/suite/binlog/t/binlog_unsafe-master.opt
Normal file
@@ -0,0 +1 @@
|
||||
$UDF_EXAMPLE_LIB_OPT --log-output=file,table
|
@@ -1,34 +1,61 @@
|
||||
# ==== Background ====
|
||||
#
|
||||
# Some statements may execute differently on master and slave when
|
||||
# logged in statement format. Such statements are called unsafe.
|
||||
# Unsafe statements include:
|
||||
#
|
||||
# - statements using @@variables (with a small number of exceptions;
|
||||
# see below);
|
||||
# - statements using certain functions, e.g., UUID();
|
||||
# - statements using LIMIT;
|
||||
# - INSERT DELAYED;
|
||||
# - insert into two autoinc columns;
|
||||
# - statements using UDF's.
|
||||
# - statements reading from log tables in the mysql database.
|
||||
#
|
||||
# Note that statements that use stored functions, stored procedures,
|
||||
# triggers, views, or prepared statements that invoke unsafe
|
||||
# statements shall also be unsafe.
|
||||
#
|
||||
# Unsafeness of a statement shall have the following consequences:
|
||||
#
|
||||
# 1. If the binlogging is on and the unsafe statement is logged:
|
||||
# - If binlog_format=STATEMENT, the statement shall give a warning.
|
||||
# - If binlog_format=MIXED or binlog_format=ROW, the statement shall
|
||||
# be logged in row format.
|
||||
#
|
||||
# 2. If binlogging is off or the statement is not logged (e.g. SELECT
|
||||
# UUID()), no warning shall be issued and the statement shall not
|
||||
# be logged.
|
||||
#
|
||||
# Moreover, when a sub-statement of a recursive construct (i.e.,
|
||||
# stored function, stored procedure, trigger, view, or prepared
|
||||
# statement) is unsafe and binlog_format=STATEMENT, then a warning
|
||||
# shall be issued for every recursive construct. In effect, this
|
||||
# creates a stack trace from the top-level statement to the unsafe
|
||||
# statement.
|
||||
#
|
||||
#
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Some statements can not be written to the binlog in a safe manner
|
||||
# with statement-based replication, either because they rely on
|
||||
# features that are local to the server they are replicated from
|
||||
# (e.g., @@variables), or because they include nondeterministic
|
||||
# queries (e.g., LIMIT), or because the time at which the query is
|
||||
# executed cannot be determined (e.g., INSERT DELAYED). Such
|
||||
# statements should be marked unsafe. All unsafe statements should
|
||||
# give a warning.
|
||||
# Yet the warning/error message isn't issued when SQL_LOG_BIN is turned off.
|
||||
# This test verifies that a warning is generated when it should,
|
||||
# according to the rules above.
|
||||
#
|
||||
# This test verifies that a warning is generated for statements that
|
||||
# should be unsafe, when they are executed under statement mode
|
||||
# logging.
|
||||
#
|
||||
# All variables should be unsafe, with some exceptions. Therefore,
|
||||
# this test also verifies that the exceptions do *not* generare a
|
||||
# All @@variables should be unsafe, with some exceptions. Therefore,
|
||||
# this test also verifies that the exceptions do *not* generate a
|
||||
# warning.
|
||||
#
|
||||
#
|
||||
# ==== Method ====
|
||||
#
|
||||
# We try an INSERT DELAYED statement and verify that a warning is
|
||||
# issued.
|
||||
# 1. Each type of statements listed above is executed.
|
||||
#
|
||||
# We try to insert unsafe variables into a table in several ways:
|
||||
# directly with an INSERT statement, from a stored procedure, from a
|
||||
# stored function, from a trigger, from a prepared statement, and from
|
||||
# a complicated nesting of triggers, functions, procedures, and
|
||||
# prepared statements. In all cases, a warning should be issued.
|
||||
# 2. Each unsafe statement is wrapped in each type of recursive
|
||||
# construct (stored function, stored procedure, trigger, view, or
|
||||
# prepared statement).
|
||||
#
|
||||
# 3. Each unsafe statement is wrapped in two levels of recursive
|
||||
# constructs (function invoking trigger invoking UUID(), etc).
|
||||
#
|
||||
# We try to insert the variables that should not be unsafe into a
|
||||
# table, and verify that *no* warning is issued.
|
||||
@@ -38,7 +65,8 @@
|
||||
# Execute a unsafe statement calling a trigger or stored function
|
||||
# or neither when @@SQL_LOG_BIN is turned OFF,
|
||||
# no warning/error is issued
|
||||
|
||||
#
|
||||
#
|
||||
# ==== Related bugs and worklogs ====
|
||||
#
|
||||
# WL#3339: Issue warnings when statement-based replication may fail
|
||||
@@ -47,6 +75,8 @@
|
||||
# BUG#34768: nondeterministic INSERT using LIMIT logged in stmt mode if binlog_format=mixed
|
||||
# BUG#41980, SBL, INSERT .. SELECT .. LIMIT = ERROR, even when @@SQL_LOG_BIN is 0
|
||||
# BUG#42640: mysqld crashes when unsafe statements are executed (STRICT_TRANS_TABLES mode)
|
||||
# BUG#45825: INSERT DELAYED is not unsafe: logged in statement format
|
||||
# BUG#45785: LIMIT in SP does not cause RBL if binlog_format=MIXED
|
||||
# BUG#47995: Mark user functions as unsafe
|
||||
# BUG#49222: Mare RAND() unsafe
|
||||
#
|
||||
@@ -59,192 +89,313 @@
|
||||
# rpl.rpl_variables_stm tests the small subset of variables that
|
||||
# actually can be replicated safely in statement mode.
|
||||
#
|
||||
#
|
||||
# ==== Todo ====
|
||||
#
|
||||
# There are several other ways to create unsafe statements: see, e.g.,
|
||||
# WL#3339, BUG#34768.
|
||||
# rpl_ndb.rpl_ndb_binlog_format_errors tests all errors and warnings
|
||||
# related to logging format (not just 'Unsafe statement binlogged in
|
||||
# statement mode since BINLOG_FORMAT = STATEMENT').
|
||||
|
||||
source include/have_log_bin.inc;
|
||||
source include/have_binlog_format_statement.inc;
|
||||
--source include/have_udf.inc
|
||||
--source include/have_log_bin.inc
|
||||
--source include/have_binlog_format_statement.inc
|
||||
|
||||
--echo ==== Setup tables ====
|
||||
--disable_query_log
|
||||
call mtr.add_suppression("Unsafe statement binlogged in statement format");
|
||||
--enable_query_log
|
||||
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE t2 (a CHAR(40));
|
||||
CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY);
|
||||
CREATE TABLE trigger_table (a CHAR(7));
|
||||
CREATE TABLE trigger_table2 (a INT);
|
||||
--echo #### Setup tables ####
|
||||
|
||||
CREATE TABLE t0 (a CHAR(100));
|
||||
CREATE TABLE t1 (a CHAR(100));
|
||||
CREATE TABLE t2 (a CHAR(100));
|
||||
CREATE TABLE t3 (a CHAR(100));
|
||||
CREATE TABLE ta0 (a CHAR(100));
|
||||
CREATE TABLE ta1 (a CHAR(100));
|
||||
CREATE TABLE ta2 (a CHAR(100));
|
||||
CREATE TABLE ta3 (a CHAR(100));
|
||||
CREATE TABLE autoinc_table (a INT PRIMARY KEY AUTO_INCREMENT);
|
||||
CREATE TABLE data_table (a CHAR(100));
|
||||
INSERT INTO data_table VALUES ('foo');
|
||||
CREATE TABLE trigger_table_1 (a INT);
|
||||
CREATE TABLE trigger_table_2 (a INT);
|
||||
CREATE TABLE trigger_table_3 (a INT);
|
||||
CREATE TABLE double_autoinc_table (a INT PRIMARY KEY AUTO_INCREMENT);
|
||||
|
||||
--echo ==== Non-deterministic statements ====
|
||||
|
||||
INSERT DELAYED INTO t1 VALUES (5);
|
||||
|
||||
|
||||
--echo ==== Some variables that *should* be unsafe ====
|
||||
|
||||
--echo ---- Insert directly ----
|
||||
|
||||
INSERT INTO t1 VALUES (@@global.sync_binlog);
|
||||
INSERT INTO t1 VALUES (@@session.insert_id);
|
||||
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
|
||||
INSERT INTO t2 SELECT UUID();
|
||||
INSERT INTO t2 VALUES (@@session.sql_mode);
|
||||
INSERT INTO t2 VALUES (@@global.init_slave);
|
||||
INSERT INTO t2 VALUES (@@hostname);
|
||||
|
||||
--echo ---- Insert from stored procedure ----
|
||||
|
||||
DELIMITER |;
|
||||
CREATE PROCEDURE proc()
|
||||
--DELIMITER |
|
||||
CREATE TRIGGER double_autoinc_trig
|
||||
BEFORE INSERT ON double_autoinc_table FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO t1 VALUES (@@global.sync_binlog);
|
||||
INSERT INTO t1 VALUES (@@session.insert_id);
|
||||
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
|
||||
INSERT INTO t2 SELECT UUID();
|
||||
INSERT INTO t2 VALUES (@@session.sql_mode);
|
||||
INSERT INTO t2 VALUES (@@global.init_slave);
|
||||
INSERT INTO t2 VALUES (@@hostname);
|
||||
END|
|
||||
DELIMITER ;|
|
||||
|
||||
CALL proc();
|
||||
|
||||
--echo ---- Insert from stored function ----
|
||||
|
||||
DELIMITER |;
|
||||
CREATE FUNCTION func()
|
||||
RETURNS INT
|
||||
BEGIN
|
||||
INSERT INTO t1 VALUES (@@global.sync_binlog);
|
||||
INSERT INTO t1 VALUES (@@session.insert_id);
|
||||
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
|
||||
INSERT INTO t2 SELECT UUID();
|
||||
INSERT INTO t2 VALUES (@@session.sql_mode);
|
||||
INSERT INTO t2 VALUES (@@global.init_slave);
|
||||
INSERT INTO t2 VALUES (@@hostname);
|
||||
RETURN 0;
|
||||
END|
|
||||
DELIMITER ;|
|
||||
|
||||
SELECT func();
|
||||
|
||||
--echo ---- Insert from trigger ----
|
||||
|
||||
DELIMITER |;
|
||||
CREATE TRIGGER trig
|
||||
BEFORE INSERT ON trigger_table
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO t1 VALUES (@@global.sync_binlog);
|
||||
INSERT INTO t1 VALUES (@@session.insert_id);
|
||||
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
|
||||
INSERT INTO t2 SELECT UUID();
|
||||
INSERT INTO t2 VALUES (@@session.sql_mode);
|
||||
INSERT INTO t2 VALUES (@@global.init_slave);
|
||||
INSERT INTO t2 VALUES (@@hostname);
|
||||
END|
|
||||
DELIMITER ;|
|
||||
|
||||
INSERT INTO trigger_table VALUES ('bye.');
|
||||
|
||||
--echo ---- Insert from prepared statement ----
|
||||
|
||||
PREPARE p1 FROM 'INSERT INTO t1 VALUES (@@global.sync_binlog)';
|
||||
PREPARE p2 FROM 'INSERT INTO t1 VALUES (@@session.insert_id)';
|
||||
PREPARE p3 FROM 'INSERT INTO t1 VALUES (@@global.auto_increment_increment)';
|
||||
PREPARE p4 FROM 'INSERT INTO t2 SELECT UUID()';
|
||||
PREPARE p5 FROM 'INSERT INTO t2 VALUES (@@session.sql_mode)';
|
||||
PREPARE p6 FROM 'INSERT INTO t2 VALUES (@@global.init_slave)';
|
||||
PREPARE p7 FROM 'INSERT INTO t2 VALUES (@@hostname)';
|
||||
|
||||
EXECUTE p1; EXECUTE p2; EXECUTE p3; EXECUTE p4; EXECUTE p5;
|
||||
EXECUTE p6; EXECUTE p7;
|
||||
|
||||
--echo ---- Insert from nested call of triggers / functions / procedures ----
|
||||
|
||||
DELIMITER |;
|
||||
|
||||
# proc1: cause trigger 'trig' above to be triggered.
|
||||
CREATE PROCEDURE proc1()
|
||||
INSERT INTO trigger_table VALUES ('ha!')|
|
||||
|
||||
# func2: call proc1 above.
|
||||
CREATE FUNCTION func2()
|
||||
RETURNS INT
|
||||
BEGIN
|
||||
CALL proc1();
|
||||
RETURN 0;
|
||||
INSERT INTO autoinc_table VALUES (NULL);
|
||||
END|
|
||||
|
||||
# trig3: call func2 above
|
||||
CREATE TRIGGER trig3
|
||||
BEFORE INSERT ON trigger_table2
|
||||
FOR EACH ROW
|
||||
CREATE FUNCTION multi_unsafe_func() RETURNS INT
|
||||
BEGIN
|
||||
DECLARE tmp INT;
|
||||
SELECT func2() INTO tmp;
|
||||
INSERT INTO t0 VALUES(CONCAT(@@hostname, @@hostname));
|
||||
INSERT INTO t0 VALUES(0);
|
||||
INSERT INTO t0 VALUES(CONCAT(UUID(), @@hostname));
|
||||
RETURN 1;
|
||||
END|
|
||||
--DELIMITER ;
|
||||
|
||||
# proc4: cause trig3 above to be triggered.
|
||||
CREATE PROCEDURE proc4()
|
||||
INSERT INTO trigger_table2 VALUES (1)|
|
||||
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
|
||||
--eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB"
|
||||
|
||||
# func5: call proc4 above.
|
||||
CREATE FUNCTION func5()
|
||||
RETURNS INT
|
||||
BEGIN
|
||||
CALL proc4;
|
||||
RETURN 0;
|
||||
END|
|
||||
# In each iteration of this loop, we select one method to make the
|
||||
# statement unsafe.
|
||||
--let $unsafe_type= 0
|
||||
while (`SELECT $unsafe_type < 9`) {
|
||||
|
||||
# prep6: call func5() above.
|
||||
PREPARE prep6 FROM 'SELECT func5()'|
|
||||
--echo
|
||||
|
||||
DELIMITER ;|
|
||||
if (`SELECT $unsafe_type = 0`) {
|
||||
--echo ==== Testing UUID() unsafeness ====
|
||||
--let $desc_0= unsafe UUID() function
|
||||
--let $stmt_sidef_0= INSERT INTO t0 VALUES (UUID())
|
||||
--let $value_0= UUID()
|
||||
--let $sel_sidef_0=
|
||||
--let $sel_retval_0= SELECT UUID()
|
||||
--let $CRC_ARG_expected_number_of_warnings= 1
|
||||
}
|
||||
|
||||
# try a complicated call path to trigger 'trig'.
|
||||
EXECUTE prep6;
|
||||
if (`SELECT $unsafe_type = 1`) {
|
||||
--echo ==== Testing @@hostname unsafeness ====
|
||||
--let $desc_0= unsafe @@hostname variable
|
||||
--let $stmt_sidef_0= INSERT INTO t0 VALUES (@@hostname)
|
||||
--let $value_0= @@hostname
|
||||
--let $sel_sidef_0=
|
||||
# $sel_retval is going to be used in views. Views cannot execute
|
||||
# statements that refer to @@variables. Hence, we set $set_retval
|
||||
# to empty instead of SELECT @@hostname.
|
||||
--let $sel_retval_0=
|
||||
--let $CRC_ARG_expected_number_of_warnings= 1
|
||||
}
|
||||
|
||||
if (`SELECT $unsafe_type = 2`) {
|
||||
--echo ==== Testing SELECT...LIMIT unsafeness ====
|
||||
--let $desc_0= unsafe SELECT...LIMIT statement
|
||||
--let $stmt_sidef_0= INSERT INTO t0 SELECT * FROM data_table LIMIT 1
|
||||
--let $value_0=
|
||||
--let $sel_sidef_0=
|
||||
--let $sel_retval_0= SELECT * FROM data_table LIMIT 1
|
||||
--let $CRC_ARG_expected_number_of_warnings= 1
|
||||
}
|
||||
|
||||
if (`SELECT $unsafe_type = 3`) {
|
||||
--echo ==== Testing INSERT DELAYED unsafeness ====
|
||||
--let $desc_0= unsafe INSERT DELAYED statement
|
||||
--let $stmt_sidef_0= INSERT DELAYED INTO t0 VALUES (1), (2)
|
||||
--let $value_0=
|
||||
--let $sel_sidef_0=
|
||||
--let $sel_retval_0=
|
||||
--let $CRC_ARG_expected_number_of_warnings= 1
|
||||
}
|
||||
|
||||
if (`SELECT $unsafe_type = 4`) {
|
||||
--echo ==== Testing unsafeness of insert of two autoinc values ====
|
||||
--let $desc_0= unsafe update of two autoinc columns
|
||||
--let $stmt_sidef_0= INSERT INTO double_autoinc_table VALUES (NULL)
|
||||
--let $value_0=
|
||||
--let $sel_sidef_0=
|
||||
--let $sel_retval_0=
|
||||
--let $CRC_ARG_expected_number_of_warnings= 1
|
||||
}
|
||||
|
||||
if (`SELECT $unsafe_type = 5`) {
|
||||
--echo ==== Testing unsafeness of UDF's ====
|
||||
--let $desc_0= unsafe UDF
|
||||
--let $stmt_sidef_0= INSERT INTO t0 VALUES (myfunc_int(10))
|
||||
--let $value_0= myfunc_int(10)
|
||||
--let $sel_sidef_0= SELECT myfunc_int(10)
|
||||
--let $sel_retval_0=
|
||||
--let $CRC_ARG_expected_number_of_warnings= 1
|
||||
}
|
||||
|
||||
if (`SELECT $unsafe_type = 6`) {
|
||||
--echo ==== Testing unsafeness of access to mysql.general_log ====
|
||||
--let $desc_0= unsafe use of mysql.general_log
|
||||
--let $stmt_sidef_0= INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log
|
||||
--let $value_0=
|
||||
--let $sel_sidef_0=
|
||||
--let $sel_retval_0= SELECT COUNT(*) FROM mysql.general_log
|
||||
--let $CRC_ARG_expected_number_of_warnings= 1
|
||||
}
|
||||
|
||||
if (`SELECT $unsafe_type = 7`) {
|
||||
--echo ==== Testing a statement that is unsafe in many ways ====
|
||||
--let $desc_0= statement that is unsafe in many ways
|
||||
# Concatenate three unsafe values, and then concatenate NULL to
|
||||
# that so that the result is NULL and we instead use autoinc.
|
||||
--let $stmt_sidef_0= INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1
|
||||
--let $value_0=
|
||||
--let $sel_sidef_0=
|
||||
--let $sel_retval_0=
|
||||
--let $CRC_ARG_expected_number_of_warnings= 7
|
||||
}
|
||||
|
||||
if (`SELECT $unsafe_type = 8`) {
|
||||
--echo ==== Testing a statement that is unsafe several times ====
|
||||
--let $desc_0= statement that is unsafe several times
|
||||
--let $stmt_sidef_0= INSERT INTO ta0 VALUES (multi_unsafe_func())
|
||||
--let $value_0=
|
||||
--let $sel_sidef_0= SELECT multi_unsafe_func()
|
||||
--let $sel_retval_0=
|
||||
--let $CRC_ARG_expected_number_of_warnings= 2
|
||||
}
|
||||
|
||||
# In each iteration of the following loop, we select one way to
|
||||
# enclose the unsafe statement as a sub-statement of a recursive
|
||||
# construct (i.e., a function, procedure, trigger, view, or prepared
|
||||
# statement).
|
||||
#
|
||||
# In the last iteration, $call_type_1=7, we don't create a recursive
|
||||
# construct. Instead, we just invoke the unsafe statement directly.
|
||||
|
||||
--let $call_type_1= 0
|
||||
while (`SELECT $call_type_1 < 8`) {
|
||||
#--echo debug: level 1, types $call_type_1 -> $unsafe_type
|
||||
--let $CRC_ARG_level= 1
|
||||
--let $CRC_ARG_type= $call_type_1
|
||||
--let $CRC_ARG_stmt_sidef= $stmt_sidef_0
|
||||
--let $CRC_ARG_value= $value_0
|
||||
--let $CRC_ARG_sel_sidef= $sel_sidef_0
|
||||
--let $CRC_ARG_sel_retval= $sel_retval_0
|
||||
--let $CRC_ARG_desc= $desc_0
|
||||
--source extra/rpl_tests/create_recursive_construct.inc
|
||||
--let $stmt_sidef_1= $CRC_RET_stmt_sidef
|
||||
--let $value_1= $CRC_RET_value
|
||||
--let $sel_sidef_1= $CRC_RET_sel_sidef
|
||||
--let $sel_retval_1= $CRC_RET_sel_retval
|
||||
--let $is_toplevel_1= $CRC_RET_is_toplevel
|
||||
--let $drop_1= $CRC_RET_drop
|
||||
--let $desc_1= $CRC_RET_desc
|
||||
|
||||
# Some statements must be top-level statements, i.e., cannot be
|
||||
# called as a sub-statement of any recursive construct. (One
|
||||
# example is 'EXECUTE prepared_stmt'). When
|
||||
# create_recursive_construct.inc creates a top-level statement, it
|
||||
# sets $CRC_RET_is_toplevel=1.
|
||||
|
||||
if (!$is_toplevel_1) {
|
||||
|
||||
# In each iteration of this loop, we select one way to enclose
|
||||
# the previous recursive construct in another recursive
|
||||
# construct.
|
||||
|
||||
--let $call_type_2= 0
|
||||
while (`SELECT $call_type_2 < 7`) {
|
||||
#--echo debug: level 2, types $call_type_2 -> $call_type_1 -> $unsafe_type
|
||||
--let $CRC_ARG_level= 2
|
||||
--let $CRC_ARG_type= $call_type_2
|
||||
--let $CRC_ARG_stmt_sidef= $stmt_sidef_1
|
||||
--let $CRC_ARG_value= $value_1
|
||||
--let $CRC_ARG_sel_sidef= $sel_sidef_1
|
||||
--let $CRC_ARG_sel_retval= $sel_retval_1
|
||||
--let $CRC_ARG_desc= $desc_1
|
||||
--source extra/rpl_tests/create_recursive_construct.inc
|
||||
--let $stmt_sidef_2= $CRC_RET_stmt_sidef
|
||||
--let $value_2= $CRC_RET_value
|
||||
--let $sel_sidef_2= $CRC_RET_sel_sidef
|
||||
--let $sel_retval_2= $CRC_RET_sel_retval
|
||||
--let $is_toplevel_2= $CRC_RET_is_toplevel
|
||||
--let $drop_2= $CRC_RET_drop
|
||||
--let $desc_2= $CRC_RET_desc
|
||||
|
||||
if (!$is_toplevel_2) {
|
||||
|
||||
# Conditioned out since it makes result file really big.
|
||||
|
||||
if (0) {
|
||||
|
||||
# In each iteration of this loop, we select one way to enclose
|
||||
# the previous recursive construct in another recursive
|
||||
# construct.
|
||||
|
||||
--let $call_type_3= 0
|
||||
while (`SELECT $call_type_3 < 7`) {
|
||||
#--echo debug: level 3, types $call_type_2 -> $call_type_2 -> $call_type_1 -> $unsafe_type
|
||||
--let $CRC_ARG_level= 3
|
||||
--let $CRC_ARG_type= $call_type_3
|
||||
--let $CRC_ARG_stmt_sidef= $stmt_sidef_2
|
||||
--let $CRC_ARG_value= $value_2
|
||||
--let $CRC_ARG_sel_sidef= $sel_sidef_2
|
||||
--let $CRC_ARG_sel_retval= $sel_retval_2
|
||||
--let $CRC_ARG_desc= $desc_2
|
||||
--source extra/rpl_tests/create_recursive_construct.inc
|
||||
|
||||
# Drop created object.
|
||||
if (`SELECT '$drop_3' != ''`) {
|
||||
--eval $drop_3
|
||||
}
|
||||
--inc $call_type_3
|
||||
} # while (call_type_3)
|
||||
} # if (0)
|
||||
} # if (!is_toplevel_2)
|
||||
|
||||
# Drop created object.
|
||||
if (`SELECT '$drop_2' != ''`) {
|
||||
--eval $drop_2
|
||||
}
|
||||
--inc $call_type_2
|
||||
} # while (call_type_2)
|
||||
} # if (!is_toplevel_1)
|
||||
|
||||
# Drop created object.
|
||||
if (`SELECT '$drop_1' != ''`) {
|
||||
--eval $drop_1
|
||||
}
|
||||
--inc $call_type_1
|
||||
} # while (call_type_1)
|
||||
|
||||
--inc $unsafe_type
|
||||
} # while (unsafe_type)
|
||||
|
||||
DROP TRIGGER double_autoinc_trig;
|
||||
DROP TABLE t0, t1, t2, t3, ta0, ta1, ta2, ta3,
|
||||
autoinc_table, double_autoinc_table,
|
||||
data_table,
|
||||
trigger_table_1, trigger_table_2, trigger_table_3;
|
||||
DROP FUNCTION myfunc_int;
|
||||
DROP FUNCTION multi_unsafe_func;
|
||||
|
||||
|
||||
--echo ==== Variables that should *not* be unsafe ====
|
||||
--echo ==== Special system variables that should *not* be unsafe ====
|
||||
|
||||
CREATE TABLE t1 (a VARCHAR(1000));
|
||||
CREATE TABLE autoinc_table (a INT PRIMARY KEY AUTO_INCREMENT);
|
||||
|
||||
INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
|
||||
INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
|
||||
INSERT INTO t1 VALUES (@@session.foreign_key_checks);
|
||||
INSERT INTO t1 VALUES (@@session.sql_auto_is_null);
|
||||
INSERT INTO t1 VALUES (@@session.unique_checks);
|
||||
INSERT INTO t1 VALUES (@@session.auto_increment_increment);
|
||||
INSERT INTO t1 VALUES (@@session.auto_increment_offset);
|
||||
INSERT INTO t2 VALUES (@@session.character_set_client);
|
||||
INSERT INTO t2 VALUES (@@session.collation_connection);
|
||||
INSERT INTO t2 VALUES (@@session.collation_server);
|
||||
INSERT INTO t2 VALUES (@@session.time_zone);
|
||||
INSERT INTO t2 VALUES (@@session.lc_time_names);
|
||||
INSERT INTO t2 VALUES (@@session.collation_database);
|
||||
INSERT INTO t2 VALUES (@@session.timestamp);
|
||||
INSERT INTO t2 VALUES (@@session.last_insert_id);
|
||||
INSERT INTO t1 VALUES (@@session.character_set_client);
|
||||
INSERT INTO t1 VALUES (@@session.character_set_connection);
|
||||
INSERT INTO t1 VALUES (@@session.character_set_database);
|
||||
INSERT INTO t1 VALUES (@@session.character_set_server);
|
||||
INSERT INTO t1 VALUES (@@session.collation_connection);
|
||||
INSERT INTO t1 VALUES (@@session.collation_database);
|
||||
INSERT INTO t1 VALUES (@@session.collation_server);
|
||||
INSERT INTO t1 VALUES (@@session.foreign_key_checks);
|
||||
INSERT INTO t1 VALUES (@@session.identity);
|
||||
INSERT INTO t1 VALUES (@@session.last_insert_id);
|
||||
INSERT INTO t1 VALUES (@@session.lc_time_names);
|
||||
INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
|
||||
INSERT INTO t1 VALUES (@@session.sql_auto_is_null);
|
||||
INSERT INTO t1 VALUES (@@session.timestamp);
|
||||
INSERT INTO t1 VALUES (@@session.time_zone);
|
||||
INSERT INTO t1 VALUES (@@session.unique_checks);
|
||||
|
||||
SET @my_var= 4711;
|
||||
INSERT INTO t1 VALUES (@my_var);
|
||||
|
||||
# using insert_id implicitly should be ok.
|
||||
SET insert_id=12;
|
||||
INSERT INTO t3 VALUES (NULL);
|
||||
SET insert_id= 12;
|
||||
INSERT INTO autoinc_table VALUES (NULL);
|
||||
|
||||
# See set_var.cc for explanation.
|
||||
--echo The following variables *should* give a warning, despite they are replicated.
|
||||
INSERT INTO t1 VALUES (@@session.sql_mode);
|
||||
INSERT INTO t1 VALUES (@@session.insert_id);
|
||||
|
||||
|
||||
--echo ==== Clean up ====
|
||||
DROP TABLE t1, autoinc_table;
|
||||
|
||||
|
||||
DROP PROCEDURE proc;
|
||||
DROP FUNCTION func;
|
||||
DROP TRIGGER trig;
|
||||
DROP PROCEDURE proc1;
|
||||
DROP FUNCTION func2;
|
||||
DROP TRIGGER trig3;
|
||||
DROP PROCEDURE proc4;
|
||||
DROP FUNCTION func5;
|
||||
DROP PREPARE prep6;
|
||||
DROP TABLE t1, t2, t3, trigger_table, trigger_table2;
|
||||
#
|
||||
# BUG#34768 - nondeterministic INSERT using LIMIT logged in stmt mode if
|
||||
# binlog_format=mixed
|
||||
@@ -391,6 +542,109 @@ DELETE FROM t1 LIMIT 1;
|
||||
DROP TABLE t1, t2;
|
||||
SET @@SESSION.SQL_MODE = @save_sql_mode;
|
||||
|
||||
#
|
||||
# BUG#45825: INSERT DELAYED is not unsafe: logged in statement format
|
||||
# BUG#45785: LIMIT in SP does not cause RBL if binlog_format=MIXED
|
||||
#
|
||||
SET @old_binlog_format = @@session.binlog_format;
|
||||
SET binlog_format = MIXED;
|
||||
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE t2 (a INT);
|
||||
INSERT INTO t2 VALUES (1), (2);
|
||||
|
||||
--DELIMITER |
|
||||
CREATE PROCEDURE proc_insert_delayed ()
|
||||
BEGIN
|
||||
INSERT DELAYED INTO t1 VALUES (1), (2);
|
||||
END|
|
||||
|
||||
CREATE FUNCTION func_limit ()
|
||||
RETURNS INT
|
||||
BEGIN
|
||||
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
|
||||
RETURN 1;
|
||||
END|
|
||||
--DELIMITER ;
|
||||
|
||||
RESET MASTER;
|
||||
CALL proc_insert_delayed();
|
||||
SELECT func_limit();
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
SET @@session.binlog_format = @old_binlog_format;
|
||||
DROP TABLE t1, t2;
|
||||
DROP PROCEDURE proc_insert_delayed;
|
||||
DROP FUNCTION func_limit;
|
||||
|
||||
#
|
||||
# BUG#45827
|
||||
# The test verifies if stmt that have more than one
|
||||
# different tables to update with autoinc columns
|
||||
# will produce unsafe warning
|
||||
#
|
||||
|
||||
# Test case1: stmt that have more than one different tables
|
||||
# to update with autoinc columns should produce
|
||||
# unsafe warning when calling a function
|
||||
CREATE TABLE t1 (a INT, b INT PRIMARY KEY AUTO_INCREMENT);
|
||||
CREATE TABLE t2 (a INT, b INT PRIMARY KEY AUTO_INCREMENT);
|
||||
|
||||
# The purpose of this function is to insert into t1 so that the second
|
||||
# column is auto_increment'ed.
|
||||
DELIMITER |;
|
||||
CREATE FUNCTION func_modify_t1 ()
|
||||
RETURNS INT
|
||||
BEGIN
|
||||
INSERT INTO t1 SET a = 1;
|
||||
RETURN 0;
|
||||
END|
|
||||
DELIMITER ;|
|
||||
--echo # The following statement causes auto-incrementation
|
||||
--echo # of both t1 and t2. It is logged in statement format,
|
||||
--echo # so it should produce unsafe warning.
|
||||
INSERT INTO t2 SET a = func_modify_t1();
|
||||
|
||||
SET SESSION binlog_format = MIXED;
|
||||
--echo # Check if the statement is logged in row format.
|
||||
let $pos0_master= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
INSERT INTO t2 SET a = func_modify_t1();
|
||||
eval SHOW BINLOG EVENTS FROM $pos0_master;
|
||||
|
||||
# clean up
|
||||
DROP TABLE t1,t2;
|
||||
DROP FUNCTION func_modify_t1;
|
||||
#
|
||||
# Test case2: stmt that have more than one different tables
|
||||
# to update with autoinc columns should produce
|
||||
# unsafe warning when invoking a trigger
|
||||
SET SESSION binlog_format = STATEMENT;
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE t2 (a INT, b INT PRIMARY KEY AUTO_INCREMENT);
|
||||
CREATE TABLE t3 (a INT, b INT PRIMARY KEY AUTO_INCREMENT);
|
||||
|
||||
# The purpose of this function is to insert into t1 so that the second
|
||||
# column is auto_increment'ed.
|
||||
delimiter |;
|
||||
create trigger tri_modify_two_tables before insert on t1 for each row begin
|
||||
insert into t2(a) values(new.a);
|
||||
insert into t3(a) values(new.a);
|
||||
end |
|
||||
delimiter ;|
|
||||
--echo # The following statement causes auto-incrementation
|
||||
--echo # of both t2 and t3. It is logged in statement format,
|
||||
--echo # so it should produce unsafe warning
|
||||
INSERT INTO t1 SET a = 1;
|
||||
|
||||
SET SESSION binlog_format = MIXED;
|
||||
--echo # Check if the statement is logged in row format.
|
||||
let $pos1_master= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
INSERT INTO t1 SET a = 2;
|
||||
eval SHOW BINLOG EVENTS FROM $pos1_master;
|
||||
|
||||
# clean up
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
||||
#
|
||||
# BUG#47995: Mark user functions as unsafe
|
||||
# BUG#49222: Mare RAND() unsafe
|
||||
@@ -399,6 +653,7 @@ SET @@SESSION.SQL_MODE = @save_sql_mode;
|
||||
# generate a warning. Each INSERT statement below should generate a
|
||||
# warning.
|
||||
#
|
||||
SET SESSION binlog_format = STATEMENT;
|
||||
|
||||
CREATE TABLE t1 (a VARCHAR(1000));
|
||||
INSERT INTO t1 VALUES (CURRENT_USER()); #marked unsafe before BUG#47995
|
||||
|
@@ -15,6 +15,7 @@
|
||||
|
||||
source include/have_log_bin.inc;
|
||||
source include/have_debug.inc;
|
||||
source include/have_binlog_format_mixed_or_statement.inc;
|
||||
|
||||
--echo #
|
||||
--echo # Initialization
|
||||
|
@@ -10,4 +10,5 @@
|
||||
#
|
||||
##############################################################################
|
||||
binlog_truncate_innodb : BUG#42643 2009-02-06 mats Changes to InnoDB requires to complete fix for BUG#36763
|
||||
binlog_unsafe : BUG#50312 2010-01-13 lsoares Warnings for unsafe sub-statement not returned to client
|
||||
|
||||
|
Reference in New Issue
Block a user