mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
Fixed compiler warnings
Fixed compile-pentium64 scripts Fixed wrong estimate of update_with_key_prefix in sql-bench Merge bk-internal.mysql.com:/home/bk/mysql-5.1 into mysql.com:/home/my/mysql-5.1 Fixed unsafe define of uint4korr() Fixed that --extern works with mysql-test-run.pl Small trivial cleanups This also fixes a bug in counting number of rows that are updated when we have many simultanous queries Move all connection handling and command exectuion main loop from sql_parse.cc to sql_connection.cc Split handle_one_connection() into reusable sub functions. Split create_new_thread() into reusable sub functions. Added thread_scheduler; Preliminary interface code for future thread_handling code. Use 'my_thread_id' for internal thread id's Make thr_alarm_kill() to depend on thread_id instead of thread Make thr_abort_locks_for_thread() depend on thread_id instead of thread In store_globals(), set my_thread_var->id to be thd->thread_id. Use my_thread_var->id as basis for my_thread_name() The above changes makes the connection we have between THD and threads more soft. Added a lot of DBUG_PRINT() and DBUG_ASSERT() functions Fixed compiler warnings Fixed core dumps when running with --debug Removed setting of signal masks (was never used) Made event code call pthread_exit() (portability fix) Fixed that event code doesn't call DBUG_xxx functions before my_thread_init() is called. Made handling of thread_id and thd->variables.pseudo_thread_id uniform. Removed one common 'not freed memory' warning from mysqltest Fixed a couple of usage of not initialized warnings (unlikely cases) Suppress compiler warnings from bdb and (for the moment) warnings from ndb
This commit is contained in:
parent
a5051aa4eb
commit
f0ae3ce9b9
171 changed files with 2307 additions and 2592 deletions
|
@ -2951,3 +2951,4 @@ win/vs71cache.txt
|
|||
win/vs8cache.txt
|
||||
zlib/*.ds?
|
||||
zlib/*.vcproj
|
||||
storage/ndb/src/ndbapi/ndberror_check
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
***************
|
||||
*** 39,46 ****
|
||||
c_warnings="$global_warnings -Wunused"
|
||||
cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
|
||||
|
||||
! alpha_cflags="-mcpu=ev6 -Wa,-mev6" # Not used yet
|
||||
! pentium_cflags="-mcpu=pentiumpro"
|
||||
sparc_cflags=""
|
||||
|
||||
# be as fast as we can be without losing our ability to backtrace
|
||||
--- 39,46 ----
|
||||
c_warnings="$global_warnings -Wunused"
|
||||
cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
|
||||
|
||||
! #alpha_cflags="-mcpu=ev6 -Wa,-mev6" # Not used yet
|
||||
! #pentium_cflags="-mcpu=pentiumpro"
|
||||
sparc_cflags=""
|
||||
|
||||
# be as fast as we can be without losing our ability to backtrace
|
|
@ -1,7 +1,7 @@
|
|||
#! /bin/sh
|
||||
|
||||
path=`dirname $0`
|
||||
. "$path/SETUP.sh"
|
||||
. "$path/SETUP.sh" $@
|
||||
|
||||
extra_flags="$pentium_cflags $fast_cflags"
|
||||
extra_configs="$pentium_configs $static_link"
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
#! /bin/sh
|
||||
|
||||
path=`dirname $0`
|
||||
. "$path/SETUP.sh" $@ --with-debug=full
|
||||
. "$path/SETUP.sh" $@
|
||||
|
||||
extra_flags="$pentium64_cflags $fast_cflags"
|
||||
c_warnings="$c_warnings"
|
||||
cxx_warnings="$cxx_warnings"
|
||||
extra_configs="$pentium_configs $static_link"
|
||||
|
||||
extra_configs="$extra_configs "
|
||||
CC="$CC --pipe"
|
||||
strip=yes
|
||||
|
||||
. "$path/FINISH.sh"
|
||||
|
|
11
BUILD/compile-pentium64-max
Executable file
11
BUILD/compile-pentium64-max
Executable file
|
@ -0,0 +1,11 @@
|
|||
#! /bin/sh
|
||||
|
||||
path=`dirname $0`
|
||||
. "$path/SETUP.sh" $@
|
||||
|
||||
extra_flags="$pentium64_cflags $fast_cflags"
|
||||
extra_configs="$pentium_configs $max_configs $static_link"
|
||||
CC="$CC --pipe"
|
||||
strip=yes
|
||||
|
||||
. "$path/FINISH.sh"
|
|
@ -1,7 +1,14 @@
|
|||
#!/usr/bin/bash
|
||||
path=`dirname $0`
|
||||
. "$path/SETUP.sh"
|
||||
extra_flags=""
|
||||
extra_configs="$max_configs"
|
||||
#! /bin/sh
|
||||
|
||||
. "$path/FINISH.sh"
|
||||
make -k clean || true
|
||||
/bin/rm -f */.deps/*.P config.cache
|
||||
|
||||
# gcc is often in /usr/ccs/bin or /usr/local/bin
|
||||
PATH=$PATH:/usr/ccs/bin:/usr/local/bin
|
||||
|
||||
path=`dirname $0`
|
||||
. "$path/autorun.sh"
|
||||
|
||||
CFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -O3 -fno-omit-frame-pointer -mcpu=v8 -Wa,-xarch=v8plusa" CXX=gcc CXXFLAGS="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -O3 -fno-omit-frame-pointer -mcpu=v8 -Wa,-xarch=v8plusa -g" ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client
|
||||
|
||||
make -j 4
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
#!/usr/bin/bash
|
||||
path=`dirname $0`
|
||||
. "$path/SETUP.sh"
|
||||
extra_flags="$debug_cflags"
|
||||
extra_configs="$debug_configs $max_configs"
|
||||
#!/bin/sh
|
||||
|
||||
. "$path/FINISH.sh"
|
||||
make -k clean || true
|
||||
/bin/rm -f */.deps/*.P config.cache
|
||||
|
||||
path=`dirname $0`
|
||||
. "$path/autorun.sh"
|
||||
|
||||
CFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -O3 -fno-omit-frame-pointer -mcpu=v8 -Wa,-xarch=v8plusa" CXX=gcc CXXFLAGS="-Wimplicit -Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -O3 -fno-omit-frame-pointer -mcpu=v8 -Wa,-xarch=v8plusa -g" ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-debug
|
||||
|
||||
make -j 4
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
#! /bin/sh
|
||||
|
||||
gmake -k clean || true
|
||||
# Assume Forte is installed in /opt/SUNWSpro and ld is installed in
|
||||
# /usr/ccs/bin
|
||||
|
||||
PATH=/opt/SUNWspro/bin/:/usr/ccs/bin:$PATH
|
||||
|
||||
make -k clean || true
|
||||
/bin/rm -f */.deps/*.P config.cache
|
||||
|
||||
path=`dirname $0`
|
||||
. "$path/autorun.sh"
|
||||
|
||||
|
||||
# Assume Forte is installed in /opt/SUNWSpro
|
||||
|
||||
PATH=/opt/SUNWspro/bin/:$PATH
|
||||
|
||||
# For "optimal" code for this computer add -fast to EXTRA
|
||||
# To compile 64 bit, add -xarch=v9 to EXTRA_64_BIT
|
||||
|
||||
|
@ -27,7 +27,7 @@ CC=cc-5.0 CFLAGS="-Xa -xstrconst $STD" \
|
|||
CXX=CC CXXFLAGS="-noex $STD" \
|
||||
./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client
|
||||
|
||||
gmake -j 4
|
||||
make -j 4
|
||||
if [ $? = 0 ]
|
||||
then
|
||||
make test
|
||||
|
|
|
@ -31,7 +31,7 @@ do
|
|||
shift
|
||||
done
|
||||
|
||||
gmake -k clean || true
|
||||
make -k clean || true
|
||||
/bin/rm -f */.deps/*.P config.cache
|
||||
|
||||
path=`dirname $0`
|
||||
|
@ -39,7 +39,7 @@ path=`dirname $0`
|
|||
|
||||
CFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -DHAVE_purify -DEXTRA_DEBUG -O2" CXX=gcc CXXLD=g++ CXXFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -DHAVE_purify -DEXTRA_DEBUG -O2" ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-embedded-server --with-innodb $EXTRA_CONFIG_FLAGS
|
||||
|
||||
gmake -j 4
|
||||
make -j 4
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
|
@ -75,17 +75,17 @@ purifying_binaries ()
|
|||
fi
|
||||
|
||||
if [ -n "$mode" -a $mode = purify ] ; then
|
||||
gmake CCLD="purify $opts gcc" CXXLD="purify $opts g++" $target
|
||||
make CCLD="purify $opts gcc" CXXLD="purify $opts g++" $target
|
||||
mv $binary $binary-purify
|
||||
fi
|
||||
|
||||
if [ -n "$mode" -a $mode = quantify ] ; then
|
||||
gmake CCLD="quantify $opts gcc" CXXLD="quantify $opts g++" $target
|
||||
make CCLD="quantify $opts gcc" CXXLD="quantify $opts g++" $target
|
||||
mv $binary $binary-quantify
|
||||
fi
|
||||
|
||||
if [ -n "$mode" -a $mode = purecov ] ; then
|
||||
gmake CCLD="purecov $opts gcc" CXXLD="purecov $opts g++" $target
|
||||
make CCLD="purecov $opts gcc" CXXLD="purecov $opts g++" $target
|
||||
mv $binary $binary-purecov
|
||||
fi
|
||||
|
||||
|
|
|
@ -1481,7 +1481,7 @@ end:
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
static char **defaults_argv;
|
||||
char **defaults_argv;
|
||||
int exit_value= 0;
|
||||
ulonglong save_stop_position;
|
||||
MY_INIT(argv[0]);
|
||||
|
|
|
@ -2172,7 +2172,8 @@ continue_xml:
|
|||
|
||||
*/
|
||||
|
||||
static void dump_triggers_for_table(char *table, char *db)
|
||||
static void dump_triggers_for_table(char *table,
|
||||
char *db __attribute__((unused)))
|
||||
{
|
||||
char *result_table;
|
||||
char name_buff[NAME_LEN*4+3], table_buff[NAME_LEN*2+3];
|
||||
|
@ -2181,7 +2182,6 @@ static void dump_triggers_for_table(char *table, char *db)
|
|||
FILE *sql_file= md_result_file;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
DBUG_ENTER("dump_triggers_for_table");
|
||||
DBUG_PRINT("enter", ("db: %s, table: %s", db, table));
|
||||
|
||||
|
|
|
@ -407,7 +407,8 @@ struct st_command
|
|||
TYPELIB command_typelib= {array_elements(command_names),"",
|
||||
command_names, 0};
|
||||
|
||||
DYNAMIC_STRING ds_res, ds_progress, ds_warning_messages;
|
||||
static DYNAMIC_STRING ds_res, ds_progress, ds_warning_messages;
|
||||
static DYNAMIC_STRING global_ds_warnings, global_eval_query;
|
||||
|
||||
void die(const char *fmt, ...)
|
||||
ATTRIBUTE_FORMAT(printf, 1, 2);
|
||||
|
@ -781,6 +782,9 @@ void free_used_memory()
|
|||
dynstr_free(&ds_res);
|
||||
dynstr_free(&ds_progress);
|
||||
dynstr_free(&ds_warning_messages);
|
||||
dynstr_free(&global_ds_warnings);
|
||||
dynstr_free(&global_eval_query);
|
||||
|
||||
free_all_replace();
|
||||
my_free(opt_pass,MYF(MY_ALLOW_ZERO_PTR));
|
||||
free_defaults(default_argv);
|
||||
|
@ -5191,8 +5195,6 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
|
|||
MYSQL *mysql= &cn->mysql;
|
||||
DYNAMIC_STRING *ds;
|
||||
DYNAMIC_STRING ds_result;
|
||||
DYNAMIC_STRING ds_warnings;
|
||||
DYNAMIC_STRING eval_query;
|
||||
char *query;
|
||||
int query_len;
|
||||
my_bool view_created= 0, sp_created= 0;
|
||||
|
@ -5200,7 +5202,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
|
|||
(flags & QUERY_REAP_FLAG));
|
||||
DBUG_ENTER("run_query");
|
||||
|
||||
init_dynamic_string(&ds_warnings, NULL, 0, 256);
|
||||
init_dynamic_string(&global_ds_warnings, NULL, 0, 256);
|
||||
|
||||
/* Scan for warning before sendign to server */
|
||||
scan_command_for_warnings(command);
|
||||
|
@ -5210,10 +5212,10 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
|
|||
*/
|
||||
if (command->type == Q_EVAL)
|
||||
{
|
||||
init_dynamic_string(&eval_query, "", command->query_len+256, 1024);
|
||||
do_eval(&eval_query, command->query, command->end, FALSE);
|
||||
query = eval_query.str;
|
||||
query_len = eval_query.length;
|
||||
init_dynamic_string(&global_eval_query, "", command->query_len+256, 1024);
|
||||
do_eval(&global_eval_query, command->query, command->end, FALSE);
|
||||
query = global_eval_query.str;
|
||||
query_len = global_eval_query.length;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5285,7 +5287,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
|
|||
Collect warnings from create of the view that should otherwise
|
||||
have been produced when the SELECT was executed
|
||||
*/
|
||||
append_warnings(&ds_warnings, cur_con->util_mysql);
|
||||
append_warnings(&global_ds_warnings, cur_con->util_mysql);
|
||||
}
|
||||
|
||||
dynstr_free(&query_str);
|
||||
|
@ -5344,10 +5346,10 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
|
|||
if (ps_protocol_enabled &&
|
||||
complete_query &&
|
||||
match_re(&ps_re, query))
|
||||
run_query_stmt(mysql, command, query, query_len, ds, &ds_warnings);
|
||||
run_query_stmt(mysql, command, query, query_len, ds, &global_ds_warnings);
|
||||
else
|
||||
run_query_normal(cn, command, flags, query, query_len,
|
||||
ds, &ds_warnings);
|
||||
ds, &global_ds_warnings);
|
||||
|
||||
if (sp_created)
|
||||
{
|
||||
|
@ -5371,11 +5373,11 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
|
|||
check_require(ds, command->require_file);
|
||||
}
|
||||
|
||||
dynstr_free(&ds_warnings);
|
||||
dynstr_free(&global_ds_warnings);
|
||||
if (ds == &ds_result)
|
||||
dynstr_free(&ds_result);
|
||||
if (command->type == Q_EVAL)
|
||||
dynstr_free(&eval_query);
|
||||
dynstr_free(&global_eval_query);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -6282,7 +6284,8 @@ typedef struct st_replace_found {
|
|||
|
||||
|
||||
void replace_strings_append(REPLACE *rep, DYNAMIC_STRING* ds,
|
||||
const char *str, int len)
|
||||
const char *str,
|
||||
int len __attribute__((unused)))
|
||||
{
|
||||
reg1 REPLACE *rep_pos;
|
||||
reg2 REPLACE_STRING *rep_str;
|
||||
|
@ -6673,7 +6676,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
|
|||
we need at least what we have so far in the buffer + the part
|
||||
before this match
|
||||
*/
|
||||
need_buf_len= (res_p - buf) + subs[0].rm_so;
|
||||
need_buf_len= (res_p - buf) + (int) subs[0].rm_so;
|
||||
|
||||
/* on this pass, calculate the memory for the result buffer */
|
||||
while (expr_p < replace_end)
|
||||
|
@ -6683,17 +6686,17 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
|
|||
|
||||
if (c == '\\' && expr_p + 1 < replace_end)
|
||||
{
|
||||
back_ref_num= expr_p[1] - '0';
|
||||
back_ref_num= (int) (expr_p[1] - '0');
|
||||
}
|
||||
|
||||
/* found a valid back_ref (eg. \1)*/
|
||||
if (back_ref_num >= 0 && back_ref_num <= (int)r.re_nsub)
|
||||
{
|
||||
int start_off,end_off;
|
||||
regoff_t start_off, end_off;
|
||||
if ((start_off=subs[back_ref_num].rm_so) > -1 &&
|
||||
(end_off=subs[back_ref_num].rm_eo) > -1)
|
||||
{
|
||||
need_buf_len += (end_off - start_off);
|
||||
need_buf_len += (int) (end_off - start_off);
|
||||
}
|
||||
expr_p += 2;
|
||||
}
|
||||
|
@ -6713,7 +6716,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
|
|||
/* copy the pre-match part */
|
||||
if (subs[0].rm_so)
|
||||
{
|
||||
memcpy(res_p, str_p, subs[0].rm_so);
|
||||
memcpy(res_p, str_p, (size_t) subs[0].rm_so);
|
||||
res_p+= subs[0].rm_so;
|
||||
}
|
||||
|
||||
|
@ -6732,11 +6735,11 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
|
|||
|
||||
if (back_ref_num >= 0 && back_ref_num <= (int)r.re_nsub)
|
||||
{
|
||||
int start_off,end_off;
|
||||
if ((start_off=subs[back_ref_num].rm_so) > -1 &&
|
||||
regoff_t start_off, end_off;
|
||||
if ((start_off= subs[back_ref_num].rm_so) > -1 &&
|
||||
(end_off=subs[back_ref_num].rm_eo) > -1)
|
||||
{
|
||||
int block_len= end_off - start_off;
|
||||
int block_len= (int) (end_off - start_off);
|
||||
memcpy(res_p,str_p + start_off, block_len);
|
||||
res_p += block_len;
|
||||
}
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
#define NOT_FIXED_DEC 31
|
||||
#endif
|
||||
|
||||
#define STRING_WITH_LEN(X) ((const char*) X), ((uint) (sizeof(X) - 1))
|
||||
|
||||
class String;
|
||||
int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
|
||||
String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
|
||||
|
|
|
@ -39,8 +39,7 @@
|
|||
/* **************************************************************** */
|
||||
|
||||
static void
|
||||
memory_error_and_abort (fname)
|
||||
char *fname;
|
||||
memory_error_and_abort(const char *fname)
|
||||
{
|
||||
fprintf (stderr, "%s: out of virtual memory\n", fname);
|
||||
exit (2);
|
||||
|
@ -57,7 +56,7 @@ xmalloc (bytes)
|
|||
|
||||
temp = malloc (bytes);
|
||||
if (temp == 0)
|
||||
memory_error_and_abort ("xmalloc");
|
||||
memory_error_and_abort("xmalloc");
|
||||
return (temp);
|
||||
}
|
||||
|
||||
|
@ -71,7 +70,7 @@ xrealloc (pointer, bytes)
|
|||
temp = pointer ? realloc (pointer, bytes) : malloc (bytes);
|
||||
|
||||
if (temp == 0)
|
||||
memory_error_and_abort ("xrealloc");
|
||||
memory_error_and_abort("xrealloc");
|
||||
return (temp);
|
||||
}
|
||||
|
||||
|
|
10
configure.in
10
configure.in
|
@ -715,7 +715,7 @@ AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \
|
|||
sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
|
||||
unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h \
|
||||
sys/ioctl.h malloc.h sys/malloc.h sys/ipc.h sys/shm.h linux/config.h \
|
||||
sys/resource.h sys/param.h)
|
||||
sys/resource.h sys/param.h port.h)
|
||||
|
||||
AC_CHECK_HEADERS([xfs/xfs.h])
|
||||
|
||||
|
@ -983,7 +983,7 @@ case $SYSTEM_TYPE in
|
|||
AC_DEFINE([DEFAULT_SKIP_THREAD_PRIORITY], [1], [default to skip thread priority])
|
||||
if test "$ac_cv_prog_gcc" = "yes"
|
||||
then
|
||||
FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT"
|
||||
FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL"
|
||||
CFLAGS="$CFLAGS $FLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $FLAGS"
|
||||
MAX_C_OPTIMIZE="-O"
|
||||
|
@ -1883,9 +1883,9 @@ AC_CHECK_FUNCS(alarm bcmp bfill bmove bsearch bzero \
|
|||
pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
|
||||
realpath rename rint rwlock_init setupterm \
|
||||
shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \
|
||||
sighold sigset sigthreadmask sleep \
|
||||
snprintf socket stpcpy strcasecmp strerror strsignal strnlen strpbrk strstr strtol \
|
||||
strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr \
|
||||
sighold sigset sigthreadmask port_create sleep \
|
||||
snprintf socket stpcpy strcasecmp strerror strsignal strnlen strpbrk strstr \
|
||||
strtol strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr \
|
||||
posix_fallocate)
|
||||
|
||||
#
|
||||
|
|
299
configure.in.rej
299
configure.in.rej
|
@ -1,299 +0,0 @@
|
|||
***************
|
||||
*** 388,402 ****
|
||||
if expr "$target_os" : "[[Ll]]inux.*" > /dev/null
|
||||
then
|
||||
MYSQLD_DEFAULT_SWITCHES="--skip-locking"
|
||||
! IS_LINUX="true"
|
||||
AC_MSG_RESULT("yes");
|
||||
else
|
||||
MYSQLD_DEFAULT_SWITCHES=""
|
||||
! IS_LINUX="false"
|
||||
AC_MSG_RESULT("no");
|
||||
fi
|
||||
AC_SUBST(MYSQLD_DEFAULT_SWITCHES)
|
||||
! AC_SUBST(IS_LINUX)
|
||||
|
||||
dnl Find paths to some shell programs
|
||||
AC_PATH_PROG(LN, ln, ln)
|
||||
--- 388,403 ----
|
||||
if expr "$target_os" : "[[Ll]]inux.*" > /dev/null
|
||||
then
|
||||
MYSQLD_DEFAULT_SWITCHES="--skip-locking"
|
||||
! TARGET_LINUX="true"
|
||||
AC_MSG_RESULT("yes");
|
||||
+ AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux])
|
||||
else
|
||||
MYSQLD_DEFAULT_SWITCHES=""
|
||||
! TARGET_LINUX="false"
|
||||
AC_MSG_RESULT("no");
|
||||
fi
|
||||
AC_SUBST(MYSQLD_DEFAULT_SWITCHES)
|
||||
! AC_SUBST(TARGET_LINUX)
|
||||
|
||||
dnl Find paths to some shell programs
|
||||
AC_PATH_PROG(LN, ln, ln)
|
||||
***************
|
||||
*** 576,582 ****
|
||||
# (this is true on the MySQL build machines to avoid NSS problems)
|
||||
#
|
||||
|
||||
! if test "$IS_LINUX" = "true" -a "$static_nss" = ""
|
||||
then
|
||||
tmp=`nm /usr/lib/libc.a | grep _nss_files_getaliasent_r`
|
||||
if test -n "$tmp"
|
||||
--- 577,583 ----
|
||||
# (this is true on the MySQL build machines to avoid NSS problems)
|
||||
#
|
||||
|
||||
! if test "$TARGET_LINUX" = "true" -a "$static_nss" = ""
|
||||
then
|
||||
tmp=`nm /usr/lib/libc.a | grep _nss_files_getaliasent_r`
|
||||
if test -n "$tmp"
|
||||
***************
|
||||
*** 827,833 ****
|
||||
])
|
||||
AC_SUBST(WRAPLIBS)
|
||||
|
||||
! if test "$IS_LINUX" = "true"; then
|
||||
AC_MSG_CHECKING([for atomic operations])
|
||||
|
||||
AC_LANG_SAVE
|
||||
--- 828,834 ----
|
||||
])
|
||||
AC_SUBST(WRAPLIBS)
|
||||
|
||||
! if test "$TARGET_LINUX" = "true"; then
|
||||
AC_MSG_CHECKING([for atomic operations])
|
||||
|
||||
AC_LANG_SAVE
|
||||
***************
|
||||
*** 870,876 ****
|
||||
[ USE_PSTACK=no ])
|
||||
pstack_libs=
|
||||
pstack_dirs=
|
||||
! if test "$USE_PSTACK" = yes -a "$IS_LINUX" = "true" -a "$BASE_MACHINE_TYPE" = "i386" -a "$with_mit_threads" = "no"
|
||||
then
|
||||
have_libiberty= have_libbfd=
|
||||
my_save_LIBS="$LIBS"
|
||||
--- 871,877 ----
|
||||
[ USE_PSTACK=no ])
|
||||
pstack_libs=
|
||||
pstack_dirs=
|
||||
! if test "$USE_PSTACK" = yes -a "$TARGET_LINUX" = "true" -a "$BASE_MACHINE_TYPE" = "i386" -a "$with_mit_threads" = "no"
|
||||
then
|
||||
have_libiberty= have_libbfd=
|
||||
my_save_LIBS="$LIBS"
|
||||
***************
|
||||
*** 1239,1301 ****
|
||||
# Hack for DEC-UNIX (OSF1)
|
||||
if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
|
||||
then
|
||||
! # Look for LinuxThreads.
|
||||
! AC_MSG_CHECKING("LinuxThreads")
|
||||
! grepres=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l`
|
||||
! getconfres=`which getconf >/dev/null && getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ |grep LINUXTHREADS | wc -l || echo 0`
|
||||
! if test "$grepres" -gt 0 -o "$getconfres" -gt 0
|
||||
then
|
||||
! AC_MSG_RESULT("Found")
|
||||
! AC_DEFINE(HAVE_LINUXTHREADS)
|
||||
! # Linux 2.0 sanity check
|
||||
! AC_TRY_COMPILE([#include <sched.h>], [int a = sched_get_priority_min(1);], ,
|
||||
! AC_MSG_ERROR([Syntax error in sched.h. Change _P to __P in the /usr/include/sched.h file. See the Installation chapter in the Reference Manual]))
|
||||
! # RedHat 5.0 does not work with dynamic linking of this. -static also
|
||||
! # gives a speed increase in linux so it does not hurt on other systems.
|
||||
! with_named_thread="-lpthread"
|
||||
! else
|
||||
! AC_MSG_RESULT("Not found")
|
||||
! # If this is a linux machine we should barf
|
||||
! AC_MSG_CHECKING("NPTL")
|
||||
! if test "$IS_LINUX" = "true"
|
||||
! then
|
||||
! getconfres=`which getconf >/dev/null && getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ |grep NPTL | wc -l || echo 0`
|
||||
! if test "$getconfres" -gt 0
|
||||
then
|
||||
! AC_DEFINE(HAVE_LINUXTHREADS) dnl All this code predates NPTL, so "have linuxthreads" is a poor name.
|
||||
! with_named_thread="-lpthread"
|
||||
else
|
||||
! AC_MSG_ERROR([This is a Linux system and neither Linuxthreads nor NPTL were
|
||||
! found. Please install Linuxthreads or a new glibc and try
|
||||
! again. See the Installation chapter in the Reference Manual for
|
||||
! more information.])
|
||||
fi
|
||||
! else
|
||||
! AC_MSG_CHECKING("DEC threads")
|
||||
! if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
|
||||
! then
|
||||
! with_named_thread="-lpthread -lmach -lexc"
|
||||
! CFLAGS="$CFLAGS -D_REENTRANT"
|
||||
! CXXFLAGS="$CXXFLAGS -D_REENTRANT"
|
||||
! AC_DEFINE(HAVE_DEC_THREADS)
|
||||
! AC_MSG_RESULT("yes")
|
||||
! else
|
||||
! AC_MSG_RESULT("no")
|
||||
! AC_MSG_CHECKING("DEC 3.2 threads")
|
||||
! if test -f /usr/shlib/libpthreads.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
|
||||
! then
|
||||
! with_named_thread="-lpthreads -lmach -lc_r"
|
||||
! AC_DEFINE(HAVE_DEC_THREADS)
|
||||
! AC_DEFINE(HAVE_DEC_3_2_THREADS)
|
||||
! with_osf32_threads="yes"
|
||||
! MYSQLD_DEFAULT_SWITCHES="--skip-thread-priority"
|
||||
! AC_MSG_RESULT("yes")
|
||||
! else
|
||||
! AC_MSG_RESULT("no")
|
||||
! fi
|
||||
! fi
|
||||
! fi
|
||||
! fi
|
||||
fi
|
||||
|
||||
|
||||
--- 1240,1337 ----
|
||||
# Hack for DEC-UNIX (OSF1)
|
||||
if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
|
||||
then
|
||||
! AC_MSG_CHECKING("Linux threads")
|
||||
! if test "$TARGET_LINUX" = "true"
|
||||
then
|
||||
! AC_MSG_RESULT("starting")
|
||||
! # use getconf to check glibc contents
|
||||
! AC_MSG_CHECKING("getconf GNU_LIBPTHREAD_VERSION")
|
||||
! case `getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` in
|
||||
! NPTL* )
|
||||
! AC_MSG_RESULT("NPTL")
|
||||
! AC_DEFINE([HAVE_NPTL], [1], [NPTL threads implementation])
|
||||
! with_named_thread="-lpthread"
|
||||
! ;;
|
||||
! LINUXTHREADS* )
|
||||
! AC_MSG_RESULT("Linuxthreads")
|
||||
! AC_DEFINE([HAVE_LINUXTHREADS], [1],
|
||||
! [Whether we are using Xavier Leroy's LinuxThreads])
|
||||
! with_named_thread="-lpthread"
|
||||
! ;;
|
||||
! * )
|
||||
! AC_MSG_RESULT("unknown")
|
||||
! ;;
|
||||
! esac
|
||||
! if test "$with_named_thread" = "no"
|
||||
then
|
||||
! # old method, check headers
|
||||
! # Look for LinuxThreads.
|
||||
! AC_MSG_CHECKING("LinuxThreads in header file comment")
|
||||
! res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l`
|
||||
! if test "$res" -gt 0
|
||||
! then
|
||||
! AC_MSG_RESULT("Found")
|
||||
! AC_DEFINE([HAVE_LINUXTHREADS], [1],
|
||||
! [Whether we are using Xavier Leroy's LinuxThreads])
|
||||
! # Linux 2.0 sanity check
|
||||
! AC_TRY_COMPILE([#include <sched.h>], [int a = sched_get_priority_min(1);], ,
|
||||
! AC_MSG_ERROR([Syntax error in sched.h. Change _P to __P in the /usr/include/sched.h file. See the Installation chapter in the Reference Manual]))
|
||||
! # RedHat 5.0 does not work with dynamic linking of this. -static also
|
||||
! # gives a speed increase in linux so it does not hurt on other systems.
|
||||
! with_named_thread="-lpthread"
|
||||
! else
|
||||
! AC_MSG_RESULT("Not found")
|
||||
! # If this is a linux machine we should barf
|
||||
! AC_MSG_ERROR([This is a Linux system without a working getconf,
|
||||
! and Linuxthreads was not found. Please install it (or a new glibc) and try again.
|
||||
! See the Installation chapter in the Reference Manual for more information.])
|
||||
! fi
|
||||
else
|
||||
! AC_MSG_RESULT("no need to check headers")
|
||||
fi
|
||||
! AC_MSG_CHECKING("for pthread_create in -lpthread");
|
||||
! ac_save_LIBS="$LIBS"
|
||||
! LIBS="$LIBS -lpthread"
|
||||
! AC_TRY_LINK( [#include <pthread.h>],
|
||||
! [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
|
||||
! AC_MSG_RESULT("yes"),
|
||||
! [ AC_MSG_RESULT("no")
|
||||
! AC_MSG_ERROR([
|
||||
! This is a Linux system claiming to support threads, either Linuxthreads or NPTL, but linking a test program failed.
|
||||
! Please install one of these (or a new glibc) and try again.
|
||||
! See the Installation chapter in the Reference Manual for more information.]) ]
|
||||
! )
|
||||
! LIBS="$ac_save_LIBS"
|
||||
! else
|
||||
! AC_MSG_RESULT("no")
|
||||
! fi # "$TARGET_LINUX"
|
||||
! fi # "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
|
||||
!
|
||||
! if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
|
||||
! then
|
||||
! AC_MSG_CHECKING("DEC threads")
|
||||
! if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
|
||||
! then
|
||||
! with_named_thread="-lpthread -lmach -lexc"
|
||||
! CFLAGS="$CFLAGS -D_REENTRANT"
|
||||
! CXXFLAGS="$CXXFLAGS -D_REENTRANT"
|
||||
! AC_DEFINE(HAVE_DEC_THREADS)
|
||||
! AC_MSG_RESULT("yes")
|
||||
! else
|
||||
! AC_MSG_RESULT("no")
|
||||
! AC_MSG_CHECKING("DEC 3.2 threads")
|
||||
! if test -f /usr/shlib/libpthreads.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
|
||||
! then
|
||||
! with_named_thread="-lpthreads -lmach -lc_r"
|
||||
! AC_DEFINE(HAVE_DEC_THREADS)
|
||||
! AC_DEFINE(HAVE_DEC_3_2_THREADS)
|
||||
! with_osf32_threads="yes"
|
||||
! MYSQLD_DEFAULT_SWITCHES="--skip-thread-priority"
|
||||
! AC_MSG_RESULT("yes")
|
||||
! else
|
||||
! AC_MSG_RESULT("no")
|
||||
! fi
|
||||
! fi
|
||||
fi
|
||||
|
||||
|
||||
***************
|
||||
*** 1720,1726 ****
|
||||
AC_SUBST(COMPILATION_COMMENT)
|
||||
|
||||
AC_MSG_CHECKING("need of special linking flags")
|
||||
! if test "$IS_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes"
|
||||
then
|
||||
LDFLAGS="$LDFLAGS -rdynamic"
|
||||
AC_MSG_RESULT("-rdynamic")
|
||||
--- 1756,1762 ----
|
||||
AC_SUBST(COMPILATION_COMMENT)
|
||||
|
||||
AC_MSG_CHECKING("need of special linking flags")
|
||||
! if test "$TARGET_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes"
|
||||
then
|
||||
LDFLAGS="$LDFLAGS -rdynamic"
|
||||
AC_MSG_RESULT("-rdynamic")
|
||||
***************
|
||||
*** 1873,1878 ****
|
||||
tell atod memcpy memmove \
|
||||
setupterm strcasecmp sighold vidattr lrand48 localtime_r \
|
||||
sigset sigthreadmask pthread_sigmask pthread_setprio pthread_setprio_np \
|
||||
pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam \
|
||||
pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \
|
||||
pthread_attr_getstacksize pthread_key_delete \
|
||||
--- 1909,1915 ----
|
||||
tell atod memcpy memmove \
|
||||
setupterm strcasecmp sighold vidattr lrand48 localtime_r \
|
||||
sigset sigthreadmask pthread_sigmask pthread_setprio pthread_setprio_np \
|
||||
+ sigaction sigemptyset sigaddset \
|
||||
pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam \
|
||||
pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \
|
||||
pthread_attr_getstacksize pthread_key_delete \
|
||||
***************
|
||||
*** 1884,1890 ****
|
||||
# Sanity check: We chould not have any fseeko symbol unless
|
||||
# large_file_support=yes
|
||||
AC_CHECK_FUNCS(fseeko,
|
||||
! [if test "$large_file_support" = no -a "$IS_LINUX" = "true";
|
||||
then
|
||||
AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!");
|
||||
fi]
|
||||
--- 1921,1927 ----
|
||||
# Sanity check: We chould not have any fseeko symbol unless
|
||||
# large_file_support=yes
|
||||
AC_CHECK_FUNCS(fseeko,
|
||||
! [if test "$large_file_support" = no -a "$TARGET_LINUX" = "true";
|
||||
then
|
||||
AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!");
|
||||
fi]
|
|
@ -153,7 +153,9 @@ int main(int argc, char **argv) {
|
|||
my_init();
|
||||
|
||||
if (argc > argcnt && argv[argcnt][0] == '-' && argv[argcnt][1] == '#')
|
||||
{
|
||||
DBUG_PUSH(argv[argcnt++]+2);
|
||||
}
|
||||
|
||||
if (argc > argcnt)
|
||||
the_set = argv[argcnt++];
|
||||
|
|
|
@ -41,7 +41,9 @@ static char *NAMEFILE= (char*) "mysqld_ername.h";
|
|||
static char *STATEFILE= (char*) "sql_state.h";
|
||||
static char *TXTFILE= (char*) "../sql/share/errmsg.txt";
|
||||
static char *DATADIRECTORY= (char*) "../sql/share/";
|
||||
#ifndef DBUG_OFF
|
||||
static char *default_dbug_option= (char*) "d:t:O,/tmp/comp_err.trace";
|
||||
#endif
|
||||
|
||||
/* Header for errmsg.sys files */
|
||||
uchar file_head[]= { 254, 254, 2, 1 };
|
||||
|
@ -402,6 +404,8 @@ static int parse_input_file(const char *file_name, struct errors **top_error,
|
|||
int rcount= 0;
|
||||
DBUG_ENTER("parse_input_file");
|
||||
|
||||
*top_error= 0;
|
||||
*top_lang= 0;
|
||||
if (!(file= my_fopen(file_name, O_RDONLY | O_SHARE, MYF(MY_WME))))
|
||||
DBUG_RETURN(0);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace yaSSL {
|
|||
|
||||
|
||||
#ifdef MULTI_THREADED
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#include <windows.h>
|
||||
|
||||
class Mutex {
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "opensslv.h" /* for version number */
|
||||
#include "rsa.h"
|
||||
|
||||
|
||||
#define YASSL_VERSION "1.5.8"
|
||||
|
||||
|
||||
|
@ -190,11 +189,17 @@ enum { /* ERR Constants */
|
|||
EVP_R_BAD_DECRYPT = 2
|
||||
};
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#include <winsock2.h>
|
||||
typedef SOCKET socket_t;
|
||||
#else
|
||||
typedef int socket_t;
|
||||
#endif
|
||||
|
||||
|
||||
SSL_CTX* SSL_CTX_new(SSL_METHOD*);
|
||||
SSL* SSL_new(SSL_CTX*);
|
||||
int SSL_set_fd (SSL*, int);
|
||||
int SSL_set_fd (SSL*, socket_t);
|
||||
int SSL_connect(SSL*);
|
||||
int SSL_write(SSL*, const void*, int);
|
||||
int SSL_read(SSL*, void*, int);
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
|
@ -38,16 +38,14 @@
|
|||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#include "openssl/ssl.h" /* for socket_t */
|
||||
|
||||
|
||||
namespace yaSSL {
|
||||
|
||||
typedef unsigned int uint;
|
||||
|
||||
#ifdef _WIN32
|
||||
typedef SOCKET socket_t;
|
||||
#else
|
||||
typedef int socket_t;
|
||||
#if !defined( _WIN32) && !defined(_WIN64)
|
||||
const socket_t INVALID_SOCKET = -1;
|
||||
const int SD_RECEIVE = 0;
|
||||
const int SD_SEND = 1;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
namespace yaSSL {
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
typedef unsigned int SOCKET_T;
|
||||
#else
|
||||
typedef int SOCKET_T;
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "coding.hpp" // HexDecoder
|
||||
#include "helpers.hpp" // for placement new hack
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h> // FindFirstFile etc..
|
||||
|
@ -58,6 +59,9 @@ int read_file(SSL_CTX* ctx, const char* file, int format, CertType type)
|
|||
if (format != SSL_FILETYPE_ASN1 && format != SSL_FILETYPE_PEM)
|
||||
return SSL_BAD_FILETYPE;
|
||||
|
||||
if (file == NULL || !file[0])
|
||||
return SSL_BAD_FILE;
|
||||
|
||||
FILE* input = fopen(file, "rb");
|
||||
if (!input)
|
||||
return SSL_BAD_FILE;
|
||||
|
@ -229,7 +233,7 @@ void SSL_free(SSL* ssl)
|
|||
}
|
||||
|
||||
|
||||
int SSL_set_fd(SSL* ssl, int fd)
|
||||
int SSL_set_fd(SSL* ssl, socket_t fd)
|
||||
{
|
||||
ssl->useSocket().set_fd(fd);
|
||||
return SSL_SUCCESS;
|
||||
|
@ -950,7 +954,7 @@ void ERR_print_errors_fp(FILE* /*fp*/)
|
|||
|
||||
char* ERR_error_string(unsigned long errNumber, char* buffer)
|
||||
{
|
||||
static char* msg = "Please supply a buffer for error string";
|
||||
static char* msg = (char*) "Please supply a buffer for error string";
|
||||
|
||||
if (buffer) {
|
||||
SetErrorString(YasslError(errNumber), buffer);
|
||||
|
|
|
@ -3390,7 +3390,7 @@ void Integer::DivideByPowerOf2(Integer &r, Integer &q, const Integer &a,
|
|||
CopyWords(r.reg_.get_buffer(), a.reg_.get_buffer(), wordCount);
|
||||
SetWords(r.reg_+wordCount, 0, r.reg_.size()-wordCount);
|
||||
if (n % WORD_BITS != 0)
|
||||
r.reg_[wordCount-1] %= (1 << (n % WORD_BITS));
|
||||
r.reg_[wordCount-1] %= ((word) 1 << (n % WORD_BITS));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -86,8 +86,8 @@ int main(int argc, char** argv)
|
|||
// input output compare
|
||||
byte input[TaoCrypt::MD5::DIGEST_SIZE];
|
||||
byte output[TaoCrypt::MD5::DIGEST_SIZE];
|
||||
file_test("input", input);
|
||||
file_test("output", output);
|
||||
file_test((char*) "input", input);
|
||||
file_test((char*) "output", output);
|
||||
assert(memcmp(input, output, sizeof(input)) == 0);
|
||||
|
||||
printf("\nAll tests passed!\n");
|
||||
|
|
|
@ -350,6 +350,7 @@ inline double ulonglong2double(ulonglong value)
|
|||
#define HAVE_SETFILEPOINTER
|
||||
#define HAVE_VIO_READ_BUFF
|
||||
#define HAVE_STRNLEN
|
||||
#define HAVE_WINSOCK2
|
||||
|
||||
#define strcasecmp stricmp
|
||||
#define strncasecmp strnicmp
|
||||
|
|
|
@ -95,7 +95,7 @@ extern FILE *_db_fp_(void);
|
|||
#define DBUG_SET(a1)
|
||||
#define DBUG_SET_INITIAL(a1)
|
||||
#define DBUG_POP()
|
||||
#define DBUG_PROCESS(a1) (a1)
|
||||
#define DBUG_PROCESS(a1)
|
||||
#define DBUG_SETJMP(a1) setjmp(a1)
|
||||
#define DBUG_LONGJMP(a1) longjmp(a1)
|
||||
#define DBUG_DUMP(keyword,a1,a2)
|
||||
|
|
|
@ -932,7 +932,6 @@ typedef unsigned long long my_size_t;
|
|||
#define my_offsetof(TYPE, MEMBER) \
|
||||
((size_t)((char *)&(((TYPE *)0x10)->MEMBER) - (char*)0x10))
|
||||
|
||||
|
||||
#define NullS (char *) 0
|
||||
/* Nowdays we do not support MessyDos */
|
||||
#ifndef NEAR
|
||||
|
@ -1171,7 +1170,7 @@ typedef char bool; /* Ordinary boolean values 0 1 */
|
|||
*/
|
||||
#define uint3korr(A) (long) (*((unsigned int *) (A)) & 0xFFFFFF)
|
||||
#endif
|
||||
#define uint4korr(A) (*((unsigned long *) (A)))
|
||||
#define uint4korr(A) (*((uint32 *) (A)))
|
||||
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
|
||||
(((uint32) ((uchar) (A)[1])) << 8) +\
|
||||
(((uint32) ((uchar) (A)[2])) << 16) +\
|
||||
|
@ -1285,17 +1284,19 @@ do { doubleget_union _tmp; \
|
|||
*(((char *)(T))+1)=(char) (((A) >> 8));\
|
||||
*(((char *)(T))+2)=(char) (((A) >> 16));\
|
||||
*(((char *)(T))+3)=(char) (((A) >> 24)); } while(0)
|
||||
#define int5store(T,A) do { *((char *)(T))=((A));\
|
||||
*(((char *)(T))+1)=(((A) >> 8));\
|
||||
*(((char *)(T))+2)=(((A) >> 16));\
|
||||
*(((char *)(T))+3)=(((A) >> 24)); \
|
||||
*(((char *)(T))+4)=(((A) >> 32)); } while(0)
|
||||
#define int6store(T,A) do { *((char *)(T))=((A));\
|
||||
*(((char *)(T))+1)=(((A) >> 8)); \
|
||||
*(((char *)(T))+2)=(((A) >> 16)); \
|
||||
*(((char *)(T))+3)=(((A) >> 24)); \
|
||||
*(((char *)(T))+4)=(((A) >> 32)); \
|
||||
*(((char *)(T))+5)=(((A) >> 40)); } while(0)
|
||||
#define int5store(T,A) do { *((char *)(T))= (char)((A)); \
|
||||
*(((char *)(T))+1)= (char)(((A) >> 8)); \
|
||||
*(((char *)(T))+2)= (char)(((A) >> 16)); \
|
||||
*(((char *)(T))+3)= (char)(((A) >> 24)); \
|
||||
*(((char *)(T))+4)= (char)(((A) >> 32)); \
|
||||
} while(0)
|
||||
#define int6store(T,A) do { *((char *)(T))= (char)((A)); \
|
||||
*(((char *)(T))+1)= (char)(((A) >> 8)); \
|
||||
*(((char *)(T))+2)= (char)(((A) >> 16)); \
|
||||
*(((char *)(T))+3)= (char)(((A) >> 24)); \
|
||||
*(((char *)(T))+4)= (char)(((A) >> 32)); \
|
||||
*(((char *)(T))+5)= (char)(((A) >> 40)); \
|
||||
} while(0)
|
||||
#define int8store(T,A) do { uint def_temp= (uint) (A), def_temp2= (uint) ((A) >> 32); \
|
||||
int4store((T),def_temp); \
|
||||
int4store((T+4),def_temp2); } while(0)
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
***************
|
||||
*** 97,103 ****
|
||||
|
||||
|
||||
/* Fix problem with S_ISLNK() on Linux */
|
||||
! #if defined(HAVE_LINUXTHREADS)
|
||||
#undef _GNU_SOURCE
|
||||
#define _GNU_SOURCE 1
|
||||
#endif
|
||||
--- 97,103 ----
|
||||
|
||||
|
||||
/* Fix problem with S_ISLNK() on Linux */
|
||||
! #if defined(TARGET_OS_LINUX) || defined(__GLIBC__)
|
||||
#undef _GNU_SOURCE
|
||||
#define _GNU_SOURCE 1
|
||||
#endif
|
|
@ -18,7 +18,6 @@
|
|||
#ifndef _my_pthread_h
|
||||
#define _my_pthread_h
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef ETIME
|
||||
#define ETIME ETIMEDOUT /* For FreeBSD */
|
||||
#endif
|
||||
|
@ -75,6 +74,7 @@ typedef struct {
|
|||
|
||||
typedef int pthread_mutexattr_t;
|
||||
#define win_pthread_self my_thread_var->pthread_self
|
||||
#define pthread_self() win_pthread_self
|
||||
#define pthread_handler_t EXTERNC void * __cdecl
|
||||
typedef void * (__cdecl *pthread_handler)(void *);
|
||||
|
||||
|
@ -130,7 +130,6 @@ void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/
|
|||
|
||||
#define ETIMEDOUT 145 /* Win32 doesn't have this */
|
||||
#define getpid() GetCurrentThreadId()
|
||||
#define pthread_self() win_pthread_self
|
||||
#define HAVE_LOCALTIME_R 1
|
||||
#define _REENTRANT 1
|
||||
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
|
||||
|
@ -638,12 +637,14 @@ extern pthread_mutexattr_t my_errorcheck_mutexattr;
|
|||
#define MY_MUTEX_INIT_ERRCHK NULL
|
||||
#endif
|
||||
|
||||
typedef ulong my_thread_id;
|
||||
|
||||
extern my_bool my_thread_global_init(void);
|
||||
extern void my_thread_global_end(void);
|
||||
extern my_bool my_thread_init(void);
|
||||
extern void my_thread_end(void);
|
||||
extern const char *my_thread_name(void);
|
||||
extern long my_thread_id(void);
|
||||
extern my_thread_id my_thread_dbug_id(void);
|
||||
extern int pthread_no_free(void *);
|
||||
extern int pthread_dummy(int);
|
||||
|
||||
|
@ -670,7 +671,7 @@ struct st_my_thread_var
|
|||
pthread_mutex_t * volatile current_mutex;
|
||||
pthread_cond_t * volatile current_cond;
|
||||
pthread_t pthread_self;
|
||||
long id;
|
||||
my_thread_id id;
|
||||
int cmp_length;
|
||||
int volatile abort;
|
||||
my_bool init;
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
***************
|
||||
*** 286,293 ****
|
||||
#undef HAVE_PTHREAD_RWLOCK_RDLOCK
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
! #define sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
|
||||
! #define signal(A,B) pthread_signal((A),(void (*)(int)) (B))
|
||||
#define my_pthread_attr_setprio(A,B)
|
||||
#endif /* defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) */
|
||||
|
||||
--- 294,301 ----
|
||||
#undef HAVE_PTHREAD_RWLOCK_RDLOCK
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
! #define my_sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
|
||||
! #define my_signal(A,B) pthread_signal((A),(void (*)(int)) (B))
|
||||
#define my_pthread_attr_setprio(A,B)
|
||||
#endif /* defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) */
|
||||
|
||||
***************
|
||||
*** 324,337 ****
|
||||
#if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX)
|
||||
int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
|
||||
#endif
|
||||
! #if !defined(HAVE_SIGSET) && !defined(HAVE_mit_thread) && !defined(sigset)
|
||||
! #define sigset(A,B) do { struct sigaction s; sigset_t set; \
|
||||
! sigemptyset(&set); \
|
||||
! s.sa_handler = (B); \
|
||||
! s.sa_mask = set; \
|
||||
! s.sa_flags = 0; \
|
||||
! sigaction((A), &s, (struct sigaction *) NULL); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef my_pthread_setprio
|
||||
--- 332,358 ----
|
||||
#if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX)
|
||||
int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
|
||||
#endif
|
||||
!
|
||||
! /*
|
||||
! We define my_sigset() and use that instead of the system sigset() so that
|
||||
! we can favor an implementation based on sigaction(). On some systems, such
|
||||
! as Mac OS X, sigset() results in flags such as SA_RESTART being set, and
|
||||
! we want to make sure that no such flags are set.
|
||||
! */
|
||||
! #if defined(HAVE_SIGACTION) && !defined(my_sigset)
|
||||
! #define my_sigset(A,B) do { struct sigaction s; sigset_t set; int rc; \
|
||||
! DBUG_ASSERT((A) != 0); \
|
||||
! sigemptyset(&set); \
|
||||
! s.sa_handler = (B); \
|
||||
! s.sa_mask = set; \
|
||||
! s.sa_flags = 0; \
|
||||
! rc= sigaction((A), &s, (struct sigaction *) NULL); \
|
||||
! DBUG_ASSERT(rc == 0); \
|
||||
} while (0)
|
||||
+ #elif defined(HAVE_SIGSET) && !defined(my_sigset)
|
||||
+ #define my_sigset(A,B) sigset((A),(B))
|
||||
+ #elif !defined(my_sigset)
|
||||
+ #define my_sigset(A,B) signal((A),(B))
|
||||
#endif
|
||||
|
||||
#ifndef my_pthread_setprio
|
||||
***************
|
||||
*** 416,422 ****
|
||||
#undef pthread_detach_this_thread
|
||||
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(tmp); }
|
||||
#undef sigset
|
||||
! #define sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
|
||||
#endif
|
||||
|
||||
#if ((defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)) || defined(HAVE_DEC_3_2_THREADS)) && !defined(HAVE_CTHREADS_WRAPPER)
|
||||
--- 437,443 ----
|
||||
#undef pthread_detach_this_thread
|
||||
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(tmp); }
|
||||
#undef sigset
|
||||
! #define my_sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
|
||||
#endif
|
||||
|
||||
#if ((defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)) || defined(HAVE_DEC_3_2_THREADS)) && !defined(HAVE_CTHREADS_WRAPPER)
|
|
@ -86,6 +86,7 @@ typedef struct st_alarm {
|
|||
ulong expire_time;
|
||||
thr_alarm_entry alarmed; /* set when alarm is due */
|
||||
pthread_t thread;
|
||||
my_thread_id thread_id;
|
||||
my_bool malloced;
|
||||
} ALARM;
|
||||
|
||||
|
@ -94,7 +95,7 @@ typedef struct st_alarm {
|
|||
void init_thr_alarm(uint max_alarm);
|
||||
void resize_thr_alarm(uint max_alarms);
|
||||
my_bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff);
|
||||
void thr_alarm_kill(pthread_t thread_id);
|
||||
void thr_alarm_kill(my_thread_id thread_id);
|
||||
void thr_end_alarm(thr_alarm_t *alarmed);
|
||||
void end_thr_alarm(my_bool free_structures);
|
||||
sig_handler process_alarm(int);
|
||||
|
|
|
@ -78,7 +78,7 @@ extern enum thr_lock_type thr_upgraded_concurrent_insert_lock;
|
|||
typedef struct st_thr_lock_info
|
||||
{
|
||||
pthread_t thread;
|
||||
ulong thread_id;
|
||||
my_thread_id thread_id;
|
||||
ulong n_cursors;
|
||||
} THR_LOCK_INFO;
|
||||
|
||||
|
@ -144,7 +144,7 @@ enum enum_thr_lock_result thr_multi_lock(THR_LOCK_DATA **data,
|
|||
uint count, THR_LOCK_OWNER *owner);
|
||||
void thr_multi_unlock(THR_LOCK_DATA **data,uint count);
|
||||
void thr_abort_locks(THR_LOCK *lock, bool upgrade_lock);
|
||||
my_bool thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread);
|
||||
my_bool thr_abort_locks_for_thread(THR_LOCK *lock, my_thread_id thread);
|
||||
void thr_print_locks(void); /* For debugging */
|
||||
my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data);
|
||||
void thr_downgrade_write_lock(THR_LOCK_DATA *data,
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
LIBRARY LIBMYSQL
|
||||
DESCRIPTION 'MySQL 5.0 Client Library'
|
||||
VERSION 6.0
|
||||
EXPORTS
|
||||
_dig_vec_lower
|
||||
|
|
|
@ -74,6 +74,7 @@ ADD_LIBRARY(mysqldemb emb_qcache.cc libmysqld.c lib_sql.cc
|
|||
../sql/strfunc.cc ../sql/table.cc ../sql/thr_malloc.cc
|
||||
../sql/time.cc ../sql/tztime.cc ../sql/uniques.cc ../sql/unireg.cc
|
||||
../sql/partition_info.cc ../sql/sql_locale.cc
|
||||
../sql/sql_connect.cc ../sql/scheduler.cc
|
||||
../vio/vio.c ../vio/viosocket.c ../vio/viossl.c
|
||||
../vio/viosslfactories.c
|
||||
${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
|
||||
|
|
|
@ -59,7 +59,8 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
|
|||
sql_load.cc discover.cc sql_locale.cc \
|
||||
sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc \
|
||||
sql_crypt.cc sql_db.cc sql_delete.cc sql_error.cc sql_insert.cc \
|
||||
sql_lex.cc sql_list.cc sql_manager.cc sql_map.cc sql_parse.cc \
|
||||
sql_lex.cc sql_list.cc sql_manager.cc sql_map.cc \
|
||||
scheduler.cc sql_connect.cc sql_parse.cc \
|
||||
sql_prepare.cc sql_derived.cc sql_rename.cc \
|
||||
sql_select.cc sql_do.cc sql_show.cc set_var.cc \
|
||||
sql_string.cc sql_table.cc sql_test.cc sql_udf.cc \
|
||||
|
|
|
@ -34,11 +34,6 @@ extern "C"
|
|||
#include "../sql/mysqld.cc"
|
||||
#endif
|
||||
|
||||
int check_user(THD *thd, enum enum_server_command command,
|
||||
const char *passwd, uint passwd_len, const char *db,
|
||||
bool check_count);
|
||||
void thd_init_client_charset(THD *thd, uint cs_number);
|
||||
|
||||
C_MODE_START
|
||||
|
||||
#include <mysql.h>
|
||||
|
@ -585,10 +580,7 @@ void *create_embedded_thd(int client_flag)
|
|||
goto err;
|
||||
}
|
||||
|
||||
thd->mysys_var= my_thread_var;
|
||||
thd->dbug_thread_id= my_thread_id();
|
||||
|
||||
/* TODO - add init_connect command execution */
|
||||
/* TODO - add init_connect command execution */
|
||||
|
||||
if (thd->variables.max_join_size == HA_POS_ERROR)
|
||||
thd->options |= OPTION_BIG_SELECTS;
|
||||
|
|
5
mysql-test/include/one_thread_per_connection.inc
Normal file
5
mysql-test/include/one_thread_per_connection.inc
Normal file
|
@ -0,0 +1,5 @@
|
|||
-- require r/one_thread_per_connection.require
|
||||
disable_query_log;
|
||||
select @@thread_handling;
|
||||
enable_query_log;
|
||||
|
|
@ -236,8 +236,10 @@ sub mtr_report_stats ($) {
|
|||
"the documentation at\n",
|
||||
"http://www.mysql.com/doc/en/MySQL_test_suite.html\n";
|
||||
}
|
||||
print
|
||||
"The servers were restarted $tot_restarts times\n";
|
||||
if (!$::opt_extern)
|
||||
{
|
||||
print "The servers where restarted $tot_restarts times\n";
|
||||
}
|
||||
|
||||
if ( $::opt_timer )
|
||||
{
|
||||
|
|
|
@ -700,7 +700,9 @@ sub command_line_setup () {
|
|||
"$glob_basedir/client",
|
||||
"$glob_basedir/bin");
|
||||
|
||||
$exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
|
||||
if (!$opt_extern)
|
||||
{
|
||||
$exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
|
||||
"$glob_basedir/sql/mysqld",
|
||||
"$path_client_bindir/mysqld-max-nt",
|
||||
"$path_client_bindir/mysqld-max",
|
||||
|
@ -712,8 +714,16 @@ sub command_line_setup () {
|
|||
"$glob_basedir/bin/mysqld",
|
||||
"$glob_basedir/sbin/mysqld");
|
||||
|
||||
# Use the mysqld found above to find out what features are available
|
||||
collect_mysqld_features();
|
||||
# Use the mysqld found above to find out what features are available
|
||||
collect_mysqld_features();
|
||||
}
|
||||
else
|
||||
{
|
||||
$mysqld_variables{'port'}= 3306;
|
||||
$mysqld_variables{'master-port'}= 3306;
|
||||
$opt_skip_ndbcluster= 1;
|
||||
$opt_skip_im= 1;
|
||||
}
|
||||
|
||||
if ( $opt_comment )
|
||||
{
|
||||
|
@ -750,7 +760,7 @@ sub command_line_setup () {
|
|||
# --------------------------------------------------------------------------
|
||||
# NOTE if the default binlog format is changed, this has to be changed
|
||||
$used_binlog_format= "stmt";
|
||||
if ( $mysql_version_id >= 50100 )
|
||||
if (!$opt_extern && $mysql_version_id >= 50100 )
|
||||
{
|
||||
$used_binlog_format= "mixed"; # Default value for binlog format
|
||||
|
||||
|
@ -836,19 +846,20 @@ sub command_line_setup () {
|
|||
# --------------------------------------------------------------------------
|
||||
# Check im suport
|
||||
# --------------------------------------------------------------------------
|
||||
if ( $mysql_version_id < 50000 )
|
||||
if (!$opt_extern)
|
||||
{
|
||||
# Instance manager is not supported until 5.0
|
||||
$opt_skip_im= 1;
|
||||
if ( $mysql_version_id < 50000 ) {
|
||||
# Instance manager is not supported until 5.0
|
||||
$opt_skip_im= 1;
|
||||
|
||||
}
|
||||
|
||||
if ( $glob_win32 ) {
|
||||
mtr_report("Disable Instance manager - not supported on Windows");
|
||||
$opt_skip_im= 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( $glob_win32 )
|
||||
{
|
||||
mtr_report("Disable Instance manager - not supported on Windows");
|
||||
$opt_skip_im= 1;
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Record flag
|
||||
# --------------------------------------------------------------------------
|
||||
|
@ -1212,7 +1223,7 @@ sub command_line_setup () {
|
|||
$opt_skip_rpl= 1;
|
||||
|
||||
# Setup master->[0] with the settings for the extern server
|
||||
$master->[0]->{'path_sock'}= $opt_socket if $opt_socket;
|
||||
$master->[0]->{'path_sock'}= $opt_socket ? $opt_socket : "/tmp/mysql.sock";
|
||||
mtr_report("Using extern server at '$master->[0]->{path_sock}'");
|
||||
}
|
||||
else
|
||||
|
@ -1478,62 +1489,67 @@ sub executable_setup () {
|
|||
$exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
|
||||
$exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
|
||||
$exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
|
||||
if ( $mysql_version_id >= 50100 )
|
||||
{
|
||||
$exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
|
||||
}
|
||||
if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server )
|
||||
{
|
||||
$exe_mysql_upgrade= mtr_exe_exists("$path_client_bindir/mysql_upgrade")
|
||||
}
|
||||
else
|
||||
{
|
||||
$exe_mysql_upgrade= "";
|
||||
}
|
||||
|
||||
if ( ! $glob_win32 )
|
||||
if (!$opt_extern)
|
||||
{
|
||||
# Look for mysql_fix_system_table script
|
||||
$exe_mysql_fix_system_tables=
|
||||
mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
|
||||
"$path_client_bindir/mysql_fix_privilege_tables");
|
||||
}
|
||||
|
||||
# Look for mysql_fix_privilege_tables.sql script
|
||||
$file_mysql_fix_privilege_tables=
|
||||
mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql",
|
||||
"$glob_basedir/share/mysql_fix_privilege_tables.sql");
|
||||
|
||||
if ( ! $opt_skip_ndbcluster and executable_setup_ndb())
|
||||
{
|
||||
mtr_warning("Could not find all required ndb binaries, " .
|
||||
"all ndb tests will fail, use --skip-ndbcluster to " .
|
||||
"skip testing it.");
|
||||
|
||||
foreach my $cluster (@{$clusters})
|
||||
if ( $mysql_version_id >= 50100 )
|
||||
{
|
||||
$cluster->{"executable_setup_failed"}= 1;
|
||||
$exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
|
||||
}
|
||||
if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server )
|
||||
{
|
||||
$exe_mysql_upgrade= mtr_exe_exists("$path_client_bindir/mysql_upgrade")
|
||||
}
|
||||
else
|
||||
{
|
||||
$exe_mysql_upgrade= "";
|
||||
}
|
||||
|
||||
if ( ! $glob_win32 )
|
||||
{
|
||||
# Look for mysql_fix_system_table script
|
||||
$exe_mysql_fix_system_tables=
|
||||
mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
|
||||
"$path_client_bindir/mysql_fix_privilege_tables");
|
||||
}
|
||||
|
||||
# Look for mysql_fix_privilege_tables.sql script
|
||||
$file_mysql_fix_privilege_tables=
|
||||
mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql",
|
||||
"$glob_basedir/share/mysql_fix_privilege_tables.sql");
|
||||
|
||||
if ( ! $opt_skip_ndbcluster and executable_setup_ndb())
|
||||
{
|
||||
mtr_warning("Could not find all required ndb binaries, " .
|
||||
"all ndb tests will fail, use --skip-ndbcluster to " .
|
||||
"skip testing it.");
|
||||
|
||||
foreach my $cluster (@{$clusters})
|
||||
{
|
||||
$cluster->{"executable_setup_failed"}= 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $opt_skip_im and executable_setup_im())
|
||||
{
|
||||
mtr_warning("Could not find all required instance manager binaries, " .
|
||||
"all im tests will fail, use --skip-im to " .
|
||||
"continue without instance manager");
|
||||
$instance_manager->{"executable_setup_failed"}= 1;
|
||||
}
|
||||
|
||||
# Look for the udf_example library
|
||||
$lib_udf_example=
|
||||
mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
|
||||
"$glob_basedir/sql/.libs/udf_example.so",);
|
||||
|
||||
# Look for the ha_example library
|
||||
$lib_example_plugin=
|
||||
mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'),
|
||||
"$glob_basedir/storage/example/.libs/ha_example.so",);
|
||||
|
||||
}
|
||||
|
||||
if ( ! $opt_skip_im and executable_setup_im())
|
||||
{
|
||||
mtr_warning("Could not find all required instance manager binaries, " .
|
||||
"all im tests will fail, use --skip-im to " .
|
||||
"continue without instance manager");
|
||||
$instance_manager->{"executable_setup_failed"}= 1;
|
||||
}
|
||||
|
||||
# Look for the udf_example library
|
||||
$lib_udf_example=
|
||||
mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
|
||||
"$glob_basedir/sql/.libs/udf_example.so",);
|
||||
|
||||
# Look for the ha_example library
|
||||
$lib_example_plugin=
|
||||
mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'),
|
||||
"$glob_basedir/storage/example/.libs/ha_example.so",);
|
||||
|
||||
# Look for mysqltest executable
|
||||
if ( $glob_use_embedded_server )
|
||||
{
|
||||
|
@ -1599,7 +1615,7 @@ sub mysql_client_test_arguments()
|
|||
mtr_add_arg($args, "--port=$master->[0]->{'port'}");
|
||||
mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}");
|
||||
|
||||
if ( $mysql_version_id >= 50000 )
|
||||
if ( $opt_extern || $mysql_version_id >= 50000 )
|
||||
{
|
||||
mtr_add_arg($args, "--vardir=$opt_vardir")
|
||||
}
|
||||
|
@ -1718,7 +1734,7 @@ sub environment_setup () {
|
|||
}
|
||||
|
||||
$ENV{'LD_LIBRARY_PATH'}= join(":", @ld_library_paths,
|
||||
$ENV{'LD_LIBRARY_PATHS'} ?
|
||||
$ENV{'LD_LIBRARY_PATH'} ?
|
||||
split(':', $ENV{'LD_LIBRARY_PATH'}) : ());
|
||||
mtr_debug("LD_LIBRARY_PATH: $ENV{'LD_LIBRARY_PATH'}");
|
||||
|
||||
|
@ -1899,7 +1915,7 @@ sub environment_setup () {
|
|||
my $cmdline_mysqlbinlog=
|
||||
"$exe_mysqlbinlog" .
|
||||
" --no-defaults --disable-force-if-open --debug-info --local-load=$opt_tmpdir";
|
||||
if ( $mysql_version_id >= 50000 )
|
||||
if ( !$opt_extern && $mysql_version_id >= 50000 )
|
||||
{
|
||||
$cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
|
||||
}
|
||||
|
@ -1930,7 +1946,7 @@ sub environment_setup () {
|
|||
# ----------------------------------------------------
|
||||
# Setup env so childs can execute mysql_upgrade
|
||||
# ----------------------------------------------------
|
||||
if ( $mysql_version_id >= 50000 )
|
||||
if ( !$opt_extern && $mysql_version_id >= 50000 )
|
||||
{
|
||||
$ENV{'MYSQL_UPGRADE'}= mysql_upgrade_arguments();
|
||||
}
|
||||
|
@ -1938,7 +1954,7 @@ sub environment_setup () {
|
|||
# ----------------------------------------------------
|
||||
# Setup env so childs can execute mysql_fix_system_tables
|
||||
# ----------------------------------------------------
|
||||
if ( ! $glob_win32 )
|
||||
if ( !$opt_extern && ! $glob_win32 )
|
||||
{
|
||||
my $cmdline_mysql_fix_system_tables=
|
||||
"$exe_mysql_fix_system_tables --no-defaults --host=localhost " .
|
||||
|
@ -1948,7 +1964,10 @@ sub environment_setup () {
|
|||
"--socket=$master->[0]->{'path_sock'}";
|
||||
$ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
|
||||
}
|
||||
$ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables;
|
||||
if (!$opt_extern)
|
||||
{
|
||||
$ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables;
|
||||
}
|
||||
|
||||
# ----------------------------------------------------
|
||||
# Setup env so childs can execute my_print_defaults
|
||||
|
@ -2253,7 +2272,10 @@ sub check_ssl_support ($) {
|
|||
|
||||
if ($opt_skip_ssl || $opt_extern)
|
||||
{
|
||||
mtr_report("Skipping SSL");
|
||||
if (!$opt_extern)
|
||||
{
|
||||
mtr_report("Skipping SSL");
|
||||
}
|
||||
$opt_ssl_supported= 0;
|
||||
$opt_ssl= 0;
|
||||
return;
|
||||
|
@ -2328,9 +2350,12 @@ sub vs_config_dirs ($$) {
|
|||
sub check_ndbcluster_support ($) {
|
||||
my $mysqld_variables= shift;
|
||||
|
||||
if ($opt_skip_ndbcluster)
|
||||
if ($opt_skip_ndbcluster || $opt_extern)
|
||||
{
|
||||
mtr_report("Skipping ndbcluster");
|
||||
if (!$opt_extern)
|
||||
{
|
||||
mtr_report("Skipping ndbcluster");
|
||||
}
|
||||
$opt_skip_ndbcluster_slave= 1;
|
||||
return;
|
||||
}
|
||||
|
@ -2746,7 +2771,10 @@ sub initialize_servers () {
|
|||
}
|
||||
else
|
||||
{
|
||||
mtr_report("No need to create '$opt_vardir' it already exists");
|
||||
if ($opt_verbose)
|
||||
{
|
||||
mtr_report("No need to create '$opt_vardir' it already exists");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -3143,17 +3171,17 @@ sub do_before_run_mysqltest($)
|
|||
unlink("$result_dir/$tname.log");
|
||||
unlink("$result_dir/$tname.warnings");
|
||||
|
||||
if ( $mysql_version_id < 50000 )
|
||||
if (!$opt_extern)
|
||||
{
|
||||
# Set environment variable NDB_STATUS_OK to 1
|
||||
# if script decided to run mysqltest cluster _is_ installed ok
|
||||
$ENV{'NDB_STATUS_OK'} = "1";
|
||||
}
|
||||
elsif ( $mysql_version_id < 50100 )
|
||||
{
|
||||
# Set environment variable NDB_STATUS_OK to YES
|
||||
# if script decided to run mysqltest cluster _is_ installed ok
|
||||
$ENV{'NDB_STATUS_OK'} = "YES";
|
||||
if ( $mysql_version_id < 50000 ) {
|
||||
# Set environment variable NDB_STATUS_OK to 1
|
||||
# if script decided to run mysqltest cluster _is_ installed ok
|
||||
$ENV{'NDB_STATUS_OK'} = "1";
|
||||
} elsif ( $mysql_version_id < 50100 ) {
|
||||
# Set environment variable NDB_STATUS_OK to YES
|
||||
# if script decided to run mysqltest cluster _is_ installed ok
|
||||
$ENV{'NDB_STATUS_OK'} = "YES";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4932,10 +4960,10 @@ sub usage ($) {
|
|||
|
||||
if ( $message )
|
||||
{
|
||||
print STDERR "$message \n";
|
||||
print STDERR "$message\n";
|
||||
}
|
||||
|
||||
print STDERR <<HERE;
|
||||
print <<HERE;
|
||||
|
||||
$0 [ OPTIONS ] [ TESTCASE ]
|
||||
|
||||
|
|
|
@ -16,19 +16,6 @@ select events.binlog from events;
|
|||
binlog
|
||||
1
|
||||
drop table events;
|
||||
create table t1 (connection int, b int);
|
||||
create procedure p1()
|
||||
begin
|
||||
declare connection int;
|
||||
select max(t1.connection) into connection from t1;
|
||||
select concat("max=",connection) 'p1';
|
||||
end|
|
||||
insert into t1 (connection) values (1);
|
||||
call p1();
|
||||
p1
|
||||
max=1
|
||||
drop procedure p1;
|
||||
drop table t1;
|
||||
create procedure p1()
|
||||
begin
|
||||
declare n int default 2;
|
||||
|
@ -45,3 +32,16 @@ end while contributors;
|
|||
end|
|
||||
drop procedure p1;
|
||||
drop procedure p2;
|
||||
create table t1 (connection int, b int);
|
||||
create procedure p1()
|
||||
begin
|
||||
declare connection int;
|
||||
select max(t1.connection) into connection from t1;
|
||||
select concat("max=",connection) 'p1';
|
||||
end|
|
||||
insert into t1 (connection) values (1);
|
||||
call p1();
|
||||
p1
|
||||
max=1
|
||||
drop procedure p1;
|
||||
drop table t1;
|
||||
|
|
|
@ -121,7 +121,7 @@ select * from t1 where x = 1 for update;
|
|||
x y z
|
||||
1 one 1
|
||||
select * from t1 where x = 2 for update;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
Got one of the listed errors
|
||||
rollback;
|
||||
commit;
|
||||
begin;
|
||||
|
|
6
mysql-test/r/no-threads.result
Normal file
6
mysql-test/r/no-threads.result
Normal file
|
@ -0,0 +1,6 @@
|
|||
select 1+1;
|
||||
1+1
|
||||
2
|
||||
select 1+2;
|
||||
1+2
|
||||
3
|
2
mysql-test/r/one_thread_per_connection.require
Normal file
2
mysql-test/r/one_thread_per_connection.require
Normal file
|
@ -0,0 +1,2 @@
|
|||
@@thread_handling
|
||||
one-thread-per-connection
|
|
@ -2157,11 +2157,11 @@ drop view v1;
|
|||
drop table t1;
|
||||
create procedure proc_1() install plugin my_plug soname 'some_plugin.so';
|
||||
call proc_1();
|
||||
ERROR HY000: Can't open shared library
|
||||
Got one of the listed errors
|
||||
call proc_1();
|
||||
ERROR HY000: Can't open shared library
|
||||
Got one of the listed errors
|
||||
call proc_1();
|
||||
ERROR HY000: Can't open shared library
|
||||
Got one of the listed errors
|
||||
drop procedure proc_1;
|
||||
create function func_1() returns int begin install plugin my_plug soname '/tmp/plugin'; return 1; end|
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
|
|
|
@ -39,3 +39,4 @@ synchronization : Bug#24529 Test 'synchronization' fails on Mac pushb
|
|||
mysql_upgrade : Bug#25074 mysql_upgrade gives inconsisten results
|
||||
plugin : Bug#25659 memory leak via "plugins" test
|
||||
rpl_ndb_dd_advance : Bug#25913 rpl_ndb_dd_advance fails randomly
|
||||
ndb_alter_table : Bug##25774 ndb_alter_table.test fails in DBUG_ASSERT() on Linux x64
|
||||
|
|
|
@ -20,28 +20,6 @@ drop table events;
|
|||
|
||||
# End of 4.1 tests
|
||||
|
||||
|
||||
#
|
||||
# Bug#12204 - CONNECTION should not be a reserved word
|
||||
#
|
||||
|
||||
create table t1 (connection int, b int);
|
||||
delimiter |;
|
||||
create procedure p1()
|
||||
begin
|
||||
declare connection int;
|
||||
select max(t1.connection) into connection from t1;
|
||||
select concat("max=",connection) 'p1';
|
||||
end|
|
||||
delimiter ;|
|
||||
insert into t1 (connection) values (1);
|
||||
call p1();
|
||||
drop procedure p1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
# End of 5.0 tests
|
||||
|
||||
#
|
||||
# Bug#19939 "AUTHORS is not a keyword"
|
||||
#
|
||||
|
@ -65,3 +43,24 @@ drop procedure p1;
|
|||
drop procedure p2;
|
||||
|
||||
# End of 5.1 tests
|
||||
|
||||
#
|
||||
# Bug#12204 - CONNECTION should not be a reserved word
|
||||
#
|
||||
|
||||
create table t1 (connection int, b int);
|
||||
delimiter |;
|
||||
create procedure p1()
|
||||
begin
|
||||
declare connection int;
|
||||
select max(t1.connection) into connection from t1;
|
||||
select concat("max=",connection) 'p1';
|
||||
end|
|
||||
delimiter ;|
|
||||
insert into t1 (connection) values (1);
|
||||
call p1();
|
||||
drop procedure p1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
# End of 5.0 tests
|
||||
|
|
|
@ -149,7 +149,7 @@ begin;
|
|||
# Have to check with pk access here since scans take locks on
|
||||
# all rows and then release them in chunks
|
||||
select * from t1 where x = 1 for update;
|
||||
--error 1205
|
||||
--error 1105,1205
|
||||
select * from t1 where x = 2 for update;
|
||||
rollback;
|
||||
|
||||
|
|
1
mysql-test/t/no-threads-master.opt
Normal file
1
mysql-test/t/no-threads-master.opt
Normal file
|
@ -0,0 +1 @@
|
|||
--one-thread --thread-handling=no-threads
|
5
mysql-test/t/no-threads.test
Normal file
5
mysql-test/t/no-threads.test
Normal file
|
@ -0,0 +1,5 @@
|
|||
#
|
||||
# Test the --thread-handler=no-threads option
|
||||
#
|
||||
select 1+1;
|
||||
select 1+2;
|
|
@ -2175,13 +2175,13 @@ drop table t1;
|
|||
|
||||
create procedure proc_1() install plugin my_plug soname 'some_plugin.so';
|
||||
--replace_regex /(Can\'t open shared library).*$/\1/
|
||||
--error ER_CANT_OPEN_LIBRARY
|
||||
--error ER_CANT_OPEN_LIBRARY,ER_FEATURE_DISABLED
|
||||
call proc_1();
|
||||
--replace_regex /(Can\'t open shared library).*$/\1/
|
||||
--error ER_CANT_OPEN_LIBRARY
|
||||
--error ER_CANT_OPEN_LIBRARY,ER_FEATURE_DISABLED
|
||||
call proc_1();
|
||||
--replace_regex /(Can\'t open shared library).*$/\1/
|
||||
--error ER_CANT_OPEN_LIBRARY
|
||||
--error ER_CANT_OPEN_LIBRARY,ER_FEATURE_DISABLED
|
||||
call proc_1();
|
||||
drop procedure proc_1;
|
||||
delimiter |;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# This tests not performed with embedded server
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/one_thread_per_connection.inc
|
||||
|
||||
#
|
||||
# Bug #8731: wait_timeout does not work on Mac OS X
|
||||
|
|
|
@ -100,10 +100,10 @@ base64_encode(const void *src, size_t src_len, char *dst)
|
|||
}
|
||||
|
||||
|
||||
static inline unsigned
|
||||
static inline uint
|
||||
pos(unsigned char c)
|
||||
{
|
||||
return strchr(base64_table, c) - base64_table;
|
||||
return (uint) (strchr(base64_table, c) - base64_table);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -159,8 +159,10 @@ static void unlink_from_queue(KEYCACHE_WQUEUE *wqueue,
|
|||
struct st_my_thread_var *thread);
|
||||
#endif
|
||||
static void free_block(KEY_CACHE *keycache, BLOCK_LINK *block);
|
||||
#ifndef DBUG_OFF
|
||||
static void test_key_cache(KEY_CACHE *keycache,
|
||||
const char *where, my_bool lock);
|
||||
#endif
|
||||
|
||||
#define KEYCACHE_HASH(f, pos) \
|
||||
(((ulong) ((pos) >> keycache->key_cache_shift)+ \
|
||||
|
@ -2608,7 +2610,8 @@ static int flush_all_key_blocks(KEY_CACHE *keycache)
|
|||
0 on success (always because it can't fail)
|
||||
*/
|
||||
|
||||
int reset_key_cache_counters(const char *name, KEY_CACHE *key_cache)
|
||||
int reset_key_cache_counters(const char *name __attribute__((unused)),
|
||||
KEY_CACHE *key_cache)
|
||||
{
|
||||
DBUG_ENTER("reset_key_cache_counters");
|
||||
if (!key_cache->key_cache_inited)
|
||||
|
|
|
@ -194,6 +194,7 @@ int handle_options(int *argc, char ***argv,
|
|||
Find first the right option. Return error in case of an ambiguous,
|
||||
or unknown option
|
||||
*/
|
||||
LINT_INIT(prev_found);
|
||||
optp= longopts;
|
||||
if (!(opt_found= findopt(opt_str, length, &optp, &prev_found)))
|
||||
{
|
||||
|
@ -960,7 +961,7 @@ void my_print_variables(const struct my_option *options)
|
|||
printf("%d\n", *((uint*) value));
|
||||
break;
|
||||
case GET_LONG:
|
||||
printf("%lu\n", *((long*) value));
|
||||
printf("%ld\n", *((long*) value));
|
||||
break;
|
||||
case GET_ULONG:
|
||||
printf("%lu\n", *((ulong*) value));
|
||||
|
|
|
@ -199,7 +199,9 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
|
|||
}
|
||||
|
||||
if (!(infoflag & MY_DONT_FREE_DBUG))
|
||||
{
|
||||
DBUG_END(); /* Must be done before my_thread_end */
|
||||
}
|
||||
#ifdef THREAD
|
||||
my_thread_end();
|
||||
my_thread_global_end();
|
||||
|
@ -248,14 +250,16 @@ void setEnvString(char *ret, const char *name, const char *value)
|
|||
}
|
||||
|
||||
/*
|
||||
my_paramter_handler
|
||||
Invalid paramter handler we will use instead of the one "baked" into the CRT
|
||||
for MSC v8. This one just prints out what invalid parameter was encountered.
|
||||
By providing this routine, routines like lseek will return -1 when we expect them
|
||||
to instead of crash.
|
||||
my_parameter_handler
|
||||
|
||||
Invalid parameter handler we will use instead of the one "baked"
|
||||
into the CRT for MSC v8. This one just prints out what invalid
|
||||
parameter was encountered. By providing this routine, routines like
|
||||
lseek will return -1 when we expect them to instead of crash.
|
||||
*/
|
||||
void my_parameter_handler(const wchar_t * expression, const wchar_t * function,
|
||||
const wchar_t * file, unsigned int line,
|
||||
|
||||
void my_parameter_handler(const wchar_t * expression, const wchar_t * function,
|
||||
const wchar_t * file, unsigned int line,
|
||||
uintptr_t pReserved)
|
||||
{
|
||||
DBUG_PRINT("my",("Expression: %s function: %s file: %s, line: %d",
|
||||
|
|
|
@ -46,23 +46,23 @@ pthread_mutexattr_t my_fast_mutexattr;
|
|||
pthread_mutexattr_t my_errorcheck_mutexattr;
|
||||
#endif
|
||||
|
||||
#ifdef NPTL_PTHREAD_EXIT_BUG /* see my_pthread.h */
|
||||
#ifdef NPTL_PTHREAD_EXIT_BUG /* see my_pthread.h */
|
||||
|
||||
/*
|
||||
Dummy thread spawned in my_thread_global_init() below to avoid
|
||||
race conditions in NPTL pthread_exit code.
|
||||
Dummy thread spawned in my_thread_global_init() below to avoid
|
||||
race conditions in NPTL pthread_exit code.
|
||||
*/
|
||||
|
||||
static
|
||||
pthread_handler_t nptl_pthread_exit_hack_handler(void *arg)
|
||||
static pthread_handler_t
|
||||
nptl_pthread_exit_hack_handler(void *arg __attribute((unused)))
|
||||
{
|
||||
/* Do nothing! */
|
||||
pthread_exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
initialize thread environment
|
||||
|
||||
|
@ -83,25 +83,28 @@ my_bool my_thread_global_init(void)
|
|||
}
|
||||
|
||||
#ifdef NPTL_PTHREAD_EXIT_BUG
|
||||
/*
|
||||
BUG#24507: Race conditions inside current NPTL pthread_exit()
|
||||
implementation.
|
||||
|
||||
/*
|
||||
BUG#24507: Race conditions inside current NPTL pthread_exit() implementation.
|
||||
|
||||
To avoid a possible segmentation fault during concurrent executions of
|
||||
pthread_exit(), a dummy thread is spawned which initializes internal variables
|
||||
of pthread lib. See bug description for thoroughfull explanation.
|
||||
To avoid a possible segmentation fault during concurrent
|
||||
executions of pthread_exit(), a dummy thread is spawned which
|
||||
initializes internal variables of pthread lib. See bug description
|
||||
for a full explanation.
|
||||
|
||||
TODO: Remove this code when fixed versions of glibc6 are in common use.
|
||||
*/
|
||||
TODO: Remove this code when fixed versions of glibc6 are in common
|
||||
use.
|
||||
*/
|
||||
{
|
||||
pthread_t dummy_thread;
|
||||
pthread_attr_t dummy_thread_attr;
|
||||
|
||||
pthread_t dummy_thread;
|
||||
pthread_attr_t dummy_thread_attr;
|
||||
|
||||
pthread_attr_init(&dummy_thread_attr);
|
||||
pthread_attr_setdetachstate(&dummy_thread_attr,PTHREAD_CREATE_DETACHED);
|
||||
|
||||
pthread_create(&dummy_thread,&dummy_thread_attr,nptl_pthread_exit_hack_handler,NULL);
|
||||
pthread_attr_init(&dummy_thread_attr);
|
||||
pthread_attr_setdetachstate(&dummy_thread_attr, PTHREAD_CREATE_DETACHED);
|
||||
|
||||
pthread_create(&dummy_thread,&dummy_thread_attr,
|
||||
nptl_pthread_exit_hack_handler, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
|
||||
|
@ -206,7 +209,7 @@ void my_thread_global_end(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static long thread_id=0;
|
||||
static my_thread_id thread_id= 0;
|
||||
|
||||
/*
|
||||
Allocate thread specific memory for the thread, used by mysys and dbug
|
||||
|
@ -234,15 +237,16 @@ my_bool my_thread_init(void)
|
|||
my_bool error=0;
|
||||
|
||||
#ifdef EXTRA_DEBUG_THREADS
|
||||
fprintf(stderr,"my_thread_init(): thread_id=%ld\n",pthread_self());
|
||||
fprintf(stderr,"my_thread_init(): thread_id: 0x%lx\n",
|
||||
(ulong) pthread_self());
|
||||
#endif
|
||||
|
||||
#if !defined(__WIN__) || defined(USE_TLS)
|
||||
if (my_pthread_getspecific(struct st_my_thread_var *,THR_KEY_mysys))
|
||||
{
|
||||
#ifdef EXTRA_DEBUG_THREADS
|
||||
fprintf(stderr,"my_thread_init() called more than once in thread %ld\n",
|
||||
pthread_self());
|
||||
fprintf(stderr,"my_thread_init() called more than once in thread 0x%lx\n",
|
||||
(long) pthread_self());
|
||||
#endif
|
||||
goto end;
|
||||
}
|
||||
|
@ -262,7 +266,9 @@ my_bool my_thread_init(void)
|
|||
tmp= &THR_KEY_mysys;
|
||||
#endif
|
||||
#if defined(__WIN__) && defined(EMBEDDED_LIBRARY)
|
||||
tmp->thread_self= (pthread_t)getpid();
|
||||
tmp->pthread_self= (pthread_t) getpid();
|
||||
#else
|
||||
tmp->pthread_self= pthread_self();
|
||||
#endif
|
||||
pthread_mutex_init(&tmp->mutex,MY_MUTEX_INIT_FAST);
|
||||
pthread_cond_init(&tmp->suspend, NULL);
|
||||
|
@ -272,6 +278,11 @@ my_bool my_thread_init(void)
|
|||
tmp->id= ++thread_id;
|
||||
++THR_thread_count;
|
||||
pthread_mutex_unlock(&THR_LOCK_threads);
|
||||
#ifndef DBUG_OFF
|
||||
/* Generate unique name for thread */
|
||||
(void) my_thread_name();
|
||||
#endif
|
||||
|
||||
end:
|
||||
return error;
|
||||
}
|
||||
|
@ -295,8 +306,8 @@ void my_thread_end(void)
|
|||
tmp= my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
|
||||
|
||||
#ifdef EXTRA_DEBUG_THREADS
|
||||
fprintf(stderr,"my_thread_end(): tmp: 0x%lx thread_id=%ld\n",
|
||||
(long) tmp, pthread_self());
|
||||
fprintf(stderr,"my_thread_end(): tmp: 0x%lx pthread_self: 0x%lx thread_id: %ld\n",
|
||||
(long) tmp, (long) pthread_self(), tmp ? (long) tmp->id : 0L);
|
||||
#endif
|
||||
if (tmp && tmp->init)
|
||||
{
|
||||
|
@ -357,17 +368,9 @@ struct st_my_thread_var *_my_thread_var(void)
|
|||
Get name of current thread.
|
||||
****************************************************************************/
|
||||
|
||||
#define UNKNOWN_THREAD -1
|
||||
|
||||
long my_thread_id()
|
||||
my_thread_id my_thread_dbug_id()
|
||||
{
|
||||
#if defined(HAVE_PTHREAD_GETSEQUENCE_NP)
|
||||
return pthread_getsequence_np(pthread_self());
|
||||
#elif (defined(__sun) || defined(__sgi) || defined(__linux__))
|
||||
return pthread_self();
|
||||
#else
|
||||
return my_thread_var->id;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef DBUG_OFF
|
||||
|
@ -384,8 +387,8 @@ const char *my_thread_name(void)
|
|||
struct st_my_thread_var *tmp=my_thread_var;
|
||||
if (!tmp->name[0])
|
||||
{
|
||||
long id=my_thread_id();
|
||||
sprintf(name_buff,"T@%ld", id);
|
||||
my_thread_id id= my_thread_dbug_id();
|
||||
sprintf(name_buff,"T@%lu", (ulong) id);
|
||||
strmake(tmp->name,name_buff,THREAD_NAME_SIZE);
|
||||
}
|
||||
return tmp->name;
|
||||
|
|
|
@ -185,7 +185,7 @@ my_off_t my_get_ptr(byte *ptr, uint pack_length)
|
|||
case 3: pos= (my_off_t) mi_uint3korr(ptr); break;
|
||||
case 2: pos= (my_off_t) mi_uint2korr(ptr); break;
|
||||
case 1: pos= (my_off_t) *(uchar*) ptr; break;
|
||||
default: DBUG_ASSERT(0);
|
||||
default: DBUG_ASSERT(0); return 0;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
|
|
@ -146,6 +146,7 @@ my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
|
|||
ulong now;
|
||||
sigset_t old_mask;
|
||||
my_bool reschedule;
|
||||
struct st_my_thread_var *current_my_thread_var= my_thread_var;
|
||||
DBUG_ENTER("thr_alarm");
|
||||
DBUG_PRINT("enter",("thread: %s sec: %d",my_thread_name(),sec));
|
||||
|
||||
|
@ -195,7 +196,8 @@ my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
|
|||
alarm_data->malloced=0;
|
||||
alarm_data->expire_time=now+sec;
|
||||
alarm_data->alarmed=0;
|
||||
alarm_data->thread=pthread_self();
|
||||
alarm_data->thread= current_my_thread_var->pthread_self;
|
||||
alarm_data->thread_id= current_my_thread_var->id;
|
||||
queue_insert(&alarm_queue,(byte*) alarm_data);
|
||||
|
||||
/* Reschedule alarm if the current one has more than sec left */
|
||||
|
@ -444,7 +446,7 @@ void end_thr_alarm(my_bool free_structures)
|
|||
Remove another thread from the alarm
|
||||
*/
|
||||
|
||||
void thr_alarm_kill(pthread_t thread_id)
|
||||
void thr_alarm_kill(my_thread_id thread_id)
|
||||
{
|
||||
uint i;
|
||||
if (alarm_aborted)
|
||||
|
@ -452,8 +454,7 @@ void thr_alarm_kill(pthread_t thread_id)
|
|||
pthread_mutex_lock(&LOCK_alarm);
|
||||
for (i=0 ; i < alarm_queue.elements ; i++)
|
||||
{
|
||||
if (pthread_equal(((ALARM*) queue_element(&alarm_queue,i))->thread,
|
||||
thread_id))
|
||||
if (((ALARM*) queue_element(&alarm_queue,i))->thread_id == thread_id)
|
||||
{
|
||||
ALARM *tmp=(ALARM*) queue_remove(&alarm_queue,i);
|
||||
tmp->expire_time=0;
|
||||
|
@ -567,7 +568,7 @@ static void *alarm_handler(void *arg __attribute__((unused)))
|
|||
|
||||
#else /* __WIN__ */
|
||||
|
||||
void thr_alarm_kill(pthread_t thread_id)
|
||||
void thr_alarm_kill(my_thread_id thread_id)
|
||||
{
|
||||
/* Can't do this yet */
|
||||
}
|
||||
|
|
|
@ -1,220 +0,0 @@
|
|||
***************
|
||||
*** 76,96 ****
|
||||
alarm_aborted=0;
|
||||
init_queue(&alarm_queue,max_alarms+1,offsetof(ALARM,expire_time),0,
|
||||
compare_ulong,NullS);
|
||||
! sigfillset(&full_signal_set); /* Neaded to block signals */
|
||||
pthread_mutex_init(&LOCK_alarm,MY_MUTEX_INIT_FAST);
|
||||
pthread_cond_init(&COND_alarm,NULL);
|
||||
! #if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD)
|
||||
! #if defined(HAVE_mit_thread)
|
||||
! sigset(THR_CLIENT_ALARM,thread_alarm); /* int. thread system calls */
|
||||
! #else
|
||||
{
|
||||
! struct sigaction sact;
|
||||
! sact.sa_flags = 0;
|
||||
! sact.sa_handler = thread_alarm;
|
||||
! sigaction(THR_CLIENT_ALARM, &sact, (struct sigaction*) 0);
|
||||
}
|
||||
- #endif
|
||||
- #endif
|
||||
sigemptyset(&s);
|
||||
sigaddset(&s, THR_SERVER_ALARM);
|
||||
alarm_thread=pthread_self();
|
||||
--- 74,89 ----
|
||||
alarm_aborted=0;
|
||||
init_queue(&alarm_queue,max_alarms+1,offsetof(ALARM,expire_time),0,
|
||||
compare_ulong,NullS);
|
||||
! sigfillset(&full_signal_set); /* Needed to block signals */
|
||||
pthread_mutex_init(&LOCK_alarm,MY_MUTEX_INIT_FAST);
|
||||
pthread_cond_init(&COND_alarm,NULL);
|
||||
! #ifndef USE_ALARM_THREAD
|
||||
! if (thd_lib_detected != THD_LIB_LT)
|
||||
! #endif
|
||||
{
|
||||
! my_sigset(thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1,
|
||||
! thread_alarm);
|
||||
}
|
||||
sigemptyset(&s);
|
||||
sigaddset(&s, THR_SERVER_ALARM);
|
||||
alarm_thread=pthread_self();
|
||||
***************
|
||||
*** 108,120 ****
|
||||
}
|
||||
#elif defined(USE_ONE_SIGNAL_HAND)
|
||||
pthread_sigmask(SIG_BLOCK, &s, NULL); /* used with sigwait() */
|
||||
! #if THR_SERVER_ALARM == THR_CLIENT_ALARM
|
||||
! sigset(THR_CLIENT_ALARM,process_alarm); /* Linuxthreads */
|
||||
! pthread_sigmask(SIG_UNBLOCK, &s, NULL);
|
||||
! #endif
|
||||
#else
|
||||
pthread_sigmask(SIG_UNBLOCK, &s, NULL);
|
||||
- sigset(THR_SERVER_ALARM,process_alarm);
|
||||
#endif
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
--- 101,115 ----
|
||||
}
|
||||
#elif defined(USE_ONE_SIGNAL_HAND)
|
||||
pthread_sigmask(SIG_BLOCK, &s, NULL); /* used with sigwait() */
|
||||
! if (thd_lib_detected == THD_LIB_LT)
|
||||
! {
|
||||
! my_sigset(thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1,
|
||||
! process_alarm); /* Linuxthreads */
|
||||
! pthread_sigmask(SIG_UNBLOCK, &s, NULL);
|
||||
! }
|
||||
#else
|
||||
+ my_sigset(THR_SERVER_ALARM, process_alarm);
|
||||
pthread_sigmask(SIG_UNBLOCK, &s, NULL);
|
||||
#endif
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
***************
|
||||
*** 240,246 ****
|
||||
if (alarm_data->malloced)
|
||||
my_free((gptr) alarm_data,MYF(0));
|
||||
found++;
|
||||
! #ifndef DBUG_OFF
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
--- 235,241 ----
|
||||
if (alarm_data->malloced)
|
||||
my_free((gptr) alarm_data,MYF(0));
|
||||
found++;
|
||||
! #ifdef DBUG_OFF
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
***************
|
||||
*** 249,258 ****
|
||||
if (!found)
|
||||
{
|
||||
if (*alarmed)
|
||||
! fprintf(stderr,"Warning: Didn't find alarm %lx in queue of %d alarms\n",
|
||||
! (long) *alarmed, alarm_queue.elements);
|
||||
! DBUG_PRINT("warning",("Didn't find alarm %lx in queue\n",
|
||||
! (long) *alarmed));
|
||||
}
|
||||
pthread_mutex_unlock(&LOCK_alarm);
|
||||
pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
|
||||
--- 244,254 ----
|
||||
if (!found)
|
||||
{
|
||||
if (*alarmed)
|
||||
! fprintf(stderr,
|
||||
! "Warning: Didn't find alarm 0x%lx in queue of %d alarms\n",
|
||||
! (long) *alarmed, alarm_queue.elements);
|
||||
! DBUG_PRINT("warning",("Didn't find alarm 0x%lx in queue\n",
|
||||
! (long) *alarmed));
|
||||
}
|
||||
pthread_mutex_unlock(&LOCK_alarm);
|
||||
pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
|
||||
***************
|
||||
*** 274,291 ****
|
||||
This must be first as we can't call DBUG inside an alarm for a normal thread
|
||||
*/
|
||||
|
||||
! #if THR_SERVER_ALARM == THR_CLIENT_ALARM
|
||||
! if (!pthread_equal(pthread_self(),alarm_thread))
|
||||
{
|
||||
#if defined(MAIN) && !defined(__bsdi__)
|
||||
! printf("thread_alarm\n"); fflush(stdout);
|
||||
#endif
|
||||
#ifdef DONT_REMEMBER_SIGNAL
|
||||
! sigset(THR_CLIENT_ALARM,process_alarm); /* int. thread system calls */
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
- #endif
|
||||
|
||||
/*
|
||||
We have to do do the handling of the alarm in a sub function,
|
||||
--- 270,287 ----
|
||||
This must be first as we can't call DBUG inside an alarm for a normal thread
|
||||
*/
|
||||
|
||||
! if (thd_lib_detected == THD_LIB_LT &&
|
||||
! !pthread_equal(pthread_self(),alarm_thread))
|
||||
{
|
||||
#if defined(MAIN) && !defined(__bsdi__)
|
||||
! printf("thread_alarm in process_alarm\n"); fflush(stdout);
|
||||
#endif
|
||||
#ifdef DONT_REMEMBER_SIGNAL
|
||||
! my_sigset(thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1,
|
||||
! process_alarm); /* int. thread system calls */
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
We have to do do the handling of the alarm in a sub function,
|
||||
***************
|
||||
*** 301,307 ****
|
||||
process_alarm_part2(sig);
|
||||
#ifndef USE_ALARM_THREAD
|
||||
#if defined(DONT_REMEMBER_SIGNAL) && !defined(USE_ONE_SIGNAL_HAND)
|
||||
! sigset(THR_SERVER_ALARM,process_alarm);
|
||||
#endif
|
||||
pthread_mutex_unlock(&LOCK_alarm);
|
||||
pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
|
||||
--- 297,303 ----
|
||||
process_alarm_part2(sig);
|
||||
#ifndef USE_ALARM_THREAD
|
||||
#if defined(DONT_REMEMBER_SIGNAL) && !defined(USE_ONE_SIGNAL_HAND)
|
||||
! my_sigset(THR_SERVER_ALARM, process_alarm);
|
||||
#endif
|
||||
pthread_mutex_unlock(&LOCK_alarm);
|
||||
pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
|
||||
***************
|
||||
*** 504,520 ****
|
||||
ARGSUSED
|
||||
*/
|
||||
|
||||
- #if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD)
|
||||
static sig_handler thread_alarm(int sig)
|
||||
{
|
||||
#ifdef MAIN
|
||||
printf("thread_alarm\n"); fflush(stdout);
|
||||
#endif
|
||||
#ifdef DONT_REMEMBER_SIGNAL
|
||||
! sigset(sig,thread_alarm); /* int. thread system calls */
|
||||
#endif
|
||||
}
|
||||
- #endif
|
||||
|
||||
|
||||
#ifdef HAVE_TIMESPEC_TS_SEC
|
||||
--- 499,513 ----
|
||||
ARGSUSED
|
||||
*/
|
||||
|
||||
static sig_handler thread_alarm(int sig)
|
||||
{
|
||||
#ifdef MAIN
|
||||
printf("thread_alarm\n"); fflush(stdout);
|
||||
#endif
|
||||
#ifdef DONT_REMEMBER_SIGNAL
|
||||
! my_sigset(sig, thread_alarm); /* int. thread system calls */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_TIMESPEC_TS_SEC
|
||||
***************
|
||||
*** 915,921 ****
|
||||
printf("Warning: Got signal %d from thread %s\n",sig,my_thread_name());
|
||||
fflush(stdout);
|
||||
#ifdef DONT_REMEMBER_SIGNAL
|
||||
! sigset(sig,print_signal_warning); /* int. thread system calls */
|
||||
#endif
|
||||
#ifndef OS2
|
||||
if (sig == SIGALRM)
|
||||
--- 908,914 ----
|
||||
printf("Warning: Got signal %d from thread %s\n",sig,my_thread_name());
|
||||
fflush(stdout);
|
||||
#ifdef DONT_REMEMBER_SIGNAL
|
||||
! my_sigset(sig, print_signal_warning); /* int. thread system calls */
|
||||
#endif
|
||||
#ifndef OS2
|
||||
if (sig == SIGALRM)
|
|
@ -343,8 +343,9 @@ void thr_lock_delete(THR_LOCK *lock)
|
|||
|
||||
void thr_lock_info_init(THR_LOCK_INFO *info)
|
||||
{
|
||||
info->thread= pthread_self();
|
||||
info->thread_id= my_thread_id(); /* for debugging */
|
||||
struct st_my_thread_var *tmp= my_thread_var;
|
||||
info->thread= tmp->pthread_self;
|
||||
info->thread_id= tmp->id;
|
||||
info->n_cursors= 0;
|
||||
}
|
||||
|
||||
|
@ -622,8 +623,10 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_OWNER *owner,
|
|||
statistic_increment(locks_immediate,&THR_LOCK_lock);
|
||||
goto end;
|
||||
}
|
||||
/* purecov: begin inspected */
|
||||
DBUG_PRINT("lock",("write locked by thread: 0x%lx",
|
||||
lock->write.data->owner->info->thread_id));
|
||||
/* purecov: end */
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -658,7 +661,7 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_OWNER *owner,
|
|||
goto end;
|
||||
}
|
||||
}
|
||||
DBUG_PRINT("lock",("write locked by thread: 0x%lx, type: %d",
|
||||
DBUG_PRINT("lock",("write locked by thread: 0x%lx type: %d",
|
||||
lock->read.data->owner->info->thread_id, data->type));
|
||||
}
|
||||
wait_queue= &lock->write_wait;
|
||||
|
@ -720,8 +723,10 @@ static inline void free_all_read_locks(THR_LOCK *lock,
|
|||
}
|
||||
lock->read_no_write_count++;
|
||||
}
|
||||
/* purecov: begin inspected */
|
||||
DBUG_PRINT("lock",("giving read lock to thread: 0x%lx",
|
||||
data->owner->info->thread_id));
|
||||
/* purecov: end */
|
||||
data->cond=0; /* Mark thread free */
|
||||
VOID(pthread_cond_signal(cond));
|
||||
} while ((data=data->next));
|
||||
|
@ -806,8 +811,10 @@ void thr_unlock(THR_LOCK_DATA *data)
|
|||
if (data->type == TL_WRITE_CONCURRENT_INSERT &&
|
||||
(*lock->check_status)(data->status_param))
|
||||
data->type=TL_WRITE; /* Upgrade lock */
|
||||
/* purecov: begin inspected */
|
||||
DBUG_PRINT("lock",("giving write lock of type %d to thread: 0x%lx",
|
||||
data->type, data->owner->info->thread_id));
|
||||
/* purecov: end */
|
||||
{
|
||||
pthread_cond_t *cond=data->cond;
|
||||
data->cond=0; /* Mark thread free */
|
||||
|
@ -1006,7 +1013,7 @@ void thr_multi_unlock(THR_LOCK_DATA **data,uint count)
|
|||
thr_unlock(*pos);
|
||||
else
|
||||
{
|
||||
DBUG_PRINT("lock",("Free lock: data: 0x%lx thread: %ld lock: 0x%lx",
|
||||
DBUG_PRINT("lock",("Free lock: data: 0x%lx thread: 0x%lx lock: 0x%lx",
|
||||
(long) *pos, (*pos)->owner->info->thread_id,
|
||||
(long) (*pos)->lock));
|
||||
}
|
||||
|
@ -1054,7 +1061,7 @@ void thr_abort_locks(THR_LOCK *lock, bool upgrade_lock)
|
|||
This is used to abort all locks for a specific thread
|
||||
*/
|
||||
|
||||
my_bool thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread)
|
||||
my_bool thr_abort_locks_for_thread(THR_LOCK *lock, my_thread_id thread_id)
|
||||
{
|
||||
THR_LOCK_DATA *data;
|
||||
my_bool found= FALSE;
|
||||
|
@ -1063,7 +1070,7 @@ my_bool thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread)
|
|||
pthread_mutex_lock(&lock->mutex);
|
||||
for (data= lock->read_wait.data; data ; data= data->next)
|
||||
{
|
||||
if (pthread_equal(thread, data->owner->info->thread))
|
||||
if (data->owner->info->thread_id == thread_id) /* purecov: tested */
|
||||
{
|
||||
DBUG_PRINT("info",("Aborting read-wait lock"));
|
||||
data->type= TL_UNLOCK; /* Mark killed */
|
||||
|
@ -1080,7 +1087,7 @@ my_bool thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread)
|
|||
}
|
||||
for (data= lock->write_wait.data; data ; data= data->next)
|
||||
{
|
||||
if (pthread_equal(thread, data->owner->info->thread))
|
||||
if (data->owner->info->thread_id == thread_id) /* purecov: tested */
|
||||
{
|
||||
DBUG_PRINT("info",("Aborting write-wait lock"));
|
||||
data->type= TL_UNLOCK;
|
||||
|
@ -1133,7 +1140,9 @@ void thr_downgrade_write_lock(THR_LOCK_DATA *in_data,
|
|||
enum thr_lock_type new_lock_type)
|
||||
{
|
||||
THR_LOCK *lock=in_data->lock;
|
||||
#ifndef DBUG_OFF
|
||||
enum thr_lock_type old_lock_type= in_data->type;
|
||||
#endif
|
||||
#ifdef TO_BE_REMOVED
|
||||
THR_LOCK_DATA *data, *next;
|
||||
bool start_writers= FALSE;
|
||||
|
@ -1528,6 +1537,10 @@ static void test_get_status(void* param __attribute__((unused)),
|
|||
{
|
||||
}
|
||||
|
||||
static void test_update_status(void* param __attribute__((unused)))
|
||||
{
|
||||
}
|
||||
|
||||
static void test_copy_status(void* to __attribute__((unused)) ,
|
||||
void *from __attribute__((unused)))
|
||||
{
|
||||
|
@ -1620,7 +1633,7 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
|
|||
{
|
||||
thr_lock_init(locks+i);
|
||||
locks[i].check_status= test_check_status;
|
||||
locks[i].update_status=test_get_status;
|
||||
locks[i].update_status=test_update_status;
|
||||
locks[i].copy_status= test_copy_status;
|
||||
locks[i].get_status= test_get_status;
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp, const char *file,
|
|||
{
|
||||
fprintf(stderr,
|
||||
"safe_mutex: Count was %d in thread 0x%lx when locking mutex at %s, line %d\n",
|
||||
mp->count-1, my_thread_id(), file, line);
|
||||
mp->count-1, my_thread_dbug_id(), file, line);
|
||||
fflush(stderr);
|
||||
abort();
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
|
|||
{
|
||||
fprintf(stderr,
|
||||
"safe_mutex: Count was %d in thread 0x%lx when locking mutex at %s, line %d (error: %d (%d))\n",
|
||||
mp->count-1, my_thread_id(), file, line, error, error);
|
||||
mp->count-1, my_thread_dbug_id(), file, line, error, error);
|
||||
fflush(stderr);
|
||||
abort();
|
||||
}
|
||||
|
|
|
@ -212,8 +212,8 @@ void Guardian::process_instance(Instance *instance)
|
|||
return;
|
||||
|
||||
case Instance::CRASHED: /* just regular restarts */
|
||||
if (current_time - instance->last_checked <=
|
||||
Options::Main::monitoring_interval)
|
||||
if ((ulong) (current_time - instance->last_checked) <=
|
||||
(ulong) Options::Main::monitoring_interval)
|
||||
return;
|
||||
|
||||
if (instance->restart_counter < restart_retry)
|
||||
|
|
|
@ -923,7 +923,7 @@ void Instance::remove_pid()
|
|||
|
||||
bool Instance::wait_for_stop()
|
||||
{
|
||||
int start_time= time(NULL);
|
||||
int start_time= (int) time(NULL);
|
||||
int finish_time= start_time + options.get_shutdown_delay();
|
||||
|
||||
log_info("Instance '%s': waiting for mysqld to stop "
|
||||
|
|
|
@ -87,7 +87,7 @@ bool Mysql_connection::init()
|
|||
/* Initialize random number generator */
|
||||
{
|
||||
ulong seed1= (ulong) &rand_st + rand();
|
||||
ulong seed2= (ulong) rand() + time(0);
|
||||
ulong seed2= (ulong) rand() + (ulong) time(0);
|
||||
randominit(&rand_st, seed1, seed2);
|
||||
}
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ static void init_environment(char *progname)
|
|||
MY_INIT(progname);
|
||||
log_init();
|
||||
umask(0117);
|
||||
srand((unsigned int) time(0));
|
||||
srand((uint) time(0));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ require "$pwd/server-cfg" || die "Can't read Configuration file: $!\n";
|
|||
|
||||
$|=1; # Output data immediately
|
||||
|
||||
$opt_skip_test=$opt_skip_create=$opt_skip_delete=$opt_verbose=$opt_fast_insert=$opt_lock_tables=$opt_debug=$opt_skip_delete=$opt_fast=$opt_force=$opt_log=$opt_use_old_results=$opt_help=$opt_odbc=$opt_small_test=$opt_small_tables=$opt_samll_key_tables=$opt_stage=$opt_old_headers=$opt_die_on_errors=$opt_tcpip=$opt_random=0;
|
||||
$opt_skip_test=$opt_skip_create=$opt_skip_delete=$opt_verbose=$opt_fast_insert=$opt_lock_tables=$opt_debug=$opt_skip_delete=$opt_fast=$opt_force=$opt_log=$opt_use_old_results=$opt_help=$opt_odbc=$opt_small_test=$opt_small_tables=$opt_samll_key_tables=$opt_stage=$opt_old_headers=$opt_die_on_errors=$opt_tcpip=$opt_random=$opt_only_missing_tests=0;
|
||||
$opt_cmp=$opt_user=$opt_password=$opt_connect_options="";
|
||||
$opt_server="mysql"; $opt_dir="output";
|
||||
$opt_host="localhost";$opt_database="test";
|
||||
|
@ -59,7 +59,7 @@ $log_prog_args=join(" ", skip_arguments(\@ARGV,"comments","cmp","server",
|
|||
"use-old-results","skip-test",
|
||||
"optimization","hw",
|
||||
"machine", "dir", "suffix", "log"));
|
||||
GetOptions("skip-test=s","comments=s","cmp=s","server=s","user=s","host=s","database=s","password=s","loop-count=i","row-count=i","skip-create","skip-delete","verbose","fast-insert","lock-tables","debug","fast","force","field-count=i","regions=i","groups=i","time-limit=i","log","use-old-results","machine=s","dir=s","suffix=s","help","odbc","small-test","small-tables","small-key-tables","stage=i","threads=i","random","old-headers","die-on-errors","create-options=s","hires","tcpip","silent","optimization=s","hw=s","socket=s","connect-options=s") || usage();
|
||||
GetOptions("skip-test=s","comments=s","cmp=s","server=s","user=s","host=s","database=s","password=s","loop-count=i","row-count=i","skip-create","skip-delete","verbose","fast-insert","lock-tables","debug","fast","force","field-count=i","regions=i","groups=i","time-limit=i","log","use-old-results","machine=s","dir=s","suffix=s","help","odbc","small-test","small-tables","small-key-tables","stage=i","threads=i","random","old-headers","die-on-errors","create-options=s","hires","tcpip","silent","optimization=s","hw=s","socket=s","connect-options=s","only-missing-tests") || usage();
|
||||
|
||||
usage() if ($opt_help);
|
||||
$server=get_server($opt_server,$opt_host,$opt_database,$opt_odbc,
|
||||
|
@ -504,6 +504,13 @@ All benchmarks takes the following options:
|
|||
--odbc
|
||||
Use the ODBC DBI driver to connect to the database.
|
||||
|
||||
--only-missing-tests
|
||||
Only run test that don\'t have an old test result.
|
||||
This is useful when you want to do a re-run of tests that failed in last run.
|
||||
|
||||
--optimization='some comments'
|
||||
Add coments about optimization of DBMS, which was done before the test.
|
||||
|
||||
--password='password'
|
||||
Password for the current user.
|
||||
|
||||
|
@ -576,9 +583,6 @@ All benchmarks takes the following options:
|
|||
This is a test specific option that is only used when debugging a test.
|
||||
Print more information about what is going on.
|
||||
|
||||
--optimization='some comments'
|
||||
Add coments about optimization of DBMS, which was done before the test.
|
||||
|
||||
--hw='some comments'
|
||||
Add coments about hardware used for this test.
|
||||
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
#/bin/sh
|
||||
run-all-tests --prefix=-innodb --hw="AMD Athlon 4000+; 2400 MHz 1M cache, 3G memory" --optimization="gcc 4.0.2 -O3" --comments="Engine=InnoDB" --create-options="ENGINE=InnoDB"
|
||||
|
||||
hw="2xPentium(R) 3.2 GHz, 1M cache, 4G memory"
|
||||
optimization="gcc 4.1.2 -m64 -O3 --static"
|
||||
machine="Linux-x64"
|
||||
|
||||
# InnoDB tests
|
||||
|
||||
./run-all-tests --suffix=-innodb --comments="Engine=InnoDB --innodb_log_file_size=100M" --create-options="ENGINE=InnoDB" --hw="$hw" --optimization="$optimization" --machine="$machine" --log
|
||||
|
||||
./run-all-tests --suffix=_fast-innodb --comments="Engine=InnoDB --innodb_log_file_size=100M" --create-options="ENGINE=InnoDB" --hw="$hw" --optimization="$optimization" --machine="$machine" --fast --log
|
||||
|
||||
|
||||
# MyISAM tests
|
||||
|
||||
./run-all-tests --suffix=-myisam --comments="Engine=MyISAM key_buffer_size=16M" --create-options="ENGINE=myisam" --hw="$hw" --optimization="$optimization" --machine="$machine" --log
|
||||
|
||||
./run-all-tests --suffix=_fast-myisam --comments="Engine=MyISAM key_buffer_size=16M" --create-options="ENGINE=myisam" --hw="$hw" --optimization="$optimization" --machine="$machine" --fast --log
|
||||
|
||||
compare-results --relative output/RUN-mysql-myisam-* output/RUN-mysql_fast-myisam* output/RUN-mysql*
|
||||
|
|
|
@ -114,7 +114,6 @@ print "Server version: $server_version\n";
|
|||
print "Optimization: $opt_optimization\n";
|
||||
print "Hardware: $opt_hw\n\n";
|
||||
|
||||
|
||||
$estimated=$warning=$got_warning=0;
|
||||
while (<test-*>)
|
||||
{
|
||||
|
@ -130,6 +129,11 @@ while (<test-*>)
|
|||
last;
|
||||
}
|
||||
}
|
||||
if ($opt_only_missing_tests && -f "$opt_dir$dir$prog-$filename")
|
||||
{
|
||||
# Test already run, skip it
|
||||
$skip_prog= 1;
|
||||
}
|
||||
print "$prog: ";
|
||||
if ((!$opt_use_old_results) && (!$skip_prog))
|
||||
{
|
||||
|
|
|
@ -998,7 +998,7 @@ for ($i=1 ; $i < $opt_loop_count*3 ; $i+=3)
|
|||
{
|
||||
$sth = $dbh->do("update bench1 set dummy1='updated' where id=$i") or die $DBI::errstr;
|
||||
$end_time=new Benchmark;
|
||||
last if ($estimated=predict_query_time($loop_time,$end_time,\$i,$tests,
|
||||
last if ($estimated=predict_query_time($loop_time,$end_time,\$i,($i-1)/3,
|
||||
$opt_loop_count));
|
||||
}
|
||||
if ($estimated)
|
||||
|
|
|
@ -69,6 +69,7 @@ ADD_EXECUTABLE(mysqld ../sql-common/client.c derror.cc des_key_file.cc
|
|||
sql_tablespace.cc events.cc ../sql-common/my_user.c
|
||||
partition_info.cc rpl_utility.cc rpl_injector.cc sql_locale.cc
|
||||
rpl_rli.cc rpl_mi.cc sql_servers.cc
|
||||
sql_connect.cc scheduler.cc
|
||||
${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
|
||||
${PROJECT_SOURCE_DIR}/sql/sql_yacc.h
|
||||
${PROJECT_SOURCE_DIR}/include/mysqld_error.h
|
||||
|
|
|
@ -64,10 +64,11 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
|
|||
tztime.h my_decimal.h\
|
||||
sp_head.h sp_pcontext.h sp_rcontext.h sp.h sp_cache.h \
|
||||
parse_file.h sql_view.h sql_trigger.h \
|
||||
sql_array.h sql_cursor.h events.h \
|
||||
sql_array.h sql_cursor.h events.h scheduler.h \
|
||||
event_db_repository.h event_queue.h \
|
||||
sql_plugin.h authors.h sql_partition.h event_data_objects.h \
|
||||
partition_info.h partition_element.h event_scheduler.h \
|
||||
sql_plugin.h authors.h \
|
||||
event_data_objects.h event_scheduler.h \
|
||||
sql_partition.h partition_info.h partition_element.h \
|
||||
contributors.h sql_servers.h
|
||||
mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
|
||||
item.cc item_sum.cc item_buff.cc item_func.cc \
|
||||
|
@ -79,7 +80,8 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
|
|||
lock.cc my_lock.c \
|
||||
sql_string.cc sql_manager.cc sql_map.cc \
|
||||
mysqld.cc password.c hash_filo.cc hostname.cc \
|
||||
set_var.cc sql_parse.cc sql_yacc.yy \
|
||||
sql_connect.cc scheduler.cc sql_parse.cc \
|
||||
set_var.cc sql_yacc.yy \
|
||||
sql_base.cc table.cc sql_select.cc sql_insert.cc \
|
||||
sql_prepare.cc sql_error.cc sql_locale.cc \
|
||||
sql_update.cc sql_delete.cc uniques.cc sql_do.cc \
|
||||
|
|
|
@ -104,25 +104,22 @@ evex_print_warnings(THD *thd, Event_job_data *et)
|
|||
SYNOPSIS
|
||||
post_init_event_thread()
|
||||
thd Thread
|
||||
|
||||
NOTES
|
||||
Before this is called, one should not do any DBUG_XXX() calls.
|
||||
|
||||
*/
|
||||
|
||||
bool
|
||||
post_init_event_thread(THD *thd)
|
||||
{
|
||||
my_thread_init();
|
||||
pthread_detach_this_thread();
|
||||
thd->real_id= pthread_self();
|
||||
(void) init_new_connection_handler_thread();
|
||||
if (init_thr_lock() || thd->store_globals())
|
||||
{
|
||||
thd->cleanup();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
|
||||
sigset_t set;
|
||||
VOID(sigemptyset(&set)); // Get mask in use
|
||||
VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
|
||||
#endif
|
||||
pthread_mutex_lock(&LOCK_thread_count);
|
||||
threads.append(thd);
|
||||
thread_count++;
|
||||
|
@ -187,7 +184,7 @@ pre_init_event_thread(THD* thd)
|
|||
thd->options|= OPTION_AUTO_IS_NULL;
|
||||
thd->client_capabilities|= CLIENT_MULTI_RESULTS;
|
||||
pthread_mutex_lock(&LOCK_thread_count);
|
||||
thd->thread_id= thread_id++;
|
||||
thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
|
||||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
|
||||
/*
|
||||
|
@ -218,20 +215,20 @@ pthread_handler_t
|
|||
event_scheduler_thread(void *arg)
|
||||
{
|
||||
/* needs to be first for thread_stack */
|
||||
THD *thd= (THD *)((struct scheduler_param *) arg)->thd;
|
||||
THD *thd= (THD *) ((struct scheduler_param *) arg)->thd;
|
||||
Event_scheduler *scheduler= ((struct scheduler_param *) arg)->scheduler;
|
||||
bool res;
|
||||
|
||||
my_free((char*)arg, MYF(0));
|
||||
|
||||
thd->thread_stack= (char *)&thd; // remember where our stack is
|
||||
thd->thread_stack= (char*) &thd; // remember where our stack is
|
||||
res= post_init_event_thread(thd);
|
||||
|
||||
DBUG_ENTER("event_scheduler_thread");
|
||||
|
||||
if (!post_init_event_thread(thd))
|
||||
my_free((char*)arg, MYF(0));
|
||||
if (!res)
|
||||
scheduler->run(thd);
|
||||
|
||||
deinit_event_thread(thd);
|
||||
|
||||
pthread_exit(0);
|
||||
DBUG_RETURN(0); // Against gcc warnings
|
||||
}
|
||||
|
||||
|
@ -255,13 +252,14 @@ event_worker_thread(void *arg)
|
|||
THD *thd;
|
||||
Event_job_data *event= (Event_job_data *)arg;
|
||||
int ret;
|
||||
bool res;
|
||||
|
||||
thd= event->thd;
|
||||
|
||||
thd->thread_stack= (char *) &thd; // remember where our stack is
|
||||
res= post_init_event_thread(thd);
|
||||
DBUG_ENTER("event_worker_thread");
|
||||
|
||||
if (!post_init_event_thread(thd))
|
||||
if (!res)
|
||||
{
|
||||
DBUG_PRINT("info", ("Baikonur, time is %ld, BURAN reporting and operational."
|
||||
"THD: 0x%lx",
|
||||
|
@ -295,6 +293,7 @@ event_worker_thread(void *arg)
|
|||
|
||||
deinit_event_thread(thd);
|
||||
|
||||
pthread_exit(0);
|
||||
DBUG_RETURN(0); // Can't return anything here
|
||||
}
|
||||
|
||||
|
|
|
@ -825,8 +825,8 @@ public:
|
|||
void sort_string(char *buff,uint length);
|
||||
uint32 pack_length() const { return sizeof(double); }
|
||||
void sql_type(String &str) const;
|
||||
uint size_of() const { return sizeof(*this); }
|
||||
uint32 max_display_length() { return 53; }
|
||||
uint size_of() const { return sizeof(*this); }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -2820,7 +2820,7 @@ int ha_ndbcluster::key_cmp(uint keynr, const byte * old_row,
|
|||
|
||||
int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
|
||||
{
|
||||
THD *thd= current_thd;
|
||||
THD *thd= table->in_use;
|
||||
NdbTransaction *trans= m_active_trans;
|
||||
NdbScanOperation* cursor= m_active_cursor;
|
||||
NdbOperation *op;
|
||||
|
@ -3007,7 +3007,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
|
|||
|
||||
int ha_ndbcluster::delete_row(const byte *record)
|
||||
{
|
||||
THD *thd= current_thd;
|
||||
THD *thd= table->in_use;
|
||||
NdbTransaction *trans= m_active_trans;
|
||||
NdbScanOperation* cursor= m_active_cursor;
|
||||
NdbOperation *op;
|
||||
|
@ -6016,7 +6016,7 @@ void ha_ndbcluster::set_part_info(partition_info *part_info)
|
|||
int ha_ndbcluster::close(void)
|
||||
{
|
||||
DBUG_ENTER("close");
|
||||
THD *thd= current_thd;
|
||||
THD *thd= table->in_use;
|
||||
Ndb *ndb= thd ? check_ndb_in_thd(thd) : g_ndb;
|
||||
/* ndb_share reference handler free */
|
||||
DBUG_PRINT("NDB_SHARE", ("%s handler free use_count: %u",
|
||||
|
|
|
@ -845,7 +845,7 @@ int ha_rollback_trans(THD *thd, bool all)
|
|||
message in the error log, so we don't send it.
|
||||
*/
|
||||
if (is_real_trans && (thd->options & OPTION_STATUS_NO_TRANS_UPDATE) &&
|
||||
!thd->slave_thread)
|
||||
!thd->slave_thread && thd->killed != THD::KILL_CONNECTION)
|
||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_WARNING_NOT_COMPLETE_ROLLBACK,
|
||||
ER(ER_WARNING_NOT_COMPLETE_ROLLBACK));
|
||||
|
@ -2855,8 +2855,8 @@ ha_find_files(THD *thd,const char *db,const char *path,
|
|||
{
|
||||
int error= 0;
|
||||
DBUG_ENTER("ha_find_files");
|
||||
DBUG_PRINT("enter", ("db: %s, path: %s, wild: %s, dir: %d",
|
||||
db, path, wild, dir));
|
||||
DBUG_PRINT("enter", ("db: '%s' path: '%s' wild: '%s' dir: %d",
|
||||
db, path, wild ? wild : "NULL", dir));
|
||||
st_find_files_args args= {db, path, wild, dir, files};
|
||||
|
||||
plugin_foreach(thd, find_files_handlerton,
|
||||
|
|
|
@ -1553,6 +1553,8 @@ bool agg_item_charsets(DTCollation &coll, const char *fname,
|
|||
doesn't display each argument's characteristics.
|
||||
- if nargs is 1, then this error cannot happen.
|
||||
*/
|
||||
LINT_INIT(safe_args[0]);
|
||||
LINT_INIT(safe_args[1]);
|
||||
if (nargs >=2 && nargs <= 3)
|
||||
{
|
||||
safe_args[0]= args[0];
|
||||
|
|
|
@ -903,6 +903,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, Item **ref)
|
|||
|
||||
longlong Item_in_optimizer::val_int()
|
||||
{
|
||||
bool tmp;
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
cache->store(args[0]);
|
||||
|
||||
|
@ -966,7 +967,7 @@ longlong Item_in_optimizer::val_int()
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
bool tmp= args[1]->val_bool_result();
|
||||
tmp= args[1]->val_bool_result();
|
||||
null_value= args[1]->null_value;
|
||||
return tmp;
|
||||
}
|
||||
|
|
|
@ -3087,14 +3087,8 @@ public:
|
|||
int count;
|
||||
bool locked;
|
||||
pthread_cond_t cond;
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
pthread_t thread;
|
||||
void set_thread(THD *thd) { thread= thd->real_id; }
|
||||
#else
|
||||
THD *thread;
|
||||
void set_thread(THD *thd) { thread= thd; }
|
||||
#endif /*EMBEDDED_LIBRARY*/
|
||||
ulong thread_id;
|
||||
my_thread_id thread_id;
|
||||
void set_thread(THD *thd) { thread_id= thd->thread_id; }
|
||||
|
||||
User_level_lock(const char *key_arg,uint length, ulong id)
|
||||
:key_length(length),count(1),locked(1), thread_id(id)
|
||||
|
@ -3411,11 +3405,7 @@ longlong Item_func_release_lock::val_int()
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
if (ull->locked && (current_thd == ull->thread))
|
||||
#else
|
||||
if (ull->locked && pthread_equal(pthread_self(),ull->thread))
|
||||
#endif
|
||||
if (ull->locked && current_thd->thread_id == ull->thread_id)
|
||||
{
|
||||
result=1; // Release is ok
|
||||
item_user_lock_release(ull);
|
||||
|
@ -3460,7 +3450,7 @@ longlong Item_func_benchmark::val_int()
|
|||
THD *thd=current_thd;
|
||||
ulong loop_count;
|
||||
|
||||
loop_count= args[0]->val_int();
|
||||
loop_count= (ulong) args[0]->val_int();
|
||||
|
||||
if (args[0]->null_value)
|
||||
{
|
||||
|
|
|
@ -1926,7 +1926,7 @@ String *Item_func_format::val_str(String *str)
|
|||
int diff;
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
|
||||
dec= args[1]->val_int();
|
||||
dec= (int) args[1]->val_int();
|
||||
if (args[1]->null_value)
|
||||
{
|
||||
null_value=1;
|
||||
|
|
|
@ -1587,7 +1587,7 @@ int Item_func_now::save_in_field(Field *to, bool no_conversions)
|
|||
void Item_func_sysdate_local::store_now_in_TIME(TIME *now_time)
|
||||
{
|
||||
THD *thd= current_thd;
|
||||
thd->variables.time_zone->gmt_sec_to_TIME(now_time, time(NULL));
|
||||
thd->variables.time_zone->gmt_sec_to_TIME(now_time, (my_time_t) time(NULL));
|
||||
thd->time_zone_used= 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -485,7 +485,7 @@ bool mysql_lock_abort_for_thread(THD *thd, TABLE *table)
|
|||
for (uint i=0; i < locked->lock_count; i++)
|
||||
{
|
||||
if (thr_abort_locks_for_thread(locked->locks[i]->lock,
|
||||
table->in_use->real_id))
|
||||
table->in_use->thread_id))
|
||||
result= TRUE;
|
||||
}
|
||||
my_free((gptr) locked,MYF(0));
|
||||
|
|
|
@ -267,7 +267,7 @@ bool Log_to_csv_event_handler::open_log_table(uint log_table_type)
|
|||
table->table_name_length= 8;
|
||||
break;
|
||||
default:
|
||||
DBUG_ASSERT(0);
|
||||
assert(0); // Impossible
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1161,7 +1161,7 @@ void LOGGER::deactivate_log_handler(THD *thd, uint log_type)
|
|||
log_thd= table_log_handler->general_log_thd;
|
||||
break;
|
||||
default:
|
||||
DBUG_ASSERT(0);
|
||||
assert(0); // Impossible
|
||||
}
|
||||
|
||||
if (!(*tmp_opt))
|
||||
|
@ -1310,7 +1310,7 @@ void Log_to_csv_event_handler::
|
|||
table= &slow_log;
|
||||
break;
|
||||
default:
|
||||
DBUG_ASSERT(0);
|
||||
assert(0); // Impossible
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3887,7 +3887,7 @@ void MYSQL_BIN_LOG::rotate_and_purge(uint flags)
|
|||
#ifdef HAVE_REPLICATION
|
||||
if (expire_logs_days)
|
||||
{
|
||||
long purge_time= time(0) - expire_logs_days*24*60*60;
|
||||
long purge_time= (long) (time(0) - expire_logs_days*24*60*60);
|
||||
if (purge_time >= 0)
|
||||
purge_logs_before_date(purge_time);
|
||||
}
|
||||
|
|
|
@ -1148,7 +1148,6 @@ void Log_event::print_base64(IO_CACHE* file,
|
|||
{
|
||||
const uchar *ptr= (const uchar *)temp_buf;
|
||||
uint32 size= uint4korr(ptr + EVENT_LEN_OFFSET);
|
||||
|
||||
DBUG_ENTER("Log_event::print_base64");
|
||||
|
||||
size_t const tmp_str_sz= base64_needed_encoded_length((int) size);
|
||||
|
@ -1159,8 +1158,10 @@ void Log_event::print_base64(IO_CACHE* file,
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
int const res= base64_encode(ptr, (size_t) size, tmp_str);
|
||||
DBUG_ASSERT(res == 0);
|
||||
if (base64_encode(ptr, (size_t) size, tmp_str))
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
}
|
||||
|
||||
if (my_b_tell(file) == 0)
|
||||
my_b_printf(file, "\nBINLOG '\n");
|
||||
|
@ -5471,7 +5472,7 @@ int Rows_log_event::do_add_row_data(byte *const row_data,
|
|||
my_ptrdiff_t const new_alloc=
|
||||
block_size * ((cur_size + length) / block_size + block_size - 1);
|
||||
|
||||
byte* const new_buf= (byte*)my_realloc((gptr)m_rows_buf, new_alloc,
|
||||
byte* const new_buf= (byte*)my_realloc((gptr)m_rows_buf, (uint) new_alloc,
|
||||
MYF(MY_ALLOW_ZERO_PTR|MY_WME));
|
||||
if (unlikely(!new_buf))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
@ -6014,7 +6015,7 @@ bool Rows_log_event::write_data_body(IO_CACHE*file)
|
|||
sbuf_end - sbuf) ||
|
||||
my_b_safe_write(file, reinterpret_cast<byte*>(m_cols.bitmap),
|
||||
no_bytes_in_map(&m_cols)) ||
|
||||
my_b_safe_write(file, m_rows_buf, data_size));
|
||||
my_b_safe_write(file, m_rows_buf, (uint) data_size));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -6367,8 +6368,8 @@ bool Table_map_log_event::write_data_body(IO_CACHE *file)
|
|||
DBUG_ASSERT(m_dblen < 128);
|
||||
DBUG_ASSERT(m_tbllen < 128);
|
||||
|
||||
byte const dbuf[]= { m_dblen };
|
||||
byte const tbuf[]= { m_tbllen };
|
||||
byte const dbuf[]= { (byte) m_dblen };
|
||||
byte const tbuf[]= { (byte) m_tbllen };
|
||||
|
||||
char cbuf[sizeof(m_colcnt)];
|
||||
char *const cbuf_end= net_store_length((char*) cbuf, (uint) m_colcnt);
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <queues.h>
|
||||
#include "sql_bitmap.h"
|
||||
#include "sql_array.h"
|
||||
#include "scheduler.h"
|
||||
|
||||
/* TODO convert all these three maps to Bitmap classes */
|
||||
typedef ulonglong table_map; /* Used for table bits in join */
|
||||
|
@ -282,7 +283,6 @@ MY_LOCALE *my_locale_by_number(uint number);
|
|||
#define TEST_MIT_THREAD 4
|
||||
#define TEST_BLOCKING 8
|
||||
#define TEST_KEEP_TMP_TABLES 16
|
||||
#define TEST_NO_THREADS 32 /* For debugging under Linux */
|
||||
#define TEST_READCHECK 64 /* Force use of readcheck */
|
||||
#define TEST_NO_EXTRA 128
|
||||
#define TEST_CORE_ON_SIGNAL 256 /* Give core if signal */
|
||||
|
@ -787,6 +787,23 @@ uint build_table_path(char *buff, size_t bufflen, const char *db,
|
|||
void write_bin_log(THD *thd, bool clear_error,
|
||||
char const *query, ulong query_length);
|
||||
|
||||
/* sql_connect.cc */
|
||||
int check_user(THD *thd, enum enum_server_command command,
|
||||
const char *passwd, uint passwd_len, const char *db,
|
||||
bool check_count);
|
||||
pthread_handler_t handle_one_connection(void *arg);
|
||||
bool init_new_connection_handler_thread();
|
||||
void reset_mqh(LEX_USER *lu, bool get_them);
|
||||
bool check_mqh(THD *thd, uint check_command);
|
||||
void time_out_user_resource_limits(THD *thd, USER_CONN *uc);
|
||||
int check_for_max_user_connections(THD *thd, USER_CONN *uc);
|
||||
void decrease_user_connections(USER_CONN *uc);
|
||||
void thd_init_client_charset(THD *thd, uint cs_number);
|
||||
bool setup_connection_thread_globals(THD *thd);
|
||||
bool login_connection(THD *thd);
|
||||
void prepare_new_connection_state(THD* thd);
|
||||
void end_connection(THD *thd);
|
||||
|
||||
bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent);
|
||||
bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create);
|
||||
bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent);
|
||||
|
@ -822,10 +839,7 @@ bool multi_delete_set_locks_and_link_aux_tables(LEX *lex);
|
|||
void init_max_user_conn(void);
|
||||
void init_update_queries(void);
|
||||
void free_max_user_conn(void);
|
||||
pthread_handler_t handle_one_connection(void *arg);
|
||||
pthread_handler_t handle_bootstrap(void *arg);
|
||||
void end_thread(THD *thd,bool put_in_cache);
|
||||
void flush_thread_cache();
|
||||
bool mysql_execute_command(THD *thd);
|
||||
bool do_command(THD *thd);
|
||||
bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
|
@ -1495,6 +1509,11 @@ File open_binlog(IO_CACHE *log, const char *log_file_name,
|
|||
extern void MYSQLerror(const char*);
|
||||
void refresh_status(THD *thd);
|
||||
my_bool mysql_rm_tmp_tables(void);
|
||||
void handle_connection_in_main_thread(THD *thd);
|
||||
void create_thread_to_handle_connection(THD *thd);
|
||||
void unlink_thd(THD *thd);
|
||||
bool one_thread_per_connection_end(THD *thd, bool put_in_cache);
|
||||
void flush_thread_cache();
|
||||
|
||||
/* item_func.cc */
|
||||
extern bool check_reserved_words(LEX_STRING *name);
|
||||
|
@ -1578,7 +1597,7 @@ extern ulong max_prepared_stmt_count, prepared_stmt_count;
|
|||
extern ulong binlog_cache_size, max_binlog_cache_size, open_files_limit;
|
||||
extern ulong max_binlog_size, max_relay_log_size;
|
||||
extern ulong opt_binlog_rows_event_max_size;
|
||||
extern ulong rpl_recovery_rank, thread_cache_size;
|
||||
extern ulong rpl_recovery_rank, thread_cache_size, thread_pool_size;
|
||||
extern ulong back_log;
|
||||
extern ulong specialflag, current_pid;
|
||||
extern ulong expire_logs_days, sync_binlog_period, sync_binlog_counter;
|
||||
|
@ -1663,6 +1682,9 @@ extern TABLE *unused_tables;
|
|||
extern const char* any_db;
|
||||
extern struct my_option my_long_options[];
|
||||
extern const LEX_STRING view_type;
|
||||
extern scheduler_functions thread_scheduler;
|
||||
extern TYPELIB thread_handling_typelib;
|
||||
extern uint8 uc_update_queries[SQLCOM_END+1];
|
||||
extern uint sql_command_flags[];
|
||||
extern TYPELIB log_output_typelib;
|
||||
|
||||
|
|
325
sql/mysqld.cc
325
sql/mysqld.cc
|
@ -59,10 +59,6 @@
|
|||
|
||||
#define mysqld_charset &my_charset_latin1
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
#define ONE_THREAD
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_purify
|
||||
#define IF_PURIFY(A,B) (A)
|
||||
#else
|
||||
|
@ -282,6 +278,16 @@ static TYPELIB tc_heuristic_recover_typelib=
|
|||
array_elements(tc_heuristic_recover_names)-1,"",
|
||||
tc_heuristic_recover_names, NULL
|
||||
};
|
||||
|
||||
static const char *thread_handling_names[]=
|
||||
{ "one-thread-per-connection", "no-threads", "pool-of-threads", NullS};
|
||||
|
||||
TYPELIB thread_handling_typelib=
|
||||
{
|
||||
array_elements(thread_handling_names) - 1, "",
|
||||
thread_handling_names, NULL
|
||||
};
|
||||
|
||||
const char *first_keyword= "first", *binary_keyword= "BINARY";
|
||||
const char *my_localhost= "localhost", *delayed_user= "DELAYED";
|
||||
#if SIZEOF_OFF_T > 4 && defined(BIG_TABLES)
|
||||
|
@ -467,7 +473,8 @@ ulong thread_stack, what_to_log;
|
|||
ulong query_buff_size, slow_launch_time, slave_open_temp_tables;
|
||||
ulong open_files_limit, max_binlog_size, max_relay_log_size;
|
||||
ulong slave_net_timeout, slave_trans_retries;
|
||||
ulong thread_cache_size=0, binlog_cache_size=0, max_binlog_cache_size=0;
|
||||
ulong thread_cache_size=0, thread_pool_size= 0;
|
||||
ulong binlog_cache_size=0, max_binlog_cache_size=0;
|
||||
ulong query_cache_size=0;
|
||||
ulong refresh_version, flush_version; /* Increments on each reload */
|
||||
query_id_t global_query_id;
|
||||
|
@ -681,6 +688,8 @@ my_bool opt_enable_shared_memory;
|
|||
HANDLE smem_event_connect_request= 0;
|
||||
#endif
|
||||
|
||||
scheduler_functions thread_scheduler;
|
||||
|
||||
#define SSL_VARS_NOT_STATIC
|
||||
#include "sslopt-vars.h"
|
||||
#ifdef HAVE_OPENSSL
|
||||
|
@ -861,6 +870,7 @@ static void close_connections(void)
|
|||
continue;
|
||||
|
||||
tmp->killed= THD::KILL_CONNECTION;
|
||||
thread_scheduler.post_kill_notification(tmp);
|
||||
if (tmp->mysys_var)
|
||||
{
|
||||
tmp->mysys_var->abort=1;
|
||||
|
@ -1254,6 +1264,7 @@ void clean_up(bool print_message)
|
|||
if (!opt_bootstrap)
|
||||
(void) my_delete(pidfile_name,MYF(0)); // This may not always exist
|
||||
#endif
|
||||
thread_scheduler.end();
|
||||
finish_client_errs();
|
||||
my_free((gptr) my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST),
|
||||
MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
|
||||
|
@ -1513,6 +1524,9 @@ static void network_init(void)
|
|||
DBUG_ENTER("network_init");
|
||||
LINT_INIT(ret);
|
||||
|
||||
if (thread_scheduler.init())
|
||||
unireg_abort(1); /* purecov: inspected */
|
||||
|
||||
set_ports();
|
||||
|
||||
if (mysqld_port != 0 && !opt_disable_networking && !opt_bootstrap)
|
||||
|
@ -1731,21 +1745,55 @@ extern "C" sig_handler end_thread_signal(int sig __attribute__((unused)))
|
|||
if (thd && ! thd->bootstrap)
|
||||
{
|
||||
statistic_increment(killed_threads, &LOCK_status);
|
||||
end_thread(thd,0);
|
||||
thread_scheduler.end_thread(thd,0); /* purecov: inspected */
|
||||
}
|
||||
DBUG_VOID_RETURN; /* purecov: deadcode */
|
||||
}
|
||||
|
||||
|
||||
void end_thread(THD *thd, bool put_in_cache)
|
||||
/*
|
||||
Unlink thd from global list of available connections and free thd
|
||||
|
||||
SYNOPSIS
|
||||
unlink_thd()
|
||||
thd Thread handler
|
||||
|
||||
NOTES
|
||||
LOCK_thread_count is locked and left locked
|
||||
*/
|
||||
|
||||
void unlink_thd(THD *thd)
|
||||
{
|
||||
DBUG_ENTER("end_thread");
|
||||
DBUG_ENTER("unlink_thd");
|
||||
DBUG_PRINT("enter", ("thd: 0x%lx", (long) thd));
|
||||
thd->cleanup();
|
||||
(void) pthread_mutex_lock(&LOCK_thread_count);
|
||||
thread_count--;
|
||||
delete thd;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
if (put_in_cache && cached_thread_count < thread_cache_size &&
|
||||
|
||||
/*
|
||||
Store thread in cache for reuse by new connections
|
||||
|
||||
SYNOPSIS
|
||||
cache_thread()
|
||||
|
||||
NOTES
|
||||
LOCK_thread_count has to be locked
|
||||
|
||||
RETURN
|
||||
0 Thread was not put in cache
|
||||
1 Thread is to be reused by new connection.
|
||||
(ie, caller should return, not abort with pthread_exit())
|
||||
*/
|
||||
|
||||
|
||||
static bool cache_thread()
|
||||
{
|
||||
safe_mutex_assert_owner(&LOCK_thread_count);
|
||||
if (cached_thread_count < thread_cache_size &&
|
||||
! abort_loop && !kill_cached_threads)
|
||||
{
|
||||
/* Don't kill the thread, just put it in cache for reuse */
|
||||
|
@ -1758,31 +1806,56 @@ void end_thread(THD *thd, bool put_in_cache)
|
|||
pthread_cond_signal(&COND_flush_thread_cache);
|
||||
if (wake_thread)
|
||||
{
|
||||
THD *thd;
|
||||
wake_thread--;
|
||||
thd=thread_cache.get();
|
||||
thd->real_id=pthread_self();
|
||||
thd= thread_cache.get();
|
||||
thd->thread_stack= (char*) &thd; // For store_globals
|
||||
(void) thd->store_globals();
|
||||
thd->thr_create_time= time(NULL);
|
||||
threads.append(thd);
|
||||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
DBUG_VOID_RETURN;
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
End thread for the current connection
|
||||
|
||||
SYNOPSIS
|
||||
one_thread_per_connection_end()
|
||||
thd Thread handler
|
||||
put_in_cache Store thread in cache, if there is room in it
|
||||
Normally this is true in all cases except when we got
|
||||
out of resources initializing the current thread
|
||||
|
||||
NOTES
|
||||
If thread is cached, we will wait until thread is scheduled to be
|
||||
reused and then we will return.
|
||||
If thread is not cached, we end the thread.
|
||||
|
||||
RETURN
|
||||
0 Signal to handle_one_connection to reuse connection
|
||||
*/
|
||||
|
||||
bool one_thread_per_connection_end(THD *thd, bool put_in_cache)
|
||||
{
|
||||
DBUG_ENTER("one_thread_per_connection_end");
|
||||
unlink_thd(thd);
|
||||
if (put_in_cache)
|
||||
put_in_cache= cache_thread();
|
||||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
if (put_in_cache)
|
||||
DBUG_RETURN(0); // Thread is reused
|
||||
|
||||
/* Tell main we are ready */
|
||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
||||
/* It's safe to broadcast outside a lock (COND... is not deleted here) */
|
||||
DBUG_PRINT("signal", ("Broadcasting COND_thread_count"));
|
||||
(void) pthread_cond_broadcast(&COND_thread_count);
|
||||
#ifdef ONE_THREAD
|
||||
if (!(test_flags & TEST_NO_THREADS)) // For debugging under Linux
|
||||
#endif
|
||||
{
|
||||
my_thread_end();
|
||||
pthread_exit(0);
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
my_thread_end();
|
||||
pthread_exit(0);
|
||||
DBUG_RETURN(0); // Impossible
|
||||
}
|
||||
|
||||
|
||||
|
@ -2123,14 +2196,15 @@ and this may fail.\n\n");
|
|||
(ulong) dflt_key_cache->key_cache_mem_size);
|
||||
fprintf(stderr, "read_buffer_size=%ld\n", (long) global_system_variables.read_buff_size);
|
||||
fprintf(stderr, "max_used_connections=%lu\n", max_used_connections);
|
||||
fprintf(stderr, "max_connections=%lu\n", max_connections);
|
||||
fprintf(stderr, "max_threads=%u\n", thread_scheduler.max_threads);
|
||||
fprintf(stderr, "threads_connected=%u\n", thread_count);
|
||||
fprintf(stderr, "It is possible that mysqld could use up to \n\
|
||||
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = %lu K\n\
|
||||
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = %lu K\n\
|
||||
bytes of memory\n", ((ulong) dflt_key_cache->key_cache_mem_size +
|
||||
(global_system_variables.read_buff_size +
|
||||
global_system_variables.sortbuff_size) *
|
||||
max_connections)/ 1024);
|
||||
thread_scheduler.max_threads +
|
||||
max_connections * sizeof(THD)) / 1024);
|
||||
fprintf(stderr, "Hope that's ok; if not, decrease some variables in the equation.\n\n");
|
||||
|
||||
#if defined(HAVE_LINUXTHREADS)
|
||||
|
@ -2331,7 +2405,7 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
|
|||
This should actually be '+ max_number_of_slaves' instead of +10,
|
||||
but the +10 should be quite safe.
|
||||
*/
|
||||
init_thr_alarm(max_connections +
|
||||
init_thr_alarm(thread_scheduler.max_threads +
|
||||
global_system_variables.max_insert_delayed_threads + 10);
|
||||
#if SIGINT != THR_KILL_SIGNAL
|
||||
if (test_flags & TEST_SIGINT)
|
||||
|
@ -2535,18 +2609,6 @@ static void my_str_free_mysqld(void *ptr)
|
|||
|
||||
#ifdef __WIN__
|
||||
|
||||
struct utsname
|
||||
{
|
||||
char nodename[FN_REFLEN];
|
||||
};
|
||||
|
||||
|
||||
int uname(struct utsname *a)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
pthread_handler_t handle_shutdown(void *arg)
|
||||
{
|
||||
MSG msg;
|
||||
|
@ -3357,7 +3419,7 @@ server.");
|
|||
#ifdef HAVE_REPLICATION
|
||||
if (opt_bin_log && expire_logs_days)
|
||||
{
|
||||
long purge_time= time(0) - expire_logs_days*24*60*60;
|
||||
long purge_time= (long) (time(0) - expire_logs_days*24*60*60);
|
||||
if (purge_time >= 0)
|
||||
mysql_bin_log.purge_logs_before_date(purge_time);
|
||||
}
|
||||
|
@ -4009,7 +4071,7 @@ static void bootstrap(FILE *file)
|
|||
my_net_init(&thd->net,(st_vio*) 0);
|
||||
thd->max_client_packet_length= thd->net.max_packet;
|
||||
thd->security_ctx->master_access= ~(ulong)0;
|
||||
thd->thread_id=thread_id++;
|
||||
thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
|
||||
thread_count++;
|
||||
|
||||
bootstrap_file=file;
|
||||
|
@ -4052,6 +4114,74 @@ static bool read_init_file(char *file_name)
|
|||
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
|
||||
/*
|
||||
Simple scheduler that use the main thread to handle the request
|
||||
|
||||
NOTES
|
||||
This is only used for debugging, when starting mysqld with
|
||||
--thread-handling=no-threads or --one-thread
|
||||
|
||||
When we enter this function, LOCK_thread_count is hold!
|
||||
*/
|
||||
|
||||
void handle_connection_in_main_thread(THD *thd)
|
||||
{
|
||||
safe_mutex_assert_owner(&LOCK_thread_count);
|
||||
thread_cache_size=0; // Safety
|
||||
threads.append(thd);
|
||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
||||
handle_one_connection((void*) thd);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Scheduler that uses one thread per connection
|
||||
*/
|
||||
|
||||
void create_thread_to_handle_connection(THD *thd)
|
||||
{
|
||||
if (cached_thread_count > wake_thread)
|
||||
{
|
||||
/* Get thread from cache */
|
||||
thread_cache.append(thd);
|
||||
wake_thread++;
|
||||
pthread_cond_signal(&COND_thread_cache);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Create new thread to handle connection */
|
||||
int error;
|
||||
thread_created++;
|
||||
threads.append(thd);
|
||||
DBUG_PRINT("info",(("creating thread %lu"), thd->thread_id));
|
||||
thd->connect_time = time(NULL);
|
||||
if ((error=pthread_create(&thd->real_id,&connection_attrib,
|
||||
handle_one_connection,
|
||||
(void*) thd)))
|
||||
{
|
||||
/* purify: begin inspected */
|
||||
DBUG_PRINT("error",
|
||||
("Can't create thread to handle request (error %d)",
|
||||
error));
|
||||
thread_count--;
|
||||
thd->killed= THD::KILL_CONNECTION; // Safety
|
||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
||||
statistic_increment(aborted_connects,&LOCK_status);
|
||||
net_printf_error(thd, ER_CANT_CREATE_THREAD, error);
|
||||
(void) pthread_mutex_lock(&LOCK_thread_count);
|
||||
close_connection(thd,0,0);
|
||||
delete thd;
|
||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
||||
return;
|
||||
/* purecov: end */
|
||||
}
|
||||
}
|
||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
||||
DBUG_PRINT("info",("Thread created"));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Create new thread to handle incoming connection.
|
||||
|
||||
|
@ -4088,64 +4218,15 @@ static void create_new_thread(THD *thd)
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
pthread_mutex_lock(&LOCK_thread_count);
|
||||
thd->thread_id=thread_id++;
|
||||
|
||||
thd->real_id=pthread_self(); // Keep purify happy
|
||||
thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
|
||||
|
||||
/* Start a new thread to handle connection */
|
||||
thread_count++;
|
||||
|
||||
#ifdef ONE_THREAD
|
||||
if (test_flags & TEST_NO_THREADS) // For debugging under Linux
|
||||
{
|
||||
thread_cache_size=0; // Safety
|
||||
threads.append(thd);
|
||||
thd->real_id=pthread_self();
|
||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
||||
handle_one_connection((void*) thd);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (thread_count-delayed_insert_threads > max_used_connections)
|
||||
max_used_connections=thread_count-delayed_insert_threads;
|
||||
if (thread_count - delayed_insert_threads > max_used_connections)
|
||||
max_used_connections= thread_count - delayed_insert_threads;
|
||||
|
||||
if (cached_thread_count > wake_thread)
|
||||
{
|
||||
thread_cache.append(thd);
|
||||
wake_thread++;
|
||||
pthread_cond_signal(&COND_thread_cache);
|
||||
}
|
||||
else
|
||||
{
|
||||
int error;
|
||||
thread_created++;
|
||||
threads.append(thd);
|
||||
DBUG_PRINT("info",(("creating thread %lu"), thd->thread_id));
|
||||
thd->connect_time = time(NULL);
|
||||
if ((error=pthread_create(&thd->real_id,&connection_attrib,
|
||||
handle_one_connection,
|
||||
(void*) thd)))
|
||||
{
|
||||
DBUG_PRINT("error",
|
||||
("Can't create thread to handle request (error %d)",
|
||||
error));
|
||||
thread_count--;
|
||||
thd->killed= THD::KILL_CONNECTION; // Safety
|
||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
||||
statistic_increment(aborted_connects,&LOCK_status);
|
||||
net_printf_error(thd, ER_CANT_CREATE_THREAD, error);
|
||||
(void) pthread_mutex_lock(&LOCK_thread_count);
|
||||
close_connection(thd,0,0);
|
||||
delete thd;
|
||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
}
|
||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
||||
|
||||
}
|
||||
DBUG_PRINT("info",("Thread created"));
|
||||
thread_scheduler.add_connection(thd);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
#endif /* EMBEDDED_LIBRARY */
|
||||
|
@ -4895,6 +4976,7 @@ enum options_mysqld
|
|||
OPT_GENERAL_LOG,
|
||||
OPT_SLOW_LOG,
|
||||
OPT_MERGE,
|
||||
OPT_THREAD_HANDLING,
|
||||
OPT_INNODB_ROLLBACK_ON_TIMEOUT
|
||||
};
|
||||
|
||||
|
@ -5502,11 +5584,9 @@ Disable with --skip-ndbcluster (will save memory).",
|
|||
(gptr*) &global_system_variables.old_passwords,
|
||||
(gptr*) &max_system_variables.old_passwords, 0, GET_BOOL, NO_ARG,
|
||||
0, 0, 0, 0, 0, 0},
|
||||
#ifdef ONE_THREAD
|
||||
{"one-thread", OPT_ONE_THREAD,
|
||||
"Only use one thread (for debugging under Linux).", 0, 0, 0, GET_NO_ARG,
|
||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
"(deprecated): Only use one thread (for debugging under Linux). Use thread-handling=no-threads instead",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"old-style-user-limits", OPT_OLD_STYLE_USER_LIMITS,
|
||||
"Enable old-style user limits (before 5.0.3 user resources were counted per each user+host vs. per account)",
|
||||
(gptr*) &opt_old_style_user_limits, (gptr*) &opt_old_style_user_limits,
|
||||
|
@ -5985,7 +6065,7 @@ The minimum value for this variable is 4096.",
|
|||
// children, to avoid "too many connections" error in a common setup
|
||||
{"max_connections", OPT_MAX_CONNECTIONS,
|
||||
"The number of simultaneous clients allowed.", (gptr*) &max_connections,
|
||||
(gptr*) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 151, 1, 16384, 0, 1,
|
||||
(gptr*) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 151, 1, 100000, 0, 1,
|
||||
0},
|
||||
{"max_delayed_threads", OPT_MAX_DELAYED_THREADS,
|
||||
"Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero, which means INSERT DELAYED is not used.",
|
||||
|
@ -6276,6 +6356,12 @@ The minimum value for this variable is 4096.",
|
|||
"Permits the application to give the threads system a hint for the desired number of threads that should be run at the same time.",
|
||||
(gptr*) &concurrency, (gptr*) &concurrency, 0, GET_ULONG, REQUIRED_ARG,
|
||||
DEFAULT_CONCURRENCY, 1, 512, 0, 1, 0},
|
||||
#if HAVE_POOL_OF_THREADS == 1
|
||||
{"thread_pool_size", OPT_THREAD_CACHE_SIZE,
|
||||
"How many threads we should create to handle query requests in case of 'thread_handling=pool-of-threads'",
|
||||
(gptr*) &thread_pool_size, (gptr*) &thread_pool_size, 0, GET_ULONG,
|
||||
REQUIRED_ARG, 20, 1, 16384, 0, 1, 0},
|
||||
#endif
|
||||
{"thread_stack", OPT_THREAD_STACK,
|
||||
"The stack size for each thread.", (gptr*) &thread_stack,
|
||||
(gptr*) &thread_stack, 0, GET_ULONG, REQUIRED_ARG,DEFAULT_THREAD_STACK,
|
||||
|
@ -6300,6 +6386,10 @@ The minimum value for this variable is 4096.",
|
|||
(gptr*) &global_system_variables.trans_prealloc_size,
|
||||
(gptr*) &max_system_variables.trans_prealloc_size, 0, GET_ULONG,
|
||||
REQUIRED_ARG, TRANS_ALLOC_PREALLOC_SIZE, 1024, ~0L, 0, 1024, 0},
|
||||
{"thread_handling", OPT_THREAD_HANDLING,
|
||||
"Define threads usage for handling queries: "
|
||||
"one-thread-per-connection or no-threads", 0, 0,
|
||||
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"updatable_views_with_limit", OPT_UPDATABLE_VIEWS_WITH_LIMIT,
|
||||
"1 = YES = Don't issue an error message (warning only) if a VIEW without presence of a key of the underlying table is used in queries with a LIMIT clause for updating. 0 = NO = Prohibit update of a VIEW, which does not contain a key of the underlying table and the query uses a LIMIT clause (usually get from GUI tools).",
|
||||
(gptr*) &global_system_variables.updatable_views_with_limit,
|
||||
|
@ -7241,7 +7331,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
break;
|
||||
case 'T':
|
||||
test_flags= argument ? (uint) atoi(argument) : 0;
|
||||
test_flags&= ~TEST_NO_THREADS;
|
||||
opt_endinfo=1;
|
||||
break;
|
||||
case (int) OPT_BIG_TABLES:
|
||||
|
@ -7473,11 +7562,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
opt_skip_show_db=1;
|
||||
opt_specialflag|=SPECIAL_SKIP_SHOW_DB;
|
||||
break;
|
||||
#ifdef ONE_THREAD
|
||||
case (int) OPT_ONE_THREAD:
|
||||
test_flags |= TEST_NO_THREADS;
|
||||
#endif
|
||||
break;
|
||||
case (int) OPT_WANT_CORE:
|
||||
test_flags |= TEST_CORE_ON_SIGNAL;
|
||||
break;
|
||||
|
@ -7723,6 +7807,23 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
sql_mode);
|
||||
break;
|
||||
}
|
||||
case OPT_ONE_THREAD:
|
||||
global_system_variables.thread_handling= 2;
|
||||
break;
|
||||
case OPT_THREAD_HANDLING:
|
||||
{
|
||||
if ((global_system_variables.thread_handling=
|
||||
find_type(argument, &thread_handling_typelib, 2)) <= 0 ||
|
||||
(global_system_variables.thread_handling == SCHEDULER_POOL_OF_THREADS
|
||||
&& !HAVE_POOL_OF_THREADS))
|
||||
{
|
||||
/* purecov: begin tested */
|
||||
fprintf(stderr,"Unknown/unsupported thread-handling: %s\n",argument);
|
||||
exit(1);
|
||||
/* purecov: end */
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OPT_FT_BOOLEAN_SYNTAX:
|
||||
if (ft_boolean_check_syntax_string((byte*) argument))
|
||||
{
|
||||
|
@ -7843,6 +7944,7 @@ static void get_options(int argc,char **argv)
|
|||
if (mysqld_chroot)
|
||||
set_root(mysqld_chroot);
|
||||
#else
|
||||
global_system_variables.thread_handling = SCHEDULER_NO_THREADS;
|
||||
max_allowed_packet= global_system_variables.max_allowed_packet;
|
||||
net_buffer_length= global_system_variables.net_buffer_length;
|
||||
#endif
|
||||
|
@ -7873,6 +7975,17 @@ static void get_options(int argc,char **argv)
|
|||
&global_system_variables.datetime_format))
|
||||
exit(1);
|
||||
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
one_thread_scheduler(&thread_scheduler);
|
||||
#else
|
||||
if (global_system_variables.thread_handling <=
|
||||
SCHEDULER_ONE_THREAD_PER_CONNECTION)
|
||||
one_thread_per_connection_scheduler(&thread_scheduler);
|
||||
else if (global_system_variables.thread_handling == SCHEDULER_NO_THREADS)
|
||||
one_thread_scheduler(&thread_scheduler);
|
||||
else
|
||||
pool_of_threads_scheduler(&thread_scheduler); /* purecov: tested */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -8213,5 +8326,3 @@ template class I_List<NAMED_LIST>;
|
|||
template class I_List<Statement>;
|
||||
template class I_List_iterator<Statement>;
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
***************
|
||||
*** 5316,5322 ****
|
||||
(gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"merge", OPT_MERGE, "Enable Merge storage engine. Disable with \
|
||||
--skip-merge.",
|
||||
! (gptr*) &opt_merge, (gptr*) &opt_merge, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0},
|
||||
{"myisam-recover", OPT_MYISAM_RECOVER,
|
||||
"Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.",
|
||||
(gptr*) &myisam_recover_options_str, (gptr*) &myisam_recover_options_str, 0,
|
||||
--- 5336,5342 ----
|
||||
(gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"merge", OPT_MERGE, "Enable Merge storage engine. Disable with \
|
||||
--skip-merge.",
|
||||
! (gptr*) &opt_merge, (gptr*) &opt_merge, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
|
||||
{"myisam-recover", OPT_MYISAM_RECOVER,
|
||||
"Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.",
|
||||
(gptr*) &myisam_recover_options_str, (gptr*) &myisam_recover_options_str, 0,
|
|
@ -228,7 +228,7 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
|
|||
|
||||
if (dir)
|
||||
{
|
||||
fn_format(path, file_name->str, dir->str, 0, MY_UNPACK_FILENAME);
|
||||
fn_format(path, file_name->str, dir->str, "", MY_UNPACK_FILENAME);
|
||||
path_end= strlen(path);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -73,23 +73,19 @@ static int init_failsafe_rpl_thread(THD* thd)
|
|||
thd->net.read_timeout = slave_net_timeout;
|
||||
thd->max_client_packet_length=thd->net.max_packet;
|
||||
pthread_mutex_lock(&LOCK_thread_count);
|
||||
thd->thread_id = thread_id++;
|
||||
thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
|
||||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
|
||||
if (init_thr_lock() || thd->store_globals())
|
||||
{
|
||||
/* purecov: begin inspected */
|
||||
close_connection(thd, ER_OUT_OF_RESOURCES, 1); // is this needed?
|
||||
statistic_increment(aborted_connects,&LOCK_status);
|
||||
end_thread(thd,0);
|
||||
one_thread_per_connection_end(thd,0);
|
||||
DBUG_RETURN(-1);
|
||||
/* purecov: end */
|
||||
}
|
||||
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
sigset_t set;
|
||||
VOID(sigemptyset(&set)); // Get mask in use
|
||||
VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
|
||||
#endif
|
||||
|
||||
thd->mem_root->free= thd->mem_root->used= 0;
|
||||
if (thd->variables.max_join_size == HA_POS_ERROR)
|
||||
thd->options|= OPTION_BIG_SELECTS;
|
||||
|
|
88
sql/scheduler.cc
Normal file
88
sql/scheduler.cc
Normal file
|
@ -0,0 +1,88 @@
|
|||
/* Copyright (C) 2007 MySQL AB
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/*
|
||||
Implementation for the thread scheduler
|
||||
*/
|
||||
|
||||
#ifdef USE_PRAGMA_INTERFACE
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include <mysql_priv.h>
|
||||
|
||||
/*
|
||||
'Dummy' functions to be used when we don't need any handling for a scheduler
|
||||
event
|
||||
*/
|
||||
|
||||
static bool init_dummy(void) {return 0;}
|
||||
static void post_kill_dummy(THD* thd) {}
|
||||
static void end_dummy(void) {}
|
||||
static bool end_thread_dummy(THD *thd, bool cache_thread) { return 0; }
|
||||
|
||||
/*
|
||||
Initialize default scheduler with dummy functions so that setup functions
|
||||
only need to declare those that are relvant for their usage
|
||||
*/
|
||||
|
||||
scheduler_functions::scheduler_functions()
|
||||
:init(init_dummy),
|
||||
init_new_connection_thread(init_new_connection_handler_thread),
|
||||
add_connection(0), // Must be defined
|
||||
post_kill_notification(post_kill_dummy),
|
||||
end_thread(end_thread_dummy), end(end_dummy)
|
||||
{}
|
||||
|
||||
|
||||
/*
|
||||
End connection, in case when we are using 'no-threads'
|
||||
*/
|
||||
|
||||
static bool no_threads_end(THD *thd, bool put_in_cache)
|
||||
{
|
||||
unlink_thd(thd);
|
||||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
return 1; // Abort handle_one_connection
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Initailize scheduler for --thread-handling=no-threads
|
||||
*/
|
||||
|
||||
void one_thread_scheduler(scheduler_functions* func)
|
||||
{
|
||||
func->max_threads= 1;
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
func->add_connection= handle_connection_in_main_thread;
|
||||
#endif
|
||||
func->init_new_connection_thread= init_dummy;
|
||||
func->end_thread= no_threads_end;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Initialize scheduler for --thread-handling=one-thread-per-connection
|
||||
*/
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
void one_thread_per_connection_scheduler(scheduler_functions* func)
|
||||
{
|
||||
func->max_threads= max_connections;
|
||||
func->add_connection= create_thread_to_handle_connection;
|
||||
func->end_thread= one_thread_per_connection_end;
|
||||
}
|
||||
#endif /* EMBEDDED_LIBRARY */
|
60
sql/scheduler.h
Normal file
60
sql/scheduler.h
Normal file
|
@ -0,0 +1,60 @@
|
|||
/* Copyright (C) 2007 MySQL AB
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/*
|
||||
Classes for the thread scheduler
|
||||
*/
|
||||
|
||||
#ifdef USE_PRAGMA_INTERFACE
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
class THD;
|
||||
|
||||
/* Functions used when manipulating threads */
|
||||
|
||||
class scheduler_functions
|
||||
{
|
||||
public:
|
||||
uint max_threads;
|
||||
bool (*init)(void);
|
||||
bool (*init_new_connection_thread)(void);
|
||||
void (*add_connection)(THD *thd);
|
||||
void (*post_kill_notification)(THD *thd);
|
||||
bool (*end_thread)(THD *thd, bool cache_thread);
|
||||
void (*end)(void);
|
||||
scheduler_functions();
|
||||
};
|
||||
|
||||
enum scheduler_types
|
||||
{
|
||||
SCHEDULER_ONE_THREAD_PER_CONNECTION=1,
|
||||
SCHEDULER_NO_THREADS,
|
||||
SCHEDULER_POOL_OF_THREADS
|
||||
};
|
||||
|
||||
void one_thread_per_connection_scheduler(scheduler_functions* func);
|
||||
void one_thread_scheduler(scheduler_functions* func);
|
||||
|
||||
enum pool_command_op
|
||||
{
|
||||
NOT_IN_USE_OP= 0, NORMAL_OP= 1, CONNECT_OP, KILL_OP, DIE_OP
|
||||
};
|
||||
|
||||
#define HAVE_POOL_OF_THREADS 0 /* For easyer tests */
|
||||
#define pool_of_threads_scheduler(A) one_thread_per_connection_scheduler(A)
|
||||
|
||||
class thd_scheduler
|
||||
{};
|
|
@ -396,6 +396,10 @@ sys_var_thd_ulong sys_trans_alloc_block_size("transaction_alloc_block_size",
|
|||
sys_var_thd_ulong sys_trans_prealloc_size("transaction_prealloc_size",
|
||||
&SV::trans_prealloc_size,
|
||||
0, fix_trans_mem_root);
|
||||
sys_var_thd_enum sys_thread_handling("thread_handling",
|
||||
&SV::thread_handling,
|
||||
&thread_handling_typelib,
|
||||
NULL);
|
||||
|
||||
#ifdef HAVE_QUERY_CACHE
|
||||
sys_var_long_ptr sys_query_cache_limit("query_cache_limit",
|
||||
|
@ -464,6 +468,10 @@ sys_var_long_ptr sys_table_lock_wait_timeout("table_lock_wait_timeout",
|
|||
&table_lock_wait_timeout);
|
||||
sys_var_long_ptr sys_thread_cache_size("thread_cache_size",
|
||||
&thread_cache_size);
|
||||
#if HAVE_POOL_OF_THREADS == 1
|
||||
sys_var_long_ptr sys_thread_pool_size("thread_pool_size",
|
||||
&thread_pool_size);
|
||||
#endif
|
||||
sys_var_thd_enum sys_tx_isolation("tx_isolation",
|
||||
&SV::tx_isolation,
|
||||
&tx_isolation_typelib,
|
||||
|
@ -1006,6 +1014,10 @@ SHOW_VAR init_vars[]= {
|
|||
{sys_thread_cache_size.name,(char*) &sys_thread_cache_size, SHOW_SYS},
|
||||
#ifdef HAVE_THR_SETCONCURRENCY
|
||||
{"thread_concurrency", (char*) &concurrency, SHOW_LONG},
|
||||
#endif
|
||||
{sys_thread_handling.name, (char*) &sys_thread_handling, SHOW_SYS},
|
||||
#if HAVE_POOL_OF_THREADS == 1
|
||||
{sys_thread_pool_size.name, (char*) &sys_thread_pool_size, SHOW_SYS},
|
||||
#endif
|
||||
{"thread_stack", (char*) &thread_stack, SHOW_LONG},
|
||||
{sys_time_format.name, (char*) &sys_time_format, SHOW_SYS},
|
||||
|
@ -2587,7 +2599,7 @@ bool update_sys_var_str_path(THD *thd, sys_var_str *var_str,
|
|||
file_log= logger.get_log_file_handler();
|
||||
break;
|
||||
default:
|
||||
DBUG_ASSERT(0);
|
||||
assert(0); // Impossible
|
||||
}
|
||||
|
||||
if (!old_value)
|
||||
|
@ -3626,7 +3638,7 @@ bool sys_var_thd_table_type::update(THD *thd, set_var *var)
|
|||
*/
|
||||
|
||||
byte *sys_var_thd_sql_mode::symbolic_mode_representation(THD *thd,
|
||||
ulong val,
|
||||
ulonglong val,
|
||||
ulong *len)
|
||||
{
|
||||
char buff[256];
|
||||
|
@ -4002,7 +4014,7 @@ sys_var_event_scheduler::update(THD *thd, set_var *var)
|
|||
res= Events::get_instance()->stop_execution_of_events();
|
||||
else
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
assert(0); // Impossible
|
||||
}
|
||||
if (res)
|
||||
my_error(ER_EVENT_SET_VAR_ERROR, MYF(0));
|
||||
|
|
|
@ -440,7 +440,7 @@ public:
|
|||
}
|
||||
void set_default(THD *thd, enum_var_type type);
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
||||
static byte *symbolic_mode_representation(THD *thd, ulong sql_mode,
|
||||
static byte *symbolic_mode_representation(THD *thd, ulonglong sql_mode,
|
||||
ulong *length);
|
||||
};
|
||||
|
||||
|
|
|
@ -1425,9 +1425,8 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
|
|||
thd->slave_thread = 1;
|
||||
set_slave_thread_options(thd);
|
||||
thd->client_capabilities = CLIENT_LOCAL_FILES;
|
||||
thd->real_id=pthread_self();
|
||||
pthread_mutex_lock(&LOCK_thread_count);
|
||||
thd->thread_id = thread_id++;
|
||||
thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
|
||||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
|
||||
if (init_thr_lock() || thd->store_globals())
|
||||
|
@ -1437,12 +1436,6 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
|
|||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
sigset_t set;
|
||||
VOID(sigemptyset(&set)); // Get mask in use
|
||||
VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
|
||||
#endif
|
||||
|
||||
if (thd_type == SLAVE_THD_SQL)
|
||||
thd->proc_info= "Waiting for the next event in relay log";
|
||||
else
|
||||
|
|
|
@ -5169,6 +5169,8 @@ static int handle_grant_struct(uint struct_no, bool drop,
|
|||
user= grant_name->user;
|
||||
host= grant_name->host.hostname;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
if (! user)
|
||||
user= "";
|
||||
|
|
|
@ -1078,7 +1078,6 @@ void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived)
|
|||
if (!thd->active_transaction())
|
||||
thd->transaction.xid_state.xid.null();
|
||||
|
||||
/* VOID(pthread_sigmask(SIG_SETMASK,&thd->block_signals,NULL)); */
|
||||
if (!lock_in_use)
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
|
||||
|
@ -1208,11 +1207,12 @@ void close_temporary_tables(THD *thd)
|
|||
const char stub[]= "DROP /*!40005 TEMPORARY */ TABLE IF EXISTS ";
|
||||
uint stub_len= sizeof(stub) - 1;
|
||||
char buf[256];
|
||||
memcpy(buf, stub, stub_len);
|
||||
String s_query= String(buf, sizeof(buf), system_charset_info);
|
||||
bool found_user_tables= false;
|
||||
bool found_user_tables= FALSE;
|
||||
LINT_INIT(next);
|
||||
|
||||
memcpy(buf, stub, stub_len);
|
||||
|
||||
/*
|
||||
insertion sort of temp tables by pseudo_thread_id to build ordered list
|
||||
of sublists of equal pseudo_thread_id
|
||||
|
@ -1263,10 +1263,13 @@ void close_temporary_tables(THD *thd)
|
|||
{
|
||||
if (is_user_table(table))
|
||||
{
|
||||
my_thread_id save_pseudo_thread_id= thd->variables.pseudo_thread_id;
|
||||
/* Set pseudo_thread_id to be that of the processed table */
|
||||
thd->variables.pseudo_thread_id= tmpkeyval(thd, table);
|
||||
/* Loop forward through all tables within the sublist of
|
||||
common pseudo_thread_id to create single DROP query */
|
||||
/*
|
||||
Loop forward through all tables within the sublist of
|
||||
common pseudo_thread_id to create single DROP query.
|
||||
*/
|
||||
for (s_query.length(stub_len);
|
||||
table && is_user_table(table) &&
|
||||
tmpkeyval(thd, table) == thd->variables.pseudo_thread_id;
|
||||
|
@ -1292,16 +1295,18 @@ void close_temporary_tables(THD *thd)
|
|||
0, FALSE);
|
||||
thd->variables.character_set_client= cs_save;
|
||||
/*
|
||||
Imagine the thread had created a temp table, then was doing a SELECT, and
|
||||
the SELECT was killed. Then it's not clever to mark the statement above as
|
||||
"killed", because it's not really a statement updating data, and there
|
||||
are 99.99% chances it will succeed on slave.
|
||||
If a real update (one updating a persistent table) was killed on the
|
||||
master, then this real update will be logged with error_code=killed,
|
||||
rightfully causing the slave to stop.
|
||||
Imagine the thread had created a temp table, then was doing a
|
||||
SELECT, and the SELECT was killed. Then it's not clever to
|
||||
mark the statement above as "killed", because it's not really
|
||||
a statement updating data, and there are 99.99% chances it
|
||||
will succeed on slave. If a real update (one updating a
|
||||
persistent table) was killed on the master, then this real
|
||||
update will be logged with error_code=killed, rightfully
|
||||
causing the slave to stop.
|
||||
*/
|
||||
qinfo.error_code= 0;
|
||||
mysql_bin_log.write(&qinfo);
|
||||
thd->variables.pseudo_thread_id= save_pseudo_thread_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1519,9 +1524,15 @@ TABLE *find_temporary_table(THD *thd, TABLE_LIST *table_list)
|
|||
{
|
||||
if (table->s->table_cache_key.length == key_length &&
|
||||
!memcmp(table->s->table_cache_key.str, key, key_length))
|
||||
{
|
||||
DBUG_PRINT("info",
|
||||
("Found table. server_id: %u pseudo_thread_id: %lu",
|
||||
(uint) thd->server_id,
|
||||
(ulong) thd->variables.pseudo_thread_id));
|
||||
DBUG_RETURN(table);
|
||||
}
|
||||
}
|
||||
DBUG_RETURN(0); // Not a temporary table
|
||||
DBUG_RETURN(0); // Not a temporary table
|
||||
}
|
||||
|
||||
|
||||
|
@ -1857,6 +1868,10 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
|||
if (table->query_id == thd->query_id ||
|
||||
thd->prelocked_mode && table->query_id)
|
||||
{
|
||||
DBUG_PRINT("error",
|
||||
("query_id: %lu server_id: %u pseudo_thread_id: %lu",
|
||||
(ulong) table->query_id, (uint) thd->server_id,
|
||||
(ulong) thd->variables.pseudo_thread_id));
|
||||
my_error(ER_CANT_REOPEN_TABLE, MYF(0), table->alias);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
@ -3507,8 +3522,11 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
|
|||
uint key_length;
|
||||
TABLE_LIST table_list;
|
||||
DBUG_ENTER("open_temporary_table");
|
||||
DBUG_PRINT("enter", ("table: '%s'.'%s' path: '%s'",
|
||||
db, table_name, path));
|
||||
DBUG_PRINT("enter",
|
||||
("table: '%s'.'%s' path: '%s' server_id: %u "
|
||||
"pseudo_thread_id: %lu",
|
||||
db, table_name, path,
|
||||
(uint) thd->server_id, (ulong) thd->variables.pseudo_thread_id));
|
||||
|
||||
table_list.db= (char*) db;
|
||||
table_list.table_name= (char*) table_name;
|
||||
|
@ -3795,6 +3813,7 @@ find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name,
|
|||
if (nj_col->view_field)
|
||||
{
|
||||
Item *item;
|
||||
LINT_INIT(arena);
|
||||
if (register_tree_change)
|
||||
arena= thd->activate_stmt_arena_if_needed(&backup);
|
||||
/*
|
||||
|
@ -3978,6 +3997,9 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
|
|||
{
|
||||
Field *fld;
|
||||
DBUG_ENTER("find_field_in_table_ref");
|
||||
DBUG_ASSERT(table_list->alias);
|
||||
DBUG_ASSERT(name);
|
||||
DBUG_ASSERT(item_name);
|
||||
DBUG_PRINT("enter",
|
||||
("table: '%s' field name: '%s' item name: '%s' ref 0x%lx",
|
||||
table_list->alias, name, item_name, (ulong) ref));
|
||||
|
|
|
@ -243,7 +243,7 @@ THD::THD()
|
|||
time_after_lock=(time_t) 0;
|
||||
current_linfo = 0;
|
||||
slave_thread = 0;
|
||||
variables.pseudo_thread_id= 0;
|
||||
thread_id= variables.pseudo_thread_id= 0;
|
||||
one_shot_set= 0;
|
||||
file_id = 0;
|
||||
query_id= 0;
|
||||
|
@ -267,9 +267,6 @@ THD::THD()
|
|||
cleanup_done= abort_on_warning= no_warnings_for_error= 0;
|
||||
peer_port= 0; // For SHOW PROCESSLIST
|
||||
transaction.m_pending_rows_event= 0;
|
||||
#ifdef __WIN__
|
||||
real_id = 0;
|
||||
#endif
|
||||
#ifdef SIGNAL_WITH_VIO_CLOSE
|
||||
active_vio = 0;
|
||||
#endif
|
||||
|
@ -401,6 +398,8 @@ void THD::change_user(void)
|
|||
void THD::cleanup(void)
|
||||
{
|
||||
DBUG_ENTER("THD::cleanup");
|
||||
DBUG_ASSERT(cleanup_done == 0);
|
||||
|
||||
#ifdef ENABLE_WHEN_BINLOG_WILL_BE_ABLE_TO_PREPARE
|
||||
if (transaction.xid_state.xa_state == XA_PREPARED)
|
||||
{
|
||||
|
@ -436,7 +435,6 @@ void THD::cleanup(void)
|
|||
pthread_mutex_lock(&LOCK_user_locks);
|
||||
item_user_lock_release(ull);
|
||||
pthread_mutex_unlock(&LOCK_user_locks);
|
||||
ull= 0;
|
||||
}
|
||||
|
||||
cleanup_done=1;
|
||||
|
@ -550,7 +548,9 @@ void THD::awake(THD::killed_state state_to_set)
|
|||
killed= state_to_set;
|
||||
if (state_to_set != THD::KILL_QUERY)
|
||||
{
|
||||
thr_alarm_kill(real_id);
|
||||
thr_alarm_kill(thread_id);
|
||||
if (!slave_thread)
|
||||
thread_scheduler.post_kill_notification(this);
|
||||
#ifdef SIGNAL_WITH_VIO_CLOSE
|
||||
close_active_vio();
|
||||
#endif
|
||||
|
@ -601,18 +601,19 @@ bool THD::store_globals()
|
|||
Assert that thread_stack is initialized: it's necessary to be able
|
||||
to track stack overrun.
|
||||
*/
|
||||
DBUG_ASSERT(this->thread_stack);
|
||||
DBUG_ASSERT(thread_stack);
|
||||
|
||||
if (my_pthread_setspecific_ptr(THR_THD, this) ||
|
||||
my_pthread_setspecific_ptr(THR_MALLOC, &mem_root))
|
||||
return 1;
|
||||
mysys_var=my_thread_var;
|
||||
dbug_thread_id=my_thread_id();
|
||||
/*
|
||||
By default 'slave_proxy_id' is 'thread_id'. They may later become different
|
||||
if this is the slave SQL thread.
|
||||
Let mysqld define the thread id (not mysys)
|
||||
This allows us to move THD to different threads if needed.
|
||||
*/
|
||||
variables.pseudo_thread_id= thread_id;
|
||||
mysys_var->id= thread_id;
|
||||
real_id= pthread_self(); // For debugging
|
||||
|
||||
/*
|
||||
We have to call thr_lock_info_init() again here as THD may have been
|
||||
created in another thread
|
||||
|
@ -2511,7 +2512,7 @@ my_size_t THD::pack_row(TABLE *table, MY_BITMAP const* cols, byte *row_data,
|
|||
if (bitmap_is_set(cols,i))
|
||||
{
|
||||
my_ptrdiff_t const offset=
|
||||
field->is_null(rec_offset) ? def_offset : rec_offset;
|
||||
field->is_null((uint) rec_offset) ? def_offset : rec_offset;
|
||||
field->move_field_offset(offset);
|
||||
ptr= (byte*)field->pack((char *) ptr, field->ptr);
|
||||
field->move_field_offset(-offset);
|
||||
|
|
|
@ -214,7 +214,7 @@ struct system_variables
|
|||
ulong read_rnd_buff_size;
|
||||
ulong div_precincrement;
|
||||
ulong sortbuff_size;
|
||||
handlerton *table_type;
|
||||
ulong thread_handling;
|
||||
ulong tx_isolation;
|
||||
ulong completion_type;
|
||||
/* Determines which non-standard SQL behaviour should be enabled */
|
||||
|
@ -231,11 +231,15 @@ struct system_variables
|
|||
ulong trans_prealloc_size;
|
||||
ulong log_warnings;
|
||||
ulong group_concat_max_len;
|
||||
ulong ndb_autoincrement_prefetch_sz;
|
||||
ulong ndb_index_stat_cache_entries;
|
||||
ulong ndb_index_stat_update_freq;
|
||||
ulong binlog_format; // binlog format for this thd (see enum_binlog_format)
|
||||
/*
|
||||
In slave thread we need to know in behalf of which
|
||||
thread the query is being run to replicate temp tables properly
|
||||
*/
|
||||
ulong pseudo_thread_id;
|
||||
my_thread_id pseudo_thread_id;
|
||||
|
||||
my_bool low_priority_updates;
|
||||
my_bool new_mode;
|
||||
|
@ -248,14 +252,12 @@ struct system_variables
|
|||
my_bool ndb_use_exact_count;
|
||||
my_bool ndb_use_transactions;
|
||||
my_bool ndb_index_stat_enable;
|
||||
ulong ndb_autoincrement_prefetch_sz;
|
||||
ulong ndb_index_stat_cache_entries;
|
||||
ulong ndb_index_stat_update_freq;
|
||||
ulong binlog_format; // binlog format for this thd (see enum_binlog_format)
|
||||
|
||||
my_bool old_alter_table;
|
||||
my_bool old_passwords;
|
||||
|
||||
handlerton *table_type;
|
||||
|
||||
/* Only charset part of these variables is sensible */
|
||||
CHARSET_INFO *character_set_filesystem;
|
||||
CHARSET_INFO *character_set_client;
|
||||
|
@ -1064,7 +1066,7 @@ public:
|
|||
} transaction;
|
||||
Field *dup_field;
|
||||
#ifndef __WIN__
|
||||
sigset_t signals,block_signals;
|
||||
sigset_t signals;
|
||||
#endif
|
||||
#ifdef SIGNAL_WITH_VIO_CLOSE
|
||||
Vio* active_vio;
|
||||
|
@ -1255,7 +1257,7 @@ public:
|
|||
update auto-updatable fields (like auto_increment and timestamp).
|
||||
*/
|
||||
query_id_t query_id, warn_id;
|
||||
ulong thread_id, col_access;
|
||||
ulong col_access;
|
||||
|
||||
#ifdef ERROR_INJECT_SUPPORT
|
||||
ulong error_inject_value;
|
||||
|
@ -1264,8 +1266,8 @@ public:
|
|||
ulong statement_id_counter;
|
||||
ulong rand_saved_seed1, rand_saved_seed2;
|
||||
ulong row_count; // Row counter, mainly for errors and warnings
|
||||
long dbug_thread_id;
|
||||
pthread_t real_id;
|
||||
pthread_t real_id; /* For debugging */
|
||||
my_thread_id thread_id;
|
||||
uint tmp_table, global_read_lock;
|
||||
uint server_status,open_options;
|
||||
enum enum_thread_type system_thread;
|
||||
|
@ -1629,6 +1631,7 @@ public:
|
|||
*p_db_length= db_length;
|
||||
return FALSE;
|
||||
}
|
||||
thd_scheduler scheduler;
|
||||
};
|
||||
|
||||
|
||||
|
|
1108
sql/sql_connect.cc
Normal file
1108
sql/sql_connect.cc
Normal file
File diff suppressed because it is too large
Load diff
|
@ -396,6 +396,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
|
|||
#ifndef EMBEDDED_LIBRARY
|
||||
if (lock_type == TL_WRITE_DELAYED)
|
||||
{
|
||||
res= 1;
|
||||
if (thd->locked_tables)
|
||||
{
|
||||
DBUG_ASSERT(table_list->db); /* Must be set in the parser */
|
||||
|
@ -1897,7 +1898,7 @@ pthread_handler_t handle_delayed_insert(void *arg)
|
|||
pthread_detach_this_thread();
|
||||
/* Add thread to THD list so that's it's visible in 'show processlist' */
|
||||
pthread_mutex_lock(&LOCK_thread_count);
|
||||
thd->thread_id=thread_id++;
|
||||
thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
|
||||
thd->end_time();
|
||||
threads.append(thd);
|
||||
thd->killed=abort_loop ? THD::KILL_CONNECTION : THD::NOT_KILLED;
|
||||
|
@ -1928,14 +1929,8 @@ pthread_handler_t handle_delayed_insert(void *arg)
|
|||
strmov(thd->net.last_error,ER(thd->net.last_errno=ER_OUT_OF_RESOURCES));
|
||||
goto err;
|
||||
}
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
sigset_t set;
|
||||
VOID(sigemptyset(&set)); // Get mask in use
|
||||
VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
|
||||
#endif
|
||||
|
||||
/* open table */
|
||||
|
||||
if (!(di->table=open_ltable(thd,&di->table_list,TL_WRITE_DELAYED)))
|
||||
{
|
||||
thd->fatal_error(); // Abort waiting inserts
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue