[This commit e-mail is a repeat.]
#At file:///home/mayank/mysql-server/mydefects/5.1_11764633/ based on
revid:ramil@stripped
3622 Mayank Prasad 2011-03-25
Bug # 11764633 : 57491: THD->MAIN_DA.IS_OK() ASSERT IN EMBEDDED
Issue:
------
TEE command '\T foo/bar' was aborting. This is because, foo/bar directory doesn't
exist, and while reporting this error, diagnostic area was found not reset. So abort was
happenning.
Solution:
---------
Added a new error handler for embeded server to rest the diagnostic area before
common error handler is called.
@ libmysqld/embedded_priv.h
Added declaration for new embedded server error handler defined in lib_sql.cc
@ libmysqld/lib_sql.cc
Added a new embedded server error handler which makes sure to reset diagnostic are
before calling actual error handler.
modified:
libmysqld/embedded_priv.h
libmysqld/lib_sql.cc
=== modified file 'libmysqld/embedded_priv.h'
--- a/libmysqld/embedded_priv.h 2006-12-31 00:32:21 +0000
+++ b/libmysqld/embedded_priv.h 2011-03-25 10:15:20 +0000
@@ -22,6 +22,7 @@ void *create_embedded_thd(int client_fla
int check_embedded_connection(MYSQL *mysql, const char *db);
void free_old_query(MYSQL *mysql);
extern MYSQL_METHODS embedded_methods;
+int embedded_error_handler(uint error, const char *str, myf MyFlags);
/* This one is used by embedded library to gather returning data */
typedef struct embedded_query_result
=== modified file 'libmysqld/lib_sql.cc'
--- a/libmysqld/lib_sql.cc 2009-12-18 18:44:24 +0000
+++ b/libmysqld/lib_sql.cc 2011-03-25 10:15:20 +0000
@@ -51,6 +51,20 @@ extern "C" void unireg_clear(int exit_co
DBUG_VOID_RETURN;
}
+/*
+ Resets the Diagnostic Area before calling actual error handler
+ my_message_sql()
+*/
+
+int embedded_error_handler(uint error, const char *str, myf MyFlags)
+{
+ DBUG_ENTER("embedded_error_handler");
+ THD *thd= current_thd;
+ thd->main_da.reset_diagnostics_area();
+ my_message_sql(error,str,MyFlags);
+ DBUG_RETURN(0);
+}
+
/*
Reads error information from the MYSQL_DATA and puts
@@ -525,7 +539,8 @@ int init_embedded_server(int argc, char
return 1;
}
- error_handler_hook = my_message_sql;
+ error_handler_hook = embedded_error_handler;
+
acl_error= 0;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
Attachment: [text/bzr-bundle] bzr/mayank.prasad@oracle.com-20110325101520-uwkj2xlrgwo9dakh.bundle
| Thread |
|---|
| • [Resend] bzr commit into mysql-5.1 branch (mayank.prasad:3622) Bug#11764633 | Mayank Prasad | 25 Mar |