mirror of
https://github.com/MariaDB/server.git
synced 2026-05-14 19:07:15 +02:00
Automerge MySQL 5.1.44 merge into latest MariaDB trunk.
This commit is contained in:
commit
4d7b6a6ea1
306 changed files with 10447 additions and 2273 deletions
|
|
@ -220,7 +220,8 @@ copy_uca_collation(CHARSET_INFO *to, CHARSET_INFO *from)
|
|||
static int add_collation(CHARSET_INFO *cs)
|
||||
{
|
||||
if (cs->name && (cs->number ||
|
||||
(cs->number=get_collation_number_internal(cs->name))))
|
||||
(cs->number=get_collation_number_internal(cs->name))) &&
|
||||
cs->number < array_elements(all_charsets))
|
||||
{
|
||||
if (!all_charsets[cs->number])
|
||||
{
|
||||
|
|
@ -324,7 +325,6 @@ static int add_collation(CHARSET_INFO *cs)
|
|||
#define MY_CHARSET_INDEX "Index.xml"
|
||||
|
||||
const char *charsets_dir= NULL;
|
||||
static int charset_initialized=0;
|
||||
|
||||
|
||||
static my_bool my_read_charset_file(const char *filename, myf myflags)
|
||||
|
|
@ -402,63 +402,37 @@ static void *cs_alloc(size_t size)
|
|||
}
|
||||
|
||||
|
||||
#ifdef __NETWARE__
|
||||
my_bool STDCALL init_available_charsets(myf myflags)
|
||||
#else
|
||||
static my_bool init_available_charsets(myf myflags)
|
||||
#endif
|
||||
static my_pthread_once_t charsets_initialized= MY_PTHREAD_ONCE_INIT;
|
||||
|
||||
static void init_available_charsets(void)
|
||||
{
|
||||
char fname[FN_REFLEN + sizeof(MY_CHARSET_INDEX)];
|
||||
my_bool error=FALSE;
|
||||
/*
|
||||
We have to use charset_initialized to not lock on THR_LOCK_charset
|
||||
inside get_internal_charset...
|
||||
*/
|
||||
if (!charset_initialized)
|
||||
CHARSET_INFO **cs;
|
||||
|
||||
bzero(&all_charsets,sizeof(all_charsets));
|
||||
init_compiled_charsets(MYF(0));
|
||||
|
||||
/* Copy compiled charsets */
|
||||
for (cs=all_charsets;
|
||||
cs < all_charsets+array_elements(all_charsets)-1 ;
|
||||
cs++)
|
||||
{
|
||||
CHARSET_INFO **cs;
|
||||
/*
|
||||
To make things thread safe we are not allowing other threads to interfere
|
||||
while we may changing the cs_info_table
|
||||
*/
|
||||
pthread_mutex_lock(&THR_LOCK_charset);
|
||||
if (!charset_initialized)
|
||||
if (*cs)
|
||||
{
|
||||
bzero(&all_charsets,sizeof(all_charsets));
|
||||
init_compiled_charsets(myflags);
|
||||
|
||||
/* Copy compiled charsets */
|
||||
for (cs=all_charsets;
|
||||
cs < all_charsets+array_elements(all_charsets)-1 ;
|
||||
cs++)
|
||||
{
|
||||
if (*cs)
|
||||
{
|
||||
if (cs[0]->ctype)
|
||||
if (init_state_maps(*cs))
|
||||
*cs= NULL;
|
||||
}
|
||||
}
|
||||
|
||||
strmov(get_charsets_dir(fname), MY_CHARSET_INDEX);
|
||||
error= my_read_charset_file(fname,myflags);
|
||||
charset_initialized=1;
|
||||
if (cs[0]->ctype)
|
||||
if (init_state_maps(*cs))
|
||||
*cs= NULL;
|
||||
}
|
||||
pthread_mutex_unlock(&THR_LOCK_charset);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
void free_charsets(void)
|
||||
{
|
||||
charset_initialized=0;
|
||||
|
||||
strmov(get_charsets_dir(fname), MY_CHARSET_INDEX);
|
||||
my_read_charset_file(fname, MYF(0));
|
||||
}
|
||||
|
||||
|
||||
uint get_collation_number(const char *name)
|
||||
{
|
||||
init_available_charsets(MYF(0));
|
||||
my_pthread_once(&charsets_initialized, init_available_charsets);
|
||||
return get_collation_number_internal(name);
|
||||
}
|
||||
|
||||
|
|
@ -466,7 +440,7 @@ uint get_collation_number(const char *name)
|
|||
uint get_charset_number(const char *charset_name, uint cs_flags)
|
||||
{
|
||||
CHARSET_INFO **cs;
|
||||
init_available_charsets(MYF(0));
|
||||
my_pthread_once(&charsets_initialized, init_available_charsets);
|
||||
|
||||
for (cs= all_charsets;
|
||||
cs < all_charsets+array_elements(all_charsets)-1 ;
|
||||
|
|
@ -483,7 +457,7 @@ uint get_charset_number(const char *charset_name, uint cs_flags)
|
|||
const char *get_charset_name(uint charset_number)
|
||||
{
|
||||
CHARSET_INFO *cs;
|
||||
init_available_charsets(MYF(0));
|
||||
my_pthread_once(&charsets_initialized, init_available_charsets);
|
||||
|
||||
cs=all_charsets[charset_number];
|
||||
if (cs && (cs->number == charset_number) && cs->name )
|
||||
|
|
@ -541,7 +515,7 @@ CHARSET_INFO *get_charset(uint cs_number, myf flags)
|
|||
if (cs_number == default_charset_info->number)
|
||||
return default_charset_info;
|
||||
|
||||
(void) init_available_charsets(MYF(0)); /* If it isn't initialized */
|
||||
my_pthread_once(&charsets_initialized, init_available_charsets);
|
||||
|
||||
if (!cs_number || cs_number >= array_elements(all_charsets)-1)
|
||||
return NULL;
|
||||
|
|
@ -563,7 +537,7 @@ CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags)
|
|||
{
|
||||
uint cs_number;
|
||||
CHARSET_INFO *cs;
|
||||
(void) init_available_charsets(MYF(0)); /* If it isn't initialized */
|
||||
my_pthread_once(&charsets_initialized, init_available_charsets);
|
||||
|
||||
cs_number=get_collation_number(cs_name);
|
||||
cs= cs_number ? get_internal_charset(cs_number,flags) : NULL;
|
||||
|
|
@ -588,7 +562,7 @@ CHARSET_INFO *get_charset_by_csname(const char *cs_name,
|
|||
DBUG_ENTER("get_charset_by_csname");
|
||||
DBUG_PRINT("enter",("name: '%s'", cs_name));
|
||||
|
||||
(void) init_available_charsets(MYF(0)); /* If it isn't initialized */
|
||||
my_pthread_once(&charsets_initialized, init_available_charsets);
|
||||
|
||||
cs_number= get_charset_number(cs_name, cs_flags);
|
||||
cs= cs_number ? get_internal_charset(cs_number, flags) : NULL;
|
||||
|
|
|
|||
|
|
@ -650,7 +650,7 @@ static int search_default_file_with_ext(Process_option_func opt_handler,
|
|||
int recursion_level)
|
||||
{
|
||||
char name[FN_REFLEN + 10], buff[4096], curr_gr[4096], *ptr, *end, **tmp_ext;
|
||||
char *value, option[4096], tmp[FN_REFLEN];
|
||||
char *value, option[4096+2], tmp[FN_REFLEN];
|
||||
static const char includedir_keyword[]= "includedir";
|
||||
static const char include_keyword[]= "include";
|
||||
const int max_recursion_level= 10;
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ my_bool my_use_symdir=0; /* Set this if you want to use symdirs */
|
|||
#ifdef USE_SYMDIR
|
||||
void symdirget(char *dir)
|
||||
{
|
||||
char buff[FN_REFLEN];
|
||||
char buff[FN_REFLEN+1];
|
||||
char *pos=strend(dir);
|
||||
if (dir[0] && pos[-1] != FN_DEVCHAR && my_access(dir, F_OK))
|
||||
{
|
||||
|
|
@ -257,7 +257,7 @@ void symdirget(char *dir)
|
|||
*pos++=temp; *pos=0; /* Restore old filename */
|
||||
if (file >= 0)
|
||||
{
|
||||
if ((length= my_read(file, buff, sizeof(buff), MYF(0))) > 0)
|
||||
if ((length= my_read(file, buff, sizeof(buff) - 1, MYF(0))) > 0)
|
||||
{
|
||||
for (pos= buff + length ;
|
||||
pos > buff && (iscntrl(pos[-1]) || isspace(pos[-1])) ;
|
||||
|
|
|
|||
|
|
@ -145,6 +145,10 @@ int handle_options(int *argc, char ***argv,
|
|||
{ /* --set-variable, or -O */
|
||||
if (*cur_arg == 'O')
|
||||
{
|
||||
my_getopt_error_reporter(WARNING_LEVEL,
|
||||
"%s: Option '-O' is deprecated. "
|
||||
"Use --variable-name=value instead.",
|
||||
my_progname);
|
||||
must_be_var= 1;
|
||||
|
||||
if (!(*++cur_arg)) /* If not -Ovar=# */
|
||||
|
|
@ -164,6 +168,11 @@ int handle_options(int *argc, char ***argv,
|
|||
}
|
||||
else if (!getopt_compare_strings(cur_arg, "-set-variable", 13))
|
||||
{
|
||||
my_getopt_error_reporter(WARNING_LEVEL,
|
||||
"%s: Option '--set-variable' is deprecated. "
|
||||
"Use --variable-name=value instead.",
|
||||
my_progname);
|
||||
|
||||
must_be_var= 1;
|
||||
if (cur_arg[13] == '=')
|
||||
{
|
||||
|
|
|
|||
|
|
@ -166,7 +166,6 @@ void my_end(int infoflag)
|
|||
my_print_open_files();
|
||||
}
|
||||
}
|
||||
free_charsets();
|
||||
my_error_unregister_all();
|
||||
my_once_free();
|
||||
#ifdef THREAD
|
||||
|
|
|
|||
|
|
@ -30,7 +30,9 @@ pthread_key(struct st_my_thread_var, THR_KEY_mysys);
|
|||
#endif /* USE_TLS */
|
||||
pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,
|
||||
THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_myisam,THR_LOCK_heap,
|
||||
THR_LOCK_net, THR_LOCK_charset, THR_LOCK_threads, THR_LOCK_time;
|
||||
THR_LOCK_net, THR_LOCK_charset, THR_LOCK_threads, THR_LOCK_time,
|
||||
THR_LOCK_myisam_mmap;
|
||||
|
||||
pthread_cond_t THR_COND_threads;
|
||||
uint THR_thread_count= 0;
|
||||
uint my_thread_end_wait_time= 5;
|
||||
|
|
@ -156,6 +158,7 @@ my_bool my_thread_global_init(void)
|
|||
pthread_mutex_init(&THR_LOCK_lock,MY_MUTEX_INIT_FAST);
|
||||
pthread_mutex_init(&THR_LOCK_isam,MY_MUTEX_INIT_SLOW);
|
||||
pthread_mutex_init(&THR_LOCK_myisam,MY_MUTEX_INIT_SLOW);
|
||||
pthread_mutex_init(&THR_LOCK_myisam_mmap,MY_MUTEX_INIT_FAST);
|
||||
pthread_mutex_init(&THR_LOCK_heap,MY_MUTEX_INIT_FAST);
|
||||
pthread_mutex_init(&THR_LOCK_net,MY_MUTEX_INIT_FAST);
|
||||
pthread_mutex_init(&THR_LOCK_charset,MY_MUTEX_INIT_FAST);
|
||||
|
|
@ -253,6 +256,7 @@ void my_thread_destroy_mutex(void)
|
|||
pthread_mutex_destroy(&THR_LOCK_lock);
|
||||
pthread_mutex_destroy(&THR_LOCK_isam);
|
||||
pthread_mutex_destroy(&THR_LOCK_myisam);
|
||||
pthread_mutex_destroy(&THR_LOCK_myisam_mmap);
|
||||
pthread_mutex_destroy(&THR_LOCK_heap);
|
||||
pthread_mutex_destroy(&THR_LOCK_net);
|
||||
pthread_mutex_destroy(&THR_LOCK_time);
|
||||
|
|
|
|||
|
|
@ -148,4 +148,36 @@ int win_pthread_setspecific(void *a,void *b,uint length)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
One time initialization. For simplicity, we assume initializer thread
|
||||
does not exit within init_routine().
|
||||
*/
|
||||
int my_pthread_once(my_pthread_once_t *once_control,
|
||||
void (*init_routine)(void))
|
||||
{
|
||||
LONG state= InterlockedCompareExchange(once_control, MY_PTHREAD_ONCE_INPROGRESS,
|
||||
MY_PTHREAD_ONCE_INIT);
|
||||
switch(state)
|
||||
{
|
||||
case MY_PTHREAD_ONCE_INIT:
|
||||
/* This is initializer thread */
|
||||
(*init_routine)();
|
||||
*once_control= MY_PTHREAD_ONCE_DONE;
|
||||
break;
|
||||
|
||||
case MY_PTHREAD_ONCE_INPROGRESS:
|
||||
/* init_routine in progress. Wait for its completion */
|
||||
while(*once_control == MY_PTHREAD_ONCE_INPROGRESS)
|
||||
{
|
||||
Sleep(1);
|
||||
}
|
||||
break;
|
||||
case MY_PTHREAD_ONCE_DONE:
|
||||
/* Nothing to do */
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -63,7 +63,26 @@ void my_safe_print_str(const char* name, const char* val, int max_len)
|
|||
fputc('\n', stderr);
|
||||
}
|
||||
|
||||
#if HAVE_BACKTRACE && (HAVE_BACKTRACE_SYMBOLS || HAVE_BACKTRACE_SYMBOLS_FD)
|
||||
#if defined(HAVE_PRINTSTACK)
|
||||
|
||||
/* Use Solaris' symbolic stack trace routine. */
|
||||
#include <ucontext.h>
|
||||
|
||||
void my_print_stacktrace(uchar* stack_bottom __attribute__((unused)),
|
||||
ulong thread_stack __attribute__((unused)))
|
||||
{
|
||||
if (printstack(fileno(stderr)) == -1)
|
||||
fprintf(stderr, "Error when traversing the stack, stack appears corrupt.\n");
|
||||
else
|
||||
fprintf(stderr,
|
||||
"Please read "
|
||||
"http://dev.mysql.com/doc/refman/5.1/en/resolve-stack-dump.html\n"
|
||||
"and follow instructions on how to resolve the stack trace.\n"
|
||||
"Resolved stack trace is much more helpful in diagnosing the\n"
|
||||
"problem, so please do resolve it\n");
|
||||
}
|
||||
|
||||
#elif HAVE_BACKTRACE && (HAVE_BACKTRACE_SYMBOLS || HAVE_BACKTRACE_SYMBOLS_FD)
|
||||
|
||||
#if BACKTRACE_DEMANGLE
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue