mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Portability fixes
Fixed test suite for HPUX 10.20 and MacOSX Build-tools/Do-compile: Added timeout to mysqladmin shutdown commands Kill old running mysqld started by earlier runs Removed run time warning from LD_LIBRARY_PATH client/mysqladmin.c: Return 1 if pid file isn't deleted on shutdown. Fix error message if pid file is not deleted client/mysqltest.c: Always allow --debug flag (Makes it easier to run mysql-test-run) mysql-test/mysql-test-run.sh: A lot of safety fixes. This fixes some problems with test suite for HPUX 10.20 and MacOSX sql-bench/bench-init.pl.sh: Allow tests to change time limit. sql-bench/crash-me.sh: Indentation cleanups Added DROP for a created table sql-bench/test-alter-table.sh: Added default time limit Changed test to be estimated to get down run time. Fixed that add_multi_col is detected sql-bench/test-insert.sh: Comment cleanup sql/mysql_priv.h: Removed not needed prototype. sql/mysqld.cc: Removed DBUG warnings Removed default argument for clean_up() and made it static. More comments. Ignore SIGHUP during shutdown sql/net_pkg.cc: More comments sql/slave.cc: Added DBUG_PRINT messages
This commit is contained in:
@ -135,6 +135,7 @@ $ENV{'MYSQL_UNIX_PORT'}=$mysql_unix_port="$opt_tmp/mysql$opt_suffix.build";
|
|||||||
$ENV{"PERL5LIB"}="$pwd/$host/perl5:$pwd/$host/perl5/site_perl";
|
$ENV{"PERL5LIB"}="$pwd/$host/perl5:$pwd/$host/perl5/site_perl";
|
||||||
$slave_port=$mysql_tcp_port+16;
|
$slave_port=$mysql_tcp_port+16;
|
||||||
$manager_port=$mysql_tcp_port+1;
|
$manager_port=$mysql_tcp_port+1;
|
||||||
|
$mysqladmin_args="--no-defaults -u root --connect_timeout=5 --shutdown_timeout=20";
|
||||||
|
|
||||||
if ($opt_stage == 0)
|
if ($opt_stage == 0)
|
||||||
{
|
{
|
||||||
@ -154,13 +155,18 @@ log_timestamp();
|
|||||||
|
|
||||||
if (-x "$host/bin/mysqladmin")
|
if (-x "$host/bin/mysqladmin")
|
||||||
{
|
{
|
||||||
log_system("$host/bin/mysqladmin --no-defaults -u root -S $mysql_unix_port -s shutdown");
|
log_system("$host/bin/mysqladmin $mysqladmin_args -S $mysql_unix_port -s shutdown");
|
||||||
log_system("$host/bin/mysqladmin --no-defaults -u root -P $mysql_tcp_port -h $host -s shutdown");
|
log_system("$host/bin/mysqladmin $mysqladmin_args -P $mysql_tcp_port -h $host -s shutdown");
|
||||||
log_system("$host/bin/mysqladmin --no-defaults -u root -P $slave_port -h $host -s shutdown");
|
log_system("$host/bin/mysqladmin $mysqladmin_args -P $slave_port -h $host -s shutdown");
|
||||||
log_system("$host/bin/mysqladmin --no-defaults -u root -P 9306 -h $host -s shutdown");
|
log_system("$host/bin/mysqladmin $mysqladmin_args -P 9306 -h $host -s shutdown");
|
||||||
log_system("$host/bin/mysqladmin --no-defaults -u root -P 9307 -h $host -s shutdown");
|
log_system("$host/bin/mysqladmin $mysqladmin_args -P 9307 -h $host -s shutdown");
|
||||||
}
|
}
|
||||||
kill_all("mysqlmanager");
|
kill_all("mysqlmanager");
|
||||||
|
#
|
||||||
|
# Kill all old processes that are in the build directories
|
||||||
|
# This is to find any old mysqld servers left from previous builds
|
||||||
|
kill_all("$pwd/host/mysql");
|
||||||
|
kill_all("$pwd/host/test");
|
||||||
|
|
||||||
if ($opt_stage == 0)
|
if ($opt_stage == 0)
|
||||||
{
|
{
|
||||||
@ -308,8 +314,9 @@ if ($opt_stage <= 4 && !$opt_no_test)
|
|||||||
$tar_file =~ /(mysql[^\/]*)\.tar/;
|
$tar_file =~ /(mysql[^\/]*)\.tar/;
|
||||||
$ver=$1;
|
$ver=$1;
|
||||||
$test_dir="$pwd/$host/test/$ver";
|
$test_dir="$pwd/$host/test/$ver";
|
||||||
$ENV{"LD_LIBRARY_PATH"}= "$test_dir/lib:" . $ENV{"LD_LIBRARY_PATH"};
|
$ENV{"LD_LIBRARY_PATH"}= ("$test_dir/lib" .
|
||||||
|
(defined($ENV{"LD_LIBRARY_PATH"}) ?
|
||||||
|
":" . $ENV{"LD_LIBRARY_PATH"} : ""));
|
||||||
#
|
#
|
||||||
# Run the test suite
|
# Run the test suite
|
||||||
#
|
#
|
||||||
@ -328,7 +335,7 @@ if (!$opt_no_test && !$opt_no_benchmark)
|
|||||||
{
|
{
|
||||||
my $extra;
|
my $extra;
|
||||||
safe_cd($test_dir);
|
safe_cd($test_dir);
|
||||||
log_system("./bin/mysqladmin --no-defaults -u root -S $mysql_unix_port -s shutdown") || info("There was no mysqld running\n");
|
log_system("./bin/mysqladmin $mysqladmin_args -S $mysql_unix_port -s shutdown") || info("There was no mysqld running\n");
|
||||||
sleep(2);
|
sleep(2);
|
||||||
log_system("rm -f ./data/mysql/*");
|
log_system("rm -f ./data/mysql/*");
|
||||||
check_system("scripts/mysql_install_db --no-defaults --skip-locking","https://order");
|
check_system("scripts/mysql_install_db --no-defaults --skip-locking","https://order");
|
||||||
@ -418,7 +425,7 @@ if ($opt_stage <= 9 && !$opt_no_test && !$opt_no_benchmark)
|
|||||||
rm_all($bench_tmpdir);
|
rm_all($bench_tmpdir);
|
||||||
rm_all("$opt_tmp") if ($new_opt_tmp);
|
rm_all("$opt_tmp") if ($new_opt_tmp);
|
||||||
|
|
||||||
log_system("$pwd/$host/bin/mysqladmin --no-defaults -S $mysql_unix_port -u root shutdown");
|
log_system("$pwd/$host/bin/mysqladmin $mysqladmin_args -S $mysql_unix_port -u root shutdown");
|
||||||
print LOG "ok\n";
|
print LOG "ok\n";
|
||||||
close LOG;
|
close LOG;
|
||||||
print "$host: ok\n";
|
print "$host: ok\n";
|
||||||
@ -429,7 +436,7 @@ exit 0;
|
|||||||
sub usage
|
sub usage
|
||||||
{
|
{
|
||||||
print <<EOF;
|
print <<EOF;
|
||||||
$0 version 1.4
|
$0 version 1.5
|
||||||
|
|
||||||
$0 takes the following options:
|
$0 takes the following options:
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#define ADMIN_VERSION "8.38"
|
#define ADMIN_VERSION "8.39"
|
||||||
#define MAX_MYSQL_VAR 128
|
#define MAX_MYSQL_VAR 128
|
||||||
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
|
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
|
||||||
#define MAX_TRUNC_LENGTH 3
|
#define MAX_TRUNC_LENGTH 3
|
||||||
@ -70,8 +70,8 @@ static void print_relative_header();
|
|||||||
static void print_relative_line();
|
static void print_relative_line();
|
||||||
static void truncate_names();
|
static void truncate_names();
|
||||||
static my_bool get_pidfile(MYSQL *mysql, char *pidfile);
|
static my_bool get_pidfile(MYSQL *mysql, char *pidfile);
|
||||||
static void wait_pidfile(char *pidfile, time_t last_modified,
|
static my_bool wait_pidfile(char *pidfile, time_t last_modified,
|
||||||
struct stat *pidfile_status);
|
struct stat *pidfile_status);
|
||||||
static void store_values(MYSQL_RES *result);
|
static void store_values(MYSQL_RES *result);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -481,7 +481,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
|||||||
printf("Shutdown signal sent to server; Waiting for pid file to disappear\n");
|
printf("Shutdown signal sent to server; Waiting for pid file to disappear\n");
|
||||||
|
|
||||||
/* Wait until pid file is gone */
|
/* Wait until pid file is gone */
|
||||||
wait_pidfile(pidfile, last_modified, &pidfile_status);
|
if (wait_pidfile(pidfile, last_modified, &pidfile_status))
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1110,34 +1111,51 @@ static my_bool get_pidfile(MYSQL *mysql, char *pidfile)
|
|||||||
return 1; /* Error */
|
return 1; /* Error */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Return 1 if pid file didn't disappear or change
|
||||||
|
*/
|
||||||
|
|
||||||
static void wait_pidfile(char *pidfile, time_t last_modified,
|
static my_bool wait_pidfile(char *pidfile, time_t last_modified,
|
||||||
struct stat *pidfile_status)
|
struct stat *pidfile_status)
|
||||||
{
|
{
|
||||||
char buff[FN_REFLEN];
|
char buff[FN_REFLEN];
|
||||||
int fd = -1;
|
int error= 1;
|
||||||
uint count=0;
|
uint count= 0;
|
||||||
|
DBUG_ENTER("wait_pidfile");
|
||||||
|
|
||||||
system_filename(buff, pidfile);
|
system_filename(buff, pidfile);
|
||||||
while (count++ <= opt_shutdown_timeout && !interrupted &&
|
do
|
||||||
(!last_modified || (last_modified == pidfile_status->st_mtime)) &&
|
|
||||||
(fd= my_open(buff, O_RDONLY, MYF(0))) >= 0)
|
|
||||||
{
|
{
|
||||||
if (!my_close(fd,MYF(0)))
|
int fd;
|
||||||
fd= -1;
|
if ((fd= my_open(buff, O_RDONLY, MYF(0))) < 0)
|
||||||
|
{
|
||||||
|
error= 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
(void) my_close(fd,MYF(0));
|
||||||
|
if (last_modified && !stat(pidfile, pidfile_status))
|
||||||
|
{
|
||||||
|
if (last_modified != pidfile_status->st_mtime)
|
||||||
|
{
|
||||||
|
/* File changed; Let's assume that mysqld did restart */
|
||||||
|
if (opt_verbose)
|
||||||
|
printf("pid file '%s' changed while waiting for it to disappear!\nmysqld did probably restart\n",
|
||||||
|
buff);
|
||||||
|
error= 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count++ == opt_shutdown_timeout)
|
||||||
|
break;
|
||||||
sleep(1);
|
sleep(1);
|
||||||
if (last_modified && stat(pidfile, pidfile_status))
|
} while (!interrupted);
|
||||||
last_modified= 0;
|
|
||||||
}
|
if (error)
|
||||||
if (opt_verbose && last_modified &&
|
|
||||||
last_modified != pidfile_status->st_mtime)
|
|
||||||
printf("Warning; pid file '%s' changed while waiting for it to disappear!\n",
|
|
||||||
buff);
|
|
||||||
if (fd >= 0)
|
|
||||||
{
|
{
|
||||||
my_close(fd,MYF(0));
|
DBUG_PRINT("warning",("Pid file didn't disappear"));
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Warning; Aborted waiting on pid file: '%s' after %d seconds\n",
|
"Warning; Aborted waiting on pid file: '%s' after %d seconds\n",
|
||||||
buff, count-1);
|
buff, count-1);
|
||||||
}
|
}
|
||||||
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
#define MTEST_VERSION "1.25"
|
#define MTEST_VERSION "1.26"
|
||||||
|
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include <mysql_embed.h>
|
#include <mysql_embed.h>
|
||||||
@ -1797,10 +1797,8 @@ int read_query(struct st_query** q_ptr)
|
|||||||
|
|
||||||
static struct my_option my_long_options[] =
|
static struct my_option my_long_options[] =
|
||||||
{
|
{
|
||||||
#ifndef DBUG_OFF
|
|
||||||
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'",
|
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'",
|
||||||
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
#endif
|
|
||||||
{"database", 'D', "Database to use.", (gptr*) &db, (gptr*) &db, 0,
|
{"database", 'D', "Database to use.", (gptr*) &db, (gptr*) &db, 0,
|
||||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"basedir", 'b', "Basedir for tests", (gptr*) &opt_basedir,
|
{"basedir", 'b', "Basedir for tests", (gptr*) &opt_basedir,
|
||||||
@ -1893,7 +1891,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
{
|
{
|
||||||
switch(optid) {
|
switch(optid) {
|
||||||
case '#':
|
case '#':
|
||||||
|
#ifndef DBUG_OFF
|
||||||
DBUG_PUSH(argument ? argument : "d:t:S:i:O,/tmp/mysqltest.trace");
|
DBUG_PUSH(argument ? argument : "d:t:S:i:O,/tmp/mysqltest.trace");
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
record = 1;
|
record = 1;
|
||||||
@ -1971,7 +1971,7 @@ int parse_args(int argc, char **argv)
|
|||||||
default_argv= argv;
|
default_argv= argv;
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(1);
|
||||||
|
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
{
|
{
|
||||||
|
@ -88,6 +88,7 @@ sleep_until_file_created ()
|
|||||||
wait_for_pid()
|
wait_for_pid()
|
||||||
{
|
{
|
||||||
pid=$1
|
pid=$1
|
||||||
|
#$WAIT_PID pid $SLEEP_TIME_FOR_DELETE
|
||||||
}
|
}
|
||||||
|
|
||||||
# No paths below as we can't be sure where the program is!
|
# No paths below as we can't be sure where the program is!
|
||||||
@ -343,9 +344,9 @@ while test $# -gt 0; do
|
|||||||
;;
|
;;
|
||||||
--debug)
|
--debug)
|
||||||
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \
|
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \
|
||||||
--debug=d:t:i:O,$MYSQL_TEST_DIR/var/log/master.trace"
|
--debug=d:t:i:A,$MYSQL_TEST_DIR/var/log/master.trace"
|
||||||
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT \
|
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT \
|
||||||
--debug=d:t:i:O,$MYSQL_TEST_DIR/var/log/slave.trace"
|
--debug=d:t:i:A,$MYSQL_TEST_DIR/var/log/slave.trace"
|
||||||
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT --debug"
|
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT --debug"
|
||||||
;;
|
;;
|
||||||
--fast)
|
--fast)
|
||||||
@ -419,6 +420,7 @@ if [ x$SOURCE_DIST = x1 ] ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
MYSQLADMIN="$BASEDIR/client/mysqladmin"
|
MYSQLADMIN="$BASEDIR/client/mysqladmin"
|
||||||
|
WAIT_PID="$BASEDIR/extra/mysql_waitpid"
|
||||||
MYSQL_MANAGER_CLIENT="$BASEDIR/client/mysqlmanagerc"
|
MYSQL_MANAGER_CLIENT="$BASEDIR/client/mysqlmanagerc"
|
||||||
MYSQL_MANAGER="$BASEDIR/tools/mysqlmanager"
|
MYSQL_MANAGER="$BASEDIR/tools/mysqlmanager"
|
||||||
MYSQL_MANAGER_PWGEN="$BASEDIR/client/mysqlmanager-pwgen"
|
MYSQL_MANAGER_PWGEN="$BASEDIR/client/mysqlmanager-pwgen"
|
||||||
@ -435,6 +437,7 @@ else
|
|||||||
fi
|
fi
|
||||||
MYSQL_TEST="$BASEDIR/bin/mysqltest"
|
MYSQL_TEST="$BASEDIR/bin/mysqltest"
|
||||||
MYSQLADMIN="$BASEDIR/bin/mysqladmin"
|
MYSQLADMIN="$BASEDIR/bin/mysqladmin"
|
||||||
|
WAIT_PID="$BASEDIR/bin/mysql_waitpid"
|
||||||
MYSQL_MANAGER="$BASEDIR/bin/mysqlmanager"
|
MYSQL_MANAGER="$BASEDIR/bin/mysqlmanager"
|
||||||
MYSQL_MANAGER_CLIENT="$BASEDIR/bin/mysqlmanagerc"
|
MYSQL_MANAGER_CLIENT="$BASEDIR/bin/mysqlmanagerc"
|
||||||
MYSQL_MANAGER_PWGEN="$BASEDIR/bin/mysqlmanager-pwgen"
|
MYSQL_MANAGER_PWGEN="$BASEDIR/bin/mysqlmanager-pwgen"
|
||||||
@ -749,9 +752,9 @@ manager_term()
|
|||||||
{
|
{
|
||||||
pid=$1
|
pid=$1
|
||||||
ident=$2
|
ident=$2
|
||||||
shift
|
|
||||||
if [ $USE_MANAGER = 0 ] ; then
|
if [ $USE_MANAGER = 0 ] ; then
|
||||||
$MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock --connect_timeout=5 --shutdown_timeout=20 shutdown >> $MYSQL_MANAGER_LOG 2>&1
|
# Shutdown time must be high as slave may be in reconnect
|
||||||
|
$MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock --connect_timeout=5 --shutdown_timeout=70 shutdown >> $MYSQL_MANAGER_LOG 2>&1
|
||||||
res=$?
|
res=$?
|
||||||
# Some systems require an extra connect
|
# Some systems require an extra connect
|
||||||
$MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1
|
$MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1
|
||||||
@ -873,8 +876,8 @@ start_slave()
|
|||||||
[ x$SKIP_SLAVE = x1 ] && return
|
[ x$SKIP_SLAVE = x1 ] && return
|
||||||
eval "this_slave_running=\$SLAVE$1_RUNNING"
|
eval "this_slave_running=\$SLAVE$1_RUNNING"
|
||||||
[ x$this_slave_running = 1 ] && return
|
[ x$this_slave_running = 1 ] && return
|
||||||
#when testing fail-safe replication, we will have more than one slave
|
# When testing fail-safe replication, we will have more than one slave
|
||||||
#in this case, we start secondary slaves with an argument
|
# in this case, we start secondary slaves with an argument
|
||||||
slave_ident="slave$1"
|
slave_ident="slave$1"
|
||||||
if [ -n "$1" ] ;
|
if [ -n "$1" ] ;
|
||||||
then
|
then
|
||||||
@ -982,9 +985,12 @@ EOF
|
|||||||
|
|
||||||
mysql_start ()
|
mysql_start ()
|
||||||
{
|
{
|
||||||
$ECHO "Starting MySQL daemon"
|
# We should not start the deamon here as we don't know the argumens
|
||||||
start_master
|
# for the test. Better to let the test start the deamon
|
||||||
start_slave
|
|
||||||
|
# $ECHO "Starting MySQL daemon"
|
||||||
|
# start_master
|
||||||
|
# start_slave
|
||||||
cd $MYSQL_TEST_DIR
|
cd $MYSQL_TEST_DIR
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
@ -1085,8 +1091,6 @@ run_testcase ()
|
|||||||
slave_init_script=$TESTDIR/$tname-slave.sh
|
slave_init_script=$TESTDIR/$tname-slave.sh
|
||||||
slave_master_info_file=$TESTDIR/$tname-slave-master-info.opt
|
slave_master_info_file=$TESTDIR/$tname-slave-master-info.opt
|
||||||
echo $tname > $CURRENT_TEST
|
echo $tname > $CURRENT_TEST
|
||||||
echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR
|
|
||||||
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
|
|
||||||
SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0`
|
SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0`
|
||||||
if [ $USE_MANAGER = 1 ] ; then
|
if [ $USE_MANAGER = 1 ] ; then
|
||||||
many_slaves=`$EXPR \( $tname : rpl_failsafe \) != 0`
|
many_slaves=`$EXPR \( $tname : rpl_failsafe \) != 0`
|
||||||
@ -1123,13 +1127,17 @@ run_testcase ()
|
|||||||
then
|
then
|
||||||
EXTRA_MASTER_OPT=`$CAT $master_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"`
|
EXTRA_MASTER_OPT=`$CAT $master_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"`
|
||||||
stop_master
|
stop_master
|
||||||
|
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
|
||||||
start_master
|
start_master
|
||||||
else
|
else
|
||||||
if [ ! -z "$EXTRA_MASTER_OPT" ] || [ x$MASTER_RUNNING != x1 ] ;
|
if [ ! -z "$EXTRA_MASTER_OPT" ] || [ x$MASTER_RUNNING != x1 ] ;
|
||||||
then
|
then
|
||||||
EXTRA_MASTER_OPT=""
|
EXTRA_MASTER_OPT=""
|
||||||
stop_master
|
stop_master
|
||||||
|
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
|
||||||
start_master
|
start_master
|
||||||
|
else
|
||||||
|
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1159,7 +1167,10 @@ run_testcase ()
|
|||||||
|
|
||||||
if [ x$do_slave_restart = x1 ] ; then
|
if [ x$do_slave_restart = x1 ] ; then
|
||||||
stop_slave
|
stop_slave
|
||||||
|
echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR
|
||||||
start_slave
|
start_slave
|
||||||
|
else
|
||||||
|
echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR
|
||||||
fi
|
fi
|
||||||
if [ x$many_slaves = x1 ]; then
|
if [ x$many_slaves = x1 ]; then
|
||||||
start_slave 1
|
start_slave 1
|
||||||
|
@ -48,7 +48,10 @@ $opt_optimization="None";
|
|||||||
$opt_hw="";
|
$opt_hw="";
|
||||||
$opt_threads=5;
|
$opt_threads=5;
|
||||||
|
|
||||||
$opt_time_limit=10*60; # Don't wait more than 10 min for some tests
|
if (!defined($opt_time_limit))
|
||||||
|
{
|
||||||
|
$opt_time_limit=10*60; # Don't wait more than 10 min for some tests
|
||||||
|
}
|
||||||
|
|
||||||
$log_prog_args=join(" ", skip_arguments(\@ARGV,"comments","cmp","server",
|
$log_prog_args=join(" ", skip_arguments(\@ARGV,"comments","cmp","server",
|
||||||
"user", "host", "database", "password",
|
"user", "host", "database", "password",
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
# as such, and clarify ones such as "mediumint" with comments such as
|
# as such, and clarify ones such as "mediumint" with comments such as
|
||||||
# "3-byte int" or "same as xxx".
|
# "3-byte int" or "same as xxx".
|
||||||
|
|
||||||
$version="1.59";
|
$version="1.60";
|
||||||
|
|
||||||
use DBI;
|
use DBI;
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
@ -50,7 +50,7 @@ $opt_server="mysql"; $opt_host="localhost"; $opt_database="test";
|
|||||||
$opt_dir="limits";
|
$opt_dir="limits";
|
||||||
$opt_user=$opt_password="";$opt_verbose="";
|
$opt_user=$opt_password="";$opt_verbose="";
|
||||||
$opt_debug=$opt_help=$opt_Information=$opt_restart=$opt_force=$opt_quick=0;
|
$opt_debug=$opt_help=$opt_Information=$opt_restart=$opt_force=$opt_quick=0;
|
||||||
$opt_log_all_queries=$opt_fix_limit_file=$opt_batch_mode=0;
|
$opt_log_all_queries=$opt_fix_limit_file=$opt_batch_mode=$opt_version=0;
|
||||||
$opt_db_start_cmd=""; # the db server start command
|
$opt_db_start_cmd=""; # the db server start command
|
||||||
$opt_check_server=0; # Check if server is alive before each query
|
$opt_check_server=0; # Check if server is alive before each query
|
||||||
$opt_sleep=10; # time to sleep while starting the db server
|
$opt_sleep=10; # time to sleep while starting the db server
|
||||||
@ -68,8 +68,10 @@ GetOptions("Information","help","server=s","debug","user=s","password=s",
|
|||||||
"database=s","restart","force","quick","log-all-queries","comment=s",
|
"database=s","restart","force","quick","log-all-queries","comment=s",
|
||||||
"host=s","fix-limit-file","dir=s","db-start-cmd=s","sleep=s","suffix=s",
|
"host=s","fix-limit-file","dir=s","db-start-cmd=s","sleep=s","suffix=s",
|
||||||
"batch-mode","config-file=s","log-queries-to-file=s","check-server",
|
"batch-mode","config-file=s","log-queries-to-file=s","check-server",
|
||||||
|
"version",
|
||||||
"verbose!" => \$opt_verbose) || usage();
|
"verbose!" => \$opt_verbose) || usage();
|
||||||
usage() if ($opt_help || $opt_Information);
|
usage() if ($opt_help || $opt_Information);
|
||||||
|
version() && exit(0) if ($opt_version);
|
||||||
|
|
||||||
$opt_suffix = '-'.$opt_suffix if (length($opt_suffix) != 0);
|
$opt_suffix = '-'.$opt_suffix if (length($opt_suffix) != 0);
|
||||||
$opt_config_file = "$pwd/$opt_dir/$opt_server$opt_suffix.cfg"
|
$opt_config_file = "$pwd/$opt_dir/$opt_server$opt_suffix.cfg"
|
||||||
@ -1190,7 +1192,7 @@ else
|
|||||||
|
|
||||||
# Test: NOROUND
|
# Test: NOROUND
|
||||||
{
|
{
|
||||||
my $resultat = 'undefined';
|
my $result = 'undefined';
|
||||||
my $error;
|
my $error;
|
||||||
print "NOROUND: ";
|
print "NOROUND: ";
|
||||||
save_incomplete('func_extra_noround','Function NOROUND');
|
save_incomplete('func_extra_noround','Function NOROUND');
|
||||||
@ -1199,21 +1201,25 @@ else
|
|||||||
$error = safe_query_l('func_extra_noround',"select noround(22.6) $end_query");
|
$error = safe_query_l('func_extra_noround',"select noround(22.6) $end_query");
|
||||||
if ($error ne 1) # syntax error -- noround is not supported
|
if ($error ne 1) # syntax error -- noround is not supported
|
||||||
{
|
{
|
||||||
$resultat = 'no'
|
$result = 'no'
|
||||||
} else # Ok, now check if it really works
|
}
|
||||||
{
|
else # Ok, now check if it really works
|
||||||
|
{
|
||||||
$error=safe_query_l('func_extra_noround',
|
$error=safe_query_l('func_extra_noround',
|
||||||
["create table crash_me_nr (a int)",
|
["create table crash_me_nr (a int)",
|
||||||
"insert into crash_me_nr values(noround(10.2))",
|
"insert into crash_me_nr values(noround(10.2))",
|
||||||
"drop table crash_me_nr $drop_attr"]);
|
"drop table crash_me_nr $drop_attr"]);
|
||||||
if ($error eq 1) {
|
if ($error == 1)
|
||||||
$resultat = "syntax only";
|
{
|
||||||
} else {
|
$result= "syntax only";
|
||||||
$resultat = 'yes';
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
print "$resultat\n";
|
$result= 'yes';
|
||||||
save_config_data('func_extra_noround',$resultat,"Function NOROUND");
|
}
|
||||||
|
}
|
||||||
|
print "$result\n";
|
||||||
|
save_config_data('func_extra_noround',$result,"Function NOROUND");
|
||||||
}
|
}
|
||||||
|
|
||||||
check_parenthesis("func_sql_","CURRENT_USER");
|
check_parenthesis("func_sql_","CURRENT_USER");
|
||||||
@ -1377,7 +1383,7 @@ if ($limits{'type_sql_date'} eq 'yes')
|
|||||||
|
|
||||||
# Test: WEEK()
|
# Test: WEEK()
|
||||||
{
|
{
|
||||||
my $resultat="no";
|
my $result="no";
|
||||||
my $error;
|
my $error;
|
||||||
print "WEEK:";
|
print "WEEK:";
|
||||||
save_incomplete('func_odbc_week','WEEK');
|
save_incomplete('func_odbc_week','WEEK');
|
||||||
@ -1388,17 +1394,17 @@ if ($limits{'type_sql_date'} eq 'yes')
|
|||||||
# and 0 - EURO weeks
|
# and 0 - EURO weeks
|
||||||
if ($error == -1) {
|
if ($error == -1) {
|
||||||
if ($last_result == 4) {
|
if ($last_result == 4) {
|
||||||
$resultat = 'USA';
|
$result = 'USA';
|
||||||
} else {
|
} else {
|
||||||
$resultat='error';
|
$result='error';
|
||||||
add_log('func_odbc_week',
|
add_log('func_odbc_week',
|
||||||
" must return 4 or 5, but $last_result");
|
" must return 4 or 5, but $last_result");
|
||||||
}
|
}
|
||||||
} elsif ($error == 0) {
|
} elsif ($error == 0) {
|
||||||
$resultat = 'EURO';
|
$result = 'EURO';
|
||||||
}
|
}
|
||||||
print " $resultat\n";
|
print " $result\n";
|
||||||
save_config_data('func_odbc_week',$resultat,"WEEK");
|
save_config_data('func_odbc_week',$result,"WEEK");
|
||||||
}
|
}
|
||||||
|
|
||||||
my $insert_query ='insert into crash_me_d values('.
|
my $insert_query ='insert into crash_me_d values('.
|
||||||
@ -1498,7 +1504,7 @@ if ($limits{'type_sql_date'} eq 'yes')
|
|||||||
# NOT id BETWEEN a and b
|
# NOT id BETWEEN a and b
|
||||||
if ($limits{'func_where_not_between'} eq 'yes')
|
if ($limits{'func_where_not_between'} eq 'yes')
|
||||||
{
|
{
|
||||||
my $resultat = 'error';
|
my $result = 'error';
|
||||||
my $err;
|
my $err;
|
||||||
my $key='not_id_between';
|
my $key='not_id_between';
|
||||||
my $prompt='NOT ID BETWEEN interprets as ID NOT BETWEEN';
|
my $prompt='NOT ID BETWEEN interprets as ID NOT BETWEEN';
|
||||||
@ -1512,15 +1518,15 @@ if ($limits{'func_where_not_between'} eq 'yes')
|
|||||||
5,0);
|
5,0);
|
||||||
if ($err eq 1) {
|
if ($err eq 1) {
|
||||||
if (not defined($last_result)) {
|
if (not defined($last_result)) {
|
||||||
$resultat='no';
|
$result='no';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
if ( $err eq 0) {
|
if ( $err eq 0) {
|
||||||
$resultat = 'yes';
|
$result = 'yes';
|
||||||
};
|
};
|
||||||
safe_query_l($key,["drop table crash_me_b"]);
|
safe_query_l($key,["drop table crash_me_b"]);
|
||||||
save_config_data($key,$resultat,$prompt);
|
save_config_data($key,$result,$prompt);
|
||||||
print "$resultat\n";
|
print "$result\n";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -2018,37 +2024,44 @@ report("views","views",
|
|||||||
|
|
||||||
# Test: foreign key
|
# Test: foreign key
|
||||||
{
|
{
|
||||||
my $resultat = 'undefined';
|
my $result = 'undefined';
|
||||||
my $error;
|
my $error;
|
||||||
print "foreign keys: ";
|
print "foreign keys: ";
|
||||||
save_incomplete('foreign_key','foreign keys');
|
save_incomplete('foreign_key','foreign keys');
|
||||||
|
|
||||||
# 1) check if foreign keys are supported
|
# 1) check if foreign keys are supported
|
||||||
safe_query_l('foreign_key',create_table("crash_me_qf",["a integer not null"],
|
safe_query_l('foreign_key',
|
||||||
["primary key (a)"]));
|
create_table("crash_me_qf",
|
||||||
$error = safe_query_l('foreign_key',
|
["a integer not null"],
|
||||||
create_table("crash_me_qf2",["a integer not null",
|
["primary key (a)"]));
|
||||||
"foreign key (a) references crash_me_qf (a)"], []));
|
$error= safe_query_l('foreign_key',
|
||||||
|
create_table("crash_me_qf2",
|
||||||
if ($error eq 1) # OK -- syntax is supported
|
["a integer not null",
|
||||||
|
"foreign key (a) references crash_me_qf (a)"],
|
||||||
|
[]));
|
||||||
|
|
||||||
|
if ($error == 1) # OK -- syntax is supported
|
||||||
{
|
{
|
||||||
$resultat = 'error';
|
$result = 'error';
|
||||||
# now check if foreign key really works
|
# now check if foreign key really works
|
||||||
safe_query_l('foreign_key', "insert into crash_me_qf values (1)");
|
safe_query_l('foreign_key', "insert into crash_me_qf values (1)");
|
||||||
if (safe_query_l('foreign_key', "insert into crash_me_qf2 values (2)") eq 1)
|
if (safe_query_l('foreign_key', "insert into crash_me_qf2 values (2)") eq 1)
|
||||||
{
|
{
|
||||||
$resultat = 'syntax only';
|
$result = 'syntax only';
|
||||||
} else {
|
}
|
||||||
$resultat = 'yes';
|
else
|
||||||
}
|
{
|
||||||
|
$result = 'yes';
|
||||||
} else {
|
}
|
||||||
$resultat = "no";
|
}
|
||||||
}
|
else
|
||||||
safe_query_l('foreign_key',
|
{
|
||||||
"drop table crash_me_qf2 $drop_attr","drop table crash_me_qf $drop_attr");
|
$result = "no";
|
||||||
print "$resultat\n";
|
}
|
||||||
save_config_data('foreign_key',$resultat,"foreign keys");
|
safe_query_l('foreign_key', "drop table crash_me_qf2 $drop_attr");
|
||||||
|
safe_query_l('foreign_key', "drop table crash_me_qf $drop_attr");
|
||||||
|
print "$result\n";
|
||||||
|
save_config_data('foreign_key',$result,"foreign keys");
|
||||||
}
|
}
|
||||||
|
|
||||||
report("Create SCHEMA","create_schema",
|
report("Create SCHEMA","create_schema",
|
||||||
@ -2607,7 +2620,7 @@ sub detect_null_position
|
|||||||
sub check_parenthesis {
|
sub check_parenthesis {
|
||||||
my $prefix=shift;
|
my $prefix=shift;
|
||||||
my $fn=shift;
|
my $fn=shift;
|
||||||
my $resultat='no';
|
my $result='no';
|
||||||
my $param_name=$prefix.lc($fn);
|
my $param_name=$prefix.lc($fn);
|
||||||
my $r;
|
my $r;
|
||||||
|
|
||||||
@ -2616,18 +2629,18 @@ sub check_parenthesis {
|
|||||||
add_log($param_name,$safe_query_log);
|
add_log($param_name,$safe_query_log);
|
||||||
if ($r == 1)
|
if ($r == 1)
|
||||||
{
|
{
|
||||||
$resultat="yes";
|
$result="yes";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$r = safe_query("select $fn() $end_query");
|
$r = safe_query("select $fn() $end_query");
|
||||||
add_log($param_name,$safe_query_log);
|
add_log($param_name,$safe_query_log);
|
||||||
if ( $r == 1)
|
if ( $r == 1)
|
||||||
{
|
{
|
||||||
$resultat="with_parenthesis";
|
$result="with_parenthesis";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
save_config_data($param_name,$resultat,$fn);
|
save_config_data($param_name,$result,$fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check_constraint {
|
sub check_constraint {
|
||||||
@ -2699,10 +2712,16 @@ sub make_date {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub version
|
||||||
|
{
|
||||||
|
print "$0 Ver $version\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sub usage
|
sub usage
|
||||||
{
|
{
|
||||||
|
version();
|
||||||
print <<EOF;
|
print <<EOF;
|
||||||
$0 Ver $version
|
|
||||||
|
|
||||||
This program tries to find all limits and capabilities for a SQL
|
This program tries to find all limits and capabilities for a SQL
|
||||||
server. As it will use the server in some 'unexpected' ways, one
|
server. As it will use the server in some 'unexpected' ways, one
|
||||||
@ -3048,7 +3067,7 @@ sub safe_query_l {
|
|||||||
my $r = safe_query($q);
|
my $r = safe_query($q);
|
||||||
add_log($key,$safe_query_log);
|
add_log($key,$safe_query_log);
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub safe_query
|
sub safe_query
|
||||||
{
|
{
|
||||||
@ -3110,7 +3129,6 @@ sub safe_query
|
|||||||
$retry = $retry_limit;
|
$retry = $retry_limit;
|
||||||
$retry_ok = 1;
|
$retry_ok = 1;
|
||||||
$safe_query_log .= "> OK\n";
|
$safe_query_log .= "> OK\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ $opt_start_field_count=8; # start with this many fields
|
|||||||
$opt_loop_count=20; # How many tests to do
|
$opt_loop_count=20; # How many tests to do
|
||||||
$opt_row_count=1000; # Rows in the table
|
$opt_row_count=1000; # Rows in the table
|
||||||
$opt_field_count=1000; # Add until this many fields.
|
$opt_field_count=1000; # Add until this many fields.
|
||||||
|
$opt_time_limit=10*60; # Don't wait more than 10 min for some tests
|
||||||
|
|
||||||
chomp($pwd = `pwd`); $pwd = "." if ($pwd eq '');
|
chomp($pwd = `pwd`); $pwd = "." if ($pwd eq '');
|
||||||
require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n";
|
require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n";
|
||||||
@ -113,10 +114,9 @@ if ($opt_fast)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$add=1 if (!$limits{'alter_add_multi_col'});
|
$add=1 if (!$limits->{'alter_add_multi_col'});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$count=0;
|
$count=0;
|
||||||
while ($field_count < $opt_field_count)
|
while ($field_count < $opt_field_count)
|
||||||
{
|
{
|
||||||
@ -131,19 +131,43 @@ while ($field_count < $opt_field_count)
|
|||||||
$tmp="" if (!$multi_add); # Adabas
|
$tmp="" if (!$multi_add); # Adabas
|
||||||
}
|
}
|
||||||
do_query($dbh,"ALTER TABLE bench " . substr($fields,1));
|
do_query($dbh,"ALTER TABLE bench " . substr($fields,1));
|
||||||
|
$end_time=new Benchmark;
|
||||||
|
last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$count,
|
||||||
|
$opt_field_count/$add+1));
|
||||||
}
|
}
|
||||||
|
|
||||||
$end_time=new Benchmark;
|
$end_time=new Benchmark;
|
||||||
print "Time for alter_table_add ($count): " .
|
if ($estimated)
|
||||||
|
{ print "Estimated time"; }
|
||||||
|
else
|
||||||
|
{ print "Time"; }
|
||||||
|
print " for alter_table_add ($count): " .
|
||||||
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
||||||
|
|
||||||
|
#
|
||||||
|
# If estimated, fix table to have known number of fields
|
||||||
|
#
|
||||||
|
if ($estimated && $field_count < $opt_field_count)
|
||||||
|
{
|
||||||
|
$fields="";
|
||||||
|
$tmp="ADD ";
|
||||||
|
while ($field_count < $opt_field_count)
|
||||||
|
{
|
||||||
|
$field_count++;
|
||||||
|
$fields.=",$tmp i${field_count} integer";
|
||||||
|
$tmp="" if (!$multi_add); # Adabas
|
||||||
|
}
|
||||||
|
do_query($dbh,"ALTER TABLE bench " . substr($fields,1));
|
||||||
|
}
|
||||||
|
|
||||||
####
|
####
|
||||||
#### Test adding and deleting index on the first $opt_start_fields
|
#### Test adding and deleting index on the first $opt_start_fields
|
||||||
####
|
####
|
||||||
|
|
||||||
$loop_time=new Benchmark;
|
$loop_time=new Benchmark;
|
||||||
|
|
||||||
for ($i=1; $i < $opt_start_field_count ; $i++)
|
$count= 0;
|
||||||
|
for ($i=1; $i <= $opt_start_field_count ; $i++)
|
||||||
{
|
{
|
||||||
$dbh->do("CREATE INDEX bench_ind$i ON bench (i${i})") || die $DBI::errstr;
|
$dbh->do("CREATE INDEX bench_ind$i ON bench (i${i})") || die $DBI::errstr;
|
||||||
}
|
}
|
||||||
@ -153,7 +177,7 @@ print "Time for create_index ($opt_start_field_count): " .
|
|||||||
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
||||||
|
|
||||||
$loop_time=new Benchmark;
|
$loop_time=new Benchmark;
|
||||||
for ($i=1; $i < $opt_start_field_count ; $i++)
|
for ($i=1; $i <= $opt_start_field_count ; $i++)
|
||||||
{
|
{
|
||||||
$dbh->do($server->drop_index("bench","bench_ind$i")) || die $DBI::errstr;
|
$dbh->do($server->drop_index("bench","bench_ind$i")) || die $DBI::errstr;
|
||||||
}
|
}
|
||||||
@ -182,10 +206,17 @@ while ($field_count > $opt_start_field_count)
|
|||||||
}
|
}
|
||||||
$dbh->do("ALTER TABLE bench " . substr($fields,1) . $server->{'drop_attr'})
|
$dbh->do("ALTER TABLE bench " . substr($fields,1) . $server->{'drop_attr'})
|
||||||
|| die $DBI::errstr;
|
|| die $DBI::errstr;
|
||||||
|
$end_time=new Benchmark;
|
||||||
|
last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$count,
|
||||||
|
$opt_field_count/$add+1));
|
||||||
}
|
}
|
||||||
|
|
||||||
$end_time=new Benchmark;
|
$end_time=new Benchmark;
|
||||||
print "Time for alter_table_drop ($count): " .
|
if ($estimated)
|
||||||
|
{ print "Estimated time"; }
|
||||||
|
else
|
||||||
|
{ print "Time"; }
|
||||||
|
print " for alter_table_drop ($count): " .
|
||||||
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
||||||
|
|
||||||
skip_dropcol:
|
skip_dropcol:
|
||||||
|
@ -21,10 +21,11 @@
|
|||||||
# $opt_loop_count rows in random order
|
# $opt_loop_count rows in random order
|
||||||
#
|
#
|
||||||
# changes made for Oracle compatibility
|
# changes made for Oracle compatibility
|
||||||
# - $limits{'func_odbc_mod'} is OK from crash-me, but it fails here so set we
|
# - $limits->{'func_odbc_mod'} is OK from crash-me, but it fails here so set we
|
||||||
# set it to 0 in server-cfg
|
# set it to 0 in server-cfg
|
||||||
# - the default server config runs out of rollback segments, so I added a couple
|
# - the default server config runs out of rollback segments, so we added a
|
||||||
# of disconnect/connects to reset
|
# couple of disconnect/connects to reset
|
||||||
|
#
|
||||||
##################### Standard benchmark inits ##############################
|
##################### Standard benchmark inits ##############################
|
||||||
|
|
||||||
use DBI;
|
use DBI;
|
||||||
|
@ -772,7 +772,6 @@ uint calc_week(TIME *ltime, bool with_year, bool sunday_first_day_of_week,
|
|||||||
void find_date(char *pos,uint *vek,uint flag);
|
void find_date(char *pos,uint *vek,uint flag);
|
||||||
TYPELIB *convert_strings_to_array_type(my_string *typelibs, my_string *end);
|
TYPELIB *convert_strings_to_array_type(my_string *typelibs, my_string *end);
|
||||||
TYPELIB *typelib(List<String> &strings);
|
TYPELIB *typelib(List<String> &strings);
|
||||||
void clean_up(bool print_message=1);
|
|
||||||
ulong get_form_pos(File file, uchar *head, TYPELIB *save_names);
|
ulong get_form_pos(File file, uchar *head, TYPELIB *save_names);
|
||||||
ulong make_new_entry(File file,uchar *fileinfo,TYPELIB *formnames,
|
ulong make_new_entry(File file,uchar *fileinfo,TYPELIB *formnames,
|
||||||
const char *newname);
|
const char *newname);
|
||||||
|
@ -470,6 +470,7 @@ extern "C" pthread_handler_decl(handle_slave,arg);
|
|||||||
static uint set_maximum_open_files(uint max_file_limit);
|
static uint set_maximum_open_files(uint max_file_limit);
|
||||||
#endif
|
#endif
|
||||||
static ulong find_bit_type(const char *x, TYPELIB *bit_lib);
|
static ulong find_bit_type(const char *x, TYPELIB *bit_lib);
|
||||||
|
static void clean_up(bool print_message);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
** Code to end mysqld
|
** Code to end mysqld
|
||||||
@ -742,13 +743,13 @@ void kill_mysql(void)
|
|||||||
|
|
||||||
#if defined(OS2)
|
#if defined(OS2)
|
||||||
extern "C" void kill_server(int sig_ptr)
|
extern "C" void kill_server(int sig_ptr)
|
||||||
#define RETURN_FROM_KILL_SERVER return
|
#define RETURN_FROM_KILL_SERVER DBUG_RETURN
|
||||||
#elif !defined(__WIN__)
|
#elif !defined(__WIN__)
|
||||||
static void *kill_server(void *sig_ptr)
|
static void *kill_server(void *sig_ptr)
|
||||||
#define RETURN_FROM_KILL_SERVER return 0
|
#define RETURN_FROM_KILL_SERVER DBUG_RETURN(0)
|
||||||
#else
|
#else
|
||||||
static void __cdecl kill_server(int sig_ptr)
|
static void __cdecl kill_server(int sig_ptr)
|
||||||
#define RETURN_FROM_KILL_SERVER return
|
#define RETURN_FROM_KILL_SERVER DBUG_RETURN
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int sig=(int) (long) sig_ptr; // This is passed a int
|
int sig=(int) (long) sig_ptr; // This is passed a int
|
||||||
@ -827,7 +828,7 @@ extern "C" sig_handler print_signal_warning(int sig)
|
|||||||
|
|
||||||
void unireg_end(void)
|
void unireg_end(void)
|
||||||
{
|
{
|
||||||
clean_up();
|
clean_up(1);
|
||||||
my_thread_end();
|
my_thread_end();
|
||||||
#ifdef SIGNALS_DONT_BREAK_READ
|
#ifdef SIGNALS_DONT_BREAK_READ
|
||||||
exit(0);
|
exit(0);
|
||||||
@ -842,7 +843,7 @@ extern "C" void unireg_abort(int exit_code)
|
|||||||
DBUG_ENTER("unireg_abort");
|
DBUG_ENTER("unireg_abort");
|
||||||
if (exit_code)
|
if (exit_code)
|
||||||
sql_print_error("Aborting\n");
|
sql_print_error("Aborting\n");
|
||||||
clean_up(); /* purecov: inspected */
|
clean_up(1); /* purecov: inspected */
|
||||||
DBUG_PRINT("quit",("done with cleanup in unireg_abort"));
|
DBUG_PRINT("quit",("done with cleanup in unireg_abort"));
|
||||||
my_thread_end();
|
my_thread_end();
|
||||||
exit(exit_code); /* purecov: inspected */
|
exit(exit_code); /* purecov: inspected */
|
||||||
@ -887,12 +888,12 @@ void clean_up(bool print_message)
|
|||||||
regex_end();
|
regex_end();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (print_message && errmesg)
|
||||||
|
sql_print_error(ER(ER_SHUTDOWN_COMPLETE),my_progname);
|
||||||
#if !defined(__WIN__) && !defined(EMBEDDED_LIBRARY)
|
#if !defined(__WIN__) && !defined(EMBEDDED_LIBRARY)
|
||||||
if (!opt_bootstrap)
|
if (!opt_bootstrap)
|
||||||
(void) my_delete(pidfile_name,MYF(0)); // This may not always exist
|
(void) my_delete(pidfile_name,MYF(0)); // This may not always exist
|
||||||
#endif
|
#endif
|
||||||
if (print_message && errmesg)
|
|
||||||
sql_print_error(ER(ER_SHUTDOWN_COMPLETE),my_progname);
|
|
||||||
x_free((gptr) my_errmsg[ERRMAPP]); /* Free messages */
|
x_free((gptr) my_errmsg[ERRMAPP]); /* Free messages */
|
||||||
DBUG_PRINT("quit", ("Error messages freed"));
|
DBUG_PRINT("quit", ("Error messages freed"));
|
||||||
/* Tell main we are ready */
|
/* Tell main we are ready */
|
||||||
@ -902,6 +903,10 @@ void clean_up(bool print_message)
|
|||||||
/* do the broadcast inside the lock to ensure that my_end() is not called */
|
/* do the broadcast inside the lock to ensure that my_end() is not called */
|
||||||
(void) pthread_cond_broadcast(&COND_thread_count);
|
(void) pthread_cond_broadcast(&COND_thread_count);
|
||||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
||||||
|
/*
|
||||||
|
The following lines may never be executed as the main thread may have
|
||||||
|
killed us
|
||||||
|
*/
|
||||||
DBUG_PRINT("quit", ("done with cleanup"));
|
DBUG_PRINT("quit", ("done with cleanup"));
|
||||||
} /* clean_up */
|
} /* clean_up */
|
||||||
|
|
||||||
@ -1481,7 +1486,7 @@ static void init_signals(void)
|
|||||||
/* Change limits so that we will get a core file */
|
/* Change limits so that we will get a core file */
|
||||||
struct rlimit rl;
|
struct rlimit rl;
|
||||||
rl.rlim_cur = rl.rlim_max = RLIM_INFINITY;
|
rl.rlim_cur = rl.rlim_max = RLIM_INFINITY;
|
||||||
if (setrlimit(RLIMIT_CORE, &rl))
|
if (setrlimit(RLIMIT_CORE, &rl) && global_system_variables.log_warnings)
|
||||||
sql_print_error("Warning: setrlimit could not change the size of core files to 'infinity'; We may not be able to generate a core file on signals");
|
sql_print_error("Warning: setrlimit could not change the size of core files to 'infinity'; We may not be able to generate a core file on signals");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1550,8 +1555,11 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
|
|||||||
my_thread_init(); // Init new thread
|
my_thread_init(); // Init new thread
|
||||||
DBUG_ENTER("signal_hand");
|
DBUG_ENTER("signal_hand");
|
||||||
SIGNAL_THD;
|
SIGNAL_THD;
|
||||||
/* Setup alarm handler */
|
/*
|
||||||
init_thr_alarm(max_connections+max_insert_delayed_threads);
|
Setup alarm handler
|
||||||
|
The two extra handlers are for slave threads
|
||||||
|
*/
|
||||||
|
init_thr_alarm(max_connections+max_insert_delayed_threads+2);
|
||||||
#if SIGINT != THR_KILL_SIGNAL
|
#if SIGINT != THR_KILL_SIGNAL
|
||||||
(void) sigemptyset(&set); // Setup up SIGINT for debug
|
(void) sigemptyset(&set); // Setup up SIGINT for debug
|
||||||
(void) sigaddset(&set,SIGINT); // For debugging
|
(void) sigaddset(&set,SIGINT); // For debugging
|
||||||
@ -1639,12 +1647,15 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SIGHUP:
|
case SIGHUP:
|
||||||
reload_acl_and_cache((THD*) 0,
|
if (!abort_loop)
|
||||||
(REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST |
|
{
|
||||||
REFRESH_STATUS | REFRESH_GRANT | REFRESH_THREADS |
|
reload_acl_and_cache((THD*) 0,
|
||||||
REFRESH_HOSTS),
|
(REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST |
|
||||||
(TABLE_LIST*) 0); // Flush logs
|
REFRESH_STATUS | REFRESH_GRANT |
|
||||||
mysql_print_status((THD*) 0); // Send debug some info
|
REFRESH_THREADS | REFRESH_HOSTS),
|
||||||
|
(TABLE_LIST*) 0); // Flush logs
|
||||||
|
mysql_print_status((THD*) 0); // Send debug some info
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef USE_ONE_SIGNAL_HAND
|
#ifdef USE_ONE_SIGNAL_HAND
|
||||||
case THR_SERVER_ALARM:
|
case THR_SERVER_ALARM:
|
||||||
|
@ -134,7 +134,10 @@ net_printf(NET *net, uint errcode, ...)
|
|||||||
{
|
{
|
||||||
if (thd && thd->bootstrap)
|
if (thd && thd->bootstrap)
|
||||||
{
|
{
|
||||||
/* In bootstrap it's ok to print on stderr */
|
/*
|
||||||
|
In bootstrap it's ok to print on stderr
|
||||||
|
This may also happen when we get an error from a slave thread
|
||||||
|
*/
|
||||||
fprintf(stderr,"ERROR: %d %s\n",errcode,text_pos);
|
fprintf(stderr,"ERROR: %d %s\n",errcode,text_pos);
|
||||||
thd->fatal_error=1;
|
thd->fatal_error=1;
|
||||||
}
|
}
|
||||||
|
@ -376,6 +376,7 @@ int terminate_slave_threads(MASTER_INFO* mi,int thread_mask,bool skip_lock)
|
|||||||
}
|
}
|
||||||
if ((thread_mask & (SLAVE_IO|SLAVE_FORCE_ALL)) && mi->slave_running)
|
if ((thread_mask & (SLAVE_IO|SLAVE_FORCE_ALL)) && mi->slave_running)
|
||||||
{
|
{
|
||||||
|
DBUG_PRINT("info",("Terminating IO thread"));
|
||||||
mi->abort_slave=1;
|
mi->abort_slave=1;
|
||||||
if ((error=terminate_slave_thread(mi->io_thd,io_lock,
|
if ((error=terminate_slave_thread(mi->io_thd,io_lock,
|
||||||
io_cond_lock,
|
io_cond_lock,
|
||||||
@ -386,6 +387,7 @@ int terminate_slave_threads(MASTER_INFO* mi,int thread_mask,bool skip_lock)
|
|||||||
}
|
}
|
||||||
if ((thread_mask & (SLAVE_SQL|SLAVE_FORCE_ALL)) && mi->rli.slave_running)
|
if ((thread_mask & (SLAVE_SQL|SLAVE_FORCE_ALL)) && mi->rli.slave_running)
|
||||||
{
|
{
|
||||||
|
DBUG_PRINT("info",("Terminating SQL thread"));
|
||||||
DBUG_ASSERT(mi->rli.sql_thd != 0) ;
|
DBUG_ASSERT(mi->rli.sql_thd != 0) ;
|
||||||
mi->rli.abort_slave=1;
|
mi->rli.abort_slave=1;
|
||||||
if ((error=terminate_slave_thread(mi->rli.sql_thd,sql_lock,
|
if ((error=terminate_slave_thread(mi->rli.sql_thd,sql_lock,
|
||||||
|
Reference in New Issue
Block a user