Bug #20919 temp tables closing fails when binlog is off
Submitted: 8 Jul 2006 20:09 Modified: 30 Aug 2006 19:29
Reporter: Andrei Elkin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.23 OS:Linux (Linux)
Assigned to: Andrei Elkin CPU Architecture:Any

[8 Jul 2006 20:09] Andrei Elkin
Description:
rpl_temporary and some other tests incl rename flush connect binlog_row_mix_innodb_myisam binlog_row_drop_tmp_tbl 
fails without binlog or RBR (in 5.1) because of wrong iterating, clearing an item of the list before taking 'next' pointer, over thd->temporary_tables in
close_temporary_tables.
 

How to repeat:
start mysqld 5.0 without binlog

mysql -e 'create temporary table t1 (id int); create temporary table t2 (id int)'

must be server crash

Suggested fix:
void close_temporary_tables(THD *thd)
{
  TABLE *table;
  if (!thd->temporary_tables)
    return;

 if (!mysql_bin_log.is_open() || thd->current_stmt_binlog_row_based)
  {
+   TABLE *next;
-   for (table= thd->temporary_tables; table; table= table->next)
+   for (table= thd->temporary_tables; table; table= next)
    {
 +     next=table->next;
      close_temporary(table, 1, 1);
[9 Jul 2006 21:26] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/8971
[10 Jul 2006 18:53] Andrei Elkin
Apporved by Mats.
[16 Jul 2006 11:54] Andrei Elkin
fixed in 5.1.12
[20 Jul 2006 17:51] Paul DuBois
Noted in 5.1.12 changelog.

Closing of temporary tables failed if binary logging was not enabled.
[19 Aug 2006 7:27] Lars Thalmann
We need exact version (4.1?, 5.0?) this has been pushed to 
and update of documentation.  Setting it back to verified.
[21 Aug 2006 11:08] Andrei Elkin
Fixed in 4.1.21, 5.0.24a, 5.1.12.
[30 Aug 2006 19:29] Paul DuBois
Also noted in 4.1.21, 5.0.24a changelogs.