[Commits] e733fed325b: MDEV-9266 Creating index on temporary table breaks replication
revision-id: e733fed325b53889a2e0bc15279cfd085296a433 (mariadb-10.0.34-56-ge733fed325b) parent(s): 42fac3241368ad72f8cfef2b8521269e6c173558 author: Sachin Setiya committer: Sachin Setiya timestamp: 2018-05-03 11:25:39 +0530 message: MDEV-9266 Creating index on temporary table breaks replication We should not write the create index on binlog. Since Create Index is a different way of writing alter table. It should also have CF_FORCE_ORIGINAL_BINLOG_FORMAT flag --- mysql-test/suite/rpl/r/rpl_temp_table_row.result | 12 ++++++++++++ mysql-test/suite/rpl/t/rpl_temp_table_row.test | 19 +++++++++++++++++++ sql/sql_parse.cc | 2 ++ 3 files changed, 33 insertions(+) diff --git a/mysql-test/suite/rpl/r/rpl_temp_table_row.result b/mysql-test/suite/rpl/r/rpl_temp_table_row.result new file mode 100644 index 00000000000..608ba2404a1 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_temp_table_row.result @@ -0,0 +1,12 @@ +include/master-slave.inc +[connection master] +##testing index creation on temp table with +##binlog format row #mdev-9266 +create temporary table t1(a int, b int); +create index index_t1 on t1(a); +alter table t1 add index indx(b); +insert into t1 values(1,2); +select * from t1; +ERROR 42S02: Table 'test.t1' doesn't exist +drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_temp_table_row.test b/mysql-test/suite/rpl/t/rpl_temp_table_row.test new file mode 100644 index 00000000000..030ce441012 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_temp_table_row.test @@ -0,0 +1,19 @@ +-- source include/have_binlog_format_row.inc +-- source include/master-slave.inc + +--echo ##testing index creation on temp table with +--echo ##binlog format row #mdev-9266 +--connection master +create temporary table t1(a int, b int); +create index index_t1 on t1(a); +alter table t1 add index indx(b); +insert into t1 values(1,2); + +--sync_slave_with_master +--error ER_NO_SUCH_TABLE +select * from t1; + +--connection master +drop table t1; + +--source include/rpl_end.inc diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 4c0be4ebc8b..d9477233035 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -453,6 +453,8 @@ void init_update_queries(void) sql_command_flags[SQLCOM_ROLLBACK]|= CF_FORCE_ORIGINAL_BINLOG_FORMAT; /* We don't want to replicate ALTER TABLE for temp tables in row format */ sql_command_flags[SQLCOM_ALTER_TABLE]|= CF_FORCE_ORIGINAL_BINLOG_FORMAT; + /* We don't want to replicate CREATE INDEX for temp tables in row format */ + sql_command_flags[SQLCOM_CREATE_INDEX]|= CF_FORCE_ORIGINAL_BINLOG_FORMAT; /* We don't want to replicate TRUNCATE for temp tables in row format */ sql_command_flags[SQLCOM_TRUNCATE]|= CF_FORCE_ORIGINAL_BINLOG_FORMAT; /* We don't want to replicate DROP for temp tables in row format */
participants (1)
-
sachin