summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/Makefile.am2
-rwxr-xr-xmysql-test/fix-result22
-rw-r--r--mysql-test/include/have_openssl.inc2
-rw-r--r--mysql-test/include/have_openssl_1.inc2
-rw-r--r--mysql-test/include/have_openssl_2.inc2
-rw-r--r--mysql-test/install_test_db.sh28
-rw-r--r--mysql-test/mysql-test-run.sh191
-rw-r--r--mysql-test/r/big_test.require2
-rw-r--r--mysql-test/r/count_distinct2.result84
-rw-r--r--mysql-test/r/ctype_latin1_de.result175
-rw-r--r--mysql-test/r/fulltext_distinct.result10
-rw-r--r--mysql-test/r/fulltext_var.result4
-rw-r--r--mysql-test/r/func_like.result3
-rw-r--r--mysql-test/r/func_time.result24
-rw-r--r--mysql-test/r/handler.result87
-rw-r--r--mysql-test/r/have_openssl.require2
-rw-r--r--mysql-test/r/have_openssl_1.require2
-rw-r--r--mysql-test/r/have_openssl_2.require2
-rw-r--r--mysql-test/r/have_symlink.require2
-rw-r--r--mysql-test/r/innodb.result4
-rw-r--r--mysql-test/r/insert_select.result2
-rw-r--r--mysql-test/r/multi_update.result22
-rw-r--r--mysql-test/r/null_key.result2
-rw-r--r--mysql-test/r/openssl_1.result16
-rw-r--r--mysql-test/r/openssl_2.result16
-rw-r--r--mysql-test/r/order_by.result116
-rw-r--r--mysql-test/r/order_fill_sortbuf.result2
-rw-r--r--mysql-test/r/rpl000002.result2
-rw-r--r--mysql-test/r/rpl000009.result30
-rw-r--r--mysql-test/r/rpl000014.result20
-rw-r--r--mysql-test/r/rpl000015.result18
-rw-r--r--mysql-test/r/rpl000016.result14
-rw-r--r--mysql-test/r/rpl_log.result71
-rw-r--r--mysql-test/r/rpl_magic.result22
-rw-r--r--mysql-test/r/select.result2
-rw-r--r--mysql-test/r/select_found.result31
-rw-r--r--mysql-test/r/show_check.result3
-rw-r--r--mysql-test/r/symlink.result23
-rw-r--r--mysql-test/r/truncate.result1
-rw-r--r--mysql-test/r/type_datetime.result2
-rw-r--r--mysql-test/r/union.result61
-rw-r--r--mysql-test/r/varbinary.result4
-rw-r--r--mysql-test/std_data/master-bin.001bin113 -> 98 bytes
-rw-r--r--mysql-test/t/alter_table.test21
-rw-r--r--mysql-test/t/analyse.test1
-rw-r--r--mysql-test/t/bdb-crash.test1
-rw-r--r--mysql-test/t/check.test1
-rw-r--r--mysql-test/t/count_distinct2-master.opt1
-rw-r--r--mysql-test/t/count_distinct2.test74
-rw-r--r--mysql-test/t/ctype_latin1_de-master.opt1
-rw-r--r--mysql-test/t/ctype_latin1_de.test46
-rw-r--r--mysql-test/t/drop.test8
-rw-r--r--mysql-test/t/fulltext.test3
-rw-r--r--mysql-test/t/fulltext_distinct.test39
-rw-r--r--mysql-test/t/fulltext_var.test5
-rw-r--r--mysql-test/t/func_like.test2
-rw-r--r--mysql-test/t/func_time.test12
-rw-r--r--mysql-test/t/handler.test65
-rw-r--r--mysql-test/t/innodb.test34
-rw-r--r--mysql-test/t/insert.test12
-rw-r--r--mysql-test/t/insert_select.test56
-rw-r--r--mysql-test/t/merge.test2
-rw-r--r--mysql-test/t/multi_update.test51
-rw-r--r--mysql-test/t/openssl_1.test6
-rw-r--r--mysql-test/t/openssl_2.test5
-rw-r--r--mysql-test/t/order_by.test49
-rw-r--r--mysql-test/t/order_fill_sortbuf-master.opt1
-rw-r--r--mysql-test/t/order_fill_sortbuf.test20
-rw-r--r--mysql-test/t/rpl000002.test1
-rw-r--r--mysql-test/t/rpl000009.test53
-rw-r--r--mysql-test/t/rpl000014.test2
-rwxr-xr-xmysql-test/t/rpl000017-slave.sh1
-rw-r--r--mysql-test/t/rpl_log.test48
-rw-r--r--mysql-test/t/rpl_magic.test31
-rw-r--r--mysql-test/t/rpl_mystery22.test1
-rw-r--r--mysql-test/t/rpl_sporadic_master.test8
-rw-r--r--mysql-test/t/select_found.test20
-rw-r--r--mysql-test/t/show_check.test7
-rw-r--r--mysql-test/t/status.test2
-rw-r--r--mysql-test/t/symlink.test82
-rw-r--r--mysql-test/t/truncate.test6
-rw-r--r--mysql-test/t/type_datetime.test9
-rw-r--r--mysql-test/t/union.test42
-rw-r--r--mysql-test/t/varbinary.test16
84 files changed, 1883 insertions, 92 deletions
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index d98c10a29a9..91333dfad9b 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -59,6 +59,8 @@ SUFFIXES = .sh
-e 's!@''libexecdir''@!$(libexecdir)!g' \
-e 's!@''PERL''@!@PERL@!' \
-e 's!@''VERSION''@!@VERSION@!' \
+ -e 's!@''MYSQL_BASE_VERSION''@!@MYSQL_BASE_VERSION@!' \
+ -e 's!@''MYSQL_NO_DASH_VERSION''@!@MYSQL_NO_DASH_VERSION@!' \
-e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \
$< > $@-t
@CHMOD@ +x $@-t
diff --git a/mysql-test/fix-result b/mysql-test/fix-result
new file mode 100755
index 00000000000..7060db36e03
--- /dev/null
+++ b/mysql-test/fix-result
@@ -0,0 +1,22 @@
+#! /bin/sh
+
+# Sasha's hack to fix results generated with mysql-test-run --record
+# to be version and test port independent. In some cases, further minor
+# manual edititing may be required, but most of the time it should not
+# happen
+
+#It is assumed we are running the script in mysql-test directory
+
+VERSION=4.0.0-debug-log
+TEST_CASE=$1
+
+if [ -z "$TEST_CASE" ] ;
+then
+ echo "usage: $0 test_case_name"
+ exit 1
+fi
+
+../extra/replace $VERSION '$VERSION' 9306 '$MASTER_MYPORT' 9307 \
+'$SLAVE_MYPORT' \\ \\\\ -- r/$TEST_CASE.result
+
+
diff --git a/mysql-test/include/have_openssl.inc b/mysql-test/include/have_openssl.inc
new file mode 100644
index 00000000000..b9aa2dadb9e
--- /dev/null
+++ b/mysql-test/include/have_openssl.inc
@@ -0,0 +1,2 @@
+-- require r/have_openssl.require
+show variables like "have_openssl";
diff --git a/mysql-test/include/have_openssl_1.inc b/mysql-test/include/have_openssl_1.inc
new file mode 100644
index 00000000000..5aa93b688f3
--- /dev/null
+++ b/mysql-test/include/have_openssl_1.inc
@@ -0,0 +1,2 @@
+-- require r/have_openssl_1.require
+show variables like "have_openssl";
diff --git a/mysql-test/include/have_openssl_2.inc b/mysql-test/include/have_openssl_2.inc
new file mode 100644
index 00000000000..b15af43715b
--- /dev/null
+++ b/mysql-test/include/have_openssl_2.inc
@@ -0,0 +1,2 @@
+-- require r/have_openssl_2.require
+SHOW STATUS LIKE "SSL_get_cipher";
diff --git a/mysql-test/install_test_db.sh b/mysql-test/install_test_db.sh
index 6fe736644d3..0535b66e289 100644
--- a/mysql-test/install_test_db.sh
+++ b/mysql-test/install_test_db.sh
@@ -30,7 +30,7 @@ else
fi
mdata=$data/mysql
-
+EXTRA_ARG=""
if test ! -x $execdir/mysqld
then
@@ -57,9 +57,7 @@ if [ x$BINARY_DIST = x1 ] ; then
basedir=..
else
basedir=.
-rm -rf share
-mkdir share
-ln -f -s ../../sql/share share/mysql
+EXTRA_ARG="--language=../sql/share/english/"
fi
# Initialize variables
@@ -136,16 +134,20 @@ then
c_u="$c_u References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ c_u="$c_u ssl_type enum('none', 'cipher', 'x509','issuer','subject') NOT NULL,"
+ c_u="$c_u ssl_cipher char(60) NULL,"
+ c_u="$c_u x509_issuer blob NULL,"
+ c_u="$c_u x509_subject blob NULL,"
c_u="$c_u PRIMARY KEY Host (Host,User)"
c_u="$c_u )"
c_u="$c_u comment='Users and global privileges';"
- i_u="INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
- INSERT INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
- REPLACE INTO user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
+ i_u="INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','none',NULL,NULL,NULL);
+ INSERT INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','none',NULL,NULL,NULL);
+ REPLACE INTO user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','none',NULL,NULL,NULL);
- INSERT INTO user VALUES ('localhost','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N');
- INSERT INTO user VALUES ('$hostname','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N');"
+ INSERT INTO user VALUES ('localhost','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N','none',NULL,NULL,NULL);
+ INSERT INTO user VALUES ('$hostname','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N','none',NULL,NULL,NULL);"
fi
if test ! -f $mdata/func.frm
@@ -192,8 +194,11 @@ then
c_c="$c_c comment='Column privileges';"
fi
-if $execdir/mysqld --no-defaults --bootstrap --skip-grant-tables \
- --basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb --skip-gemini << END_OF_DATA
+mysqld_boot=" $execdir/mysqld --no-defaults --bootstrap --skip-grant-tables \
+ --basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb --skip-gemini $EXTRA_ARG"
+echo "running $mysqld_boot"
+
+if $mysqld_boot << END_OF_DATA
use mysql;
$c_d
$i_d
@@ -213,5 +218,6 @@ END_OF_DATA
then
exit 0
else
+ echo "Error executing mysqld --boostrap"
exit 1
fi
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 4d987e591e0..e20eb4e0869 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -99,8 +99,9 @@ export MYSQL_TEST_DIR
STD_DATA=$MYSQL_TEST_DIR/std_data
hostname=`hostname` # Installed in the mysql privilege table
-TESTDIR="$MYSQL_TEST_DIR/t/"
+TESTDIR="$MYSQL_TEST_DIR/t"
TESTSUFFIX=test
+TOT_SKIP=0
TOT_PASS=0
TOT_FAIL=0
TOT_TEST=0
@@ -108,6 +109,7 @@ USERT=0
SYST=0
REALT=0
MYSQL_TMP_DIR=$MYSQL_TEST_DIR/var/tmp
+SLAVE_LOAD_TMPDIR=../../var/tmp #needs to be same length to test logging
RES_SPACE=" "
MYSQLD_SRC_DIRS="strings mysys include extra regex isam merge myisam \
myisammrg heap sql"
@@ -124,7 +126,9 @@ USE_RUNNING_SERVER=1
DO_GCOV=""
DO_GDB=""
DO_DDD=""
+DO_CLIENT_GDB=""
SLEEP_TIME=2
+CHARACTER_SET=latin1
DBUSER=""
while test $# -gt 0; do
@@ -135,10 +139,33 @@ while test $# -gt 0; do
--tmpdir=*) MYSQL_TMP_DIR=`$ECHO "$1" | $SED -e "s;--tmpdir=;;"` ;;
--master_port=*) MASTER_MYPORT=`$ECHO "$1" | $SED -e "s;--master_port=;;"` ;;
--slave_port=*) SLAVE_MYPORT=`$ECHO "$1" | $SED -e "s;--slave_port=;;"` ;;
+ --with-openssl)
+ EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \
+ --ssl-ca=$BASEDIR/SSL/cacert.pem \
+ --ssl-cert=$BASEDIR/SSL/server-cert.pem \
+ --ssl-key=$BASEDIR/SSL/server-key.pem"
+ EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT \
+ --ssl-ca=$BASEDIR/SSL/cacert.pem \
+ --ssl-cert=$BASEDIR/SSL/server-cert.pem \
+ --ssl-key=$BASEDIR/SSL/server-key.pem" ;;
+ --skip-innobase)
+ EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-innobase"
+ EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-innobase" ;;
+ --skip-bdb)
+ EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-bdb"
+ EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-bdb" ;;
--skip-rpl) NO_SLAVE=1 ;;
+ --skip-test=*) SKIP_TEST=`$ECHO "$1" | $SED -e "s;--skip-test=;;"`;;
+ --do-test=*) DO_TEST=`$ECHO "$1" | $SED -e "s;--do-test=;;"`;;
--record)
RECORD=1;
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
+ --bench)
+ DO_BENCH=1
+ NO_SLAVE=1
+ ;;
+ --big*) # Actually --big-test
+ EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
--sleep=*)
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1"
SLEEP_TIME=`$ECHO "$1" | $SED -e "s;--sleep=;;"`
@@ -160,18 +187,22 @@ while test $# -gt 0; do
;;
--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 -gdb option"
+ $ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --gdb option"
fi
DO_GDB=1
USE_RUNNING_SERVER=""
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-stack"
+ ;;
+ --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
;;
--ddd )
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 -gdb option"
+ $ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --ddd option"
fi
DO_DDD=1
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-stack"
USE_RUNNING_SERVER=""
;;
--skip-*)
@@ -180,9 +211,9 @@ while test $# -gt 0; do
;;
--debug)
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \
- --debug=d:t:O,$MYSQL_TMP_DIR/master.trace"
+ --debug=d:t:O,$MYSQL_TEST_DIR/var/log/master.trace"
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT \
- --debug=d:t:O,$MYSQL_TMP_DIR/slave.trace"
+ --debug=d:t:O,$MYSQL_TEST_DIR/var/log/slave.trace"
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT --debug"
;;
-- ) shift; break ;;
@@ -231,16 +262,23 @@ fi
[ -z "$COLUMNS" ] && COLUMNS=80
E=`$EXPR $COLUMNS - 8`
-#DASH72=`expr substr '------------------------------------------------------------------------' 1 $E`
+#DASH72=`$EXPR substr '------------------------------------------------------------------------' 1 $E`
DASH72=`$ECHO '------------------------------------------------------------------------'|$CUT -c 1-$E`
# on source dist, we pick up freshly build executables
# on binary, use what is installed
if [ x$SOURCE_DIST = x1 ] ; then
MYSQLD="$BASEDIR/sql/mysqld"
- MYSQL_TEST="$BASEDIR/client/mysqltest"
+ if [ -e "$BASEDIR/client/.libs/mysqltest" ] ; then
+ [ -e "$BASEDIR/client/.libs/lt-mysqltest" ] || $BASEDIR/client/mysqltest -V
+ MYSQL_TEST="$BASEDIR/client/.libs/lt-mysqltest"
+ else
+ MYSQL_TEST="$BASEDIR/client/mysqltest"
+ fi
MYSQLADMIN="$BASEDIR/client/mysqladmin"
MYSQL="$BASEDIR/client/mysql"
+ LANGUAGE="$BASEDIR/sql/share/english/"
+ CHARSETSDIR="$BASEDIR/sql/share/charsets"
INSTALL_DB="./install_test_db"
else
MYSQLD="$BASEDIR/bin/mysqld"
@@ -248,6 +286,14 @@ else
MYSQLADMIN="$BASEDIR/bin/mysqladmin"
MYSQL="$BASEDIR/bin/mysql"
INSTALL_DB="./install_test_db -bin"
+ if test -d "$BASEDIR/share/mysql/english"
+ then
+ LANGUAGE="$BASEDIR/share/mysql/english/"
+ CHARSETSDIR="$BASEDIR/share/mysql/charsets"
+ else
+ LANGUAGE="$BASEDIR/share/english/"
+ CHARSETSDIR="$BASEDIR/share/charsets"
+ fi
fi
# If we should run all tests cases, we will use a local server for that
@@ -272,7 +318,10 @@ then
fi
-MYSQL_TEST="$MYSQL_TEST --no-defaults --socket=$MASTER_MYSOCK --database=$DB --user=$DBUSER --password=$DBPASSWD --silent -v --tmpdir=$MYSQL_TMP_DIR"
+MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB --user=$DBUSER --password=$DBPASSWD --silent -v --tmpdir=$MYSQL_TMP_DIR"
+MYSQL_TEST_BIN=$MYSQL_TEST
+MYSQL_TEST="$MYSQL_TEST $MYSQL_TEST_ARGS"
+GDB_CLIENT_INIT=$MYSQL_TMP_DIR/gdbinit.client
GDB_MASTER_INIT=$MYSQL_TMP_DIR/gdbinit.master
GDB_SLAVE_INIT=$MYSQL_TMP_DIR/gdbinit.slave
GCOV_MSG=$MYSQL_TMP_DIR/mysqld-gcov.out
@@ -303,11 +352,18 @@ show_failed_diff ()
{
reject_file=r/$1.reject
result_file=r/$1.result
+ eval_file=r/$1.eval
+
+ if [ -f $eval_file ]
+ then
+ result_file=$eval_file
+ fi
+
if [ -x "$DIFF" ] && [ -f $reject_file ]
then
echo "Below are the diffs between actual and expected results:"
echo "-------------------------------------------------------"
- $DIFF -c $result_file $reject_file
+ $DIFF -c -a $result_file $reject_file
echo "-------------------------------------------------------"
echo "Please follow the instructions outlined at"
echo "http://www.mysql.com/doc/R/e/Reporting_mysqltest_bugs.html"
@@ -315,6 +371,15 @@ show_failed_diff ()
fi
}
+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
+ xterm -title "Client" -e gdb -x $GDB_CLIENT_INIT $MYSQL_TEST_BIN
+}
+
error () {
$ECHO "Error: $1"
exit 1
@@ -435,19 +500,40 @@ start_master()
# Remove old berkeley db log files that can confuse the server
$RM -f $MASTER_MYDDIR/log.*
#start master
- master_args="--no-defaults --log-bin=master-bin \
+ if [ -z "$DO_BENCH" ]
+ then
+ master_args="--no-defaults --log-bin=master-bin \
--server-id=1 \
--basedir=$MY_BASEDIR \
--port=$MASTER_MYPORT \
+ --exit-info=256 \
--datadir=$MASTER_MYDDIR \
--pid-file=$MASTER_MYPID \
--socket=$MASTER_MYSOCK \
- --log=$MASTER_MYLOG --default-character-set=latin1 \
+ --log=$MASTER_MYLOG \
+ --character-sets-dir=$CHARSETSDIR \
+ --default-character-set=$CHARACTER_SET \
--tmpdir=$MYSQL_TMP_DIR \
- --language=english \
+ --language=$LANGUAGE \
--innodb_data_file_path=ibdata1:50M \
$SMALL_SERVER \
$EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT"
+ else
+ master_args="--no-defaults --log-bin=master-bin --server-id=1 \
+ --basedir=$MY_BASEDIR \
+ --port=$MASTER_MYPORT \
+ --datadir=$MASTER_MYDDIR \
+ --pid-file=$MASTER_MYPID \
+ --socket=$MASTER_MYSOCK \
+ --character-sets-dir=$CHARSETSDIR \
+ --default-character-set=$CHARACTER_SET \
+ --core \
+ --tmpdir=$MYSQL_TMP_DIR \
+ --language=$LANGUAGE \
+ --innodb_data_file_path=ibdata1:50M \
+ $SMALL_SERVER \
+ $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT"
+ fi
if [ x$DO_DDD = x1 ]
then
$ECHO "set args $master_args" > $GDB_MASTER_INIT
@@ -496,18 +582,23 @@ start_slave()
--pid-file=$SLAVE_MYPID \
--port=$SLAVE_MYPORT \
--socket=$SLAVE_MYSOCK \
- --log=$SLAVE_MYLOG --default-character-set=latin1 \
+ --log=$SLAVE_MYLOG \
+ --character-sets-dir=$CHARSETSDIR \
+ --default-character-set=$CHARACTER_SET \
--core \
--tmpdir=$MYSQL_TMP_DIR \
- --language=english \
+ --language=$LANGUAGE \
--skip-innodb --skip-slave-start \
+ --slave-load-tmpdir=$SLAVE_LOAD_TMPDIR \
+ --report-host=127.0.0.1 --report-user=root \
+ --report-port=$SLAVE_MYPORT \
$SMALL_SERVER \
$EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT"
if [ x$DO_DDD = x1 ]
then
$ECHO "set args $master_args" > $GDB_SLAVE_INIT
ddd --debugger "gdb -x $GDB_SLAVE_INIT" $SLAVE_MYSQLD &
- prompt_user "Hit enter to continue after you've started the master"
+ prompt_user "Hit enter to continue after you've started the slave"
elif [ x$DO_GDB = x1 ]
then
$ECHO "set args $slave_args" > $GDB_SLAVE_INIT
@@ -609,6 +700,22 @@ run_testcase ()
slave_init_script=$TESTDIR/$tname-slave.sh
slave_master_info_file=$TESTDIR/$tname-slave-master-info.opt
SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0`
+ if [ -n "$SKIP_TEST" ] ; then
+ SKIP_THIS_TEST=`$EXPR \( $tname : "$SKIP_TEST" \) != 0`
+ if [ x$SKIP_THIS_TEST = x1 ] ;
+ then
+ return;
+ fi
+ fi
+
+ if [ -n "$DO_TEST" ] ; then
+ DO_THIS_TEST=`$EXPR \( $tname : "$DO_TEST" \) != 0`
+ if [ x$DO_THIS_TEST = x0 ] ;
+ then
+ return;
+ fi
+ fi
+
if [ x${NO_SLAVE}x$SKIP_SLAVE = x1x0 ] ;
then
@@ -616,9 +723,9 @@ run_testcase ()
SYST=" ...."
REALT=" ...."
timestr="$USERT $SYST $REALT"
- pname=`$ECHO "$tname "|$CUT -c 1-16`
- RES="$pname $timestr"
- pass_inc
+ pname=`$ECHO "$tname "|$CUT -c 1-24`
+ RES="$pname $timestr"
+ skip_inc
$ECHO "$RES$RES_SPACE [ skipped ]"
return
fi
@@ -672,8 +779,13 @@ run_testcase ()
if [ -f $tf ] ; then
$RM -f r/$tname.*reject
- mytime=`$TIME -p $MYSQL_TEST -R r/$tname.result $EXTRA_MYSQL_TEST_OPT \
- < $tf 2> $TIMEFILE`
+ mysql_test_args="-R r/$tname.result $EXTRA_MYSQL_TEST_OPT"
+ if [ -z "$DO_CLIENT_GDB" ] ; then
+ mytime=`$TIME -p $MYSQL_TEST $mysql_test_args < $tf 2> $TIMEFILE`
+ else
+ do_gdb_test "$mysql_test_args" "$tf"
+ fi
+
res=$?
if [ $res = 0 ]; then
@@ -692,15 +804,19 @@ run_testcase ()
fi
timestr="$USERT $SYST $REALT"
- pname=`$ECHO "$tname "|$CUT -c 1-16`
- RES="$pname $timestr"
+ pname=`$ECHO "$tname "|$CUT -c 1-24`
+ RES="$pname $timestr"
if [ $res = 0 ]; then
total_inc
pass_inc
$ECHO "$RES$RES_SPACE [ pass ]"
else
- if [ $res = 1 ]; then
+ # why the following ``if'' ? That is why res==1 is special ?
+ if [ $res = 2 ]; then
+ skip_inc
+ $ECHO "$RES$RES_SPACE [ skipped ]"
+ else
total_inc
fail_inc
$ECHO "$RES$RES_SPACE [ fail ]"
@@ -724,9 +840,6 @@ run_testcase ()
fi
$ECHO "Resuming Tests"
$ECHO ""
- else
- pass_inc
- $ECHO "$RES$RES_SPACE [ skipped ]"
fi
fi
fi
@@ -763,6 +876,28 @@ fi
$ECHO "Starting Tests"
+if [ "$DO_BENCH" = 1 ]
+then
+ BENCHDIR=$BASEDIR/sql-bench/
+ savedir=`pwd`
+ cd $BENCHDIR
+ if [ -z "$1" ]
+ then
+ ./run-all-tests --socket=$MASTER_MYSOCK --user=root
+ else
+ if [ -x "./$1" ]
+ then
+ ./$1 --socket=$MASTER_MYSOCK --user=root
+ else
+ echo "benchmark $1 not found"
+ fi
+ fi
+ cd $savedir
+ mysql_stop
+ exit
+fi
+
+
$ECHO
$ECHO " TEST USER SYSTEM ELAPSED RESULT"
$ECHO $DASH72
diff --git a/mysql-test/r/big_test.require b/mysql-test/r/big_test.require
new file mode 100644
index 00000000000..001b903496b
--- /dev/null
+++ b/mysql-test/r/big_test.require
@@ -0,0 +1,2 @@
+using_big_test
+1
diff --git a/mysql-test/r/count_distinct2.result b/mysql-test/r/count_distinct2.result
new file mode 100644
index 00000000000..3586910e8b3
--- /dev/null
+++ b/mysql-test/r/count_distinct2.result
@@ -0,0 +1,84 @@
+n1
+1
+2
+NULL
+count(distinct n1)
+2
+n2
+11
+12
+13
+NULL
+count(distinct n2)
+3
+s
+one
+two
+NULL
+count(distinct s)
+2
+vs
+eleven
+twevle
+thirteen
+NULL
+count(distinct vs)
+3
+t
+eleven
+twelve
+foo
+bar
+NULL
+count(distinct t)
+4
+n1 n2
+1 11
+2 11
+2 12
+2 13
+NULL 13
+2 NULL
+count(distinct n1,n2)
+4
+n1 s
+1 one
+2 two
+NULL two
+2 NULL
+count(distinct n1,s)
+2
+s n1 vs
+one 1 eleven
+two 2 eleven
+two 2 twevle
+two 2 thirteen
+two NULL thirteen
+NULL 2 thirteen
+two 2 NULL
+count(distinct s,n1,vs)
+4
+s t
+one eleven
+two eleven
+two twelve
+two foo
+two bar
+NULL bar
+two NULL
+count(distinct s,t)
+5
+count(distinct n1) count(distinct n2)
+2 3
+count(distinct n2) n1
+1 NULL
+1 1
+3 2
+count(distinct n)
+5000
+Variable_name Value
+Created_tmp_disk_tables 1
+count(distinct s)
+5000
+Variable_name Value
+Created_tmp_disk_tables 1
diff --git a/mysql-test/r/ctype_latin1_de.result b/mysql-test/r/ctype_latin1_de.result
new file mode 100644
index 00000000000..44a1757209e
--- /dev/null
+++ b/mysql-test/r/ctype_latin1_de.result
@@ -0,0 +1,175 @@
+a b
+a 35
+ac 2
+ad 4
+ä 1
+ae 3
+ää 31
+aeae 33
+ääa 32
+aeb 6
+Äc 5
+é 38
+É 39
+eä 28
+o 37
+oc 15
+od 18
+ö 14
+oe 17
+Öa 16
+oeb 20
+Öc 19
+öo 30
+q 34
+s 21
+ss 22
+ß 23
+ssa 25
+ßa 27
+ßb 24
+ssc 26
+u 36
+uc 8
+ud 10
+ue 9
+Ü 11
+ueb 12
+üc 7
+uf 13
+uü 29
+a b
+a 35
+ac 2
+ad 4
+ä 1
+ae 3
+ää 31
+aeae 33
+ääa 32
+aeb 6
+Äc 5
+é 38
+É 39
+eä 28
+o 37
+oc 15
+od 18
+ö 14
+oe 17
+Öa 16
+oeb 20
+Öc 19
+öo 30
+q 34
+s 21
+ss 22
+ß 23
+ssa 25
+ßa 27
+ßb 24
+ssc 26
+u 36
+uc 8
+ud 10
+ue 9
+Ü 11
+ueb 12
+üc 7
+uf 13
+uü 29
+a
+uü
+uf
+üc
+ueb
+ue
+ud
+uc
+u
+ssc
+ßb
+ßa
+ssa
+ss
+s
+q
+öo
+Öc
+oeb
+Öa
+oe
+od
+oc
+o
+eä
+Äc
+aeb
+ääa
+aeae
+ää
+ae
+ad
+ac
+a
+Table Op Msg_type Msg_text
+test.t1 check status OK
+a b
+ö 14
+Öa 16
+Öc 19
+öo 30
+a b
+É 39
+a b
+a 35
+ac 2
+ad 4
+ae 3
+aeae 33
+ääa 32
+aeb 6
+Öa 16
+ssa 25
+ßa 27
+a b
+u 36
+uc 8
+ud 10
+ue 9
+ueb 12
+uf 13
+uü 29
+a b
+ss 22
+ssa 25
+ssc 26
+strcmp('ä','ae') strcmp('ae','ä') strcmp('aeq','äq') strcmp('äq','aeq')
+0 0 0 0
+strcmp('ss','ß') strcmp('ß','ss') strcmp('ßs','sss') strcmp('ßq','ssq')
+0 0 0 0
+strcmp('ä','af') strcmp('a','ä') strcmp('ää','aeq') strcmp('ää','aeaeq')
+-1 -1 -1 -1
+strcmp('ss','ßa') strcmp('ß','ssa') strcmp('sßa','sssb') strcmp('s','ß')
+-1 -1 -1 -1
+strcmp('ö','oö') strcmp('Ü','uü') strcmp('ö','oeb')
+-1 -1 -1
+strcmp('af','ä') strcmp('ä','a') strcmp('aeq','ää') strcmp('aeaeq','ää')
+1 1 1 1
+strcmp('ßa','ss') strcmp('ssa','ß') strcmp('sssb','sßa') strcmp('ß','s')
+1 1 1 1
+strcmp('u','öa') strcmp('u','ö')
+1 1
+a
+abc
+abcd
+a
+test
+a
+test
diff --git a/mysql-test/r/fulltext_distinct.result b/mysql-test/r/fulltext_distinct.result
new file mode 100644
index 00000000000..9729eb59c10
--- /dev/null
+++ b/mysql-test/r/fulltext_distinct.result
@@ -0,0 +1,10 @@
+id tag value
+1 foo123 bar111
+2 foo123 bar222
+3 bar345 baz333 ar
+id_t2 id_t1 field_number
+12346 3 1
+2231626 64280 0
+2231626 64281 0
+id_t2
+12346
diff --git a/mysql-test/r/fulltext_var.result b/mysql-test/r/fulltext_var.result
new file mode 100644
index 00000000000..0352cd7addf
--- /dev/null
+++ b/mysql-test/r/fulltext_var.result
@@ -0,0 +1,4 @@
+Variable_name Value
+ft_min_word_len 4
+ft_max_word_len 254
+ft_max_word_len_for_sort 20
diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result
index 78bede19762..a6c28daae88 100644
--- a/mysql-test/r/func_like.result
+++ b/mysql-test/r/func_like.result
@@ -2,6 +2,9 @@ a
abc
abcd
a
+abc
+abcd
+a
test
a
test
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 790cce9f1c1..52999dfaf10 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -27,19 +27,35 @@ DAYOFYEAR("1997-03-03") WEEK("1998-03-03") QUARTER(980303)
HOUR("1997-03-03 23:03:22") MINUTE("23:03:22") SECOND(230322)
23 3 22
week(19980101) week(19970101) week(19980101,1) week(19970101,1)
-0 1 1 1
+0 0 1 1
week(19981231) week(19971231) week(19981231,1) week(19971231,1)
-52 53 53 53
+52 52 53 53
week(19950101) week(19950101,1)
1 0
yearweek('1981-12-31',1) yearweek('1982-01-01',1) yearweek('1982-12-31',1) yearweek('1983-01-01',1)
198153 198153 198252 198252
+yearweek('1987-01-01',1) yearweek('1987-01-01')
+198701 198652
+2000 2001 2002 2003 2004 2005 2006
+0 0 0 0 0 0 1
+2000 2001 2002 2003 2004 2005 2006
+1 0 1 1 1 1 1
+2000 2001 2002 2003 2004 2005 2006
+0 1 1 1 1 0 0
+2000 2001 2002 2003 2004 2005 2006
+1 1 1 2 2 1 1
+2000 2001 2002 2003 2004 2005 2006
+199952 200053 200152 200252 200352 200452 200601
+2000 2001 2002 2003 2004 2005 2006
+200001 200053 200201 200301 200401 200501 200601
+2000 2001 2002 2003 2004 2005 2006
+199952 200101 200201 200301 200401 200453 200552
+2000 2001 2002 2003 2004 2005 2006
+200001 200101 200201 200302 200402 200501 200601
date_format('1998-12-31','%x-%v') date_format('1999-01-01','%x-%v')
1998-53 1998-53
date_format('1999-12-31','%x-%v') date_format('2000-01-01','%x-%v')
1999-52 1999-52
-yearweek('1987-01-01',1) yearweek('1987-01-01')
-198701 198653
dayname("1962-03-03") dayname("1962-03-03")+0
Saturday 5
monthname("1972-03-04") monthname("1972-03-04")+0
diff --git a/mysql-test/r/handler.result b/mysql-test/r/handler.result
new file mode 100644
index 00000000000..5dcab296eac
--- /dev/null
+++ b/mysql-test/r/handler.result
@@ -0,0 +1,87 @@
+a b
+14 aaa
+a b
+15 bbb
+a b
+16 ccc
+a b
+15 bbb
+a b
+22 iii
+a b
+21 hhh
+a b
+20 ggg
+a b
+14 aaa
+a b
+a b
+22 iii
+a b
+21 hhh
+a b
+22 iii
+a b
+a b
+15 bbb
+a b
+16 ccc
+a b
+19 fff
+a b
+19 yyy
+a b
+19 fff
+a b
+a b
+14 aaa
+a b
+18 eee
+a b
+18 eee
+a b
+19 fff
+a b
+18 eee
+a b
+17 ddd
+a b
+14 aaa
+15 bbb
+16 ccc
+16 xxx
+17 ddd
+a b
+18 eee
+19 fff
+19 yyy
+a b
+19 fff
+18 eee
+17 ddd
+16 xxx
+16 ccc
+15 bbb
+14 aaa
+a b
+16 ccc
+16 xxx
+17 ddd
+18 eee
+a b
+17 ddd
+18 eee
+a b
+22 iii
+21 hhh
+20 ggg
+a b
+19 fff
+a b
+19 yyy
+a b
+17 ddd
+a b
+18 eee
+a b
+19 fff
diff --git a/mysql-test/r/have_openssl.require b/mysql-test/r/have_openssl.require
new file mode 100644
index 00000000000..9bdffdf0c13
--- /dev/null
+++ b/mysql-test/r/have_openssl.require
@@ -0,0 +1,2 @@
+Variable_name Value
+have_ssl YES
diff --git a/mysql-test/r/have_openssl_1.require b/mysql-test/r/have_openssl_1.require
new file mode 100644
index 00000000000..dae48a472b5
--- /dev/null
+++ b/mysql-test/r/have_openssl_1.require
@@ -0,0 +1,2 @@
+Variable_name Value
+have_openssl YES
diff --git a/mysql-test/r/have_openssl_2.require b/mysql-test/r/have_openssl_2.require
new file mode 100644
index 00000000000..09a65d7d9bc
--- /dev/null
+++ b/mysql-test/r/have_openssl_2.require
@@ -0,0 +1,2 @@
+Variable_name Value
+jkhjkhfs
diff --git a/mysql-test/r/have_symlink.require b/mysql-test/r/have_symlink.require
new file mode 100644
index 00000000000..55ad9437034
--- /dev/null
+++ b/mysql-test/r/have_symlink.require
@@ -0,0 +1,2 @@
+Variable_name Value
+have_symlink YES
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 913f4226f1c..67aa024b117 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -115,7 +115,7 @@ t1 index level level 1 NULL 39 where used; Using index
table type possible_keys key key_len ref rows Extra
t1 index level level 1 NULL 39 where used; Using index
table type possible_keys key key_len ref rows Extra
-t1 ref level level 1 const 12
+t1 ALL level NULL NULL NULL 39 where used
level id
1 1002
1 1003
@@ -479,3 +479,5 @@ id name value uid
1 one one value 101
3 three three value 103
6 two other value 102
+a
+a
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index c754085ccb3..04498add5e9 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -11,3 +11,5 @@ payoutID
19
20
22
+Variable_name Value
+myisam_bulk_insert_tree_size 8388608
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
new file mode 100644
index 00000000000..6358e2a81cd
--- /dev/null
+++ b/mysql-test/r/multi_update.result
@@ -0,0 +1,22 @@
+Table Op Msg_type Msg_text
+test.t1 check status OK
+test.t2 check status OK
+test.t3 check status OK
+count(*)
+0
+count(*)
+0
+count(*)
+0
+count(*)
+0
+count(*)
+0
+count(*)
+0
+count(*)
+0
+count(*)
+0
+count(*)
+0
diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result
index ead1dc29326..87ba8961ad6 100644
--- a/mysql-test/r/null_key.result
+++ b/mysql-test/r/null_key.result
@@ -53,7 +53,7 @@ t1 ref a,b a 5 const 1 where used
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 12 where used
table type possible_keys key key_len ref rows Extra
-t1 range a,b a 5 NULL 12 where used
+t1 range a,b a 5 NULL 5 where used
table type possible_keys key key_len ref rows Extra
t1 range a,b a 5 NULL 4 where used
table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result
new file mode 100644
index 00000000000..6636a336c45
--- /dev/null
+++ b/mysql-test/r/openssl_1.result
@@ -0,0 +1,16 @@
+Variable_name Value
+SSL_CTX_sess_accept 0
+SSL_CTX_sess_accept_good 0
+SSL_CTX_sess_accept_renegotiate 0
+SSL_CTX_sess_cb_hits 0
+SSL_CTX_sess_number 0
+SSL_CTX_get_session_cache_mode SERVER
+SSL_CTX_sess_get_cache_size 128
+SSL_CTX_get_verify_mode 7
+SSL_CTX_get_verify_depth 4294967295
+SSL_get_verify_mode 0
+SSL_get_verify_depth 0
+SSL_session_reused 0
+SSL_get_version
+SSL_get_cipher
+SSL_get_default_timeout 0
diff --git a/mysql-test/r/openssl_2.result b/mysql-test/r/openssl_2.result
new file mode 100644
index 00000000000..6636a336c45
--- /dev/null
+++ b/mysql-test/r/openssl_2.result
@@ -0,0 +1,16 @@
+Variable_name Value
+SSL_CTX_sess_accept 0
+SSL_CTX_sess_accept_good 0
+SSL_CTX_sess_accept_renegotiate 0
+SSL_CTX_sess_cb_hits 0
+SSL_CTX_sess_number 0
+SSL_CTX_get_session_cache_mode SERVER
+SSL_CTX_sess_get_cache_size 128
+SSL_CTX_get_verify_mode 7
+SSL_CTX_get_verify_depth 4294967295
+SSL_get_verify_mode 0
+SSL_get_verify_depth 0
+SSL_session_reused 0
+SSL_get_version
+SSL_get_cipher
+SSL_get_default_timeout 0
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index 1a292b1203c..f6fc3b6090a 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -111,6 +111,122 @@ DateOfAction TransactionID
member_id nickname voornaam
1
2
+table type possible_keys key key_len ref rows Extra
+t1 range a a 20 NULL 2 where used; Using index
+a b c
+1 NULL b
+table type possible_keys key key_len ref rows Extra
+t1 range a a 4 NULL 10 where used; Using index
+a b c
+2 3 c
+2 2 b
+2 2 a
+2 1 b
+2 1 a
+1 3 b
+1 1 b
+1 1 b
+1 1 NULL
+1 NULL b
+1 NULL NULL
+table type possible_keys key key_len ref rows Extra
+t1 ref a a 4 const 5 where used; Using index; Using filesort
+a b c
+1 3 b
+1 1 NULL
+1 1 b
+1 1 b
+1 NULL NULL
+1 NULL b
+table type possible_keys key key_len ref rows Extra
+t1 ref a a 9 const,const 2 where used; Using index; Using filesort
+a b c
+1 NULL NULL
+1 NULL b
+table type possible_keys key key_len ref rows Extra
+t1 range a a 9 NULL 8 where used; Using index; Using filesort
+table type possible_keys key key_len ref rows Extra
+t1 range a a 9 NULL 5 where used; Using index
+table type possible_keys key key_len ref rows Extra
+t1 ref a a 9 const,const 1 where used; Using index; Using filesort
+table type possible_keys key key_len ref rows Extra
+t1 range a a 9 NULL 6 where used; Using index
+table type possible_keys key key_len ref rows Extra
+t1 range a a 9 NULL 5 where used; Using index
+table type possible_keys key key_len ref rows Extra
+t1 range a a 9 NULL 2 where used; Using index; Using filesort
+table type possible_keys key key_len ref rows Extra
+t1 index NULL a 18 NULL 11 Using index
+a b c
+1 0
+1 0 b
+1 1
+1 1 b
+1 1 b
+1 3 b
+2 1 a
+2 1 b
+2 2 a
+2 2 b
+2 3 c
+table type possible_keys key key_len ref rows Extra
+t1 index NULL a 18 NULL 11 Using index
+a b c
+2 3 c
+2 2 b
+2 2 a
+2 1 b
+2 1 a
+1 3 b
+1 1 b
+1 1 b
+1 1
+1 0 b
+1 0
+table type possible_keys key key_len ref rows Extra
+t1 range a a 18 NULL 3 where used; Using index
+a b c
+1 1 b
+1 1 b
+table type possible_keys key key_len ref rows Extra
+t1 range a a 4 NULL 6 where used; Using index
+a b c
+1 1 b
+1 1 b
+1 1
+1 0 b
+1 0
+count(*)
+9
+a b c
+2 3 c
+2 2 b
+2 2 a
+2 1 b
+2 1 a
+1 3 b
+1 1 b
+1 1 b
+1 1
+table type possible_keys key key_len ref rows Extra
+t1 range a a 8 NULL 10 where used; Using index
+a b c
+2 1 b
+2 1 a
+1 1 b
+1 1 b
+1 1
+1 0 b
+1 0
+table type possible_keys key key_len ref rows Extra
+t1 range a a 4 NULL 5 where used; Using index
+a b c
+1 3 b
+1 1 b
+1 1 b
+1 1
+1 0 b
+1 0
gid sid uid
104620 5 15
103867 5 27
diff --git a/mysql-test/r/order_fill_sortbuf.result b/mysql-test/r/order_fill_sortbuf.result
new file mode 100644
index 00000000000..cb3349cc433
--- /dev/null
+++ b/mysql-test/r/order_fill_sortbuf.result
@@ -0,0 +1,2 @@
+count(*)
+4000
diff --git a/mysql-test/r/rpl000002.result b/mysql-test/r/rpl000002.result
index a68ef517708..7f518a7339e 100644
--- a/mysql-test/r/rpl000002.result
+++ b/mysql-test/r/rpl000002.result
@@ -2,6 +2,8 @@ n
2000
2001
2002
+Server_id Host Port
+2 127.0.0.1 9307
id created
1 1970-01-01 06:25:45
id created
diff --git a/mysql-test/r/rpl000009.result b/mysql-test/r/rpl000009.result
index d5b4cdf3bee..74452473d0c 100644
--- a/mysql-test/r/rpl000009.result
+++ b/mysql-test/r/rpl000009.result
@@ -1,2 +1,32 @@
n m
4 15
+Database
+bar
+foo
+mysql
+test
+Database
+mysql
+test
+Database
+bar
+foo
+mysql
+test
+Tables_in_foo
+Tables_in_bar
+t1
+t2
+n s
+1 one bar
+2 two bar
+3 three bar
+n s
+11 eleven bar
+12 twelve bar
+13 thirteen bar
+n s
+1 one bar
+2 two bar
+3 three bar
+4 four bar
diff --git a/mysql-test/r/rpl000014.result b/mysql-test/r/rpl000014.result
index a47c3c91c1d..cdafc7575ab 100644
--- a/mysql-test/r/rpl000014.result
+++ b/mysql-test/r/rpl000014.result
@@ -1,15 +1,15 @@
File Position Binlog_do_db Binlog_ignore_db
-master-bin.001 73
-Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
-127.0.0.1 root 9999 1 master-bin.001 73 Yes 0 0
-Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
-127.0.0.1 root 9999 1 master-bin.001 73 No 0 0
-Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
-127.0.0.1 root 9999 1 master-bin.001 73 Yes 0 0
-Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
-127.0.0.1 root 9999 1 master-bin.001 173 Yes 0 0
+master-bin.001 79
+Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
+127.0.0.1 root 9999 1 master-bin.001 79 Yes 0 0 1
+Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
+127.0.0.1 root 9999 1 master-bin.001 73 No 0 0 1
+Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
+127.0.0.1 root 9999 1 master-bin.001 73 Yes 0 0 1
+Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
+127.0.0.1 root 9999 1 master-bin.001 173 Yes 0 0 1
File Position Binlog_do_db Binlog_ignore_db
-master-bin.001 73
+master-bin.001 79
n
1
2
diff --git a/mysql-test/r/rpl000015.result b/mysql-test/r/rpl000015.result
index 58487af27f8..0aef660905b 100644
--- a/mysql-test/r/rpl000015.result
+++ b/mysql-test/r/rpl000015.result
@@ -1,13 +1,13 @@
File Position Binlog_do_db Binlog_ignore_db
-master-bin.001 73
-Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
- 0 0 0 No 0 0
-Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
-127.0.0.1 test 9998 60 4 No 0 0
-Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
-127.0.0.1 root 9999 60 4 No 0 0
-Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
-127.0.0.1 root 9999 60 master-bin.001 73 Yes 0 0
+master-bin.001 79
+Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
+ 0 0 0 No 0 0 0
+Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
+127.0.0.1 test 9998 60 4 No 0 0 0
+Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
+127.0.0.1 root 9999 60 4 No 0 0 0
+Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
+127.0.0.1 root 9999 60 master-bin.001 79 Yes 0 0 1
n
10
45
diff --git a/mysql-test/r/rpl000016.result b/mysql-test/r/rpl000016.result
index abe4275a124..65f260bd575 100644
--- a/mysql-test/r/rpl000016.result
+++ b/mysql-test/r/rpl000016.result
@@ -1,5 +1,5 @@
-Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
-127.0.0.1 root 9999 60 master-bin.001 216 Yes 0 0
+Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
+127.0.0.1 root 9999 60 master-bin.001 234 Yes 0 0 3
s
Could not break slave
Tried hard
@@ -9,8 +9,8 @@ master-bin.002
master-bin.003
Log_name
master-bin.003
-Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
-127.0.0.1 root 9999 60 master-bin.003 184 Yes 0 0
+Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
+127.0.0.1 root 9999 60 master-bin.003 202 Yes 0 0 3
m
34
65
@@ -23,8 +23,8 @@ master-bin.004
master-bin.005
master-bin.006
File Position Binlog_do_db Binlog_ignore_db
-master-bin.006 131
-Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
-127.0.0.1 root 9999 60 master-bin.006 131 Yes 0 0
+master-bin.006 720
+Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
+127.0.0.1 root 9999 60 master-bin.006 720 Yes 0 0 11
count(*)
100
diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result
new file mode 100644
index 00000000000..2090781caab
--- /dev/null
+++ b/mysql-test/r/rpl_log.result
@@ -0,0 +1,71 @@
+Log_name Pos Event_type Server_id Log_seq Info
+master-bin.001 4 Start 1 1 Server ver: $VERSION, Binlog ver: 2
+master-bin.001 79 Query 1 2 use test; create table t1(n int not null auto_increment primary key)
+master-bin.001 172 Intvar 1 3 INSERT_ID=1
+master-bin.001 200 Query 1 4 use test; insert into t1 values (NULL)
+master-bin.001 263 Query 1 5 use test; drop table t1
+master-bin.001 311 Query 1 6 use test; create table t1 (word char(20) not null)
+master-bin.001 386 Create_file 1 7 db=test;table=t1;file_id=1;block_len=81
+master-bin.001 556 Exec_load 1 8 ;file_id=1
+master-bin.001 579 Query 1 9 use test; drop table t1
+Log_name Pos Event_type Server_id Log_seq Info
+master-bin.001 79 Query 1 2 use test; create table t1(n int not null auto_increment primary key)
+Log_name Pos Event_type Server_id Log_seq Info
+master-bin.001 79 Query 1 2 use test; create table t1(n int not null auto_increment primary key)
+master-bin.001 172 Intvar 1 3 INSERT_ID=1
+Log_name Pos Event_type Server_id Log_seq Info
+master-bin.001 200 Query 1 4 use test; insert into t1 values (NULL)
+Log_name Pos Event_type Server_id Log_seq Info
+master-bin.001 4 Start 1 1 Server ver: $VERSION, Binlog ver: 2
+master-bin.001 79 Query 1 2 use test; create table t1(n int not null auto_increment primary key)
+master-bin.001 172 Intvar 1 3 INSERT_ID=1
+master-bin.001 200 Query 1 4 use test; insert into t1 values (NULL)
+master-bin.001 263 Query 1 5 use test; drop table t1
+master-bin.001 311 Query 1 6 use test; create table t1 (word char(20) not null)
+master-bin.001 386 Create_file 1 7 db=test;table=t1;file_id=1;block_len=81
+master-bin.001 556 Exec_load 1 8 ;file_id=1
+master-bin.001 579 Query 1 9 use test; drop table t1
+master-bin.001 627 Rotate 1 10 master-bin.002;pos=4
+master-bin.001 668 Stop 1 11
+Log_name Pos Event_type Server_id Log_seq Info
+master-bin.002 4 Start 1 1 Server ver: $VERSION, Binlog ver: 2
+master-bin.002 79 Query 1 2 use test; create table t1 (n int)
+master-bin.002 137 Query 1 3 use test; insert into t1 values (1)
+master-bin.002 197 Query 1 4 use test; drop table t1
+Log_name
+master-bin.001
+master-bin.002
+Log_name
+slave-bin.001
+slave-bin.002
+Log_name Pos Event_type Server_id Log_seq Info
+slave-bin.001 4 Start 2 1 Server ver: $VERSION, Binlog ver: 2
+slave-bin.001 79 Slave 2 3 host=127.0.0.1,port=$MASTER_MYPORT,log=master-bin.001,pos=4
+slave-bin.001 132 Query 1 2 use test; create table t1(n int not null auto_increment primary key)
+slave-bin.001 225 Intvar 1 3 INSERT_ID=1
+slave-bin.001 253 Query 1 4 use test; insert into t1 values (NULL)
+slave-bin.001 316 Query 1 5 use test; drop table t1
+slave-bin.001 364 Query 1 6 use test; create table t1 (word char(20) not null)
+slave-bin.001 439 Create_file 1 7 db=test;table=t1;file_id=1;block_len=81
+slave-bin.001 618 Exec_load 1 8 ;file_id=1
+slave-bin.001 641 Query 1 9 use test; drop table t1
+slave-bin.001 689 Rotate 1 4 slave-bin.002;pos=4; forced by master
+slave-bin.001 729 Stop 2 5
+Log_name Pos Event_type Server_id Log_seq Info
+slave-bin.002 4 Start 2 1 Server ver: $VERSION, Binlog ver: 2
+slave-bin.002 79 Slave 2 10 host=127.0.0.1,port=$MASTER_MYPORT,log=master-bin.002,pos=4
+slave-bin.002 132 Query 1 2 use test; create table t1 (n int)
+slave-bin.002 190 Query 1 3 use test; insert into t1 values (1)
+slave-bin.002 250 Query 1 4 use test; drop table t1
+Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
+127.0.0.1 root $MASTER_MYPORT 1 master-bin.002 245 Yes 0 0 4
+Log_name Log_pos
+slave-bin.001 132
+Log_name Log_pos
+slave-bin.001 225
+Log_name Log_pos
+slave-bin.001 439
+Log_name Log_pos
+slave-bin.002 132
+Log_name Log_pos
+slave-bin.002 250
diff --git a/mysql-test/r/rpl_magic.result b/mysql-test/r/rpl_magic.result
new file mode 100644
index 00000000000..449a6bca68c
--- /dev/null
+++ b/mysql-test/r/rpl_magic.result
@@ -0,0 +1,22 @@
+n
+1
+2
+3
+4
+5
+n
+1
+2
+3
+4
+n
+1
+2
+3
+4
+n
+1
+2
+3
+4
+5
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 413b03130f6..33cd9048774 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -1210,7 +1210,7 @@ fld1 fld1
companynr companyname
table type possible_keys key key_len ref rows Extra
t2 ALL NULL NULL NULL NULL 1199
-t4 eq_ref PRIMARY PRIMARY 1 t2.companynr 1 where used; Not exists
+t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 where used; Not exists
table type possible_keys key key_len ref rows Extra
t4 ALL NULL NULL NULL NULL 12
t2 ALL NULL NULL NULL NULL 1199 where used; Not exists
diff --git a/mysql-test/r/select_found.result b/mysql-test/r/select_found.result
new file mode 100644
index 00000000000..b3fa281e76d
--- /dev/null
+++ b/mysql-test/r/select_found.result
@@ -0,0 +1,31 @@
+a b
+1 2
+2 3
+3 5
+4 5
+5 5
+6 6
+7 7
+8 9
+FOUND_ROWS()
+8
+a b
+1 2
+FOUND_ROWS()
+8
+a b
+8 9
+FOUND_ROWS()
+8
+b
+2
+FOUND_ROWS()
+6
+b c
+5 3
+FOUND_ROWS()
+6
+a b a b
+3 5 5 5
+FOUND_ROWS()
+8
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 099ea2fa109..a8be3f04249 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -90,3 +90,6 @@ t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
PRIMARY KEY (`a`)
) TYPE=MyISAM
+Database Table In_use Name_locked
+Database Table In_use Name_locked
+test t1 0 0
diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result
new file mode 100644
index 00000000000..71e8f79b890
--- /dev/null
+++ b/mysql-test/r/symlink.result
@@ -0,0 +1,23 @@
+Table Op Msg_type Msg_text
+test.t9 check status OK
+Table Op Msg_type Msg_text
+test.t9 optimize status OK
+Table Op Msg_type Msg_text
+test.t9 repair status OK
+Table Create Table
+t9 CREATE TABLE `t9` (
+ `a` int(11) NOT NULL auto_increment,
+ `b` char(16) NOT NULL default '',
+ `c` int(11) NOT NULL default '0',
+ PRIMARY KEY (`a`)
+) TYPE=MyISAM
+count(*)
+16724
+Table Create Table
+t9 CREATE TABLE `t9` (
+ `a` int(11) NOT NULL auto_increment,
+ `b` char(16) NOT NULL default '',
+ `c` int(11) NOT NULL default '0',
+ `d` int(11) NOT NULL default '0',
+ PRIMARY KEY (`a`)
+) TYPE=MyISAM
diff --git a/mysql-test/r/truncate.result b/mysql-test/r/truncate.result
index 716b38c57c7..e091bb8c73a 100644
--- a/mysql-test/r/truncate.result
+++ b/mysql-test/r/truncate.result
@@ -2,3 +2,4 @@ count(*)
0
count(*)
1
+a b c1
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index 7028b5ffe33..97365811785 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -33,3 +33,5 @@ date_format(a,"%Y-%m-%d")=b right(a,6)=c+0 a=d+0
1 1 1
a
0000-00-00 00:00:00
+id dt
+1 2001-08-14 00:00:00
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
new file mode 100644
index 00000000000..31244341196
--- /dev/null
+++ b/mysql-test/r/union.result
@@ -0,0 +1,61 @@
+a b
+1 a
+2 b
+3 c
+4 d
+5 f
+6 e
+a b
+1 a
+2 b
+3 c
+3 c
+3 c
+4 d
+5 f
+6 e
+a b
+1 a
+2 b
+3 c
+3 c
+3 c
+4 d
+6 e
+5 f
+a b
+1 a
+2 b
+3 c
+3 c
+3 c
+4 d
+5 f
+6 e
+7 g
+0 #
+0 #
+1 a
+2 b
+3 c
+3 c
+3 c
+4 d
+5 f
+6 e
+7 g
+a b
+1 a
+2 b
+3 c
+t1 b count(*)
+t1 a 1
+t1 b 1
+t1 c 2
+t2 c 1
+t2 d 1
+t2 e 1
+t2 f 1
+table type possible_keys key key_len ref rows Extra
+t1 ALL NULL NULL NULL NULL 4
+t2 ALL NULL NULL NULL NULL 4
diff --git a/mysql-test/r/varbinary.result b/mysql-test/r/varbinary.result
index 62aeae21970..bb4aaefe057 100644
--- a/mysql-test/r/varbinary.result
+++ b/mysql-test/r/varbinary.result
@@ -2,5 +2,9 @@
A 65 9223372036854775807 -1
0x31+1 concat(0x31)+1 -0xf
50 2 -15
+x'31' X'ffff'+0
+1 65535
table type possible_keys key key_len ref rows Extra
t1 const UNIQ UNIQ 8 const 1
+x xx
+1 2
diff --git a/mysql-test/std_data/master-bin.001 b/mysql-test/std_data/master-bin.001
index fa30d8e5302..2ec2397acdd 100644
--- a/mysql-test/std_data/master-bin.001
+++ b/mysql-test/std_data/master-bin.001
Binary files differ
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index dbfbd4267d8..681e3d36cca 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -73,6 +73,26 @@ OPTIMIZE TABLE t1;
DROP TABLE t1;
#
+# ALTER TABLE ... ENABLE/DISABLE KEYS
+
+create table t1 (n1 int not null, n2 int, n3 int, n4 float,
+ unique(n1),
+ key (n1, n2, n3, n4),
+ key (n2, n3, n4, n1),
+ key (n3, n4, n1, n2),
+ key (n4, n1, n2, n3) );
+alter table t1 disable keys;
+#let $1=10000;
+let $1=10;
+while ($1)
+{
+ eval insert into t1 values($1,RAND()*1000,RAND()*1000,RAND());
+ dec $1;
+}
+alter table t1 enable keys;
+drop table t1;
+
+#
# Drop and add an auto_increment column
#
@@ -81,4 +101,3 @@ insert into t1 values (null),(null),(null),(null);
alter table t1 drop i,add i int unsigned not null auto_increment, drop primary key, add primary key (i);
select * from t1;
drop table t1;
-
diff --git a/mysql-test/t/analyse.test b/mysql-test/t/analyse.test
index 1b5022f6e4c..3f56b3e47ce 100644
--- a/mysql-test/t/analyse.test
+++ b/mysql-test/t/analyse.test
@@ -2,6 +2,7 @@
# Test of procedure analyse
#
+drop table if exists t1,t2;
create table t1 (i int, j int);
insert into t1 values (1,2), (3,4), (5,6), (7,8);
select * from t1 procedure analyse();
diff --git a/mysql-test/t/bdb-crash.test b/mysql-test/t/bdb-crash.test
index 05ab7260d23..e2d2cd42be2 100644
--- a/mysql-test/t/bdb-crash.test
+++ b/mysql-test/t/bdb-crash.test
@@ -1,3 +1,4 @@
+-- source include/have_bdb.inc
# test for bug reported by Mark Steele
drop table if exists tblChange;
diff --git a/mysql-test/t/check.test b/mysql-test/t/check.test
index 62af9f92e65..6296b31d65d 100644
--- a/mysql-test/t/check.test
+++ b/mysql-test/t/check.test
@@ -16,3 +16,4 @@ insert into t1 values (200000);
connection con1;
reap;
drop table t1;
+
diff --git a/mysql-test/t/count_distinct2-master.opt b/mysql-test/t/count_distinct2-master.opt
new file mode 100644
index 00000000000..8f1be6dce3a
--- /dev/null
+++ b/mysql-test/t/count_distinct2-master.opt
@@ -0,0 +1 @@
+-O max_heap_table_size=16384
diff --git a/mysql-test/t/count_distinct2.test b/mysql-test/t/count_distinct2.test
new file mode 100644
index 00000000000..33d4cf54278
--- /dev/null
+++ b/mysql-test/t/count_distinct2.test
@@ -0,0 +1,74 @@
+create table t1(n1 int, n2 int, s char(20), vs varchar(20), t text);
+insert into t1 values (1,11, 'one','eleven', 'eleven'),
+ (1,11, 'one','eleven', 'eleven'),
+ (2,11, 'two','eleven', 'eleven'),
+ (2,12, 'two','twevle', 'twelve'),
+ (2,13, 'two','thirteen', 'foo'),
+ (2,13, 'two','thirteen', 'foo'),
+ (2,13, 'two','thirteen', 'bar'),
+ (NULL,13, 'two','thirteen', 'bar'),
+ (2,NULL, 'two','thirteen', 'bar'),
+ (2,13, NULL,'thirteen', 'bar'),
+ (2,13, 'two',NULL, 'bar'),
+ (2,13, 'two','thirteen', NULL);
+
+select distinct n1 from t1;
+select count(distinct n1) from t1;
+
+select distinct n2 from t1;
+select count(distinct n2) from t1;
+
+select distinct s from t1;
+select count(distinct s) from t1;
+
+select distinct vs from t1;
+select count(distinct vs) from t1;
+
+select distinct t from t1;
+select count(distinct t) from t1;
+
+select distinct n1,n2 from t1;
+select count(distinct n1,n2) from t1;
+
+select distinct n1,s from t1;
+select count(distinct n1,s) from t1;
+
+select distinct s,n1,vs from t1;
+select count(distinct s,n1,vs) from t1;
+
+select distinct s,t from t1;
+select count(distinct s,t) from t1;
+
+select count(distinct n1), count(distinct n2) from t1;
+
+select count(distinct n2), n1 from t1 group by n1;
+drop table t1;
+
+# test the converstion from tree to MyISAM
+create table t1 (n int default NULL);
+let $1=5000;
+while ($1)
+{
+ eval insert into t1 values($1);
+ dec $1;
+}
+
+flush status;
+select count(distinct n) from t1;
+show status like 'Created_tmp_disk_tables';
+drop table t1;
+
+#test conversion from heap to MyISAM
+create table t1 (s text);
+let $1=5000;
+while ($1)
+{
+ eval insert into t1 values('$1');
+ dec $1;
+}
+
+flush status;
+select count(distinct s) from t1;
+show status like 'Created_tmp_disk_tables';
+drop table t1;
+
diff --git a/mysql-test/t/ctype_latin1_de-master.opt b/mysql-test/t/ctype_latin1_de-master.opt
new file mode 100644
index 00000000000..98accd58c46
--- /dev/null
+++ b/mysql-test/t/ctype_latin1_de-master.opt
@@ -0,0 +1 @@
+--default-character-set=latin1_de
diff --git a/mysql-test/t/ctype_latin1_de.test b/mysql-test/t/ctype_latin1_de.test
new file mode 100644
index 00000000000..d39d7f6e5dd
--- /dev/null
+++ b/mysql-test/t/ctype_latin1_de.test
@@ -0,0 +1,46 @@
+#
+# Test latin_de character set
+#
+drop table if exists t1;
+create table t1 (a char (20) not null, b int not null auto_increment, index (a,b),index(b));
+insert into t1 (a) values ('ä'),('ac'),('ae'),('ad'),('Äc'),('aeb');
+insert into t1 (a) values ('üc'),('uc'),('ue'),('ud'),('Ü'),('ueb'),('uf');
+insert into t1 (a) values ('ö'),('oc'),('Öa'),('oe'),('od'),('Öc'),('oeb');
+insert into t1 (a) values ('s'),('ss'),('ß'),('ßb'),('ssa'),('ssc'),('ßa');
+insert into t1 (a) values ('eä'),('uü'),('öo'),('ää'),('ääa'),('aeae');
+insert into t1 (a) values ('q'),('a'),('u'),('o'),('é'),('É');
+select a,b from t1 order by a,b;
+select a,b from t1 order by upper(a),b;
+select a from t1 order by a desc;
+check table t1;
+select * from t1 where a like "ö%";
+select * from t1 where a like binary "%É%";
+select * from t1 where a like "%Á%";
+select * from t1 where a like "%U%";
+select * from t1 where a like "%ss%";
+drop table t1;
+
+# The following should all be true
+select strcmp('ä','ae'),strcmp('ae','ä'),strcmp('aeq','äq'),strcmp('äq','aeq');
+select strcmp('ss','ß'),strcmp('ß','ss'),strcmp('ßs','sss'),strcmp('ßq','ssq');
+
+# The following should all return -1
+select strcmp('ä','af'),strcmp('a','ä'),strcmp('ää','aeq'),strcmp('ää','aeaeq');
+select strcmp('ss','ßa'),strcmp('ß','ssa'),strcmp('sßa','sssb'),strcmp('s','ß');
+select strcmp('ö','oö'),strcmp('Ü','uü'),strcmp('ö','oeb');
+
+# The following should all return 1
+select strcmp('af','ä'),strcmp('ä','a'),strcmp('aeq','ää'),strcmp('aeaeq','ää');
+select strcmp('ßa','ss'),strcmp('ssa','ß'),strcmp('sssb','sßa'),strcmp('ß','s');
+select strcmp('u','öa'),strcmp('u','ö');
+
+#
+# Some other simple tests with the current character set
+#
+
+create table t1 (a varchar(10), key(a));
+insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
+select * from t1 where a like "abc%";
+select * from t1 where a like "test%";
+select * from t1 where a like "te_t";
+drop table t1;
diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test
index 2a45fe8253b..50a33762776 100644
--- a/mysql-test/t/drop.test
+++ b/mysql-test/t/drop.test
@@ -28,16 +28,16 @@ drop database foo;
# test drop/create database and FLUSH TABLES WITH READ LOCK
drop database if exists foo;
flush tables with read lock;
---error 1209
+--error 1209,1218;
create database foo;
unlock tables;
create database foo;
show databases;
flush tables with read lock;
---error 1208
+--error 1208,1218;
drop database foo;
unlock tables;
drop database foo;
show databases;
-
-
+--error 1008
+drop database foo;
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
index eedee811f2b..e9b9bd23398 100644
--- a/mysql-test/t/fulltext.test
+++ b/mysql-test/t/fulltext.test
@@ -74,13 +74,10 @@ CREATE TABLE t3 (
--error 1210
select * from t2 where MATCH inhalt AGAINST (t2.inhalt);
-
--error 1210
select * from t2 where MATCH inhalt AGAINST (t2.inhalt);
-
--error 1191
select * from t2 where MATCH ticket AGAINST ('foobar');
-
--error 1210
select * from t2,t3 where MATCH (t2.inhalt,t3.inhalt) AGAINST ('foobar');
diff --git a/mysql-test/t/fulltext_distinct.test b/mysql-test/t/fulltext_distinct.test
new file mode 100644
index 00000000000..4bd88dde496
--- /dev/null
+++ b/mysql-test/t/fulltext_distinct.test
@@ -0,0 +1,39 @@
+#
+# Test of fulltext index
+# bug reported by Tibor Simko <tibor.simko@cern.ch>
+#
+
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1 (
+ id mediumint unsigned NOT NULL auto_increment,
+ tag char(6) NOT NULL default '',
+ value text NOT NULL default '',
+ PRIMARY KEY (id),
+ KEY kt(tag),
+ KEY kv(value(15)),
+ FULLTEXT KEY kvf(value)
+ ) TYPE=MyISAM;
+ DROP TABLE IF EXISTS t2;
+ CREATE TABLE t2 (
+ id_t2 mediumint unsigned NOT NULL default '0',
+ id_t1 mediumint unsigned NOT NULL default '0',
+ field_number tinyint unsigned NOT NULL default '0',
+ PRIMARY KEY (id_t2,id_t1,field_number),
+ KEY id_t1(id_t1)
+ ) TYPE=MyISAM;
+
+ INSERT INTO t1 (tag,value) VALUES ('foo123','bar111');
+ INSERT INTO t2 VALUES (2231626,64280,0);
+ INSERT INTO t1 (tag,value) VALUES ('foo123','bar222');
+ INSERT INTO t2 VALUES (2231626,64281,0);
+insert into t1 (tag,value) values ('bar345','baz333 ar');
+insert into t2 values (12346, 3, 1);
+
+select * from t1; select * from t2;
+
+ SELECT DISTINCT t2.id_t2
+ FROM t2, t1
+ WHERE MATCH (t1.value) AGAINST ('baz333')
+ AND t1.id = t2.id_t1;
+
+DROP TABLE t1,t2;
diff --git a/mysql-test/t/fulltext_var.test b/mysql-test/t/fulltext_var.test
new file mode 100644
index 00000000000..71213d1195a
--- /dev/null
+++ b/mysql-test/t/fulltext_var.test
@@ -0,0 +1,5 @@
+#
+# Fulltext configurable parameters
+#
+
+show variables like "ft\_%";
diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test
index d160b04176c..e0f1f0db9ce 100644
--- a/mysql-test/t/func_like.test
+++ b/mysql-test/t/func_like.test
@@ -2,9 +2,11 @@
# Test of like
#
+drop table if exists t1;
create table t1 (a varchar(10), key(a));
insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
select * from t1 where a like "abc%";
+select * from t1 where a like "ABC%";
select * from t1 where a like "test%";
select * from t1 where a like "te_t";
drop table t1;
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index cb021d25ae3..ec1f64307e4 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -18,13 +18,23 @@ select month("1997-01-02"),year("98-02-03"),dayofyear("1997-12-31");
select month("2001-02-00"),year("2001-00-00");
select DAYOFYEAR("1997-03-03"), WEEK("1998-03-03"), QUARTER(980303);
select HOUR("1997-03-03 23:03:22"), MINUTE("23:03:22"), SECOND(230322);
+
+# Test of week and yearweek
select week(19980101),week(19970101),week(19980101,1),week(19970101,1);
select week(19981231),week(19971231),week(19981231,1),week(19971231,1);
select week(19950101),week(19950101,1);
select yearweek('1981-12-31',1),yearweek('1982-01-01',1),yearweek('1982-12-31',1),yearweek('1983-01-01',1);
+select yearweek('1987-01-01',1),yearweek('1987-01-01');
+select week("2000-01-01",0) as '2000', week("2001-01-01",0) as '2001', week("2002-01-01",0) as '2002',week("2003-01-01",0) as '2003', week("2004-01-01",0) as '2004', week("2005-01-01",0) as '2005', week("2006-01-01",0) as '2006';
+select week("2000-01-06",0) as '2000', week("2001-01-06",0) as '2001', week("2002-01-06",0) as '2002',week("2003-01-06",0) as '2003', week("2004-01-06",0) as '2004', week("2005-01-06",0) as '2005', week("2006-01-06",0) as '2006';
+select week("2000-01-01",1) as '2000', week("2001-01-01",1) as '2001', week("2002-01-01",1) as '2002',week("2003-01-01",1) as '2003', week("2004-01-01",1) as '2004', week("2005-01-01",1) as '2005', week("2006-01-01",1) as '2006';
+select week("2000-01-06",1) as '2000', week("2001-01-06",1) as '2001', week("2002-01-06",1) as '2002',week("2003-01-06",1) as '2003', week("2004-01-06",1) as '2004', week("2005-01-06",1) as '2005', week("2006-01-06",1) as '2006';
+select yearweek("2000-01-01",0) as '2000', yearweek("2001-01-01",0) as '2001', yearweek("2002-01-01",0) as '2002',yearweek("2003-01-01",0) as '2003', yearweek("2004-01-01",0) as '2004', yearweek("2005-01-01",0) as '2005', yearweek("2006-01-01",0) as '2006';
+select yearweek("2000-01-06",0) as '2000', yearweek("2001-01-06",0) as '2001', yearweek("2002-01-06",0) as '2002',yearweek("2003-01-06",0) as '2003', yearweek("2004-01-06",0) as '2004', yearweek("2005-01-06",0) as '2005', yearweek("2006-01-06",0) as '2006';
+select yearweek("2000-01-01",1) as '2000', yearweek("2001-01-01",1) as '2001', yearweek("2002-01-01",1) as '2002',yearweek("2003-01-01",1) as '2003', yearweek("2004-01-01",1) as '2004', yearweek("2005-01-01",1) as '2005', yearweek("2006-01-01",1) as '2006';
+select yearweek("2000-01-06",1) as '2000', yearweek("2001-01-06",1) as '2001', yearweek("2002-01-06",1) as '2002',yearweek("2003-01-06",1) as '2003', yearweek("2004-01-06",1) as '2004', yearweek("2005-01-06",1) as '2005', yearweek("2006-01-06",1) as '2006';
select date_format('1998-12-31','%x-%v'),date_format('1999-01-01','%x-%v');
select date_format('1999-12-31','%x-%v'),date_format('2000-01-01','%x-%v');
-select yearweek('1987-01-01',1),yearweek('1987-01-01');
select dayname("1962-03-03"),dayname("1962-03-03")+0;
select monthname("1972-03-04"),monthname("1972-03-04")+0;
diff --git a/mysql-test/t/handler.test b/mysql-test/t/handler.test
new file mode 100644
index 00000000000..359c5641056
--- /dev/null
+++ b/mysql-test/t/handler.test
@@ -0,0 +1,65 @@
+#
+# test of HANDLER ...
+#
+
+drop table if exists t1;
+create table t1 (a int, b char(10), key a(a), key b(a,b));
+insert into t1 values
+(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),
+(14,"aaa"),(15,"bbb"),(16,"ccc"),(16,"xxx"),
+(20,"ggg"),(21,"hhh"),(22,"iii");
+handler t1 open as t2;
+handler t2 read a first;
+handler t2 read a next;
+handler t2 read a next;
+handler t2 read a prev;
+handler t2 read a last;
+handler t2 read a prev;
+handler t2 read a prev;
+
+handler t2 read a first;
+handler t2 read a prev;
+
+handler t2 read a last;
+handler t2 read a prev;
+handler t2 read a next;
+handler t2 read a next;
+
+handler t2 read a=(15);
+handler t2 read a=(16);
+
+!$1070 handler t2 read a=(19,"fff");
+
+handler t2 read b=(19,"fff");
+handler t2 read b=(19,"yyy");
+handler t2 read b=(19);
+
+!$1109 handler t1 read a last;
+
+handler t2 read a=(11);
+handler t2 read a>=(11);
+
+handler t2 read a=(18);
+handler t2 read a>=(18);
+handler t2 read a>(18);
+handler t2 read a<=(18);
+handler t2 read a<(18);
+
+handler t2 read a first limit 5;
+handler t2 read a next limit 3;
+handler t2 read a prev limit 10;
+
+handler t2 read a>=(16) limit 4;
+handler t2 read a>=(16) limit 2,2;
+handler t2 read a last limit 3;
+
+handler t2 read a=(19);
+handler t2 read a=(19) where b="yyy";
+
+handler t2 read first;
+handler t2 read next;
+handler t2 read next;
+!$1064 handler t2 read last;
+
+handler t2 close;
+drop table if exists t1;
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 5530e2b1f54..0d2eb09eabd 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -512,3 +512,37 @@ replace into t1 (value,name,uid) values ('other value','two',102);
select * from t1;
drop table t1;
+#
+# Test DROP DATABASE
+#
+
+create database test_$1;
+create table test_$1.t1 (a int not null) type= innodb;
+insert into test_$1.t1 values(1);
+create table test_$1.t2 (a int not null) type= myisam;
+insert into test_$1.t2 values(1);
+create table test_$1.t3 (a int not null) type= heap;
+insert into test_$1.t3 values(1);
+commit;
+drop database test_$1;
+--error 12
+show tables from test_$1;
+
+#
+# Test truncate table
+#
+
+create table t1 (a int not null) type= innodb;
+insert into t1 values(1),(2);
+--error 1192
+truncate table t1;
+commit;
+truncate table t1;
+select * from t1;
+insert into t1 values(1),(2);
+delete from t1;
+select * from t1;
+commit;
+drop table t1;
+
+
diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test
index cf6f41d454d..270b1cd4c79 100644
--- a/mysql-test/t/insert.test
+++ b/mysql-test/t/insert.test
@@ -10,3 +10,15 @@ insert into t1 values (a+3);
insert into t1 values (4),(a+5);
select * from t1;
drop table t1;
+
+#
+# Test of duplicate key values with packed keys
+#
+
+create table t1 (id int not null auto_increment primary key, username varchar(32) not null, unique (username));
+insert into t1 values (0,"mysql");
+insert into t1 values (0,"mysql ab");
+insert into t1 values (0,"mysql a");
+insert into t1 values (0,"r1manic");
+insert into t1 values (0,"r1man");
+drop table t1;
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
index 17ecb2d5a1f..30d3e31188c 100644
--- a/mysql-test/t/insert_select.test
+++ b/mysql-test/t/insert_select.test
@@ -10,3 +10,59 @@ insert into t2 (payoutID) SELECT DISTINCT payoutID FROM t1;
insert into t2 (payoutID) SELECT payoutID+10 FROM t1;
select * from t2;
drop table t1,t2;
+#
+# bug in bulk insert optimization
+# test case by Fournier Jocelyn <joc@presence-pc.com>
+#
+
+DROP TABLE IF EXISTS crash1,crash2;
+CREATE TABLE `crash1` (
+ `numeropost` bigint(20) unsigned NOT NULL default '0',
+ `icone` tinyint(4) unsigned NOT NULL default '0',
+ `numreponse` bigint(20) unsigned NOT NULL auto_increment,
+ `contenu` text NOT NULL,
+ `pseudo` varchar(50) NOT NULL default '',
+ `date` datetime NOT NULL default '0000-00-00 00:00:00',
+ `ip` bigint(11) NOT NULL default '0',
+ `signature` tinyint(1) unsigned NOT NULL default '0',
+ PRIMARY KEY (`numeropost`,`numreponse`)
+ ,KEY `ip` (`ip`),
+ KEY `date` (`date`),
+ KEY `pseudo` (`pseudo`),
+ KEY `numreponse` (`numreponse`)
+) TYPE=MyISAM;
+
+CREATE TABLE `crash2` (
+ `numeropost` bigint(20) unsigned NOT NULL default '0',
+ `icone` tinyint(4) unsigned NOT NULL default '0',
+ `numreponse` bigint(20) unsigned NOT NULL auto_increment,
+ `contenu` text NOT NULL,
+ `pseudo` varchar(50) NOT NULL default '',
+ `date` datetime NOT NULL default '0000-00-00 00:00:00',
+ `ip` bigint(11) NOT NULL default '0',
+ `signature` tinyint(1) unsigned NOT NULL default '0',
+ PRIMARY KEY (`numeropost`,`numreponse`),
+ KEY `ip` (`ip`),
+ KEY `date` (`date`),
+ KEY `pseudo` (`pseudo`),
+ KEY `numreponse` (`numreponse`)
+) TYPE=MyISAM;
+
+INSERT INTO crash2
+(numeropost,icone,numreponse,contenu,pseudo,date,ip,signature) VALUES
+(9,1,56,'test','joce','2001-07-25 13:50:53'
+,3649052399,0);
+
+
+INSERT INTO crash1 (numeropost,icone,contenu,pseudo,date,signature,ip)
+SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM crash2
+WHERE numeropost=9 ORDER BY numreponse ASC;
+
+show variables like '%bulk%';
+
+INSERT INTO crash1 (numeropost,icone,contenu,pseudo,date,signature,ip)
+SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM crash2
+WHERE numeropost=9 ORDER BY numreponse ASC;
+
+DROP TABLE IF EXISTS crash1,crash2;
+
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index 238dd599664..188f699cd64 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -22,7 +22,7 @@ insert into t2 select NULL,message from t1;
insert into t1 select NULL,message from t2;
insert into t2 select NULL,message from t1;
insert into t1 select NULL,message from t2;
-create table t3 (a int not null, b char(20), key(a)) type=MERGE UNION=(t1,t2);
+create table t3 (a int not null, b char(20), key(a)) type=MERGE UNION=(test.t1,test.t2);
explain select * from t3 where a < 10;
explain select * from t3 where a > 10 and a < 20;
select * from t3 where a = 10;
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
new file mode 100644
index 00000000000..7959b67ee9c
--- /dev/null
+++ b/mysql-test/t/multi_update.test
@@ -0,0 +1,51 @@
+#
+# Only run the test if we are using --big-test, because this test takes a
+# long time
+#
+-- require r/big_test.require
+eval select $BIG_TEST as using_big_test;
+
+drop table if exists t1,t2,t3;
+create table t1(id1 int not null auto_increment primary key, t char(12));
+create table t2(id2 int not null, t char(12));
+create table t3(id3 int not null, t char(12), index(id3));
+let $1 = 10000;
+while ($1)
+ {
+ let $2 = 5;
+ eval insert into t1(t) values ('$1');
+ while ($2)
+ {
+ eval insert into t2(id2,t) values ($1,'$2');
+ let $3 = 10;
+ while ($3)
+ {
+ eval insert into t3(id3,t) values ($1,'$2');
+ dec $3;
+ }
+ dec $2;
+ }
+ dec $1;
+ }
+
+delete t1.*, t2.*, t3.* from t1,t2,t3 where t1.id1 = t2.id2 and t2.id2 = t3.id3 and t1.id1 > 9500;
+
+check table t1, t2, t3;
+
+select count(*) from t1 where id1 > 9500;
+select count(*) from t2 where id2 > 9500;
+select count(*) from t3 where id3 > 9500;
+
+delete t1, t2, t3 from t1,t2,t3 where t1.id1 = t2.id2 and t2.id2 = t3.id3 and t1.id1 > 500;
+select count(*) from t1 where id1 > 500;
+select count(*) from t2 where id2 > 500;
+select count(*) from t3 where id3 > 500;
+
+delete t1, t2, t3 from t1,t2,t3 where t1.id1 = t2.id2 and t2.id2 = t3.id3 and t1.id1 > 0;
+
+# These queries will force a scan of the table
+select count(*) from t1 where id1;
+select count(*) from t2 where id2;
+select count(*) from t3 where id3;
+
+drop table t1,t2,t3;
diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test
new file mode 100644
index 00000000000..8dfd0d8c2f9
--- /dev/null
+++ b/mysql-test/t/openssl_1.test
@@ -0,0 +1,6 @@
+# We test openssl. Result set is optimized to be compiled with --with-openssl but
+# SSL is swithced off in some reason
+-- source include/have_openssl_2.inc
+
+SHOW STATUS LIKE 'SSL%';
+
diff --git a/mysql-test/t/openssl_2.test b/mysql-test/t/openssl_2.test
new file mode 100644
index 00000000000..12f1240f3af
--- /dev/null
+++ b/mysql-test/t/openssl_2.test
@@ -0,0 +1,5 @@
+# We want to test everything with SSL turned on.
+-- source include/have_openssl_2.inc
+
+SHOW STATUS LIKE 'SSL%';
+
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index 16094206745..baa3fe67f0b 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -206,8 +206,53 @@ ORDER by lastchange_datum DESC LIMIT 2;
drop table t1;
#
-# Test optimizing bug with EQ_REF tables, where some ORDER BY parts where
-# wrongly removed.
+# Test optimization of ORDER BY DESC
+#
+
+create table t1 (a int not null, b int, c varchar(10), key (a, b, c));
+insert into t1 values (1, NULL, NULL), (1, NULL, 'b'), (1, 1, NULL), (1, 1, 'b'), (1, 1, 'b'), (2, 1, 'a'), (2, 1, 'b'), (2, 2, 'a'), (2, 2, 'b'), (2, 3, 'c'),(1,3,'b');
+
+explain select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc;
+select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc;
+explain select * from t1 where a >= 1 and a < 3 order by a desc;
+select * from t1 where a >= 1 and a < 3 order by a desc;
+explain select * from t1 where a = 1 order by a desc, b desc;
+select * from t1 where a = 1 order by a desc, b desc;
+explain select * from t1 where a = 1 and b is null order by a desc, b desc;
+select * from t1 where a = 1 and b is null order by a desc, b desc;
+explain select * from t1 where a >= 1 and a < 3 and b >0 order by a desc,b desc;
+explain select * from t1 where a = 2 and b >0 order by a desc,b desc;
+explain select * from t1 where a = 2 and b is null order by a desc,b desc;
+explain select * from t1 where a = 2 and (b is null or b > 0) order by a
+desc,b desc;
+explain select * from t1 where a = 2 and b > 0 order by a desc,b desc;
+explain select * from t1 where a = 2 and b < 2 order by a desc,b desc;
+
+#
+# Test things when we don't have NULL keys
+#
+
+alter table t1 modify b int not null, modify c varchar(10) not null;
+explain select * from t1 order by a, b, c;
+select * from t1 order by a, b, c;
+explain select * from t1 order by a desc, b desc, c desc;
+select * from t1 order by a desc, b desc, c desc;
+# test multiple ranges, NO_MAX_RANGE and EQ_RANGE
+explain select * from t1 where (a = 1 and b = 1 and c = 'b') or (a > 2) order by a desc;
+select * from t1 where (a = 1 and b = 1 and c = 'b') or (a > 2) order by a desc;
+# test NEAR_MAX, NO_MIN_RANGE
+explain select * from t1 where a < 2 and b <= 1 order by a desc, b desc;
+select * from t1 where a < 2 and b <= 1 order by a desc, b desc;
+select count(*) from t1 where a < 5 and b > 0;
+select * from t1 where a < 5 and b > 0 order by a desc,b desc;
+# test HA_READ_AFTER_KEY (at the end of the file), NEAR_MIN
+explain select * from t1 where a between 1 and 3 and b <= 1 order by a desc, b desc;
+select * from t1 where a between 1 and 3 and b <= 1 order by a desc, b desc;
+# test HA_READ_AFTER_KEY (in the middle of the file)
+explain select * from t1 where a between 0 and 1 order by a desc, b desc;
+select * from t1 where a between 0 and 1 order by a desc, b desc;
+drop table t1;
+
CREATE TABLE t1 (
gid int(10) unsigned NOT NULL auto_increment,
diff --git a/mysql-test/t/order_fill_sortbuf-master.opt b/mysql-test/t/order_fill_sortbuf-master.opt
new file mode 100644
index 00000000000..af4e7d33143
--- /dev/null
+++ b/mysql-test/t/order_fill_sortbuf-master.opt
@@ -0,0 +1 @@
+-O sort_buffer=0
diff --git a/mysql-test/t/order_fill_sortbuf.test b/mysql-test/t/order_fill_sortbuf.test
new file mode 100644
index 00000000000..a64ffce08e3
--- /dev/null
+++ b/mysql-test/t/order_fill_sortbuf.test
@@ -0,0 +1,20 @@
+#
+# This test does a create-select with ORDER BY, where there is so many
+# rows MySQL needs to use a merge during the sort phase.
+#
+
+drop table if exists t1,t2;
+CREATE TABLE `t1` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ `id3` int(11) NOT NULL default '0');
+let $1=4000;
+while ($1)
+ {
+ eval insert into t1 (id,id2,id3) values ($1,$1,$1);
+ dec $1;
+ }
+
+create table t2 select id2 from t1 order by id3;
+select count(*) from t2;
+drop table t1,t2;
diff --git a/mysql-test/t/rpl000002.test b/mysql-test/t/rpl000002.test
index 0c490e6316d..865aa5e5bab 100644
--- a/mysql-test/t/rpl000002.test
+++ b/mysql-test/t/rpl000002.test
@@ -11,6 +11,7 @@ use test;
sync_with_master;
select * from t1;
connection master;
+show slave hosts;
drop table t1;
save_master_pos;
connection slave;
diff --git a/mysql-test/t/rpl000009.test b/mysql-test/t/rpl000009.test
index 768c6c151b4..208e6f0b037 100644
--- a/mysql-test/t/rpl000009.test
+++ b/mysql-test/t/rpl000009.test
@@ -31,3 +31,56 @@ connection slave;
sync_with_master;
drop database if exists bar;
drop database if exists foo;
+
+#now let's test load data from master
+
+#first create some databases and tables on the master
+connection master;
+set sql_log_bin = 0;
+create database foo;
+create database bar;
+show databases;
+create table foo.t1(n int, s char(20));
+create table foo.t2(n int, s text);
+insert into foo.t1 values (1, 'one'), (2, 'two'), (3, 'three');
+insert into foo.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen');
+
+create table bar.t1(n int, s char(20));
+create table bar.t2(n int, s text);
+insert into bar.t1 values (1, 'one bar'), (2, 'two bar'), (3, 'three bar');
+insert into bar.t2 values (11, 'eleven bar'), (12, 'twelve bar'),
+ (13, 'thirteen bar');
+set sql_log_bin = 1;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+#this should show that the slave is empty at this point
+show databases;
+load data from master;
+
+#now let's check if we have the right tables and the right data in them
+show databases;
+use foo;
+show tables;
+use bar;
+show tables;
+select * from bar.t1;
+select * from bar.t2;
+
+#now let's see if replication works
+connection master;
+insert into bar.t1 values (4, 'four bar');
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from bar.t1;
+
+#now time for cleanup
+connection master;
+drop database bar;
+drop database foo;
+save_master_pos;
+connection slave;
+sync_with_master;
+
diff --git a/mysql-test/t/rpl000014.test b/mysql-test/t/rpl000014.test
index b501d63b10e..604e614b3a8 100644
--- a/mysql-test/t/rpl000014.test
+++ b/mysql-test/t/rpl000014.test
@@ -25,7 +25,7 @@ create table foo (n int);
insert into foo values (1),(2),(3);
save_master_pos;
connection slave;
-change master to master_log_pos=73;
+change master to master_log_pos=79;
sync_with_master;
select * from foo;
connection master;
diff --git a/mysql-test/t/rpl000017-slave.sh b/mysql-test/t/rpl000017-slave.sh
index 4415f093aad..2ead2021416 100755
--- a/mysql-test/t/rpl000017-slave.sh
+++ b/mysql-test/t/rpl000017-slave.sh
@@ -6,4 +6,5 @@ replicate
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
9306
1
+0
EOF
diff --git a/mysql-test/t/rpl_log.test b/mysql-test/t/rpl_log.test
new file mode 100644
index 00000000000..426553b4bdc
--- /dev/null
+++ b/mysql-test/t/rpl_log.test
@@ -0,0 +1,48 @@
+source include/master-slave.inc;
+eval_result; #result depends on some server specific params
+
+#clean up slave binlogs
+connection slave;
+slave stop;
+reset master;
+reset slave;
+
+connection master;
+reset master;
+drop table if exists t1;
+create table t1(n int not null auto_increment primary key);
+insert into t1 values (NULL);
+drop table t1;
+create table t1 (word char(20) not null);
+load data infile '../../std_data/words.dat' into table t1;
+drop table t1;
+show binlog events;
+show binlog events from 79 limit 1;
+show binlog events from 79 limit 2;
+show binlog events from 79 limit 2,1;
+flush logs;
+create table t1 (n int);
+insert into t1 values (1);
+drop table t1;
+show binlog events;
+show binlog events in 'master-bin.002';
+show master logs;
+save_master_pos;
+connection slave;
+let $VERSION=`select version()`;
+slave start;
+sync_with_master;
+show master logs;
+show binlog events in 'slave-bin.001' from 4;
+show binlog events in 'slave-bin.002' from 4;
+show slave status;
+show new master for slave with master_log_file='master-bin.001' and
+ master_log_pos=4 and master_log_seq=1 and master_server_id=1;
+show new master for slave with master_log_file='master-bin.001' and
+ master_log_pos=79 and master_log_seq=2 and master_server_id=1;
+show new master for slave with master_log_file='master-bin.001' and
+ master_log_pos=311 and master_log_seq=6 and master_server_id=1;
+show new master for slave with master_log_file='master-bin.002' and
+ master_log_pos=4 and master_log_seq=1 and master_server_id=1;
+show new master for slave with master_log_file='master-bin.002' and
+ master_log_pos=137 and master_log_seq=3 and master_server_id=1;
diff --git a/mysql-test/t/rpl_magic.test b/mysql-test/t/rpl_magic.test
new file mode 100644
index 00000000000..376edc301d7
--- /dev/null
+++ b/mysql-test/t/rpl_magic.test
@@ -0,0 +1,31 @@
+source include/master-slave.inc;
+
+#first, make sure the slave has had enough time to register
+connection master;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+#discover slaves
+connection master;
+rpl_probe;
+
+#turn on master/slave query direction auto-magic
+enable_rpl_parse;
+drop table if exists t1;
+create table t1 ( n int);
+insert into t1 values (1),(2),(3),(4);
+disable_rpl_parse;
+save_master_pos;
+enable_rpl_parse;
+connection slave;
+sync_with_master;
+insert into t1 values(5);
+connection master;
+select * from t1;
+select * from t1;
+disable_rpl_parse;
+select * from t1;
+connection slave;
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/rpl_mystery22.test b/mysql-test/t/rpl_mystery22.test
index 3a48ef84dc1..e987074697b 100644
--- a/mysql-test/t/rpl_mystery22.test
+++ b/mysql-test/t/rpl_mystery22.test
@@ -1,5 +1,6 @@
# test case to make slave thread get ahead by 22 bytes
+drop table if exists t1;
source include/master-slave.inc;
connection master;
# first, cause a duplicate key problem on the slave
diff --git a/mysql-test/t/rpl_sporadic_master.test b/mysql-test/t/rpl_sporadic_master.test
index c1a47781ddf..0487f868436 100644
--- a/mysql-test/t/rpl_sporadic_master.test
+++ b/mysql-test/t/rpl_sporadic_master.test
@@ -7,7 +7,7 @@ drop table if exists t1,t2;
create table t2(n int);
create table t1(n int not null auto_increment primary key);
insert into t1 values (NULL),(NULL);
-delete from t1;
+truncate table t1;
# We have to use 4 in the following to make this test work with all table types
insert into t1 values (4),(NULL);
save_master_pos;
@@ -18,10 +18,8 @@ slave start;
connection master;
insert into t1 values (NULL),(NULL);
flush logs;
-delete from t1;
-insert into t1 values (10),(NULL);
-insert into t1 values (NULL),(NULL);
-insert into t1 values (NULL),(NULL);
+truncate table t1;
+insert into t1 values (10),(NULL),(NULL),(NULL),(NULL),(NULL);
save_master_pos;
connection slave;
sync_with_master;
diff --git a/mysql-test/t/select_found.test b/mysql-test/t/select_found.test
new file mode 100644
index 00000000000..52c8039b2f5
--- /dev/null
+++ b/mysql-test/t/select_found.test
@@ -0,0 +1,20 @@
+#
+# Testing of found_rows()
+#
+
+drop table if exists t1;
+create table t1 (a int not null auto_increment, b int not null, primary key(a));
+insert into t1 (b) values (2),(3),(5),(5),(5),(6),(7),(9);
+select SQL_CALC_FOUND_ROWS * from t1;
+select found_rows();
+select SQL_CALC_FOUND_ROWS * from t1 limit 1;
+select found_rows();
+select SQL_CALC_FOUND_ROWS * from t1 order by b desc limit 1;
+select found_rows();
+select SQL_CALC_FOUND_ROWS distinct b from t1 limit 1;
+select found_rows();
+select SQL_CALC_FOUND_ROWS b,count(*) as c from t1 group by b order by c desc limit 1;
+select found_rows();
+select SQL_CALC_FOUND_ROWS * from t1 left join t1 as t2 on (t1.b=t2.a) limit 2,1;
+select found_rows();
+drop table t1;
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 0f07d577c0c..0e0d79e7d16 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -72,3 +72,10 @@ drop table t1;
create table t1 (a int not null, primary key (a));
show create table t1;
drop table t1;
+
+flush tables;
+show open tables;
+create table t1(n int);
+insert into t1 values (1);
+show open tables;
+drop table t1;
diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test
index 70a7a3ab584..bdfeb26073f 100644
--- a/mysql-test/t/status.test
+++ b/mysql-test/t/status.test
@@ -6,7 +6,7 @@ show status like 'Table_lock%';
connection con1;
SET SQL_LOG_BIN=0;
drop table if exists t1;
-create table t1(n int);
+create table t1(n int) type=myisam;
insert into t1 values(1);
connection con2;
lock tables t1 read;
diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test
new file mode 100644
index 00000000000..5e2b8232844
--- /dev/null
+++ b/mysql-test/t/symlink.test
@@ -0,0 +1,82 @@
+-- require r/have_symlink.require
+show variables like "have_symlink";
+
+#
+# First create little data to play with
+#
+drop table if exists t1,t2,t7,t8,t9;
+create table t1 (a int not null auto_increment, b char(16) not null, primary key (a));
+create table t2 (a int not null auto_increment, b char(16) not null, primary key (a));
+insert into t1 (b) values ("test"),("test1"),("test2"),("test3");
+insert into t2 (b) select b from t1;
+insert into t1 (b) select b from t2;
+insert into t2 (b) select b from t1;
+insert into t1 (b) select b from t2;
+insert into t2 (b) select b from t1;
+insert into t1 (b) select b from t2;
+insert into t2 (b) select b from t1;
+insert into t1 (b) select b from t2;
+insert into t2 (b) select b from t1;
+insert into t1 (b) select b from t2;
+insert into t2 (b) select b from t1;
+insert into t1 (b) select b from t2;
+insert into t2 (b) select b from t1;
+insert into t1 (b) select b from t2;
+insert into t2 (b) select b from t1;
+insert into t1 (b) select b from t2;
+insert into t2 (b) select b from t1;
+insert into t1 (b) select b from t2;
+drop table t2;
+
+#
+# Start the test
+# We use t9 here to not crash with tables generated by the backup test
+#
+
+eval create table t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="$MYSQL_TEST_DIR/var/tmp" index directory="$MYSQL_TEST_DIR/var/run";
+insert into t9 select * from t1;
+check table t9;
+optimize table t9;
+repair table t9;
+alter table t9 add column c int not null;
+show create table t9;
+
+# Test renames
+alter table t9 rename t8, add column d int not null;
+alter table t8 rename t7;
+rename table t7 to t9;
+# Drop old t1 table, keep t9
+drop table t1;
+
+#
+# Test error handling
+# Note that we are using the above table t9 here!
+#
+
+--error 1103
+create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="tmp";
+
+# Check that we cannot link over a table from another database.
+
+drop database if exists test_mysqltest;
+create database test_mysqltest;
+
+--error 1
+create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="/this-dir-does-not-exist";
+
+--error 1103
+create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="not-hard-path";
+
+--error 1
+eval create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="$MYSQL_TEST_DIR/var/run";
+
+--error 1
+eval create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="$MYSQL_TEST_DIR/var/tmp";
+
+# Check moving table t9 from default database to test_mysqltest;
+# In this case the symlinks should be removed.
+
+alter table t9 rename test_mysqltest.t9;
+select count(*) from test_mysqltest.t9;
+show create table test_mysqltest.t9;
+drop database test_mysqltest;
diff --git a/mysql-test/t/truncate.test b/mysql-test/t/truncate.test
index e995517cf1e..2430682a93f 100644
--- a/mysql-test/t/truncate.test
+++ b/mysql-test/t/truncate.test
@@ -2,10 +2,14 @@
# Test of truncate
#
create table t1 (a integer, b integer,c1 CHAR(10));
+insert into t1 (a) values (1),(2);
truncate table t1;
select count(*) from t1;
insert into t1 values(1,2,"test");
select count(*) from t1;
+delete from t1;
+select * from t1;
drop table t1;
# The following should fail
-!$1146 select count(*) from t1;
+--error 1146
+select count(*) from t1;
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index 1e7bd11bab1..857937fd90e 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -30,3 +30,12 @@ CREATE TABLE t1 (a datetime not null);
insert into t1 values (0);
select * from t1 where a is null;
drop table t1;
+
+#
+# Test with bug when propagating DATETIME to integer and WHERE optimization
+#
+
+create table t1 (id int, dt datetime);
+insert into t1 values (1,"2001-08-14 00:00:00"),(2,"2001-08-15 00:00:00"),(3,"2001-08-16 00:00:00");
+select * from t1 where dt='2001-08-14 00:00:00' and dt = if(id=1,'2001-08-14 00:00:00','1999-08-15');
+drop table t1;
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
new file mode 100644
index 00000000000..c3a0e1ef901
--- /dev/null
+++ b/mysql-test/t/union.test
@@ -0,0 +1,42 @@
+#
+# Test of unions
+#
+
+drop table if exists t1,t2,t3;
+CREATE TABLE t1 (a int not null, b char (10) not null);
+insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
+CREATE TABLE t2 (a int not null, b char (10) not null);
+insert into t2 values (3,'c'),(4,'d'),(5,'f'),(6,'e');
+
+select a,b from t1 union select a,b from t2;
+select a,b from t1 union all select a,b from t2;
+select a,b from t1 union all select a,b from t2 order by b;
+select a,b from t1 union all select a,b from t2 union select 7,'g';
+select 0,'#' union select a,b from t1 union all select a,b from t2 union select 7,'gg';
+select a,b from t1 union select a,b from t1;
+select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 group by b;
+
+# Test some error conditions with UNION
+explain select a,b from t1 union all select a,b from t2;
+
+--error 1215
+select a,b from t1 into outfile 'skr' union select a,b from t2;
+
+--error 1215
+select a,b from t1 order by a union select a,b from t2;
+
+--error 1216
+create table t3 select a,b from t1 union select a from t2;
+
+--error 1215
+insert into t3 select a from t1 order by a union select a from t2;
+
+--error 1216
+select a,b from t1 union select a from t2;
+
+# Test CREATE, INSERT and REPLACE
+create table t3 select a,b from t1 union all select a,b from t2;
+insert into t3 select a,b from t1 union all select a,b from t2;
+replace into t3 select a,b as c from t1 union all select a,b from t2;
+
+drop table t1,t2,t3;
diff --git a/mysql-test/t/varbinary.test b/mysql-test/t/varbinary.test
index 0ab26f51e65..6d2660271ea 100644
--- a/mysql-test/t/varbinary.test
+++ b/mysql-test/t/varbinary.test
@@ -4,6 +4,7 @@
select 0x41,0x41+0,0x41 | 0x7fffffffffffffff | 0,0xffffffffffffffff | 0 ;
select 0x31+1,concat(0x31)+1,-0xf;
+select x'31',X'ffff'+0;
#
# Test of hex constants in WHERE:
@@ -14,3 +15,18 @@ insert into t1 set UNIQ=0x38afba1d73e6a18a;
insert into t1 set UNIQ=123;
explain select * from t1 where UNIQ=0x38afba1d73e6a18a;
drop table t1;
+
+#
+# Test error conditions
+#
+--error 1064
+select x'hello';
+--error 1054
+select 0xfg;
+
+#
+# Test likely error conditions
+#
+create table t1 select 1 as x, 2 as xx;
+select x,xx from t1;
+drop table t1;