From 61d706a4f04906632e461aa6a2756429b1be9c2c Mon Sep 17 00:00:00 2001 From: Leonard Zhou Date: Mon, 23 Feb 2009 11:26:38 +0800 Subject: Bug#40013 mixed replication: row based format could lead to stale tmp tables on the slave. In mixed mode, if we create a temporary table and do some update which switch to ROW format, the format will keep in ROW format until the session ends or the table is dropped explicitly. When the session ends, the temp table is dropped automaticly at cleanup time. but it checks only current binlog format and so skip insertion of DROP TABLE instructions into binlog. So the temp table can't be dropped correctly at slave. Our solution is that when closing temp tables at cleanup time we check both binlog format and binlog mode, and we could write DROP TABLE instructions into binlog if current binlog format is ROW but in MIX mode. mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result: Test result file. mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test: Test file. sql/sql_base.cc: Didn't do binloging when both current format and default format are ROW. --- sql/sql_base.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sql/sql_base.cc') diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 6db9f1df0f2..7602b1187aa 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1440,7 +1440,8 @@ void close_temporary_tables(THD *thd) if (!thd->temporary_tables) return; - if (!mysql_bin_log.is_open() || thd->current_stmt_binlog_row_based) + if (!mysql_bin_log.is_open() || + (thd->current_stmt_binlog_row_based && thd->variables.binlog_format == BINLOG_FORMAT_ROW)) { TABLE *tmp_next; for (table= thd->temporary_tables; table; table= tmp_next) -- cgit v1.2.1