List:Commits« Previous MessageNext Message »
From:Davi Arnaut Date:November 10 2009 8:32pm
Subject:bzr push into mysql-5.5-next-mr-runtime branch (davi:2921 to 2922)
Bug#15192
View as plain text  
 2922 Davi Arnaut	2009-11-10
      Backport of Bug#15192 to mysql-next-mr
      ------------------------------------------------------------
      revno: 2597.4.17
      revision-id: sp1r-davi@stripped/endora.local-20080328174753-24337
      parent: sp1r-anozdrin/alik@stripped
      committer: davi@stripped/endora.local
      timestamp: Fri 2008-03-28 14:47:53 -0300
      message:
        Bug#15192 "fatal errors" are caught by handlers in stored procedures
      
        The problem is that fatal errors (e.g.: out of memory) were being
        caught by stored procedure exception handlers which could cause
        the execution to not be stopped due to a continue handler.
      
        The solution is to not call any exception handler if the error is
        fatal and send the fatal error to the client.
     @ mysql-test/r/sp-error.result
        Add test case result for Bug#15192
     @ mysql-test/t/sp-error.test
        Add test case for Bug#15192
     @ mysys/my_alloc.c
        Pass flag to signal fatal error in memory root allocations.
     @ sql/event_data_objects.cc
        Use init_sql_alloc to initialize memory roots, which uses
        the sql error handler to push errors.
     @ sql/ha_partition.cc
        Pass flag to signal fatal error instead of calling fatal_error.
     @ sql/item_func.cc
        Pass flag to signal fatal error instead of calling fatal_error.
     @ sql/item_subselect.cc
        Remove redundant fatal error, memory root already pushes error.
     @ sql/opt_sum.cc
        Pass flag to signal fatal error instead of calling fatal_error.
     @ sql/sp_head.cc
        Allocator already sets fatal error.
     @ sql/sql_class.h
        A error must exist for it to be fatal. Pass flag to signal fatal
        error instead of calling fatal_error.
     @ sql/sql_insert.cc
        Pass flag to signal fatal error instead of calling fatal_error.
     @ sql/sql_list.h
        Pass flag to signal fatal error instead of calling fatal_error.
     @ sql/sql_parse.cc
        Pass flag to signal fatal error instead of calling fatal_error.
     @ sql/sql_partition.cc
        Pass flag to signal fatal error instead of calling fatal_error.
     @ sql/sql_select.cc
        Pass flag to signal fatal error instead of calling fatal_error.
     @ sql/sql_servers.cc
        Use init_sql_alloc to initialize memory roots, which uses
        the sql error handler to push errors.
     @ sql/sql_show.cc
        Pass flag to signal fatal error instead of calling fatal_error.
     @ sql/sql_trigger.cc
        Use init_sql_alloc to initialize memory roots, which uses
        the sql error handler to push errors.
     @ sql/sql_update.cc
        Pass flag to signal fatal error instead of calling fatal_error.
     @ sql/tztime.cc
        Use init_sql_alloc to initialize memory roots, which uses
        the sql error handler to push errors.

    modified:
      mysql-test/r/sp-error.result
      mysql-test/t/sp-error.test
      mysys/my_alloc.c
      sql/event_data_objects.cc
      sql/ha_partition.cc
      sql/item_func.cc
      sql/item_subselect.cc
      sql/opt_sum.cc
      sql/sp_head.cc
      sql/sql_class.h
      sql/sql_insert.cc
      sql/sql_list.h
      sql/sql_parse.cc
      sql/sql_partition.cc
      sql/sql_select.cc
      sql/sql_servers.cc
      sql/sql_show.cc
      sql/sql_trigger.cc
      sql/sql_update.cc
      sql/tztime.cc
 2921 Davi Arnaut	2009-11-10
      Backport of Bug#41860 to mysql-next-mr
      ------------------------------------------------------------
      revno: 3317
      revision-id: davi.arnaut@stripped
      parent: patrick.crews@stripped
      committer: Davi Arnaut <Davi.Arnaut@stripped>
      branch nick: 41860-6.0
      timestamp: Fri 2009-05-22 14:09:16 -0300
      message:
        Bug#41860: Without Windows named pipe
      
        The problem was that the patch for Bug#10374 broke named pipe
        and shared memory transports on Windows due to a failure to
        implement a dummy poll method for transports other than BSD
        sockets. Another problem was that mysqltest lacked support
        for named pipe and shared memory connections, which lead to
        misleading test cases that were supposed run common queries
        over both transports.
      
        The solution is to properly implement, at the VIO layer, the
        poll and is_connected methods. The is_connected method is
        implemented for every suppported transport and the poll one
        only where it makes sense. Furthermore, support for named pipe
        and shared memory connections is added to mysqltest as to
        enable testing of both transports using the test suite.
     @ client/mysqltest.cc
        Add support for named pipe and shared memory connections.
     @ include/violite.h
        Move private functions to vio/vio_priv.h
        Add poll_read and is_connected methods.
     @ mysql-test/t/named_pipe.test
        Run tests over a named pipe connection.
     @ mysql-test/t/shm.test
        Run tests over a shared memory connection.
     @ sql/item_func.cc
        Rename method.
     @ sql/sql_class.cc
        Remove higher-level vio_is_connected implementation.
     @ sql/sql_class.h
        Rename vio_is_connected to not conflict with the vio one.
        Verify that there is a valid vio.
     @ vio/vio.c
        Add poll_read and is_connected methods.
     @ vio/vio_priv.h
        Add private functions.
     @ vio/viosocket.c
        Implement the is_connected method for the various transports.

    modified:
      client/mysqltest.cc
      include/violite.h
      mysql-test/t/named_pipe.test
      mysql-test/t/shm.test
      sql/item_func.cc
      sql/sql_class.cc
      sql/sql_class.h
      vio/vio.c
      vio/vio_priv.h
      vio/viosocket.c
