| 1 |
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); |
| 2 |
DROP TABLE IF EXISTS t1; |
| 3 |
DROP TABLE IF EXISTS t2; |
| 4 |
set @saved_global_binlog_format = @@global.binlog_format; |
| 5 |
Warnings: |
| 6 |
Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release. |
| 7 |
set @saved_local_binlog_format = @@session.binlog_format; |
| 8 |
Warnings: |
| 9 |
Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release. |
| 10 |
SET GLOBAL BINLOG_FORMAT = STATEMENT; |
| 11 |
Warnings: |
| 12 |
Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release. |
| 13 |
SET SESSION BINLOG_FORMAT = STATEMENT; |
| 14 |
Warnings: |
| 15 |
Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release. |
| 16 |
CREATE TABLE t1 (a INT); |
| 17 |
CREATE TABLE t2 LIKE t1; |
| 18 |
select @@SESSION.BINLOG_FORMAT; |
| 19 |
@@SESSION.BINLOG_FORMAT |
| 20 |
STATEMENT |
| 21 |
Warnings: |
| 22 |
Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release. |
| 23 |
INSERT INTO t1 VALUES(1); |
| 24 |
INSERT INTO t2 VALUES(2); |
| 25 |
# |
| 26 |
# Ensure that INSERT INTO .. SELECT FROM under SBR takes a read |
| 27 |
# lock that will prevent the source table from being modified. |
| 28 |
# |
| 29 |
# con1 |
| 30 |
SELECT GET_LOCK('Bug#34306', 120); |
| 31 |
GET_LOCK('Bug#34306', 120) |
| 32 |
1 |
| 33 |
# con2 |
| 34 |
PREPARE stmt FROM "INSERT INTO t1 SELECT * FROM t2 WHERE GET_LOCK('Bug#34306', 120)"; |
| 35 |
EXECUTE stmt;; |
| 36 |
# default |
| 37 |
INSERT INTO t2 VALUES (3);; |
| 38 |
# con1 |
| 39 |
SELECT RELEASE_LOCK('Bug#34306'); |
| 40 |
RELEASE_LOCK('Bug#34306') |
| 41 |
1 |
| 42 |
# con2 |
| 43 |
Warnings: |
| 44 |
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the replica. |
| 45 |
SELECT RELEASE_LOCK('Bug#34306'); |
| 46 |
RELEASE_LOCK('Bug#34306') |
| 47 |
1 |
| 48 |
# default |
| 49 |
# |
| 50 |
# Ensure that INSERT INTO .. SELECT FROM prepared under SBR does |
| 51 |
# not prevent the source table from being modified if under RBR. |
| 52 |
# |
| 53 |
# con2 |
| 54 |
SET SESSION BINLOG_FORMAT = 'ROW'; |
| 55 |
Warnings: |
| 56 |
Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release. |
| 57 |
# con1 |
| 58 |
SELECT GET_LOCK('Bug#34306', 120); |
| 59 |
GET_LOCK('Bug#34306', 120) |
| 60 |
1 |
| 61 |
# con2 |
| 62 |
EXECUTE stmt;; |
| 63 |
# default |
| 64 |
# con1 |
| 65 |
INSERT INTO t2 VALUES (4); |
| 66 |
SELECT RELEASE_LOCK('Bug#34306'); |
| 67 |
RELEASE_LOCK('Bug#34306') |
| 68 |
1 |
| 69 |
# con2 |
| 70 |
# default |
| 71 |
# Show binlog events |
| 72 |
include/show_binlog_events.inc |
| 73 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 74 |
binlog.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */ |
| 75 |
binlog.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */ |
| 76 |
binlog.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) |
| 77 |
binlog.000001 # Query # # use `test`; CREATE TABLE t2 LIKE t1 |
| 78 |
binlog.000001 # Query # # BEGIN |
| 79 |
binlog.000001 # Query # # use `test`; INSERT INTO t1 VALUES(1) |
| 80 |
binlog.000001 # Query # # COMMIT |
| 81 |
binlog.000001 # Query # # BEGIN |
| 82 |
binlog.000001 # Query # # use `test`; INSERT INTO t2 VALUES(2) |
| 83 |
binlog.000001 # Query # # COMMIT |
| 84 |
binlog.000001 # Query # # BEGIN |
| 85 |
binlog.000001 # Query # # use `test`; INSERT INTO t1 SELECT * FROM t2 WHERE GET_LOCK('Bug#34306', 120) |
| 86 |
binlog.000001 # Query # # COMMIT |
| 87 |
binlog.000001 # Query # # BEGIN |
| 88 |
binlog.000001 # Query # # use `test`; INSERT INTO t2 VALUES (3) |
| 89 |
binlog.000001 # Query # # COMMIT |
| 90 |
binlog.000001 # Query # # BEGIN |
| 91 |
binlog.000001 # Query # # use `test`; INSERT INTO t2 VALUES (4) |
| 92 |
binlog.000001 # Query # # COMMIT |
| 93 |
binlog.000001 # Query # # BEGIN |
| 94 |
binlog.000001 # Table_map # # table_id: # (test.t1) |
| 95 |
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F |
| 96 |
binlog.000001 # Query # # COMMIT |
| 97 |
DROP TABLE t1; |
| 98 |
DROP TABLE t2; |
| 99 |
SET GLOBAL BINLOG_FORMAT = @saved_global_binlog_format; |
| 100 |
Warnings: |
| 101 |
Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release. |
| 102 |
SET SESSION BINLOG_FORMAT = @saved_local_binlog_format; |
| 103 |
Warnings: |
| 104 |
Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release. |