Andrei Elkin wrote:
> He Zhenxing, hello.
>
> It's great you found yet another flaw, not reported
> in the bug!
>
> The fix is okay, although I need to ask you to make a test case which
> would not just prove your fixes (straighforward enough to believe 'me)
> but rather secure marking thd->tmp_table_used will never be lost.
>
> I suggest to file binlog_temp_table.test and list there yours two and
> the rest basic cases where a query event goes in binlog with the temp
> flag on.
>
I have added a test case named binlog_tmp_table.test in my latest
commit. Please review that commit.
> Hope you'll appreciate this idea,
>
Of course.
> cheers,
>
> Andrei
>
> PS Once again sorry I could not make review earlier :-(
>
>
> > #At file:///media/sdb2/hezx/work/mysql/bzrwork/b35583/5.0/
> >
> > 2636 He Zhenxing 2008-12-15
> > BUG#35583 mysqlbinlog replay fails with ERROR 1146 when temp tables are
> used
> >
> > When using CREATE TEMPORARY TABLE LIKE to create a temporary table,
> > or using TRUNCATE to delete all rows of a temporary table, they
> > did not set the tmp_table_used flag, and cause the omission of
> > "SET @@session.pseudo_thread_id" when dumping binlog with mysqlbinlog,
> > and cause error when replay the statements.
> >
> > This patch fixed the problem by setting tmp_table_used in these two
> > cases.
> > modified:
> > sql/sql_delete.cc
> > sql/sql_table.cc
> >
> > per-file messages:
> > sql/sql_delete.cc
> > set thd->tmp_table_used when truncate temporary table
> > sql/sql_table.cc
> > set thd->tmp_table_used when using create like to create temporary
> tables
> > === modified file 'sql/sql_delete.cc'
> > --- a/sql/sql_delete.cc 2008-03-27 11:52:55 +0000
> > +++ b/sql/sql_delete.cc 2008-12-15 07:20:29 +0000
> > @@ -918,6 +918,9 @@ bool mysql_truncate(THD *thd, TABLE_LIST
> > if ((error= (int) !(open_temporary_table(thd, path, table_list->db,
> > table_list->table_name, 1))))
> > (void) rm_temporary_table(table_type, path);
> > + else
> > + thd->tmp_table_used= 1;
> > +
> > /*
> > If we return here we will not have logged the truncation to the bin log
> > and we will not send_ok() to the client.
> >
> > === modified file 'sql/sql_table.cc'
> > --- a/sql/sql_table.cc 2008-05-12 16:01:13 +0000
> > +++ b/sql/sql_table.cc 2008-12-15 07:20:29 +0000
> > @@ -2876,6 +2876,7 @@ bool mysql_create_like_table(THD* thd, T
> > dst_path); /* purecov: inspected */
> > goto err; /* purecov: inspected */
> > }
> > + thd->tmp_table_used= 1;
> > }
> > else if (err)
> > {
> >
> >
> > --
> > MySQL Code Commits Mailing List
> > For list archives: http://lists.mysql.com/commits
> > To unsubscribe: http://lists.mysql.com/commits?unsub=1