Commit ffb51e15 authored by unknown's avatar unknown

Merge bk-internal:/home/bk/mysql-5.1

into  production.mysql.com:/usersnfs/mjorgensen/bktrees/mysql-5.1-build


sql/ha_ndbcluster.cc:
  Auto merged
sql/mysqld.cc:
  Auto merged
parents f80084bf dd5523d9
...@@ -5,9 +5,13 @@ ...@@ -5,9 +5,13 @@
# #
check_cpu () { check_cpu () {
if test -r /proc/cpuinfo ; then CPUINFO=/proc/cpuinfo
if test -n "$TEST_CPUINFO" ; then
CPUINFO=$TEST_CPUINFO
fi
if test -r "$CPUINFO" -a "$CPUINFO" != " " ; then
# on Linux (and others?) we can get detailed CPU information out of /proc # on Linux (and others?) we can get detailed CPU information out of /proc
cpuinfo="cat /proc/cpuinfo" cpuinfo="cat $CPUINFO"
# detect CPU family # detect CPU family
cpu_family=`$cpuinfo | grep 'family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1` cpu_family=`$cpuinfo | grep 'family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
...@@ -33,6 +37,7 @@ check_cpu () { ...@@ -33,6 +37,7 @@ check_cpu () {
done done
else else
# Fallback when there is no /proc/cpuinfo # Fallback when there is no /proc/cpuinfo
CPUINFO=" "
case "`uname -s`" in case "`uname -s`" in
FreeBSD|OpenBSD) FreeBSD|OpenBSD)
cpu_family=`uname -m`; cpu_family=`uname -m`;
...@@ -84,6 +89,18 @@ check_cpu () { ...@@ -84,6 +89,18 @@ check_cpu () {
*Pentium*M*pro*) *Pentium*M*pro*)
cpu_arg="pentium-m"; cpu_arg="pentium-m";
;; ;;
*Celeron\(R\)*\ M*)
cpu_arg="pentium-m";
;;
*Celeron*Coppermine*)
cpu_arg="pentium3"
;;
*Celeron\(R\)*)
cpu_arg="pentium4"
;;
*Celeron*)
cpu_arg="pentium2";
;;
*Athlon*64*) *Athlon*64*)
cpu_arg="athlon64"; cpu_arg="athlon64";
;; ;;
...@@ -120,7 +137,14 @@ check_cpu () { ...@@ -120,7 +137,14 @@ check_cpu () {
esac esac
if test -z "$cpu_arg"; then if test -z "$cpu_arg" ; then
if test "$CPUINFO" != " " ; then
# fallback to uname if necessary
TEST_CPUINFO=" "
check_cpu_cflags=""
check_cpu
return
fi
echo "BUILD/check-cpu: Oops, could not find out what kind of cpu this machine is using." >&2 echo "BUILD/check-cpu: Oops, could not find out what kind of cpu this machine is using." >&2
check_cpu_cflags="" check_cpu_cflags=""
return return
......
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$amd64_cflags $debug_cflags $valgrind_flags"
extra_configs="$amd64_configs $debug_configs $max_configs"
. "$path/FINISH.sh"
if test -z "$just_print"
then
set +v +x
echo "\
******************************************************************************
Note that by default BUILD/compile-pentium-valgrind-max calls 'configure' with
--enable-assembler. When Valgrind detects an error involving an assembly
function (for example an uninitialized value used as an argument of an
assembly function), Valgrind will not print the stacktrace and 'valgrind
--gdb-attach=yes' will not work either. If you need a stacktrace in those
cases, you have to run BUILD/compile-pentium-valgrind-max with the
--disable-assembler argument.
******************************************************************************"
fi
...@@ -1037,7 +1037,7 @@ sub command_line_setup () { ...@@ -1037,7 +1037,7 @@ sub command_line_setup () {
# On some operating systems, there is a limit to the length of a # On some operating systems, there is a limit to the length of a
# UNIX domain socket's path far below PATH_MAX, so try to avoid long # UNIX domain socket's path far below PATH_MAX, so try to avoid long
# socket path names. # socket path names.
$sockdir = tempdir(CLEANUP => 1) if ( length($sockdir) > 80 ); $sockdir = tempdir(CLEANUP => 0) if ( length($sockdir) > 80 );
# Put this into a hash, will be a C struct # Put this into a hash, will be a C struct
......
...@@ -465,6 +465,9 @@ MySQLaccess::Report::Print_Header(); ...@@ -465,6 +465,9 @@ MySQLaccess::Report::Print_Header();
elsif (-f "@sysconfdir@/$script_conf") { elsif (-f "@sysconfdir@/$script_conf") {
require "@sysconfdir@/$script_conf"; require "@sysconfdir@/$script_conf";
} }
elsif (-f "/etc/$script_conf") {
require "/etc/$script_conf";
}
# **************************** # ****************************
# Read in all parameters # Read in all parameters
...@@ -930,6 +933,7 @@ sub MergeConfigFile { ...@@ -930,6 +933,7 @@ sub MergeConfigFile {
sub MergeConfigFiles { sub MergeConfigFiles {
my ($name,$pass,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = getpwuid $<; my ($name,$pass,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = getpwuid $<;
MergeConfigFile("@sysconfdir@/my.cnf"); MergeConfigFile("@sysconfdir@/my.cnf");
MergeConfigFile("/etc/my.cnf");
MergeConfigFile("$dir/.my.cnf"); MergeConfigFile("$dir/.my.cnf");
} }
......
...@@ -467,6 +467,9 @@ sub find_groups ...@@ -467,6 +467,9 @@ sub find_groups
if (-f "@sysconfdir@/my.cnf" && -r "@sysconfdir@/my.cnf") if (-f "@sysconfdir@/my.cnf" && -r "@sysconfdir@/my.cnf")
{ {
open(MY_CNF, "<@sysconfdir@/my.cnf") && (@tmp=<MY_CNF>) && close(MY_CNF); open(MY_CNF, "<@sysconfdir@/my.cnf") && (@tmp=<MY_CNF>) && close(MY_CNF);
} elsif (-f "/etc/my.cnf" && -r "/etc/my.cnf")
{
open(MY_CNF, "</etc/my.cnf") && (@tmp=<MY_CNF>) && close(MY_CNF);
} }
for ($i = 0; ($line = shift @tmp); $i++) for ($i = 0; ($line = shift @tmp); $i++)
{ {
......
...@@ -133,6 +133,7 @@ static uint ndbcluster_alter_table_flags(uint flags) ...@@ -133,6 +133,7 @@ static uint ndbcluster_alter_table_flags(uint flags)
} }
static int ndbcluster_inited= 0; static int ndbcluster_inited= 0;
static int ndbcluster_terminating= 0;
static Ndb* g_ndb= NULL; static Ndb* g_ndb= NULL;
Ndb_cluster_connection* g_ndb_cluster_connection= NULL; Ndb_cluster_connection* g_ndb_cluster_connection= NULL;
...@@ -159,6 +160,7 @@ pthread_t ndb_util_thread; ...@@ -159,6 +160,7 @@ pthread_t ndb_util_thread;
int ndb_util_thread_running= 0; int ndb_util_thread_running= 0;
pthread_mutex_t LOCK_ndb_util_thread; pthread_mutex_t LOCK_ndb_util_thread;
pthread_cond_t COND_ndb_util_thread; pthread_cond_t COND_ndb_util_thread;
pthread_cond_t COND_ndb_util_ready;
pthread_handler_t ndb_util_thread_func(void *arg); pthread_handler_t ndb_util_thread_func(void *arg);
ulong ndb_cache_check_time; ulong ndb_cache_check_time;
...@@ -6625,6 +6627,7 @@ int ndbcluster_find_files(handlerton *hton, THD *thd, ...@@ -6625,6 +6627,7 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
/* Call back after cluster connect */ /* Call back after cluster connect */
static int connect_callback() static int connect_callback()
{ {
pthread_mutex_lock(&LOCK_ndb_util_thread);
update_status_variables(g_ndb_cluster_connection); update_status_variables(g_ndb_cluster_connection);
uint node_id, i= 0; uint node_id, i= 0;
...@@ -6634,6 +6637,7 @@ static int connect_callback() ...@@ -6634,6 +6637,7 @@ static int connect_callback()
g_node_id_map[node_id]= i++; g_node_id_map[node_id]= i++;
pthread_cond_signal(&COND_ndb_util_thread); pthread_cond_signal(&COND_ndb_util_thread);
pthread_mutex_unlock(&LOCK_ndb_util_thread);
return 0; return 0;
} }
...@@ -6644,6 +6648,15 @@ static int ndbcluster_init(void *p) ...@@ -6644,6 +6648,15 @@ static int ndbcluster_init(void *p)
int res; int res;
DBUG_ENTER("ndbcluster_init"); DBUG_ENTER("ndbcluster_init");
if (ndbcluster_inited)
DBUG_RETURN(FALSE);
pthread_mutex_init(&ndbcluster_mutex,MY_MUTEX_INIT_FAST);
pthread_mutex_init(&LOCK_ndb_util_thread, MY_MUTEX_INIT_FAST);
pthread_cond_init(&COND_ndb_util_thread, NULL);
pthread_cond_init(&COND_ndb_util_ready, NULL);
ndb_util_thread_running= -1;
ndbcluster_terminating= 0;
ndb_dictionary_is_mysqld= 1; ndb_dictionary_is_mysqld= 1;
ndbcluster_hton= (handlerton *)p; ndbcluster_hton= (handlerton *)p;
...@@ -6742,17 +6755,12 @@ static int ndbcluster_init(void *p) ...@@ -6742,17 +6755,12 @@ static int ndbcluster_init(void *p)
(void) hash_init(&ndbcluster_open_tables,system_charset_info,32,0,0, (void) hash_init(&ndbcluster_open_tables,system_charset_info,32,0,0,
(hash_get_key) ndbcluster_get_key,0,0); (hash_get_key) ndbcluster_get_key,0,0);
pthread_mutex_init(&ndbcluster_mutex,MY_MUTEX_INIT_FAST);
#ifdef HAVE_NDB_BINLOG #ifdef HAVE_NDB_BINLOG
/* start the ndb injector thread */ /* start the ndb injector thread */
if (ndbcluster_binlog_start()) if (ndbcluster_binlog_start())
goto ndbcluster_init_error; goto ndbcluster_init_error;
#endif /* HAVE_NDB_BINLOG */ #endif /* HAVE_NDB_BINLOG */
pthread_mutex_init(&LOCK_ndb_util_thread, MY_MUTEX_INIT_FAST);
pthread_cond_init(&COND_ndb_util_thread, NULL);
ndb_cache_check_time = opt_ndb_cache_check_time; ndb_cache_check_time = opt_ndb_cache_check_time;
// Create utility thread // Create utility thread
pthread_t tmp; pthread_t tmp;
...@@ -6763,14 +6771,26 @@ static int ndbcluster_init(void *p) ...@@ -6763,14 +6771,26 @@ static int ndbcluster_init(void *p)
pthread_mutex_destroy(&ndbcluster_mutex); pthread_mutex_destroy(&ndbcluster_mutex);
pthread_mutex_destroy(&LOCK_ndb_util_thread); pthread_mutex_destroy(&LOCK_ndb_util_thread);
pthread_cond_destroy(&COND_ndb_util_thread); pthread_cond_destroy(&COND_ndb_util_thread);
pthread_cond_destroy(&COND_ndb_util_ready);
goto ndbcluster_init_error; goto ndbcluster_init_error;
} }
/* Wait for the util thread to start */ /* Wait for the util thread to start */
pthread_mutex_lock(&LOCK_ndb_util_thread); pthread_mutex_lock(&LOCK_ndb_util_thread);
while (!ndb_util_thread_running) while (ndb_util_thread_running < 0)
pthread_cond_wait(&COND_ndb_util_thread, &LOCK_ndb_util_thread); pthread_cond_wait(&COND_ndb_util_ready, &LOCK_ndb_util_thread);
pthread_mutex_unlock(&LOCK_ndb_util_thread); pthread_mutex_unlock(&LOCK_ndb_util_thread);
if (!ndb_util_thread_running)
{
DBUG_PRINT("error", ("ndb utility thread exited prematurely"));
hash_free(&ndbcluster_open_tables);
pthread_mutex_destroy(&ndbcluster_mutex);
pthread_mutex_destroy(&LOCK_ndb_util_thread);
pthread_cond_destroy(&COND_ndb_util_thread);
pthread_cond_destroy(&COND_ndb_util_ready);
goto ndbcluster_init_error;
}
ndbcluster_inited= 1; ndbcluster_inited= 1;
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
...@@ -6797,22 +6817,12 @@ static int ndbcluster_end(handlerton *hton, ha_panic_function type) ...@@ -6797,22 +6817,12 @@ static int ndbcluster_end(handlerton *hton, ha_panic_function type)
ndbcluster_inited= 0; ndbcluster_inited= 0;
/* wait for util thread to finish */ /* wait for util thread to finish */
sql_print_information("Stopping Cluster Utility thread");
pthread_mutex_lock(&LOCK_ndb_util_thread); pthread_mutex_lock(&LOCK_ndb_util_thread);
if (ndb_util_thread_running > 0) ndbcluster_terminating= 1;
{ pthread_cond_signal(&COND_ndb_util_thread);
pthread_cond_signal(&COND_ndb_util_thread); while (ndb_util_thread_running > 0)
pthread_mutex_unlock(&LOCK_ndb_util_thread); pthread_cond_wait(&COND_ndb_util_ready, &LOCK_ndb_util_thread);
pthread_mutex_lock(&LOCK_ndb_util_thread);
while (ndb_util_thread_running > 0)
{
struct timespec abstime;
set_timespec(abstime, 1);
pthread_cond_timedwait(&COND_ndb_util_thread,
&LOCK_ndb_util_thread,
&abstime);
}
}
pthread_mutex_unlock(&LOCK_ndb_util_thread); pthread_mutex_unlock(&LOCK_ndb_util_thread);
...@@ -6861,6 +6871,7 @@ static int ndbcluster_end(handlerton *hton, ha_panic_function type) ...@@ -6861,6 +6871,7 @@ static int ndbcluster_end(handlerton *hton, ha_panic_function type)
pthread_mutex_destroy(&ndbcluster_mutex); pthread_mutex_destroy(&ndbcluster_mutex);
pthread_mutex_destroy(&LOCK_ndb_util_thread); pthread_mutex_destroy(&LOCK_ndb_util_thread);
pthread_cond_destroy(&COND_ndb_util_thread); pthread_cond_destroy(&COND_ndb_util_thread);
pthread_cond_destroy(&COND_ndb_util_ready);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -8394,6 +8405,8 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused))) ...@@ -8394,6 +8405,8 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused)))
my_thread_init(); my_thread_init();
DBUG_ENTER("ndb_util_thread"); DBUG_ENTER("ndb_util_thread");
DBUG_PRINT("enter", ("ndb_cache_check_time: %lu", ndb_cache_check_time)); DBUG_PRINT("enter", ("ndb_cache_check_time: %lu", ndb_cache_check_time));
pthread_mutex_lock(&LOCK_ndb_util_thread);
thd= new THD; /* note that contructor of THD uses DBUG_ */ thd= new THD; /* note that contructor of THD uses DBUG_ */
THD_CHECK_SENTRY(thd); THD_CHECK_SENTRY(thd);
...@@ -8403,12 +8416,7 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused))) ...@@ -8403,12 +8416,7 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused)))
thd->thread_stack= (char*)&thd; /* remember where our stack is */ thd->thread_stack= (char*)&thd; /* remember where our stack is */
if (thd->store_globals()) if (thd->store_globals())
{ goto ndb_util_thread_fail;
thd->cleanup();
delete thd;
ndb_util_thread_running= 0;
DBUG_RETURN(NULL);
}
thd->init_for_queries(); thd->init_for_queries();
thd->version=refresh_version; thd->version=refresh_version;
thd->set_time(); thd->set_time();
...@@ -8419,15 +8427,27 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused))) ...@@ -8419,15 +8427,27 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused)))
thd->main_security_ctx.priv_user = 0; thd->main_security_ctx.priv_user = 0;
thd->current_stmt_binlog_row_based= TRUE; // If in mixed mode thd->current_stmt_binlog_row_based= TRUE; // If in mixed mode
/* Signal successful initialization */
ndb_util_thread_running= 1; ndb_util_thread_running= 1;
pthread_cond_signal(&COND_ndb_util_thread); pthread_cond_signal(&COND_ndb_util_ready);
pthread_mutex_unlock(&LOCK_ndb_util_thread);
/* /*
wait for mysql server to start wait for mysql server to start
*/ */
pthread_mutex_lock(&LOCK_server_started); pthread_mutex_lock(&LOCK_server_started);
while (!mysqld_server_started) while (!mysqld_server_started)
pthread_cond_wait(&COND_server_started, &LOCK_server_started); {
set_timespec(abstime, 1);
pthread_cond_timedwait(&COND_server_started, &LOCK_server_started,
&abstime);
if (ndbcluster_terminating)
{
pthread_mutex_unlock(&LOCK_server_started);
pthread_mutex_lock(&LOCK_ndb_util_thread);
goto ndb_util_thread_end;
}
}
pthread_mutex_unlock(&LOCK_server_started); pthread_mutex_unlock(&LOCK_server_started);
/* /*
...@@ -8437,15 +8457,9 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused))) ...@@ -8437,15 +8457,9 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused)))
while (!ndb_cluster_node_id && (ndbcluster_hton->slot != ~(uint)0)) while (!ndb_cluster_node_id && (ndbcluster_hton->slot != ~(uint)0))
{ {
/* ndb not connected yet */ /* ndb not connected yet */
set_timespec(abstime, 1); pthread_cond_wait(&COND_ndb_util_thread, &LOCK_ndb_util_thread);
pthread_cond_timedwait(&COND_ndb_util_thread, if (ndbcluster_terminating)
&LOCK_ndb_util_thread,
&abstime);
if (abort_loop)
{
pthread_mutex_unlock(&LOCK_ndb_util_thread);
goto ndb_util_thread_end; goto ndb_util_thread_end;
}
} }
pthread_mutex_unlock(&LOCK_ndb_util_thread); pthread_mutex_unlock(&LOCK_ndb_util_thread);
...@@ -8453,6 +8467,7 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused))) ...@@ -8453,6 +8467,7 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused)))
if (!(thd_ndb= ha_ndbcluster::seize_thd_ndb())) if (!(thd_ndb= ha_ndbcluster::seize_thd_ndb()))
{ {
sql_print_error("Could not allocate Thd_ndb object"); sql_print_error("Could not allocate Thd_ndb object");
pthread_mutex_lock(&LOCK_ndb_util_thread);
goto ndb_util_thread_end; goto ndb_util_thread_end;
} }
set_thd_ndb(thd, thd_ndb); set_thd_ndb(thd, thd_ndb);
...@@ -8471,19 +8486,20 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused))) ...@@ -8471,19 +8486,20 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused)))
#endif #endif
set_timespec(abstime, 0); set_timespec(abstime, 0);
for (;!abort_loop;) for (;;)
{ {
pthread_mutex_lock(&LOCK_ndb_util_thread); pthread_mutex_lock(&LOCK_ndb_util_thread);
pthread_cond_timedwait(&COND_ndb_util_thread, if (!ndbcluster_terminating)
&LOCK_ndb_util_thread, pthread_cond_timedwait(&COND_ndb_util_thread,
&abstime); &LOCK_ndb_util_thread,
&abstime);
if (ndbcluster_terminating) /* Shutting down server */
goto ndb_util_thread_end;
pthread_mutex_unlock(&LOCK_ndb_util_thread); pthread_mutex_unlock(&LOCK_ndb_util_thread);
#ifdef NDB_EXTRA_DEBUG_UTIL_THREAD #ifdef NDB_EXTRA_DEBUG_UTIL_THREAD
DBUG_PRINT("ndb_util_thread", ("Started, ndb_cache_check_time: %lu", DBUG_PRINT("ndb_util_thread", ("Started, ndb_cache_check_time: %lu",
ndb_cache_check_time)); ndb_cache_check_time));
#endif #endif
if (abort_loop)
break; /* Shutting down server */
#ifdef HAVE_NDB_BINLOG #ifdef HAVE_NDB_BINLOG
/* /*
...@@ -8606,13 +8622,18 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused))) ...@@ -8606,13 +8622,18 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused)))
abstime.tv_nsec-= 1000000000; abstime.tv_nsec-= 1000000000;
} }
} }
pthread_mutex_lock(&LOCK_ndb_util_thread);
ndb_util_thread_end: ndb_util_thread_end:
sql_print_information("Stopping Cluster Utility thread");
net_end(&thd->net); net_end(&thd->net);
ndb_util_thread_fail:
thd->cleanup(); thd->cleanup();
delete thd; delete thd;
pthread_mutex_lock(&LOCK_ndb_util_thread);
/* signal termination */
ndb_util_thread_running= 0; ndb_util_thread_running= 0;
pthread_cond_signal(&COND_ndb_util_ready);
pthread_mutex_unlock(&LOCK_ndb_util_thread); pthread_mutex_unlock(&LOCK_ndb_util_thread);
DBUG_PRINT("exit", ("ndb_util_thread")); DBUG_PRINT("exit", ("ndb_util_thread"));
my_thread_end(); my_thread_end();
......
...@@ -3698,15 +3698,18 @@ we force server id to 2, but this MySQL server will not act as a slave."); ...@@ -3698,15 +3698,18 @@ we force server id to 2, but this MySQL server will not act as a slave.");
mysqld_port, mysqld_port,
MYSQL_COMPILATION_COMMENT); MYSQL_COMPILATION_COMMENT);
// Signal threads waiting for server to be started
mysqld_server_started= 1;
pthread_cond_signal(&COND_server_started);
if (!opt_noacl) if (!opt_noacl)
{ {
if (Events::get_instance()->init()) if (Events::get_instance()->init())
unireg_abort(1); unireg_abort(1);
} }
/* Signal threads waiting for server to be started */
pthread_mutex_lock(&LOCK_server_started);
mysqld_server_started= 1;
pthread_cond_signal(&COND_server_started);
pthread_mutex_unlock(&LOCK_server_started);
#if defined(__NT__) || defined(HAVE_SMEM) #if defined(__NT__) || defined(HAVE_SMEM)
handle_connections_methods(); handle_connections_methods();
#else #else
......
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