mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Manual merge from mysql-next-mr.
Conflicts: - sql/log_event.cc - sql/sql_class.h
This commit is contained in:
@ -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;
|
@ -745,8 +745,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 # Intvar # # INSERT_ID=3
|
||||
master-bin.000001 # Query # # use `test`; insert into t2 values (bug27417(2))
|
||||
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 # # COMMIT
|
||||
select count(*) from t1 /* must be 3 */;
|
||||
count(*)
|
||||
@ -762,8 +763,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 # Intvar # # INSERT_ID=4
|
||||
master-bin.000001 # Query # # use `test`; delete from t2 where a=bug27417(3)
|
||||
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 # # COMMIT
|
||||
select count(*) from t1 /* must be 5 */;
|
||||
count(*)
|
||||
@ -785,6 +787,10 @@ insert into t2 values (bug27417(1));
|
||||
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.t1)
|
||||
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
|
||||
@ -796,6 +802,10 @@ insert into t2 select bug27417(1) union select 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 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
select count(*) from t1 /* must be 2 */;
|
||||
count(*)
|
||||
2
|
||||
@ -807,8 +817,11 @@ 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 # Table_map # # table_id: # (test.t3)
|
||||
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 # # COMMIT
|
||||
select count(*) from t1 /* must be 2 */;
|
||||
count(*)
|
||||
@ -822,6 +835,10 @@ UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */;
|
||||
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.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
select count(*) from t1 /* must be 4 */;
|
||||
count(*)
|
||||
4
|
||||
@ -835,7 +852,7 @@ UPDATE t3,t4 SET t3.a=t4.a + bug27417(1);
|
||||
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
|
||||
select count(*) from t1 /* must be 1 */;
|
||||
count(*)
|
||||
1
|
||||
2
|
||||
drop table t4;
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
@ -849,6 +866,11 @@ delete from t2;
|
||||
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.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 # # COMMIT
|
||||
select count(*) from t1 /* must be 1 */;
|
||||
count(*)
|
||||
1
|
||||
@ -865,6 +887,10 @@ delete t2.* from t2,t5 where t2.a=t5.a + 1;
|
||||
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.t1)
|
||||
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
|
||||
@ -882,6 +908,10 @@ 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.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
drop trigger trg_del_t2;
|
||||
drop table t1,t2,t3,t4,t5;
|
||||
drop function bug27417;
|
||||
|
@ -520,10 +520,10 @@ 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
|
||||
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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
|
||||
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'
|
||||
@ -543,7 +543,7 @@ 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
|
||||
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
|
||||
@ -560,7 +560,7 @@ count(*)
|
||||
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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
|
||||
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
|
||||
@ -784,10 +784,10 @@ 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
|
||||
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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
|
||||
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'
|
||||
@ -806,7 +806,7 @@ 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
|
||||
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
|
||||
@ -822,7 +822,7 @@ count(*)
|
||||
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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
|
||||
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
|
||||
|
@ -1,5 +1,6 @@
|
||||
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));
|
||||
@ -50,3 +51,29 @@ 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;
|
@ -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;
|
||||
|
@ -27,6 +27,7 @@
|
||||
-- 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
|
||||
|
||||
@ -117,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;
|
Reference in New Issue
Block a user