=== modified file 'mysql-test/r/sp-error.result'
--- a/mysql-test/r/sp-error.result	2009-08-04 11:25:19 +0000
+++ b/mysql-test/r/sp-error.result	2009-11-10 20:31:28 +0000
@@ -1659,6 +1659,17 @@ begin
 declare continue handler for sqlstate '00000' set @x=0;
 end$$
 ERROR 42000: Bad SQLSTATE: '00000'
+drop procedure if exists p1;
+set @old_recursion_depth = @@max_sp_recursion_depth;
+set @@max_sp_recursion_depth = 255;
+create procedure p1(a int)
+begin
+declare continue handler for sqlexception select 'exception';
+call p1(a+1);
+end|
+call p1(1);
+set @@max_sp_recursion_depth = @old_recursion_depth;
+drop procedure p1;
 LOAD DATA INFILE '../../tmp/proc.txt' INTO TABLE mysql.proc;
 CREATE TABLE t1 (a INT, b INT);
 INSERT INTO t1 VALUES (1,1), (2,2);

=== modified file 'mysql-test/t/sp-error.test'
--- a/mysql-test/t/sp-error.test	2009-05-27 15:19:44 +0000
+++ b/mysql-test/t/sp-error.test	2009-11-10 20:31:28 +0000
@@ -2421,6 +2421,27 @@ delimiter ;$$
 
 
 #
+# Bug#15192: "fatal errors" are caught by handlers in stored procedures
+#
+
+--disable_warnings
+drop procedure if exists p1;
+--enable_warnings
+set @old_recursion_depth = @@max_sp_recursion_depth;
+set @@max_sp_recursion_depth = 255;
+delimiter |;
+create procedure p1(a int)
+begin
+  declare continue handler for sqlexception select 'exception';
+  call p1(a+1);
+end|
+delimiter ;|
+--error 0,ER_STACK_OVERRUN_NEED_MORE
+call p1(1);
+set @@max_sp_recursion_depth = @old_recursion_depth;
+drop procedure p1;
+
+#
 # BUG#NNNN: New bug synopsis
 #
 #--disable_warnings

=== modified file 'mysys/my_alloc.c'
--- a/mysys/my_alloc.c	2009-01-15 18:11:25 +0000
+++ b/mysys/my_alloc.c	2009-11-10 20:31:28 +0000
@@ -155,7 +155,7 @@ void *alloc_root(MEM_ROOT *mem_root, siz
   DBUG_ASSERT(alloc_root_inited(mem_root));
 
   length+=ALIGN_SIZE(sizeof(USED_MEM));
-  if (!(next = (USED_MEM*) my_malloc(length,MYF(MY_WME))))
+  if (!(next = (USED_MEM*) my_malloc(length,MYF(MY_WME | ME_FATALERROR))))
   {
     if (mem_root->error_handler)
       (*mem_root->error_handler)();
@@ -198,7 +198,7 @@ void *alloc_root(MEM_ROOT *mem_root, siz
     get_size= length+ALIGN_SIZE(sizeof(USED_MEM));
     get_size= max(get_size, block_size);
 
-    if (!(next = (USED_MEM*) my_malloc(get_size,MYF(MY_WME))))
+    if (!(next = (USED_MEM*) my_malloc(get_size,MYF(MY_WME | ME_FATALERROR))))
     {
       if (mem_root->error_handler)
 	(*mem_root->error_handler)();

=== modified file 'sql/event_data_objects.cc'
--- a/sql/event_data_objects.cc	2009-10-07 20:57:03 +0000
+++ b/sql/event_data_objects.cc	2009-11-10 20:31:28 +0000
@@ -196,7 +196,7 @@ Event_basic::Event_basic()
 {
   DBUG_ENTER("Event_basic::Event_basic");
   /* init memory root */
-  init_alloc_root(&mem_root, 256, 512);
+  init_sql_alloc(&mem_root, 256, 512);
   dbname.str= name.str= NULL;
   dbname.length= name.length= 0;
   time_zone= NULL;

=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc	2009-10-23 11:22:21 +0000
+++ b/sql/ha_partition.cc	2009-11-10 20:31:28 +0000
@@ -1980,8 +1980,7 @@ partition_element *ha_partition::find_pa
       return part_elem;
   }
   DBUG_ASSERT(0);
-  my_error(ER_OUT_OF_RESOURCES, MYF(0));
-  current_thd->fatal_error();                   // Abort
+  my_error(ER_OUT_OF_RESOURCES, MYF(ME_FATALERROR));
   return NULL;
 }
 

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2009-11-10 19:36:38 +0000
+++ b/sql/item_func.cc	2009-11-10 20:31:28 +0000
@@ -3818,7 +3818,7 @@ static user_var_entry *get_variable(HASH
     uint size=ALIGN_SIZE(sizeof(user_var_entry))+name.length+1+extra_size;
     if (!my_hash_inited(hash))
       return 0;
-    if (!(entry = (user_var_entry*) my_malloc(size,MYF(MY_WME))))
+    if (!(entry = (user_var_entry*) my_malloc(size,MYF(MY_WME | ME_FATALERROR))))
       return 0;
     entry->name.str=(char*) entry+ ALIGN_SIZE(sizeof(user_var_entry))+
       extra_size;
@@ -3956,6 +3956,8 @@ bool Item_func_set_user_var::register_fi
   @param dv             derivation for new value
   @param unsigned_arg   indiates if a value of type INT_RESULT is unsigned
 
+  @note Sets error and fatal error if allocation fails.
+
   @retval
     false   success
   @retval
@@ -3999,7 +4001,8 @@ update_hash(user_var_entry *entry, bool 
 	if (entry->value == pos)
 	  entry->value=0;
         entry->value= (char*) my_realloc(entry->value, length,
-                                         MYF(MY_ALLOW_ZERO_PTR | MY_WME));
+                                         MYF(MY_ALLOW_ZERO_PTR | MY_WME |
+                                             ME_FATALERROR));
         if (!entry->value)
 	  return 1;
       }
@@ -4036,7 +4039,6 @@ Item_func_set_user_var::update_hash(void
   if (::update_hash(entry, (null_value= args[0]->null_value),
                     ptr, length, res_type, cs, dv, unsigned_arg))
   {
-    current_thd->fatal_error();     // Probably end of memory
     null_value= 1;
     return 1;
   }
@@ -4769,11 +4771,6 @@ void Item_func_get_user_var::fix_length_
     m_cached_result_type= STRING_RESULT;
     max_length= MAX_BLOB_WIDTH;
   }
-
-  if (error)
-    thd->fatal_error();
-
-  return;
 }
 
 
@@ -4857,18 +4854,16 @@ bool Item_user_var_as_out_param::fix_fie
 
 void Item_user_var_as_out_param::set_null_value(CHARSET_INFO* cs)
 {
-  if (::update_hash(entry, TRUE, 0, 0, STRING_RESULT, cs,
-                    DERIVATION_IMPLICIT, 0 /* unsigned_arg */))
-    current_thd->fatal_error();			// Probably end of memory
+  ::update_hash(entry, TRUE, 0, 0, STRING_RESULT, cs,
+                DERIVATION_IMPLICIT, 0 /* unsigned_arg */);
 }
 
 
 void Item_user_var_as_out_param::set_value(const char *str, uint length,
                                            CHARSET_INFO* cs)
 {
-  if (::update_hash(entry, FALSE, (void*)str, length, STRING_RESULT, cs,
-                    DERIVATION_IMPLICIT, 0 /* unsigned_arg */))
-    current_thd->fatal_error();			// Probably end of memory
+  ::update_hash(entry, FALSE, (void*)str, length, STRING_RESULT, cs,
+                DERIVATION_IMPLICIT, 0 /* unsigned_arg */);
 }
 
 

=== modified file 'sql/item_subselect.cc'
--- a/sql/item_subselect.cc	2009-10-16 15:58:26 +0000
+++ b/sql/item_subselect.cc	2009-11-10 20:31:28 +0000
@@ -1735,8 +1735,6 @@ subselect_union_engine::subselect_union_
   :subselect_engine(item_arg, result_arg)
 {
   unit= u;
-  if (!result_arg)				//out of memory
-    current_thd->fatal_error();
   unit->item= item_arg;
 }
 
@@ -1748,10 +1746,7 @@ int subselect_single_select_engine::prep
   join= new JOIN(thd, select_lex->item_list,
 		 select_lex->options | SELECT_NO_UNLOCK, result);
   if (!join || !result)
-  {
-    thd->fatal_error();				//out of memory
-    return 1;
-  }
+    return 1; /* Fatal error is set already. */
   prepared= 1;
   SELECT_LEX *save_select= thd->lex->current_select;
   thd->lex->current_select= select_lex;

=== modified file 'sql/opt_sum.cc'
--- a/sql/opt_sum.cc	2009-10-28 10:07:30 +0000
+++ b/sql/opt_sum.cc	2009-11-10 20:31:28 +0000
@@ -175,8 +175,7 @@ int opt_sum_query(TABLE_LIST *tables, Li
       error= tl->table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
       if(error)
       {
-        tl->table->file->print_error(error, MYF(0));
-        tl->table->in_use->fatal_error();
+        tl->table->file->print_error(error, MYF(ME_FATALERROR));
         return error;
       }
       count*= tl->table->file->stats.records;
@@ -427,8 +426,7 @@ int opt_sum_query(TABLE_LIST *tables, Li
 	    if (error == HA_ERR_KEY_NOT_FOUND || error == HA_ERR_END_OF_FILE)
 	      return HA_ERR_KEY_NOT_FOUND;	     // No rows matching WHERE
 	    /* HA_ERR_LOCK_DEADLOCK or some other error */
- 	    table->file->print_error(error, MYF(0));
-            table->in_use->fatal_error();
+            table->file->print_error(error, MYF(ME_FATALERROR));
             return(error);
 	  }
           removed_tables|= table->map;

=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc	2009-11-10 18:11:27 +0000
+++ b/sql/sp_head.cc	2009-11-10 20:31:28 +0000
@@ -4012,10 +4012,7 @@ sp_add_to_query_tables(THD *thd, LEX *le
   TABLE_LIST *table;
 
   if (!(table= (TABLE_LIST *)thd->calloc(sizeof(TABLE_LIST))))
-  {
-    thd->fatal_error();
     return NULL;
-  }
   table->db_length= strlen(db);
   table->db= thd->strmake(db, table->db_length);
   table->table_name_length= strlen(name);

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2009-11-10 19:36:38 +0000
+++ b/sql/sql_class.h	2009-11-10 20:31:28 +0000
@@ -1978,6 +1978,7 @@ public:
   */
   inline void fatal_error()
   {
+    DBUG_ASSERT(main_da.is_error());
     is_fatal_error= 1;
     DBUG_PRINT("error",("Fatal error set"));
   }
@@ -2139,7 +2140,10 @@ public:
     else
     {
       x_free(db);
-      db= new_db ? my_strndup(new_db, new_db_len, MYF(MY_WME)) : NULL;
+      if (new_db)
+        db= my_strndup(new_db, new_db_len, MYF(MY_WME | ME_FATALERROR));
+      else
+        db= NULL;
     }
     db_length= db ? new_db_len : 0;
     return new_db && !db;

=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc	2009-11-02 11:10:04 +0000
+++ b/sql/sql_insert.cc	2009-11-10 20:31:28 +0000
@@ -1922,20 +1922,17 @@ bool delayed_get_table(THD *thd, TABLE_L
     if (! (di= find_handler(thd, table_list)))
     {
       if (!(di= new Delayed_insert()))
-      {
-        thd->fatal_error();
         goto end_create;
-      }
       pthread_mutex_lock(&LOCK_thread_count);
       thread_count++;
       pthread_mutex_unlock(&LOCK_thread_count);
       di->thd.set_db(table_list->db, (uint) strlen(table_list->db));
-      di->thd.set_query(my_strdup(table_list->table_name, MYF(MY_WME)), 0);
+      di->thd.set_query(my_strdup(table_list->table_name,
+                                  MYF(MY_WME | ME_FATALERROR)), 0);
       if (di->thd.db == NULL || di->thd.query == NULL)
       {
         /* The error is reported */
 	delete di;
-        thd->fatal_error();
         goto end_create;
       }
       di->table_list= *table_list;			// Needed to open table
@@ -1953,8 +1950,7 @@ bool delayed_get_table(THD *thd, TABLE_L
 	pthread_mutex_unlock(&di->mutex);
 	di->unlock();
 	delete di;
-	my_error(ER_CANT_CREATE_THREAD, MYF(0), error);
-        thd->fatal_error();
+	my_error(ER_CANT_CREATE_THREAD, MYF(ME_FATALERROR), error);
         goto end_create;
       }
 
@@ -2331,8 +2327,8 @@ static void handle_delayed_insert_impl(T
   }
   if (!(di->table->file->ha_table_flags() & HA_CAN_INSERT_DELAYED))
   {
-    thd->fatal_error();
-    my_error(ER_DELAYED_NOT_SUPPORTED, MYF(0), di->table_list.table_name);
+    my_error(ER_DELAYED_NOT_SUPPORTED, MYF(ME_FATALERROR),
+             di->table_list.table_name);
     goto err;
   }
   if (di->table->triggers)

=== modified file 'sql/sql_list.h'
--- a/sql/sql_list.h	2009-10-22 19:31:06 +0000
+++ b/sql/sql_list.h	2009-11-10 20:31:28 +0000
@@ -458,7 +458,7 @@ struct ilink
   struct ilink **prev,*next;
   static void *operator new(size_t size) throw ()
   {
-    return (void*)my_malloc((uint)size, MYF(MY_WME | MY_FAE));
+    return (void*)my_malloc((uint)size, MYF(MY_WME | MY_FAE | ME_FATALERROR));
   }
   static void operator delete(void* ptr_arg, size_t size)
   {

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2009-11-10 18:48:46 +0000
+++ b/sql/sql_parse.cc	2009-11-10 20:31:28 +0000
@@ -5823,7 +5823,6 @@ bool check_stack_overrun(THD *thd, long 
     my_snprintf(ebuff, sizeof(ebuff), ER(ER_STACK_OVERRUN_NEED_MORE),
                 stack_used, my_thread_stack_size, margin);
     my_message(ER_STACK_OVERRUN_NEED_MORE, ebuff, MYF(ME_FATALERROR));
-    thd->fatal_error();
     return 1;
   }
 #ifndef DBUG_OFF

=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc	2009-10-22 22:30:28 +0000
+++ b/sql/sql_partition.cc	2009-11-10 20:31:28 +0000
@@ -2084,8 +2084,7 @@ char *generate_partition_syntax(partitio
     default:
       DBUG_ASSERT(0);
       /* We really shouldn't get here, no use in continuing from here */
-      my_error(ER_OUT_OF_RESOURCES, MYF(0));
-      current_thd->fatal_error();
+      my_error(ER_OUT_OF_RESOURCES, MYF(ME_FATALERROR));
       DBUG_RETURN(NULL);
   }
   if (part_info->part_expr)
@@ -5150,10 +5149,7 @@ static bool mysql_change_partitions(ALTE
                                          &lpt->deleted, lpt->pack_frm_data,
                                          lpt->pack_frm_len)))
   {
-    if (error != ER_OUTOFMEMORY)
-      file->print_error(error, MYF(0));
-    else
-      lpt->thd->fatal_error();
+    file->print_error(error, MYF(error != ER_OUTOFMEMORY ? 0 : ME_FATALERROR));
     DBUG_RETURN(TRUE);
   }
   DBUG_RETURN(FALSE);

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2009-11-02 11:10:04 +0000
+++ b/sql/sql_select.cc	2009-11-10 20:31:28 +0000
@@ -9628,7 +9628,7 @@ Field *create_tmp_field(THD *thd, TABLE 
     Item_sum *item_sum=(Item_sum*) item;
     result= item_sum->create_tmp_field(group, table, convert_blob_length);
     if (!result)
-      thd->fatal_error();
+      my_error(ER_OUT_OF_RESOURCES, MYF(ME_FATALERROR));
     return result;
   }
   case Item::FIELD_ITEM:
@@ -10771,8 +10771,7 @@ bool create_myisam_from_heap(THD *thd, T
       We don't want this error to be converted to a warning, e.g. in case of
       INSERT IGNORE ... SELECT.
     */
-    thd->fatal_error();
-    table->file->print_error(error,MYF(0));
+    table->file->print_error(error, MYF(ME_FATALERROR));
     DBUG_RETURN(1);
   }
 
@@ -14930,8 +14929,7 @@ calc_group_buffer(JOIN *join,ORDER *grou
       default:
         /* This case should never be choosen */
         DBUG_ASSERT(0);
-        my_error(ER_OUT_OF_RESOURCES, MYF(0));
-        join->thd->fatal_error();
+        my_error(ER_OUT_OF_RESOURCES, MYF(ME_FATALERROR));
       }
     }
     parts++;

=== modified file 'sql/sql_servers.cc'
--- a/sql/sql_servers.cc	2009-10-14 16:37:38 +0000
+++ b/sql/sql_servers.cc	2009-11-10 20:31:28 +0000
@@ -128,7 +128,7 @@ bool servers_init(bool dont_read_servers
   }
 
   /* Initialize the mem root for data */
-  init_alloc_root(&mem, ACL_ALLOC_BLOCK_SIZE, 0);
+  init_sql_alloc(&mem, ACL_ALLOC_BLOCK_SIZE, 0);
 
   if (dont_read_servers_table)
     goto end;
@@ -180,7 +180,7 @@ static bool servers_load(THD *thd, TABLE
 
   my_hash_reset(&servers_cache);
   free_root(&mem, MYF(0));
-  init_alloc_root(&mem, ACL_ALLOC_BLOCK_SIZE, 0);
+  init_sql_alloc(&mem, ACL_ALLOC_BLOCK_SIZE, 0);
 
   init_read_record(&read_record_info,thd,table=tables[0].table,NULL,1,0, 
                    FALSE);

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2009-11-10 14:21:50 +0000
+++ b/sql/sql_show.cc	2009-11-10 20:31:28 +0000
@@ -4960,8 +4960,7 @@ static int get_schema_partitions_record(
       break;
     default:
       DBUG_ASSERT(0);
-      my_error(ER_OUT_OF_RESOURCES, MYF(0));
-      current_thd->fatal_error();
+      my_error(ER_OUT_OF_RESOURCES, MYF(ME_FATALERROR));
       DBUG_RETURN(1);
     }
     table->field[7]->set_notnull();

=== modified file 'sql/sql_trigger.cc'
--- a/sql/sql_trigger.cc	2009-10-19 12:58:13 +0000
+++ b/sql/sql_trigger.cc	2009-11-10 20:31:28 +0000
@@ -1660,7 +1660,7 @@ bool Table_triggers_list::drop_all_trigg
   DBUG_ENTER("drop_all_triggers");
 
   bzero(&table, sizeof(table));
-  init_alloc_root(&table.mem_root, 8192, 0);
+  init_sql_alloc(&table.mem_root, 8192, 0);
 
   if (Table_triggers_list::check_n_load(thd, db, name, &table, 1))
   {
@@ -1871,7 +1871,7 @@ bool Table_triggers_list::change_table_n
   DBUG_ENTER("change_table_name");
 
   bzero(&table, sizeof(table));
-  init_alloc_root(&table.mem_root, 8192, 0);
+  init_sql_alloc(&table.mem_root, 8192, 0);
 
   /*
     This method interfaces the mysql server code protected by

=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc	2009-10-22 08:46:07 +0000
+++ b/sql/sql_update.cc	2009-11-10 20:31:28 +0000
@@ -662,11 +662,13 @@ int mysql_update(THD *thd,
             If (ignore && error is ignorable) we don't have to
             do anything; otherwise...
           */
+          myf flags= 0;
+
           if (table->file->is_fatal_error(error, HA_CHECK_DUP_KEY))
-            thd->fatal_error(); /* Other handler errors are fatal */
+            flags|= ME_FATALERROR; /* Other handler errors are fatal */
 
           prepare_record_for_error_message(error, table);
-	  table->file->print_error(error,MYF(0));
+	  table->file->print_error(error,MYF(flags));
 	  error= 1;
 	  break;
 	}
@@ -763,9 +765,8 @@ int mysql_update(THD *thd,
     */
   {
     /* purecov: begin inspected */
-    thd->fatal_error();
     prepare_record_for_error_message(loc_error, table);
-    table->file->print_error(loc_error,MYF(0));
+    table->file->print_error(loc_error,MYF(ME_FATALERROR));
     error= 1;
     /* purecov: end */
   }
@@ -1737,11 +1738,13 @@ bool multi_update::send_data(List<Item> 
               If (ignore && error == is ignorable) we don't have to
               do anything; otherwise...
             */
+            myf flags= 0;
+
             if (table->file->is_fatal_error(error, HA_CHECK_DUP_KEY))
-              thd->fatal_error(); /* Other handler errors are fatal */
+              flags|= ME_FATALERROR; /* Other handler errors are fatal */
 
             prepare_record_for_error_message(error, table);
-            table->file->print_error(error,MYF(0));
+            table->file->print_error(error,MYF(flags));
             DBUG_RETURN(1);
           }
         }
@@ -2024,9 +2027,8 @@ int multi_update::do_updates()
 
 err:
   {
-    thd->fatal_error();
     prepare_record_for_error_message(local_error, table);
-    table->file->print_error(local_error,MYF(0));
+    table->file->print_error(local_error,MYF(ME_FATALERROR));
   }
 
 err2:

=== modified file 'sql/tztime.cc'
--- a/sql/tztime.cc	2009-10-14 16:37:38 +0000
+++ b/sql/tztime.cc	2009-11-10 20:31:28 +0000
@@ -1594,7 +1594,7 @@ my_tz_init(THD *org_thd, const char *def
     my_hash_free(&tz_names);
     goto end;
   }
-  init_alloc_root(&tz_storage, 32 * 1024, 0);
+  init_sql_alloc(&tz_storage, 32 * 1024, 0);
   VOID(pthread_mutex_init(&tz_LOCK, MY_MUTEX_INIT_FAST));
   tz_inited= 1;
 


Attachment: [text/bzr-bundle] bzr/davi.arnaut@sun.com-20091110203128-3i5gobixb1h4psv0.bundle
Thread
bzr push into mysql-5.5-next-mr-runtime branch (davi:2921 to 2922)Bug#15192Davi Arnaut10 Nov