Hi!

It took me quite a while to understand what caused this issue.
It is because the old code before create_tmp_table_binlog_formats did
not allow one
to switch from row based logging to statemen and the code path for
create or replace temmporary_table like not_logged_temporary_table was not
properly tested after the create_tmp_table_binlog_formats patch..

A few suggestion for the patch:

Fix the warning in the test case:
set create_tmp_table_binlog_formats=mixed;
->
set create_tmp_table_binlog_formats="mixed,statement";

Add the following comment before the new code in:
+++ b/sql/sql_table.cc
@@ -4732,6 +4732,8 @@ int create_table_impl(THD *thd,

           We are using CREATE OR REPLACE on an existing temporary table
           Remove the old table so that we can re-create it.
         */
+        tmp_table->pos_in_table_list->table= NULL;
+        create_info->table= NULL;

/*
  Reseting tmp_table->pos_in_table_list->table resets 'table->table' in
  mysql_create_like_table(), which is used to decide how to binlog the table
  creation.
*/

Note that create_info->table= NULL is not needed as it is reset later in
create_table_impl.

It is also good to enhance the test to use locked tables, as this uses
a somewhat
different code path.

Here is a full enhanced test case:

set binlog_format=mixed;
create temporary table t1 (x int);
create temporary table t2 (y int);
set create_tmp_table_binlog_formats="mixed,statement";
create or replace temporary table t2 like t1;
drop table t1, t2;
set create_tmp_table_binlog_formats=@save_create_tmp_table_binlog_formats;

# Test same with locked tables

set binlog_format=mixed;
create temporary table t1 (x int);
create temporary table t2 (y int);
set create_tmp_table_binlog_formats="mixed,statement";
lock tables t1 write,t2 write;
create or replace temporary table t2 like t1;
select * from t1,t2;
unlock tables;
drop table t1, t2;
set create_tmp_table_binlog_formats=@save_create_tmp_table_binlog_formats;

set binlog_format=default;

------------

Regards,
Monty
_______________________________________________
commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to