mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
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".
This commit is contained in:
parent
c43f894c51
commit
36897c862b
5 changed files with 28 additions and 5 deletions
|
@ -1561,7 +1561,7 @@ inline void operator delete[](void*, void*) { /* Do nothing */ }
|
|||
#if !defined(max)
|
||||
#define max(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
|
||||
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,
|
|||
extern uint my_file_limit;
|
||||
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
|
||||
extern my_bool my_use_large_pages;
|
||||
extern uint my_large_page_size;
|
||||
|
|
|
@ -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)=
|
||||
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)
|
||||
/**
|
||||
Global pointer to be set if callback function is defined
|
||||
|
|
|
@ -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())
|
||||
{
|
||||
sql_print_error("Out of memory");
|
||||
|
|
|
@ -247,13 +247,16 @@ int thd_tablespace_op(const THD *thd)
|
|||
|
||||
|
||||
extern "C"
|
||||
const char *set_thd_proc_info(THD *thd, const char *info,
|
||||
const char *calling_function,
|
||||
const char *calling_file,
|
||||
const char *set_thd_proc_info(THD *thd, const char *info,
|
||||
const char *calling_function,
|
||||
const char *calling_file,
|
||||
const unsigned int calling_line)
|
||||
{
|
||||
if (!thd)
|
||||
thd= current_thd;
|
||||
|
||||
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)"));
|
||||
#if defined(ENABLED_PROFILING)
|
||||
thd->profiling.status_change(info, calling_function, calling_file, calling_line);
|
||||
|
|
Loading…
Reference in a new issue