Commit 36897c86 authored by Konstantin Osipov's avatar Konstantin Osipov

Backport of:

-----------------------------------------------------------
2497.479.10 Sergei Golubchik    2008-08-27
            proc_info_hook, mysys access to thd->proc_info

This patch is necessary for backport of WL#4284 "Transactional
DDL locking".
parent c43f894c
...@@ -1561,7 +1561,7 @@ inline void operator delete[](void*, void*) { /* Do nothing */ } ...@@ -1561,7 +1561,7 @@ inline void operator delete[](void*, void*) { /* Do nothing */ }
#if !defined(max) #if !defined(max)
#define max(a, b) ((a) > (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b))
#endif #endif
/* /*
Only Linux is known to need an explicit sync of the directory to make sure a Only Linux is known to need an explicit sync of the directory to make sure a
file creation/deletion/renaming in(from,to) this directory durable. file creation/deletion/renaming in(from,to) this directory durable.
......
...@@ -235,6 +235,9 @@ extern void (*fatal_error_handler_hook)(uint my_err, const char *str, ...@@ -235,6 +235,9 @@ extern void (*fatal_error_handler_hook)(uint my_err, const char *str,
extern uint my_file_limit; extern uint my_file_limit;
extern ulong my_thread_stack_size; extern ulong my_thread_stack_size;
extern const char *(*proc_info_hook)(void *, const char *, const char *,
const char *, const unsigned int);
#ifdef HAVE_LARGE_PAGES #ifdef HAVE_LARGE_PAGES
extern my_bool my_use_large_pages; extern my_bool my_use_large_pages;
extern uint my_large_page_size; extern uint my_large_page_size;
......
...@@ -92,6 +92,19 @@ void (*error_handler_hook)(uint error,const char *str,myf MyFlags)= ...@@ -92,6 +92,19 @@ void (*error_handler_hook)(uint error,const char *str,myf MyFlags)=
void (*fatal_error_handler_hook)(uint error,const char *str,myf MyFlags)= void (*fatal_error_handler_hook)(uint error,const char *str,myf MyFlags)=
my_message_no_curses; my_message_no_curses;
static const char *proc_info_dummy(void *a __attribute__((unused)),
const char *b __attribute__((unused)),
const char *c __attribute__((unused)),
const char *d __attribute__((unused)),
const unsigned int e __attribute__((unused)))
{
return 0;
}
/* this is to be able to call set_thd_proc_info from the C code */
const char *(*proc_info_hook)(void *, const char *, const char *, const char *,
const unsigned int)= proc_info_dummy;
#if defined(ENABLED_DEBUG_SYNC) #if defined(ENABLED_DEBUG_SYNC)
/** /**
Global pointer to be set if callback function is defined Global pointer to be set if callback function is defined
......
...@@ -3828,6 +3828,10 @@ static int init_server_components() ...@@ -3828,6 +3828,10 @@ static int init_server_components()
} }
} }
proc_info_hook= (const char *(*)(void *, const char *, const char *,
const char *, const unsigned int))
set_thd_proc_info;
if (xid_cache_init()) if (xid_cache_init())
{ {
sql_print_error("Out of memory"); sql_print_error("Out of memory");
......
...@@ -247,13 +247,16 @@ int thd_tablespace_op(const THD *thd) ...@@ -247,13 +247,16 @@ int thd_tablespace_op(const THD *thd)
extern "C" extern "C"
const char *set_thd_proc_info(THD *thd, const char *info, const char *set_thd_proc_info(THD *thd, const char *info,
const char *calling_function, const char *calling_function,
const char *calling_file, const char *calling_file,
const unsigned int calling_line) const unsigned int calling_line)
{ {
if (!thd)
thd= current_thd;
const char *old_info= thd->proc_info; const char *old_info= thd->proc_info;
DBUG_PRINT("proc_info", ("%s:%d %s", calling_file, calling_line, DBUG_PRINT("proc_info", ("%s:%d %s", calling_file, calling_line,
(info != NULL) ? info : "(null)")); (info != NULL) ? info : "(null)"));
#if defined(ENABLED_PROFILING) #if defined(ENABLED_PROFILING)
thd->profiling.status_change(info, calling_function, calling_file, calling_line); thd->profiling.status_change(info, calling_function, calling_file, calling_line);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment