List:Internals« Previous MessageNext Message »
From:Konstantin Osipov Date:September 2 2005 12:55pm
Subject:bk commit into 5.0 tree (konstantin:1.1948)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kostja. When kostja does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1948 05/09/02 16:55:24 konstantin@stripped +20 -0
  Rename:
  - set_item_arena -> set_query_arena, because Item_arena was renamed to 
  Query_arena a while ago
  - set_n_backup_item_arena -> set_n_backup_active_arena;
  the active arena is the arena thd->mem_root and thd->free_list
  are currently pointing at.
  - restore_backup_item_arena -> restore_active_arena (with the same
  rationale)
  - change_arena_if_needed -> activate_stmt_arena_if_needed; this
  method sets thd->stmt_arena active if it's not done yet.

  sql/table.cc
    1.184 05/09/02 16:55:05 konstantin@stripped +4 -4
    Rename.

  sql/sql_view.cc
    1.60 05/09/02 16:55:05 konstantin@stripped +4 -4
    Rename.

  sql/sql_union.cc
    1.128 05/09/02 16:55:05 konstantin@stripped +4 -4
    Rename.

  sql/sql_show.cc
    1.273 05/09/02 16:55:05 konstantin@stripped +1 -1
    Rename.

  sql/sql_select.cc
    1.365 05/09/02 16:55:04 konstantin@stripped +6 -6
    Rename.

  sql/sql_prepare.cc
    1.150 05/09/02 16:55:04 konstantin@stripped +11 -11
    Rename.

  sql/sql_parse.cc
    1.483 05/09/02 16:55:04 konstantin@stripped +3 -3
    Rename.

  sql/sql_lex.cc
    1.166 05/09/02 16:55:04 konstantin@stripped +3 -3
    Rename.

  sql/sql_class.h
    1.262 05/09/02 16:55:04 konstantin@stripped +17 -18
    Rename.

  sql/sql_class.cc
    1.205 05/09/02 16:55:04 konstantin@stripped +11 -11
    Rename.

  sql/sql_base.cc
    1.294 05/09/02 16:55:03 konstantin@stripped +16 -16
    Rename.

  sql/sp_head.cc
    1.178 05/09/02 16:55:03 konstantin@stripped +34 -38
    Rename.

  sql/sp.cc
    1.92 05/09/02 16:55:03 konstantin@stripped +2 -2
    Rename.

  sql/mysql_priv.h
    1.346 05/09/02 16:55:03 konstantin@stripped +0 -1
    Remove an unused forward declaration.

  sql/item_sum.h
    1.91 05/09/02 16:55:03 konstantin@stripped +0 -2
    Remove an unused forward declaration.

  sql/item_subselect.h
    1.74 05/09/02 16:55:03 konstantin@stripped +0 -1
    Remove an unused forward declaration.

  sql/item_subselect.cc
    1.118 05/09/02 16:55:03 konstantin@stripped +6 -6
    Rename.

  sql/item_func.cc
    1.247 05/09/02 16:55:03 konstantin@stripped +2 -2
    Rename.

  sql/item_cmpfunc.cc
    1.171 05/09/02 16:55:03 konstantin@stripped +1 -1
    Rename.

  sql/item.cc
    1.170 05/09/02 16:55:02 konstantin@stripped +3 -3
    Rename.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	konstantin
# Host:	oak.local
# Root:	/home/kostja/mysql/mysql-5.0-rename

--- 1.169/sql/item.cc	2005-08-31 22:04:26 +04:00
+++ 1.170/sql/item.cc	2005-09-02 16:55:02 +04:00
@@ -1296,7 +1296,7 @@
     In case we're in statement prepare, create conversion item
     in its memory: it will be reused on each execute.
   */
-  arena= thd->change_arena_if_needed(&backup);
+  arena= thd->activate_stmt_arena_if_needed(&backup);
 
   for (arg= args, last= args + nargs; arg < last; arg++)
   {
@@ -1342,7 +1342,7 @@
     conv->fix_fields(thd, arg);
   }
   if (arena)
-    thd->restore_backup_item_arena(arena, &backup);
+    thd->restore_active_arena(arena, &backup);
   return res;
 }
 
@@ -1385,7 +1385,7 @@
     structure can go away and pop up again between subsequent executions
     of a prepared statement).
   */
-  if (thd->current_arena->is_stmt_prepare_or_first_sp_execute())
+  if (thd->stmt_arena->is_stmt_prepare_or_first_sp_execute())
   {
     if (db_name)
       orig_db_name= thd->strdup(db_name);

--- 1.170/sql/item_cmpfunc.cc	2005-08-22 02:13:18 +04:00
+++ 1.171/sql/item_cmpfunc.cc	2005-09-02 16:55:03 +04:00
@@ -671,7 +671,7 @@
     If it is preparation PS only then we do not know values of parameters =>
     cant't get there values and do not need that values.
   */
-  if (!thd->current_arena->is_stmt_prepare())
+  if (!thd->stmt_arena->is_stmt_prepare())
     cache->store(args[0]);
   if (cache->cols() == 1)
   {

--- 1.246/sql/item_func.cc	2005-08-29 17:44:57 +04:00
+++ 1.247/sql/item_func.cc	2005-09-02 16:55:03 +04:00
@@ -1875,7 +1875,7 @@
   if (arg_count)
   {					// Only use argument once in query
     /*
-      Allocate rand structure once: we must use thd->current_arena
+      Allocate rand structure once: we must use thd->stmt_arena
       to create rand in proper mem_root if it's a prepared statement or
       stored procedure.
 
@@ -1883,7 +1883,7 @@
       as it will be replicated in the query as such.
     */
     if (!rand && !(rand= (struct rand_struct*)
-                   thd->current_arena->alloc(sizeof(*rand))))
+                   thd->stmt_arena->alloc(sizeof(*rand))))
       return TRUE;
     /*
       PARAM_ITEM is returned if we're in statement prepare and consequently

--- 1.90/sql/item_sum.h	2005-07-05 12:19:56 +04:00
+++ 1.91/sql/item_sum.h	2005-09-02 16:55:03 +04:00
@@ -23,8 +23,6 @@
 
 #include <my_tree.h>
 
-class Item_arena;
-
 class Item_sum :public Item_result_field
 {
 public:

--- 1.345/sql/mysql_priv.h	2005-08-30 13:39:17 +04:00
+++ 1.346/sql/mysql_priv.h	2005-09-02 16:55:03 +04:00
@@ -408,7 +408,6 @@
 
 struct st_table;
 class THD;
-class Item_arena;
 
 /* Struct to handle simple linked lists */
 

--- 1.293/sql/sql_base.cc	2005-08-25 01:22:52 +04:00
+++ 1.294/sql/sql_base.cc	2005-09-02 16:55:03 +04:00
@@ -3422,7 +3422,7 @@
                       table_ref_1->alias, table_ref_2->alias));
 
   *found_using_fields= 0;
-  arena= thd->change_arena_if_needed(&backup);
+  arena= thd->activate_stmt_arena_if_needed(&backup);
 
   /*
     TABLE_LIST::join_columns could be allocated by the previous call to
@@ -3585,7 +3585,7 @@
 
 err:
   if (arena)
-    thd->restore_backup_item_arena(arena, &backup);
+    thd->restore_active_arena(arena, &backup);
   DBUG_RETURN(result);
 }
 
@@ -3643,7 +3643,7 @@
 
   DBUG_ASSERT(!natural_using_join->join_columns);
 
-  arena= thd->change_arena_if_needed(&backup);
+  arena= thd->activate_stmt_arena_if_needed(&backup);
 
   if (!(non_join_columns= new List<Natural_join_column>) ||
       !(natural_using_join->join_columns= new List<Natural_join_column>))
@@ -3728,7 +3728,7 @@
 
 err:
   if (arena)
-    thd->restore_backup_item_arena(arena, &backup);
+    thd->restore_active_arena(arena, &backup);
   DBUG_RETURN(result);
 }
 
@@ -3773,7 +3773,7 @@
 
   DBUG_ENTER("store_top_level_join_columns");
 
-  arena= thd->change_arena_if_needed(&backup);
+  arena= thd->activate_stmt_arena_if_needed(&backup);
 
   /* Call the procedure recursively for each nested table reference. */
   if (table_ref->nested_join)
@@ -3886,7 +3886,7 @@
 
 err:
   if (arena)
-    thd->restore_backup_item_arena(arena, &backup);
+    thd->restore_active_arena(arena, &backup);
   DBUG_RETURN(result);
 }
 
@@ -3985,7 +3985,7 @@
     Don't use arena if we are not in prepared statements or stored procedures
     For PS/SP we have to use arena to remember the changes
   */
-  arena= thd->change_arena_if_needed(&backup);
+  arena= thd->activate_stmt_arena_if_needed(&backup);
 
   while (wild_num && (item= it++))
   {
@@ -4013,7 +4013,7 @@
                              any_privileges))
       {
 	if (arena)
-	  thd->restore_backup_item_arena(arena, &backup);
+	  thd->restore_active_arena(arena, &backup);
 	DBUG_RETURN(-1);
       }
       if (sum_func_list)
@@ -4035,7 +4035,7 @@
     select_lex->with_wild= 0;
     select_lex->item_list= fields;
 
-    thd->restore_backup_item_arena(arena, &backup);
+    thd->restore_active_arena(arena, &backup);
   }
   DBUG_RETURN(0);
 }
@@ -4213,15 +4213,15 @@
     if (table_list->ancestor)
     {
       DBUG_ASSERT(table_list->view);
-      Query_arena *arena= thd->current_arena, backup;
+      Query_arena *arena= thd->stmt_arena, backup;
       bool res;
       if (arena->is_conventional())
         arena= 0;                                   // For easier test
       else
-        thd->set_n_backup_item_arena(arena, &backup);
+        thd->set_n_backup_active_arena(arena, &backup);
       res= table_list->setup_ancestor(thd);
       if (arena)
-        thd->restore_backup_item_arena(arena, &backup);
+        thd->restore_active_arena(arena, &backup);
       if (res)
         DBUG_RETURN(1);
     }
@@ -4302,7 +4302,7 @@
   bool found;
   char name_buff[NAME_LEN+1];
   DBUG_ENTER("insert_fields");
