From 3b05fc78e5dceebaa47c10d36ba667fb7be38fac Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Apr 2010 00:15:15 +0300 Subject: Fixed a problem where the temp table of a materialized subquery was not cleaned up between PS re-executions. The reason was two-fold: - a merge with mysql-6.0 missed select_union::cleanup() that should have cleaned up the temp table, and - the subclass of select_union used by materialization didn't call the base class cleanup() method. --- sql/sql_union.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'sql/sql_union.cc') diff --git a/sql/sql_union.cc b/sql/sql_union.cc index ee9ff833726..1080b45d60d 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -136,6 +136,22 @@ select_union::create_result_table(THD *thd_arg, List *column_types, } +/** + Reset and empty the temporary table that stores the materialized query result. + + @note The cleanup performed here is exactly the same as for the two temp + tables of JOIN - exec_tmp_table_[1 | 2]. +*/ + +void select_union::cleanup() +{ + table->file->extra(HA_EXTRA_RESET_STATE); + table->file->ha_delete_all_rows(); + free_io_cache(table); + filesort_free_buffers(table,0); +} + + /* initialization procedures before fake_select_lex preparation() -- cgit v1.2.1 From dad93f2c822f174f4674c4a04c2382c18a262e36 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Fri, 4 Jun 2010 17:40:57 +0400 Subject: MWL#90, code movearound to unify merged and non-merged semi-join materialization processing - First code, needs cleanup. --- sql/sql_union.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'sql/sql_union.cc') diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 1080b45d60d..bb97c1f6352 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -703,6 +703,7 @@ bool st_select_lex_unit::cleanup() { join->tables_list= 0; join->tables= 0; + join->top_jtrange_tables= 0; } error|= fake_select_lex->cleanup(); /* -- cgit v1.2.1 From 5de770f31736e1ed7088b6d609a4237083d4fe47 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Sun, 27 Mar 2011 03:45:16 +0400 Subject: MWL#90: Address review feedback part #14 --- sql/sql_union.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/sql_union.cc') diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 8283d0e01fb..ec2f1faeb35 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -690,7 +690,7 @@ bool st_select_lex_unit::cleanup() if ((join= fake_select_lex->join)) { join->tables_list= 0; - join->tables= 0; + join->table_count= 0; join->top_jtrange_tables= 0; } error|= fake_select_lex->cleanup(); -- cgit v1.2.1 From 4e5199912baa75261ea0bc1a5602e2746c74b1c2 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Sun, 27 Mar 2011 03:54:15 +0400 Subject: Rename JOIN::top_jtrange_tables to top_join_tab_count --- sql/sql_union.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/sql_union.cc') diff --git a/sql/sql_union.cc b/sql/sql_union.cc index ec2f1faeb35..6897411c036 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -691,7 +691,7 @@ bool st_select_lex_unit::cleanup() { join->tables_list= 0; join->table_count= 0; - join->top_jtrange_tables= 0; + join->top_join_tab_count= 0; } error|= fake_select_lex->cleanup(); /* -- cgit v1.2.1