mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Backport of Bug#15192 to mysql-next-mr
------------------------------------------------------------ revno: 2597.4.17 revision-id: sp1r-davi@mysql.com/endora.local-20080328174753-24337 parent: sp1r-anozdrin/alik@quad.opbmk-20080328140038-16479 committer: davi@mysql.com/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.
This commit is contained in:
@@ -1922,20 +1922,17 @@ bool delayed_get_table(THD *thd, TABLE_LIST *table_list)
|
||||
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_LIST *table_list)
|
||||
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(THD *thd, Delayed_insert *di)
|
||||
}
|
||||
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)
|
||||
|
Reference in New Issue
Block a user