-  DBUG_PRINT("arena", ("current arena: 0x%lx", (ulong)thd->current_arena));
+  DBUG_PRINT("arena", ("stmt arena: 0x%lx", (ulong)thd->stmt_arena));
 
   if (db_name && lower_case_table_names)
   {
@@ -4508,7 +4508,7 @@
                 COND **conds)
 {
   SELECT_LEX *select_lex= thd->lex->current_select;
-  Query_arena *arena= thd->current_arena, backup;
+  Query_arena *arena= thd->stmt_arena, backup;
   TABLE_LIST *table= NULL;	// For HP compilers
   /*
     it_is_update set to TRUE when tables of primary SELECT_LEX (SELECT_LEX
@@ -4584,7 +4584,7 @@
     }
   }
 
-  if (!thd->current_arena->is_conventional())
+  if (!thd->stmt_arena->is_conventional())
   {
     /*
       We are in prepared statement preparation code => we should store
@@ -4599,7 +4599,7 @@
 
 err:
   if (arena)
-    thd->restore_backup_item_arena(arena, &backup);
+    thd->restore_active_arena(arena, &backup);
 err_no_arena:
   DBUG_RETURN(1);
 }

--- 1.204/sql/sql_class.cc	2005-08-27 02:34:04 +04:00
+++ 1.205/sql/sql_class.cc	2005-09-02 16:55:04 +04:00
@@ -180,7 +180,7 @@
    in_lock_tables(0), bootstrap(0), derived_tables_processing(FALSE),
    spcont(NULL)
 {
-  current_arena= this;
+  stmt_arena= this;
   host= user= priv_user= db= ip= 0;
   catalog= (char*)"std"; // the only catalog we have for now
   host_or_ip= "connecting host";
@@ -794,7 +794,7 @@
 /*
   Register an item tree tree transformation, performed by the query
   optimizer. We need a pointer to runtime_memroot because it may be !=
-  thd->mem_root (due to possible set_n_backup_item_arena called for thd).
+  thd->mem_root (due to possible set_n_backup_active_arena called for thd).
 */
 
 void THD::nocheck_register_item_tree_change(Item **place, Item *old_value,
@@ -1602,13 +1602,13 @@
 }
 
 
-void Query_arena::set_n_backup_item_arena(Query_arena *set, Query_arena *backup)
+void THD::set_n_backup_active_arena(Query_arena *set, Query_arena *backup)
 {
-  DBUG_ENTER("Query_arena::set_n_backup_item_arena");
+  DBUG_ENTER("THD::set_n_backup_active_arena");
   DBUG_ASSERT(backup->is_backup_arena == FALSE);
 
-  backup->set_item_arena(this);
-  set_item_arena(set);
+  backup->set_query_arena(this);
+  set_query_arena(set);
 #ifndef DBUG_OFF
   backup->is_backup_arena= TRUE;
 #endif
@@ -1616,19 +1616,19 @@
 }
 
 
-void Query_arena::restore_backup_item_arena(Query_arena *set, Query_arena *backup)
+void THD::restore_active_arena(Query_arena *set, Query_arena *backup)
 {
-  DBUG_ENTER("Query_arena::restore_backup_item_arena");
+  DBUG_ENTER("THD::restore_active_arena");
   DBUG_ASSERT(backup->is_backup_arena);
-  set->set_item_arena(this);
-  set_item_arena(backup);
+  set->set_query_arena(this);
+  set_query_arena(backup);
 #ifndef DBUG_OFF
   backup->is_backup_arena= FALSE;
 #endif
   DBUG_VOID_RETURN;
 }
 
-void Query_arena::set_item_arena(Query_arena *set)
+void Query_arena::set_query_arena(Query_arena *set)
 {
   mem_root=  set->mem_root;
   free_list= set->free_list;

--- 1.261/sql/sql_class.h	2005-08-27 02:33:00 +04:00
+++ 1.262/sql/sql_class.h	2005-09-02 16:55:04 +04:00
@@ -733,9 +733,7 @@
     return ptr;
   }
 
-  void set_n_backup_item_arena(Query_arena *set, Query_arena *backup);
-  void restore_backup_item_arena(Query_arena *set, Query_arena *backup);
-  void set_item_arena(Query_arena *set);
+  void set_query_arena(Query_arena *set);
 
   void free_items();
 };
@@ -1230,16 +1228,16 @@
   /*
     A permanent memory area of the statement. For conventional
     execution, the parsed tree and execution runtime reside in the same
-    memory root. In this case current_arena points to THD. In case of
+    memory root. In this case stmt_arena points to THD. In case of
     a prepared statement or a stored procedure statement, thd->mem_root
-    conventionally points to runtime memory, and thd->current_arena
+    conventionally points to runtime memory, and thd->stmt_arena
     points to the memory of the PS/SP, where the parsed tree of the
     statement resides. Whenever you need to perform a permanent
     transformation of a parsed tree, you should allocate new memory in
-    current_arena, to allow correct re-execution of PS/SP.
-    Note: in the parser, current_arena == thd, even for PS/SP.
+    stmt_arena, to allow correct re-execution of PS/SP.
+    Note: in the parser, stmt_arena == thd, even for PS/SP.
   */
-  Query_arena *current_arena;
+  Query_arena *stmt_arena;
   /*
     next_insert_id is set on SET INSERT_ID= #. This is used as the next
     generated auto_increment value in handler.cc
@@ -1467,7 +1465,7 @@
   }
   inline bool fill_derived_tables()
   {
-    return !current_arena->is_stmt_prepare() && !lex->only_view_structure();
+    return !stmt_arena->is_stmt_prepare() && !lex->only_view_structure();
   }
   inline gptr trans_alloc(unsigned int size)
   {
@@ -1506,17 +1504,16 @@
   inline CHARSET_INFO *charset() { return variables.character_set_client; }
   void update_charset();
 
-  inline Query_arena *change_arena_if_needed(Query_arena *backup)
+  inline Query_arena *activate_stmt_arena_if_needed(Query_arena *backup)
   {
     /*
-      use new arena if we are in a prepared statements and we have not
-      already changed to use this arena.
+      Use the persistent arena if we are in a prepared statement or a stored
+      procedure statement and we have not already changed to use this arena.
     */
