diff options
author | unknown <aelkin@mysql.com> | 2006-06-19 20:26:36 +0300 |
---|---|---|
committer | unknown <aelkin@mysql.com> | 2006-06-19 20:26:36 +0300 |
commit | e3654f431551298566af1c216396059f417deff2 (patch) | |
tree | d6dd4cbab8916d93b0c6143ffd69064cb4283c3e /sql/sql_base.cc | |
parent | 51b9d38194c3cbb4a01e6dcb6d6b1bd2db5f36e8 (diff) | |
parent | 9534b8f1ec974e289a7c9d039098686cfdaa3260 (diff) | |
download | mariadb-git-e3654f431551298566af1c216396059f417deff2.tar.gz |
Merge aelkin@bk-internal.mysql.com:/home/bk/mysql-5.1-new-rpl
into mysql.com:/usr_rh9/home/elkin.rh9/MySQL/TEAM/BARE/mysql-5.1-new-rpl
sql/sql_base.cc:
Auto merged
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 1b448a3ba18..f8ec4531995 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1526,17 +1526,37 @@ bool close_temporary_table(THD *thd, TABLE_LIST *table_list) } /* - Close temporary table and unlink from thd->temporary tables + unlink from thd->temporary tables and close temporary table */ void close_temporary_table(THD *thd, TABLE *table, bool free_share, bool delete_table) { - TABLE **prev= table->open_prev; - if ((*table->open_prev= table->next)) - table->next->open_prev= prev; + if (table->prev) + { + table->prev->next= table->next; + if (table->prev->next) + table->next->prev= table->prev; + } + else + { + /* removing the item from the list */ + DBUG_ASSERT(table == thd->temporary_tables); + /* + slave must reset its temporary list pointer to zero to exclude + passing non-zero value to end_slave via rli->save_temporary_tables + when no temp tables opened, see an invariant below. + */ + thd->temporary_tables= table->next; + if (thd->temporary_tables) + table->next->prev= 0; + } if (thd->slave_thread) + { + /* natural invariant of temporary_tables */ + DBUG_ASSERT(slave_open_temp_tables || !thd->temporary_tables); slave_open_temp_tables--; + } close_temporary(table, free_share, delete_table); } @@ -3504,10 +3524,12 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, if (link_in_list) { - tmp_table->open_prev= &thd->temporary_tables; - if ((tmp_table->next= thd->temporary_tables)) - thd->temporary_tables->open_prev= &tmp_table->next; + /* growing temp list at the head */ + tmp_table->next= thd->temporary_tables; + if (tmp_table->next) + tmp_table->next->prev= tmp_table; thd->temporary_tables= tmp_table; + thd->temporary_tables->prev= 0; if (thd->slave_thread) slave_open_temp_tables++; } |