diff options
author | Mayank Prasad <mayank.prasad@oracle.com> | 2011-05-18 20:10:01 +0530 |
---|---|---|
committer | Mayank Prasad <mayank.prasad@oracle.com> | 2011-05-18 20:10:01 +0530 |
commit | d608ad2dd6ea45e3ef96a98f41702971a5edd215 (patch) | |
tree | 4cce2b7b8458e61ce73aefc6a834029bf0860901 /sql/sql_class.cc | |
parent | 3201f92cb3a8e564387d656f7a7bb566d4776bb5 (diff) | |
download | mariadb-git-d608ad2dd6ea45e3ef96a98f41702971a5edd215.tar.gz |
Bug#11764633 : 57491: THD->MAIN_DA.IS_OK() ASSERT IN EMBEDDED
Issue:
While running embedded server, if client issues TEE command (\T foo/bar) and
"foo/bar" directory doesn't exist, it is suppose to give error. But it was
aborting. This was happening because wrong error handler was being called.
Solution:
Modified calls to correct error handler. In embedded server case, there are
two error handler (client and server) which are supposed to be called based
on which context code is in. If it is in client context, client error handler
should be called otherwise server.
Test case:
Test case automation is not possible as current (following) code doesn't
allow '\T' to be executed from command line (OR command read from a file):
[client/mysql.cc]
...
static int
com_tee(String *buffer __attribute__((unused)),
char *line __attribute__((unused)))
{
char file_name[FN_REFLEN], *end, *param;
if (status.batch) << THIS IS TRUE WHILE EXECUTING FROM COMMAND LINE.
return 0;
...
So, not adding test case in GA. WIll add a test case in mysql-trunk after
removing above code so that this could be properly tested before GA.
libmysqld/lib_sql.cc:
Added code to call client/server error handler based on in control is in
client/server code respectively.
sql/mysql_priv.h:
Added comments for THR_THD, THR_MALLOC keys.
sql/sql_class.cc:
Function definition of new function restore_global to removes thread specific
data from stack (which was stored in store global).
sql/sql_class.h:
Function declaration of new function restore_global.
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r-- | sql/sql_class.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index ae21a5335fd..04f981c6d6a 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1196,6 +1196,25 @@ bool THD::store_globals() return 0; } +/* + Remove the thread specific info (THD and mem_root pointer) stored during + store_global call for this thread. +*/ +bool THD::restore_globals() +{ + /* + Assert that thread_stack is initialized: it's necessary to be able + to track stack overrun. + */ + DBUG_ASSERT(thread_stack); + + /* Undocking the thread specific data. */ + my_pthread_setspecific_ptr(THR_THD, NULL); + my_pthread_setspecific_ptr(THR_MALLOC, NULL); + + return 0; +} + /* Cleanup after query. |