| 1 |
set @@session.gtid_domain_id=1; |
| 2 |
set @save_gtid_stric_mode=@@global.gtid_strict_mode; |
| 3 |
create table ta (a int) engine=aria; |
| 4 |
create table ti (a int) engine=innodb; |
| 5 |
create table ti_pk (a int primary key) engine=innodb; |
| 6 |
create table t (a int) engine=innodb; |
| 7 |
create function f_i() |
| 8 |
returns integer |
| 9 |
begin |
| 10 |
insert into ti set a=1; |
| 11 |
return 1; |
| 12 |
end | |
| 13 |
create function f_ia(arg int) |
| 14 |
returns integer |
| 15 |
begin |
| 16 |
insert into ti_pk set a=1; |
| 17 |
insert into ta set a=1; |
| 18 |
insert into ti_pk set a=arg; |
| 19 |
return 1; |
| 20 |
end | |
| 21 |
call mtr.add_suppression("Error writing file"); |
| 22 |
select count(*) as zero from t; |
| 23 |
zero |
| 24 |
0 |
| 25 |
select count(*) as zero from ta; |
| 26 |
zero |
| 27 |
0 |
| 28 |
select count(*) as zero from ti; |
| 29 |
zero |
| 30 |
0 |
| 31 |
# 1. simple Innodb test |
| 32 |
set @@global.gtid_strict_mode=0; |
| 33 |
set @@session.gtid_seq_no=1; |
| 34 |
set @@global.gtid_strict_mode=1; |
| 35 |
insert into t set a=1; |
| 36 |
ERROR HY000: An attempt was made to binlog GTID VALUE which would create an out-of-order sequence number with existing GTID VALUE, and gtid strict mode is enabled |
| 37 |
# observe effective rollback |
| 38 |
select count(*) as zero from t; |
| 39 |
zero |
| 40 |
0 |
| 41 |
# 2. simple Aira test |
| 42 |
set @@global.gtid_strict_mode=0; |
| 43 |
set @@session.gtid_seq_no=1; |
| 44 |
set @@global.gtid_strict_mode=1; |
| 45 |
insert into ta values (1),(2); |
| 46 |
ERROR HY000: An attempt was made to binlog GTID VALUE which would create an out-of-order sequence number with existing GTID VALUE, and gtid strict mode is enabled |
| 47 |
# note no rollback |
| 48 |
select count(*) as '*NON-zero*' from ta; |
| 49 |
*NON-zero* |
| 50 |
2 |
| 51 |
delete from ta; |
| 52 |
# 3. multi-engine test |
| 53 |
set @@global.gtid_strict_mode=0; |
| 54 |
set @@session.gtid_seq_no=1; |
| 55 |
set @@global.gtid_strict_mode=1; |
| 56 |
insert into ta set a=f_i(); |
| 57 |
ERROR HY000: An attempt was made to binlog GTID VALUE which would create an out-of-order sequence number with existing GTID VALUE, and gtid strict mode is enabled |
| 58 |
# note no rollback.. |
| 59 |
select count(*) as one from ta; |
| 60 |
one |
| 61 |
1 |
| 62 |
# ..except transactional engine |
| 63 |
select count(*) as zero from ti; |
| 64 |
zero |
| 65 |
0 |
| 66 |
delete from ta; |
| 67 |
set @@global.gtid_strict_mode=0; |
| 68 |
set @@session.gtid_seq_no=1; |
| 69 |
set @@global.gtid_strict_mode=1; |
| 70 |
insert into t set a=f_ia(0); |
| 71 |
ERROR HY000: An attempt was made to binlog GTID VALUE which would create an out-of-order sequence number with existing GTID VALUE, and gtid strict mode is enabled |
| 72 |
# note no rollback.. |
| 73 |
select count(*) as one from ta; |
| 74 |
one |
| 75 |
1 |
| 76 |
# ..except transactional engine |
| 77 |
select count(*) as zero from t; |
| 78 |
zero |
| 79 |
0 |
| 80 |
select count(*) as zero from ti_pk; |
| 81 |
zero |
| 82 |
0 |
| 83 |
delete from ta; |
| 84 |
# 4. create-table-select-f() |
| 85 |
set @@global.gtid_strict_mode=0; |
| 86 |
set @@session.gtid_seq_no=1; |
| 87 |
set @@global.gtid_strict_mode=1; |
| 88 |
create table f_x (a int) select f_i() as a; |
| 89 |
ERROR HY000: An attempt was made to binlog GTID VALUE which would create an out-of-order sequence number with existing GTID VALUE, and gtid strict mode is enabled |
| 90 |
# rollback indeed takes place in the pure transactional case |
| 91 |
select count(*) as zero from ti; |
| 92 |
zero |
| 93 |
0 |
| 94 |
set @@global.gtid_strict_mode=0; |
| 95 |
set @@session.gtid_seq_no=1; |
| 96 |
set @@global.gtid_strict_mode=1; |
| 97 |
create table t_x (a int) engine=aria select f_ia(0) as a; |
| 98 |
ERROR HY000: An attempt was made to binlog GTID VALUE which would create an out-of-order sequence number with existing GTID VALUE, and gtid strict mode is enabled |
| 99 |
select * from t_x; |
| 100 |
ERROR 42S02: Table 'test.t_x' doesn't exist |
| 101 |
# **TODO**: fix MDEV-36027 |
| 102 |
# **TODO**: the empty binlog is buggy .. |
| 103 |
include/show_binlog_events.inc |
| 104 |
# .. as non-transactional `ta` (and `t_x` sic!) are modified |
| 105 |
select count(*) as one from ta; |
| 106 |
one |
| 107 |
1 |
| 108 |
select count(*) as zero from ti; |
| 109 |
zero |
| 110 |
0 |
| 111 |
delete from ta; |
| 112 |
#. |
| 113 |
set @@global.gtid_strict_mode=@save_gtid_stric_mode; |
| 114 |
drop function f_i; |
| 115 |
drop function f_ia; |
| 116 |
drop table t, ta, ti, ti_pk; |