summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/Makefile.am8
-rw-r--r--mysql-test/README60
-rw-r--r--mysql-test/README.gcov16
-rw-r--r--mysql-test/include/have_latin2_ch.inc4
-rw-r--r--mysql-test/lib/mtr_cases.pl22
-rw-r--r--mysql-test/lib/mtr_misc.pl42
-rw-r--r--mysql-test/lib/mtr_process.pl5
-rw-r--r--mysql-test/lib/mtr_timer.pl6
-rwxr-xr-xmysql-test/mysql-test-run.pl185
-rw-r--r--mysql-test/mysql-test-run.sh23
-rw-r--r--mysql-test/r/cast.result8
-rw-r--r--mysql-test/r/create.result2
-rw-r--r--mysql-test/r/ctype_big5.result3
-rw-r--r--mysql-test/r/ctype_gbk.result3
-rw-r--r--mysql-test/r/ctype_latin1.result22
-rw-r--r--mysql-test/r/ctype_latin2_ch.result30
-rw-r--r--mysql-test/r/ctype_ucs.result12
-rw-r--r--mysql-test/r/ctype_ucs2_def.result6
-rw-r--r--mysql-test/r/ctype_ujis.result6
-rw-r--r--mysql-test/r/ctype_utf8.result46
-rw-r--r--mysql-test/r/func_compress.result7
-rw-r--r--mysql-test/r/func_gconcat.result25
-rw-r--r--mysql-test/r/func_op.result11
-rw-r--r--mysql-test/r/grant.result18
-rw-r--r--mysql-test/r/have_latin2_ch.require2
-rw-r--r--mysql-test/r/key_cache.result42
-rw-r--r--mysql-test/r/kill.result2
-rw-r--r--mysql-test/r/lock.result11
-rw-r--r--mysql-test/r/myisam.result18
-rw-r--r--mysql-test/r/mysqltest.result2
-rw-r--r--mysql-test/r/order_by.result32
-rw-r--r--mysql-test/r/ps.result142
-rw-r--r--mysql-test/r/rpl_deadlock.result105
-rw-r--r--mysql-test/r/rpl_relayrotate.result7
-rw-r--r--mysql-test/r/rpl_trunc_temp.result22
-rw-r--r--mysql-test/r/union.result12
-rw-r--r--mysql-test/t/cast.test9
-rw-r--r--mysql-test/t/create.test6
-rw-r--r--mysql-test/t/ctype_big5.test10
-rw-r--r--mysql-test/t/ctype_gbk.test10
-rw-r--r--mysql-test/t/ctype_latin1.test14
-rw-r--r--mysql-test/t/ctype_latin2_ch.test30
-rw-r--r--mysql-test/t/ctype_ucs.test8
-rw-r--r--mysql-test/t/ctype_ucs2_def-master.opt1
-rw-r--r--mysql-test/t/ctype_ucs2_def.test9
-rw-r--r--mysql-test/t/ctype_ujis.test15
-rw-r--r--mysql-test/t/ctype_utf8.test34
-rw-r--r--mysql-test/t/disabled.def3
-rw-r--r--mysql-test/t/func_compress.test9
-rw-r--r--mysql-test/t/func_gconcat.test19
-rw-r--r--mysql-test/t/func_op.test14
-rw-r--r--mysql-test/t/grant.test16
-rw-r--r--mysql-test/t/key_cache.test41
-rw-r--r--mysql-test/t/kill.test7
-rw-r--r--mysql-test/t/lock.test18
-rw-r--r--mysql-test/t/myisam.test19
-rw-r--r--mysql-test/t/mysqltest.test4
-rw-r--r--mysql-test/t/order_by.test14
-rw-r--r--mysql-test/t/ps.test164
-rw-r--r--mysql-test/t/rpl_deadlock.test16
-rw-r--r--mysql-test/t/rpl_relayrotate.test8
-rw-r--r--mysql-test/t/rpl_trunc_temp.test35
-rw-r--r--mysql-test/t/rpl_until.test4
-rw-r--r--mysql-test/t/union.test11
64 files changed, 1408 insertions, 107 deletions
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index 9a88aff8300..7c2415dd6b6 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -32,12 +32,14 @@ endif
benchdir_root= $(prefix)
testdir = $(benchdir_root)/mysql-test
-EXTRA_SCRIPTS = mysql-test-run.sh mysql-test-run.pl install_test_db.sh
+EXTRA_SCRIPTS = mysql-test-run.sh install_test_db.sh $(PRESCRIPTS)
EXTRA_DIST = $(EXTRA_SCRIPTS)
-test_SCRIPTS = mysql-test-run install_test_db
+GENSCRIPTS = mysql-test-run install_test_db
+PRESCRIPTS = mysql-test-run.pl
+test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS)
test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem \
std_data/server-cert.pem std_data/server-key.pem
-CLEANFILES = $(test_SCRIPTS) $(test_DATA)
+CLEANFILES = $(GENSCRIPTS) $(test_DATA)
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I..
EXTRA_PROGRAMS = mysql_test_run_new
diff --git a/mysql-test/README b/mysql-test/README
index 10d64784ed4..77b398ebf39 100644
--- a/mysql-test/README
+++ b/mysql-test/README
@@ -1,45 +1,51 @@
-This directory contains a test suite for mysql daemon. To run
+This directory contains a test suite for the MySQL daemon. To run
the currently existing test cases, simply execute ./mysql-test-run in
this directory. It will fire up the newly built mysqld and test it.
-If you want to run a test with a running MySQL server use the --extern
-option to mysql-test-run. Please note that in this mode the test suite
-expects user to specify test names to run. Otherwise it falls back to the
-normal "non-extern" behaviour. The reason is that some tests
-could not run with external server. Here is the sample command
-to test "alias" and "analyze" tests on external server:
+Note that you do not have to have to do "make install", and you could
+actually have a co-existing MySQL installation. The tests will not
+conflict with it.
-mysql-test-run --extern alias analyze
+All tests must pass. If one or more of them fail on your system, please
+read the following manual section for instructions on how to report the
+problem:
-To match your setup you might also need to provide --socket, --user and
-other relevant options.
+http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html
-Note that you do not have to have to do make install, and you could
-actually have a co-existing MySQL installation - the tests will not
-conflict with it.
+If you want to use an already running MySQL server for specific tests,
+use the --extern option to mysql-test-run. Please note that in this mode,
+the test suite expects you to provide the names of the tests to run.
+For example, here is the command to run the "alias" and "analyze" tests
+with an external server:
-All tests must pass. If one or more of them fail on your system, please
-read the following manual section of how to report the problem:
+mysql-test-run --extern alias analyze
+
+To match your setup, you might also need to provide --socket, --user, and
+other relevant options.
-http://dev.mysql.com/doc/mysql/en/MySQL_test_suite.html
+With no test cases named on the command line, mysql-test-run falls back
+to the normal "non-extern" behavior. The reason for this is that some
+tests cannot run with an external server.
-You can create your own test cases. To create a test case:
+You can create your own test cases. To create a test case, create a new
+file in the t subdirectory using a text editor. The file should have a .test
+extension. For example:
xemacs t/test_case_name.test
- in the file, put a set of SQL commands that will create some tables,
- load test data, run some queries to manipulate it.
+ In the file, put a set of SQL statements that create some tables,
+ load test data, and run some queries to manipulate it.
- We would appreciate if the test tables were called t1, t2, t3 ... (to not
+ We would appreciate it if you name your test tables t1, t2, t3 ... (to not
conflict too much with existing tables).
Your test should begin by dropping the tables you are going to create and
- end by dropping them again. This will ensure that one can run the test
- over and over again.
+ end by dropping them again. This ensures that you can run the test over
+ and over again.
If you are using mysqltest commands (like result file names) in your
- test case you should do create the result file as follows:
+ test case, you should create the result file as follows:
mysql-test-run --record test_case_name
@@ -47,8 +53,8 @@ You can create your own test cases. To create a test case:
mysqltest --record < t/test_case_name.test
- If you only have a simple test cases consistent of SQL commands and comments
- you can create the test case one of the following ways:
+ If you only have a simple test cases consisting of SQL statements and
+ comments, you can create the test case in one of the following ways:
mysql-test-run --record test_case_name
@@ -57,11 +63,11 @@ You can create your own test cases. To create a test case:
mysqltest --record --record-file=r/test_case_name.result < t/test_case_name.test
When this is done, take a look at r/test_case_name.result
- - If the result is wrong, you have found a bug; In this case you should
+ - If the result is incorrect, you have found a bug. In this case, you should
edit the test result to the correct results so that we can verify
that the bug is corrected in future releases.
To submit your test case, put your .test file and .result file(s) into
a tar.gz archive, add a README that explains the problem, ftp the
-archive to ftp://support.mysql.com/pub/mysql/secret/ and send a mail
+archive to ftp://support.mysql.com/pub/mysql/secret/ and send a mail
to bugs@lists.mysql.com
diff --git a/mysql-test/README.gcov b/mysql-test/README.gcov
index 83ddd6df2e1..6d2852e8ca0 100644
--- a/mysql-test/README.gcov
+++ b/mysql-test/README.gcov
@@ -1,11 +1,13 @@
To be able to see the level of coverage with the current test suite,
do the following:
- - make sure gcov is installed
- - compile with BUILD/compile-pentium-gcov ( if your machine is not pentium, hack
-this script, or just live with the pentium-specific stuff)
- - ./mysql-test-run -gcov
- - to see the level of coverage for a given source file:
+ - Make sure gcov is installed
+ - Compile the MySQL distribution with BUILD/compile-pentium-gcov (if your
+ machine does not have a pentium CPU, hack this script, or just live with
+ the pentium-specific stuff)
+ - In the mysql-test directory, run this command: ./mysql-test-run -gcov
+ - To see the level of coverage for a given source file:
grep source_file_name /tmp/gcov.out
- - to see which lines are not yet covered, look at source_file_name.gcov in the source tree. Then think hard about a test case that will cover those
-lines, and write one!
+ - To see which lines are not yet covered, look at source_file_name.gcov in
+ the source tree. Then think hard about a test case that will cover those
+ lines, and write one!
diff --git a/mysql-test/include/have_latin2_ch.inc b/mysql-test/include/have_latin2_ch.inc
new file mode 100644
index 00000000000..9d3ee6b341c
--- /dev/null
+++ b/mysql-test/include/have_latin2_ch.inc
@@ -0,0 +1,4 @@
+-- require r/have_latin2_ch.require
+disable_query_log;
+show collation like "latin2_czech_cs";
+enable_query_log;
diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl
index 158fd602ef8..3666c1aa01b 100644
--- a/mysql-test/lib/mtr_cases.pl
+++ b/mysql-test/lib/mtr_cases.pl
@@ -85,11 +85,24 @@ sub collect_test_cases ($) {
if ( $::opt_reorder )
{
@$cases = sort {
- if ( $a->{'master_restart'} and $b->{'master_restart'} or
- ! $a->{'master_restart'} and ! $b->{'master_restart'} )
+ if ( ! $a->{'master_restart'} and ! $b->{'master_restart'} )
{
return $a->{'name'} cmp $b->{'name'};
}
+
+ if ( $a->{'master_restart'} and $b->{'master_restart'} )
+ {
+ my $cmp= mtr_cmp_opts($a->{'master_opt'}, $b->{'master_opt'});
+ if ( $cmp == 0 )
+ {
+ return $a->{'name'} cmp $b->{'name'};
+ }
+ else
+ {
+ return $cmp;
+ }
+ }
+
if ( $a->{'master_restart'} )
{
return 1; # Is greater
@@ -189,8 +202,8 @@ sub collect_one_test_case($$$$$$) {
my $slave_sh= "$testdir/$tname-slave.sh";
my $disabled_file= "$testdir/$tname.disabled";
- $tinfo->{'master_opt'}= $::glob_win32 ? ["--default-time-zone=+3:00"] : [];
- $tinfo->{'slave_opt'}= $::glob_win32 ? ["--default-time-zone=+3:00"] : [];
+ $tinfo->{'master_opt'}= [];
+ $tinfo->{'slave_opt'}= [];
$tinfo->{'slave_mi'}= [];
if ( -f $master_opt_file )
@@ -213,7 +226,6 @@ sub collect_one_test_case($$$$$$) {
if ( defined $value )
{
$tinfo->{'timezone'}= $value;
- $tinfo->{'skip'}= 1 if $::glob_win32; # FIXME server unsets TZ
last MASTER_OPT;
}
diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl
index 9a12d842998..26d5b9ed283 100644
--- a/mysql-test/lib/mtr_misc.pl
+++ b/mysql-test/lib/mtr_misc.pl
@@ -13,6 +13,9 @@ sub mtr_add_arg ($$);
sub mtr_path_exists(@);
sub mtr_script_exists(@);
sub mtr_exe_exists(@);
+sub mtr_copy_dir($$);
+sub mtr_same_opts($$);
+sub mtr_cmp_opts($$);
##############################################################################
#
@@ -108,5 +111,44 @@ sub mtr_exe_exists (@) {
}
}
+sub mtr_copy_dir($$) {
+ my $srcdir= shift;
+ my $dstdir= shift;
+
+ # Create destination directory
+ mkpath($dstdir);
+ find(\&mtr_copy_one_file, $dstdir);
+}
+
+sub mtr_copy_one_file {
+ print $File::Find::name, "\n";
+}
+
+sub mtr_same_opts ($$) {
+ my $l1= shift;
+ my $l2= shift;
+ return mtr_cmp_opts($l1,$l2) == 0;
+}
+
+sub mtr_cmp_opts ($$) {
+ my $l1= shift;
+ my $l2= shift;
+
+ my @l1= @$l1;
+ my @l2= @$l2;
+
+ return -1 if @l1 < @l2;
+ return 1 if @l1 > @l2;
+
+ while ( @l1 ) # Same length
+ {
+ my $e1= shift @l1;
+ my $e2= shift @l2;
+ my $cmp= ($e1 cmp $e2);
+ return $cmp if $cmp != 0;
+ }
+
+ return 0; # They are the same
+}
1;
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index 4da608ad345..662b70a4fee 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -454,8 +454,7 @@ sub mtr_kill_leftovers () {
if ( kill(0, @pids) ) # Check if some left
{
- # FIXME maybe just mtr_warning() ?
- mtr_error("can't kill process(es) " . join(" ", @pids));
+ mtr_warning("can't kill process(es) " . join(" ", @pids));
}
}
}
@@ -468,7 +467,7 @@ sub mtr_kill_leftovers () {
{
if ( mtr_ping_mysqld_server($srv->{'port'}, $srv->{'sockfile'}) )
{
- mtr_error("can't kill old mysqld holding port $srv->{'port'}");
+ mtr_warning("can't kill old mysqld holding port $srv->{'port'}");
}
}
}
diff --git a/mysql-test/lib/mtr_timer.pl b/mysql-test/lib/mtr_timer.pl
index 709cebd6407..a85ab8c6122 100644
--- a/mysql-test/lib/mtr_timer.pl
+++ b/mysql-test/lib/mtr_timer.pl
@@ -78,6 +78,12 @@ sub mtr_timer_start($$$) {
{
# Child, redirect output and exec
# FIXME do we need to redirect streams?
+
+ # Don't do the ^C cleanup in the timeout child processes!
+ # There is actually a race here, if we get ^C after fork(), but before
+ # clearing the signal handler.
+ $SIG{INT}= 'DEFAULT';
+
$0= "mtr_timer(timers,$name,$duration)";
sleep($duration);
exit(0);
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index addacab8f9a..20bb6e0117a 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -76,6 +76,7 @@ $Devel::Trace::TRACE= 0; # Don't trace boring init stuff
#require 5.6.1;
use File::Path;
use File::Basename;
+use File::Copy;
use Cwd;
use Getopt::Long;
use Sys::Hostname;
@@ -152,6 +153,7 @@ our $path_language;
our $path_timefile;
our $path_manager_log; # Used by mysqldadmin
our $path_slave_load_tmpdir; # What is this?!
+our $path_mysqltest_log;
our $path_my_basedir;
our $opt_vardir; # A path but set directly on cmd line
our $opt_tmpdir; # A path but set directly on cmd line
@@ -184,6 +186,7 @@ our $opt_big_test= 0; # Send --big-test to mysqltest
our @opt_extra_mysqld_opt;
+our $opt_comment;
our $opt_compress;
our $opt_current_test;
our $opt_ddd;
@@ -238,7 +241,7 @@ our $opt_sleep_time_after_restart= 1;
our $opt_sleep_time_for_delete= 10;
our $opt_testcase_timeout;
our $opt_suite_timeout;
-my $default_testcase_timeout= 10; # 10 min max
+my $default_testcase_timeout= 15; # 15 min max
my $default_suite_timeout= 120; # 2 hours max
our $opt_socket;
@@ -257,6 +260,7 @@ our $opt_user;
our $opt_user_test;
our $opt_valgrind;
+our $opt_valgrind_mysqld;
our $opt_valgrind_mysqltest;
our $opt_valgrind_all;
our $opt_valgrind_options;
@@ -273,6 +277,8 @@ our $opt_udiff;
our $opt_skip_ndbcluster;
our $opt_with_ndbcluster;
+our $opt_with_ndbcluster_only= 0; # dummy, ignored
+
our $opt_with_openssl;
our $exe_ndb_mgm;
@@ -428,9 +434,9 @@ sub initial_setup () {
if ( $glob_cygwin_perl )
{
# Windows programs like 'mysqld' needs Windows paths
- $glob_mysql_test_dir= `cygpath -m $glob_mysql_test_dir`;
+ $glob_mysql_test_dir= `cygpath -m "$glob_mysql_test_dir"`;
my $shell= $ENV{'SHELL'} || "/bin/bash";
- $glob_cygwin_shell= `cygpath -w $shell`; # The Windows path c:\...
+ $glob_cygwin_shell= `cygpath -w "$shell"`; # The Windows path c:\...
chomp($glob_mysql_test_dir);
chomp($glob_cygwin_shell);
}
@@ -473,13 +479,25 @@ sub command_line_setup () {
# 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.
#
+ # Also note the limiteation of ports we are allowed to hand out. This
+ # differs between operating systems and configuration, see
+ # http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html
+ # But a fairly safe range seems to be 5001 - 32767
if ( $ENV{'MTR_BUILD_THREAD'} )
{
- $opt_master_myport= $ENV{'MTR_BUILD_THREAD'} * 10 + 10000;
- $opt_slave_myport= $opt_master_myport + 2; # and 3 4
+ # Up to two masters, up to three slaves
+ $opt_master_myport= $ENV{'MTR_BUILD_THREAD'} * 10 + 10000; # and 1
+ $opt_slave_myport= $opt_master_myport + 2; # and 3 4
$opt_ndbcluster_port= $opt_master_myport + 5;
}
+ if ( $opt_master_myport < 5001 or $opt_master_myport + 10 >= 32767 )
+ {
+ mtr_error("MTR_BUILD_THREAD number results in a port",
+ "outside 5001 - 32767",
+ "($opt_master_myport - $opt_master_myport + 10)");
+ }
+
# Read the command line
# Note: Keep list, and the order, in sync with usage at end of this file
@@ -496,6 +514,7 @@ sub command_line_setup () {
'force' => \$opt_force,
'with-ndbcluster' => \$opt_with_ndbcluster,
'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster,
+ 'with-ndbcluster-only' => \$opt_with_ndbcluster_only,
'do-test=s' => \$opt_do_test,
'suite=s' => \$opt_suite,
'skip-rpl' => \$opt_skip_rpl,
@@ -536,6 +555,7 @@ sub command_line_setup () {
# Misc
'big-test' => \$opt_big_test,
+ 'comment=s' => \$opt_comment,
'compress' => \$opt_compress,
'debug' => \$opt_debug,
'fast' => \$opt_fast,
@@ -571,6 +591,19 @@ sub command_line_setup () {
usage("");
}
+ if ( $opt_comment )
+ {
+ print "\n";
+ print '#' x 78, "\n";
+ print "# $opt_comment\n";
+ print '#' x 78, "\n\n";
+ }
+
+ if ( $opt_with_ndbcluster_only )
+ {
+ print "# Option '--with-ndbcluster-only' is ignored in this release.\n";
+ }
+
foreach my $arg ( @ARGV )
{
if ( $arg =~ /^--skip-/ )
@@ -609,6 +642,7 @@ sub command_line_setup () {
# --------------------------------------------------------------------------
$opt_tmpdir= "$opt_vardir/tmp" unless $opt_tmpdir;
+ $opt_tmpdir =~ s,/+$,,; # Remove ending slash if any
# FIXME maybe not needed?
$path_manager_log= "$opt_vardir/log/manager.log"
unless $path_manager_log;
@@ -725,6 +759,7 @@ sub command_line_setup () {
# "somestring" option is name/path of valgrind executable
# Take executable path from any of them, if any
+ $opt_valgrind_mysqld= $opt_valgrind;
$opt_valgrind= $opt_valgrind_mysqltest if $opt_valgrind_mysqltest;
$opt_valgrind= $opt_valgrind_all if $opt_valgrind_all;
@@ -834,6 +869,7 @@ sub command_line_setup () {
}
$path_timefile= "$opt_vardir/log/mysqltest-time";
+ $path_mysqltest_log= "$opt_vardir/log/mysqltest.log";
}
@@ -853,7 +889,8 @@ sub executable_setup () {
"$glob_basedir/bin");
$exe_mysqld= mtr_exe_exists ("$path_client_bindir/mysqld-nt",
"$path_client_bindir/mysqld",
- "$path_client_bindir/mysqld-debug",);
+ "$path_client_bindir/mysqld-debug",
+ "$path_client_bindir/mysqld-max");
$path_language= mtr_path_exists("$glob_basedir/share/english/");
$path_charsetsdir= mtr_path_exists("$glob_basedir/share/charsets");
}
@@ -875,7 +912,19 @@ sub executable_setup () {
}
else
{
- $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
+ if ( $opt_valgrind_mysqltest )
+ {
+ # client/mysqltest might be a libtool .sh script, so look for real exe
+ # to avoid valgrinding bash ;)
+ $exe_mysqltest=
+ mtr_exe_exists("$path_client_bindir/.libs/lt-mysqltest",
+ "$path_client_bindir/.libs/mysqltest",
+ "$path_client_bindir/mysqltest");
+ }
+ else
+ {
+ $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
+ }
$exe_mysql_client_test=
mtr_exe_exists("$glob_basedir/tests/mysql_client_test",
"/usr/bin/false");
@@ -985,6 +1034,7 @@ sub environment_setup () {
$ENV{'USE_RUNNING_SERVER'}= $glob_use_running_server;
$ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir;
$ENV{'MYSQL_TEST_WINDIR'}= $glob_mysql_test_dir;
+ $ENV{'MYSQLTEST_VARDIR'}= $opt_vardir;
$ENV{'MASTER_WINMYSOCK'}= $master->[0]->{'path_mysock'};
$ENV{'MASTER_MYSOCK'}= $master->[0]->{'path_mysock'};
$ENV{'MASTER_MYSOCK1'}= $master->[1]->{'path_mysock'};
@@ -996,6 +1046,8 @@ sub environment_setup () {
# $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME
$ENV{'MYSQL_TCP_PORT'}= 3306;
+ $ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port;
+
if ( $glob_cygwin_perl )
{
foreach my $key ('MYSQL_TEST_WINDIR','MASTER_MYSOCK')
@@ -1015,7 +1067,7 @@ sub environment_setup () {
print "Using SLAVE_MYPORT = $ENV{SLAVE_MYPORT}\n";
print "Using SLAVE_MYPORT1 = $ENV{SLAVE_MYPORT1}\n";
print "Using SLAVE_MYPORT2 = $ENV{SLAVE_MYPORT2}\n";
- print "Using NDBCLUSTER_PORT = $opt_ndbcluster_port\n";
+ print "Using NDBCLUSTER_PORT = $ENV{NDBCLUSTER_PORT}\n";
}
@@ -1077,10 +1129,40 @@ sub kill_and_cleanup () {
mtr_report("Removing Stale Files");
- rmtree("$opt_vardir/log");
- rmtree("$opt_vardir/ndbcluster-$opt_ndbcluster_port");
- rmtree("$opt_vardir/run");
- rmtree("$opt_vardir/tmp");
+ if ( $opt_vardir eq "$glob_mysql_test_dir/var" )
+ {
+ #
+ # Running with "var" in mysql-test dir
+ #
+ if ( -l "$glob_mysql_test_dir/var" )
+ {
+ # Some users creates a soft link in mysql-test/var to another area
+ # - allow it
+ mtr_report("WARNING: Using the 'mysql-test/var' symlink");
+ rmtree("$opt_vardir/log");
+ rmtree("$opt_vardir/ndbcluster-$opt_ndbcluster_port");
+ rmtree("$opt_vardir/run");
+ rmtree("$opt_vardir/tmp");
+ }
+ else
+ {
+ # Remove the entire "var" dir
+ rmtree("$opt_vardir/");
+ }
+ }
+ else
+ {
+ #
+ # Running with "var" in some other place
+ #
+
+ # Remove the var/ dir in mysql-test dir if any
+ # this could be an old symlink that shouldn't be there
+ rmtree("$glob_mysql_test_dir/var");
+
+ # Remove the "var" dir
+ rmtree("$opt_vardir/");
+ }
mkpath("$opt_vardir/log");
mkpath("$opt_vardir/run");
@@ -1104,14 +1186,22 @@ sub kill_and_cleanup () {
mkpath("$data_dir/test");
}
- # To make some old test cases work, we create a soft
- # link from the old "var" location to the new one
-
- if ( ! $glob_win32 and $opt_vardir ne "$glob_mysql_test_dir/var" )
+ # Make a link std_data_ln in var/ that points to std_data
+ if ( ! $glob_win32 )
{
- # FIXME why bother with the above, why not always remove all of var?!
- rmtree("$glob_mysql_test_dir/var"); # Clean old var, FIXME or rename it?!
- symlink($opt_vardir, "$glob_mysql_test_dir/var");
+ symlink("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data_ln");
+ }
+ else
+ {
+ # on windows, copy all files from std_data into var/std_data_ln
+ mkpath("$opt_vardir/std_data_ln");
+ opendir(DIR, "$glob_mysql_test_dir/std_data")
+ or mtr_error("Can't find the std_data directory: $!");
+ for my $elem ( readdir(DIR) ) {
+ next if -d "$glob_mysql_test_dir/std_data/$elem";
+ copy("$glob_mysql_test_dir/std_data/$elem", "$opt_vardir/std_data_ln/$elem");
+ }
+ closedir(DIR);
}
}
@@ -1470,11 +1560,33 @@ sub run_testcase ($) {
if ( ! $glob_use_running_server and ! $glob_use_embedded_server )
{
- if ( $tinfo->{'master_restart'} or
- $master->[0]->{'running_master_is_special'} )
+ # We try to find out if we are to restart the server
+ my $do_restart= 0; # Assumes we don't have to
+
+ if ( $tinfo->{'master_sh'} )
+ {
+ $do_restart= 1; # Always restart if script to run
+ }
+ elsif ( $master->[0]->{'running_master_is_special'} and
+ $master->[0]->{'running_master_is_special'}->{'timezone'} eq
+ $tinfo->{'timezone'} and
+ mtr_same_opts($master->[0]->{'running_master_is_special'}->{'master_opt'},
+ $tinfo->{'master_opt'}) )
+ {
+ # If running master was started with special settings, but
+ # the current test requuires the same ones, we *don't* restart.
+ $do_restart= 0;
+ }
+ elsif ( $tinfo->{'master_restart'} or
+ $master->[0]->{'running_master_is_special'} )
+ {
+ $do_restart= 1;
+ }
+
+ if ( $do_restart )
{
stop_masters();
- $master->[0]->{'running_master_is_special'}= 0; # Forget why we stopped
+ delete $master->[0]->{'running_master_is_special'}; # Forget history
}
# ----------------------------------------------------------------------
@@ -1543,6 +1655,7 @@ sub run_testcase ($) {
}
if ( $opt_with_ndbcluster and ! $master->[1]->{'pid'} )
{
+ # Test needs cluster, start an extra mysqld connected to cluster
$master->[1]->{'pid'}=
mysqld_start('master',1,$tinfo->{'master_opt'},[]);
if ( ! $master->[1]->{'pid'} )
@@ -1554,7 +1667,8 @@ sub run_testcase ($) {
if ( $tinfo->{'master_restart'} )
{
- $master->[0]->{'running_master_is_special'}= 1;
+ # Save this test case information, so next can examine it
+ $master->[0]->{'running_master_is_special'}= $tinfo;
}
}
@@ -1787,7 +1901,7 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--language=%s", $prefix, $path_language);
mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
- if ( defined $opt_valgrind )
+ if ( defined $opt_valgrind_mysqld )
{
mtr_add_arg($args, "%s--skip-safemalloc", $prefix);
mtr_add_arg($args, "%s--skip-bdb", $prefix);
@@ -1854,6 +1968,10 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--skip-innodb", $prefix);
mtr_add_arg($args, "%s--skip-ndbcluster", $prefix);
mtr_add_arg($args, "%s--skip-slave-start", $prefix);
+
+ # Directory where slaves find the dumps generated by "load data"
+ # on the server. The path need to have constant length otherwise
+ # test results will vary, thus a relative path is used.
mtr_add_arg($args, "%s--slave-load-tmpdir=%s", $prefix,
$path_slave_load_tmpdir);
mtr_add_arg($args, "%s--socket=%s", $prefix,
@@ -2012,7 +2130,7 @@ sub mysqld_start ($$$$) {
mtr_init_args(\$args);
- if ( defined $opt_valgrind )
+ if ( defined $opt_valgrind_mysqld )
{
valgrind_arguments($args, \$exe);
}
@@ -2198,11 +2316,6 @@ sub run_mysqltest ($) {
mtr_init_args(\$args);
- if ( defined $opt_valgrind_mysqltest )
- {
- valgrind_arguments($args, \$exe);
- }
-
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_mysock'});
mtr_add_arg($args, "--database=test");
@@ -2280,6 +2393,17 @@ sub run_mysqltest ($) {
# Add arguments that should not go into the MYSQL_TEST env var
# ----------------------------------------------------------------------
+ if ( defined $opt_valgrind_mysqltest )
+ {
+ # Prefix the Valgrind options to the argument list.
+ # We do this here, since we do not want to Valgrind the nested invocations
+ # of mysqltest; that would mess up the stderr output causing test failure.
+ my @args_saved = @$args;
+ mtr_init_args(\$args);
+ valgrind_arguments($args, \$exe);
+ mtr_add_arg($args, "%s", $_) for @args_saved;
+ }
+
mtr_add_arg($args, "-R");
mtr_add_arg($args, $tinfo->{'result_file'});
@@ -2398,6 +2522,7 @@ Misc options
verbose Verbose output from this script
script-debug Debug this script itself
+ comment=STR Write STR to the output
compress Use the compressed protocol between client and server
timer Show test case execution time
start-and-exit Only initiate and start the "mysqld" servers, use the startup
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 9fcdacb22cb..c8d54d7e86c 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -243,6 +243,7 @@ EXTRA_MYSQLDUMP_OPT=""
EXTRA_MYSQLBINLOG_OPT=""
USE_RUNNING_SERVER=""
USE_NDBCLUSTER=@USE_NDBCLUSTER@
+USE_NDBCLUSTER_ONLY=0
USE_RUNNING_NDBCLUSTER=""
USE_PURIFY=""
PURIFY_LOGS=""
@@ -270,6 +271,8 @@ NDB_MGM_EXTRA_OPTS=
NDB_MGMD_EXTRA_OPTS=
NDBD_EXTRA_OPTS=
+$ECHO "Logging: $0 $*" # To ensure we see all arguments in the output, for the test analysis tool
+
while test $# -gt 0; do
case "$1" in
--embedded-server)
@@ -295,6 +298,10 @@ while test $# -gt 0; do
--extern) USE_RUNNING_SERVER="1" ;;
--with-ndbcluster)
USE_NDBCLUSTER="--ndbcluster" ;;
+ --with-ndbcluster-only)
+ USE_NDBCLUSTER="--ndbcluster"
+ USE_NDBCLUSTER_SLAVE="--ndbcluster"
+ USE_NDBCLUSTER_ONLY=1 ;;
--ndb-connectstring=*)
USE_NDBCLUSTER="--ndbcluster" ;
USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndb-connectstring=;;"` ;;
@@ -476,6 +483,13 @@ while test $# -gt 0; do
--fast)
FAST_START=1
;;
+ --comment=*)
+ TMP=`$ECHO "$1" | $SED -e "s;--comment=;;"`
+ echo
+ echo '############################################'
+ echo "# $TMP"
+ echo '############################################'
+ ;;
-- ) shift; break ;;
--* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
* ) break ;;
@@ -789,7 +803,7 @@ show_failed_diff ()
$DIFF -c $result_file $reject_file
echo "-------------------------------------------------------"
echo "Please follow the instructions outlined at"
- echo "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html"
+ echo "http://dev.mysql.com/doc/mysql/en/reporting-mysqltest-bugs.html"
echo "to find the reason to this problem and how to report this."
echo ""
fi
@@ -884,7 +898,7 @@ report_stats () {
$ECHO "The log files in $MY_LOG_DIR may give you some hint"
$ECHO "of what when wrong."
$ECHO "If you want to report this error, please read first the documentation at"
- $ECHO "http://www.mysql.com/doc/en/MySQL_test_suite.html"
+ $ECHO "http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html"
fi
if test -z "$USE_RUNNING_SERVER"
@@ -1517,6 +1531,11 @@ run_testcase ()
disable_test $tname "$comment"
return
fi
+ NDBCLUSTER_TEST=`$EXPR \( $tname : '.*ndb.*' \) != 0`
+ if [ "x$USE_NDBCLUSTER_ONLY" = "x1" -a "x$NDBCLUSTER_TEST" != "x1" ] ; then
+ skip_test $tname
+ return
+ fi
if [ "$USE_MANAGER" = 1 ] ; then
many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)`
fi
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index 69a4cb24276..68687670e17 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -267,3 +267,11 @@ Warning 1105 Cast to signed converted positive out-of-range integer to it's nega
select cast(1.0e+300 as signed int);
cast(1.0e+300 as signed int)
9223372036854775807
+CREATE TABLE t1 (f1 double);
+INSERT INTO t1 SET f1 = -1.0e+30 ;
+INSERT INTO t1 SET f1 = +1.0e+30 ;
+SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1;
+double_val cast_val
+-1e+30 -9223372036854775808
+1e+30 9223372036854775807
+DROP TABLE t1;
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 6fe148adce5..aa25c55f394 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -699,3 +699,5 @@ t2 CREATE TABLE `t2` (
`a2` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
+create table t1(a set("a,b","c,d") not null);
+ERROR HY000: Illegal set 'a,b' value found during parsing
diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result
index 4c5832a57e9..6574908101c 100644
--- a/mysql-test/r/ctype_big5.result
+++ b/mysql-test/r/ctype_big5.result
@@ -189,3 +189,6 @@ select hex(a) from t1 where a = _big5 0xF9DC;
hex(a)
E5ABBA
drop table t1;
+select hex(convert(_big5 0xC84041 using ucs2));
+hex(convert(_big5 0xC84041 using ucs2))
+003F0041
diff --git a/mysql-test/r/ctype_gbk.result b/mysql-test/r/ctype_gbk.result
index aaffe692126..241539ecf42 100644
--- a/mysql-test/r/ctype_gbk.result
+++ b/mysql-test/r/ctype_gbk.result
@@ -165,3 +165,6 @@ hex(a)
A1A1
A3A0
DROP TABLE t1;
+select hex(convert(_gbk 0xA14041 using ucs2));
+hex(convert(_gbk 0xA14041 using ucs2))
+003F0041
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
index cf4bf6e2fdd..f8e07e1eb6f 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -369,3 +369,25 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT '„a' as str;
str
„a
+set @str= _latin1 'ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈ̀̉Ù @ abc';
+SELECT convert(@str collate latin1_bin using utf8);
+convert(@str collate latin1_bin using utf8)
+ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈ̀̉Ù @ abc
+SELECT convert(@str collate latin1_general_ci using utf8);
+convert(@str collate latin1_general_ci using utf8)
+ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈ̀̉Ù @ abc
+SELECT convert(@str collate latin1_german1_ci using utf8);
+convert(@str collate latin1_german1_ci using utf8)
+ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈ̀̉Ù @ abc
+SELECT convert(@str collate latin1_danish_ci using utf8);
+convert(@str collate latin1_danish_ci using utf8)
+ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈ̀̉Ù @ abc
+SELECT convert(@str collate latin1_spanish_ci using utf8);
+convert(@str collate latin1_spanish_ci using utf8)
+ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈ̀̉Ù @ abc
+SELECT convert(@str collate latin1_german2_ci using utf8);
+convert(@str collate latin1_german2_ci using utf8)
+ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈ̀̉Ù @ abc
+SELECT convert(@str collate latin1_swedish_ci using utf8);
+convert(@str collate latin1_swedish_ci using utf8)
+ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈ̀̉Ù @ abc
diff --git a/mysql-test/r/ctype_latin2_ch.result b/mysql-test/r/ctype_latin2_ch.result
new file mode 100644
index 00000000000..2b3765c07c4
--- /dev/null
+++ b/mysql-test/r/ctype_latin2_ch.result
@@ -0,0 +1,30 @@
+drop table if exists t1;
+set names latin2;
+select 'A' = 'a' collate latin2_czech_cs;
+'A' = 'a' collate latin2_czech_cs
+0
+create table t1 (
+id int(5) not null,
+tt char(255) not null
+) character set latin2 collate latin2_czech_cs;
+insert into t1 values (1,'Aa');
+insert into t1 values (2,'Aas');
+alter table t1 add primary key aaa(tt);
+select * from t1 where tt like 'Aa%';
+id tt
+1 Aa
+2 Aas
+select * from t1 ignore index (primary) where tt like 'Aa%';
+id tt
+1 Aa
+2 Aas
+select * from t1 where tt like '%Aa%';
+id tt
+1 Aa
+2 Aas
+select * from t1 where tt like 'AA%';
+id tt
+select * from t1 ignore index (primary) where tt like 'AA%';
+id tt
+select * from t1 where tt like '%AA%';
+id tt
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 0e12ec88662..8869604b128 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -666,6 +666,18 @@ Warnings:
Warning 1265 Data truncated for column 'Field1' at row 1
DROP TABLE t1;
SET NAMES latin1;
+SELECT CONVERT(103, CHAR(50) UNICODE);
+CONVERT(103, CHAR(50) UNICODE)
+103
+SELECT CONVERT(103.0, CHAR(50) UNICODE);
+CONVERT(103.0, CHAR(50) UNICODE)
+103.0
+SELECT CONVERT(-103, CHAR(50) UNICODE);
+CONVERT(-103, CHAR(50) UNICODE)
+-103
+SELECT CONVERT(-103.0, CHAR(50) UNICODE);
+CONVERT(-103.0, CHAR(50) UNICODE)
+-103.0
CREATE TABLE t1 (
a varchar(255) NOT NULL default '',
KEY a (a)
diff --git a/mysql-test/r/ctype_ucs2_def.result b/mysql-test/r/ctype_ucs2_def.result
new file mode 100644
index 00000000000..897dbac251c
--- /dev/null
+++ b/mysql-test/r/ctype_ucs2_def.result
@@ -0,0 +1,6 @@
+show variables like "%character_set_ser%";
+Variable_name Value
+character_set_server ucs2
+DROP TABLE IF EXISTS t1;
+create table t1 (a int);
+drop table t1;
diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result
index c86cbe9ce53..77258ba1730 100644
--- a/mysql-test/r/ctype_ujis.result
+++ b/mysql-test/r/ctype_ujis.result
@@ -2307,3 +2307,9 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+select hex(convert(_ujis 0xA5FE41 using ucs2));
+hex(convert(_ujis 0xA5FE41 using ucs2))
+003F0041
+select hex(convert(_ujis 0x8FABF841 using ucs2));
+hex(convert(_ujis 0x8FABF841 using ucs2))
+003F0041
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index cf9426e6b21..69d7577ee77 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -1078,3 +1078,49 @@ LENGTH(bug)
100
DROP TABLE t2;
DROP TABLE t1;
+SET NAMES utf8;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1(a VARCHAR(255), KEY(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̀ˆbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
+INSERT INTO t1 VALUES('uu');
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 VALUES('uU');
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 VALUES('uu');
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 VALUES('uuABC');
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 VALUES('UuABC');
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 VALUES('uuABC');
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+alter table t1 add b int;
+INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̀ˆbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1);
+INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̀ˆbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',2);
+delete from t1 where b=1;
+INSERT INTO t1 VALUES('UUABCDEFGHIGKLMNOPRSTUVWXYZ̀ˆbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1);
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̀ˆbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3);
+INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̀ˆbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',4);
+delete from t1 where b=3;
+INSERT INTO t1 VALUES('uUABCDEFGHIGKLMNOPRSTUVWXYZ̀ˆbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3);
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result
index 9bc8e417e19..8d6fa9927ce 100644
--- a/mysql-test/r/func_compress.result
+++ b/mysql-test/r/func_compress.result
@@ -72,3 +72,10 @@ set @@max_allowed_packet=1048576*100;
select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null;
compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null
0
+create table t1(a blob);
+insert into t1 values(NULL), (compress('a'));
+select uncompress(a), uncompressed_length(a) from t1;
+uncompress(a) uncompressed_length(a)
+NULL NULL
+a 1
+drop table t1;
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index 200b4a4d53b..2c79b8f8ab1 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -589,3 +589,28 @@ GROUP_CONCAT(a ORDER BY a)
,x
,z
DROP TABLE t1;
+create table t1(f1 int);
+insert into t1 values(1),(2),(3);
+select f1, group_concat(f1+1) from t1 group by f1 with rollup;
+f1 group_concat(f1+1)
+1 2
+2 3
+3 4
+NULL 2,3,4
+select count(distinct (f1+1)) from t1 group by f1 with rollup;
+count(distinct (f1+1))
+1
+1
+1
+3
+drop table t1;
+create table t1 (f1 int unsigned, f2 varchar(255));
+insert into t1 values (1,repeat('a',255)),(2,repeat('b',255));
+select f2,group_concat(f1) from t1 group by f2;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 t1 f2 f2 253 255 255 Y 0 0 8
+def group_concat(f1) 252 400 1 Y 128 0 63
+f2 group_concat(f1)
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 1
+bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 2
+drop table t1;
diff --git a/mysql-test/r/func_op.result b/mysql-test/r/func_op.result
index 6cd975b0911..9870af2c6f9 100644
--- a/mysql-test/r/func_op.result
+++ b/mysql-test/r/func_op.result
@@ -35,3 +35,14 @@ select -1 >> 0, -1 << 0;
select -1 >> 1, -1 << 1;
-1 >> 1 -1 << 1
9223372036854775807 18446744073709551614
+drop table if exists t1,t2;
+create table t1(a int);
+create table t2(a int, b int);
+insert into t1 values (1), (2), (3);
+insert into t2 values (1, 7), (3, 7);
+select t1.a, t2.a, t2.b, bit_count(t2.b) from t1 left join t2 on t1.a=t2.a;
+a a b bit_count(t2.b)
+1 1 7 3
+2 NULL NULL NULL
+3 3 7 3
+drop table t1, t2;
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 13593ec2a88..dffa4988ea7 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -473,3 +473,21 @@ GRANT USAGE ON *.* TO 'mysqltest_7'@'' IDENTIFIED BY PASSWORD '*2FB071A056F9BB74
drop user mysqltest_7@;
show grants for mysqltest_7@;
ERROR 42000: There is no such grant defined for user 'mysqltest_7' on host ''
+create database mysqltest;
+use mysqltest;
+create table t1(f1 int);
+GRANT DELETE ON mysqltest.t1 TO mysqltest1@'%';
+GRANT SELECT ON mysqltest.t1 TO mysqltest1@'192.%';
+show grants for mysqltest1@'192.%';
+Grants for mysqltest1@192.%
+GRANT USAGE ON *.* TO 'mysqltest1'@'192.%'
+GRANT SELECT ON `mysqltest`.`t1` TO 'mysqltest1'@'192.%'
+show grants for mysqltest1@'%';
+Grants for mysqltest1@%
+GRANT USAGE ON *.* TO 'mysqltest1'@'%'
+GRANT DELETE ON `mysqltest`.`t1` TO 'mysqltest1'@'%'
+delete from mysql.user where user='mysqltest1';
+delete from mysql.db where user='mysqltest1';
+delete from mysql.tables_priv where user='mysqltest1';
+flush privileges;
+drop database mysqltest;
diff --git a/mysql-test/r/have_latin2_ch.require b/mysql-test/r/have_latin2_ch.require
new file mode 100644
index 00000000000..352401bbfe8
--- /dev/null
+++ b/mysql-test/r/have_latin2_ch.require
@@ -0,0 +1,2 @@
+Collation Charset Id Default Compiled Sortlen
+latin2_czech_cs latin2 2 Yes 4
diff --git a/mysql-test/r/key_cache.result b/mysql-test/r/key_cache.result
index 41aaa21eea3..15dc244693d 100644
--- a/mysql-test/r/key_cache.result
+++ b/mysql-test/r/key_cache.result
@@ -287,3 +287,45 @@ check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
+CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY);
+SET GLOBAL key_cache_block_size=1536;
+INSERT INTO t1 VALUES (1);
+SELECT @@key_cache_block_size;
+@@key_cache_block_size
+1536
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
+CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int);
+CREATE TABLE t2(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int);
+SET GLOBAL key_cache_block_size=1536;
+INSERT INTO t1 VALUES (1,0);
+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;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4181
+SELECT @@key_cache_block_size;
+@@key_cache_block_size
+1536
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result
index 239f9d24e9e..eff59b102de 100644
--- a/mysql-test/r/kill.result
+++ b/mysql-test/r/kill.result
@@ -17,6 +17,8 @@ select 4;
4
4
drop table t1;
+kill (select count(*) from mysql.user);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select count(*) from mysql.user)' at line 1
create table t1 (id int primary key);
create table t2 (id int unsigned not null);
insert into t2 select id from t1;
diff --git a/mysql-test/r/lock.result b/mysql-test/r/lock.result
index 54162a36d83..2fe03b9fc14 100644
--- a/mysql-test/r/lock.result
+++ b/mysql-test/r/lock.result
@@ -47,6 +47,17 @@ unlock tables;
lock tables t1 write, t1 as t1_alias read;
insert into t1 select index1,nr from t1 as t1_alias;
drop table t1,t2;
+create table t1 (c1 int);
+create table t2 (c1 int);
+create table t3 (c1 int);
+lock tables t1 write, t2 write, t3 write;
+drop table t2, t3, t1;
+create table t1 (c1 int);
+create table t2 (c1 int);
+create table t3 (c1 int);
+lock tables t1 write, t2 write, t3 write, t1 as t4 read;
+alter table t2 add column c2 int;
+drop table t1, t2, t3;
create table t1 ( a int(11) not null auto_increment, primary key(a));
create table t2 ( a int(11) not null auto_increment, primary key(a));
lock tables t1 write, t2 read;
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index c269cbadca3..3b4519e5444 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -730,3 +730,21 @@ select * from t1 where bob is null and cip=1;
cip time score bob
1 00:01:00 0 NULL
drop table t1;
+create table t1 (
+id1 int not null auto_increment,
+id2 int not null default '0',
+t text not null,
+primary key (id1),
+key x (id2, t(32))
+) engine=myisam;
+insert into t1 (id2, t) values
+(10, 'abc'), (10, 'abc'), (10, 'abc'),
+(20, 'abc'), (20, 'abc'), (20, 'def'),
+(10, 'abc'), (10, 'abc');
+select count(*) from t1 where id2 = 10;
+count(*)
+5
+select count(id1) from t1 where id2 = 10;
+count(id1)
+5
+drop table t1;
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index 0e3d3812781..990f04e5ba9 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -280,7 +280,9 @@ here is the sourced script
In loop
here is the sourced script
mysqltest: At line 1: Missing argument to sleep
+mysqltest: At line 1: Missing argument to real_sleep
mysqltest: At line 1: Invalid argument to sleep "abc"
+mysqltest: At line 1: Invalid argument to real_sleep "abc"
1
2
101
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index ee8ca5f0328..8126e223f55 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -788,3 +788,35 @@ a
2
2
DROP TABLE t1;
+CREATE TABLE t1 (a int, b int);
+INSERT INTO t1 VALUES (1,30), (2,20), (1,10), (2,30), (1,20), (2,10);
+(SELECT b,a FROM t1 ORDER BY a,b) ORDER BY b,a;
+b a
+10 1
+10 2
+20 1
+20 2
+30 1
+30 2
+(SELECT b FROM t1 ORDER BY b DESC) ORDER BY b ASC;
+b
+10
+10
+20
+20
+30
+30
+(SELECT b,a FROM t1 ORDER BY b,a) ORDER BY a,b;
+b a
+10 1
+20 1
+30 1
+10 2
+20 2
+30 2
+(SELECT b,a FROM t1 ORDER by b,a LIMIT 3) ORDER by a,b;
+b a
+10 1
+20 1
+10 2
+DROP TABLE t1;
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index ba9336c20bb..2be5366b180 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -107,6 +107,9 @@ set @fvar= 123.4567;
prepare stmt1 from @fvar;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '123.4567' at line 1
drop table t1,t2;
+deallocate prepare stmt3;
+deallocate prepare stmt4;
+deallocate prepare stmt5;
PREPARE stmt1 FROM "select _utf8 'A' collate utf8_bin = ?";
set @var='A';
EXECUTE stmt1 USING @var;
@@ -252,6 +255,7 @@ set names latin1;
execute `ü`;
1234
1234
+deallocate prepare `ü`;
set names default;
create table t1 (a varchar(10)) charset=utf8;
insert into t1 (a) values ('yahoo');
@@ -733,3 +737,141 @@ count(*)
5
deallocate prepare stmt;
drop table t1;
+prepare stmt from 'create table t1 (a varchar(10) character set utf8)';
+execute stmt;
+insert into t1 (a) values (repeat('a', 20));
+select length(a) from t1;
+length(a)
+10
+drop table t1;
+execute stmt;
+insert into t1 (a) values (repeat('a', 20));
+select length(a) from t1;
+length(a)
+10
+drop table t1;
+deallocate prepare stmt;
+create table t1 (col1 integer, col2 integer);
+insert into t1 values(100,100),(101,101),(102,102),(103,103);
+prepare stmt from 'select col1, col2 from t1 where (col1, col2) in ((?,?))';
+set @a=100, @b=100;
+execute stmt using @a,@b;
+col1 col2
+100 100
+set @a=101, @b=101;
+execute stmt using @a,@b;
+col1 col2
+101 101
+set @a=102, @b=102;
+execute stmt using @a,@b;
+col1 col2
+102 102
+set @a=102, @b=103;
+execute stmt using @a,@b;
+col1 col2
+deallocate prepare stmt;
+drop table t1;
+set @old_max_prepared_stmt_count= @@max_prepared_stmt_count;
+show variables like 'max_prepared_stmt_count';
+Variable_name Value
+max_prepared_stmt_count 16382
+show variables like 'prepared_stmt_count';
+Variable_name Value
+prepared_stmt_count 0
+select @@max_prepared_stmt_count, @@prepared_stmt_count;
+@@max_prepared_stmt_count @@prepared_stmt_count
+16382 0
+set global max_prepared_stmt_count=-1;
+select @@max_prepared_stmt_count;
+@@max_prepared_stmt_count
+0
+set global max_prepared_stmt_count=10000000000000000;
+select @@max_prepared_stmt_count;
+@@max_prepared_stmt_count
+1048576
+set global max_prepared_stmt_count=default;
+select @@max_prepared_stmt_count;
+@@max_prepared_stmt_count
+16382
+set @@max_prepared_stmt_count=1;
+ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
+set max_prepared_stmt_count=1;
+ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
+set local max_prepared_stmt_count=1;
+ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
+set local prepared_stmt_count=0;
+ERROR HY000: Variable 'prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
+set @@prepared_stmt_count=0;
+ERROR HY000: Variable 'prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
+set global prepared_stmt_count=1;
+ERROR 42000: Incorrect argument type to variable 'prepared_stmt_count'
+set global max_prepared_stmt_count=1;
+select @@max_prepared_stmt_count;
+@@max_prepared_stmt_count
+1
+set global max_prepared_stmt_count=0;
+select @@max_prepared_stmt_count, @@prepared_stmt_count;
+@@max_prepared_stmt_count @@prepared_stmt_count
+0 0
+prepare stmt from "select 1";
+ERROR HY000: Unknown error
+select @@prepared_stmt_count;
+@@prepared_stmt_count
+0
+set global max_prepared_stmt_count=1;
+prepare stmt from "select 1";
+select @@prepared_stmt_count;
+@@prepared_stmt_count
+1
+prepare stmt1 from "select 1";
+ERROR HY000: Unknown error
+select @@prepared_stmt_count;
+@@prepared_stmt_count
+1
+deallocate prepare stmt;
+select @@prepared_stmt_count;
+@@prepared_stmt_count
+0
+prepare stmt from "select 1";
+select @@prepared_stmt_count;
+@@prepared_stmt_count
+1
+prepare stmt from "select 2";
+select @@prepared_stmt_count;
+@@prepared_stmt_count
+1
+select @@prepared_stmt_count, @@max_prepared_stmt_count;
+@@prepared_stmt_count @@max_prepared_stmt_count
+1 1
+set global max_prepared_stmt_count=0;
+prepare stmt from "select 1";
+ERROR HY000: Unknown error
+execute stmt;
+ERROR HY000: Unknown prepared statement handler (stmt) given to EXECUTE
+select @@prepared_stmt_count;
+@@prepared_stmt_count
+0
+prepare stmt from "select 1";
+ERROR HY000: Unknown error
+select @@prepared_stmt_count;
+@@prepared_stmt_count
+0
+set global max_prepared_stmt_count=3;
+select @@max_prepared_stmt_count, @@prepared_stmt_count;
+@@max_prepared_stmt_count @@prepared_stmt_count
+3 0
+prepare stmt from "select 1";
+prepare stmt from "select 2";
+prepare stmt1 from "select 3";
+prepare stmt2 from "select 4";
+ERROR HY000: Unknown error
+prepare stmt2 from "select 4";
+ERROR HY000: Unknown error
+select @@max_prepared_stmt_count, @@prepared_stmt_count;
+@@max_prepared_stmt_count @@prepared_stmt_count
+3 3
+deallocate prepare stmt;
+select @@max_prepared_stmt_count, @@prepared_stmt_count;
+@@max_prepared_stmt_count @@prepared_stmt_count
+3 0
+set global max_prepared_stmt_count= @old_max_prepared_stmt_count;
diff --git a/mysql-test/r/rpl_deadlock.result b/mysql-test/r/rpl_deadlock.result
index 8eb9d64fcae..db88cf73c03 100644
--- a/mysql-test/r/rpl_deadlock.result
+++ b/mysql-test/r/rpl_deadlock.result
@@ -44,8 +44,39 @@ select * from t2;
a
22
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 13110 # # master-bin.000001 Yes Yes 0 0 13110 # None 0 No #
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 13110
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 13110
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
stop slave;
change master to master_log_pos=401;
begin;
@@ -62,8 +93,39 @@ select * from t2;
a
22
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 13110 # # master-bin.000001 Yes Yes 0 0 13110 # None 0 No #
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 13110
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running #
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 13110
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
set global max_relay_log_size=0;
stop slave;
change master to master_log_pos=401;
@@ -82,6 +144,37 @@ select * from t2;
a
22
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 13110 # # master-bin.000001 Yes Yes 0 0 13110 # None 0 No #
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 13110
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running #
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 13110
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
drop table t1,t2,t3,t4;
diff --git a/mysql-test/r/rpl_relayrotate.result b/mysql-test/r/rpl_relayrotate.result
index bf9bbbb9b93..20f19973d83 100644
--- a/mysql-test/r/rpl_relayrotate.result
+++ b/mysql-test/r/rpl_relayrotate.result
@@ -10,10 +10,7 @@ reset slave;
start slave;
stop slave;
start slave;
-select master_pos_wait('master-bin.001',3000)>=0;
-master_pos_wait('master-bin.001',3000)>=0
-1
-select * from t1 where a=8000;
-a
+select max(a) from t1;
+max(a)
8000
drop table t1;
diff --git a/mysql-test/r/rpl_trunc_temp.result b/mysql-test/r/rpl_trunc_temp.result
new file mode 100644
index 00000000000..44624a38875
--- /dev/null
+++ b/mysql-test/r/rpl_trunc_temp.result
@@ -0,0 +1,22 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create temporary table t1 (n int);
+insert into t1 values(1);
+show status like 'Slave_open_temp_tables';
+Variable_name Value
+Slave_open_temp_tables 1
+delete from t1;
+show status like 'Slave_open_temp_tables';
+Variable_name Value
+Slave_open_temp_tables 1
+truncate t1;
+show status like 'Slave_open_temp_tables';
+Variable_name Value
+Slave_open_temp_tables 1
+show status like 'Slave_open_temp_tables';
+Variable_name Value
+Slave_open_temp_tables 0
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index a9b2345d834..d01ce6249f7 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -1185,6 +1185,16 @@ select concat('value is: ', @val) union select 'some text';
concat('value is: ', @val)
value is: 6
some text
+select concat(_latin1'a', _ascii'b' collate ascii_bin);
+concat(_latin1'a', _ascii'b' collate ascii_bin)
+ab
+create table t1 (foo varchar(100)) collate ascii_bin;
+insert into t1 (foo) values ("foo");
+select foo from t1 union select 'bar' as foo from dual;
+foo
+foo
+bar
+drop table t1;
CREATE TABLE t1 (
a ENUM('ä','ö','ü') character set utf8 not null default 'ü',
b ENUM("one", "two") character set utf8,
@@ -1214,7 +1224,7 @@ Field Type Null Key Default Extra
a char(1)
drop table t2;
create table t2 select a from t1 union select c from t1;
-ERROR HY000: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation 'UNION'
+drop table t2;
create table t2 select a from t1 union select b from t1;
show columns from t2;
Field Type Null Key Default Extra
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test
index ea0a0e4b352..4d73783dd52 100644
--- a/mysql-test/t/cast.test
+++ b/mysql-test/t/cast.test
@@ -152,4 +152,13 @@ select cast(repeat('1',20) as signed);
#
select cast(1.0e+300 as signed int);
+#
+# Bugs: #15098: CAST(column double TO signed int), wrong result
+#
+CREATE TABLE t1 (f1 double);
+INSERT INTO t1 SET f1 = -1.0e+30 ;
+INSERT INTO t1 SET f1 = +1.0e+30 ;
+SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1;
+DROP TABLE t1;
+
# End of 4.1 tests
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 7799200eaa0..57b16a13c01 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -603,4 +603,10 @@ show create table t2;
drop table t1, t2;
+#
+# Bug #15316 SET value having comma not correctly handled
+#
+--error 1105
+create table t1(a set("a,b","c,d") not null);
+
# End of 4.1 tests
diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test
index ffe2a12234e..200002cd235 100644
--- a/mysql-test/t/ctype_big5.test
+++ b/mysql-test/t/ctype_big5.test
@@ -53,4 +53,14 @@ alter table t1 convert to character set utf8;
select hex(a) from t1 where a = _big5 0xF9DC;
drop table t1;
+#
+# Bugs#15375: Unassigned multibyte codes are broken
+# into parts when converting to Unicode.
+# This query should return 0x003F0041. I.e. it should
+# scan unassigned double-byte character 0xC840, convert
+# it as QUESTION MARK 0x003F and then scan the next
+# character, which is a single byte character 0x41.
+#
+select hex(convert(_big5 0xC84041 using ucs2));
+
# End of 4.1 tests
diff --git a/mysql-test/t/ctype_gbk.test b/mysql-test/t/ctype_gbk.test
index 5eeade96186..7aec48586d8 100644
--- a/mysql-test/t/ctype_gbk.test
+++ b/mysql-test/t/ctype_gbk.test
@@ -31,4 +31,14 @@ INSERT INTO t1 VALUES (0xA3A0),(0xA1A1);
SELECT hex(a) FROM t1 ORDER BY a;
DROP TABLE t1;
+#
+# Bugs#15375: Unassigned multibyte codes are broken
+# into parts when converting to Unicode.
+# This query should return 0x003F0041. I.e. it should
+# scan unassigned double-byte character 0xA140, convert
+# it as QUESTION MARK 0x003F and then scan the next
+# character, which is a single byte character 0x41.
+#
+select hex(convert(_gbk 0xA14041 using ucs2));
+
# End of 4.1 tests
diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test
index a005b4769c4..dead9a7a0bc 100644
--- a/mysql-test/t/ctype_latin1.test
+++ b/mysql-test/t/ctype_latin1.test
@@ -95,4 +95,18 @@ SET collation_connection='latin1_bin';
CREATE TABLE „a (a int);
SELECT '„a' as str;
+
+#
+# Bug#18321: Can't store EuroSign with latin1_german1_ci and latin1_general_ci
+# The problem was in latin1->utf8->latin1 round trip.
+#
+set @str= _latin1 'ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈ̀̉Ù @ abc';
+SELECT convert(@str collate latin1_bin using utf8);
+SELECT convert(@str collate latin1_general_ci using utf8);
+SELECT convert(@str collate latin1_german1_ci using utf8);
+SELECT convert(@str collate latin1_danish_ci using utf8);
+SELECT convert(@str collate latin1_spanish_ci using utf8);
+SELECT convert(@str collate latin1_german2_ci using utf8);
+SELECT convert(@str collate latin1_swedish_ci using utf8);
+
# End of 4.1 tests
diff --git a/mysql-test/t/ctype_latin2_ch.test b/mysql-test/t/ctype_latin2_ch.test
new file mode 100644
index 00000000000..626d83fa17d
--- /dev/null
+++ b/mysql-test/t/ctype_latin2_ch.test
@@ -0,0 +1,30 @@
+-- source include/have_latin2_ch.inc
+
+#
+# Tests with latin2_czech_cs
+#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Bug#17374: select ... like 'A%' operator fails
+# to find value on columuns with key
+#
+set names latin2;
+select 'A' = 'a' collate latin2_czech_cs;
+create table t1 (
+ id int(5) not null,
+ tt char(255) not null
+) character set latin2 collate latin2_czech_cs;
+insert into t1 values (1,'Aa');
+insert into t1 values (2,'Aas');
+alter table t1 add primary key aaa(tt);
+select * from t1 where tt like 'Aa%';
+select * from t1 ignore index (primary) where tt like 'Aa%';
+select * from t1 where tt like '%Aa%';
+select * from t1 where tt like 'AA%';
+select * from t1 ignore index (primary) where tt like 'AA%';
+select * from t1 where tt like '%AA%';
+
+# End of 4.1 tests
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index bd37d008173..2cbabf88ee0 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -408,6 +408,14 @@ DROP TABLE t1;
SET NAMES latin1;
#
+# Bug#18691 Converting number to UNICODE string returns invalid result
+#
+SELECT CONVERT(103, CHAR(50) UNICODE);
+SELECT CONVERT(103.0, CHAR(50) UNICODE);
+SELECT CONVERT(-103, CHAR(50) UNICODE);
+SELECT CONVERT(-103.0, CHAR(50) UNICODE);
+
+#
# Bug#9557 MyISAM utf8 table crash
#
CREATE TABLE t1 (
diff --git a/mysql-test/t/ctype_ucs2_def-master.opt b/mysql-test/t/ctype_ucs2_def-master.opt
new file mode 100644
index 00000000000..1f884ff1d67
--- /dev/null
+++ b/mysql-test/t/ctype_ucs2_def-master.opt
@@ -0,0 +1 @@
+--default-character-set=ucs2 --default-collation=ucs2_unicode_ci
diff --git a/mysql-test/t/ctype_ucs2_def.test b/mysql-test/t/ctype_ucs2_def.test
new file mode 100644
index 00000000000..fb174d551cf
--- /dev/null
+++ b/mysql-test/t/ctype_ucs2_def.test
@@ -0,0 +1,9 @@
+#
+# Bug#18004 Connecting crashes server when default charset is UCS2
+#
+show variables like "%character_set_ser%";
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+create table t1 (a int);
+drop table t1;
diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test
index bf74371510b..12d05f44a94 100644
--- a/mysql-test/t/ctype_ujis.test
+++ b/mysql-test/t/ctype_ujis.test
@@ -1152,4 +1152,19 @@ SET collation_connection='ujis_bin';
-- source include/ctype_innodb_like.inc
-- source include/ctype_like_escape.inc
+#
+# Bugs#15375: Unassigned multibyte codes are broken
+# into parts when converting to Unicode.
+# This query should return 0x003F0041. I.e. it should
+# scan unassigned double-byte character 0xA5FE, convert
+# it as QUESTION MARK 0x003F and then scan the next
+# character, which is a single byte character 0x41.
+#
+select hex(convert(_ujis 0xA5FE41 using ucs2));
+# This one should return 0x003F0041:
+# scan unassigned three-byte character 0x8FABF8,
+# convert it as QUESTION MARK 0x003F and then scan
+# the next character, which is a single byte character 0x41.
+select hex(convert(_ujis 0x8FABF841 using ucs2));
+
# End of 4.1 tests
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 01bffe9492e..5044f7979f1 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -892,4 +892,38 @@ SELECT LENGTH(bug) FROM t2;
DROP TABLE t2;
DROP TABLE t1;
+#
+# Bug#17705: Corruption of compressed index when index length changes between
+# 254 and 256
+#
+
+SET NAMES utf8;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a VARCHAR(255), KEY(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̀ˆbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
+INSERT INTO t1 VALUES('uu');
+check table t1;
+INSERT INTO t1 VALUES('uU');
+check table t1;
+INSERT INTO t1 VALUES('uu');
+check table t1;
+INSERT INTO t1 VALUES('uuABC');
+check table t1;
+INSERT INTO t1 VALUES('UuABC');
+check table t1;
+INSERT INTO t1 VALUES('uuABC');
+check table t1;
+alter table t1 add b int;
+INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̀ˆbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1);
+INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̀ˆbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',2);
+delete from t1 where b=1;
+INSERT INTO t1 VALUES('UUABCDEFGHIGKLMNOPRSTUVWXYZ̀ˆbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1);
+check table t1;
+INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̀ˆbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3);
+INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̀ˆbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',4);
+delete from t1 where b=3;
+INSERT INTO t1 VALUES('uUABCDEFGHIGKLMNOPRSTUVWXYZ̀ˆbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3);
+check table t1;
+drop table t1;
+
# End of 4.1 tests
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 3eae8d230d8..9bfe9567d83 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -10,6 +10,3 @@
#
##############################################################################
-rpl_relayrotate : Unstable test case, bug#12429
-rpl_until : Unstable test case, bug#12429
-rpl_deadlock : Unstable test case, bug#12429
diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test
index 6b85062b9fa..0f3c3cab307 100644
--- a/mysql-test/t/func_compress.test
+++ b/mysql-test/t/func_compress.test
@@ -45,4 +45,13 @@ set @@max_allowed_packet=1048576*100;
--replace_result "''" XXX "'1'" XXX
eval select compress(repeat('aaaaaaaaaa', IF('$LOW_MEMORY', 10, 10000000))) is null;
+#
+# Bug #18643: problem with null values
+#
+
+create table t1(a blob);
+insert into t1 values(NULL), (compress('a'));
+select uncompress(a), uncompressed_length(a) from t1;
+drop table t1;
+
# End of 4.1 tests
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index eb1cbc3d667..8f50690dd8b 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -382,4 +382,23 @@ SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY id;
DROP TABLE t1;
+#
+# Bug #15560: GROUP_CONCAT wasn't ready for WITH ROLLUP queries
+#
+create table t1(f1 int);
+insert into t1 values(1),(2),(3);
+select f1, group_concat(f1+1) from t1 group by f1 with rollup;
+select count(distinct (f1+1)) from t1 group by f1 with rollup;
+drop table t1;
+
+#
+# Bug#14169 type of group_concat() result changed to blob if tmp_table was used
+#
+create table t1 (f1 int unsigned, f2 varchar(255));
+insert into t1 values (1,repeat('a',255)),(2,repeat('b',255));
+--enable_metadata
+select f2,group_concat(f1) from t1 group by f2;
+--disable_metadata
+drop table t1;
+
# End of 4.1 tests
diff --git a/mysql-test/t/func_op.test b/mysql-test/t/func_op.test
index 24266150e4c..0a4f5034f4c 100644
--- a/mysql-test/t/func_op.test
+++ b/mysql-test/t/func_op.test
@@ -17,4 +17,18 @@ select 0 | -1, 0 ^ -1, 0 & -1;
select -1 >> 0, -1 << 0;
select -1 >> 1, -1 << 1;
+#
+# Bug 13044: wrong bit_count() results
+#
+
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+create table t1(a int);
+create table t2(a int, b int);
+insert into t1 values (1), (2), (3);
+insert into t2 values (1, 7), (3, 7);
+select t1.a, t2.a, t2.b, bit_count(t2.b) from t1 left join t2 on t1.a=t2.a;
+drop table t1, t2;
+
# End of 4.1 tests
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index 805fa881399..60b60547fcc 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -433,4 +433,20 @@ drop user mysqltest_7@;
--error 1141
show grants for mysqltest_7@;
+#
+# Bug#14385: GRANT and mapping to correct user account problems
+#
+create database mysqltest;
+use mysqltest;
+create table t1(f1 int);
+GRANT DELETE ON mysqltest.t1 TO mysqltest1@'%';
+GRANT SELECT ON mysqltest.t1 TO mysqltest1@'192.%';
+show grants for mysqltest1@'192.%';
+show grants for mysqltest1@'%';
+delete from mysql.user where user='mysqltest1';
+delete from mysql.db where user='mysqltest1';
+delete from mysql.tables_priv where user='mysqltest1';
+flush privileges;
+drop database mysqltest;
+
# End of 4.1 tests
diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test
index 5d0f904a716..6e772a7a9ad 100644
--- a/mysql-test/t/key_cache.test
+++ b/mysql-test/t/key_cache.test
@@ -149,6 +149,7 @@ show status like 'key_blocks_used';
--replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED 1674 KEY_BLOCKS_UNUSED 1818 KEY_BLOCKS_UNUSED 1824 KEY_BLOCKS_UNUSED
show status like 'key_blocks_unused';
+
# Cleanup
# We don't reset keycache2 as we want to ensure that mysqld will reset it
set global keycache2.key_buffer_size=0;
@@ -157,7 +158,7 @@ set global keycache2.key_buffer_size=0;
set global keycache3.key_buffer_size=100;
set global keycache3.key_buffer_size=0;
-# Test case for buf 6447
+# Test case for bug 6447
create table t1 (mytext text, FULLTEXT (mytext));
insert t1 values ('aaabbb');
@@ -168,4 +169,42 @@ check table t1;
drop table t1;
+#
+# Bug #19079: corrupted index when key_cache_block_size is not multiple of
+# myisam_block_size
+
+CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY);
+SET GLOBAL key_cache_block_size=1536;
+INSERT INTO t1 VALUES (1);
+SELECT @@key_cache_block_size;
+CHECK TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int);
+CREATE TABLE t2(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int);
+SET GLOBAL key_cache_block_size=1536;
+INSERT INTO t1 VALUES (1,0);
+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;
+SELECT COUNT(*) FROM t1;
+SELECT @@key_cache_block_size;
+CHECK TABLE t1;
+DROP TABLE t1,t2;
+
# End of 4.1 tests
diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test
index 9ef5e272d46..50c4239b45e 100644
--- a/mysql-test/t/kill.test
+++ b/mysql-test/t/kill.test
@@ -39,9 +39,12 @@ select @id != connection_id();
connection con2;
select 4;
drop table t1;
-
-disconnect con2;
connection default;
+disconnect con2;
+
+--error 1064
+kill (select count(*) from mysql.user);
+
#
# BUG#14851: killing long running subquery processed via a temporary table.
#
diff --git a/mysql-test/t/lock.test b/mysql-test/t/lock.test
index 4809dcc5abe..adf13fb4dd8 100644
--- a/mysql-test/t/lock.test
+++ b/mysql-test/t/lock.test
@@ -61,6 +61,24 @@ insert into t1 select index1,nr from t1 as t1_alias;
drop table t1,t2;
#
+# BUG#5390 - problems with merge tables
+# Supplement test for the after-fix optimization
+# Check that a dropped table is correctly removed from a lock.
+create table t1 (c1 int);
+create table t2 (c1 int);
+create table t3 (c1 int);
+lock tables t1 write, t2 write, t3 write;
+# This removes one table after the other from the lock.
+drop table t2, t3, t1;
+#
+# Check that a lock merge works.
+create table t1 (c1 int);
+create table t2 (c1 int);
+create table t3 (c1 int);
+lock tables t1 write, t2 write, t3 write, t1 as t4 read;
+alter table t2 add column c2 int;
+drop table t1, t2, t3;
+
# Bug7241 - Invalid response when DELETE .. USING and LOCK TABLES used.
#
create table t1 ( a int(11) not null auto_increment, primary key(a));
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index ce40cae3266..7e4cc324b12 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -686,4 +686,23 @@ select * from t1 where bob is null and cip=1;
create index bug on t1 (bob(22), cip, time);
select * from t1 where bob is null and cip=1;
drop table t1;
+
+#
+# Bug#14980 - COUNT(*) incorrect on MyISAM table with certain INDEX
+#
+create table t1 (
+ id1 int not null auto_increment,
+ id2 int not null default '0',
+ t text not null,
+ primary key (id1),
+ key x (id2, t(32))
+) engine=myisam;
+insert into t1 (id2, t) values
+(10, 'abc'), (10, 'abc'), (10, 'abc'),
+(20, 'abc'), (20, 'abc'), (20, 'def'),
+(10, 'abc'), (10, 'abc');
+select count(*) from t1 where id2 = 10;
+select count(id1) from t1 where id2 = 10;
+drop table t1;
+
# End of 4.1 tests
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index 7ed204fc6d3..f5c6a7617c5 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -605,10 +605,14 @@ real_sleep 1;
# Missing parameter
--error 1
--exec echo "sleep ;" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "real_sleep ;" | $MYSQL_TEST 2>&1
# Illegal parameter
--error 1
--exec echo "sleep abc;" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "real_sleep abc;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
# Test inc
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index 4b7ec84dc54..1664afc70f9 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -545,4 +545,18 @@ SELECT a FROM t1 ORDER BY a;
(SELECT a FROM t1) ORDER BY a;
DROP TABLE t1;
+#
+# Bug #18767: global ORDER BY applied to a SELECT with ORDER BY either was
+# ignored or 'concatened' to the latter.
+
+CREATE TABLE t1 (a int, b int);
+INSERT INTO t1 VALUES (1,30), (2,20), (1,10), (2,30), (1,20), (2,10);
+
+(SELECT b,a FROM t1 ORDER BY a,b) ORDER BY b,a;
+(SELECT b FROM t1 ORDER BY b DESC) ORDER BY b ASC;
+(SELECT b,a FROM t1 ORDER BY b,a) ORDER BY a,b;
+(SELECT b,a FROM t1 ORDER by b,a LIMIT 3) ORDER by a,b;
+
+DROP TABLE t1;
+
# End of 4.1 tests
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index b0755d06414..d6dcf02d5b7 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -111,6 +111,9 @@ set @fvar= 123.4567;
prepare stmt1 from @fvar;
drop table t1,t2;
+deallocate prepare stmt3;
+deallocate prepare stmt4;
+deallocate prepare stmt5;
#
# Bug #4105: Server crash on attempt to prepare a statement with character
@@ -254,6 +257,7 @@ prepare `Ă¼` from 'select 1234';
execute `Ă¼` ;
set names latin1;
execute `ü`;
+deallocate prepare `ü`;
set names default;
@@ -763,5 +767,163 @@ execute stmt using @like;
deallocate prepare stmt;
drop table t1;
-# End of 4.1 tests
+#
+# Bug#13134 "Length of VARCHAR() utf8 column is increasing when table is
+# recreated with PS/SP"
+#
+
+prepare stmt from 'create table t1 (a varchar(10) character set utf8)';
+execute stmt;
+--disable_warnings
+insert into t1 (a) values (repeat('a', 20));
+--enable_warnings
+select length(a) from t1;
+drop table t1;
+execute stmt;
+--disable_warnings
+insert into t1 (a) values (repeat('a', 20));
+--enable_warnings
+# Check that the data is truncated to the same length
+select length(a) from t1;
+drop table t1;
+deallocate prepare stmt;
+
+#
+# Bug#16248 "WHERE (col1,col2) IN ((?,?)) gives wrong results":
+# check that ROW implementation is reexecution-friendly.
+#
+create table t1 (col1 integer, col2 integer);
+insert into t1 values(100,100),(101,101),(102,102),(103,103);
+prepare stmt from 'select col1, col2 from t1 where (col1, col2) in ((?,?))';
+set @a=100, @b=100;
+execute stmt using @a,@b;
+set @a=101, @b=101;
+execute stmt using @a,@b;
+set @a=102, @b=102;
+execute stmt using @a,@b;
+set @a=102, @b=103;
+execute stmt using @a,@b;
+deallocate prepare stmt;
+drop table t1;
+
+#
+# Bug#16365 Prepared Statements: DoS with too many open statements
+# Check that the limit @@max_prpeared_stmt_count works.
+#
+# Save the old value
+set @old_max_prepared_stmt_count= @@max_prepared_stmt_count;
+#
+# Disable prepared statement protocol: in this test we set
+# @@max_prepared_stmt_count to 0 or 1 and would like to test the limit
+# manually.
+#
+--disable_ps_protocol
+#
+# A. Check that the new variables are present in SHOW VARIABLES list.
+#
+show variables like 'max_prepared_stmt_count';
+show variables like 'prepared_stmt_count';
+#
+# B. Check that the new variables are selectable.
+#
+select @@max_prepared_stmt_count, @@prepared_stmt_count;
+#
+# C. Check that max_prepared_stmt_count is settable (global only),
+# whereas prepared_stmt_count is readonly.
+#
+set global max_prepared_stmt_count=-1;
+select @@max_prepared_stmt_count;
+set global max_prepared_stmt_count=10000000000000000;
+select @@max_prepared_stmt_count;
+set global max_prepared_stmt_count=default;
+select @@max_prepared_stmt_count;
+--error 1229 # ER_GLOBAL_VARIABLE
+set @@max_prepared_stmt_count=1;
+--error 1229 # ER_GLOBAL_VARIABLE
+set max_prepared_stmt_count=1;
+--error 1229 # ER_GLOBAL_VARIABLE
+set local max_prepared_stmt_count=1;
+--error 1229 # ER_GLOBAL_VARIABLE
+set local prepared_stmt_count=0;
+--error 1229 # ER_GLOBAL_VARIABLE
+set @@prepared_stmt_count=0;
+--error 1232 # ER_WRONG_TYPE_FOR_VAR
+set global prepared_stmt_count=1;
+# set to a reasonable limit works
+set global max_prepared_stmt_count=1;
+select @@max_prepared_stmt_count;
+#
+# D. Check that the variables actually work.
+#
+set global max_prepared_stmt_count=0;
+select @@max_prepared_stmt_count, @@prepared_stmt_count;
+--error 1105 # ER_UNKNOWN_ERROR
+prepare stmt from "select 1";
+select @@prepared_stmt_count;
+set global max_prepared_stmt_count=1;
+prepare stmt from "select 1";
+select @@prepared_stmt_count;
+--error 1105 # ER_UNKNOWN_ERROR
+prepare stmt1 from "select 1";
+select @@prepared_stmt_count;
+deallocate prepare stmt;
+select @@prepared_stmt_count;
+#
+# E. Check that we can prepare a statement with the same name
+# successfully, without hitting the limit.
+#
+prepare stmt from "select 1";
+select @@prepared_stmt_count;
+prepare stmt from "select 2";
+select @@prepared_stmt_count;
+#
+# F. We can set the max below the current count. In this case no new
+# statements should be allowed to prepare.
+#
+select @@prepared_stmt_count, @@max_prepared_stmt_count;
+set global max_prepared_stmt_count=0;
+--error 1105 # ER_UNKNOWN_ERROR
+prepare stmt from "select 1";
+# Result: the old statement is deallocated, the new is not created.
+--error 1243 # ER_UNKNOWN_STMT_HANDLER
+execute stmt;
+select @@prepared_stmt_count;
+--error 1105 # ER_UNKNOWN_ERROR
+prepare stmt from "select 1";
+select @@prepared_stmt_count;
+#
+# G. Show that the variables are up to date even after a connection with all
+# statements in it was terminated.
+#
+set global max_prepared_stmt_count=3;
+select @@max_prepared_stmt_count, @@prepared_stmt_count;
+prepare stmt from "select 1";
+connect (con1,localhost,root,,);
+connection con1;
+prepare stmt from "select 2";
+prepare stmt1 from "select 3";
+--error 1105 # ER_UNKNOWN_ERROR
+prepare stmt2 from "select 4";
+connection default;
+--error 1105 # ER_UNKNOWN_ERROR
+prepare stmt2 from "select 4";
+select @@max_prepared_stmt_count, @@prepared_stmt_count;
+disconnect con1;
+connection default;
+# Wait for the connection to die: deal with a possible race
+deallocate prepare stmt;
+let $count= `select @@prepared_stmt_count`;
+if ($count)
+{
+--sleep 2
+ let $count= `select @@prepared_stmt_count`;
+}
+select @@max_prepared_stmt_count, @@prepared_stmt_count;
+#
+# Restore the old value.
+#
+set global max_prepared_stmt_count= @old_max_prepared_stmt_count;
+--enable_ps_protocol
+
+# End of 4.1 tests
diff --git a/mysql-test/t/rpl_deadlock.test b/mysql-test/t/rpl_deadlock.test
index d3bc31addff..e8ba6d6faec 100644
--- a/mysql-test/t/rpl_deadlock.test
+++ b/mysql-test/t/rpl_deadlock.test
@@ -58,7 +58,7 @@ while ($1)
enable_query_log;
select * from t1 for update;
start slave;
---sleep 3 # hope that slave is blocked now
+--real_sleep 3 # hope that slave is blocked now
insert into t2 values(22); # provoke deadlock, slave should be victim
commit;
sync_with_master;
@@ -67,7 +67,9 @@ select * from t2;
# check that no error is reported
--replace_column 1 # 8 # 9 # 23 # 33 #
--replace_result $MASTER_MYPORT MASTER_MYPORT
+--vertical_results
show slave status;
+--horizontal_results
# 2) Test lock wait timeout
@@ -76,15 +78,17 @@ change master to master_log_pos=401; # the BEGIN log event
begin;
select * from t2 for update; # hold lock
start slave;
---sleep 10 # slave should have blocked, and be retrying
+--real_sleep 10 # slave should have blocked, and be retrying
commit;
sync_with_master;
select * from t1; # check that slave succeeded finally
select * from t2;
# check that no error is reported
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 11 # 23 # 33 #
--replace_result $MASTER_MYPORT MASTER_MYPORT
+--vertical_results
show slave status;
+--horizontal_results
# Now we repeat 2), but with BEGIN in the same relay log as
# COMMIT (to see if seeking into hot log is ok).
@@ -97,14 +101,16 @@ change master to master_log_pos=401;
begin;
select * from t2 for update;
start slave;
---sleep 10
+--real_sleep 10
commit;
sync_with_master;
select * from t1;
select * from t2;
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 11 # 23 # 33 #
--replace_result $MASTER_MYPORT MASTER_MYPORT
+--vertical_results
show slave status;
+--horizontal_results
connection master;
drop table t1,t2,t3,t4;
diff --git a/mysql-test/t/rpl_relayrotate.test b/mysql-test/t/rpl_relayrotate.test
index 1dab8bf4ed5..04f03367e20 100644
--- a/mysql-test/t/rpl_relayrotate.test
+++ b/mysql-test/t/rpl_relayrotate.test
@@ -52,11 +52,9 @@ start slave;
# which proves that the transaction restarted at
# the right place.
# We must wait for the transaction to commit before
-# reading, MASTER_POS_WAIT() will do it for sure
-# (the only statement with position>=3000 is COMMIT).
-select master_pos_wait('master-bin.001',3000)>=0;
-select * from t1 where a=8000;
-
+# reading:
+sync_with_master;
+select max(a) from t1;
connection master;
# The following DROP is a very important cleaning task:
diff --git a/mysql-test/t/rpl_trunc_temp.test b/mysql-test/t/rpl_trunc_temp.test
new file mode 100644
index 00000000000..be570a6f80c
--- /dev/null
+++ b/mysql-test/t/rpl_trunc_temp.test
@@ -0,0 +1,35 @@
+source include/master-slave.inc;
+
+#
+# Bug#17137 Running "truncate table" on temporary table
+# leaves the table open on a slave
+#
+
+create temporary table t1 (n int);
+insert into t1 values(1);
+sync_slave_with_master;
+show status like 'Slave_open_temp_tables';
+
+# Perform a delete from temp table
+connection master;
+delete from t1;
+sync_slave_with_master;
+show status like 'Slave_open_temp_tables';
+
+# Perform truncate on temp table
+connection master;
+truncate t1;
+sync_slave_with_master;
+show status like 'Slave_open_temp_tables';
+
+# Disconnect the master, temp table on slave should dissapear
+disconnect master;
+--real_sleep 3 # time for DROP to be read by slave
+connection slave;
+show status like 'Slave_open_temp_tables';
+
+
+connection master;
+
+
+# End of 4.1 tests
diff --git a/mysql-test/t/rpl_until.test b/mysql-test/t/rpl_until.test
index 57ebc67db1d..990f00fdc63 100644
--- a/mysql-test/t/rpl_until.test
+++ b/mysql-test/t/rpl_until.test
@@ -26,6 +26,7 @@ show binlog events;
connection slave;
start slave until master_log_file='master-bin.000001', master_log_pos=244;
sleep 2;
+wait_for_slave_to_stop;
# here table should be still not deleted
select * from t1;
--replace_result $MASTER_MYPORT MASTER_MYPORT
@@ -37,6 +38,7 @@ start slave until master_log_file='master-no-such-bin.000001', master_log_pos=29
# again this table should be still not deleted
select * from t1;
sleep 2;
+wait_for_slave_to_stop;
--replace_result $MASTER_MYPORT MASTER_MYPORT
--replace_column 1 # 9 # 11 # 23 # 33 #
show slave status;
@@ -44,6 +46,7 @@ show slave status;
# try replicate all until second insert to t2;
start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=537;
sleep 4;
+wait_for_slave_to_stop;
select * from t2;
--replace_result $MASTER_MYPORT MASTER_MYPORT
--replace_column 1 # 9 # 11 # 23 # 33 #
@@ -61,6 +64,7 @@ stop slave;
start slave until master_log_file='master-bin.000001', master_log_pos=561;
# 2 is not enough when running with valgrind
--real_sleep 4
+wait_for_slave_to_stop;
# here the sql slave thread should be stopped
--replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
--replace_column 1 # 9 # 23 # 33 #
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 1f6fc2c8d3b..994546e9d97 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -711,6 +711,15 @@ set @val:=6;
select concat('value is: ', @val) union select 'some text';
#
+# Bug#15949 union + illegal mix of collations (IMPLICIT + COERCIBLE)
+#
+select concat(_latin1'a', _ascii'b' collate ascii_bin);
+create table t1 (foo varchar(100)) collate ascii_bin;
+insert into t1 (foo) values ("foo");
+select foo from t1 union select 'bar' as foo from dual;
+drop table t1;
+
+#
# Enum merging test
#
CREATE TABLE t1 (
@@ -729,8 +738,8 @@ drop table t2;
create table t2 select a from t1 union select a from t1;
show columns from t2;
drop table t2;
--- error 1267
create table t2 select a from t1 union select c from t1;
+drop table t2;
create table t2 select a from t1 union select b from t1;
show columns from t2;
drop table t2, t1;