-    if (!current_arena->is_conventional() &&
-        mem_root != current_arena->mem_root)
+    if (!stmt_arena->is_conventional() && mem_root != stmt_arena->mem_root)
     {
-      set_n_backup_item_arena(current_arena, backup);
-      return current_arena;
+      set_n_backup_active_arena(stmt_arena, backup);
+      return stmt_arena;
     }
     return 0;
   }
@@ -1524,7 +1521,7 @@
   void change_item_tree(Item **place, Item *new_value)
   {
     /* TODO: check for OOM condition here */
-    if (!current_arena->is_conventional())
+    if (!stmt_arena->is_conventional())
       nocheck_register_item_tree_change(place, *place, mem_root);
     *place= new_value;
   }
@@ -1556,11 +1553,13 @@
   }
   void set_status_var_init();
   bool is_context_analysis_only()
-    { return current_arena->is_stmt_prepare() || lex->view_prepare_mode; }
+    { return stmt_arena->is_stmt_prepare() || lex->view_prepare_mode; }
   void reset_n_backup_open_tables_state(Open_tables_state *backup);
   void restore_backup_open_tables_state(Open_tables_state *backup);
   void reset_sub_statement_state(Sub_statement_state *backup, uint new_state);
   void restore_sub_statement_state(Sub_statement_state *backup);
+  void set_n_backup_active_arena(Query_arena *set, Query_arena *backup);
+  void restore_active_arena(Query_arena *set, Query_arena *backup);
 };
 
 

--- 1.165/sql/sql_lex.cc	2005-08-25 17:34:14 +04:00
+++ 1.166/sql/sql_lex.cc	2005-09-02 16:55:04 +04:00
@@ -1504,7 +1504,7 @@
     We have to create array in prepared statement memory if it is
     prepared statement
   */
