2003-11-28 11:18:13 +01:00
#!/bin/sh
2000-12-07 15:54:59 +01:00
# mysql-test-run - originally written by Matt Wagner <matt@mysql.com>
# modified by Sasha Pachev <sasha@mysql.com>
2003-11-20 19:55:07 +01:00
# Slightly updated by Monty
2000-12-28 08:26:37 +01:00
# Cleaned up again by Matt
2000-12-30 16:24:31 +01:00
# Fixed by Sergei
2004-12-16 20:26:24 +01:00
# List of failed cases (--force) backported from 4.1 by Joerg
2000-12-30 16:24:31 +01:00
# :-)
2000-07-31 21:29:14 +02:00
2006-04-19 09:39:57 +02:00
#echo "##################################################";
#echo "This script is deprecated and will soon be removed";
#echo "Use mysql-test-run.pl instead";
#echo "##################################################";
#echo
2006-04-10 18:08:54 +02:00
2000-07-31 21:29:14 +02:00
#++
# Access Definitions
#--
DB = test
2004-03-19 13:52:48 +01:00
DBPASSWD = ""
2000-12-28 02:56:38 +01:00
VERBOSE = ""
2001-10-11 23:41:31 +02:00
USE_MANAGER = 0
2003-05-27 15:40:14 +02:00
MY_TZ = GMT-3
TZ = $MY_TZ ; export TZ # for UNIX_TIMESTAMP tests to work
2003-11-02 13:00:25 +01:00
LOCAL_SOCKET = @MYSQL_UNIX_ADDR@
2007-09-13 16:19:46 +02:00
if [ -z " $MYSQL_TCP_PORT " ] ; then
MYSQL_TCP_PORT = @MYSQL_TCP_PORT@
if [ @MYSQL_TCP_PORT_DEFAULT@ -eq 0 ] ; then
ESP = ` getent services mysql/tcp`
if [ $? -eq 0 ] ; then
MYSQL_TCP_PORT = ` echo " $ESP " | sed -e's-^[a-z]*[ ]*\([0-9]*\)/[a-z]*$-\1-g' `
fi
fi
fi
2000-07-31 21:29:14 +02:00
2006-03-01 16:53:21 +01:00
umask 022
2003-08-22 03:07:40 +02:00
# For query_cache test
2004-03-19 17:26:02 +01:00
case ` uname` in
2004-03-04 17:16:10 +01:00
SCO_SV | UnixWare | OpenUNIX )
# do nothing (Causes strange behavior)
; ;
2004-03-31 02:32:38 +02:00
QNX)
# do nothing (avoid error message)
; ;
2004-03-04 17:16:10 +01:00
* )
ulimit -n 1024
; ;
esac
2003-08-22 03:07:40 +02:00
2001-01-02 13:29:47 +01:00
#++
# Program Definitions
#--
2003-05-21 20:58:12 +02:00
LC_COLLATE = C
export LC_COLLATE
2002-12-02 16:52:22 +01:00
PATH = /bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11:$PATH
2002-02-09 21:58:53 +01:00
MASTER_40_ARGS = "--rpl-recovery-rank=1 --init-rpl-role=master"
2000-12-07 15:54:59 +01:00
2001-04-12 14:46:50 +02:00
# Standard functions
which ( )
{
2001-04-14 15:35:42 +02:00
IFS = " ${ IFS = } " ; save_ifs = " $IFS " ; IFS = ':'
2001-04-12 14:46:50 +02:00
for file
do
2001-04-14 15:35:42 +02:00
for dir in $PATH
2001-04-12 14:46:50 +02:00
do
2001-12-18 04:34:00 +01:00
if test -f $dir /$file
2001-04-12 14:46:50 +02:00
then
echo " $dir / $file "
continue 2
fi
done
2002-09-05 15:17:08 +02:00
echo " Fatal error: Cannot find program $file in $PATH " 1>& 2
2001-04-12 14:46:50 +02:00
exit 1
done
2001-04-14 15:35:42 +02:00
IFS = " $save_ifs "
2002-09-05 15:17:08 +02:00
exit 0
2001-04-12 14:46:50 +02:00
}
2001-12-10 17:16:51 +01:00
sleep_until_file_deleted ( )
{
2002-12-05 02:40:33 +01:00
pid = $1 ;
file = $2
2001-12-13 01:31:19 +01:00
loop = $SLEEP_TIME_FOR_DELETE
2001-12-10 17:16:51 +01:00
while ( test $loop -gt 0)
do
2001-12-18 04:34:00 +01:00
if [ ! -r $file ]
2001-12-10 17:16:51 +01:00
then
2002-12-05 02:40:33 +01:00
if test $pid != "0"
then
wait_for_pid $pid
fi
2001-12-10 17:16:51 +01:00
return
fi
2002-10-29 20:59:03 +01:00
sleep 1
2001-12-10 17:16:51 +01:00
loop = ` expr $loop - 1`
done
}
2002-02-09 21:58:53 +01:00
sleep_until_file_created ( )
2001-12-10 17:16:51 +01:00
{
file = $1
2001-12-13 01:31:19 +01:00
loop = $2
org_time = $2
2001-12-10 17:16:51 +01:00
while ( test $loop -gt 0)
do
2001-12-18 04:34:00 +01:00
if [ -r $file ]
2001-12-10 17:16:51 +01:00
then
2002-09-05 15:17:08 +02:00
return 0
2001-12-10 17:16:51 +01:00
fi
2001-12-17 14:00:14 +01:00
sleep 1
2001-12-10 17:16:51 +01:00
loop = ` expr $loop - 1`
done
2001-12-13 01:31:19 +01:00
echo " ERROR: $file was not created in $org_time seconds; Aborting "
2001-12-10 17:16:51 +01:00
exit 1;
}
2002-12-05 02:40:33 +01:00
# For the future
wait_for_pid( )
{
pid = $1
2003-01-07 15:53:10 +01:00
#$WAIT_PID pid $SLEEP_TIME_FOR_DELETE
2002-12-05 02:40:33 +01:00
}
2005-12-06 21:34:35 +01:00
# Check that valgrind is installed
find_valgrind( )
{
FIND_VALGRIND = ` which valgrind` # this will print an error if not found
# Give good warning to the user and stop
if [ -z " $FIND_VALGRIND " ] ; then
$ECHO "You need to have the 'valgrind' program in your PATH to run mysql-test-run with option --valgrind. Valgrind's home page is http://valgrind.kde.org ."
exit 1
fi
# >=2.1.2 requires the --tool option, some versions write to stdout, some to stderr
valgrind --help 2>& 1 | grep "\-\-tool" > /dev/null && FIND_VALGRIND = " $FIND_VALGRIND --tool=memcheck "
2006-11-23 15:41:21 +01:00
FIND_VALGRIND = " $FIND_VALGRIND --alignment=8 --leak-check=yes --num-callers=16 --suppressions= $MYSQL_TEST_DIR /valgrind.supp "
2005-12-06 21:34:35 +01:00
}
2001-01-02 13:29:47 +01:00
# No paths below as we can't be sure where the program is!
2002-03-05 14:46:30 +01:00
SED = sed
2002-09-05 15:17:08 +02:00
BASENAME = ` which basename`
if test $? != 0; then exit 1; fi
2002-03-05 14:46:30 +01:00
DIFF = ` which diff | $SED q`
2002-09-05 15:17:08 +02:00
if test $? != 0; then exit 1; fi
2001-01-02 13:29:47 +01:00
CAT = cat
CUT = cut
2001-11-28 01:55:52 +01:00
HEAD = head
2001-01-02 13:29:47 +01:00
TAIL = tail
ECHO = echo # use internal echo if possible
EXPR = expr # use internal if possible
FIND = find
2003-01-28 07:38:28 +01:00
GREP = grep
2002-09-05 15:17:08 +02:00
if test $? != 0; then exit 1; fi
2001-01-02 13:29:47 +01:00
PRINTF = printf
RM = rm
2002-09-05 15:17:08 +02:00
if test $? != 0; then exit 1; fi
2001-01-02 13:29:47 +01:00
TR = tr
2002-09-05 15:17:08 +02:00
XARGS = ` which xargs`
if test $? != 0; then exit 1; fi
2003-05-14 21:12:55 +02:00
SORT = sort
2001-01-02 13:29:47 +01:00
# Are we using a source or a binary distribution?
testdir = @testdir@
if [ -d bin/mysqld ] && [ -d mysql-test ] ; then
2000-12-07 15:54:59 +01:00
cd mysql-test
else
2001-01-02 13:29:47 +01:00
if [ -d $testdir /mysql-test ] ; then
cd $testdir
2000-12-07 15:54:59 +01:00
fi
2001-01-02 13:29:47 +01:00
fi
if [ ! -f ./mysql-test-run ] ; then
$ECHO "Can't find the location for the mysql-test-run script"
$ECHO "Go to to the mysql-test directory and execute the script as follows:"
$ECHO "./mysql-test-run."
2000-12-15 15:12:31 +01:00
exit 1
2000-12-07 15:54:59 +01:00
fi
2000-10-12 01:38:30 +02:00
2000-07-31 21:29:14 +02:00
#++
# Misc. Definitions
#--
2000-12-07 15:54:59 +01:00
2006-11-01 20:17:10 +01:00
# BASEDIR is always above mysql-test directory ...
MYSQL_TEST_DIR = ` pwd `
cd ..
if [ -d ./sql ] ; then
2001-01-02 13:29:47 +01:00
SOURCE_DIST = 1
else
BINARY_DIST = 1
2001-01-04 01:56:38 +01:00
2006-11-20 21:42:06 +01:00
# ... one level for tar.gz, two levels for a RPM installation
if [ ! -f ./bin/mysql_upgrade ] ; then
# Has to be RPM installation
cd ..
fi
2006-11-01 20:17:10 +01:00
fi
2006-11-20 21:42:06 +01:00
BASEDIR = ` pwd `
2006-11-01 20:17:10 +01:00
cd $MYSQL_TEST_DIR
2005-06-10 21:29:37 +02:00
MYSQL_TEST_WINDIR = $MYSQL_TEST_DIR
2006-01-24 08:30:54 +01:00
MYSQLTEST_VARDIR = $MYSQL_TEST_DIR /var
export MYSQL_TEST_DIR MYSQL_TEST_WINDIR MYSQLTEST_VARDIR
2000-12-12 16:24:50 +01:00
STD_DATA = $MYSQL_TEST_DIR /std_data
2001-01-22 14:33:34 +01:00
hostname = ` hostname` # Installed in the mysql privilege table
2001-09-28 07:05:54 +02:00
2001-12-10 17:16:51 +01:00
MANAGER_QUIET_OPT = "-q"
2001-06-05 02:38:10 +02:00
TESTDIR = " $MYSQL_TEST_DIR /t "
2000-10-10 10:42:07 +02:00
TESTSUFFIX = test
2001-06-05 02:38:10 +02:00
TOT_SKIP = 0
2000-07-31 21:29:14 +02:00
TOT_PASS = 0
TOT_FAIL = 0
TOT_TEST = 0
2006-05-04 21:19:31 +02:00
GOT_WARNINGS = 0
2000-10-11 15:50:13 +02:00
USERT = 0
SYST = 0
REALT = 0
2002-12-05 02:40:33 +01:00
FAST_START = ""
2000-12-28 18:25:41 +01:00
MYSQL_TMP_DIR = $MYSQL_TEST_DIR /var/tmp
2006-02-26 19:54:09 +01:00
export MYSQL_TMP_DIR
2006-01-31 09:38:40 +01:00
# Use a relative path for where the slave will find the dumps
# generated by "LOAD DATA" on the master. The path is relative
# since it must have fixed length to test logging
# i.e otherwise the output from "SHOW MASTER STATUS" will vary
# with the strlen() of MYSQL_TEST_DIR
SLAVE_LOAD_TMPDIR = ../tmp
2000-12-15 15:12:31 +01:00
RES_SPACE = " "
2005-01-01 21:13:09 +01:00
MYSQLD_SRC_DIRS = " strings mysys include extra regex myisam \
2000-10-12 01:01:58 +02:00
myisammrg heap sql"
2002-01-22 23:05:11 +01:00
MY_LOG_DIR = " $MYSQL_TEST_DIR /var/log "
2001-10-03 15:27:20 +02:00
#
# Set LD_LIBRARY_PATH if we are using shared libraries
#
2006-02-26 14:11:56 +01:00
LD_LIBRARY_PATH = " $BASEDIR /lib: $BASEDIR /libmysql/.libs: $BASEDIR /libmysql_r/.libs: $BASEDIR /zlib/.libs: $LD_LIBRARY_PATH "
DYLD_LIBRARY_PATH = " $BASEDIR /lib: $BASEDIR /libmysql/.libs: $BASEDIR /libmysql_r/.libs: $BASEDIR /zlib/.libs: $DYLD_LIBRARY_PATH "
2003-12-30 12:14:21 +01:00
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH
2000-11-18 07:35:40 +01:00
2005-01-25 19:08:16 +01:00
#
# Allow anyone in the group to see the generated database files
#
UMASK = 0660
UMASK_DIR = 0770
export UMASK UMASK_DIR
2000-12-13 17:58:26 +01:00
MASTER_RUNNING = 0
2004-09-28 19:04:30 +02:00
MASTER1_RUNNING = 0
2006-01-12 19:51:02 +01:00
MASTER_MYHOST = 127.0.0.1
2001-01-04 01:56:38 +01:00
MASTER_MYPORT = 9306
2000-12-13 17:58:26 +01:00
SLAVE_RUNNING = 0
2006-01-12 19:51:02 +01:00
SLAVE_MYHOST = 127.0.0.1
2004-09-28 19:04:30 +02:00
SLAVE_MYPORT = 9308 # leave room for 2 masters for cluster tests
2006-04-19 09:39:57 +02:00
MYSQL_MANAGER_LOG = $MYSQL_TEST_DIR /var/log/manager.log
2004-06-24 15:28:15 +02:00
NDBCLUSTER_PORT = 9350
2006-01-12 19:51:02 +01:00
NDBCLUSTER_PORT_SLAVE = 9358
2005-10-25 02:27:55 +02:00
#
# To make it easier for different devs to work on the same host,
# an environment variable can be used to control all ports. A small
# number is to be used, 0 - 16 or similar.
#
2006-01-28 12:35:46 +01:00
# Note the MASTER_MYPORT has to be set the same in all 4.x and 5.x
# versions of this script, else a 4.0 test run might conflict with a
# 5.1 test run, even if different MTR_BUILD_THREAD is used. This means
# all port numbers might not be used in this version of the script.
#
2005-10-25 02:27:55 +02:00
if [ -n " $MTR_BUILD_THREAD " ] ; then
2006-01-28 12:35:46 +01:00
MASTER_MYPORT = ` expr $MTR_BUILD_THREAD '*' 10 + 10000`
2005-11-01 15:30:55 +01:00
SLAVE_MYPORT = ` expr $MASTER_MYPORT + 3`
2006-02-10 19:56:34 +01:00
NDBCLUSTER_PORT = ` expr $MASTER_MYPORT + 6`
2006-02-17 21:55:27 +01:00
NDBCLUSTER_PORT_SLAVE = ` expr $MASTER_MYPORT + 7`
2005-10-25 02:27:55 +02:00
2006-01-13 17:44:37 +01:00
echo " Using MTR_BUILD_THREAD = $MTR_BUILD_THREAD "
echo " Using MASTER_MYPORT = $MASTER_MYPORT "
echo " Using SLAVE_MYPORT = $SLAVE_MYPORT "
echo " Using NDBCLUSTER_PORT = $NDBCLUSTER_PORT "
echo " Using NDBCLUSTER_PORT_SLAVE = $NDBCLUSTER_PORT_SLAVE "
2005-10-25 02:27:55 +02:00
fi
2001-01-05 12:13:15 +01:00
NO_SLAVE = 0
2002-02-15 22:02:48 +01:00
USER_TEST =
2004-09-28 16:27:50 +02:00
FAILED_CASES =
2001-01-04 01:56:38 +01:00
2001-01-16 11:38:58 +01:00
EXTRA_MASTER_OPT = ""
2001-01-04 01:56:38 +01:00
EXTRA_MYSQL_TEST_OPT = ""
2005-10-18 11:25:03 +02:00
EXTRA_MYSQLCHECK_OPT = ""
2003-12-21 18:39:32 +01:00
EXTRA_MYSQLDUMP_OPT = ""
2005-11-30 01:02:21 +01:00
EXTRA_MYSQLSLAP_OPT = ""
2005-03-15 19:46:43 +01:00
EXTRA_MYSQLSHOW_OPT = ""
2003-12-21 18:39:32 +01:00
EXTRA_MYSQLBINLOG_OPT = ""
2005-01-26 10:19:28 +01:00
USE_RUNNING_SERVER = 0
2005-03-07 13:42:01 +01:00
USE_NDBCLUSTER = @USE_NDBCLUSTER@
2006-01-12 19:51:02 +01:00
USE_NDBCLUSTER_SLAVE = @USE_NDBCLUSTER@
2006-01-16 22:47:19 +01:00
USE_NDBCLUSTER_ALL = 0
2006-01-17 08:25:52 +01:00
USE_NDBCLUSTER_ONLY = 0
2004-04-14 17:16:31 +02:00
USE_RUNNING_NDBCLUSTER = ""
2006-01-12 19:51:02 +01:00
USE_RUNNING_NDBCLUSTER_SLAVE = ""
NDB_EXTRA_TEST = 0
2006-01-23 10:42:02 +01:00
NDB_VERBOSE = 0
2006-01-12 19:51:02 +01:00
NDBCLUSTER_EXTRA_OPTS = ""
2005-01-28 00:35:26 +01:00
USE_PURIFY = ""
PURIFY_LOGS = ""
2001-01-04 01:56:38 +01:00
DO_GCOV = ""
DO_GDB = ""
2001-12-17 02:02:58 +01:00
MANUAL_GDB = ""
2001-01-04 01:56:38 +01:00
DO_DDD = ""
2001-06-09 03:24:41 +02:00
DO_CLIENT_GDB = ""
2001-12-17 23:23:56 +01:00
SLEEP_TIME_AFTER_RESTART = 1
2001-12-13 01:31:19 +01:00
SLEEP_TIME_FOR_DELETE = 10
2001-12-17 23:23:56 +01:00
SLEEP_TIME_FOR_FIRST_MASTER = 400 # Enough time to create innodb tables
2004-11-11 17:06:47 +01:00
SLEEP_TIME_FOR_SECOND_MASTER = 400
2001-12-17 23:23:56 +01:00
SLEEP_TIME_FOR_FIRST_SLAVE = 400
2005-03-22 15:12:05 +01:00
SLEEP_TIME_FOR_SECOND_SLAVE = 300
2001-09-14 01:54:33 +02:00
CHARACTER_SET = latin1
2001-01-17 02:15:20 +01:00
DBUSER = ""
2002-01-22 23:05:11 +01:00
START_WAIT_TIMEOUT = 10
STOP_WAIT_TIMEOUT = 10
2003-03-11 10:41:53 +01:00
MYSQL_TEST_SSL_OPTS = ""
2004-09-28 18:25:57 +02:00
USE_TIMER = ""
2004-09-27 17:01:26 +02:00
USE_EMBEDDED_SERVER = ""
2005-01-28 00:35:26 +01:00
TEST_MODE = ""
2001-01-04 01:56:38 +01:00
2005-01-21 12:15:14 +01:00
NDB_MGM_EXTRA_OPTS =
2005-01-19 10:00:41 +01:00
NDB_MGMD_EXTRA_OPTS =
NDBD_EXTRA_OPTS =
2006-01-20 14:50:02 +01:00
MASTER_MYSQLDBINLOG = 1
2006-01-12 19:51:02 +01:00
SLAVE_MYSQLDBINLOG = 1
2005-01-19 10:00:41 +01:00
2005-10-18 22:49:31 +02:00
DO_STRESS = ""
2005-10-18 18:26:31 +02:00
STRESS_SUITE = "main"
STRESS_MODE = "random"
STRESS_THREADS = 5
2005-12-15 23:23:55 +01:00
STRESS_TEST_COUNT = ""
2005-10-18 18:26:31 +02:00
STRESS_LOOP_COUNT = ""
STRESS_TEST_DURATION = ""
STRESS_INIT_FILE = ""
STRESS_TEST_FILE = ""
STRESS_TEST = ""
2006-04-07 19:27:19 +02:00
$ECHO " Logging: $0 $* " # To ensure we see all arguments in the output, for the test analysis tool
2001-01-04 01:56:38 +01:00
while test $# -gt 0; do
case " $1 " in
2005-01-28 00:35:26 +01:00
--embedded-server)
USE_EMBEDDED_SERVER = 1
USE_MANAGER = 0 NO_SLAVE = 1
2005-02-04 17:24:18 +01:00
USE_RUNNING_SERVER = 0
2006-01-23 08:58:14 +01:00
USE_NDBCLUSTER = ""
USE_NDBCLUSTER_SLAVE = ""
2005-01-28 00:35:26 +01:00
TEST_MODE = " $TEST_MODE embedded " ; ;
--purify)
USE_PURIFY = 1
USE_MANAGER = 0
2005-02-04 17:24:18 +01:00
USE_RUNNING_SERVER = 0
2005-01-28 00:35:26 +01:00
TEST_MODE = " $TEST_MODE purify " ; ;
2001-01-17 02:15:20 +01:00
--user= *) DBUSER = ` $ECHO " $1 " | $SED -e "s;--user=;;" ` ; ;
--force) FORCE = 1 ; ;
2004-09-28 18:25:57 +02:00
--timer) USE_TIMER = 1 ; ;
2002-02-09 21:58:53 +01:00
--old-master) MASTER_40_ARGS = "" ; ;
--master-binary= *)
MASTER_MYSQLD = ` $ECHO " $1 " | $SED -e "s;--master-binary=;;" ` ; ;
--slave-binary= *)
SLAVE_MYSQLD = ` $ECHO " $1 " | $SED -e "s;--slave-binary=;;" ` ; ;
2005-01-26 10:19:28 +01:00
--local) USE_RUNNING_SERVER = 0 ; ;
--extern) USE_RUNNING_SERVER = 1 ; ;
2004-04-14 17:16:31 +02:00
--with-ndbcluster)
2004-04-15 12:03:13 +02:00
USE_NDBCLUSTER = "--ndbcluster" ; ;
2006-01-12 19:51:02 +01:00
--with-ndbcluster-slave)
USE_NDBCLUSTER_SLAVE = "--ndbcluster" ; ;
2006-01-16 22:47:19 +01:00
--with-ndbcluster-all)
USE_NDBCLUSTER = "--ndbcluster"
USE_NDBCLUSTER_SLAVE = "--ndbcluster"
USE_NDBCLUSTER_ALL = 1 ; ;
2006-01-17 08:25:52 +01:00
--with-ndbcluster-only)
USE_NDBCLUSTER = "--ndbcluster"
USE_NDBCLUSTER_SLAVE = "--ndbcluster"
USE_NDBCLUSTER_ONLY = 1 ; ;
2004-09-29 01:40:20 +02:00
--ndb-connectstring= *)
2004-04-15 12:03:13 +02:00
USE_NDBCLUSTER = "--ndbcluster" ;
2004-09-29 01:40:20 +02:00
USE_RUNNING_NDBCLUSTER = ` $ECHO " $1 " | $SED -e "s;--ndb-connectstring=;;" ` ; ;
2006-01-12 19:51:02 +01:00
--ndb-connectstring-slave= *)
USE_NDBCLUSTER_SLAVE = "--ndbcluster" ;
USE_RUNNING_NDBCLUSTER_SLAVE = ` $ECHO " $1 " | $SED -e "s;--ndb-connectstring-slave=;;" ` ; ;
--ndb-extra-test)
NDBCLUSTER_EXTRA_OPTS = " "
NDB_EXTRA_TEST = 1 ;
; ;
2006-01-23 10:42:02 +01:00
--ndb-verbose)
NDB_VERBOSE = 2 ; ;
2005-01-21 12:15:14 +01:00
--ndb_mgm-extra-opts= *)
NDB_MGM_EXTRA_OPTS = ` $ECHO " $1 " | $SED -e "s;--ndb_mgm-extra-opts=;;" ` ; ;
2005-01-19 10:00:41 +01:00
--ndb_mgmd-extra-opts= *)
NDB_MGMD_EXTRA_OPTS = ` $ECHO " $1 " | $SED -e "s;--ndb_mgmd-extra-opts=;;" ` ; ;
--ndbd-extra-opts= *)
NDBD_EXTRA_OPTS = ` $ECHO " $1 " | $SED -e "s;--ndbd-extra-opts=;;" ` ; ;
2001-01-04 01:56:38 +01:00
--tmpdir= *) MYSQL_TMP_DIR = ` $ECHO " $1 " | $SED -e "s;--tmpdir=;;" ` ; ;
2001-11-18 01:23:46 +01:00
--local-master)
MASTER_MYPORT = 3306;
EXTRA_MYSQL_TEST_OPT = " $EXTRA_MYSQL_TEST_OPT --host=127.0.0.1 \
--port= $MYSQL_MYPORT "
LOCAL_MASTER = 1 ; ;
2001-01-04 01:56:38 +01:00
--master_port= *) MASTER_MYPORT = ` $ECHO " $1 " | $SED -e "s;--master_port=;;" ` ; ;
--slave_port= *) SLAVE_MYPORT = ` $ECHO " $1 " | $SED -e "s;--slave_port=;;" ` ; ;
2004-06-24 15:28:15 +02:00
--ndbcluster_port= *) NDBCLUSTER_PORT = ` $ECHO " $1 " | $SED -e "s;--ndbcluster_port=;;" ` ; ;
2006-01-12 19:51:02 +01:00
--ndbcluster-port= *) NDBCLUSTER_PORT = ` $ECHO " $1 " | $SED -e "s;--ndbcluster-port=;;" ` ; ;
--ndbcluster-port-slave= *) NDBCLUSTER_PORT_SLAVE = ` $ECHO " $1 " | $SED -e "s;--ndbcluster-port-slave=;;" ` ; ;
2001-08-31 19:22:18 +02:00
--with-openssl)
EXTRA_MASTER_MYSQLD_OPT = " $EXTRA_MASTER_MYSQLD_OPT \
2005-06-09 15:19:10 +02:00
--ssl-ca= $MYSQL_TEST_DIR /std_data/cacert.pem \
--ssl-cert= $MYSQL_TEST_DIR /std_data/server-cert.pem \
--ssl-key= $MYSQL_TEST_DIR /std_data/server-key.pem"
2001-08-31 19:22:18 +02:00
EXTRA_SLAVE_MYSQLD_OPT = " $EXTRA_SLAVE_MYSQLD_OPT \
2005-06-09 15:19:10 +02:00
--ssl-ca= $MYSQL_TEST_DIR /std_data/cacert.pem \
--ssl-cert= $MYSQL_TEST_DIR /std_data/server-cert.pem \
--ssl-key= $MYSQL_TEST_DIR /std_data/server-key.pem"
2005-06-24 11:56:20 +02:00
MYSQL_TEST_SSL_OPTS = " --ssl-ca= $MYSQL_TEST_DIR /std_data/cacert.pem \
2005-06-09 15:19:10 +02:00
--ssl-cert= $MYSQL_TEST_DIR /std_data/client-cert.pem \
--ssl-key= $MYSQL_TEST_DIR /std_data/client-key.pem" ;;
2001-11-11 06:24:12 +01:00
--start-and-exit)
START_AND_EXIT = 1
2001-12-10 17:16:51 +01:00
; ;
2003-11-02 13:00:25 +01:00
--socket= *) LOCAL_SOCKET = ` $ECHO " $1 " | $SED -e "s;--socket=;;" ` ; ;
2001-01-05 12:13:15 +01:00
--skip-rpl) NO_SLAVE = 1 ; ;
2001-06-20 00:08:19 +02:00
--skip-test= *) SKIP_TEST = ` $ECHO " $1 " | $SED -e "s;--skip-test=;;" ` ; ;
2001-06-27 01:02:33 +02:00
--do-test= *) DO_TEST = ` $ECHO " $1 " | $SED -e "s;--do-test=;;" ` ; ;
2004-05-03 12:10:06 +02:00
--start-from= * ) START_FROM = ` $ECHO " $1 " | $SED -e "s;--start-from=;;" ` ; ;
2002-08-08 02:12:02 +02:00
--warnings | --log-warnings)
EXTRA_MASTER_MYSQLD_OPT = " $EXTRA_MASTER_MYSQLD_OPT --log-warnings "
EXTRA_SLAVE_MYSQLD_OPT = " $EXTRA_SLAVE_MYSQLD_OPT --log-warnings "
; ;
2001-09-28 07:05:54 +02:00
--wait-timeout= *)
START_WAIT_TIMEOUT = ` $ECHO " $1 " | $SED -e "s;--wait-timeout=;;" `
STOP_WAIT_TIMEOUT = $START_WAIT_TIMEOUT ; ;
2001-01-04 01:56:38 +01:00
--record)
RECORD = 1;
EXTRA_MYSQL_TEST_OPT = " $EXTRA_MYSQL_TEST_OPT $1 " ; ;
2004-09-24 18:58:25 +02:00
--small-bench)
DO_SMALL_BENCH = 1
DO_BENCH = 1
NO_SLAVE = 1
; ;
2001-04-13 20:51:27 +02:00
--bench)
DO_BENCH = 1
NO_SLAVE = 1
2001-12-10 17:16:51 +01:00
; ;
2005-10-18 18:26:31 +02:00
--stress)
DO_STRESS = 1
NO_SLAVE = 1
SKIP_SLAVE = 1
; ;
--stress-suite= *)
STRESS_SUITE = ` $ECHO " $1 " | $SED -e "s;--stress-suite=;;" `
; ;
--stress-threads= *)
STRESS_THREADS = ` $ECHO " $1 " | $SED -e "s;--stress-threads=;;" `
; ;
--stress-test-file= *)
STRESS_TEST_FILE = ` $ECHO " $1 " | $SED -e "s;--stress-test-file=;;" `
; ;
--stress-init-file= *)
STRESS_INIT_FILE = ` $ECHO " $1 " | $SED -e "s;--stress-init-file=;;" `
; ;
--stress-mode= *)
STRESS_MODE = ` $ECHO " $1 " | $SED -e "s;--stress-mode=;;" `
; ;
--stress-loop-count= *)
STRESS_LOOP_COUNT = ` $ECHO " $1 " | $SED -e "s;--stress-loop-count=;;" `
; ;
--stress-test-count= *)
STRESS_TEST_COUNT = ` $ECHO " $1 " | $SED -e "s;--stress-test-count=;;" `
; ;
--stress-test-duration= *)
STRESS_TEST_DURATION = ` $ECHO " $1 " | $SED -e "s;--stress-test-duration=;;" `
; ;
2001-06-24 21:11:00 +02:00
--big*) # Actually --big-test
EXTRA_MYSQL_TEST_OPT = " $EXTRA_MYSQL_TEST_OPT $1 " ; ;
2001-10-04 01:44:18 +02:00
--compress)
EXTRA_MYSQL_TEST_OPT = " $EXTRA_MYSQL_TEST_OPT $1 " ; ;
2001-01-04 01:56:38 +01:00
--sleep= *)
EXTRA_MYSQL_TEST_OPT = " $EXTRA_MYSQL_TEST_OPT $1 "
2001-12-19 14:45:04 +01:00
SLEEP_TIME_AFTER_RESTART = ` $ECHO " $1 " | $SED -e "s;--sleep=;;" `
2001-01-04 01:56:38 +01:00
; ;
2004-10-26 18:30:01 +02:00
--ps-protocol)
2005-01-28 00:35:26 +01:00
TEST_MODE = " $TEST_MODE ps-protocol " EXTRA_MYSQL_TEST_OPT = " $EXTRA_MYSQL_TEST_OPT $1 " ; ;
2002-02-15 22:02:48 +01:00
--user-test= *)
USER_TEST = ` $ECHO " $1 " | $SED -e "s;--user-test=;;" `
; ;
2001-06-06 23:10:59 +02:00
--mysqld= *)
2001-07-27 20:39:48 +02:00
TMP = ` $ECHO " $1 " | $SED -e "s;--mysqld=;;" `
2001-09-03 04:16:15 +02:00
EXTRA_MASTER_MYSQLD_OPT = " $EXTRA_MASTER_MYSQLD_OPT $TMP "
2001-06-12 17:00:36 +02:00
EXTRA_SLAVE_MYSQLD_OPT = " $EXTRA_SLAVE_MYSQLD_OPT $TMP "
2001-06-06 23:10:59 +02:00
; ;
2001-01-04 01:56:38 +01:00
--gcov )
if [ x$BINARY_DIST = x1 ] ; then
$ECHO "Cannot do coverage test without the source - please use source dist"
exit 1
fi
DO_GCOV = 1
2002-09-23 21:30:08 +02:00
GCOV = ` which gcov`
2001-01-04 01:56:38 +01:00
; ;
2001-04-10 02:25:06 +02:00
--gprof )
DO_GPROF = 1
2001-12-10 17:16:51 +01:00
; ;
2001-01-04 01:56:38 +01:00
--gdb )
2001-09-28 07:05:54 +02:00
START_WAIT_TIMEOUT = 300
STOP_WAIT_TIMEOUT = 300
2001-01-04 01:56:38 +01:00
if [ x$BINARY_DIST = x1 ] ; then
2001-06-09 03:24:41 +02:00
$ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --gdb option"
2001-01-04 01:56:38 +01:00
fi
DO_GDB = 1
2004-03-10 12:46:11 +01:00
EXTRA_MASTER_MYSQLD_OPT = " $EXTRA_MASTER_MYSQLD_OPT --gdb "
EXTRA_SLAVE_MYSQLD_OPT = " $EXTRA_SLAVE_MYSQLD_OPT --gdb "
2001-12-13 01:31:19 +01:00
# This needs to be checked properly
# USE_MANAGER=1
2005-01-26 10:19:28 +01:00
USE_RUNNING_SERVER = 0
2001-01-04 01:56:38 +01:00
; ;
2001-06-09 03:24:41 +02:00
--client-gdb )
if [ x$BINARY_DIST = x1 ] ; then
$ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --client-gdb option"
fi
DO_CLIENT_GDB = 1
2003-06-10 20:42:29 +02:00
EXTRA_MASTER_MYSQLD_OPT = " $EXTRA_MASTER_MYSQLD_OPT --gdb "
EXTRA_SLAVE_MYSQLD_OPT = " $EXTRA_SLAVE_MYSQLD_OPT --gdb "
2001-06-09 03:24:41 +02:00
; ;
2001-12-17 02:02:58 +01:00
--manual-gdb )
DO_GDB = 1
MANUAL_GDB = 1
2005-01-26 10:19:28 +01:00
USE_RUNNING_SERVER = 0
2003-06-10 20:42:29 +02:00
EXTRA_MASTER_MYSQLD_OPT = " $EXTRA_MASTER_MYSQLD_OPT --gdb "
EXTRA_SLAVE_MYSQLD_OPT = " $EXTRA_SLAVE_MYSQLD_OPT --gdb "
2001-12-17 02:02:58 +01:00
; ;
2001-01-04 01:56:38 +01:00
--ddd )
if [ x$BINARY_DIST = x1 ] ; then
2001-06-09 03:24:41 +02:00
$ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --ddd option"
2001-01-04 01:56:38 +01:00
fi
DO_DDD = 1
2005-01-26 10:19:28 +01:00
USE_RUNNING_SERVER = 0
2003-06-10 20:42:29 +02:00
EXTRA_MASTER_MYSQLD_OPT = " $EXTRA_MASTER_MYSQLD_OPT --gdb "
EXTRA_SLAVE_MYSQLD_OPT = " $EXTRA_SLAVE_MYSQLD_OPT --gdb "
2001-01-04 01:56:38 +01:00
; ;
2003-11-04 13:59:38 +01:00
--valgrind | --valgrind-all)
2005-12-06 21:34:35 +01:00
find_valgrind;
VALGRIND = $FIND_VALGRIND
2006-08-10 10:50:37 +02:00
EXTRA_MASTER_MYSQLD_OPT = " $EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc "
EXTRA_SLAVE_MYSQLD_OPT = " $EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc "
2003-01-09 10:11:06 +01:00
SLEEP_TIME_AFTER_RESTART = 10
2002-12-02 16:52:22 +01:00
SLEEP_TIME_FOR_DELETE = 60
2005-01-26 10:19:28 +01:00
USE_RUNNING_SERVER = 0
2003-11-04 13:59:38 +01:00
if test " $1 " = "--valgrind-all"
then
VALGRIND = " $VALGRIND -v --show-reachable=yes "
fi
2002-10-29 20:59:03 +01:00
; ;
--valgrind-options= *)
TMP = ` $ECHO " $1 " | $SED -e "s;--valgrind-options=;;" `
VALGRIND = " $VALGRIND $TMP "
; ;
2006-01-12 19:51:02 +01:00
--skip-ndbcluster-slave | --skip-ndb-slave)
USE_NDBCLUSTER_SLAVE = ""
EXTRA_SLAVE_MYSQLD_OPT = " $EXTRA_SLAVE_MYSQLD_OPT --skip-ndbcluster "
; ;
2005-12-06 21:34:35 +01:00
--valgrind-mysqltest | --valgrind-mysqltest-all)
find_valgrind;
VALGRIND_MYSQLTEST = $FIND_VALGRIND
if test " $1 " = "--valgrind-mysqltest-all"
then
VALGRIND_MYSQLTEST = " $VALGRIND_MYSQLTEST -v --show-reachable=yes "
fi
2005-09-14 00:41:44 +02:00
; ;
2005-03-16 00:15:45 +01:00
--skip-ndbcluster | --skip-ndb)
2005-03-07 14:28:09 +01:00
USE_NDBCLUSTER = ""
2006-01-12 19:51:02 +01:00
USE_NDBCLUSTER_SLAVE = ""
2005-03-16 14:32:43 +01:00
EXTRA_MASTER_MYSQLD_OPT = " $EXTRA_MASTER_MYSQLD_OPT --skip-ndbcluster "
EXTRA_SLAVE_MYSQLD_OPT = " $EXTRA_SLAVE_MYSQLD_OPT --skip-ndbcluster "
2005-03-07 14:28:09 +01:00
; ;
2006-01-20 14:50:02 +01:00
--skip-master-binlog) MASTER_MYSQLDBINLOG = 0 ; ;
2006-01-12 19:51:02 +01:00
--skip-slave-binlog) SLAVE_MYSQLDBINLOG = 0 ; ;
2001-03-24 03:59:30 +01:00
--skip-*)
EXTRA_MASTER_MYSQLD_OPT = " $EXTRA_MASTER_MYSQLD_OPT $1 "
EXTRA_SLAVE_MYSQLD_OPT = " $EXTRA_SLAVE_MYSQLD_OPT $1 "
; ;
2001-10-12 17:37:25 +02:00
--strace-client )
STRACE_CLIENT = 1
2001-12-10 17:16:51 +01:00
; ;
2001-01-04 01:56:38 +01:00
--debug)
2005-02-09 16:23:22 +01:00
EXTRA_MASTER_MYSQLD_TRACE = " \
2003-01-07 15:53:10 +01:00
--debug= d:t:i:A,$MYSQL_TEST_DIR /var/log/master.trace"
2001-03-24 03:59:30 +01:00
EXTRA_SLAVE_MYSQLD_OPT = " $EXTRA_SLAVE_MYSQLD_OPT \
2003-01-07 15:53:10 +01:00
--debug= d:t:i:A,$MYSQL_TEST_DIR /var/log/slave.trace"
2003-03-04 11:22:35 +01:00
EXTRA_MYSQL_TEST_OPT = " $EXTRA_MYSQL_TEST_OPT \
--debug= d:t:A,$MYSQL_TEST_DIR /var/log/mysqltest.trace"
2005-10-18 11:25:03 +02:00
EXTRA_MYSQLCHECK_OPT = " $EXTRA_MYSQLCHECK_OPT \
--debug= d:t:A,$MYSQL_TEST_DIR /var/log/mysqlcheck.trace"
2003-12-21 18:39:32 +01:00
EXTRA_MYSQLDUMP_OPT = " $EXTRA_MYSQLDUMP_OPT \
--debug= d:t:A,$MYSQL_TEST_DIR /var/log/mysqldump.trace"
2005-11-30 01:02:21 +01:00
EXTRA_MYSQLSLAP_OPT = " $EXTRA_MYSQLSLAP_OPT \
--debug= d:t:A,$MYSQL_TEST_DIR /var/log/mysqlslap.trace"
2005-03-15 19:46:43 +01:00
EXTRA_MYSQLSHOW_OPT = " $EXTRA_MYSQLSHOW_OPT \
--debug= d:t:A,$MYSQL_TEST_DIR /var/log/mysqlshow.trace"
2003-12-21 18:39:32 +01:00
EXTRA_MYSQLBINLOG_OPT = " $EXTRA_MYSQLBINLOG_OPT \
--debug= d:t:A,$MYSQL_TEST_DIR /var/log/mysqlbinlog.trace"
2005-02-22 11:51:23 +01:00
EXTRA_MYSQL_CLIENT_TEST_OPT = " --debug=d:t:A, $MYSQL_TEST_DIR /var/log/mysql_client_test.trace "
2001-01-04 01:56:38 +01:00
; ;
2002-12-05 02:40:33 +01:00
--fast)
FAST_START = 1
; ;
2005-01-15 11:28:38 +01:00
--use-old-data)
2006-03-01 13:29:37 +01:00
USE_OLD_DATA = 1
; ;
2006-03-01 12:21:44 +01:00
--comment= *)
TMP = ` $ECHO " $1 " | $SED -e "s;--comment=;;" `
echo
echo '############################################'
echo " # $TMP "
echo '############################################'
2005-01-15 11:28:38 +01:00
; ;
2001-01-04 01:56:38 +01:00
-- ) shift; break ; ;
--* ) $ECHO " Unrecognized option: $1 " ; exit 1 ; ;
* ) break ; ;
esac
shift
done
2000-12-13 17:58:26 +01:00
2005-01-28 00:35:26 +01:00
if [ -z " $TEST_MODE " ] ; then
TEST_MODE = "default"
else
# Remove the leading space if any
TEST_MODE = ` echo $TEST_MODE | sed 's/^ *//' `
fi
2007-05-31 16:45:22 +02:00
#
# Skip tests that doesn't work with shell version
#
SKIP_TEST = " $SKIP_TEST bootstrap "
2000-07-31 21:29:14 +02:00
#++
# mysqld Environment Parameters
#--
2001-01-04 01:56:38 +01:00
2000-12-28 18:25:41 +01:00
MYRUN_DIR = $MYSQL_TEST_DIR /var/run
2001-11-08 00:17:40 +01:00
2001-04-21 16:12:59 +02:00
MASTER_MYDDIR = " $MYSQL_TEST_DIR /var/master-data "
2001-10-04 20:52:41 +02:00
MASTER_MYSOCK = " $MYSQL_TMP_DIR /master.sock "
2004-09-28 21:12:44 +02:00
MASTER_MYSOCK1 = $MYSQL_MYSOCK "1"
2001-12-18 04:34:00 +01:00
MASTER_MYPID = " $MYRUN_DIR /master.pid "
MASTER_MYLOG = " $MYSQL_TEST_DIR /var/log/master.log "
MASTER_MYERR = " $MYSQL_TEST_DIR /var/log/master.err "
2000-12-07 15:54:59 +01:00
SLAVE_MYDDIR = " $MYSQL_TEST_DIR /var/slave-data "
2001-10-04 20:52:41 +02:00
SLAVE_MYSOCK = " $MYSQL_TMP_DIR /slave.sock "
2001-12-18 04:34:00 +01:00
SLAVE_MYPID = " $MYRUN_DIR /slave.pid "
SLAVE_MYLOG = " $MYSQL_TEST_DIR /var/log/slave.log "
SLAVE_MYERR = " $MYSQL_TEST_DIR /var/log/slave.err "
2000-12-07 15:54:59 +01:00
2002-08-22 15:50:58 +02:00
CURRENT_TEST = " $MYSQL_TEST_DIR /var/log/current_test "
2003-11-03 13:01:59 +01:00
SMALL_SERVER = "--key_buffer_size=1M --sort_buffer=256K --max_heap_table_size=1M"
2001-01-07 23:04:30 +01:00
2006-01-12 19:51:02 +01:00
export MASTER_MYHOST MASTER_MYPORT SLAVE_MYHOST SLAVE_MYPORT MYSQL_TCP_PORT MASTER_MYSOCK MASTER_MYSOCK1
2001-04-18 07:06:00 +02:00
2005-02-09 19:29:37 +01:00
NDBCLUSTER_OPTS = " --port= $NDBCLUSTER_PORT --data-dir= $MYSQL_TEST_DIR /var --ndb_mgm-extra-opts= $NDB_MGM_EXTRA_OPTS --ndb_mgmd-extra-opts= $NDB_MGMD_EXTRA_OPTS --ndbd-extra-opts= $NDBD_EXTRA_OPTS "
2006-01-12 19:51:02 +01:00
NDBCLUSTER_OPTS_SLAVE = " --port= $NDBCLUSTER_PORT_SLAVE --data-dir= $MYSQL_TEST_DIR /var "
if [ -n " $USE_NDBCLUSTER_SLAVE " ] ; then
2006-02-06 15:42:26 +01:00
USE_NDBCLUSTER_SLAVE = " $USE_NDBCLUSTER_SLAVE --ndb-connectstring=localhost: $NDBCLUSTER_PORT_SLAVE --ndb-extra-logging "
2006-01-12 19:51:02 +01:00
fi
2005-01-24 13:06:27 +01:00
NDB_BACKUP_DIR = $MYSQL_TEST_DIR /var/ndbcluster-$NDBCLUSTER_PORT
2005-02-01 17:08:39 +01:00
NDB_TOOLS_OUTPUT = $MYSQL_TEST_DIR /var/log/ndb_tools.log
2004-11-10 17:05:28 +01:00
2000-12-07 15:54:59 +01:00
if [ x$SOURCE_DIST = x1 ] ; then
MY_BASEDIR = $MYSQL_TEST_DIR
else
MY_BASEDIR = $BASEDIR
2001-12-10 17:16:51 +01:00
fi
2000-07-31 21:29:14 +02:00
2000-12-28 18:25:41 +01:00
# Create the directories
# This should be fixed to be not be dependent on the contence of MYSQL_TMP_DIR
# or MYRUN_DIR
# (mkdir -p is not portable)
[ -d $MYSQL_TEST_DIR /var ] || mkdir $MYSQL_TEST_DIR /var
[ -d $MYSQL_TEST_DIR /var/tmp ] || mkdir $MYSQL_TEST_DIR /var/tmp
[ -d $MYSQL_TEST_DIR /var/run ] || mkdir $MYSQL_TEST_DIR /var/run
2002-10-29 21:56:30 +01:00
[ -d $MYSQL_TEST_DIR /var/log ] || mkdir $MYSQL_TEST_DIR /var/log
2006-04-19 16:23:35 +02:00
# Use 'test', not '[' as the shell builtin might not have '-L
if test ! -L " $MYSQL_TEST_DIR /var/std_data_ln " ; then
2006-01-31 10:48:40 +01:00
ln -s $MYSQL_TEST_DIR /std_data/ $MYSQL_TEST_DIR /var/std_data_ln
fi
2001-12-23 01:43:46 +01:00
if test ${ COLUMNS :- 0 } -lt 80 ; then COLUMNS = 80 ; fi
2000-12-20 13:39:27 +01:00
E = ` $EXPR $COLUMNS - 8`
2004-09-27 17:01:26 +02:00
DASH72 = ` $ECHO '-------------------------------------------------------' | $CUT -c 1-$E `
2000-12-20 13:39:27 +01:00
2000-12-07 15:54:59 +01:00
# on source dist, we pick up freshly build executables
# on binary, use what is installed
if [ x$SOURCE_DIST = x1 ] ; then
2004-09-27 17:01:26 +02:00
if [ " x $USE_EMBEDDED_SERVER " = "x1" ] ; then
2005-01-24 16:56:17 +01:00
if [ -f " $BASEDIR /libmysqld/examples/mysqltest_embedded " ] ; then
2005-12-06 21:34:35 +01:00
MYSQL_TEST = " $BASEDIR /libmysqld/examples/mysqltest_embedded "
2004-09-27 17:01:26 +02:00
else
2005-01-24 16:56:17 +01:00
echo "Fatal error: Cannot find embedded server 'mysqltest_embedded'" 1>& 2
2004-09-27 17:01:26 +02:00
exit 1
fi
2005-01-24 16:56:17 +01:00
MYSQL_CLIENT_TEST = " $BASEDIR /libmysqld/examples/mysql_client_test_embedded "
2001-07-13 13:58:25 +02:00
else
2005-01-28 00:35:26 +01:00
MYSQLD = " $BASEDIR /sql/mysqld "
if [ -n " $VALGRIND " ] ; then
MYSQLD = " $VALGRIND $MYSQLD "
fi
2004-09-27 17:01:26 +02:00
if [ -f " $BASEDIR /client/.libs/lt-mysqltest " ] ; then
MYSQL_TEST = " $BASEDIR /client/.libs/lt-mysqltest "
elif [ -f " $BASEDIR /client/.libs/mysqltest " ] ; then
MYSQL_TEST = " $BASEDIR /client/.libs/mysqltest "
else
MYSQL_TEST = " $BASEDIR /client/mysqltest "
fi
2005-01-24 16:56:17 +01:00
MYSQL_CLIENT_TEST = " $BASEDIR /tests/mysql_client_test "
2001-07-13 13:58:25 +02:00
fi
2005-10-18 11:25:03 +02:00
if [ -f " $BASEDIR /client/.libs/mysqlcheck " ] ; then
MYSQL_CHECK = " $BASEDIR /client/.libs/mysqlcheck "
else
MYSQL_CHECK = " $BASEDIR /client/mysqlcheck "
fi
2003-09-08 07:53:51 +02:00
if [ -f " $BASEDIR /client/.libs/mysqldump " ] ; then
2003-10-07 14:44:31 +02:00
MYSQL_DUMP = " $BASEDIR /client/.libs/mysqldump "
2003-09-08 07:53:51 +02:00
else
2003-10-07 14:44:31 +02:00
MYSQL_DUMP = " $BASEDIR /client/mysqldump "
2003-09-08 07:53:51 +02:00
fi
2005-11-30 01:02:21 +01:00
if [ -f " $BASEDIR /client/.libs/mysqlslap " ] ; then
MYSQL_SLAP = " $BASEDIR /client/.libs/mysqlslap "
else
MYSQL_SLAP = " $BASEDIR /client/mysqlslap "
fi
2005-10-25 23:50:08 +02:00
if [ -f " $BASEDIR /client/.libs/mysqlimport " ] ; then
MYSQL_IMPORT = " $BASEDIR /client/.libs/mysqlimport "
else
MYSQL_IMPORT = " $BASEDIR /client/mysqlimport "
fi
2005-03-15 19:46:43 +01:00
if [ -f " $BASEDIR /client/.libs/mysqlshow " ] ; then
MYSQL_SHOW = " $BASEDIR /client/.libs/mysqlshow "
else
MYSQL_SHOW = " $BASEDIR /client/mysqlshow "
fi
2003-09-24 13:46:19 +02:00
if [ -f " $BASEDIR /client/.libs/mysqlbinlog " ] ; then
2003-10-07 14:44:31 +02:00
MYSQL_BINLOG = " $BASEDIR /client/.libs/mysqlbinlog "
2003-09-24 13:46:19 +02:00
else
2003-10-07 14:44:31 +02:00
MYSQL_BINLOG = " $BASEDIR /client/mysqlbinlog "
2003-10-08 11:01:58 +02:00
fi
2001-10-12 17:37:25 +02:00
if [ -n " $STRACE_CLIENT " ] ; then
MYSQL_TEST = " strace -o $MYSQL_TEST_DIR /var/log/mysqltest.strace $MYSQL_TEST "
fi
2001-12-10 17:16:51 +01:00
2004-03-19 13:52:48 +01:00
CLIENT_BINDIR = " $BASEDIR /client "
MYSQLADMIN = " $CLIENT_BINDIR /mysqladmin "
2003-01-07 15:53:10 +01:00
WAIT_PID = " $BASEDIR /extra/mysql_waitpid "
2005-09-09 09:51:43 +02:00
MYSQL_MY_PRINT_DEFAULTS = " $BASEDIR /extra/my_print_defaults "
2004-03-19 13:52:48 +01:00
MYSQL = " $CLIENT_BINDIR /mysql "
2001-06-25 10:35:22 +02:00
LANGUAGE = " $BASEDIR /sql/share/english/ "
2001-09-07 00:05:04 +02:00
CHARSETSDIR = " $BASEDIR /sql/share/charsets "
2000-12-07 15:54:59 +01:00
INSTALL_DB = "./install_test_db"
2004-03-10 19:54:07 +01:00
MYSQL_FIX_SYSTEM_TABLES = " $BASEDIR /scripts/mysql_fix_privilege_tables "
2005-04-27 04:04:36 +02:00
NDB_TOOLS_DIR = " $BASEDIR /storage/ndb/tools "
NDB_MGM = " $BASEDIR /storage/ndb/src/mgmclient/ndb_mgm "
2005-01-28 00:35:26 +01:00
if [ -n " $USE_PURIFY " ] ; then
2005-05-15 06:59:34 +02:00
PSUP = " $MYSQL_TEST_DIR /suppress.purify "
2005-01-28 00:35:26 +01:00
PURIFYOPTIONS = " -windows=no -log-file=%v.purifylog -append-logfile -add-suppression-files= $PSUP "
if [ -f " ${ MYSQL_TEST } -purify " ] ; then
MYSQL_TEST = " ${ MYSQL_TEST } -purify "
PLOG = " $MYSQL_TEST .purifylog "
if [ -f $PLOG ] ; then
mv $PLOG $PLOG .$$
fi
PURIFY_LOGS = " $PLOG "
fi
if [ -f " ${ MYSQLD } -purify " ] ; then
MYSQLD = " ${ MYSQLD } -purify "
PLOG = " $MYSQLD .purifylog "
if [ -f $PLOG ] ; then
mv $PLOG $PLOG .$$
fi
PURIFY_LOGS = " $PURIFY_LOGS $PLOG "
fi
fi
2000-12-07 15:54:59 +01:00
else
2005-01-24 16:56:17 +01:00
# We have a binary installation. Note that this can be both from
# unpacking a MySQL AB binary distribution (created using
# "scripts/make_binary_distribution", and from a "make install".
# Unfortunately the structure differs a bit, for a "make install"
# currently all binaries are in "bin", for a MySQL AB packaging
# some are in "tests".
2002-08-21 21:04:22 +02:00
if test -x " $BASEDIR /libexec/mysqld "
then
2002-10-29 20:59:03 +01:00
MYSQLD = " $VALGRIND $BASEDIR /libexec/mysqld "
2006-11-01 20:17:10 +01:00
elif test -x " $BASEDIR /bin/mysqld "
then
2002-10-29 20:59:03 +01:00
MYSQLD = " $VALGRIND $BASEDIR /bin/mysqld "
2006-11-01 20:17:10 +01:00
elif test -x " $BASEDIR /sbin/mysqld "
then
MYSQLD = " $VALGRIND $BASEDIR /sbin/mysqld "
else
$ECHO " Fatal error: Cannot find program mysqld in $BASEDIR /{libexec,bin,sbin} " 1>& 2
exit 1
2002-08-21 21:04:22 +02:00
fi
2004-03-19 13:52:48 +01:00
CLIENT_BINDIR = " $BASEDIR /bin "
2005-01-14 18:57:50 +01:00
if test -d " $BASEDIR /tests "
then
TESTS_BINDIR = " $BASEDIR /tests "
else
TESTS_BINDIR = " $BASEDIR /bin "
fi
2004-03-19 13:52:48 +01:00
MYSQL_TEST = " $CLIENT_BINDIR /mysqltest "
2005-10-18 11:25:03 +02:00
MYSQL_CHECK = " $CLIENT_BINDIR /mysqlcheck "
2005-11-30 01:02:21 +01:00
MYSQL_SLAP = " $CLIENT_BINDIR /mysqlslap "
2005-03-15 19:46:43 +01:00
MYSQL_SHOW = " $CLIENT_BINDIR /mysqlshow "
2005-10-25 23:50:08 +02:00
MYSQL_IMPORT = " $CLIENT_BINDIR /mysqlimport "
2004-03-19 13:52:48 +01:00
MYSQL_BINLOG = " $CLIENT_BINDIR /mysqlbinlog "
MYSQLADMIN = " $CLIENT_BINDIR /mysqladmin "
WAIT_PID = " $CLIENT_BINDIR /mysql_waitpid "
2005-09-09 09:51:43 +02:00
MYSQL_MY_PRINT_DEFAULTS = " $CLIENT_BINDIR /my_print_defaults "
2004-03-19 13:52:48 +01:00
MYSQL = " $CLIENT_BINDIR /mysql "
2004-03-12 00:10:22 +01:00
INSTALL_DB = "./install_test_db --bin"
2004-03-19 13:52:48 +01:00
MYSQL_FIX_SYSTEM_TABLES = " $CLIENT_BINDIR /mysql_fix_privilege_tables "
2004-09-13 14:27:58 +02:00
NDB_TOOLS_DIR = " $CLIENT_BINDIR "
2005-01-20 13:45:42 +01:00
NDB_MGM = " $CLIENT_BINDIR /ndb_mgm "
2001-12-10 17:16:51 +01:00
if test -d " $BASEDIR /share/mysql/english "
2001-06-25 10:35:22 +02:00
then
LANGUAGE = " $BASEDIR /share/mysql/english/ "
2001-09-07 00:05:04 +02:00
CHARSETSDIR = " $BASEDIR /share/mysql/charsets "
2001-06-25 10:35:22 +02:00
else
LANGUAGE = " $BASEDIR /share/english/ "
2001-09-07 00:05:04 +02:00
CHARSETSDIR = " $BASEDIR /share/charsets "
2005-01-24 16:56:17 +01:00
fi
if [ " x $USE_EMBEDDED_SERVER " = "x1" ] ; then
if [ -f " $CLIENT_BINDIR /mysqltest_embedded " ] ; then
2005-12-06 21:34:35 +01:00
MYSQL_TEST = " $CLIENT_BINDIR /mysqltest_embedded "
2005-01-24 16:56:17 +01:00
else
echo "Fatal error: Cannot find embedded server 'mysqltest_embedded'" 1>& 2
exit 1
fi
if [ -d " $BASEDIR /tests/mysql_client_test_embedded " ] ; then
MYSQL_CLIENT_TEST = " $TESTS_BINDIR /mysql_client_test_embedded "
else
MYSQL_CLIENT_TEST = " $CLIENT_BINDIR /mysql_client_test_embedded "
fi
else
2005-12-06 21:34:35 +01:00
MYSQL_TEST = " $CLIENT_BINDIR /mysqltest "
2005-01-24 16:56:17 +01:00
MYSQL_CLIENT_TEST = " $CLIENT_BINDIR /mysql_client_test "
fi
2006-01-12 19:51:02 +01:00
if [ -f " $BASEDIR /client/.libs/mysqldump " ] ; then
MYSQL_DUMP = " $BASEDIR /client/.libs/mysqldump "
elif [ -f " $BASEDIR /client/mysqldump " ] ; then
MYSQL_DUMP = " $BASEDIR /client/mysqldump "
else
MYSQL_DUMP = " $BASEDIR /bin/mysqldump "
fi
2000-12-07 15:54:59 +01:00
fi
2002-02-09 21:58:53 +01:00
if [ -z " $MASTER_MYSQLD " ]
then
MASTER_MYSQLD = $MYSQLD
fi
if [ -z " $SLAVE_MYSQLD " ]
then
SLAVE_MYSQLD = $MYSQLD
fi
2001-01-03 15:54:46 +01:00
# If we should run all tests cases, we will use a local server for that
2005-10-18 22:49:31 +02:00
if [ -z " $1 " -a -z " $DO_STRESS " ]
2001-01-03 15:54:46 +01:00
then
2005-01-26 10:19:28 +01:00
USE_RUNNING_SERVER = 0
2001-01-03 15:54:46 +01:00
fi
2005-01-26 10:19:28 +01:00
if [ $USE_RUNNING_SERVER -eq 1 ]
2001-01-04 01:56:38 +01:00
then
2003-11-02 13:00:25 +01:00
MASTER_MYSOCK = $LOCAL_SOCKET ;
2001-01-17 02:15:20 +01:00
DBUSER = ${ DBUSER :- test }
2001-01-16 05:02:05 +01:00
else
2001-01-17 02:15:20 +01:00
DBUSER = ${ DBUSER :- root } # We want to do FLUSH xxx commands
2001-01-04 01:56:38 +01:00
fi
2001-01-03 15:54:46 +01:00
if [ -w / ]
then
2004-03-19 13:52:48 +01:00
# We are running as root; We need to add the --root argument
EXTRA_MASTER_MYSQLD_OPT = " $EXTRA_MASTER_MYSQLD_OPT --user=root "
EXTRA_SLAVE_MYSQLD_OPT = " $EXTRA_SLAVE_MYSQLD_OPT --user=root "
2001-01-03 15:54:46 +01:00
fi
2005-02-22 11:51:23 +01:00
MYSQL_CLIENT_TEST = " $MYSQL_CLIENT_TEST --no-defaults --testcase --user=root --socket= $MASTER_MYSOCK --port= $MYSQL_TCP_PORT --silent $EXTRA_MYSQL_CLIENT_TEST_OPT "
2005-04-28 02:50:48 +02:00
# Need to pass additional arguments to MYSQL_CLIENT_TEST for embedded server
# -A marks each argument for passing to the function which initializes the
# embedded library
if [ " x $USE_EMBEDDED_SERVER " = "x1" ] ; then
MYSQL_CLIENT_TEST = " $MYSQL_CLIENT_TEST -A --language= $LANGUAGE -A --datadir= $SLAVE_MYDDIR -A --character-sets-dir= $CHARSETSDIR "
fi
2005-06-21 14:19:56 +02:00
# Save path and name of mysqldump
MYSQL_DUMP_DIR = " $MYSQL_DUMP "
export MYSQL_DUMP_DIR
2006-11-21 21:32:58 +01:00
MYSQL_CHECK = " $MYSQL_CHECK --no-defaults --debug-info -uroot --socket= $MASTER_MYSOCK --password= $DBPASSWD $EXTRA_MYSQLCHECK_OPT "
MYSQL_DUMP = " $MYSQL_DUMP --no-defaults --debug-info -uroot --socket= $MASTER_MYSOCK --password= $DBPASSWD $EXTRA_MYSQLDUMP_OPT "
2005-11-30 01:02:21 +01:00
MYSQL_SLAP = " $MYSQL_SLAP -uroot --socket= $MASTER_MYSOCK --password= $DBPASSWD $EXTRA_MYSQLSLAP_OPT "
2005-12-22 06:39:02 +01:00
MYSQL_DUMP_SLAVE = " $MYSQL_DUMP_DIR --no-defaults -uroot --socket= $SLAVE_MYSOCK --password= $DBPASSWD $EXTRA_MYSQLDUMP_OPT "
2006-11-21 21:32:58 +01:00
MYSQL_SHOW = " $MYSQL_SHOW --no-defaults --debug-info -uroot --socket= $MASTER_MYSOCK --password= $DBPASSWD $EXTRA_MYSQLSHOW_OPT "
2007-05-31 16:45:22 +02:00
MYSQL_BINLOG = " $MYSQL_BINLOG --no-defaults --debug-info --local-load= $MYSQL_TMP_DIR --character-sets-dir= $CHARSETSDIR $EXTRA_MYSQLBINLOG_OPT "
MYSQL_IMPORT = " $MYSQL_IMPORT --no-defaults --debug-info -uroot --socket= $MASTER_MYSOCK --password= $DBPASSWD $EXTRA_MYSQLDUMP_OPT "
2004-09-03 01:25:27 +02:00
MYSQL_FIX_SYSTEM_TABLES = " $MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port= $MASTER_MYPORT --socket= $MASTER_MYSOCK --user=root --password= $DBPASSWD --basedir= $BASEDIR --bindir= $CLIENT_BINDIR --verbose "
2006-11-21 21:32:58 +01:00
MYSQL = " $MYSQL --no-defaults --debug-info --host=localhost --port= $MASTER_MYPORT --socket= $MASTER_MYSOCK --user=root --password= $DBPASSWD "
2005-12-22 06:39:02 +01:00
export MYSQL MYSQL_CHECK MYSQL_DUMP MYSQL_DUMP_SLAVE MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES MYSQL_IMPORT
2005-09-09 09:51:43 +02:00
export CLIENT_BINDIR MYSQL_CLIENT_TEST CHARSETSDIR MYSQL_MY_PRINT_DEFAULTS
2005-11-30 01:02:21 +01:00
export MYSQL_SLAP
2004-09-13 14:27:58 +02:00
export NDB_TOOLS_DIR
2005-01-20 13:45:42 +01:00
export NDB_MGM
2005-01-24 13:06:27 +01:00
export NDB_BACKUP_DIR
2005-02-01 17:08:39 +01:00
export NDB_TOOLS_OUTPUT
2005-01-28 00:35:26 +01:00
export PURIFYOPTIONS
2005-02-07 17:46:52 +01:00
NDB_STATUS_OK = 1
export NDB_STATUS_OK
2006-01-12 19:51:02 +01:00
NDB_SLAVE_STATUS_OK = 1
export NDB_SLAVE_STATUS_OK
export NDB_EXTRA_TEST NDBCLUSTER_PORT NDBCLUSTER_PORT_SLAVE
2004-09-03 01:25:27 +02:00
2001-10-02 00:13:55 +02:00
MYSQL_TEST_ARGS = " --no-defaults --socket= $MASTER_MYSOCK --database= $DB \
2002-10-29 21:56:30 +01:00
--user= $DBUSER --password= $DBPASSWD --silent -v --skip-safemalloc \
2003-03-11 10:41:53 +01:00
--tmpdir= $MYSQL_TMP_DIR --port= $MASTER_MYPORT $MYSQL_TEST_SSL_OPTS "
2004-09-28 18:25:57 +02:00
if [ x$USE_TIMER = x1 ] ; then
MYSQL_TEST_ARGS = " $MYSQL_TEST_ARGS --timer-file= $MY_LOG_DIR /timer "
fi
2001-06-09 03:24:41 +02:00
MYSQL_TEST_BIN = $MYSQL_TEST
MYSQL_TEST = " $MYSQL_TEST $MYSQL_TEST_ARGS "
2005-12-07 14:54:06 +01:00
# Export MYSQL_TEST variable for use from .test files
2005-07-15 17:51:43 +02:00
export MYSQL_TEST
2005-12-07 14:54:06 +01:00
2001-06-09 03:24:41 +02:00
GDB_CLIENT_INIT = $MYSQL_TMP_DIR /gdbinit.client
2001-01-04 01:56:38 +01:00
GDB_MASTER_INIT = $MYSQL_TMP_DIR /gdbinit.master
GDB_SLAVE_INIT = $MYSQL_TMP_DIR /gdbinit.slave
GCOV_MSG = $MYSQL_TMP_DIR /mysqld-gcov.out
2001-04-10 02:25:06 +02:00
GCOV_ERR = $MYSQL_TMP_DIR /mysqld-gcov.err
GPROF_DIR = $MYSQL_TMP_DIR /gprof
GPROF_MASTER = $GPROF_DIR /master.gprof
GPROF_SLAVE = $GPROF_DIR /slave.gprof
2001-11-05 00:04:08 +01:00
TIMEFILE = " $MYSQL_TEST_DIR /var/log/mysqltest-time "
2005-12-06 21:34:35 +01:00
MYSQLTEST_LOG = " $MYSQL_TEST_DIR /var/log/mysqltest.log "
2002-09-05 15:17:08 +02:00
if [ -n " $DO_CLIENT_GDB " -o -n " $DO_GDB " ] ; then
XTERM = ` which xterm`
fi
2001-01-04 01:56:38 +01:00
2005-10-18 11:25:03 +02:00
export MYSQL MYSQL_CHECK MYSQL_DUMP MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR MASTER_MYSOCK
2004-07-15 03:19:07 +02:00
2000-07-31 21:29:14 +02:00
#++
# Function Definitions
#--
2000-11-21 07:38:08 +01:00
prompt_user ( )
{
2000-12-28 08:26:37 +01:00
$ECHO $1
2000-12-07 15:54:59 +01:00
read unused
2000-11-21 07:38:08 +01:00
}
2001-09-30 21:04:56 +02:00
# We can't use diff -u or diff -a as these are not portable
2001-04-21 16:12:59 +02:00
2001-04-12 21:46:19 +02:00
show_failed_diff ( )
{
reject_file = r/$1 .reject
result_file = r/$1 .result
2001-06-30 21:08:35 +02:00
eval_file = r/$1 .eval
2001-12-10 17:16:51 +01:00
2001-06-30 21:08:35 +02:00
if [ -f $eval_file ]
then
result_file = $eval_file
fi
2001-12-10 17:16:51 +01:00
2001-04-12 21:46:19 +02:00
if [ -x " $DIFF " ] && [ -f $reject_file ]
then
echo "Below are the diffs between actual and expected results:"
echo "-------------------------------------------------------"
2001-09-30 21:04:56 +02:00
$DIFF -c $result_file $reject_file
2001-04-12 21:46:19 +02:00
echo "-------------------------------------------------------"
2001-05-29 12:46:17 +02:00
echo "Please follow the instructions outlined at"
2006-02-28 22:08:16 +01:00
echo "http://dev.mysql.com/doc/mysql/en/reporting-mysqltest-bugs.html"
2001-05-29 12:46:17 +02:00
echo "to find the reason to this problem and how to report this."
2004-07-31 22:39:10 +02:00
echo ""
2001-12-10 17:16:51 +01:00
fi
2001-04-12 21:46:19 +02:00
}
2000-07-31 21:29:14 +02:00
2001-06-09 03:24:41 +02:00
do_gdb_test ( )
{
mysql_test_args = " $MYSQL_TEST_ARGS $1 "
$ECHO " set args $mysql_test_args < $2 " > $GDB_CLIENT_INIT
echo "Set breakpoints ( if needed) and type 'run' in gdb window"
#this xterm should not be backgrounded
2001-11-28 01:55:52 +01:00
$XTERM -title "Client" -e gdb -x $GDB_CLIENT_INIT $MYSQL_TEST_BIN
2001-06-09 03:24:41 +02:00
}
2000-07-31 21:29:14 +02:00
error ( ) {
2000-12-14 18:05:04 +01:00
$ECHO " Error: $1 "
2000-07-31 21:29:14 +02:00
exit 1
}
2000-12-28 08:26:37 +01:00
error_is ( ) {
2003-06-17 16:35:20 +02:00
$ECHO " Errors are (from $TIMEFILE ) : "
$CAT < $TIMEFILE
2004-01-11 18:15:19 +01:00
$ECHO "(the last lines may be the most important ones)"
2000-12-28 08:26:37 +01:00
}
2000-12-15 15:12:31 +01:00
prefix_to_8( ) {
2000-12-28 08:26:37 +01:00
$ECHO " $1 " | $SED -e 's:.*\(........\)$:\1:'
2000-12-15 15:12:31 +01:00
}
2000-07-31 21:29:14 +02:00
pass_inc ( ) {
2000-10-10 10:42:07 +02:00
TOT_PASS = ` $EXPR $TOT_PASS + 1`
2000-07-31 21:29:14 +02:00
}
fail_inc ( ) {
2000-10-10 10:42:07 +02:00
TOT_FAIL = ` $EXPR $TOT_FAIL + 1`
2000-07-31 21:29:14 +02:00
}
2000-12-27 02:31:06 +01:00
skip_inc ( ) {
TOT_SKIP = ` $EXPR $TOT_SKIP + 1`
}
2000-07-31 21:29:14 +02:00
total_inc ( ) {
2000-10-10 10:42:07 +02:00
TOT_TEST = ` $EXPR $TOT_TEST + 1`
2000-07-31 21:29:14 +02:00
}
2002-08-21 21:04:22 +02:00
skip_test( ) {
USERT = " ...."
SYST = " ...."
REALT = " ...."
pname = ` $ECHO " $1 " | $CUT -c 1-24`
2003-05-13 10:39:07 +02:00
RES = " $pname "
2002-08-21 21:04:22 +02:00
skip_inc
$ECHO " $RES $RES_SPACE [ skipped ] "
}
2005-01-25 17:32:09 +01:00
disable_test( ) {
USERT = " ...."
SYST = " ...."
REALT = " ...."
pname = ` $ECHO " $1 " | $CUT -c 1-24`
RES = " $pname "
skip_inc
$ECHO " $RES $RES_SPACE [ disabled ] $2 "
}
2005-01-31 10:24:33 +01:00
2005-01-28 00:35:26 +01:00
report_current_test ( ) {
tname = $1
echo " CURRENT_TEST: $tname " >> $MASTER_MYERR
2006-02-06 15:42:26 +01:00
eval "master1_running=\$MASTER1_RUNNING"
if [ x$master1_running = x1 ] ; then
echo " CURRENT_TEST: $tname " >> $MASTER_MYERR "1"
fi
2005-01-28 00:35:26 +01:00
if [ -n " $PURIFY_LOGS " ] ; then
for log in $PURIFY_LOGS
do
echo " CURRENT_TEST: $tname " >> $log
done
fi
}
2005-01-31 10:24:33 +01:00
2000-07-31 21:29:14 +02:00
report_stats ( ) {
2000-10-10 00:41:21 +02:00
if [ $TOT_FAIL = 0 ] ; then
2000-12-28 18:25:41 +01:00
$ECHO " All $TOT_TEST tests were successful. "
2000-07-31 21:29:14 +02:00
else
2001-12-10 17:16:51 +01:00
xten = ` $EXPR $TOT_PASS \* 10000`
raw = ` $EXPR $xten / $TOT_TEST `
raw = ` $PRINTF %.4d $raw `
whole = ` $PRINTF %.2s $raw `
xwhole = ` $EXPR $whole \* 100`
deci = ` $EXPR $raw - $xwhole `
2005-03-03 13:04:44 +01:00
$ECHO " Failed ${ TOT_FAIL } / ${ TOT_TEST } tests, ${ whole } . ${ deci } % were successful. "
2001-03-08 21:27:43 +01:00
$ECHO ""
2002-01-22 23:05:11 +01:00
$ECHO " The log files in $MY_LOG_DIR may give you some hint "
2005-08-26 12:37:35 +02:00
$ECHO "of what went wrong."
2001-03-08 21:27:43 +01:00
$ECHO "If you want to report this error, please read first the documentation at"
2006-02-28 22:08:16 +01:00
$ECHO "http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html"
2000-07-31 21:29:14 +02:00
fi
2003-01-28 07:38:28 +01:00
2005-01-26 10:19:28 +01:00
if [ $USE_RUNNING_SERVER -eq 0 ]
2003-02-10 16:03:27 +01:00
then
2003-01-28 07:38:28 +01:00
# Report if there was any fatal warnings/errors in the log files
#
$RM -f $MY_LOG_DIR /warnings $MY_LOG_DIR /warnings.tmp
# Remove some non fatal warnings from the log files
2006-05-05 19:08:40 +02:00
$SED -e 's!Warning: Table:.* on delete!!g' -e 's!Warning: Setting lower_case_table_names=2!!g' -e 's!Warning: One can only use the --user.*root!!g' -e 's|InnoDB: Warning: we did not need to do crash recovery||g' \
2003-05-15 18:35:39 +02:00
$MY_LOG_DIR /*.err \
| $SED -e 's!Warning: Table:.* on rename!!g' \
> $MY_LOG_DIR /warnings.tmp
2003-01-28 07:38:28 +01:00
# Find errors
2006-05-05 19:08:40 +02:00
for i in "^Warning:" "^Error:" "^==.* at 0x" "InnoDB: Warning" "missing DBUG_RETURN" "mysqld: Warning" "Attempting backtrace" "Assertion .* failed"
2003-01-28 07:38:28 +01:00
do
2003-02-10 16:59:16 +01:00
if $GREP " $i " $MY_LOG_DIR /warnings.tmp >> $MY_LOG_DIR /warnings
2003-01-28 07:38:28 +01:00
then
2006-05-04 21:19:31 +02:00
GOT_WARNINGS = 1
2003-01-28 07:38:28 +01:00
fi
done
$RM -f $MY_LOG_DIR /warnings.tmp
2006-05-04 21:19:31 +02:00
if [ $GOT_WARNINGS = "1" ]
2003-01-28 07:38:28 +01:00
then
echo "WARNING: Got errors/warnings while running tests. Please examine"
echo " $MY_LOG_DIR /warnings for details. "
fi
2005-12-08 16:48:37 +01:00
fi # USE_RUNNING_SERVER
# Check valgrind errors from mysqltest
if [ ! -z " $VALGRIND_MYSQLTEST " ]
then
if $GREP "ERROR SUMMARY" $MYSQLTEST_LOG | $GREP -v "0 errors" > /dev/null
then
$ECHO "Valgrind detected errors!"
$GREP "ERROR SUMMARY" $MYSQLTEST_LOG | $GREP -v "0 errors"
$ECHO " See $MYSQLTEST_LOG "
fi
2003-02-10 16:03:27 +01:00
fi
2000-07-31 21:29:14 +02:00
}
2000-10-11 15:50:13 +02:00
2000-07-31 21:29:14 +02:00
mysql_install_db ( ) {
2000-12-28 08:26:37 +01:00
$ECHO "Removing Stale Files"
2005-01-15 11:28:38 +01:00
if [ -z " $USE_OLD_DATA " ] ; then
$RM -rf $MASTER_MYDDIR $MASTER_MYDDIR "1"
$ECHO "Installing Master Databases"
$INSTALL_DB
if [ $? != 0 ] ; then
2000-11-18 07:35:40 +01:00
error "Could not install master test DBs"
2005-01-15 11:28:38 +01:00
exit 1
fi
2000-11-18 07:35:40 +01:00
fi
2004-09-28 19:04:30 +02:00
if [ ! -z " $USE_NDBCLUSTER " ]
then
$ECHO "Installing Master Databases 1"
This changeset is largely a handler cleanup changeset (WL#3281), but includes fixes and cleanups that was found necessary while testing the handler changes
Changes that requires code changes in other code of other storage engines.
(Note that all changes are very straightforward and one should find all issues
by compiling a --debug build and fixing all compiler errors and all
asserts in field.cc while running the test suite),
- New optional handler function introduced: reset()
This is called after every DML statement to make it easy for a handler to
statement specific cleanups.
(The only case it's not called is if force the file to be closed)
- handler::extra(HA_EXTRA_RESET) is removed. Code that was there before
should be moved to handler::reset()
- table->read_set contains a bitmap over all columns that are needed
in the query. read_row() and similar functions only needs to read these
columns
- table->write_set contains a bitmap over all columns that will be updated
in the query. write_row() and update_row() only needs to update these
columns.
The above bitmaps should now be up to date in all context
(including ALTER TABLE, filesort()).
The handler is informed of any changes to the bitmap after
fix_fields() by calling the virtual function
handler::column_bitmaps_signal(). If the handler does caching of
these bitmaps (instead of using table->read_set, table->write_set),
it should redo the caching in this code. as the signal() may be sent
several times, it's probably best to set a variable in the signal
and redo the caching on read_row() / write_row() if the variable was
set.
- Removed the read_set and write_set bitmap objects from the handler class
- Removed all column bit handling functions from the handler class.
(Now one instead uses the normal bitmap functions in my_bitmap.c instead
of handler dedicated bitmap functions)
- field->query_id is removed. One should instead instead check
table->read_set and table->write_set if a field is used in the query.
- handler::extra(HA_EXTRA_RETRIVE_ALL_COLS) and
handler::extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) are removed. One should now
instead use table->read_set to check for which columns to retrieve.
- If a handler needs to call Field->val() or Field->store() on columns
that are not used in the query, one should install a temporary
all-columns-used map while doing so. For this, we provide the following
functions:
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
field->val();
dbug_tmp_restore_column_map(table->read_set, old_map);
and similar for the write map:
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set);
field->val();
dbug_tmp_restore_column_map(table->write_set, old_map);
If this is not done, you will sooner or later hit a DBUG_ASSERT
in the field store() / val() functions.
(For not DBUG binaries, the dbug_tmp_restore_column_map() and
dbug_tmp_restore_column_map() are inline dummy functions and should
be optimized away be the compiler).
- If one needs to temporary set the column map for all binaries (and not
just to avoid the DBUG_ASSERT() in the Field::store() / Field::val()
methods) one should use the functions tmp_use_all_columns() and
tmp_restore_column_map() instead of the above dbug_ variants.
- All 'status' fields in the handler base class (like records,
data_file_length etc) are now stored in a 'stats' struct. This makes
it easier to know what status variables are provided by the base
handler. This requires some trivial variable names in the extra()
function.
- New virtual function handler::records(). This is called to optimize
COUNT(*) if (handler::table_flags() & HA_HAS_RECORDS()) is true.
(stats.records is not supposed to be an exact value. It's only has to
be 'reasonable enough' for the optimizer to be able to choose a good
optimization path).
- Non virtual handler::init() function added for caching of virtual
constants from engine.
- Removed has_transactions() virtual method. Now one should instead return
HA_NO_TRANSACTIONS in table_flags() if the table handler DOES NOT support
transactions.
- The 'xxxx_create_handler()' function now has a MEM_ROOT_root argument
that is to be used with 'new handler_name()' to allocate the handler
in the right area. The xxxx_create_handler() function is also
responsible for any initialization of the object before returning.
For example, one should change:
static handler *myisam_create_handler(TABLE_SHARE *table)
{
return new ha_myisam(table);
}
->
static handler *myisam_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
{
return new (mem_root) ha_myisam(table);
}
- New optional virtual function: use_hidden_primary_key().
This is called in case of an update/delete when
(table_flags() and HA_PRIMARY_KEY_REQUIRED_FOR_DELETE) is defined
but we don't have a primary key. This allows the handler to take precisions
in remembering any hidden primary key to able to update/delete any
found row. The default handler marks all columns to be read.
- handler::table_flags() now returns a ulonglong (to allow for more flags).
- New/changed table_flags()
- HA_HAS_RECORDS Set if ::records() is supported
- HA_NO_TRANSACTIONS Set if engine doesn't support transactions
- HA_PRIMARY_KEY_REQUIRED_FOR_DELETE
Set if we should mark all primary key columns for
read when reading rows as part of a DELETE
statement. If there is no primary key,
all columns are marked for read.
- HA_PARTIAL_COLUMN_READ Set if engine will not read all columns in some
cases (based on table->read_set)
- HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS
Renamed to HA_PRIMARY_KEY_REQUIRED_FOR_POSITION.
- HA_DUPP_POS Renamed to HA_DUPLICATE_POS
- HA_REQUIRES_KEY_COLUMNS_FOR_DELETE
Set this if we should mark ALL key columns for
read when when reading rows as part of a DELETE
statement. In case of an update we will mark
all keys for read for which key part changed
value.
- HA_STATS_RECORDS_IS_EXACT
Set this if stats.records is exact.
(This saves us some extra records() calls
when optimizing COUNT(*))
- Removed table_flags()
- HA_NOT_EXACT_COUNT Now one should instead use HA_HAS_RECORDS if
handler::records() gives an exact count() and
HA_STATS_RECORDS_IS_EXACT if stats.records is exact.
- HA_READ_RND_SAME Removed (no one supported this one)
- Removed not needed functions ha_retrieve_all_cols() and ha_retrieve_all_pk()
- Renamed handler::dupp_pos to handler::dup_pos
- Removed not used variable handler::sortkey
Upper level handler changes:
- ha_reset() now does some overall checks and calls ::reset()
- ha_table_flags() added. This is a cached version of table_flags(). The
cache is updated on engine creation time and updated on open.
MySQL level changes (not obvious from the above):
- DBUG_ASSERT() added to check that column usage matches what is set
in the column usage bit maps. (This found a LOT of bugs in current
column marking code).
- In 5.1 before, all used columns was marked in read_set and only updated
columns was marked in write_set. Now we only mark columns for which we
need a value in read_set.
- Column bitmaps are created in open_binary_frm() and open_table_from_share().
(Before this was in table.cc)
- handler::table_flags() calls are replaced with handler::ha_table_flags()
- For calling field->val() you must have the corresponding bit set in
table->read_set. For calling field->store() you must have the
corresponding bit set in table->write_set. (There are asserts in
all store()/val() functions to catch wrong usage)
- thd->set_query_id is renamed to thd->mark_used_columns and instead
of setting this to an integer value, this has now the values:
MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE
Changed also all variables named 'set_query_id' to mark_used_columns.
- In filesort() we now inform the handler of exactly which columns are needed
doing the sort and choosing the rows.
- The TABLE_SHARE object has a 'all_set' column bitmap one can use
when one needs a column bitmap with all columns set.
(This is used for table->use_all_columns() and other places)
- The TABLE object has 3 column bitmaps:
- def_read_set Default bitmap for columns to be read
- def_write_set Default bitmap for columns to be written
- tmp_set Can be used as a temporary bitmap when needed.
The table object has also two pointer to bitmaps read_set and write_set
that the handler should use to find out which columns are used in which way.
- count() optimization now calls handler::records() instead of using
handler->stats.records (if (table_flags() & HA_HAS_RECORDS) is true).
- Added extra argument to Item::walk() to indicate if we should also
traverse sub queries.
- Added TABLE parameter to cp_buffer_from_ref()
- Don't close tables created with CREATE ... SELECT but keep them in
the table cache. (Faster usage of newly created tables).
New interfaces:
- table->clear_column_bitmaps() to initialize the bitmaps for tables
at start of new statements.
- table->column_bitmaps_set() to set up new column bitmaps and signal
the handler about this.
- table->column_bitmaps_set_no_signal() for some few cases where we need
to setup new column bitmaps but don't signal the handler (as the handler
has already been signaled about these before). Used for the momement
only in opt_range.cc when doing ROR scans.
- table->use_all_columns() to install a bitmap where all columns are marked
as use in the read and the write set.
- table->default_column_bitmaps() to install the normal read and write
column bitmaps, but not signaling the handler about this.
This is mainly used when creating TABLE instances.
- table->mark_columns_needed_for_delete(),
table->mark_columns_needed_for_delete() and
table->mark_columns_needed_for_insert() to allow us to put additional
columns in column usage maps if handler so requires.
(The handler indicates what it neads in handler->table_flags())
- table->prepare_for_position() to allow us to tell handler that it
needs to read primary key parts to be able to store them in
future table->position() calls.
(This replaces the table->file->ha_retrieve_all_pk function)
- table->mark_auto_increment_column() to tell handler are going to update
columns part of any auto_increment key.
- table->mark_columns_used_by_index() to mark all columns that is part of
an index. It will also send extra(HA_EXTRA_KEYREAD) to handler to allow
it to quickly know that it only needs to read colums that are part
of the key. (The handler can also use the column map for detecting this,
but simpler/faster handler can just monitor the extra() call).
- table->mark_columns_used_by_index_no_reset() to in addition to other columns,
also mark all columns that is used by the given key.
- table->restore_column_maps_after_mark_index() to restore to default
column maps after a call to table->mark_columns_used_by_index().
- New item function register_field_in_read_map(), for marking used columns
in table->read_map. Used by filesort() to mark all used columns
- Maintain in TABLE->merge_keys set of all keys that are used in query.
(Simplices some optimization loops)
- Maintain Field->part_of_key_not_clustered which is like Field->part_of_key
but the field in the clustered key is not assumed to be part of all index.
(used in opt_range.cc for faster loops)
- dbug_tmp_use_all_columns(), dbug_tmp_restore_column_map()
tmp_use_all_columns() and tmp_restore_column_map() functions to temporally
mark all columns as usable. The 'dbug_' version is primarily intended
inside a handler when it wants to just call Field:store() & Field::val()
functions, but don't need the column maps set for any other usage.
(ie:: bitmap_is_set() is never called)
- We can't use compare_records() to skip updates for handlers that returns
a partial column set and the read_set doesn't cover all columns in the
write set. The reason for this is that if we have a column marked only for
write we can't in the MySQL level know if the value changed or not.
The reason this worked before was that MySQL marked all to be written
columns as also to be read. The new 'optimal' bitmaps exposed this 'hidden
bug'.
- open_table_from_share() does not anymore setup temporary MEM_ROOT
object as a thread specific variable for the handler. Instead we
send the to-be-used MEMROOT to get_new_handler().
(Simpler, faster code)
Bugs fixed:
- Column marking was not done correctly in a lot of cases.
(ALTER TABLE, when using triggers, auto_increment fields etc)
(Could potentially result in wrong values inserted in table handlers
relying on that the old column maps or field->set_query_id was correct)
Especially when it comes to triggers, there may be cases where the
old code would cause lost/wrong values for NDB and/or InnoDB tables.
- Split thd->options flag OPTION_STATUS_NO_TRANS_UPDATE to two flags:
OPTION_STATUS_NO_TRANS_UPDATE and OPTION_KEEP_LOG.
This allowed me to remove some wrong warnings about:
"Some non-transactional changed tables couldn't be rolled back"
- Fixed handling of INSERT .. SELECT and CREATE ... SELECT that wrongly reset
(thd->options & OPTION_STATUS_NO_TRANS_UPDATE) which caused us to loose
some warnings about
"Some non-transactional changed tables couldn't be rolled back")
- Fixed use of uninitialized memory in ha_ndbcluster.cc::delete_table()
which could cause delete_table to report random failures.
- Fixed core dumps for some tests when running with --debug
- Added missing FN_LIBCHAR in mysql_rm_tmp_tables()
(This has probably caused us to not properly remove temporary files after
crash)
- slow_logs was not properly initialized, which could maybe cause
extra/lost entries in slow log.
- If we get an duplicate row on insert, change column map to read and
write all columns while retrying the operation. This is required by
the definition of REPLACE and also ensures that fields that are only
part of UPDATE are properly handled. This fixed a bug in NDB and
REPLACE where REPLACE wrongly copied some column values from the replaced
row.
- For table handler that doesn't support NULL in keys, we would give an error
when creating a primary key with NULL fields, even after the fields has been
automaticly converted to NOT NULL.
- Creating a primary key on a SPATIAL key, would fail if field was not
declared as NOT NULL.
Cleanups:
- Removed not used condition argument to setup_tables
- Removed not needed item function reset_query_id_processor().
- Field->add_index is removed. Now this is instead maintained in
(field->flags & FIELD_IN_ADD_INDEX)
- Field->fieldnr is removed (use field->field_index instead)
- New argument to filesort() to indicate that it should return a set of
row pointers (not used columns). This allowed me to remove some references
to sql_command in filesort and should also enable us to return column
results in some cases where we couldn't before.
- Changed column bitmap handling in opt_range.cc to be aligned with TABLE
bitmap, which allowed me to use bitmap functions instead of looping over
all fields to create some needed bitmaps. (Faster and smaller code)
- Broke up found too long lines
- Moved some variable declaration at start of function for better code
readability.
- Removed some not used arguments from functions.
(setup_fields(), mysql_prepare_insert_check_table())
- setup_fields() now takes an enum instead of an int for marking columns
usage.
- For internal temporary tables, use handler::write_row(),
handler::delete_row() and handler::update_row() instead of
handler::ha_xxxx() for faster execution.
- Changed some constants to enum's and define's.
- Using separate column read and write sets allows for easier checking
of timestamp field was set by statement.
- Remove calls to free_io_cache() as this is now done automaticly in ha_reset()
- Don't build table->normalized_path as this is now identical to table->path
(after bar's fixes to convert filenames)
- Fixed some missed DBUG_PRINT(.."%lx") to use "0x%lx" to make it easier to
do comparision with the 'convert-dbug-for-diff' tool.
Things left to do in 5.1:
- We wrongly log failed CREATE TABLE ... SELECT in some cases when using
row based logging (as shown by testcase binlog_row_mix_innodb_myisam.result)
Mats has promised to look into this.
- Test that my fix for CREATE TABLE ... SELECT is indeed correct.
(I added several test cases for this, but in this case it's better that
someone else also tests this throughly).
Lars has promosed to do this.
2006-06-04 17:52:22 +02:00
# $INSTALL_DB -1
$RM -rf var/master-data1
mkdir var/master-data1
cp -r var/master-data/* var/master-data1
2004-09-28 19:04:30 +02:00
if [ $? != 0 ] ; then
error "Could not install master test DBs 1"
exit 1
fi
fi
2000-12-28 08:26:37 +01:00
$ECHO "Installing Slave Databases"
2005-01-15 11:28:38 +01:00
$RM -rf $SLAVE_MYDDIR $MY_LOG_DIR /*
This changeset is largely a handler cleanup changeset (WL#3281), but includes fixes and cleanups that was found necessary while testing the handler changes
Changes that requires code changes in other code of other storage engines.
(Note that all changes are very straightforward and one should find all issues
by compiling a --debug build and fixing all compiler errors and all
asserts in field.cc while running the test suite),
- New optional handler function introduced: reset()
This is called after every DML statement to make it easy for a handler to
statement specific cleanups.
(The only case it's not called is if force the file to be closed)
- handler::extra(HA_EXTRA_RESET) is removed. Code that was there before
should be moved to handler::reset()
- table->read_set contains a bitmap over all columns that are needed
in the query. read_row() and similar functions only needs to read these
columns
- table->write_set contains a bitmap over all columns that will be updated
in the query. write_row() and update_row() only needs to update these
columns.
The above bitmaps should now be up to date in all context
(including ALTER TABLE, filesort()).
The handler is informed of any changes to the bitmap after
fix_fields() by calling the virtual function
handler::column_bitmaps_signal(). If the handler does caching of
these bitmaps (instead of using table->read_set, table->write_set),
it should redo the caching in this code. as the signal() may be sent
several times, it's probably best to set a variable in the signal
and redo the caching on read_row() / write_row() if the variable was
set.
- Removed the read_set and write_set bitmap objects from the handler class
- Removed all column bit handling functions from the handler class.
(Now one instead uses the normal bitmap functions in my_bitmap.c instead
of handler dedicated bitmap functions)
- field->query_id is removed. One should instead instead check
table->read_set and table->write_set if a field is used in the query.
- handler::extra(HA_EXTRA_RETRIVE_ALL_COLS) and
handler::extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) are removed. One should now
instead use table->read_set to check for which columns to retrieve.
- If a handler needs to call Field->val() or Field->store() on columns
that are not used in the query, one should install a temporary
all-columns-used map while doing so. For this, we provide the following
functions:
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
field->val();
dbug_tmp_restore_column_map(table->read_set, old_map);
and similar for the write map:
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set);
field->val();
dbug_tmp_restore_column_map(table->write_set, old_map);
If this is not done, you will sooner or later hit a DBUG_ASSERT
in the field store() / val() functions.
(For not DBUG binaries, the dbug_tmp_restore_column_map() and
dbug_tmp_restore_column_map() are inline dummy functions and should
be optimized away be the compiler).
- If one needs to temporary set the column map for all binaries (and not
just to avoid the DBUG_ASSERT() in the Field::store() / Field::val()
methods) one should use the functions tmp_use_all_columns() and
tmp_restore_column_map() instead of the above dbug_ variants.
- All 'status' fields in the handler base class (like records,
data_file_length etc) are now stored in a 'stats' struct. This makes
it easier to know what status variables are provided by the base
handler. This requires some trivial variable names in the extra()
function.
- New virtual function handler::records(). This is called to optimize
COUNT(*) if (handler::table_flags() & HA_HAS_RECORDS()) is true.
(stats.records is not supposed to be an exact value. It's only has to
be 'reasonable enough' for the optimizer to be able to choose a good
optimization path).
- Non virtual handler::init() function added for caching of virtual
constants from engine.
- Removed has_transactions() virtual method. Now one should instead return
HA_NO_TRANSACTIONS in table_flags() if the table handler DOES NOT support
transactions.
- The 'xxxx_create_handler()' function now has a MEM_ROOT_root argument
that is to be used with 'new handler_name()' to allocate the handler
in the right area. The xxxx_create_handler() function is also
responsible for any initialization of the object before returning.
For example, one should change:
static handler *myisam_create_handler(TABLE_SHARE *table)
{
return new ha_myisam(table);
}
->
static handler *myisam_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
{
return new (mem_root) ha_myisam(table);
}
- New optional virtual function: use_hidden_primary_key().
This is called in case of an update/delete when
(table_flags() and HA_PRIMARY_KEY_REQUIRED_FOR_DELETE) is defined
but we don't have a primary key. This allows the handler to take precisions
in remembering any hidden primary key to able to update/delete any
found row. The default handler marks all columns to be read.
- handler::table_flags() now returns a ulonglong (to allow for more flags).
- New/changed table_flags()
- HA_HAS_RECORDS Set if ::records() is supported
- HA_NO_TRANSACTIONS Set if engine doesn't support transactions
- HA_PRIMARY_KEY_REQUIRED_FOR_DELETE
Set if we should mark all primary key columns for
read when reading rows as part of a DELETE
statement. If there is no primary key,
all columns are marked for read.
- HA_PARTIAL_COLUMN_READ Set if engine will not read all columns in some
cases (based on table->read_set)
- HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS
Renamed to HA_PRIMARY_KEY_REQUIRED_FOR_POSITION.
- HA_DUPP_POS Renamed to HA_DUPLICATE_POS
- HA_REQUIRES_KEY_COLUMNS_FOR_DELETE
Set this if we should mark ALL key columns for
read when when reading rows as part of a DELETE
statement. In case of an update we will mark
all keys for read for which key part changed
value.
- HA_STATS_RECORDS_IS_EXACT
Set this if stats.records is exact.
(This saves us some extra records() calls
when optimizing COUNT(*))
- Removed table_flags()
- HA_NOT_EXACT_COUNT Now one should instead use HA_HAS_RECORDS if
handler::records() gives an exact count() and
HA_STATS_RECORDS_IS_EXACT if stats.records is exact.
- HA_READ_RND_SAME Removed (no one supported this one)
- Removed not needed functions ha_retrieve_all_cols() and ha_retrieve_all_pk()
- Renamed handler::dupp_pos to handler::dup_pos
- Removed not used variable handler::sortkey
Upper level handler changes:
- ha_reset() now does some overall checks and calls ::reset()
- ha_table_flags() added. This is a cached version of table_flags(). The
cache is updated on engine creation time and updated on open.
MySQL level changes (not obvious from the above):
- DBUG_ASSERT() added to check that column usage matches what is set
in the column usage bit maps. (This found a LOT of bugs in current
column marking code).
- In 5.1 before, all used columns was marked in read_set and only updated
columns was marked in write_set. Now we only mark columns for which we
need a value in read_set.
- Column bitmaps are created in open_binary_frm() and open_table_from_share().
(Before this was in table.cc)
- handler::table_flags() calls are replaced with handler::ha_table_flags()
- For calling field->val() you must have the corresponding bit set in
table->read_set. For calling field->store() you must have the
corresponding bit set in table->write_set. (There are asserts in
all store()/val() functions to catch wrong usage)
- thd->set_query_id is renamed to thd->mark_used_columns and instead
of setting this to an integer value, this has now the values:
MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE
Changed also all variables named 'set_query_id' to mark_used_columns.
- In filesort() we now inform the handler of exactly which columns are needed
doing the sort and choosing the rows.
- The TABLE_SHARE object has a 'all_set' column bitmap one can use
when one needs a column bitmap with all columns set.
(This is used for table->use_all_columns() and other places)
- The TABLE object has 3 column bitmaps:
- def_read_set Default bitmap for columns to be read
- def_write_set Default bitmap for columns to be written
- tmp_set Can be used as a temporary bitmap when needed.
The table object has also two pointer to bitmaps read_set and write_set
that the handler should use to find out which columns are used in which way.
- count() optimization now calls handler::records() instead of using
handler->stats.records (if (table_flags() & HA_HAS_RECORDS) is true).
- Added extra argument to Item::walk() to indicate if we should also
traverse sub queries.
- Added TABLE parameter to cp_buffer_from_ref()
- Don't close tables created with CREATE ... SELECT but keep them in
the table cache. (Faster usage of newly created tables).
New interfaces:
- table->clear_column_bitmaps() to initialize the bitmaps for tables
at start of new statements.
- table->column_bitmaps_set() to set up new column bitmaps and signal
the handler about this.
- table->column_bitmaps_set_no_signal() for some few cases where we need
to setup new column bitmaps but don't signal the handler (as the handler
has already been signaled about these before). Used for the momement
only in opt_range.cc when doing ROR scans.
- table->use_all_columns() to install a bitmap where all columns are marked
as use in the read and the write set.
- table->default_column_bitmaps() to install the normal read and write
column bitmaps, but not signaling the handler about this.
This is mainly used when creating TABLE instances.
- table->mark_columns_needed_for_delete(),
table->mark_columns_needed_for_delete() and
table->mark_columns_needed_for_insert() to allow us to put additional
columns in column usage maps if handler so requires.
(The handler indicates what it neads in handler->table_flags())
- table->prepare_for_position() to allow us to tell handler that it
needs to read primary key parts to be able to store them in
future table->position() calls.
(This replaces the table->file->ha_retrieve_all_pk function)
- table->mark_auto_increment_column() to tell handler are going to update
columns part of any auto_increment key.
- table->mark_columns_used_by_index() to mark all columns that is part of
an index. It will also send extra(HA_EXTRA_KEYREAD) to handler to allow
it to quickly know that it only needs to read colums that are part
of the key. (The handler can also use the column map for detecting this,
but simpler/faster handler can just monitor the extra() call).
- table->mark_columns_used_by_index_no_reset() to in addition to other columns,
also mark all columns that is used by the given key.
- table->restore_column_maps_after_mark_index() to restore to default
column maps after a call to table->mark_columns_used_by_index().
- New item function register_field_in_read_map(), for marking used columns
in table->read_map. Used by filesort() to mark all used columns
- Maintain in TABLE->merge_keys set of all keys that are used in query.
(Simplices some optimization loops)
- Maintain Field->part_of_key_not_clustered which is like Field->part_of_key
but the field in the clustered key is not assumed to be part of all index.
(used in opt_range.cc for faster loops)
- dbug_tmp_use_all_columns(), dbug_tmp_restore_column_map()
tmp_use_all_columns() and tmp_restore_column_map() functions to temporally
mark all columns as usable. The 'dbug_' version is primarily intended
inside a handler when it wants to just call Field:store() & Field::val()
functions, but don't need the column maps set for any other usage.
(ie:: bitmap_is_set() is never called)
- We can't use compare_records() to skip updates for handlers that returns
a partial column set and the read_set doesn't cover all columns in the
write set. The reason for this is that if we have a column marked only for
write we can't in the MySQL level know if the value changed or not.
The reason this worked before was that MySQL marked all to be written
columns as also to be read. The new 'optimal' bitmaps exposed this 'hidden
bug'.
- open_table_from_share() does not anymore setup temporary MEM_ROOT
object as a thread specific variable for the handler. Instead we
send the to-be-used MEMROOT to get_new_handler().
(Simpler, faster code)
Bugs fixed:
- Column marking was not done correctly in a lot of cases.
(ALTER TABLE, when using triggers, auto_increment fields etc)
(Could potentially result in wrong values inserted in table handlers
relying on that the old column maps or field->set_query_id was correct)
Especially when it comes to triggers, there may be cases where the
old code would cause lost/wrong values for NDB and/or InnoDB tables.
- Split thd->options flag OPTION_STATUS_NO_TRANS_UPDATE to two flags:
OPTION_STATUS_NO_TRANS_UPDATE and OPTION_KEEP_LOG.
This allowed me to remove some wrong warnings about:
"Some non-transactional changed tables couldn't be rolled back"
- Fixed handling of INSERT .. SELECT and CREATE ... SELECT that wrongly reset
(thd->options & OPTION_STATUS_NO_TRANS_UPDATE) which caused us to loose
some warnings about
"Some non-transactional changed tables couldn't be rolled back")
- Fixed use of uninitialized memory in ha_ndbcluster.cc::delete_table()
which could cause delete_table to report random failures.
- Fixed core dumps for some tests when running with --debug
- Added missing FN_LIBCHAR in mysql_rm_tmp_tables()
(This has probably caused us to not properly remove temporary files after
crash)
- slow_logs was not properly initialized, which could maybe cause
extra/lost entries in slow log.
- If we get an duplicate row on insert, change column map to read and
write all columns while retrying the operation. This is required by
the definition of REPLACE and also ensures that fields that are only
part of UPDATE are properly handled. This fixed a bug in NDB and
REPLACE where REPLACE wrongly copied some column values from the replaced
row.
- For table handler that doesn't support NULL in keys, we would give an error
when creating a primary key with NULL fields, even after the fields has been
automaticly converted to NOT NULL.
- Creating a primary key on a SPATIAL key, would fail if field was not
declared as NOT NULL.
Cleanups:
- Removed not used condition argument to setup_tables
- Removed not needed item function reset_query_id_processor().
- Field->add_index is removed. Now this is instead maintained in
(field->flags & FIELD_IN_ADD_INDEX)
- Field->fieldnr is removed (use field->field_index instead)
- New argument to filesort() to indicate that it should return a set of
row pointers (not used columns). This allowed me to remove some references
to sql_command in filesort and should also enable us to return column
results in some cases where we couldn't before.
- Changed column bitmap handling in opt_range.cc to be aligned with TABLE
bitmap, which allowed me to use bitmap functions instead of looping over
all fields to create some needed bitmaps. (Faster and smaller code)
- Broke up found too long lines
- Moved some variable declaration at start of function for better code
readability.
- Removed some not used arguments from functions.
(setup_fields(), mysql_prepare_insert_check_table())
- setup_fields() now takes an enum instead of an int for marking columns
usage.
- For internal temporary tables, use handler::write_row(),
handler::delete_row() and handler::update_row() instead of
handler::ha_xxxx() for faster execution.
- Changed some constants to enum's and define's.
- Using separate column read and write sets allows for easier checking
of timestamp field was set by statement.
- Remove calls to free_io_cache() as this is now done automaticly in ha_reset()
- Don't build table->normalized_path as this is now identical to table->path
(after bar's fixes to convert filenames)
- Fixed some missed DBUG_PRINT(.."%lx") to use "0x%lx" to make it easier to
do comparision with the 'convert-dbug-for-diff' tool.
Things left to do in 5.1:
- We wrongly log failed CREATE TABLE ... SELECT in some cases when using
row based logging (as shown by testcase binlog_row_mix_innodb_myisam.result)
Mats has promised to look into this.
- Test that my fix for CREATE TABLE ... SELECT is indeed correct.
(I added several test cases for this, but in this case it's better that
someone else also tests this throughly).
Lars has promosed to do this.
2006-06-04 17:52:22 +02:00
# $INSTALL_DB -slave
mkdir var/slave-data
cp -r var/master-data/* var/slave-data
2000-10-10 00:41:21 +02:00
if [ $? != 0 ] ; then
2000-11-18 07:35:40 +01:00
error "Could not install slave test DBs"
2000-10-10 00:41:21 +02:00
exit 1
2000-07-31 21:29:14 +02:00
fi
2001-12-10 17:16:51 +01:00
2001-10-10 00:43:05 +02:00
for slave_num in 1 2 ;
do
2002-08-21 21:04:22 +02:00
$RM -rf var/slave$slave_num -data
2001-12-23 01:43:46 +01:00
mkdir -p var/slave$slave_num -data/mysql
mkdir -p var/slave$slave_num -data/test
cp var/slave-data/mysql/* var/slave$slave_num -data/mysql
2001-10-10 00:43:05 +02:00
done
2000-07-31 21:29:14 +02:00
return 0
}
2001-04-10 02:25:06 +02:00
gprof_prepare ( )
{
2001-12-10 17:16:51 +01:00
$RM -rf $GPROF_DIR
mkdir -p $GPROF_DIR
2001-04-10 02:25:06 +02:00
}
gprof_collect ( )
{
if [ -f $MASTER_MYDDIR /gmon.out ] ; then
2002-02-09 21:58:53 +01:00
gprof $MASTER_MYSQLD $MASTER_MYDDIR /gmon.out > $GPROF_MASTER
2001-04-10 02:25:06 +02:00
echo " Master execution profile has been saved in $GPROF_MASTER "
fi
if [ -f $SLAVE_MYDDIR /gmon.out ] ; then
2002-02-09 21:58:53 +01:00
gprof $SLAVE_MYSQLD $SLAVE_MYDDIR /gmon.out > $GPROF_SLAVE
2001-04-10 02:25:06 +02:00
echo " Slave execution profile has been saved in $GPROF_SLAVE "
fi
}
2000-11-18 07:35:40 +01:00
gcov_prepare ( ) {
2000-10-13 14:14:39 +02:00
$FIND $BASEDIR -name \* .gcov \
-or -name \* .da | $XARGS $RM
2000-10-12 01:01:58 +02:00
}
gcov_collect ( ) {
2000-10-13 14:14:39 +02:00
$ECHO "Collecting source coverage info..."
2000-12-09 01:32:30 +01:00
[ -f $GCOV_MSG ] && $RM $GCOV_MSG
[ -f $GCOV_ERR ] && $RM $GCOV_ERR
2000-10-13 14:14:39 +02:00
for d in $MYSQLD_SRC_DIRS ; do
cd $BASEDIR /$d
for f in *.h *.cc *.c; do
2000-12-09 01:32:30 +01:00
$GCOV $f 2>>$GCOV_ERR >>$GCOV_MSG
2000-10-13 14:14:39 +02:00
done
2000-12-07 15:54:59 +01:00
cd $MYSQL_TEST_DIR
2000-10-12 01:01:58 +02:00
done
2000-12-28 18:25:41 +01:00
$ECHO " gcov info in $GCOV_MSG , errors in $GCOV_ERR "
2000-10-12 01:01:58 +02:00
}
2001-09-23 05:47:57 +02:00
abort_if_failed( )
{
if [ ! $? = 0 ] ; then
echo $1
exit 1
2001-12-10 17:16:51 +01:00
fi
2001-09-23 05:47:57 +02:00
}
2006-04-12 03:54:24 +02:00
launch_in_background( )
2001-09-23 05:47:57 +02:00
{
2006-04-19 09:39:57 +02:00
shift
2006-04-12 03:54:24 +02:00
echo $@ | /bin/sh >> $CUR_MYERR 2>& 1 &
sleep 2 #hack
2001-10-11 21:54:06 +02:00
return
2001-09-23 05:47:57 +02:00
}
2006-04-12 03:54:24 +02:00
shutdown_mysqld( )
2001-09-28 07:05:54 +02:00
{
2002-12-05 02:40:33 +01:00
pid = $1
ident = $2
2006-04-12 03:54:24 +02:00
# Shutdown time must be high as slave may be in reconnect
$MYSQLADMIN --no-defaults -uroot --socket= $MYSQL_TMP_DIR /$ident .sock$3 --connect_timeout= 5 --shutdown_timeout= 70 shutdown >> $MYSQL_MANAGER_LOG 2>& 1
res = $?
# Some systems require an extra connect
$MYSQLADMIN --no-defaults -uroot --socket= $MYSQL_TMP_DIR /$ident .sock$3 --connect_timeout= 1 ping >> $MYSQL_MANAGER_LOG 2>& 1
if test $res = 0
then
wait_for_pid $pid
2001-10-11 21:54:06 +02:00
fi
2006-04-12 03:54:24 +02:00
return $res
2001-09-28 07:05:54 +02:00
}
2004-10-04 02:10:33 +02:00
start_ndbcluster( )
{
2006-01-12 19:51:02 +01:00
if [ ! -n " $USE_NDBCLUSTER " ] ;
then
USING_NDBCLUSTER = 0
USE_NDBCLUSTER_OPT =
fi
if [ x$USING_NDBCLUSTER = x1 -a -z " $USE_NDBCLUSTER_OPT " ]
2004-10-04 02:10:33 +02:00
then
2005-02-01 17:16:05 +01:00
rm -f $NDB_TOOLS_OUTPUT
2004-10-04 02:10:33 +02:00
if [ -z " $USE_RUNNING_NDBCLUSTER " ]
then
2006-01-12 19:51:02 +01:00
if [ " $DO_BENCH " != 1 -a -z " $NDBCLUSTER_EXTRA_OPTS " ]
2004-10-04 02:10:33 +02:00
then
2004-11-10 17:05:28 +01:00
NDBCLUSTER_EXTRA_OPTS = "--small"
2004-10-04 02:10:33 +02:00
fi
2006-04-21 14:00:44 +02:00
OPTS = " $NDBCLUSTER_OPTS $NDBCLUSTER_EXTRA_OPTS --character-sets-dir= $CHARSETSDIR --verbose= $NDB_VERBOSE --initial --relative-config-data-dir --core "
2006-01-23 10:42:02 +01:00
if [ " x $NDB_VERBOSE " != "x0" ] ; then
echo "Starting master ndbcluster " $OPTS
fi
2006-01-12 19:51:02 +01:00
./ndb/ndbcluster $OPTS || NDB_STATUS_OK = 0
2005-02-07 17:46:52 +01:00
if [ x$NDB_STATUS_OK != x1 ] ; then
2005-01-20 20:27:17 +01:00
if [ x$FORCE != x1 ] ; then
exit 1
fi
2006-01-12 19:51:02 +01:00
USING_NDBCLUSTER = 0
USE_NDBCLUSTER_OPT =
2005-02-07 17:46:52 +01:00
return
2005-01-20 20:27:17 +01:00
fi
2005-02-07 17:46:52 +01:00
2004-10-04 15:53:36 +02:00
NDB_CONNECTSTRING = " host=localhost: $NDBCLUSTER_PORT "
2004-10-04 02:10:33 +02:00
else
2004-10-04 15:53:36 +02:00
NDB_CONNECTSTRING = " $USE_RUNNING_NDBCLUSTER "
echo " Using ndbcluster at $NDB_CONNECTSTRING "
2004-10-04 02:10:33 +02:00
fi
2006-02-06 15:42:26 +01:00
USE_NDBCLUSTER_OPT = " $USE_NDBCLUSTER --ndb-connectstring=\" $NDB_CONNECTSTRING \" --ndb-extra-logging "
2004-10-04 15:53:36 +02:00
export NDB_CONNECTSTRING
2004-10-04 02:10:33 +02:00
fi
}
2006-01-12 19:51:02 +01:00
rm_ndbcluster_tables( )
{
2006-11-21 21:32:58 +01:00
$RM -f $1 /mysql/apply_status*
$RM -f $1 /mysql/schema*
2006-01-12 19:51:02 +01:00
}
2004-10-04 02:10:33 +02:00
stop_ndbcluster( )
{
2006-01-12 19:51:02 +01:00
if [ -n " $USE_NDBCLUSTER_OPT " ]
2004-10-04 02:10:33 +02:00
then
2006-01-12 19:51:02 +01:00
USE_NDBCLUSTER_OPT =
2004-10-04 02:10:33 +02:00
if [ -z " $USE_RUNNING_NDBCLUSTER " ]
then
# Kill any running ndbcluster stuff
2006-01-12 19:51:02 +01:00
$ECHO "Stopping master cluster"
2004-11-10 17:05:28 +01:00
./ndb/ndbcluster $NDBCLUSTER_OPTS --stop
2006-01-12 19:51:02 +01:00
# remove ndb table the hard way as not to upset later tests
rm_ndbcluster_tables $MASTER_MYDDIR
rm_ndbcluster_tables $MASTER_MYDDIR "1"
2004-10-04 02:10:33 +02:00
fi
fi
}
2004-09-27 17:01:26 +02:00
# The embedded server needs the cleanup so we do some of the start work
# but stop before actually running mysqld or anything.
2001-09-28 07:05:54 +02:00
2000-11-21 07:38:08 +01:00
start_master( )
{
2004-09-28 19:04:30 +02:00
eval " this_master_running=\$MASTER $1 _RUNNING "
if [ x$this_master_running = x1 ] || [ x$LOCAL_MASTER = x1 ] ; then
2001-12-10 17:16:51 +01:00
return
fi
2004-06-20 19:11:02 +02:00
# Remove stale binary logs except for 2 tests which need them
if [ " $tname " != "rpl_crash_binlog_ib_1b" ] && [ " $tname " != "rpl_crash_binlog_ib_2b" ] && [ " $tname " != "rpl_crash_binlog_ib_3b" ]
then
2004-09-28 19:04:30 +02:00
$RM -f $MYSQL_TEST_DIR /var/log/master-bin$1 .*
2004-06-20 19:11:02 +02:00
fi
2003-03-03 14:57:02 +01:00
# Remove old master.info and relay-log.info files
2004-09-28 19:04:30 +02:00
$RM -f $MYSQL_TEST_DIR /var/master-data$1 /master.info $MYSQL_TEST_DIR /var/master-data$1 /relay-log.info
2001-12-10 17:16:51 +01:00
#run master initialization shell script if one exists
if [ -f " $master_init_script " ] ;
then
/bin/sh $master_init_script
fi
cd $BASEDIR # for gcov
2004-09-28 19:04:30 +02:00
if [ -n " $1 " ] ; then
id = ` $EXPR $1 + 101` ;
this_master_myport = ` $EXPR $MASTER_MYPORT + $1 `
2004-11-03 12:43:46 +01:00
NOT_FIRST_MASTER_EXTRA_OPTS = "--skip-innodb"
2005-02-18 10:57:10 +01:00
eval " MASTER_MYPORT $1 = $this_master_myport "
export MASTER_MYPORT$1
2004-09-28 19:04:30 +02:00
else
id = 1;
this_master_myport = $MASTER_MYPORT
2004-11-03 12:43:46 +01:00
NOT_FIRST_MASTER_EXTRA_OPTS = ""
2004-09-28 19:04:30 +02:00
fi
2005-02-09 16:23:22 +01:00
if [ -n " $EXTRA_MASTER_MYSQLD_TRACE " ]
then
2005-02-10 14:13:23 +01:00
CURR_MASTER_MYSQLD_TRACE = " $EXTRA_MASTER_MYSQLD_TRACE $1 "
2005-02-09 16:23:22 +01:00
fi
2006-01-20 14:50:02 +01:00
if [ x$MASTER_MYSQLDBINLOG = x1 ]
then
2006-02-10 00:15:07 +01:00
MASTER_MYSQLD_BINLOG_OPT = " --log-bin= $MYSQL_TEST_DIR /var/log/master-bin $1 "
2006-01-20 14:50:02 +01:00
fi
2005-10-18 18:26:31 +02:00
if [ -z " $DO_BENCH " -a -z " $DO_STRESS " ]
2001-12-10 17:16:51 +01:00
then
2006-01-20 14:50:02 +01:00
master_args = " --no-defaults \
2004-09-28 19:04:30 +02:00
--server-id= $id \
2002-02-09 21:58:53 +01:00
--basedir= $MY_BASEDIR \
2004-09-28 19:04:30 +02:00
--port= $this_master_myport \
2005-12-28 20:30:57 +01:00
--port-open-timeout= 380 \
2002-03-05 13:22:32 +01:00
--local-infile \
2001-12-10 17:16:51 +01:00
--exit-info= 256 \
--core \
2006-01-12 19:51:02 +01:00
$USE_NDBCLUSTER_OPT \
2004-09-28 19:04:30 +02:00
--datadir= $MASTER_MYDDIR $1 \
--pid-file= $MASTER_MYPID $1 \
--socket= $MASTER_MYSOCK $1 \
--log= $MASTER_MYLOG $1 \
2001-12-10 17:16:51 +01:00
--character-sets-dir= $CHARSETSDIR \
--default-character-set= $CHARACTER_SET \
--tmpdir= $MYSQL_TMP_DIR \
--language= $LANGUAGE \
2005-04-07 18:24:14 +02:00
--innodb_data_file_path= ibdata1:128M:autoextend \
2003-08-22 03:07:40 +02:00
--open-files-limit= 1024 \
2005-11-10 17:50:51 +01:00
--log-bin-trust-function-creators \
2002-02-09 21:58:53 +01:00
$MASTER_40_ARGS \
2001-12-10 17:16:51 +01:00
$SMALL_SERVER \
2006-02-10 00:15:07 +01:00
$MASTER_MYSQLD_BINLOG_OPT \
2005-12-22 06:39:02 +01:00
$EXTRA_MASTER_MYSQLD_OPT $EXTRA_MASTER_OPT \
2005-02-10 14:13:23 +01:00
$NOT_FIRST_MASTER_EXTRA_OPTS $CURR_MASTER_MYSQLD_TRACE "
2001-12-10 17:16:51 +01:00
else
2006-01-20 14:50:02 +01:00
master_args = " --no-defaults \
2004-09-28 19:04:30 +02:00
--server-id= $id --rpl-recovery-rank= 1 \
2001-12-10 17:16:51 +01:00
--basedir= $MY_BASEDIR --init-rpl-role= master \
2004-09-28 19:04:30 +02:00
--port= $this_master_myport \
2005-12-28 20:30:57 +01:00
--port-open-timeout= 380 \
2002-03-05 13:22:32 +01:00
--local-infile \
2004-09-28 19:04:30 +02:00
--datadir= $MASTER_MYDDIR $1 \
--pid-file= $MASTER_MYPID $1 \
--socket= $MASTER_MYSOCK $1 \
2001-12-10 17:16:51 +01:00
--character-sets-dir= $CHARSETSDIR \
--default-character-set= $CHARACTER_SET \
--core \
2006-01-12 19:51:02 +01:00
$USE_NDBCLUSTER_OPT \
2001-12-10 17:16:51 +01:00
--tmpdir= $MYSQL_TMP_DIR \
--language= $LANGUAGE \
2005-04-07 18:24:14 +02:00
--innodb_data_file_path= ibdata1:128M:autoextend \
2005-11-10 17:50:51 +01:00
--log-bin-trust-function-creators \
2002-02-09 21:58:53 +01:00
$MASTER_40_ARGS \
2001-12-10 17:16:51 +01:00
$SMALL_SERVER \
2006-02-10 00:15:07 +01:00
$MASTER_MYSQLD_BINLOG_OPT \
2005-12-22 06:39:02 +01:00
$EXTRA_MASTER_MYSQLD_OPT $EXTRA_MASTER_OPT \
2004-11-03 12:43:46 +01:00
$NOT_FIRST_MASTER_EXTRA_OPTS "
2001-12-10 17:16:51 +01:00
fi
2005-05-25 11:10:10 +02:00
CUR_MYERR = $MASTER_MYERR $1
CUR_MYSOCK = $MASTER_MYSOCK $1
2001-12-10 17:16:51 +01:00
2004-09-27 17:01:26 +02:00
# For embedded server we collect the server flags and return
if [ " x $USE_EMBEDDED_SERVER " = "x1" ] ; then
# Add a -A to each argument to pass it to embedded server
EMBEDDED_SERVER_OPTS = ""
for opt in $master_args
do
EMBEDDED_SERVER_OPTS = " $EMBEDDED_SERVER_OPTS -A $opt "
done
EXTRA_MYSQL_TEST_OPT = " $EMBEDDED_SERVER_OPTS "
return
fi
2001-12-10 17:16:51 +01:00
if [ x$DO_DDD = x1 ]
then
2005-11-23 21:45:02 +01:00
$ECHO " set args $master_args " > $GDB_MASTER_INIT $1
2006-04-12 03:54:24 +02:00
launch_in_background master ddd -display $DISPLAY --debugger \
2005-11-23 21:45:02 +01:00
" gdb -x $GDB_MASTER_INIT $1 " $MASTER_MYSQLD
2001-12-10 17:16:51 +01:00
elif [ x$DO_GDB = x1 ]
then
2001-12-17 02:02:58 +01:00
if [ x$MANUAL_GDB = x1 ]
then
2005-11-23 21:45:02 +01:00
$ECHO " set args $master_args " > $GDB_MASTER_INIT $1
2001-12-17 02:02:58 +01:00
$ECHO "To start gdb for the master , type in another window:"
2006-11-01 20:17:10 +01:00
$ECHO " cd $MYSQL_TEST_DIR ; gdb -x $GDB_MASTER_INIT $1 $MASTER_MYSQLD "
2001-12-17 02:02:58 +01:00
wait_for_master = 1500
else
( $ECHO set args $master_args ;
if [ $USE_MANAGER = 0 ] ; then
2001-12-10 17:16:51 +01:00
cat <<EOF
2001-10-18 15:45:33 +02:00
b mysql_parse
commands 1
2001-11-20 17:59:57 +01:00
disa 1
2001-10-18 15:45:33 +02:00
end
2001-11-09 06:27:55 +01:00
r
EOF
2005-11-23 21:45:02 +01:00
fi ) > $GDB_MASTER_INIT $1
2006-04-12 03:54:24 +02:00
launch_in_background master $XTERM -display $DISPLAY \
2005-11-23 21:45:02 +01:00
-title "Master" -e gdb -x $GDB_MASTER_INIT $1 $MASTER_MYSQLD
2001-12-17 02:02:58 +01:00
fi
2001-12-10 17:16:51 +01:00
else
2006-04-12 03:54:24 +02:00
launch_in_background master $MASTER_MYSQLD $master_args
2001-12-10 17:16:51 +01:00
fi
2004-09-28 19:04:30 +02:00
sleep_until_file_created $MASTER_MYPID $1 $wait_for_master
2001-12-13 01:31:19 +01:00
wait_for_master = $SLEEP_TIME_FOR_SECOND_MASTER
2004-09-28 19:04:30 +02:00
eval " MASTER $1 _RUNNING=1 "
2000-11-21 07:38:08 +01:00
}
start_slave( )
{
2001-12-10 17:16:51 +01:00
[ x$SKIP_SLAVE = x1 ] && return
eval " this_slave_running=\$SLAVE $1 _RUNNING "
[ x$this_slave_running = 1 ] && return
2006-01-12 19:51:02 +01:00
2003-01-07 15:53:10 +01:00
# When testing fail-safe replication, we will have more than one slave
# in this case, we start secondary slaves with an argument
2001-12-10 17:16:51 +01:00
slave_ident = " slave $1 "
if [ -n " $1 " ] ;
then
slave_server_id = ` $EXPR 2 + $1 `
slave_rpl_rank = $slave_server_id
slave_port = ` expr $SLAVE_MYPORT + $1 `
slave_log = " $SLAVE_MYLOG . $1 "
slave_err = " $SLAVE_MYERR . $1 "
2003-03-03 14:57:02 +01:00
slave_datadir = " $SLAVE_MYDDIR /../ $slave_ident -data/ "
2001-12-10 17:16:51 +01:00
slave_pid = " $MYRUN_DIR /mysqld- $slave_ident .pid "
slave_sock = " $SLAVE_MYSOCK - $1 "
else
slave_server_id = 2
slave_rpl_rank = 2
slave_port = $SLAVE_MYPORT
slave_log = $SLAVE_MYLOG
slave_err = $SLAVE_MYERR
slave_datadir = $SLAVE_MYDDIR
slave_pid = $SLAVE_MYPID
slave_sock = " $SLAVE_MYSOCK "
fi
2006-01-12 19:51:02 +01:00
#
if [ x$USING_NDBCLUSTER = x1 -a -n " $USE_NDBCLUSTER_SLAVE " ] ; then
if [ $slave_server_id -eq 2 ] ; then
savedir = ` pwd `
cd $MYSQL_TEST_DIR
if [ " $DO_BENCH " != 1 -a -z " $NDBCLUSTER_EXTRA_OPTS " ]
then
NDBCLUSTER_EXTRA_OPTS = "--small"
fi
2006-01-30 17:06:31 +01:00
OPTS = " $NDBCLUSTER_OPTS_SLAVE --initial $NDBCLUSTER_EXTRA_OPTS --ndbd-nodes=1 --verbose= $NDB_VERBOSE --relative-config-data-dir --core "
2006-01-23 10:42:02 +01:00
if [ " x $NDB_VERBOSE " != "x0" ] ; then
echo "Starting slave ndbcluster " $OPTS
fi
2006-01-12 19:51:02 +01:00
./ndb/ndbcluster $OPTS \
|| NDB_SLAVE_STATUS_OK = 0
# > /dev/null 2>&1 || NDB_SLAVE_STATUS_OK=0
cd $savedir
if [ x$NDB_SLAVE_STATUS_OK != x1 ] ; then
if [ x$FORCE != x1 ] ; then
exit 1
fi
USE_NDBCLUSTER_SLAVE_OPT =
USE_NDBCLUSTER_SLAVE =
fi
USE_NDBCLUSTER_SLAVE_OPT = $USE_NDBCLUSTER_SLAVE
fi
else
USE_NDBCLUSTER_SLAVE_OPT =
fi
2002-09-11 05:40:08 +02:00
# Remove stale binary logs and old master.info files
2004-06-20 19:11:02 +02:00
# except for too tests which need them
if [ " $tname " != "rpl_crash_binlog_ib_1b" ] && [ " $tname " != "rpl_crash_binlog_ib_2b" ] && [ " $tname " != "rpl_crash_binlog_ib_3b" ]
then
$RM -f $MYSQL_TEST_DIR /var/log/$slave_ident -*bin.*
$RM -f $slave_datadir /master.info $slave_datadir /relay-log.info
fi
2001-12-10 17:16:51 +01:00
#run slave initialization shell script if one exists
if [ -f " $slave_init_script " ] ;
then
/bin/sh $slave_init_script
fi
if [ -z " $SLAVE_MASTER_INFO " ] ; then
master_info = " --master-user=root \
--master-connect-retry= 1 \
--master-host= 127.0.0.1 \
2002-08-08 02:12:02 +02:00
--master-password= "" \
2001-12-10 17:16:51 +01:00
--master-port= $MASTER_MYPORT \
--server-id= $slave_server_id --rpl-recovery-rank= $slave_rpl_rank "
else
master_info = $SLAVE_MASTER_INFO
fi
2006-01-12 19:51:02 +01:00
if [ x$SLAVE_MYSQLDBINLOG = x1 ]
then
2006-02-10 00:15:07 +01:00
SLAVE_MYSQLD_BINLOG_OPT = " --log-bin= $MYSQL_TEST_DIR /var/log/ $slave_ident -bin --log-slave-updates "
2006-01-12 19:51:02 +01:00
fi
2001-12-10 17:16:51 +01:00
$RM -f $slave_datadir /log.*
slave_args = " --no-defaults $master_info \
--exit-info= 256 \
2006-01-12 19:51:02 +01:00
$SLAVE_MYSQLDBINLOG_OPT \
2002-01-27 06:26:24 +01:00
--relay-log= $MYSQL_TEST_DIR /var/log/$slave_ident -relay-bin \
2001-12-10 17:16:51 +01:00
--log= $slave_log \
--basedir= $MY_BASEDIR \
--datadir= $slave_datadir \
--pid-file= $slave_pid \
--port= $slave_port \
2005-12-28 20:30:57 +01:00
--port-open-timeout= 380 \
2001-12-10 17:16:51 +01:00
--socket= $slave_sock \
--character-sets-dir= $CHARSETSDIR \
--default-character-set= $CHARACTER_SET \
--core --init-rpl-role= slave \
--tmpdir= $MYSQL_TMP_DIR \
--language= $LANGUAGE \
2004-04-16 07:49:50 +02:00
--skip-innodb --skip-ndbcluster --skip-slave-start \
2001-12-10 17:16:51 +01:00
--slave-load-tmpdir= $SLAVE_LOAD_TMPDIR \
--report-host= 127.0.0.1 --report-user= root \
--report-port= $slave_port \
2002-08-18 15:04:26 +02:00
--master-retry-count= 10 \
2002-04-26 07:56:28 +02:00
-O slave_net_timeout = 10 \
2005-11-10 17:50:51 +01:00
--log-bin-trust-function-creators \
2001-12-10 17:16:51 +01:00
$SMALL_SERVER \
2006-02-10 00:15:07 +01:00
$SLAVE_MYSQLD_BINLOG_OPT \
2006-01-12 19:51:02 +01:00
$EXTRA_SLAVE_MYSQLD_OPT $EXTRA_SLAVE_OPT \
$USE_NDBCLUSTER_SLAVE_OPT "
2001-12-10 17:16:51 +01:00
CUR_MYERR = $slave_err
CUR_MYSOCK = $slave_sock
if [ x$DO_DDD = x1 ]
then
2003-08-19 15:00:12 +02:00
$ECHO " set args $slave_args " > $GDB_SLAVE_INIT
2006-04-12 03:54:24 +02:00
launch_in_background $slave_ident ddd -display $DISPLAY --debugger \
2001-12-10 17:16:51 +01:00
" gdb -x $GDB_SLAVE_INIT " $SLAVE_MYSQLD
elif [ x$DO_GDB = x1 ]
then
2001-12-17 02:02:58 +01:00
if [ x$MANUAL_GDB = x1 ]
then
2002-06-05 22:04:38 +02:00
$ECHO " set args $slave_args " > $GDB_SLAVE_INIT
2001-12-17 02:02:58 +01:00
echo "To start gdb for the slave, type in another window:"
2006-11-01 20:17:10 +01:00
echo " cd $MYSQL_TEST_DIR ; gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD "
2001-12-17 02:02:58 +01:00
wait_for_slave = 1500
else
2002-06-05 22:04:38 +02:00
( $ECHO set args $slave_args ;
if [ $USE_MANAGER = 0 ] ; then
cat <<EOF
b mysql_parse
commands 1
disa 1
end
r
EOF
fi ) > $GDB_SLAVE_INIT
2006-04-12 03:54:24 +02:00
launch_in_background $slave_ident $XTERM -display $DISPLAY -title "Slave" -e \
2001-12-17 02:02:58 +01:00
gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD
fi
2001-12-10 17:16:51 +01:00
else
2006-04-12 03:54:24 +02:00
launch_in_background $slave_ident $SLAVE_MYSQLD $slave_args
2001-12-10 17:16:51 +01:00
fi
eval " SLAVE $1 _RUNNING=1 "
2002-02-09 21:58:53 +01:00
sleep_until_file_created $slave_pid $wait_for_slave
2001-12-13 01:31:19 +01:00
wait_for_slave = $SLEEP_TIME_FOR_SECOND_SLAVE
2000-11-21 07:38:08 +01:00
}
2001-12-10 17:16:51 +01:00
mysql_start ( )
{
2003-10-06 23:23:29 +02:00
# We should not start the daemon here as we don't know the arguments
2003-10-05 00:41:17 +02:00
# for the test. Better to let the test start the daemon
2003-01-07 15:53:10 +01:00
# $ECHO "Starting MySQL daemon"
# start_master
# start_slave
2001-12-10 17:16:51 +01:00
cd $MYSQL_TEST_DIR
return 1
2000-07-31 21:29:14 +02:00
}
2000-11-21 07:38:08 +01:00
stop_slave ( )
{
2001-10-10 00:43:05 +02:00
eval " this_slave_running=\$SLAVE $1 _RUNNING "
slave_ident = " slave $1 "
if [ -n " $1 " ] ;
2000-11-21 07:38:08 +01:00
then
2001-10-10 00:43:05 +02:00
slave_pid = " $MYRUN_DIR /mysqld- $slave_ident .pid "
else
slave_pid = $SLAVE_MYPID
2001-12-10 17:16:51 +01:00
fi
2001-10-10 00:43:05 +02:00
if [ x$this_slave_running = x1 ]
then
2002-12-05 02:40:33 +01:00
pid = ` $CAT $slave_pid `
2006-04-12 03:54:24 +02:00
shutdown_mysqld $pid $slave_ident
2001-10-10 00:43:05 +02:00
if [ $? != 0 ] && [ -f $slave_pid ]
2001-01-03 15:54:46 +01:00
then # try harder!
2001-12-23 02:03:09 +01:00
$ECHO "slave not cooperating with mysqladmin, will try manual kill"
2002-12-05 02:40:33 +01:00
kill $pid
sleep_until_file_deleted $pid $slave_pid
2001-12-23 02:03:09 +01:00
if [ -f $slave_pid ] ; then
$ECHO "slave refused to die. Sending SIGKILL"
kill -9 ` $CAT $slave_pid `
$RM -f $slave_pid
else
$ECHO "slave responded to SIGTERM "
fi
else
sleep $SLEEP_TIME_AFTER_RESTART
2000-12-12 20:12:41 +01:00
fi
2001-10-10 00:43:05 +02:00
eval " SLAVE $1 _RUNNING=0 "
2006-01-12 19:51:02 +01:00
if [ -n " $USE_NDBCLUSTER_SLAVE_OPT " ] ; then
savedir = ` pwd `
cd $MYSQL_TEST_DIR
$ECHO "Stopping slave cluster"
./ndb/ndbcluster $NDBCLUSTER_OPTS_SLAVE --stop
rm_ndbcluster_tables $SLAVE_MYDDIR
cd $savedir
fi
2001-12-10 17:16:51 +01:00
fi
2000-11-21 07:38:08 +01:00
}
2000-07-31 21:29:14 +02:00
2003-06-10 23:29:49 +02:00
stop_slave_threads ( )
{
eval " this_slave_running=\$SLAVE $1 _RUNNING "
slave_ident = " slave $1 "
if [ x$this_slave_running = x1 ]
then
$MYSQLADMIN --no-defaults -uroot --socket= $MYSQL_TMP_DIR /$slave_ident .sock stop-slave > /dev/null 2>& 1
fi
}
2000-11-21 07:38:08 +01:00
stop_master ( )
{
2004-09-28 19:04:30 +02:00
eval " this_master_running=\$MASTER $1 _RUNNING "
if [ x$this_master_running = x1 ]
2000-11-21 07:38:08 +01:00
then
2004-09-27 17:01:26 +02:00
# For embedded server we don't stop anyting but mark that
# MASTER_RUNNING=0 to get cleanup when calling start_master().
if [ x$USE_EMBEDDED_SERVER != x1 ] ; then
2004-09-28 21:22:04 +02:00
pid = ` $CAT $MASTER_MYPID $1 `
2006-04-12 03:54:24 +02:00
shutdown_mysqld $pid master $1
2004-09-28 21:22:04 +02:00
if [ $? != 0 ] && [ -f $MASTER_MYPID $1 ]
2004-09-27 17:01:26 +02:00
then # try harder!
$ECHO "master not cooperating with mysqladmin, will try manual kill"
kill $pid
2004-09-28 21:22:04 +02:00
sleep_until_file_deleted $pid $MASTER_MYPID $1
if [ -f $MASTER_MYPID $1 ] ; then
2004-09-27 17:01:26 +02:00
$ECHO "master refused to die. Sending SIGKILL"
2004-09-28 21:22:04 +02:00
kill -9 ` $CAT $MASTER_MYPID $1 `
$RM -f $MASTER_MYPID $1
2004-09-27 17:01:26 +02:00
else
$ECHO "master responded to SIGTERM "
fi
2001-12-23 02:03:09 +01:00
else
2004-09-27 17:01:26 +02:00
sleep $SLEEP_TIME_AFTER_RESTART
2001-12-23 02:03:09 +01:00
fi
2000-12-12 20:12:41 +01:00
fi
2004-09-28 19:04:30 +02:00
eval " MASTER $1 _RUNNING=0 "
2000-11-21 07:38:08 +01:00
fi
}
2000-07-31 21:29:14 +02:00
2000-11-21 07:38:08 +01:00
mysql_stop ( )
{
2004-10-05 00:05:15 +02:00
if [ " $MASTER_RUNNING " = 1 ]
then
$ECHO "Ending Tests"
$ECHO "Shutting-down MySQL daemon"
$ECHO ""
stop_master
2004-10-29 18:26:52 +02:00
stop_master 1
2004-10-05 00:05:15 +02:00
$ECHO "Master shutdown finished"
stop_slave
stop_slave 1
stop_slave 2
$ECHO "Slave shutdown finished"
2004-10-29 18:26:52 +02:00
stop_ndbcluster
2004-10-05 00:05:15 +02:00
fi
return 1
2000-07-31 21:29:14 +02:00
}
2001-12-10 17:16:51 +01:00
mysql_restart ( )
{
mysql_stop
mysql_start
return 1
2000-07-31 21:29:14 +02:00
}
mysql_loadstd ( ) {
2001-12-10 17:16:51 +01:00
# cp $STD_DATA/*.frm $STD_DATA/*.MRG $MASTER_MYDDIR/test
2000-07-31 21:29:14 +02:00
return 1
}
2000-11-21 07:38:08 +01:00
run_testcase ( )
{
tf = $1
2000-12-15 15:12:31 +01:00
tname = ` $BASENAME $tf .test`
2000-11-21 07:38:08 +01:00
master_opt_file = $TESTDIR /$tname -master.opt
slave_opt_file = $TESTDIR /$tname -slave.opt
2001-01-24 20:47:09 +01:00
master_init_script = $TESTDIR /$tname -master.sh
slave_init_script = $TESTDIR /$tname -slave.sh
2003-02-25 23:04:13 +01:00
slave_master_info_file = $TESTDIR /$tname .slave-mi
2004-09-27 17:01:26 +02:00
tsrcdir = $TESTDIR /$tname -src
result_file = " r/ $tname .result "
2002-08-22 15:50:58 +02:00
echo $tname > $CURRENT_TEST
2004-12-17 10:19:31 +01:00
SKIP_SLAVE = ` $EXPR \( $tname : rpl \) = 0 \& \( $tname : federated \) = 0`
2006-01-12 19:51:02 +01:00
NDBCLUSTER_TEST = ` $EXPR \( $tname : '.*ndb.*' \) != 0`
2006-01-16 22:47:19 +01:00
if [ " x $USE_NDBCLUSTER_ALL " = "x1" ] ; then
NDBCLUSTER_TEST = 1
fi
2006-01-17 08:25:52 +01:00
if [ " x $USE_NDBCLUSTER_ONLY " = "x1" -a " x $NDBCLUSTER_TEST " != "x1" ] ; then
skip_test $tname
return
fi
2003-11-28 11:18:13 +01:00
if [ " $USE_MANAGER " = 1 ] ; then
2003-10-29 14:23:35 +01:00
many_slaves = ` $EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \) `
2004-05-03 12:10:06 +02:00
fi
if $EXPR " $tname " '<' " $START_FROM " > /dev/null ; then
#skip_test $tname
return
2001-12-10 17:16:51 +01:00
fi
2004-05-03 12:10:06 +02:00
if [ " $SKIP_TEST " ] ; then
if $EXPR \( " $tname " : " $SKIP_TEST " \) > /dev/null ; then
skip_test $tname
return
2001-06-20 00:08:19 +02:00
fi
2004-05-03 12:10:06 +02:00
fi
2001-01-05 12:13:15 +01:00
2004-05-03 12:10:06 +02:00
if [ " $DO_TEST " ] ; then
if $EXPR \( " $tname " : " $DO_TEST " \) > /dev/null ; then
2004-05-03 17:17:50 +02:00
: #empty command to keep some shells happy
2004-05-03 12:10:06 +02:00
else
#skip_test $tname
return
2001-06-27 01:02:33 +02:00
fi
2004-05-03 12:10:06 +02:00
fi
2001-06-27 01:02:33 +02:00
2004-05-03 12:10:06 +02:00
if [ x${ NO_SLAVE } x$SKIP_SLAVE = x1x0 ] ; then
skip_test $tname
2001-01-05 12:13:15 +01:00
return
fi
2005-03-18 16:48:18 +01:00
# if [ -f "$TESTDIR/$tname.disabled" ]
# then
# comment=`$CAT $TESTDIR/$tname.disabled`;
# disable_test $tname "$comment"
# return
# fi
2005-03-16 09:23:38 +01:00
if [ -f " $TESTDIR /disabled.def " ] ; then
comment = ` $GREP " ^ $tname *: * " $TESTDIR /disabled.def` ;
if [ -n " $comment " ]
then
comment = ` echo $comment | sed 's/^[^:]*: *//' `
disable_test $tname " $comment "
return
fi
2005-03-15 19:48:42 +01:00
fi
2004-09-27 17:01:26 +02:00
if [ " x $USE_EMBEDDED_SERVER " != "x1" ] ; then
# Stop all slave threads, so that we don't have useless reconnection
# attempts and error messages in case the slave and master servers restart.
stop_slave_threads
stop_slave_threads 1
stop_slave_threads 2
fi
# FIXME temporary solution, we will get a new C version of this
# script soon anyway so it is not worth it spending the time
if [ " x $USE_EMBEDDED_SERVER " = "x1" -a -z " $DO_TEST " ] ; then
for t in \
2005-03-30 03:17:46 +02:00
"init_connect" \
"init_file"
2004-09-27 17:01:26 +02:00
do
if [ " $tname " = " $t " ] ; then
skip_test $tname
return
fi
done
fi
2003-06-10 23:29:49 +02:00
2005-01-26 10:19:28 +01:00
if [ $USE_RUNNING_SERVER -eq 0 ] ;
2000-11-21 07:38:08 +01:00
then
2001-01-16 11:38:58 +01:00
if [ -f $master_opt_file ] ;
then
2001-12-13 14:53:18 +01:00
EXTRA_MASTER_OPT = ` $CAT $master_opt_file | $SED -e " s;\\ $MYSQL_TEST_DIR ; $MYSQL_TEST_DIR ; " `
2003-05-27 15:40:14 +02:00
case " $EXTRA_MASTER_OPT " in
--timezone= *)
TZ = ` $ECHO " $EXTRA_MASTER_OPT " | $SED -e "s;--timezone=;;" `
export TZ
# Note that this must be set to space, not "" for test-reset to work
EXTRA_MASTER_OPT = " "
; ;
2004-03-10 19:54:07 +01:00
--result-file= *)
result_file = ` $ECHO " $EXTRA_MASTER_OPT " | $SED -e "s;--result-file=;;" `
2004-09-27 17:01:26 +02:00
result_file = " r/ $result_file .result "
2006-11-10 02:22:33 +01:00
# Note that this must be set to space, not "" for test-reset to work
2004-03-10 19:54:07 +01:00
EXTRA_MASTER_OPT = " "
; ;
2006-11-10 02:22:33 +01:00
--force-restart)
# Note that this must be set to space, not "" for test-reset to work
EXTRA_MASTER_OPT = " "
; ;
2003-05-27 15:40:14 +02:00
esac
2001-01-16 11:38:58 +01:00
stop_master
2004-09-28 19:04:30 +02:00
stop_master 1
2006-01-12 19:51:02 +01:00
# only stop the cluster if this test will not use cluster
if [ x$NDBCLUSTER_TEST != x1 ] ;
then
stop_ndbcluster
fi
2005-01-28 00:35:26 +01:00
report_current_test $tname
2006-01-12 19:51:02 +01:00
USING_NDBCLUSTER = $NDBCLUSTER_TEST
# start_ndbcluster knows if cluster is already started
start_ndbcluster
2001-01-16 11:38:58 +01:00
start_master
2006-01-12 19:51:02 +01:00
if [ x$USING_NDBCLUSTER = x1 -a -z " $DO_BENCH " -a -z " $DO_STRESS " ] ; then
2006-02-06 15:42:26 +01:00
echo " CURRENT_TEST: $tname " >> $MASTER_MYERR "1"
2004-09-28 19:04:30 +02:00
start_master 1
fi
2003-05-27 15:40:14 +02:00
TZ = $MY_TZ ; export TZ
2001-01-16 11:38:58 +01:00
else
2004-09-27 17:01:26 +02:00
# If we had extra master opts to the previous run
# or there is no master running (FIXME strange.....)
# or there is a master init script
if [ ! -z " $EXTRA_MASTER_OPT " ] || [ x$MASTER_RUNNING != x1 ] || \
2006-01-12 19:51:02 +01:00
[ -f $master_init_script ] || \
[ -n " $USE_NDBCLUSTER " -a x$NDBCLUSTER_TEST != x$USING_NDBCLUSTER ]
2001-01-16 11:38:58 +01:00
then
EXTRA_MASTER_OPT = ""
stop_master
2004-09-28 19:04:30 +02:00
stop_master 1
2006-01-12 19:51:02 +01:00
# only stop the cluster if this test will not use cluster
if [ x$NDBCLUSTER_TEST != x1 ] ;
then
stop_ndbcluster
fi
2005-01-28 00:35:26 +01:00
report_current_test $tname
2006-01-12 19:51:02 +01:00
USING_NDBCLUSTER = $NDBCLUSTER_TEST
# start_ndbcluster knows if cluster is already started
start_ndbcluster
2001-01-16 11:38:58 +01:00
start_master
2006-01-12 19:51:02 +01:00
if [ x$USING_NDBCLUSTER = x1 -a -z " $DO_BENCH " -a -z " $DO_STRESS " ] ; then
2006-02-06 15:42:26 +01:00
echo " CURRENT_TEST: $tname " >> $MASTER_MYERR "1"
2004-09-28 19:04:30 +02:00
start_master 1
fi
2003-01-07 15:53:10 +01:00
else
2005-01-28 00:35:26 +01:00
report_current_test $tname
2001-12-10 17:16:51 +01:00
fi
2001-01-16 11:38:58 +01:00
fi
2001-12-10 17:16:51 +01:00
2004-09-27 17:01:26 +02:00
# We never start a slave if embedded server is used
if [ " x $USE_EMBEDDED_SERVER " != "x1" ] ; then
do_slave_restart = 0
if [ -f $slave_opt_file ] ;
2001-01-16 11:38:58 +01:00
then
2004-09-27 17:01:26 +02:00
EXTRA_SLAVE_OPT = ` $CAT $slave_opt_file | $SED -e " s;\\ $MYSQL_TEST_DIR ; $MYSQL_TEST_DIR ; " `
2001-12-10 17:16:51 +01:00
do_slave_restart = 1
2004-09-27 17:01:26 +02:00
else
if [ ! -z " $EXTRA_SLAVE_OPT " ] || [ x$SLAVE_RUNNING != x1 ] ;
then
EXTRA_SLAVE_OPT = ""
do_slave_restart = 1
fi
2001-12-10 17:16:51 +01:00
fi
2001-01-16 11:38:58 +01:00
2004-09-27 17:01:26 +02:00
if [ -f $slave_master_info_file ] ; then
SLAVE_MASTER_INFO = ` $CAT $slave_master_info_file `
do_slave_restart = 1
else
if [ ! -z " $SLAVE_MASTER_INFO " ] || [ x$SLAVE_RUNNING != x1 ] ;
then
SLAVE_MASTER_INFO = ""
do_slave_restart = 1
fi
fi
2006-01-12 19:51:02 +01:00
USING_NDBCLUSTER = $NDBCLUSTER_TEST
if [ -n " $USE_NDBCLUSTER_SLAVE_OPT " ] ; then
if [ x$USING_NDBCLUSTER != x1 ] ; then
do_slave_restart = 1
fi
else
if [ x$USING_NDBCLUSTER = x1 ] ; then
do_slave_restart = 1
fi
fi
2004-09-27 17:01:26 +02:00
if [ x$do_slave_restart = x1 ] ; then
stop_slave
echo " CURRENT_TEST: $tname " >> $SLAVE_MYERR
start_slave
else
echo " CURRENT_TEST: $tname " >> $SLAVE_MYERR
fi
if [ x$many_slaves = x1 ] ; then
start_slave 1
start_slave 2
fi
2001-10-10 00:43:05 +02:00
fi
2000-12-13 17:58:26 +01:00
fi
2005-01-21 08:41:38 +01:00
if [ " x $START_AND_EXIT " = "x1" ] ; then
echo "Servers started, exiting"
exit
fi
2000-12-07 15:54:59 +01:00
cd $MYSQL_TEST_DIR
2001-12-10 17:16:51 +01:00
2000-10-10 01:53:10 +02:00
if [ -f $tf ] ; then
2000-12-28 18:25:41 +01:00
$RM -f r/$tname .*reject
2004-09-27 17:01:26 +02:00
mysql_test_args = " -R $result_file $EXTRA_MYSQL_TEST_OPT "
2001-10-08 03:58:07 +02:00
if [ -z " $DO_CLIENT_GDB " ] ; then
2005-12-07 14:54:06 +01:00
` $VALGRIND_MYSQLTEST $MYSQL_TEST $mysql_test_args < $tf 2> $TIMEFILE ` ;
2001-06-09 03:24:41 +02:00
else
2001-10-08 03:58:07 +02:00
do_gdb_test " $mysql_test_args " " $tf "
2001-06-09 03:24:41 +02:00
fi
2001-12-10 17:16:51 +01:00
2000-07-31 21:29:14 +02:00
res = $?
2005-12-06 21:34:35 +01:00
# Save the testcase log to mysqltest log file
echo " CURRENT_TEST: $tname " >> $MYSQLTEST_LOG
cat $TIMEFILE >> $MYSQLTEST_LOG
2001-06-25 10:35:22 +02:00
pname = ` $ECHO " $tname " | $CUT -c 1-24`
2003-05-13 10:39:07 +02:00
RES = " $pname "
2001-12-10 17:16:51 +01:00
2001-10-11 21:54:06 +02:00
if [ x$many_slaves = x1 ] ; then
stop_slave 1
stop_slave 2
fi
2001-12-10 17:16:51 +01:00
2000-12-28 18:25:41 +01:00
if [ $res = 0 ] ; then
2000-12-27 02:31:06 +01:00
total_inc
pass_inc
2004-09-27 17:01:26 +02:00
TIMER = ""
2004-09-28 18:25:57 +02:00
if [ x$USE_TIMER = x1 -a -f " $MY_LOG_DIR /timer " ] ; then
2004-09-27 17:01:26 +02:00
TIMER = ` cat $MY_LOG_DIR /timer`
TIMER = ` $PRINTF "%13s" $TIMER `
fi
$ECHO " $RES $RES_SPACE [ pass ] $TIMER "
2000-12-27 02:31:06 +01:00
else
2001-07-12 18:06:42 +02:00
# why the following ``if'' ? That is why res==1 is special ?
2005-05-15 06:59:34 +02:00
if [ $res = 62 ] ; then
2001-07-13 13:58:25 +02:00
skip_inc
$ECHO " $RES $RES_SPACE [ skipped ] "
else
2005-05-15 06:59:34 +02:00
if [ $res -ne 1 ] ; then
2004-01-11 18:15:19 +01:00
$ECHO " mysqltest returned unexpected code $res , it has probably crashed " >> $TIMEFILE
fi
2000-12-27 02:31:06 +01:00
total_inc
2000-12-14 18:05:04 +01:00
fail_inc
2001-01-04 01:56:38 +01:00
$ECHO " $RES $RES_SPACE [ fail ] "
2000-12-28 08:26:37 +01:00
$ECHO
error_is
2004-09-27 17:01:26 +02:00
show_failed_diff $tname
2000-10-10 10:42:07 +02:00
$ECHO
2000-12-07 15:54:59 +01:00
if [ x$FORCE != x1 ] ; then
2005-01-05 13:09:31 +01:00
$ECHO " Aborting: $tname failed in $TEST_MODE mode. To continue, re-run with '--force'. "
2000-12-28 08:26:37 +01:00
$ECHO
2005-01-26 10:19:28 +01:00
if [ -z " $DO_GDB " ] && [ $USE_RUNNING_SERVER -eq 0 ] && \
2004-09-27 17:01:26 +02:00
[ -z " $DO_DDD " ] && [ -z " $USE_EMBEDDED_SERVER " ]
2001-01-15 21:56:44 +01:00
then
mysql_stop
fi
2000-12-07 15:54:59 +01:00
exit 1
fi
2004-09-28 16:27:50 +02:00
FAILED_CASES = " $FAILED_CASES $tname "
2005-01-26 10:19:28 +01:00
if [ -z " $DO_GDB " ] && [ $USE_RUNNING_SERVER -eq 0 ] && \
2004-09-27 17:01:26 +02:00
[ -z " $DO_DDD " ] && [ -z " $USE_EMBEDDED_SERVER " ]
2001-01-15 21:56:44 +01:00
then
mysql_restart
fi
2000-12-27 02:31:06 +01:00
fi
2000-07-31 21:29:14 +02:00
fi
2001-01-03 15:54:46 +01:00
fi
2000-11-21 07:38:08 +01:00
}
2005-10-18 18:26:31 +02:00
run_stress_test( )
{
STRESS_BASEDIR = " $MYSQL_TEST_DIR /var/stress "
#Clean-up old stress test basedir
if [ -d $STRESS_BASEDIR ] ; then
$RM -rf $STRESS_BASEDIR
fi
#Create stress test basedir
mkdir $STRESS_BASEDIR
if [ " $STRESS_SUITE " != "main" -a " $STRESS_SUITE " != "default" ] ; then
STRESS_SUITE_DIR = " $MYSQL_TEST_DIR /suite/ $STRESS_SUITE "
else
STRESS_SUITE_DIR = " $MYSQL_TEST_DIR "
fi
if [ -d " $STRESS_SUITE_DIR " ] ; then
STRESS_SUITE_T_DIR = " $STRESS_SUITE_DIR /t "
STRESS_SUITE_R_DIR = " $STRESS_SUITE_DIR /r "
#FIXME: check that dirs above are exist
else
echo " Directory $STRESS_SUITE_DIR with test suite doesn't exists. Abort stress testing "
exit 1
fi
if [ -n " $STRESS_TEST " ] ; then
STRESS_TEST_FILE = " $STRESS_BASEDIR /stress_tests.txt "
echo $STRESS_TEST > $STRESS_TEST_FILE
elif [ -n " $STRESS_TEST_FILE " ] ; then
STRESS_TEST_FILE = " $STRESS_SUITE_DIR / $STRESS_TEST_FILE "
if [ ! -f " $STRESS_TEST_FILE " ] ; then
2005-10-18 22:49:31 +02:00
echo " Specified file $STRESS_TEST_FILE with list of tests does not exist "
echo "Please ensure that file exists and has proper permissions"
2005-10-18 18:26:31 +02:00
exit 1
fi
else
STRESS_TEST_FILE = " $STRESS_SUITE_DIR /stress_tests.txt "
if [ ! -f " $STRESS_TEST_FILE " ] ; then
2005-10-18 22:49:31 +02:00
echo " Default file $STRESS_TEST_FILE with list of tests does not exist. "
echo "Please use --stress-test-file option to specify custom one or you can"
echo "just specify name of test for testing as last argument in command line"
2005-10-18 18:26:31 +02:00
exit 1
fi
fi
if [ -n " $STRESS_INIT_FILE " ] ; then
STRESS_INIT_FILE = " $STRESS_SUITE_DIR / $STRESS_INIT_FILE "
if [ ! -f " $STRESS_INIT_FILE " ] ; then
2005-10-18 22:49:31 +02:00
echo " Specified file $STRESS_INIT_FILE with list of tests doesn't exist. "
echo "Please ensure that file exists and has proper permissions"
2005-10-18 18:26:31 +02:00
exit 1
fi
else
STRESS_INIT_FILE = " $STRESS_SUITE_DIR /stress_init.txt "
#Check for default init file
if [ ! -f " $STRESS_INIT_FILE " ] ; then
STRESS_INIT_FILE = ""
fi
fi
if [ " $STRESS_MODE " != "random" -a " $STRESS_MODE " != "seq" ] ; then
2005-10-18 22:49:31 +02:00
echo " You specified wrong mode ' $STRESS_MODE ' for stress test. "
echo "Correct values are 'random' or 'seq'"
2005-10-18 18:26:31 +02:00
exit 1
fi
STRESS_TEST_ARGS = " --server-socket= $MASTER_MYSOCK \
--server-user= $DBUSER \
--server-database= $DB \
--stress-suite-basedir= $MYSQL_TEST_DIR \
--suite= $STRESS_SUITE \
--stress-tests-file= $STRESS_TEST_FILE \
--stress-basedir= $STRESS_BASEDIR \
--server-logs-dir= $STRESS_BASEDIR \
--stress-mode= $STRESS_MODE \
2005-12-15 23:23:55 +01:00
--mysqltest= $CLIENT_BINDIR /mysqltest \
2005-10-18 18:26:31 +02:00
--threads= $STRESS_THREADS \
--verbose \
--cleanup \
--log-error-details \
--abort-on-error"
if [ -n " $STRESS_INIT_FILE " ] ; then
STRESS_TEST_ARGS = " $STRESS_TEST_ARGS --stress-init-file= $STRESS_INIT_FILE "
fi
2005-12-15 23:23:55 +01:00
if [ -z " $STRESS_LOOP_COUNT " -a -z " $STRESS_TEST_COUNT " -a
-z " $STRESS_TEST_DURATION " ] ; then
#Limit stress testing with 20 loops in case when any limit parameter
#was specified
STRESS_TEST_COUNT = 20
fi
2005-10-18 18:26:31 +02:00
if [ -n " $STRESS_LOOP_COUNT " ] ; then
STRESS_TEST_ARGS = " $STRESS_TEST_ARGS --loop-count= $STRESS_LOOP_COUNT "
fi
if [ -n " $STRESS_TEST_COUNT " ] ; then
STRESS_TEST_ARGS = " $STRESS_TEST_ARGS --test-count= $STRESS_TEST_COUNT "
fi
if [ -n " $STRESS_TEST_DURATION " ] ; then
STRESS_TEST_ARGS = " $STRESS_TEST_ARGS --test-duration= $STRESS_TEST_DURATION "
fi
echo "Stress test related variables:"
echo " TESTS - $1 "
echo " STRESS - $DO_STRESS "
echo " STRESS_SUITE - $STRESS_SUITE "
echo " STRESS_TEST_FILE - $STRESS_TEST_FILE "
echo " STRESS_INIT_FILE - $STRESS_INIT_FILE "
echo " STRESS_THREADS - $STRESS_THREADS "
echo " STRESS_MODE - $STRESS_MODE "
echo " STRESS_TEST_COUNT - $STRESS_TEST_COUNT "
echo " STRESS_LOOP_COUNT - $STRESS_LOOP_COUNT "
echo " STRESS_TEST_DURATION - $STRESS_TEST_DURATION "
#echo "$STRESS_TEST_ARGS";
#Run stress test
$MYSQL_TEST_DIR /mysql-stress-test.pl $STRESS_TEST_ARGS
}
2000-12-28 18:25:41 +01:00
######################################################################
# Main script starts here
######################################################################
2000-11-21 07:38:08 +01:00
[ " $DO_GCOV " -a ! -x " $GCOV " ] && error "No gcov found"
2001-12-10 17:16:51 +01:00
[ " $DO_GCOV " ] && gcov_prepare
[ " $DO_GPROF " ] && gprof_prepare
2000-11-21 07:38:08 +01:00
2005-01-26 10:19:28 +01:00
if [ $USE_RUNNING_SERVER -eq 0 ]
2001-01-07 23:04:30 +01:00
then
2002-12-05 02:40:33 +01:00
if [ -z " $FAST_START " ]
then
# Ensure that no old mysqld test servers are running
$MYSQLADMIN --no-defaults --socket= $MASTER_MYSOCK -u root -O connect_timeout = 5 -O shutdown_timeout = 20 shutdown > /dev/null 2>& 1
2004-10-04 01:41:15 +02:00
$MYSQLADMIN --no-defaults --socket= $MASTER_MYSOCK1 -u root -O connect_timeout = 5 -O shutdown_timeout = 20 shutdown > /dev/null 2>& 1
2002-12-05 02:40:33 +01:00
$MYSQLADMIN --no-defaults --socket= $SLAVE_MYSOCK -u root -O connect_timeout = 5 -O shutdown_timeout = 20 shutdown > /dev/null 2>& 1
2005-11-23 21:45:02 +01:00
$MYSQLADMIN --no-defaults --host= $hostname --port= $MASTER_MYPORT --protocol= tcp -u root -O connect_timeout = 5 -O shutdown_timeout = 20 shutdown > /dev/null 2>& 1
2006-12-15 01:13:07 +01:00
$MYSQLADMIN --no-defaults --host= $hostname --protocol= tcp --port= ` expr $MASTER_MYPORT + 1` -u root -O connect_timeout = 5 -O shutdown_timeout = 20 shutdown > /dev/null 2>& 1
2005-11-23 21:45:02 +01:00
$MYSQLADMIN --no-defaults --host= $hostname --protocol= tcp --port= $SLAVE_MYPORT -u root -O connect_timeout = 5 -O shutdown_timeout = 20 shutdown > /dev/null 2>& 1
$MYSQLADMIN --no-defaults --host= $hostname --protocol= tcp --port= ` expr $SLAVE_MYPORT + 1` -u root -O connect_timeout = 5 -O shutdown_timeout = 20 shutdown > /dev/null 2>& 1
2002-12-05 02:40:33 +01:00
sleep_until_file_deleted 0 $MASTER_MYPID
2004-10-04 01:41:15 +02:00
sleep_until_file_deleted 0 $MASTER_MYPID "1"
2002-12-05 02:40:33 +01:00
sleep_until_file_deleted 0 $SLAVE_MYPID
else
2004-10-04 01:41:15 +02:00
rm $MASTER_MYPID $MASTER_MYPID "1" $SLAVE_MYPID
2002-12-05 02:40:33 +01:00
fi
2001-12-10 17:16:51 +01:00
2006-01-12 19:51:02 +01:00
# just to force stopping anything from previous runs
USE_NDBCLUSTER_OPT = $USE_NDBCLUSTER
2004-10-04 02:25:04 +02:00
stop_ndbcluster
2004-04-14 17:16:31 +02:00
2001-12-10 17:16:51 +01:00
# Remove files that can cause problems
2004-04-15 17:30:50 +02:00
$RM -rf $MYSQL_TEST_DIR /var/ndbcluster
This changeset is largely a handler cleanup changeset (WL#3281), but includes fixes and cleanups that was found necessary while testing the handler changes
Changes that requires code changes in other code of other storage engines.
(Note that all changes are very straightforward and one should find all issues
by compiling a --debug build and fixing all compiler errors and all
asserts in field.cc while running the test suite),
- New optional handler function introduced: reset()
This is called after every DML statement to make it easy for a handler to
statement specific cleanups.
(The only case it's not called is if force the file to be closed)
- handler::extra(HA_EXTRA_RESET) is removed. Code that was there before
should be moved to handler::reset()
- table->read_set contains a bitmap over all columns that are needed
in the query. read_row() and similar functions only needs to read these
columns
- table->write_set contains a bitmap over all columns that will be updated
in the query. write_row() and update_row() only needs to update these
columns.
The above bitmaps should now be up to date in all context
(including ALTER TABLE, filesort()).
The handler is informed of any changes to the bitmap after
fix_fields() by calling the virtual function
handler::column_bitmaps_signal(). If the handler does caching of
these bitmaps (instead of using table->read_set, table->write_set),
it should redo the caching in this code. as the signal() may be sent
several times, it's probably best to set a variable in the signal
and redo the caching on read_row() / write_row() if the variable was
set.
- Removed the read_set and write_set bitmap objects from the handler class
- Removed all column bit handling functions from the handler class.
(Now one instead uses the normal bitmap functions in my_bitmap.c instead
of handler dedicated bitmap functions)
- field->query_id is removed. One should instead instead check
table->read_set and table->write_set if a field is used in the query.
- handler::extra(HA_EXTRA_RETRIVE_ALL_COLS) and
handler::extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) are removed. One should now
instead use table->read_set to check for which columns to retrieve.
- If a handler needs to call Field->val() or Field->store() on columns
that are not used in the query, one should install a temporary
all-columns-used map while doing so. For this, we provide the following
functions:
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
field->val();
dbug_tmp_restore_column_map(table->read_set, old_map);
and similar for the write map:
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set);
field->val();
dbug_tmp_restore_column_map(table->write_set, old_map);
If this is not done, you will sooner or later hit a DBUG_ASSERT
in the field store() / val() functions.
(For not DBUG binaries, the dbug_tmp_restore_column_map() and
dbug_tmp_restore_column_map() are inline dummy functions and should
be optimized away be the compiler).
- If one needs to temporary set the column map for all binaries (and not
just to avoid the DBUG_ASSERT() in the Field::store() / Field::val()
methods) one should use the functions tmp_use_all_columns() and
tmp_restore_column_map() instead of the above dbug_ variants.
- All 'status' fields in the handler base class (like records,
data_file_length etc) are now stored in a 'stats' struct. This makes
it easier to know what status variables are provided by the base
handler. This requires some trivial variable names in the extra()
function.
- New virtual function handler::records(). This is called to optimize
COUNT(*) if (handler::table_flags() & HA_HAS_RECORDS()) is true.
(stats.records is not supposed to be an exact value. It's only has to
be 'reasonable enough' for the optimizer to be able to choose a good
optimization path).
- Non virtual handler::init() function added for caching of virtual
constants from engine.
- Removed has_transactions() virtual method. Now one should instead return
HA_NO_TRANSACTIONS in table_flags() if the table handler DOES NOT support
transactions.
- The 'xxxx_create_handler()' function now has a MEM_ROOT_root argument
that is to be used with 'new handler_name()' to allocate the handler
in the right area. The xxxx_create_handler() function is also
responsible for any initialization of the object before returning.
For example, one should change:
static handler *myisam_create_handler(TABLE_SHARE *table)
{
return new ha_myisam(table);
}
->
static handler *myisam_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
{
return new (mem_root) ha_myisam(table);
}
- New optional virtual function: use_hidden_primary_key().
This is called in case of an update/delete when
(table_flags() and HA_PRIMARY_KEY_REQUIRED_FOR_DELETE) is defined
but we don't have a primary key. This allows the handler to take precisions
in remembering any hidden primary key to able to update/delete any
found row. The default handler marks all columns to be read.
- handler::table_flags() now returns a ulonglong (to allow for more flags).
- New/changed table_flags()
- HA_HAS_RECORDS Set if ::records() is supported
- HA_NO_TRANSACTIONS Set if engine doesn't support transactions
- HA_PRIMARY_KEY_REQUIRED_FOR_DELETE
Set if we should mark all primary key columns for
read when reading rows as part of a DELETE
statement. If there is no primary key,
all columns are marked for read.
- HA_PARTIAL_COLUMN_READ Set if engine will not read all columns in some
cases (based on table->read_set)
- HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS
Renamed to HA_PRIMARY_KEY_REQUIRED_FOR_POSITION.
- HA_DUPP_POS Renamed to HA_DUPLICATE_POS
- HA_REQUIRES_KEY_COLUMNS_FOR_DELETE
Set this if we should mark ALL key columns for
read when when reading rows as part of a DELETE
statement. In case of an update we will mark
all keys for read for which key part changed
value.
- HA_STATS_RECORDS_IS_EXACT
Set this if stats.records is exact.
(This saves us some extra records() calls
when optimizing COUNT(*))
- Removed table_flags()
- HA_NOT_EXACT_COUNT Now one should instead use HA_HAS_RECORDS if
handler::records() gives an exact count() and
HA_STATS_RECORDS_IS_EXACT if stats.records is exact.
- HA_READ_RND_SAME Removed (no one supported this one)
- Removed not needed functions ha_retrieve_all_cols() and ha_retrieve_all_pk()
- Renamed handler::dupp_pos to handler::dup_pos
- Removed not used variable handler::sortkey
Upper level handler changes:
- ha_reset() now does some overall checks and calls ::reset()
- ha_table_flags() added. This is a cached version of table_flags(). The
cache is updated on engine creation time and updated on open.
MySQL level changes (not obvious from the above):
- DBUG_ASSERT() added to check that column usage matches what is set
in the column usage bit maps. (This found a LOT of bugs in current
column marking code).
- In 5.1 before, all used columns was marked in read_set and only updated
columns was marked in write_set. Now we only mark columns for which we
need a value in read_set.
- Column bitmaps are created in open_binary_frm() and open_table_from_share().
(Before this was in table.cc)
- handler::table_flags() calls are replaced with handler::ha_table_flags()
- For calling field->val() you must have the corresponding bit set in
table->read_set. For calling field->store() you must have the
corresponding bit set in table->write_set. (There are asserts in
all store()/val() functions to catch wrong usage)
- thd->set_query_id is renamed to thd->mark_used_columns and instead
of setting this to an integer value, this has now the values:
MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE
Changed also all variables named 'set_query_id' to mark_used_columns.
- In filesort() we now inform the handler of exactly which columns are needed
doing the sort and choosing the rows.
- The TABLE_SHARE object has a 'all_set' column bitmap one can use
when one needs a column bitmap with all columns set.
(This is used for table->use_all_columns() and other places)
- The TABLE object has 3 column bitmaps:
- def_read_set Default bitmap for columns to be read
- def_write_set Default bitmap for columns to be written
- tmp_set Can be used as a temporary bitmap when needed.
The table object has also two pointer to bitmaps read_set and write_set
that the handler should use to find out which columns are used in which way.
- count() optimization now calls handler::records() instead of using
handler->stats.records (if (table_flags() & HA_HAS_RECORDS) is true).
- Added extra argument to Item::walk() to indicate if we should also
traverse sub queries.
- Added TABLE parameter to cp_buffer_from_ref()
- Don't close tables created with CREATE ... SELECT but keep them in
the table cache. (Faster usage of newly created tables).
New interfaces:
- table->clear_column_bitmaps() to initialize the bitmaps for tables
at start of new statements.
- table->column_bitmaps_set() to set up new column bitmaps and signal
the handler about this.
- table->column_bitmaps_set_no_signal() for some few cases where we need
to setup new column bitmaps but don't signal the handler (as the handler
has already been signaled about these before). Used for the momement
only in opt_range.cc when doing ROR scans.
- table->use_all_columns() to install a bitmap where all columns are marked
as use in the read and the write set.
- table->default_column_bitmaps() to install the normal read and write
column bitmaps, but not signaling the handler about this.
This is mainly used when creating TABLE instances.
- table->mark_columns_needed_for_delete(),
table->mark_columns_needed_for_delete() and
table->mark_columns_needed_for_insert() to allow us to put additional
columns in column usage maps if handler so requires.
(The handler indicates what it neads in handler->table_flags())
- table->prepare_for_position() to allow us to tell handler that it
needs to read primary key parts to be able to store them in
future table->position() calls.
(This replaces the table->file->ha_retrieve_all_pk function)
- table->mark_auto_increment_column() to tell handler are going to update
columns part of any auto_increment key.
- table->mark_columns_used_by_index() to mark all columns that is part of
an index. It will also send extra(HA_EXTRA_KEYREAD) to handler to allow
it to quickly know that it only needs to read colums that are part
of the key. (The handler can also use the column map for detecting this,
but simpler/faster handler can just monitor the extra() call).
- table->mark_columns_used_by_index_no_reset() to in addition to other columns,
also mark all columns that is used by the given key.
- table->restore_column_maps_after_mark_index() to restore to default
column maps after a call to table->mark_columns_used_by_index().
- New item function register_field_in_read_map(), for marking used columns
in table->read_map. Used by filesort() to mark all used columns
- Maintain in TABLE->merge_keys set of all keys that are used in query.
(Simplices some optimization loops)
- Maintain Field->part_of_key_not_clustered which is like Field->part_of_key
but the field in the clustered key is not assumed to be part of all index.
(used in opt_range.cc for faster loops)
- dbug_tmp_use_all_columns(), dbug_tmp_restore_column_map()
tmp_use_all_columns() and tmp_restore_column_map() functions to temporally
mark all columns as usable. The 'dbug_' version is primarily intended
inside a handler when it wants to just call Field:store() & Field::val()
functions, but don't need the column maps set for any other usage.
(ie:: bitmap_is_set() is never called)
- We can't use compare_records() to skip updates for handlers that returns
a partial column set and the read_set doesn't cover all columns in the
write set. The reason for this is that if we have a column marked only for
write we can't in the MySQL level know if the value changed or not.
The reason this worked before was that MySQL marked all to be written
columns as also to be read. The new 'optimal' bitmaps exposed this 'hidden
bug'.
- open_table_from_share() does not anymore setup temporary MEM_ROOT
object as a thread specific variable for the handler. Instead we
send the to-be-used MEMROOT to get_new_handler().
(Simpler, faster code)
Bugs fixed:
- Column marking was not done correctly in a lot of cases.
(ALTER TABLE, when using triggers, auto_increment fields etc)
(Could potentially result in wrong values inserted in table handlers
relying on that the old column maps or field->set_query_id was correct)
Especially when it comes to triggers, there may be cases where the
old code would cause lost/wrong values for NDB and/or InnoDB tables.
- Split thd->options flag OPTION_STATUS_NO_TRANS_UPDATE to two flags:
OPTION_STATUS_NO_TRANS_UPDATE and OPTION_KEEP_LOG.
This allowed me to remove some wrong warnings about:
"Some non-transactional changed tables couldn't be rolled back"
- Fixed handling of INSERT .. SELECT and CREATE ... SELECT that wrongly reset
(thd->options & OPTION_STATUS_NO_TRANS_UPDATE) which caused us to loose
some warnings about
"Some non-transactional changed tables couldn't be rolled back")
- Fixed use of uninitialized memory in ha_ndbcluster.cc::delete_table()
which could cause delete_table to report random failures.
- Fixed core dumps for some tests when running with --debug
- Added missing FN_LIBCHAR in mysql_rm_tmp_tables()
(This has probably caused us to not properly remove temporary files after
crash)
- slow_logs was not properly initialized, which could maybe cause
extra/lost entries in slow log.
- If we get an duplicate row on insert, change column map to read and
write all columns while retrying the operation. This is required by
the definition of REPLACE and also ensures that fields that are only
part of UPDATE are properly handled. This fixed a bug in NDB and
REPLACE where REPLACE wrongly copied some column values from the replaced
row.
- For table handler that doesn't support NULL in keys, we would give an error
when creating a primary key with NULL fields, even after the fields has been
automaticly converted to NOT NULL.
- Creating a primary key on a SPATIAL key, would fail if field was not
declared as NOT NULL.
Cleanups:
- Removed not used condition argument to setup_tables
- Removed not needed item function reset_query_id_processor().
- Field->add_index is removed. Now this is instead maintained in
(field->flags & FIELD_IN_ADD_INDEX)
- Field->fieldnr is removed (use field->field_index instead)
- New argument to filesort() to indicate that it should return a set of
row pointers (not used columns). This allowed me to remove some references
to sql_command in filesort and should also enable us to return column
results in some cases where we couldn't before.
- Changed column bitmap handling in opt_range.cc to be aligned with TABLE
bitmap, which allowed me to use bitmap functions instead of looping over
all fields to create some needed bitmaps. (Faster and smaller code)
- Broke up found too long lines
- Moved some variable declaration at start of function for better code
readability.
- Removed some not used arguments from functions.
(setup_fields(), mysql_prepare_insert_check_table())
- setup_fields() now takes an enum instead of an int for marking columns
usage.
- For internal temporary tables, use handler::write_row(),
handler::delete_row() and handler::update_row() instead of
handler::ha_xxxx() for faster execution.
- Changed some constants to enum's and define's.
- Using separate column read and write sets allows for easier checking
of timestamp field was set by statement.
- Remove calls to free_io_cache() as this is now done automaticly in ha_reset()
- Don't build table->normalized_path as this is now identical to table->path
(after bar's fixes to convert filenames)
- Fixed some missed DBUG_PRINT(.."%lx") to use "0x%lx" to make it easier to
do comparision with the 'convert-dbug-for-diff' tool.
Things left to do in 5.1:
- We wrongly log failed CREATE TABLE ... SELECT in some cases when using
row based logging (as shown by testcase binlog_row_mix_innodb_myisam.result)
Mats has promised to look into this.
- Test that my fix for CREATE TABLE ... SELECT is indeed correct.
(I added several test cases for this, but in this case it's better that
someone else also tests this throughly).
Lars has promosed to do this.
2006-06-04 17:52:22 +02:00
$RM -rf $MYSQL_TEST_DIR /var/tmp/snapshot*
2006-11-23 15:41:21 +01:00
$RM -rf $MYSQL_TEST_DIR /var/run/* $MYSQL_TEST_DIR /var/tmp/*
2001-12-10 17:16:51 +01:00
2002-12-25 13:34:32 +01:00
# Remove old berkeley db log files that can confuse the server
$RM -f $MASTER_MYDDIR /log.*
2004-09-28 19:04:30 +02:00
$RM -f $MASTER_MYDDIR "1" /log.*
2002-12-25 13:34:32 +01:00
2006-11-20 21:42:06 +01:00
# Remove old log and reject files
$RM -f r/*.reject r/*.progress r/*.log r/*.warnings
2001-12-13 01:31:19 +01:00
wait_for_master = $SLEEP_TIME_FOR_FIRST_MASTER
wait_for_slave = $SLEEP_TIME_FOR_FIRST_SLAVE
2001-01-07 23:04:30 +01:00
$ECHO "Installing Test Databases"
mysql_install_db
2004-04-14 17:16:31 +02:00
2005-06-10 12:58:05 +02:00
if [ -n " $1 " -a ` expr " X $* " : '.*ndb' ` -eq 0 ]
then
2006-01-12 19:51:02 +01:00
USING_NDBCLUSTER = 0
USE_NDBCLUSTER_OPT =
2005-06-10 12:58:05 +02:00
fi
2006-07-14 00:07:37 +02:00
mysql_start
2001-01-07 23:04:30 +01:00
$ECHO "Loading Standard Test Databases"
mysql_loadstd
2000-11-21 07:38:08 +01:00
fi
2000-12-28 08:26:37 +01:00
$ECHO "Starting Tests"
2000-11-21 07:38:08 +01:00
2005-01-26 10:19:28 +01:00
# Some test cases need USE_RUNNING_SERVER
export USE_RUNNING_SERVER
2003-08-22 03:07:40 +02:00
#
# This can probably be deleted
#
2001-04-13 20:51:27 +02:00
if [ " $DO_BENCH " = 1 ]
then
2004-04-30 10:08:44 +02:00
start_master
2004-09-24 18:58:25 +02:00
if [ " $DO_SMALL_BENCH " = 1 ]
then
EXTRA_BENCH_ARGS = "--small-test --small-tables"
fi
2006-01-12 19:51:02 +01:00
if [ x$USING_NDBCLUSTER = x1 ]
2004-04-30 10:08:44 +02:00
then
2004-09-24 18:58:25 +02:00
EXTRA_BENCH_ARGS = " --create-options=TYPE=ndb $EXTRA_BENCH_ARGS "
2004-04-30 10:08:44 +02:00
fi
2001-12-10 17:16:51 +01:00
BENCHDIR = $BASEDIR /sql-bench/
savedir = ` pwd `
cd $BENCHDIR
if [ -z " $1 " ]
2001-04-13 20:51:27 +02:00
then
2004-09-24 18:58:25 +02:00
./run-all-tests --socket= $MASTER_MYSOCK --user= root $EXTRA_BENCH_ARGS --log
2001-04-13 20:51:27 +02:00
else
2001-12-10 17:16:51 +01:00
if [ -x " ./ $1 " ]
then
2004-04-30 10:08:44 +02:00
./$1 --socket= $MASTER_MYSOCK --user= root $EXTRA_BENCH_ARGS
2001-12-10 17:16:51 +01:00
else
echo " benchmark $1 not found "
fi
2001-04-13 20:51:27 +02:00
fi
2001-12-10 17:16:51 +01:00
cd $savedir
mysql_stop
exit
2001-04-13 20:51:27 +02:00
fi
2005-10-18 18:26:31 +02:00
#
# Stress testing
#
if [ " $DO_STRESS " = 1 ]
then
if [ -n " $1 " ] ; then
STRESS_TEST = " $1 " ;
fi
if [ $USE_RUNNING_SERVER -eq 0 ] ; then
start_master
fi
run_stress_test
if [ $USE_RUNNING_SERVER -eq 0 ] ; then
mysql_stop
fi
exit
fi
2000-11-21 07:38:08 +01:00
$ECHO
2004-09-28 18:25:57 +02:00
if [ x$USE_TIMER = x1 ] ; then
2004-09-27 17:01:26 +02:00
$ECHO "TEST RESULT TIME (ms)"
2004-09-28 18:25:57 +02:00
else
$ECHO "TEST RESULT"
fi
2000-11-21 07:38:08 +01:00
$ECHO $DASH72
2000-12-14 18:05:04 +01:00
if [ -z " $1 " ] ;
2000-11-21 07:38:08 +01:00
then
2002-10-25 01:46:14 +02:00
if [ x$RECORD = x1 ] ; then
$ECHO "Will not run in record mode without a specific test case."
else
2003-08-25 15:40:14 +02:00
for tf in $TESTDIR /*.$TESTSUFFIX
do
run_testcase $tf
done
2002-10-25 01:46:14 +02:00
$RM -f $TIMEFILE # Remove for full test
fi
2001-12-10 17:16:51 +01:00
else
2001-11-20 14:18:57 +01:00
while [ ! -z " $1 " ] ; do
tname = ` $BASENAME $1 .test`
tf = $TESTDIR /$tname .$TESTSUFFIX
if [ -f $tf ] ; then
run_testcase $tf
else
$ECHO " Test case $tf does not exist. "
fi
shift
done
2000-11-21 07:38:08 +01:00
fi
2000-07-31 21:29:14 +02:00
2000-10-10 10:42:07 +02:00
$ECHO $DASH72
$ECHO
2000-12-28 08:26:37 +01:00
2005-01-26 10:19:28 +01:00
if [ -z " $DO_GDB " ] && [ $USE_RUNNING_SERVER -eq 0 ] && [ -z " $DO_DDD " ]
2000-11-21 07:38:08 +01:00
then
mysql_stop
fi
2000-07-31 21:29:14 +02:00
report_stats
2000-10-10 10:42:07 +02:00
$ECHO
2000-07-31 21:29:14 +02:00
2000-10-12 15:51:19 +02:00
[ " $DO_GCOV " ] && gcov_collect # collect coverage information
2001-04-10 02:25:06 +02:00
[ " $DO_GPROF " ] && gprof_collect # collect coverage information
2000-10-12 01:01:58 +02:00
2004-09-28 16:27:50 +02:00
if [ $TOT_FAIL -ne 0 ] ; then
2005-01-05 13:09:31 +01:00
$ECHO " mysql-test-run in $TEST_MODE mode: *** Failing the test(s): $FAILED_CASES "
2004-09-28 16:27:50 +02:00
$ECHO
exit 1
fi
2006-05-04 21:19:31 +02:00
if [ $GOT_WARNINGS -ne 0 ] ; then
exit 1
fi
exit 0