diff options
author | unknown <bell@sanja.is.com.ua> | 2004-02-12 03:10:26 +0200 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2004-02-12 03:10:26 +0200 |
commit | 4b37cf65f7d9d83005fd73dc05fae39639303f24 (patch) | |
tree | ec08c4d5b30f56815e8bfdacd0319bbcbd9f1abb /sql/item_subselect.cc | |
parent | 73c56ba8a59e87500aede58b2931223799cf153d (diff) | |
download | mariadb-git-4b37cf65f7d9d83005fd73dc05fae39639303f24.tar.gz |
memory leacks in PS with subqueries fixed (adddition to fix of BUG#2462)
sql/item.h:
mechanism to keep reference in cache array for row IN
sql/item_cmpfunc.cc:
mechanism to keep reference in cache array for row IN
layout fixed
sql/item_cmpfunc.h:
mechanism to keep reference in cache array for row IN
sql/item_subselect.cc:
fixed memory pools swapping
prevented deleting Item_in_optimizer cache in case of row IN subquery
sql/mysql_priv.h:
declarations of function moved to be useful in sql_class.h
sql/sql_base.cc:
keep fields expanded from '*' in statement memory pool
sql/sql_class.cc:
fixed restoring/backup of memory pool and list of items
sql/sql_class.h:
memory allocation methods moved to Statement
memory pool substituting for preparing
sql/sql_lex.cc:
ref_pointer_array kept in statement memory
sql/sql_lex.h:
reinitialization of UNIT
sql/sql_prepare.cc:
memory allocation/swapping fixed
tests/client_test.c:
layout fixed
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r-- | sql/item_subselect.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 5371030fafa..e0177f08764 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -322,14 +322,14 @@ Item_singlerow_subselect::select_transformer(JOIN *join) goto err; } if (stmt) - thd->restore_backup_item_arena(&backup); + thd->restore_backup_item_arena(stmt, &backup); return RES_REDUCE; } return RES_OK; err: if (stmt) - thd->restore_backup_item_arena(&backup); + thd->restore_backup_item_arena(stmt, &backup); return RES_ERROR; } @@ -789,7 +789,7 @@ Item_in_subselect::single_value_transformer(JOIN *join, ER_SELECT_REDUCED, warn_buff); } if (stmt) - thd->set_item_arena(&backup); + thd->restore_backup_item_arena(stmt, &backup); DBUG_RETURN(RES_REDUCE); } } @@ -797,12 +797,12 @@ Item_in_subselect::single_value_transformer(JOIN *join, ok: if (stmt) - thd->restore_backup_item_arena(&backup); + thd->restore_backup_item_arena(stmt, &backup); DBUG_RETURN(RES_OK); err: if (stmt) - thd->restore_backup_item_arena(&backup); + thd->restore_backup_item_arena(stmt, &backup); DBUG_RETURN(RES_ERROR); } @@ -845,6 +845,10 @@ Item_in_subselect::row_value_transformer(JOIN *join) thd->lex->current_select= current; goto err; } + + // we will refer to apper level cache array => we have to save it in PS + optimizer->keep_top_level_cache(); + thd->lex->current_select= current; unit->uncacheable|= UNCACHEABLE_DEPENDENT; } @@ -892,12 +896,12 @@ Item_in_subselect::row_value_transformer(JOIN *join) goto err; } if (stmt) - thd->restore_backup_item_arena(&backup); + thd->restore_backup_item_arena(stmt, &backup); DBUG_RETURN(RES_OK); err: if (stmt) - thd->restore_backup_item_arena(&backup); + thd->restore_backup_item_arena(stmt, &backup); DBUG_RETURN(RES_ERROR); } @@ -975,6 +979,7 @@ void subselect_single_select_engine::cleanup() { DBUG_ENTER("subselect_single_select_engine::cleanup"); prepared= optimized= executed= 0; + join= 0; DBUG_VOID_RETURN; } |