1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-27 05:41:41 +03:00

read-only slave using statement replication should replicate tmp tables

Relates to MDEV-17863 DROP TEMPORARY TABLE creates a transaction in
binary log on read only server

Other things:
- Fixed that insert into normal_table select from tmp_table is
  replicated as row events if tmp_table doesn't exists on slave.
This commit is contained in:
Michael Widenius
2019-10-21 17:17:09 +03:00
parent 7def2877e3
commit 06d2e1d828
8 changed files with 135 additions and 7 deletions

View File

@@ -46,6 +46,8 @@ select * from tmp2;
a b
1 NULL
2 NULL
insert into t1 select a+100 from tmp2;
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
drop table tmp1,tmp2,tmp3;
# Clean up test connection
disconnect con1;
@@ -92,8 +94,20 @@ a b c
11 4 NULL
20 5 1
21 5 2
insert into t1 select a+200 from tmp5;
select * from t1;
a
1
2
201
202
210
211
220
221
drop table tmp4,tmp5;
# Check what is logged. Only the last create select should be row-logged
# Check what is logged. Only last create select and the insert...select's should be
# row-logged
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
@@ -104,6 +118,11 @@ master-bin.000001 # Annotate_rows # # create table t2 select * from tmp4
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # insert into t1 select a+200 from tmp5
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
# Clean up
drop user test@localhost;
drop table t1,t2;

View File

@@ -46,6 +46,8 @@ select * from tmp2;
a b
1 NULL
2 NULL
insert into t1 select a+100 from tmp2;
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
drop table tmp1,tmp2,tmp3;
# Clean up test connection
disconnect con1;
@@ -92,8 +94,20 @@ a b c
11 4 NULL
20 5 1
21 5 2
insert into t1 select a+200 from tmp5;
select * from t1;
a
1
2
201
202
210
211
220
221
drop table tmp4,tmp5;
# Check what is logged. Only the last create select should be row-logged
# Check what is logged. Only last create select and the insert...select's should be
# row-logged
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
@@ -104,6 +118,11 @@ master-bin.000001 # Annotate_rows # # create table t2 select * from tmp4
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # insert into t1 select a+200 from tmp5
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
# Clean up
drop user test@localhost;
drop table t1,t2;

View File

@@ -34,6 +34,8 @@ create temporary table tmp3 like t1;
create or replace temporary table tmp3 like t1;
alter table tmp2 add column (b int);
select * from tmp2;
--error ER_OPTION_PREVENTS_STATEMENT
insert into t1 select a+100 from tmp2;
drop table tmp1,tmp2,tmp3;
--echo # Clean up test connection
@@ -64,9 +66,12 @@ create table t2 select * from tmp4;
alter table tmp5 add column (c int);
insert into tmp5 values (20,5,1),(21,5,2);
select * from tmp5;
insert into t1 select a+200 from tmp5;
select * from t1;
drop table tmp4,tmp5;
--echo # Check what is logged. Only the last create select should be row-logged
--echo # Check what is logged. Only last create select and the insert...select's should be
--echo # row-logged
source include/show_binlog_events.inc;
--echo # Clean up