Bug#17137 Running "truncate table" on temporary table leaves the table open on a slave

- Decrease "slave_open_temp_tables" during reopen of truncated table.
 - Add test "rpl_trunc_temp" 


sql/sql_delete.cc:
  Decrease "slave_open_temp_tables" after temporary table has been closed, it will be
  increased again when the temp table is reopened after it's been truncated.
mysql-test/r/rpl_trunc_temp.result:
  New BitKeeper file ``mysql-test/r/rpl_trunc_temp.result''
mysql-test/t/rpl_trunc_temp.test:
  New BitKeeper file ``mysql-test/t/rpl_trunc_temp.test''
This commit is contained in:
unknown 2006-03-08 10:15:48 +01:00
commit f491db2119
3 changed files with 59 additions and 0 deletions

View file

@ -641,6 +641,8 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
strmov(path,table->path);
*table_ptr= table->next; // Unlink table from list
close_temporary(table,0);
if (thd->slave_thread)
--slave_open_temp_tables;
*fn_ext(path)=0; // Remove the .frm extension
ha_create_table(path, &create_info,1);
// We don't need to call invalidate() because this table is not in cache