| 1 |
--echo # |
| 2 |
--echo # MDEV-17863 DROP TEMPORARY TABLE creates a transaction in |
| 3 |
--echo # binary log on read only server |
| 4 |
--echo # MDEV-19074 Improved read_only mode for slaves with |
| 5 |
--echo # gtid_strict_mode enabled |
| 6 |
--echo # |
| 7 |
|
| 8 |
create user test@localhost; |
| 9 |
grant CREATE TEMPORARY TABLES, DROP, INSERT, SELECT on *.* to test@localhost; |
| 10 |
create table t1 (a int) engine=myisam; |
| 11 |
insert into t1 values (1),(2); |
| 12 |
reset master; |
| 13 |
|
| 14 |
set global read_only=1; |
| 15 |
--echo # Ensure that optimize and analyze doesn't log to binary log |
| 16 |
connect (con1,localhost,test,,test); |
| 17 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 18 |
insert into t1 values(3); |
| 19 |
analyze table t1; |
| 20 |
check table t1; |
| 21 |
repair table t1; |
| 22 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 23 |
optimize table t1; |
| 24 |
|
| 25 |
--echo # Ensure that using temporary tables is not logged |
| 26 |
create temporary table tmp1 (a int) engine=myisam; |
| 27 |
insert into tmp1 values (1),(2); |
| 28 |
update tmp1 set a=10 where a=2; |
| 29 |
delete from tmp1 where a=1; |
| 30 |
create temporary table tmp2 select * from t1; |
| 31 |
select * from tmp1; |
| 32 |
select * from tmp2; |
| 33 |
create temporary table tmp3 like t1; |
| 34 |
create or replace temporary table tmp3 like t1; |
| 35 |
alter table tmp2 add column (b int); |
| 36 |
select * from tmp2; |
| 37 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 38 |
insert into t1 select a+100 from tmp2; |
| 39 |
drop table tmp1,tmp2,tmp3; |
| 40 |
|
| 41 |
--echo # Clean up test connection |
| 42 |
disconnect con1; |
| 43 |
connection default; |
| 44 |
|
| 45 |
--echo # Execute some commands as root that should not be logged |
| 46 |
optimize table t1; |
| 47 |
repair table t1; |
| 48 |
|
| 49 |
--echo # Changes to temporary tables created under readonly should not |
| 50 |
--echo # be logged |
| 51 |
create temporary table tmp4 (a int) engine=myisam; |
| 52 |
insert into tmp4 values (1),(2); |
| 53 |
create temporary table tmp5 (a int) engine=myisam; |
| 54 |
insert into tmp5 select * from tmp4; |
| 55 |
alter table tmp5 add column (b int); |
| 56 |
|
| 57 |
set global read_only=0; |
| 58 |
|
| 59 |
insert into tmp4 values (3),(4); |
| 60 |
insert into tmp5 values (10,3),(11,4); |
| 61 |
select * from tmp4; |
| 62 |
select * from tmp5; |
| 63 |
update tmp4 set a=10 where a=2; |
| 64 |
delete from tmp4 where a=1; |
| 65 |
create table t2 select * from tmp4; |
| 66 |
alter table tmp5 add column (c int); |
| 67 |
insert into tmp5 values (20,5,1),(21,5,2); |
| 68 |
select * from tmp5; |
| 69 |
insert into t1 select a+200 from tmp5; |
| 70 |
select * from t1; |
| 71 |
drop table tmp4,tmp5; |
| 72 |
|
| 73 |
--echo # Check what is logged. Only last create select and the insert...select's should be |
| 74 |
--echo # row-logged |
| 75 |
source include/show_binlog_events.inc; |
| 76 |
|
| 77 |
--echo # Clean up |
| 78 |
drop user test@localhost; |
| 79 |
drop table t1,t2; |