diff options
author | Nirbhay Choubey <nirbhay@mariadb.com> | 2016-06-10 16:19:59 -0400 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@mariadb.com> | 2016-06-10 18:39:43 -0400 |
commit | 7305be2f7e724e5e62961606794beab199d79045 (patch) | |
tree | 403bd132ee82a16946e3208f5d535de6e5945b80 /sql/wsrep_applier.cc | |
parent | 547511153fb1f59688752aa5524ae411b5960c92 (diff) | |
download | mariadb-git-7305be2f7e724e5e62961606794beab199d79045.tar.gz |
MDEV-5535: Cannot reopen temporary table
mysqld maintains a list of TABLE objects for all temporary
tables created within a session in THD. Here each table is
represented by a TABLE object.
A query referencing a particular temporary table for more
than once, however, failed with ER_CANT_REOPEN_TABLE error
because a TABLE_SHARE was allocate together with the TABLE,
so temporary tables always had only one TABLE per TABLE_SHARE.
This patch lift this restriction by separating TABLE and
TABLE_SHARE objects and storing TABLE_SHAREs for temporary
tables in a list in THD, and TABLEs in a list within their
respective TABLE_SHAREs.
Diffstat (limited to 'sql/wsrep_applier.cc')
-rw-r--r-- | sql/wsrep_applier.cc | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/sql/wsrep_applier.cc b/sql/wsrep_applier.cc index cf1feb49f41..6086748b6d0 100644 --- a/sql/wsrep_applier.cc +++ b/sql/wsrep_applier.cc @@ -62,7 +62,6 @@ err: #include "transaction.h" // trans_commit(), trans_rollback() #include "rpl_rli.h" // class Relay_log_info; -#include "sql_base.h" // close_temporary_table() void wsrep_set_apply_format(THD* thd, Format_description_log_event* ev) { @@ -277,14 +276,11 @@ wsrep_cb_status_t wsrep_apply_cb(void* const ctx, wsrep_dump_rbr_buf_with_header(thd, buf, buf_len); } - TABLE *tmp; - while ((tmp = thd->temporary_tables)) + if (thd->has_thd_temporary_tables()) { - WSREP_DEBUG("Applier %lld, has temporary tables: %s.%s", - (longlong) thd->thread_id, - (tmp->s) ? tmp->s->db.str : "void", - (tmp->s) ? tmp->s->table_name.str : "void"); - close_temporary_table(thd, tmp, 1, 1); + WSREP_DEBUG("Applier %lld has temporary tables. Closing them now..", + thd->thread_id); + thd->close_temporary_tables(); } return rcode; |