|
| 1 | +include/master-slave.inc |
| 2 | +[connection master] |
| 3 | +connection master; |
| 4 | +set @max_binlog_cache_size = @@global.max_binlog_cache_size; |
| 5 | +set @binlog_cache_size = @@global.binlog_cache_size; |
| 6 | +set @@global.max_binlog_cache_size = 4096; |
| 7 | +set @@global. binlog_cache_size = 4096; |
| 8 | +# |
| 9 | +# MDEV-35207 ignored error at binlogging by CREATE-TABLE-SELECT leads to assert |
| 10 | +# |
| 11 | +connect conn_err,localhost,root,,; |
| 12 | +call mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage"); |
| 13 | +create table t engine=myisam select repeat ('a',4096*3) AS a; |
| 14 | +ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again |
| 15 | +create table t engine=innodb select repeat ('a',4096*3) AS a; |
| 16 | +ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again |
| 17 | +create table t (a int unique, b char) select 1 AS a, 'b' as b union select 1 as a, 'c' as b; |
| 18 | +ERROR 23000: Duplicate entry '1' for key 'a' |
| 19 | +select * from t; |
| 20 | +ERROR 42S02: Table 'test.t' doesn't exist |
| 21 | +disconnect conn_err; |
| 22 | +connection master; |
| 23 | + |
| 24 | +# |
| 25 | +# MDEV-35499 errored CREATE-OR-REPLACE-SELECT does not DROP table in binlog |
| 26 | +# |
| 27 | +# |
| 28 | +# Engine = innodb |
| 29 | +# |
| 30 | +set statement binlog_format=statement for create table t (a int) select 1 as a; |
| 31 | +set statement binlog_format=row for create or replace table t (a int primary key, b char) engine=innodb select 1 AS a, 'b' as b union select 1 as a, 'c' as b; |
| 32 | +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' |
| 33 | +select * from t; |
| 34 | +ERROR 42S02: Table 'test.t' doesn't exist |
| 35 | +# |
| 36 | +# Prove an expected lonely `DROP table t' |
| 37 | +include/show_binlog_events.inc |
| 38 | +Log_name Pos Event_type Server_id End_log_pos Info |
| 39 | +master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 40 | +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */ |
| 41 | +master-bin.000001 # Query # # ROLLBACK |
| 42 | +set statement binlog_format=statement for create table t (a int) select 1 as a; |
| 43 | +set statement binlog_format=row for create or replace table t (a text) engine=innodb select repeat ('a',1024) AS a union select repeat ('a',3*4096) AS a union select repeat ('a',3*4096) AS a; |
| 44 | +ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again |
| 45 | +select * from t; |
| 46 | +ERROR 42S02: Table 'test.t' doesn't exist |
| 47 | +# |
| 48 | +# Prove an expected lonely `DROP table t' |
| 49 | +include/show_binlog_events.inc |
| 50 | +Log_name Pos Event_type Server_id End_log_pos Info |
| 51 | +master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 52 | +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */ |
| 53 | +master-bin.000001 # Query # # ROLLBACK |
| 54 | +set statement binlog_format=statement for create table t (a int) select 1 as a; |
| 55 | +set statement binlog_format=row for create or replace table t (a text) engine=innodb select repeat ('a',4096*3) AS a;; |
| 56 | +ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again |
| 57 | +select * from t; |
| 58 | +ERROR 42S02: Table 'test.t' doesn't exist |
| 59 | +# |
| 60 | +# Prove an expected lonely `DROP table t' |
| 61 | +include/show_binlog_events.inc |
| 62 | +Log_name Pos Event_type Server_id End_log_pos Info |
| 63 | +master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 64 | +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */ |
| 65 | +master-bin.000001 # Query # # ROLLBACK |
| 66 | +# |
| 67 | +# Engine = myisam |
| 68 | +# |
| 69 | +set statement binlog_format=statement for create table t (a int) select 1 as a; |
| 70 | +set statement binlog_format=row for create or replace table t (a int primary key, b char) engine=myisam select 1 AS a, 'b' as b union select 1 as a, 'c' as b; |
| 71 | +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' |
| 72 | +select * from t; |
| 73 | +ERROR 42S02: Table 'test.t' doesn't exist |
| 74 | +# |
| 75 | +# Prove an expected lonely `DROP table t' |
| 76 | +include/show_binlog_events.inc |
| 77 | +Log_name Pos Event_type Server_id End_log_pos Info |
| 78 | +master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 79 | +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */ |
| 80 | +master-bin.000001 # Query # # ROLLBACK |
| 81 | +set statement binlog_format=statement for create table t (a int) select 1 as a; |
| 82 | +set statement binlog_format=row for create or replace table t (a text) engine=myisam select repeat ('a',1024) AS a union select repeat ('a',3*4096) AS a union select repeat ('a',3*4096) AS a; |
| 83 | +ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again |
| 84 | +select * from t; |
| 85 | +ERROR 42S02: Table 'test.t' doesn't exist |
| 86 | +# |
| 87 | +# Prove an expected lonely `DROP table t' |
| 88 | +include/show_binlog_events.inc |
| 89 | +Log_name Pos Event_type Server_id End_log_pos Info |
| 90 | +master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 91 | +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */ |
| 92 | +master-bin.000001 # Query # # ROLLBACK |
| 93 | +set statement binlog_format=statement for create table t (a int) select 1 as a; |
| 94 | +set statement binlog_format=row for create or replace table t (a text) engine=myisam select repeat ('a',4096*3) AS a;; |
| 95 | +ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again |
| 96 | +select * from t; |
| 97 | +ERROR 42S02: Table 'test.t' doesn't exist |
| 98 | +# |
| 99 | +# Prove an expected lonely `DROP table t' |
| 100 | +include/show_binlog_events.inc |
| 101 | +Log_name Pos Event_type Server_id End_log_pos Info |
| 102 | +master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 103 | +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */ |
| 104 | +master-bin.000001 # Query # # ROLLBACK |
| 105 | +create table ti_pk (a int primary key) engine=innodb; |
| 106 | +create table ta (a int) engine=aria; |
| 107 | +create function f_ia(arg int) |
| 108 | +returns integer |
| 109 | +begin |
| 110 | +insert into ti_pk set a=1; |
| 111 | +insert into ta set a=1; |
| 112 | +insert into ti_pk set a=arg; |
| 113 | +return 1; |
| 114 | +end | |
| 115 | +set statement binlog_format = ROW for create table t_y (a int) engine=aria select f_ia(1 /* err */) as a; |
| 116 | +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' |
| 117 | +select * from t_y; |
| 118 | +ERROR 42S02: Table 'test.t_y' doesn't exist |
| 119 | +# correct execution: `ta` is modified and its new record is binlogged |
| 120 | +include/show_binlog_events.inc |
| 121 | +Log_name Pos Event_type Server_id End_log_pos Info |
| 122 | +master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 123 | +master-bin.000001 # Table_map # # table_id: # (test.ta) |
| 124 | +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F |
| 125 | +master-bin.000001 # Query # # COMMIT |
| 126 | +select * from ta; |
| 127 | +a |
| 128 | +1 |
| 129 | +select * from ti_pk; |
| 130 | +a |
| 131 | +connection slave; |
| 132 | +include/diff_tables.inc [master:ta,slave:ta] |
| 133 | +connection master; |
| 134 | +delete from ta; |
| 135 | +connection slave; |
| 136 | +connection master; |
| 137 | +set statement binlog_format = STATEMENT for create table t_y (a int) engine=aria select f_ia(1 /* err */) as a; |
| 138 | +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' |
| 139 | +select * from t_y; |
| 140 | +ERROR 42S02: Table 'test.t_y' doesn't exist |
| 141 | +# ***TODO: fix MDEV-36027***. As of now `ta` is modified but that's not binlogged |
| 142 | +include/show_binlog_events.inc |
| 143 | +select *,'on_master' from ta; |
| 144 | +a on_master |
| 145 | +1 on_master |
| 146 | +select * from ti_pk; |
| 147 | +a |
| 148 | +connection slave; |
| 149 | +select *,'on_slave' from ta; |
| 150 | +a on_slave |
| 151 | +connection master; |
| 152 | +drop function f_ia; |
| 153 | +drop table ti_pk, ta; |
| 154 | +SET @@global.max_binlog_cache_size = @max_binlog_cache_size; |
| 155 | +SET @@global. binlog_cache_size = @binlog_cache_size; |
| 156 | +connection slave; |
| 157 | +End of the tests |
| 158 | +include/rpl_end.inc |
0 commit comments