1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

merge of MDEV-5356 5.1->5.3 (with more fixes and test suite).

THD::thd->activate_stmt_arena_if_needed() should be used to temporary activating statement arena instead of direct usage of THD::set_n_backup_active_arena() because possible such scenario:
  1) func1 saves current arena and activates copy1 of statement arena
  2) func2 saves copy1 of statement arena setup by func1 and activates copy2
  3) some changes made for copy 2
  4) func2 stores changed copy2 back to statenet arena and activates copy1
  5) func1 store unchanged copy1 back to statemnt arena (rewrite changed copy 2 so changes become lost) and activates arena which was before.
This commit is contained in:
unknown
2014-01-23 12:05:10 +02:00
8 changed files with 65 additions and 39 deletions

View File

@ -8050,12 +8050,9 @@ bool setup_tables(THD *thd, Name_resolution_context *context,
if (table_list->merge_underlying_list)
{
DBUG_ASSERT(table_list->is_merged_derived());
Query_arena *arena= thd->stmt_arena, backup;
Query_arena *arena, backup;
arena= thd->activate_stmt_arena_if_needed(&backup);
bool res;
if (arena->is_conventional())
arena= 0; // For easier test
else
thd->set_n_backup_active_arena(arena, &backup);
res= table_list->setup_underlying(thd);
if (arena)
thd->restore_active_arena(arena, &backup);
@ -8434,11 +8431,8 @@ void wrap_ident(THD *thd, Item **conds)
{
Item_direct_ref_to_ident *wrapper;
DBUG_ASSERT((*conds)->type() == Item::FIELD_ITEM || (*conds)->type() == Item::REF_ITEM);
Query_arena *arena= thd->stmt_arena, backup;
if (arena->is_conventional())
arena= 0;
else
thd->set_n_backup_active_arena(arena, &backup);
Query_arena *arena, backup;
arena= thd->activate_stmt_arena_if_needed(&backup);
if ((wrapper= new Item_direct_ref_to_ident((Item_ident *)(*conds))))
(*conds)= (Item*) wrapper;
if (arena)