Commit ff179e37 authored by guilhem@mysql.com's avatar guilhem@mysql.com

Fix for BUG#20522 "RBR: CREATE TEMPORARY TABLE SELECT writes to binlog

though unneeded". It's indeed unneeded, as slave is only interested in
permanent tables, and permanent tables don't depend on temporary tables
when in row-based binlogging mode. And other CREATE TEMPORARY TABLE
(referring no table or with LIKE) already don't write the CREATE to
binlog in row-based mode. 
parent 6e80c3ec
...@@ -178,6 +178,7 @@ CREATE TABLE t8 LIKE t4; ...@@ -178,6 +178,7 @@ CREATE TABLE t8 LIKE t4;
CREATE TABLE t9 LIKE tt4; CREATE TABLE t9 LIKE tt4;
CREATE TEMPORARY TABLE tt5 LIKE t4; CREATE TEMPORARY TABLE tt5 LIKE t4;
CREATE TEMPORARY TABLE tt6 LIKE tt4; CREATE TEMPORARY TABLE tt6 LIKE tt4;
CREATE TEMPORARY TABLE tt7 SELECT 1;
**** On Master **** **** On Master ****
SHOW CREATE TABLE t8; SHOW CREATE TABLE t8;
Table t8 Table t8
......
...@@ -97,6 +97,7 @@ CREATE TABLE t8 LIKE t4; ...@@ -97,6 +97,7 @@ CREATE TABLE t8 LIKE t4;
CREATE TABLE t9 LIKE tt4; CREATE TABLE t9 LIKE tt4;
CREATE TEMPORARY TABLE tt5 LIKE t4; CREATE TEMPORARY TABLE tt5 LIKE t4;
CREATE TEMPORARY TABLE tt6 LIKE tt4; CREATE TEMPORARY TABLE tt6 LIKE tt4;
CREATE TEMPORARY TABLE tt7 SELECT 1;
--echo **** On Master **** --echo **** On Master ****
--query_vertical SHOW CREATE TABLE t8 --query_vertical SHOW CREATE TABLE t8
--query_vertical SHOW CREATE TABLE t9 --query_vertical SHOW CREATE TABLE t9
......
...@@ -1610,7 +1610,8 @@ class select_create: public select_insert { ...@@ -1610,7 +1610,8 @@ class select_create: public select_insert {
virtual bool can_rollback_data() { return 1; } virtual bool can_rollback_data() { return 1; }
// Needed for access from local class MY_HOOKS in prepare(), since thd is proteted. // Needed for access from local class MY_HOOKS in prepare(), since thd is proteted.
THD *get_thd(void) { return thd; } const THD *get_thd(void) { return thd; }
const HA_CREATE_INFO *get_create_info() { return create_info; };
}; };
#include <myisam.h> #include <myisam.h>
......
...@@ -2714,7 +2714,8 @@ class MY_HOOKS : public TABLEOP_HOOKS ...@@ -2714,7 +2714,8 @@ class MY_HOOKS : public TABLEOP_HOOKS
MY_HOOKS(select_create *x) : ptr(x) { } MY_HOOKS(select_create *x) : ptr(x) { }
virtual void do_prelock(TABLE **tables, uint count) virtual void do_prelock(TABLE **tables, uint count)
{ {
if (ptr->get_thd()->current_stmt_binlog_row_based) if (ptr->get_thd()->current_stmt_binlog_row_based &&
!(ptr->get_create_info()->options & HA_LEX_CREATE_TMP_TABLE))
ptr->binlog_show_create_table(tables, count); ptr->binlog_show_create_table(tables, count);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment