| 1 |
--source include/have_binlog_format_row.inc |
| 2 |
--source include/have_innodb.inc |
| 3 |
--source include/master-slave.inc |
| 4 |
|
| 5 |
--connection master |
| 6 |
set @max_binlog_cache_size = @@global.max_binlog_cache_size; |
| 7 |
set @binlog_cache_size = @@global.binlog_cache_size; |
| 8 |
set @@global.max_binlog_cache_size = 4096; |
| 9 |
set @@global. binlog_cache_size = 4096; |
| 10 |
|
| 11 |
--echo # |
| 12 |
--echo # MDEV-35207 ignored error at binlogging by CREATE-TABLE-SELECT leads to assert |
| 13 |
--echo # |
| 14 |
# fix the current (write) binlog position |
| 15 |
--let $binlog_file_0= query_get_value(SHOW MASTER STATUS, File, 1) |
| 16 |
--let $binlog_start_0 = query_get_value(SHOW MASTER STATUS, Position, 1) |
| 17 |
|
| 18 |
# use a separate connection also to validate its close will be clean |
| 19 |
connect (conn_err,localhost,root,,); |
| 20 |
|
| 21 |
call mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage"); |
| 22 |
--error ER_TRANS_CACHE_FULL |
| 23 |
create table t engine=myisam select repeat ('a',4096*3) AS a; |
| 24 |
|
| 25 |
--error ER_TRANS_CACHE_FULL |
| 26 |
create table t engine=innodb select repeat ('a',4096*3) AS a; |
| 27 |
|
| 28 |
--error ER_DUP_ENTRY |
| 29 |
create table t (a int unique, b char) select 1 AS a, 'b' as b union select 1 as a, 'c' as b; |
| 30 |
--error ER_NO_SUCH_TABLE |
| 31 |
select * from t; |
| 32 |
|
| 33 |
--disconnect conn_err |
| 34 |
|
| 35 |
--connection master |
| 36 |
--let $binlog_file_1= query_get_value(SHOW MASTER STATUS, File, 1) |
| 37 |
--let $binlog_start_1= query_get_value(SHOW MASTER STATUS, Position, 1) |
| 38 |
|
| 39 |
--let $cmp = `select strcmp('$binlog_file_1', '$binlog_file_0') <> 0 OR $binlog_start_1 <> $binlog_start_0` |
| 40 |
if (!$cmp) |
| 41 |
{ |
| 42 |
--echo *** Error: unexpected advance of binlog position |
| 43 |
--die |
| 44 |
} |
| 45 |
|
| 46 |
--echo |
| 47 |
--echo # |
| 48 |
--echo # MDEV-35499 errored CREATE-OR-REPLACE-SELECT does not DROP table in binlog |
| 49 |
--echo # |
| 50 |
--let $i = 2 |
| 51 |
while ($i) |
| 52 |
{ |
| 53 |
--let $engine=`select if($i % 2, "myisam", "innodb")` |
| 54 |
--echo # |
| 55 |
--echo # Engine = $engine |
| 56 |
--echo # |
| 57 |
set statement binlog_format=statement for create table t (a int) select 1 as a; |
| 58 |
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) |
| 59 |
--let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1) |
| 60 |
--error ER_DUP_ENTRY |
| 61 |
--eval set statement binlog_format=row for create or replace table t (a int primary key, b char) engine=$engine select 1 AS a, 'b' as b union select 1 as a, 'c' as b |
| 62 |
--error ER_NO_SUCH_TABLE |
| 63 |
select * from t; |
| 64 |
--echo # |
| 65 |
--echo # Prove an expected lonely `DROP table t' |
| 66 |
--source include/show_binlog_events.inc |
| 67 |
|
| 68 |
# error before stmt commit |
| 69 |
set statement binlog_format=statement for create table t (a int) select 1 as a; |
| 70 |
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) |
| 71 |
--let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1) |
| 72 |
--error ER_TRANS_CACHE_FULL |
| 73 |
--eval set statement binlog_format=row for create or replace table t (a text) engine=$engine select repeat ('a',1024) AS a union select repeat ('a',3*4096) AS a union select repeat ('a',3*4096) AS a |
| 74 |
--error ER_NO_SUCH_TABLE |
| 75 |
select * from t; |
| 76 |
--echo # |
| 77 |
--echo # Prove an expected lonely `DROP table t' |
| 78 |
--source include/show_binlog_events.inc |
| 79 |
|
| 80 |
# error at stmt commit |
| 81 |
set statement binlog_format=statement for create table t (a int) select 1 as a; |
| 82 |
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) |
| 83 |
--let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1) |
| 84 |
--error ER_TRANS_CACHE_FULL |
| 85 |
--eval set statement binlog_format=row for create or replace table t (a text) engine=$engine select repeat ('a',4096*3) AS a; |
| 86 |
--error ER_NO_SUCH_TABLE |
| 87 |
select * from t; |
| 88 |
--echo # |
| 89 |
--echo # Prove an expected lonely `DROP table t' |
| 90 |
--source include/show_binlog_events.inc |
| 91 |
|
| 92 |
--dec $i |
| 93 |
} |
| 94 |
|
| 95 |
# Tests of mixed engines to demonstrate non-transaction table updates |
| 96 |
# are binlogged or otherwise MDEV-36027. |
| 97 |
create table ti_pk (a int primary key) engine=innodb; |
| 98 |
create table ta (a int) engine=aria; |
| 99 |
delimiter |; |
| 100 |
create function f_ia(arg int) |
| 101 |
returns integer |
| 102 |
begin |
| 103 |
insert into ti_pk set a=1; |
| 104 |
insert into ta set a=1; |
| 105 |
insert into ti_pk set a=arg; |
| 106 |
return 1; |
| 107 |
end | |
| 108 |
delimiter ;| |
| 109 |
|
| 110 |
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) |
| 111 |
--let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1) |
| 112 |
|
| 113 |
--error ER_DUP_ENTRY |
| 114 |
set statement binlog_format = ROW for create table t_y (a int) engine=aria select f_ia(1 /* err */) as a; |
| 115 |
--error ER_NO_SUCH_TABLE |
| 116 |
select * from t_y; |
| 117 |
|
| 118 |
--echo # correct execution: `ta` is modified and its new record is binlogged |
| 119 |
--source include/show_binlog_events.inc |
| 120 |
select * from ta; |
| 121 |
select * from ti_pk; |
| 122 |
|
| 123 |
--sync_slave_with_master |
| 124 |
--let $diff_tables=master:ta,slave:ta |
| 125 |
--source include/diff_tables.inc |
| 126 |
|
| 127 |
--connection master |
| 128 |
delete from ta; |
| 129 |
--sync_slave_with_master |
| 130 |
|
| 131 |
--connection master |
| 132 |
# MDEV-36027 Errored-out CREATE-SELECT does not binlog results of any function modifying non-transactional table |
| 133 |
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) |
| 134 |
--let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1) |
| 135 |
--error ER_DUP_ENTRY |
| 136 |
set statement binlog_format = STATEMENT for create table t_y (a int) engine=aria select f_ia(1 /* err */) as a; |
| 137 |
--error ER_NO_SUCH_TABLE |
| 138 |
select * from t_y; |
| 139 |
|
| 140 |
--echo # ***TODO: fix MDEV-36027***. As of now `ta` is modified but that's not binlogged |
| 141 |
--source include/show_binlog_events.inc |
| 142 |
select *,'on_master' from ta; |
| 143 |
select * from ti_pk; |
| 144 |
|
| 145 |
--sync_slave_with_master |
| 146 |
select *,'on_slave' from ta; |
| 147 |
|
| 148 |
# Cleanup |
| 149 |
--connection master |
| 150 |
drop function f_ia; |
| 151 |
drop table ti_pk, ta; |
| 152 |
|
| 153 |
SET @@global.max_binlog_cache_size = @max_binlog_cache_size; |
| 154 |
SET @@global. binlog_cache_size = @binlog_cache_size; |
| 155 |
|
| 156 |
# test that binlog replicates correctly to slave |
| 157 |
# --connection slave |
| 158 |
--sync_slave_with_master |
| 159 |
|
| 160 |
--echo End of the tests |
| 161 |
--source include/rpl_end.inc |