-  Query_arena *arena= thd->current_arena;
+  Query_arena *arena= thd->stmt_arena;
   return (ref_pointer_array=
           (Item **)arena->alloc(sizeof(Item*) *
                                 (item_list.elements +
@@ -1826,7 +1826,7 @@
 {
   ha_rows select_limit_val;
 
-  DBUG_ASSERT(! thd->current_arena->is_stmt_prepare());
+  DBUG_ASSERT(! thd->stmt_arena->is_stmt_prepare());
   select_limit_val= (ha_rows)(sl->select_limit ? sl->select_limit->val_uint() :
                                                  HA_POS_ERROR);
   offset_limit_cnt= (ha_rows)(sl->offset_limit ? sl->offset_limit->val_uint() :
@@ -2038,7 +2038,7 @@
 
 void st_select_lex::fix_prepare_information(THD *thd, Item **conds)
 {
-  if (!thd->current_arena->is_conventional() && first_execution)
+  if (!thd->stmt_arena->is_conventional() && first_execution)
   {
     first_execution= 0;
     if (*conds)

--- 1.482/sql/sql_parse.cc	2005-09-02 13:00:53 +04:00
+++ 1.483/sql/sql_parse.cc	2005-09-02 16:55:04 +04:00
@@ -5275,7 +5275,7 @@
     it's a constant one. The flag is switched off in the end of
     mysql_stmt_prepare.
   */
-  if (thd->current_arena->is_stmt_prepare())
+  if (thd->stmt_arena->is_stmt_prepare())
     select_lex->uncacheable|= UNCACHEABLE_PREPARE;
   if (move_down)
   {
@@ -6081,7 +6081,7 @@
     ptr->db= empty_c_string;
     ptr->db_length= 0;
   }
-  if (thd->current_arena->is_stmt_prepare_or_first_sp_execute())
+  if (thd->stmt_arena->is_stmt_prepare_or_first_sp_execute())
     ptr->db= thd->strdup(ptr->db);
 
   ptr->alias= alias_str;
@@ -7301,7 +7301,7 @@
       against the opened tables to ensure we don't use a table that is part
       of the view (which can only be done after the table has been opened).
     */
-    if (thd->current_arena->is_stmt_prepare_or_first_sp_execute())
+    if (thd->stmt_arena->is_stmt_prepare_or_first_sp_execute())
     {
       /*
         For temporary tables we don't have to check if the created table exists

--- 1.364/sql/sql_select.cc	2005-08-31 22:05:02 +04:00
+++ 1.365/sql/sql_select.cc	2005-09-02 16:55:04 +04:00
@@ -581,11 +581,11 @@
       MEMROOT for prepared statements and stored procedures.
     */
 
-    Query_arena *arena= thd->current_arena, backup;
+    Query_arena *arena= thd->stmt_arena, backup;
     if (arena->is_conventional())
       arena= 0;                                   // For easier test
     else
-      thd->set_n_backup_item_arena(arena, &backup);
+      thd->set_n_backup_active_arena(arena, &backup);
 
     sel->first_cond_optimization= 0;
 
@@ -595,7 +595,7 @@
     sel->prep_where= conds ? conds->copy_andor_structure(thd) : 0;
 
     if (arena)
-      thd->restore_backup_item_arena(arena, &backup);
+      thd->restore_active_arena(arena, &backup);
   }
 
   conds= optimize_cond(this, conds, join_list, &cond_value);   
@@ -1744,7 +1744,7 @@
     things that are already allocated in thd->mem_root for Cursor::fetch()
   */
   main_mem_root=  *thd->mem_root;
-  state= thd->current_arena->state;
+  state= thd->stmt_arena->state;
   /* Allocate new memory root for thd */
   init_sql_alloc(thd->mem_root,
                  thd->variables.query_alloc_block_size,
@@ -1871,7 +1871,7 @@
   thd->query_id= query_id;
   thd->change_list= change_list;
   /* save references to memory, allocated during fetch */
-  thd->set_n_backup_item_arena(this, &backup_arena);
+  thd->set_n_backup_active_arena(this, &backup_arena);
 
   for (info= ht_info; info->read_view ; info++)
     (info->ht->set_cursor_read_view)(info->read_view);
@@ -1890,7 +1890,7 @@
     ha_release_temporary_latches(thd);
 #endif
   /* Grab free_list here to correctly free it in close */
-  thd->restore_backup_item_arena(this, &backup_arena);
+  thd->restore_active_arena(this, &backup_arena);
 
   for (info= ht_info; info->read_view; info++)
     (info->ht->set_cursor_read_view)(0);

--- 1.272/sql/sql_show.cc	2005-08-26 11:56:16 +04:00
+++ 1.273/sql/sql_show.cc	2005-09-02 16:55:05 +04:00
@@ -3610,7 +3610,7 @@
     }
     List_iterator_fast<Item> it(sel->item_list);
     if (!(transl=
-          (Field_translator*)(thd->current_arena->
+          (Field_translator*)(thd->stmt_arena->
                               alloc(sel->item_list.elements *
                                     sizeof(Field_translator)))))
     {

--- 1.183/sql/table.cc	2005-08-23 19:15:46 +04:00
+++ 1.184/sql/table.cc	2005-09-02 16:55:05 +04:00
@@ -1780,7 +1780,7 @@
     /* Create view fields translation table */
 
     if (!(transl=
-          (Field_translator*)(thd->current_arena->
+          (Field_translator*)(thd->stmt_arena->
                               alloc(select->item_list.elements *
                                     sizeof(Field_translator)))))
     {
@@ -1856,8 +1856,8 @@
     if (!no_where_clause && !where_processed)
     {
       TABLE_LIST *tbl= this;
-      Query_arena *arena= thd->current_arena, backup;
-      arena= thd->change_arena_if_needed(&backup);    // For easier test
+      Query_arena *arena= thd->stmt_arena, backup;
+      arena= thd->activate_stmt_arena_if_needed(&backup);  // For easier test
 
       /* Go up to join tree and try to find left join */
       for (; tbl; tbl= tbl->embedding)
@@ -1877,7 +1877,7 @@
       if (tbl == 0)
         *conds= and_conds(*conds, where);
       if (arena)
-        thd->restore_backup_item_arena(arena, &backup);
+        thd->restore_active_arena(arena, &backup);
       where_processed= TRUE;
     }
   }

--- 1.127/sql/sql_union.cc	2005-08-12 14:57:16 +04:00
+++ 1.128/sql/sql_union.cc	2005-09-02 16:55:05 +04:00
@@ -287,7 +287,7 @@
       all collations together for UNION.
     */
     List_iterator_fast<Item> tp(types);
-    Query_arena *arena= thd->current_arena;
+    Query_arena *arena= thd->stmt_arena;
     Item *type;
     ulonglong create_options;
 
@@ -332,7 +332,7 @@
     {
       Field **field;
       Query_arena *tmp_arena,backup;
-      tmp_arena= thd->change_arena_if_needed(&backup);
+      tmp_arena= thd->activate_stmt_arena_if_needed(&backup);
 
       for (field= table->field; *field; field++)
       {
@@ -340,12 +340,12 @@
 	if (!item || item_list.push_back(item))
 	{
           if (tmp_arena)
-	    thd->restore_backup_item_arena(tmp_arena, &backup);
+	    thd->restore_active_arena(tmp_arena, &backup);
 	  DBUG_RETURN(TRUE);
 	}
       }
       if (tmp_arena)
-        thd->restore_backup_item_arena(tmp_arena, &backup);
+        thd->restore_active_arena(tmp_arena, &backup);
       if (arena->is_stmt_prepare_or_first_sp_execute())
       {
 	/* prepare fake select to initialize it correctly */

--- 1.117/sql/item_subselect.cc	2005-08-13 12:14:36 +04:00
+++ 1.118/sql/item_subselect.cc	2005-09-02 16:55:03 +04:00
@@ -333,7 +333,7 @@
     return RES_OK;
 
   SELECT_LEX *select_lex= join->select_lex;
-  Query_arena *arena= thd->current_arena;
+  Query_arena *arena= thd->stmt_arena;
  
   if (!select_lex->master_unit()->first_select()->next_select() &&
       !select_lex->table_list.elements &&
@@ -1287,10 +1287,10 @@
   */
   if (!optimizer)
   {
-    arena= thd->change_arena_if_needed(&backup);
+    arena= thd->activate_stmt_arena_if_needed(&backup);
     result= (!(optimizer= new Item_in_optimizer(left_expr, this)));
     if (arena)
-      thd->restore_backup_item_arena(arena, &backup);
+      thd->restore_active_arena(arena, &backup);
     if (result)
       goto err;
   }
@@ -1306,7 +1306,7 @@
     goto err;
 
   transformed= 1;
-  arena= thd->change_arena_if_needed(&backup);
+  arena= thd->activate_stmt_arena_if_needed(&backup);
   /*
     Both transformers call fix_fields() only for Items created inside them,
     and all that items do not make permanent changes in current item arena
@@ -1322,14 +1322,14 @@
     if (func != &eq_creator)
     {
       if (arena)
-        thd->restore_backup_item_arena(arena, &backup);
+        thd->restore_active_arena(arena, &backup);
       my_error(ER_OPERAND_COLUMNS, MYF(0), 1);
       DBUG_RETURN(RES_ERROR);
     }
     res= row_value_transformer(join);
   }
   if (arena)
-    thd->restore_backup_item_arena(arena, &backup);
+    thd->restore_active_arena(arena, &backup);
 err:
   thd->where= save_where;
   DBUG_RETURN(res);

--- 1.73/sql/item_subselect.h	2005-08-10 00:23:46 +04:00
+++ 1.74/sql/item_subselect.h	2005-09-02 16:55:03 +04:00
@@ -26,7 +26,6 @@
 class select_subselect;
 class subselect_engine;
 class Item_bool_func2;
-class Item_arena;
 
 /* base class for subselects */
 

--- 1.59/sql/sql_view.cc	2005-08-25 18:37:33 +04:00
+++ 1.60/sql/sql_view.cc	2005-09-02 16:55:05 +04:00
@@ -700,11 +700,11 @@
     For now we assume that tables will not be changed during PS life (it
     will be TRUE as far as we make new table cache).
   */
-  Query_arena *arena= thd->current_arena, backup;
+  Query_arena *arena= thd->stmt_arena, backup;
   if (arena->is_conventional())
     arena= 0;
   else
-    thd->set_n_backup_item_arena(arena, &backup);
+    thd->set_n_backup_active_arena(arena, &backup);
 
   /* init timestamp */
   if (!table->timestamp.str)
@@ -997,13 +997,13 @@
 
 ok2:
   if (arena)
-    thd->restore_backup_item_arena(arena, &backup);
+    thd->restore_active_arena(arena, &backup);
   thd->lex= old_lex;
   DBUG_RETURN(0);
 
 err:
   if (arena)
-    thd->restore_backup_item_arena(arena, &backup);
+    thd->restore_active_arena(arena, &backup);
   delete table->view;
   table->view= 0;	// now it is not VIEW placeholder
   thd->lex= old_lex;

--- 1.91/sql/sp.cc	2005-08-27 14:29:30 +04:00
+++ 1.92/sql/sp.cc	2005-09-02 16:55:03 +04:00
@@ -1338,7 +1338,7 @@
   for (uint i=0 ; i < src->records ; i++)
   {
     Sroutine_hash_entry *rt= (Sroutine_hash_entry *)hash_element(src, i);
-    (void)add_used_routine(lex, thd->current_arena, &rt->key);
+    (void)add_used_routine(lex, thd->stmt_arena, &rt->key);
   }
 }
 
@@ -1485,7 +1485,7 @@
 sp_cache_routines_and_add_tables_for_triggers(THD *thd, LEX *lex,
                                               Table_triggers_list *triggers)
 {
-  if (add_used_routine(lex, thd->current_arena, &triggers->sroutines_key))
+  if (add_used_routine(lex, thd->stmt_arena, &triggers->sroutines_key))
   {
     Sroutine_hash_entry **last_cached_routine_ptr=
                             (Sroutine_hash_entry **)lex->sroutines_list.next;

--- 1.177/sql/sp_head.cc	2005-09-02 09:30:50 +04:00
+++ 1.178/sql/sp_head.cc	2005-09-02 16:55:03 +04:00
@@ -131,12 +131,12 @@
   do                                                                    \
   {                                                                     \
     if (condition)                                                      \
-      thd->set_n_backup_item_arena(thd->spcont->callers_arena,          \
-                                   backup_arena);                       \
+      thd->set_n_backup_active_arena(thd->spcont->callers_arena,        \
+                                     backup_arena);                     \
     new_command;                                                        \
     if (condition)                                                      \
-      thd->restore_backup_item_arena(thd->spcont->callers_arena,        \
-                                     &backup_current_arena);            \
+      thd->restore_active_arena(thd->spcont->callers_arena,             \
+                                backup_arena);                          \
   } while(0)
 
 /*
@@ -167,7 +167,7 @@
   DBUG_ENTER("sp_eval_func_item");
   Item *it= sp_prepare_func_item(thd, it_addr);
   uint rsize;
-  Query_arena backup_current_arena;
+  Query_arena backup_arena;
   DBUG_PRINT("info", ("type: %d", type));
 
   if (!it)
@@ -187,7 +187,7 @@
     }
     DBUG_PRINT("info", ("INT_RESULT: %d", i));
     CREATE_ON_CALLERS_ARENA(it= new(reuse, &rsize) Item_int(i),
-                            use_callers_arena, &backup_current_arena);
+                            use_callers_arena, &backup_arena);
     break;
   }
   case REAL_RESULT:
@@ -210,7 +210,7 @@
     max_length= it->max_length;
     DBUG_PRINT("info", ("REAL_RESULT: %g", d));
     CREATE_ON_CALLERS_ARENA(it= new(reuse, &rsize) Item_float(d),
-                            use_callers_arena, &backup_current_arena);
+                            use_callers_arena, &backup_arena);
     it->decimals= decimals;
     it->max_length= max_length;
     break;
@@ -221,7 +221,7 @@
     if (it->null_value)
       goto return_null_item;
     CREATE_ON_CALLERS_ARENA(it= new(reuse, &rsize) Item_decimal(val),
-                            use_callers_arena, &backup_current_arena);
+                            use_callers_arena, &backup_arena);
 #ifndef DBUG_OFF
     {
       char dbug_buff[DECIMAL_MAX_STR_LENGTH+1];
@@ -246,7 +246,7 @@
                        s->length(), s->c_ptr_quick()));
     CHARSET_INFO *itcs= it->collation.collation;
     CREATE_ON_CALLERS_ARENA(it= new(reuse, &rsize) Item_string(itcs),
-                            use_callers_arena, &backup_current_arena);
+                            use_callers_arena, &backup_arena);
     /*
       We have to use special constructor and allocate string
       on system heap here. This is because usual Item_string
@@ -276,7 +276,7 @@
 
 return_null_item:
   CREATE_ON_CALLERS_ARENA(it= new(reuse, &rsize) Item_null(),
-                    use_callers_arena, &backup_current_arena);
+                    use_callers_arena, &backup_arena);
   it->rsize= rsize;
 
   DBUG_RETURN(it);
@@ -765,7 +765,7 @@
   /* per-instruction arena */
   MEM_ROOT execute_mem_root;
   Query_arena execute_arena(&execute_mem_root, INITIALIZED_FOR_SP),
-              execute_backup_arena;
+              backup_arena;
   query_id_t old_query_id;
   TABLE *old_derived_tables;
   LEX *old_lex;
@@ -812,7 +812,7 @@
   if ((ctx= thd->spcont))
     ctx->clear_handler();
   thd->query_error= 0;
-  old_arena= thd->current_arena;
+  old_arena= thd->stmt_arena;
 
   /*
     We have to save/restore this info when we are changing call level to
@@ -848,13 +848,13 @@
     Switch to per-instruction arena here. We can do it since we cleanup
     arena after every instruction.
   */
-  thd->set_n_backup_item_arena(&execute_arena, &execute_backup_arena);
+  thd->set_n_backup_active_arena(&execute_arena, &backup_arena);
 
   /*
     Save callers arena in order to store instruction results and out
     parameters in it later during sp_eval_func_item()
   */
-  thd->spcont->callers_arena= &execute_backup_arena;
+  thd->spcont->callers_arena= &backup_arena;
 
   do
   {
@@ -869,12 +869,12 @@
     if (!thd->in_sub_stmt)
       thd->set_time();		// Make current_time() et al work
     /*
-      We have to set thd->current_arena before executing the instruction
+      We have to set thd->stmt_arena before executing the instruction
       to store in the instruction free_list all new items, created
       during the first execution (for example expanding of '*' or the
       items made during other permanent subquery transformations).
     */
-    thd->current_arena= i;
+    thd->stmt_arena= i;
     ret= i->execute(thd, &ip);
 
     /*
@@ -907,9 +907,9 @@
       case SP_HANDLER_NONE:
 	break;
       case SP_HANDLER_CONTINUE:
-        thd->restore_backup_item_arena(&execute_arena, &execute_backup_arena);
+        thd->restore_active_arena(&execute_arena, &backup_arena);
         ctx->save_variables(hf);
-        thd->set_n_backup_item_arena(&execute_arena, &execute_backup_arena);
+        thd->set_n_backup_active_arena(&execute_arena, &backup_arena);
         ctx->push_hstack(ip);
         // Fall through
       default:
@@ -924,7 +924,7 @@
     }
   } while (ret == 0 && !thd->killed);
 
-  thd->restore_backup_item_arena(&execute_arena, &execute_backup_arena);
+  thd->restore_active_arena(&execute_arena, &backup_arena);
 
 
   /* Restore all saved */
@@ -939,7 +939,7 @@
   thd->derived_tables= old_derived_tables;
   thd->variables.sql_mode= save_sql_mode;
 
-  thd->current_arena= old_arena;
+  thd->stmt_arena= old_arena;
   state= EXECUTED;
 
  done:
@@ -1532,7 +1532,7 @@
 {
   DBUG_ENTER("sp_head::restore_thd_mem_root");
   Item *flist= free_list;	// The old list
-  set_item_arena(thd);          // Get new free_list and mem_root
+  set_query_arena(thd);         // Get new free_list and mem_root
   state= INITIALIZED_FOR_SP;
 
   DBUG_PRINT("info", ("mem_root 0x%lx returned from thd mem root 0x%lx",
@@ -2359,20 +2359,18 @@
 int
 sp_instr_cpush::execute(THD *thd, uint *nextp)
 {
-  Query_arena backup_current_arena;
+  Query_arena backup_arena;
   DBUG_ENTER("sp_instr_cpush::execute");
 
   /*
     We should create cursors in the callers arena, as
     it could be (and usually is) used in several instructions.
   */
-  thd->set_n_backup_item_arena(thd->spcont->callers_arena,
-                               &backup_current_arena);
+  thd->set_n_backup_active_arena(thd->spcont->callers_arena, &backup_arena);
 
   thd->spcont->push_cursor(&m_lex_keeper, this);
 
-  thd->restore_backup_item_arena(thd->spcont->callers_arena,
-                                 &backup_current_arena);
+  thd->restore_active_arena(thd->spcont->callers_arena, &backup_arena);
 
   *nextp= m_ip+1;
 
@@ -2439,19 +2437,19 @@
     }
     else
     {
-      Query_arena *old_arena= thd->current_arena;
+      Query_arena *old_arena= thd->stmt_arena;
 
       /*
         Get the Query_arena from the cpush instruction, which contains
         the free_list of the query, so new items (if any) are stored in
         the right free_list, and we can cleanup after each open.
       */
-      thd->current_arena= c->get_instr();
+      thd->stmt_arena= c->get_instr();
       res= lex_keeper->reset_lex_and_exec_core(thd, nextp, FALSE, this);
       /* Cleanup the query's items */
-      if (thd->current_arena->free_list)
-	cleanup_items(thd->current_arena->free_list);
-      thd->current_arena= old_arena;
+      if (thd->stmt_arena->free_list)
+        cleanup_items(thd->stmt_arena->free_list);
+      thd->stmt_arena= old_arena;
       /*
         Work around the fact that errors in selects are not returned properly
         (but instead converted into a warning), so if a condition handler
@@ -2526,18 +2524,16 @@
 {
   sp_cursor *c= thd->spcont->get_cursor(m_cursor);
   int res;
-  Query_arena backup_current_arena;
+  Query_arena backup_arena;
   DBUG_ENTER("sp_instr_cfetch::execute");
 
   if (! c)
     res= -1;
   else
   {
-    thd->set_n_backup_item_arena(thd->spcont->callers_arena,
-                                 &backup_current_arena);
+    thd->set_n_backup_active_arena(thd->spcont->callers_arena, &backup_arena);
     res= c->fetch(thd, &m_varlist);
-    thd->restore_backup_item_arena(thd->spcont->callers_arena,
-                                   &backup_current_arena);
+    thd->restore_active_arena(thd->spcont->callers_arena, &backup_arena);
   }
 
   *nextp= m_ip+1;
@@ -2790,7 +2786,7 @@
   /*
     Use persistent arena for table list allocation to be PS friendly.
   */
-  arena= thd->change_arena_if_needed(&backup);
+  arena= thd->activate_stmt_arena_if_needed(&backup);
 
   for (i=0 ; i < m_sptabs.records ; i++)
   {
@@ -2835,7 +2831,7 @@
   }
 
   if (arena)
-    thd->restore_backup_item_arena(arena, &backup);
+    thd->restore_active_arena(arena, &backup);
 
   DBUG_RETURN(result);
 }

--- 1.149/sql/sql_prepare.cc	2005-08-19 22:55:20 +04:00
+++ 1.150/sql/sql_prepare.cc	2005-09-02 16:55:04 +04:00
@@ -1767,12 +1767,12 @@
     both of backup_statement() and backup_item_area() here.
   */
   thd->set_n_backup_statement(stmt, &stmt_backup);
-  thd->set_n_backup_item_arena(stmt, &stmt_backup);
+  thd->set_n_backup_active_arena(stmt, &stmt_backup);
 
   if (alloc_query(thd, packet, packet_length))
   {
     thd->restore_backup_statement(stmt, &stmt_backup);
-    thd->restore_backup_item_arena(stmt, &stmt_backup);
+    thd->restore_active_arena(stmt, &stmt_backup);
     /* Statement map deletes statement on erase */
     thd->stmt_map.erase(stmt);
     DBUG_RETURN(TRUE);
@@ -1780,7 +1780,7 @@
 
   mysql_log.write(thd, thd->command, "[%lu] %s", stmt->id, packet);
 
-  thd->current_arena= stmt;
+  thd->stmt_arena= stmt;
   mysql_init_query(thd, (uchar *) thd->query, thd->query_length);
   /* Reset warnings from previous command */
   mysql_reset_errors(thd, 0);
@@ -1800,7 +1800,7 @@
     transformation can be reused on execute, we set again thd->mem_root from
     stmt->mem_root (see setup_wild for one place where we do that).
   */
-  thd->restore_backup_item_arena(stmt, &stmt_backup);
+  thd->restore_active_arena(stmt, &stmt_backup);
 
   if (!error)
     error= check_prepared_statement(stmt, test(name));
@@ -1817,7 +1817,7 @@
   close_thread_tables(thd);
   cleanup_stmt_and_thd_after_use(stmt, thd);
   thd->restore_backup_statement(stmt, &stmt_backup);
-  thd->current_arena= thd;
+  thd->stmt_arena= thd;
 
   if (error)
   {
@@ -2063,7 +2063,7 @@
     goto set_params_data_err;
 #endif
   thd->set_n_backup_statement(stmt, &stmt_backup);
-  thd->current_arena= stmt;
+  thd->stmt_arena= stmt;
   reinit_stmt_before_use(thd, stmt->lex);
   /* From now cursors assume that thd->mem_root is clean */
   if (expanded_query.length() &&
@@ -2110,7 +2110,7 @@
 
   thd->set_statement(&stmt_backup);
   thd->lock_id= &thd->main_lock_id;
-  thd->current_arena= thd;
+  thd->stmt_arena= thd;
   DBUG_VOID_RETURN;
 
 set_params_data_err:
@@ -2205,7 +2205,7 @@
     transformations of the query tree (i.e. negations elimination).
     This should be done permanently on the parse tree of this statement.
   */
-  thd->current_arena= stmt;
+  thd->stmt_arena= stmt;
 
   if (!(specialflag & SPECIAL_NO_PRIOR))
     my_pthread_setprio(pthread_self(),QUERY_PRIOR);
@@ -2224,7 +2224,7 @@
   close_thread_tables(thd);                    // to close derived tables
   cleanup_stmt_and_thd_after_use(stmt, thd);
   reset_stmt_params(stmt);
-  thd->current_arena= thd;
+  thd->stmt_arena= thd;
 
   if (stmt->state == Query_arena::PREPARED)
     stmt->state= Query_arena::EXECUTED;
@@ -2263,7 +2263,7 @@
     DBUG_VOID_RETURN;
   }
 
-  thd->current_arena= stmt;
+  thd->stmt_arena= stmt;
   thd->set_n_backup_statement(stmt, &stmt_backup);
 
   if (!(specialflag & SPECIAL_NO_PRIOR))
@@ -2291,7 +2291,7 @@
   }
 
   thd->restore_backup_statement(stmt, &stmt_backup);
-  thd->current_arena= thd;
+  thd->stmt_arena= thd;
 
   DBUG_VOID_RETURN;
 }
Thread
bk commit into 5.0 tree (konstantin:1.1948)Konstantin Osipov2 Sep