summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <msvensson@shellback.(none)>2006-09-01 11:23:08 +0200
committerunknown <msvensson@shellback.(none)>2006-09-01 11:23:08 +0200
commit4991cc07e5ec7a982145fa74539977bcedb0af30 (patch)
treef8c7e6cc8b0bf666906a0c4e12e7ac8ba06ba7cb
parent22d76f5a5520f384985e7de1dc30b2c3cd4d0feb (diff)
parent5d58edf00ffb3ebdb857dfe3d07e6aff0343b0ed (diff)
downloadmariadb-git-4991cc07e5ec7a982145fa74539977bcedb0af30.tar.gz
Merge shellback.(none):/home/msvensson/mysql/mysql-5.1
into shellback.(none):/home/msvensson/mysql/mysql-5.1-new-maint configure.in: Auto merged include/mysql_com.h: Auto merged mysql-test/lib/mtr_process.pl: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/r/grant.result: Auto merged mysql-test/r/partition.result: Auto merged mysql-test/r/partition_mgm.result: Auto merged mysql-test/t/disabled.def: Auto merged mysql-test/t/grant.test: Auto merged sql/item_strfunc.cc: Auto merged sql/item_strfunc.h: Auto merged sql/mysqld.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_show.cc: Auto merged
-rw-r--r--.bzrignore2
-rwxr-xr-xBUILD/SETUP.sh12
-rwxr-xr-xBUILD/check-cpu367
-rw-r--r--client/mysql.cc38
-rw-r--r--client/mysql_upgrade.c16
-rw-r--r--client/mysqldump.c130
-rw-r--r--configure.in15
-rw-r--r--dbug/dbug.c5
-rw-r--r--extra/yassl/include/openssl/prefix_ssl.h1
-rw-r--r--include/config-netware.h4
-rw-r--r--include/mysql.h1
-rw-r--r--include/mysql_com.h6
-rw-r--r--mysql-test/Makefile.am6
-rw-r--r--mysql-test/lib/mtr_cases.pl8
-rw-r--r--mysql-test/lib/mtr_misc.pl2
-rw-r--r--mysql-test/lib/mtr_process.pl7
-rwxr-xr-xmysql-test/mysql-test-run.pl717
-rw-r--r--mysql-test/r/ctype_ucs.result44
-rw-r--r--mysql-test/r/func_misc.result5
-rw-r--r--mysql-test/r/innodb.result16
-rw-r--r--mysql-test/r/mysql.result14
-rw-r--r--mysql-test/r/mysqldump.result15
-rw-r--r--mysql-test/r/ndb_dd_advance.result14
-rw-r--r--mysql-test/r/ndb_dd_advance2.result8
-rw-r--r--mysql-test/r/ndb_dd_backuprestore.result12
-rw-r--r--mysql-test/r/ndb_dd_basic.result2
-rw-r--r--mysql-test/r/ndb_dd_disk2memory.result4
-rw-r--r--mysql-test/r/openssl_1.result9
-rw-r--r--mysql-test/r/partition.result8
-rw-r--r--mysql-test/r/variables.result6
-rw-r--r--mysql-test/t/ctype_ucs.test43
-rw-r--r--mysql-test/t/disabled.def1
-rw-r--r--mysql-test/t/func_misc.test12
-rw-r--r--mysql-test/t/innodb.test8
-rw-r--r--mysql-test/t/mysql.test4
-rw-r--r--mysql-test/t/mysqldump.test31
-rw-r--r--mysql-test/t/openssl_1.test10
-rw-r--r--mysql-test/t/variables.test11
-rw-r--r--sql-common/client.c8
-rw-r--r--sql/gen_lex_hash.cc21
-rw-r--r--sql/ha_innodb.cc137
-rw-r--r--sql/handler.cc2
-rw-r--r--sql/item_strfunc.cc14
-rw-r--r--sql/item_strfunc.h26
-rw-r--r--sql/item_timefunc.cc2
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/sql_acl.cc11
-rw-r--r--sql/sql_lex.cc2
-rw-r--r--sql/sql_prepare.cc6
-rw-r--r--sql/sql_show.cc9
-rw-r--r--sql/stacktrace.c55
-rw-r--r--sql/stacktrace.h8
-rw-r--r--storage/innobase/Makefile.am3
-rw-r--r--storage/innobase/btr/btr0btr.c2
-rw-r--r--storage/innobase/buf/buf0buf.c5
-rw-r--r--storage/innobase/dict/dict0dict.c11
-rw-r--r--storage/innobase/fil/fil0fil.c26
-rw-r--r--storage/innobase/fsp/fsp0fsp.c2
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.c17
-rw-r--r--storage/innobase/include/btr0cur.ic5
-rw-r--r--storage/innobase/include/buf0buf.ic8
-rw-r--r--storage/innobase/include/ibuf0ibuf.ic11
-rw-r--r--storage/innobase/log/log0log.c2
-rw-r--r--storage/innobase/log/log0recv.c4
-rw-r--r--storage/innobase/os/os0file.c14
-rw-r--r--storage/innobase/row/row0mysql.c133
-rw-r--r--storage/innobase/row/row0sel.c2
-rw-r--r--storage/innobase/row/row0vers.c2
-rw-r--r--storage/innobase/srv/srv0start.c2
-rw-r--r--storage/innobase/ut/ut0dbg.c4
-rw-r--r--support-files/mysql.spec.sh3
-rw-r--r--tests/mysql_client_test.c95
72 files changed, 1294 insertions, 974 deletions
diff --git a/.bzrignore b/.bzrignore
index 1cf0cf7b889..375fe14b9ad 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -692,6 +692,7 @@ mysql-test/*.ds?
mysql-test/*.vcproj
mysql-test/gmon.out
mysql-test/install_test_db
+mysql-test/mtr
mysql-test/mysql-test-run
mysql-test/mysql-test-run.log
mysql-test/mysql_test_run_new
@@ -1170,6 +1171,7 @@ sql/*.ds?
sql/*.vcproj
sql/.gdbinit
sql/client.c
+sql/f.c
sql/gen_lex_hash
sql/gmon.out
sql/handlerton.cc
diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh
index 02d160158b3..bca7e7b2e1f 100755
--- a/BUILD/SETUP.sh
+++ b/BUILD/SETUP.sh
@@ -51,7 +51,7 @@ parse_options()
########################################################################
-if ! test -f sql/mysqld.cc
+if test ! -f sql/mysqld.cc
then
echo "You must run this script from the MySQL top-level directory"
exit 1
@@ -185,12 +185,6 @@ fi
# (returns 0 if finds lines)
if ccache -V > /dev/null 2>&1
then
- if ! (echo "$CC" | grep "ccache" > /dev/null)
- then
- CC="ccache $CC"
- fi
- if ! (echo "$CXX" | grep "ccache" > /dev/null)
- then
- CXX="ccache $CXX"
- fi
+ echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC"
+ echo "$CXX" | grep "ccache" > /dev/null || CXX="ccache $CXX"
fi
diff --git a/BUILD/check-cpu b/BUILD/check-cpu
index 583e31ee389..abd2884bd3f 100755
--- a/BUILD/check-cpu
+++ b/BUILD/check-cpu
@@ -3,209 +3,212 @@
# Check cpu of current machine and find the
# best compiler optimization flags for gcc
#
-#
-if test -r /proc/cpuinfo ; then
- # on Linux (and others?) we can get detailed CPU information out of /proc
- cpuinfo="cat /proc/cpuinfo"
+check_cpu () {
+ if test -r /proc/cpuinfo ; then
+ # on Linux (and others?) we can get detailed CPU information out of /proc
+ cpuinfo="cat /proc/cpuinfo"
- # detect CPU family
- cpu_family=`$cpuinfo | grep 'family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
- if test -z "$cpu_family" ; then
- cpu_family=`$cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
- fi
+ # detect CPU family
+ cpu_family=`$cpuinfo | grep 'family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
+ if test -z "$cpu_family" ; then
+ cpu_family=`$cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
+ fi
- # detect CPU vendor and model
- cpu_vendor=`$cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
- model_name=`$cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -1`
- if test -z "$model_name" ; then
- model_name=`$cpuinfo | grep 'cpu model' | cut -d ':' -f 2 | head -1`
- fi
+ # detect CPU vendor and model
+ cpu_vendor=`$cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
+ model_name=`$cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -1`
+ if test -z "$model_name" ; then
+ model_name=`$cpuinfo | grep 'cpu model' | cut -d ':' -f 2 | head -1`
+ fi
+
+ # fallback: get CPU model from uname output
+ if test -z "$model_name" ; then
+ model_name=`uname -m`
+ fi
- # fallback: get CPU model from uname output
- if test -z "$model_name" ; then
- model_name=`uname -m`
+ # parse CPU flags
+ for flag in `$cpuinfo | grep '^flags' | sed -e 's/^flags.*: //'`; do
+ eval cpu_flag_$flag=yes
+ done
+ else
+ # Fallback when there is no /proc/cpuinfo
+ case "`uname -s`" in
+ FreeBSD|OpenBSD)
+ cpu_family=`uname -m`;
+ model_name=`sysctl -n hw.model`
+ ;;
+ Darwin)
+ cpu_family=`uname -p`
+ model_name=`machine`
+ ;;
+ *)
+ cpu_family=`uname -m`;
+ model_name=`uname -p`;
+ ;;
+ esac
fi
- # parse CPU flags
- for flag in `$cpuinfo | grep '^flags' | sed -e 's/^flags.*: //'`; do
- eval cpu_flag_$flag=yes
- done
-else
- # Fallback when there is no /proc/cpuinfo
- case "`uname -s`" in
- FreeBSD|OpenBSD)
- cpu_family=`uname -m`;
- model_name=`sysctl -n hw.model`
- ;;
- Darwin)
- cpu_family=`uname -p`
- model_name=`machine`
+ # detect CPU shortname as used by gcc options
+ # this list is not complete, feel free to add further entries
+ cpu_arg=""
+ case "$cpu_family--$model_name" in
+ # DEC Alpha
+ Alpha*EV6*)
+ cpu_arg="ev6";
;;
- *)
- cpu_family=`uname -m`;
- model_name=`uname -p`;
+
+ # Intel ia32
+ *X[eE][oO][nN]*)
+ # a Xeon is just another pentium4 ...
+ # ... unless it has the "lm" (long-mode) flag set,
+ # in that case it's a Xeon with EM64T support
+ if [ -z "$cpu_flag_lm" ]; then
+ cpu_arg="pentium4";
+ else
+ cpu_arg="nocona";
+ fi
;;
- esac
-fi
-
-# detect CPU shortname as used by gcc options
-# this list is not complete, feel free to add further entries
-cpu_arg=""
-case "$cpu_family--$model_name" in
- # DEC Alpha
- Alpha*EV6*)
- cpu_arg="ev6";
+ *Pentium*4*Mobile*)
+ cpu_arg="pentium4m";
;;
-
- # Intel ia32
- *X[eE][oO][nN]*)
- # a Xeon is just another pentium4 ...
- # ... unless it has the "lm" (long-mode) flag set,
- # in that case it's a Xeon with EM64T support
- if [ -z "$cpu_flag_lm" ]; then
+ *Pentium*4*)
cpu_arg="pentium4";
- else
- cpu_arg="nocona";
- fi
- ;;
- *Pentium*4*Mobile*)
- cpu_arg="pentium4m";
- ;;
- *Pentium*4*)
- cpu_arg="pentium4";
- ;;
- *Pentium*III*Mobile*)
- cpu_arg="pentium3m";
- ;;
- *Pentium*III*)
- cpu_arg="pentium3";
- ;;
- *Pentium*M*pro*)
- cpu_arg="pentium-m";
- ;;
- *Athlon*64*)
- cpu_arg="athlon64";
+ ;;
+ *Pentium*III*Mobile*)
+ cpu_arg="pentium3m";
;;
- *Athlon*)
- cpu_arg="athlon";
+ *Pentium*III*)
+ cpu_arg="pentium3";
;;
- *Opteron*)
- cpu_arg="opteron";
+ *Pentium*M*pro*)
+ cpu_arg="pentium-m";
;;
+ *Athlon*64*)
+ cpu_arg="athlon64";
+ ;;
+ *Athlon*)
+ cpu_arg="athlon";
+ ;;
+ *Opteron*)
+ cpu_arg="opteron";
+ ;;
- # Intel ia64
- *Itanium*)
- # Don't need to set any flags for itanium(at the moment)
- cpu_arg="";
- ;;
+ # Intel ia64
+ *Itanium*)
+ # Don't need to set any flags for itanium(at the moment)
+ cpu_arg="";
+ ;;
- #
- *ppc*)
- cpu_arg='powerpc'
- ;;
-
- *powerpc*)
- cpu_arg='powerpc'
- ;;
+ #
+ *ppc*)
+ cpu_arg='powerpc'
+ ;;
+
+ *powerpc*)
+ cpu_arg='powerpc'
+ ;;
- # unknown
- *)
- cpu_arg="";
- ;;
-esac
-
-
-if test -z "$cpu_arg"; then
- echo "BUILD/check-cpu: Oops, could not find out what kind of cpu this machine is using."
- check_cpu_cflags=""
- return
-fi
-
-# different compiler versions have different option names
-# for CPU specific command line options
-if test -z "$CC" ; then
- cc="gcc";
-else
- cc=$CC
-fi
-
-cc_ver=`$cc --version | sed 1q`
-cc_verno=`echo $cc_ver | sed -e 's/[^0-9. ]//g; s/^ *//g; s/ .*//g'`
-
-case "$cc_ver--$cc_verno" in
- *GCC*)
- # different gcc backends (and versions) have different CPU flags
- case `gcc -dumpmachine` in
- i?86-*)
- case "$cc_verno" in
- 3.4*|3.5*|4.*)
- check_cpu_args='-mtune=$cpu_arg -march=$cpu_arg'
- ;;
- *)
- check_cpu_args='-mcpu=$cpu_arg -march=$cpu_arg'
- ;;
- esac
- ;;
- ppc-*)
- check_cpu_args='-mcpu=$cpu_arg -mtune=$cpu_arg'
- ;;
- x86_64-*)
- check_cpu_args='-mtune=$cpu_arg'
- ;;
- *)
- check_cpu_cflags=""
- return
- ;;
- esac
- ;;
- 2.95.*)
- # GCC 2.95 doesn't expose its name in --version output
- check_cpu_args='-m$cpu_arg'
- ;;
- *)
+ # unknown
+ *)
+ cpu_arg="";
+ ;;
+ esac
+
+
+ if test -z "$cpu_arg"; then
+ echo "BUILD/check-cpu: Oops, could not find out what kind of cpu this machine is using." >&2
check_cpu_cflags=""
return
- ;;
-esac
-
-# now we check whether the compiler really understands the cpu type
-touch __test.c
-
-while [ "$cpu_arg" ] ; do
- echo -n testing $cpu_arg "... "
-
- # compile check
- check_cpu_cflags=`eval echo $check_cpu_args`
- if $cc -c $check_cpu_cflags __test.c 2>/dev/null; then
- echo ok
- break;
fi
- echo failed
- check_cpu_cflags=""
+ # different compiler versions have different option names
+ # for CPU specific command line options
+ if test -z "$CC" ; then
+ cc="gcc";
+ else
+ cc=$CC
+ fi
- # if compile failed: check whether it supports a predecessor of this CPU
- # this list is not complete, feel free to add further entries
- case "$cpu_arg" in
- # Intel ia32
- nocona) cpu_arg=pentium4 ;;
- prescott) cpu_arg=pentium4 ;;
- pentium4m) cpu_arg=pentium4 ;;
- pentium4) cpu_arg=pentium3 ;;
- pentium3m) cpu_arg=pentium3 ;;
- pentium3) cpu_arg=pentium2 ;;
- pentium2) cpu_arg=pentiumpro ;;
- pentiumpro) cpu_arg=pentium ;;
- pentium) cpu_arg=i486 ;;
- i486) cpu_arg=i386 ;;
-
- # power / powerPC
- 7450) cpu_arg=7400 ;;
-
- *) cpu_arg="" ;;
+ cc_ver=`$cc --version | sed 1q`
+ cc_verno=`echo $cc_ver | sed -e 's/[^0-9. ]//g; s/^ *//g; s/ .*//g'`
+
+ case "$cc_ver--$cc_verno" in
+ *GCC*)
+ # different gcc backends (and versions) have different CPU flags
+ case `gcc -dumpmachine` in
+ i?86-*)
+ case "$cc_verno" in
+ 3.4*|3.5*|4.*)
+ check_cpu_args='-mtune=$cpu_arg -march=$cpu_arg'
+ ;;
+ *)
+ check_cpu_args='-mcpu=$cpu_arg -march=$cpu_arg'
+ ;;
+ esac
+ ;;
+ ppc-*)
+ check_cpu_args='-mcpu=$cpu_arg -mtune=$cpu_arg'
+ ;;
+ x86_64-*)
+ check_cpu_args='-mtune=$cpu_arg'
+ ;;
+ *)
+ check_cpu_cflags=""
+ return
+ ;;
+ esac
+ ;;
+ 2.95.*)
+ # GCC 2.95 doesn't expose its name in --version output
+ check_cpu_args='-m$cpu_arg'
+ ;;
+ *)
+ check_cpu_cflags=""
+ return
+ ;;
esac
-done
-rm __test.*
+ # now we check whether the compiler really understands the cpu type
+ touch __test.c
+
+ while [ "$cpu_arg" ] ; do
+ # FIXME: echo -n isn't portable - see contortions autoconf goes through
+ echo -n testing $cpu_arg "... " >&2
+
+ # compile check
+ check_cpu_cflags=`eval echo $check_cpu_args`
+ if $cc -c $check_cpu_cflags __test.c 2>/dev/null; then
+ echo ok >&2
+ break;
+ fi
+
+ echo failed >&2
+ check_cpu_cflags=""
+ # if compile failed: check whether it supports a predecessor of this CPU
+ # this list is not complete, feel free to add further entries
+ case "$cpu_arg" in
+ # Intel ia32
+ nocona) cpu_arg=pentium4 ;;
+ prescott) cpu_arg=pentium4 ;;
+ pentium4m) cpu_arg=pentium4 ;;
+ pentium4) cpu_arg=pentium3 ;;
+ pentium3m) cpu_arg=pentium3 ;;
+ pentium3) cpu_arg=pentium2 ;;
+ pentium2) cpu_arg=pentiumpro ;;
+ pentiumpro) cpu_arg=pentium ;;
+ pentium) cpu_arg=i486 ;;
+ i486) cpu_arg=i386 ;;
+
+ # power / powerPC
+ 7450) cpu_arg=7400 ;;
+
+ *) cpu_arg="" ;;
+ esac
+ done
+
+ rm __test.*
+}
+
+check_cpu
diff --git a/client/mysql.cc b/client/mysql.cc
index ae24c4e0d88..ab140b23405 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -338,7 +338,7 @@ static void end_timer(ulong start_time,char *buff);
static void mysql_end_timer(ulong start_time,char *buff);
static void nice_time(double sec,char *buff,bool part_second);
static sig_handler mysql_end(int sig);
-static sig_handler mysql_sigint(int sig);
+static sig_handler handle_sigint(int sig);
int main(int argc,char *argv[])
{
@@ -420,8 +420,7 @@ int main(int argc,char *argv[])
if (opt_sigint_ignore)
signal(SIGINT, SIG_IGN);
else
- signal(SIGINT, mysql_sigint); // Catch SIGINT to clean up
-
+ signal(SIGINT, handle_sigint); // Catch SIGINT to clean up
signal(SIGQUIT, mysql_end); // Catch SIGQUIT to clean up
/*
@@ -489,28 +488,6 @@ int main(int argc,char *argv[])
#endif
}
-sig_handler mysql_sigint(int sig)
-{
- char kill_buffer[40];
- MYSQL *kill_mysql= NULL;
-
- signal(SIGINT, mysql_sigint);
-
- /* terminate if no query being executed, or we already tried interrupting */
- if (!executing_query || interrupted_query++)
- mysql_end(sig);
-
- kill_mysql= mysql_init(kill_mysql);
- if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password,
- "", opt_mysql_port, opt_mysql_unix_port,0))
- mysql_end(sig);
- /* kill_buffer is always big enough because max length of %lu is 15 */
- sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql));
- mysql_real_query(kill_mysql, kill_buffer, strlen(kill_buffer));
- mysql_close(kill_mysql);
- tee_fprintf(stdout, "Query aborted by Ctrl+C\n");
-}
-
sig_handler mysql_end(int sig)
{
mysql_close(&mysql);
@@ -1058,8 +1035,6 @@ static int read_and_execute(bool interactive)
if (opt_outfile && glob_buffer.is_empty())
fflush(OUTFILE);
- interrupted_query= 0;
-
#if defined( __WIN__) || defined(__NETWARE__)
tee_fputs(prompt, stdout);
#if defined(__NETWARE__)
@@ -1982,6 +1957,9 @@ com_charset(String *buffer __attribute__((unused)), char *line)
if (new_cs)
{
charset_info= new_cs;
+ mysql_set_character_set(&mysql, charset_info->csname);
+ default_charset= (char *)charset_info->csname;
+ default_charset_used= 1;
put_info("Charset changed", INFO_INFO);
}
else put_info("Charset is not found", INFO_INFO);
@@ -2041,9 +2019,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
}
timer=start_timer();
-
executing_query= 1;
-
error= mysql_real_query_for_lazy(buffer->ptr(),buffer->length());
#ifdef HAVE_READLINE
@@ -2059,7 +2035,6 @@ com_go(String *buffer,char *line __attribute__((unused)))
{
executing_query= 0;
buffer->length(0); // Remove query on error
- executing_query= 0;
return error;
}
error=0;
@@ -2143,9 +2118,6 @@ com_go(String *buffer,char *line __attribute__((unused)))
fflush(stdout);
mysql_free_result(result);
} while (!(err= mysql_next_result(&mysql)));
-
- executing_query= 0;
-
if (err >= 1)
error= put_error(&mysql);
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index c68f8777624..9a73263f558 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -157,17 +157,29 @@ static int create_defaults_file(const char *path, const char *our_defaults_path)
File our_defaults_file, defaults_file;
char buffer[512];
char *buffer_end;
+ int failed_to_open_count= 0;
int error;
/* check if the defaults file is needed at all */
if (!opt_password)
return 0;
- defaults_file= my_open(path, O_BINARY | O_CREAT | O_WRONLY,
+retry_open:
+ defaults_file= my_open(path, O_BINARY | O_CREAT | O_WRONLY | O_EXCL,
MYF(MY_FAE | MY_WME));
if (defaults_file < 0)
- return 1;
+ {
+ if (failed_to_open_count == 0)
+ {
+ remove(path);
+ failed_to_open_count+= 1;
+ goto retry_open;
+ }
+ else
+ return 1;
+ }
+
upgrade_defaults_created= 1;
if (our_defaults_path)
{
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 83a7d0f335e..5374074ccb2 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -430,7 +430,9 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
int string_value);
static int dump_selected_tables(char *db, char **table_names, int tables);
static int dump_all_tables_in_db(char *db);
-static int init_dumping(char *);
+static int init_dumping_views(char *);
+static int init_dumping_tables(char *);
+static int init_dumping(char *, int init_func(char*));
static int dump_databases(char **);
static int dump_all_databases();
static char *quote_name(const char *name, char *buff, my_bool force);
@@ -2905,7 +2907,76 @@ static int dump_databases(char **db_names)
} /* dump_databases */
-static int init_dumping(char *database)
+/*
+View Specific database initalization.
+
+SYNOPSIS
+ init_dumping_views
+ qdatabase quoted name of the database
+
+RETURN VALUES
+ 0 Success.
+ 1 Failure.
+*/
+int init_dumping_views(char *qdatabase)
+{
+ return 0;
+} /* init_dumping_views */
+
+
+/*
+Table Specific database initalization.
+
+SYNOPSIS
+ init_dumping_tables
+ qdatabase quoted name of the database
+
+RETURN VALUES
+ 0 Success.
+ 1 Failure.
+*/
+int init_dumping_tables(char *qdatabase)
+{
+ if (!opt_create_db)
+ {
+ char qbuf[256];
+ MYSQL_ROW row;
+ MYSQL_RES *dbinfo;
+
+ my_snprintf(qbuf, sizeof(qbuf),
+ "SHOW CREATE DATABASE IF NOT EXISTS %s",
+ qdatabase);
+
+ if (mysql_query(mysql, qbuf) || !(dbinfo = mysql_store_result(mysql)))
+ {
+ /* Old server version, dump generic CREATE DATABASE */
+ if (opt_drop_database)
+ fprintf(md_result_file,
+ "\n/*!40000 DROP DATABASE IF EXISTS %s;*/\n",
+ qdatabase);
+ fprintf(md_result_file,
+ "\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n",
+ qdatabase);
+ }
+ else
+ {
+ if (opt_drop_database)
+ fprintf(md_result_file,
+ "\n/*!40000 DROP DATABASE IF EXISTS %s*/;\n",
+ qdatabase);
+ row = mysql_fetch_row(dbinfo);
+ if (row[1])
+ {
+ fprintf(md_result_file,"\n%s;\n",row[1]);
+ }
+ }
+ }
+
+ return 0;
+} /* init_dumping_tables */
+
+
+static int init_dumping(char *database, int init_func(char*))
{
if (mysql_get_server_version(mysql) >= 50003 &&
!my_strcasecmp(&my_charset_latin1, database, "information_schema"))
@@ -2930,40 +3001,10 @@ static int init_dumping(char *database)
fprintf(md_result_file,"\n--\n-- Current Database: %s\n--\n", qdatabase);
check_io(md_result_file);
}
- if (!opt_create_db)
- {
- char qbuf[256];
- MYSQL_ROW row;
- MYSQL_RES *dbinfo;
- my_snprintf(qbuf, sizeof(qbuf),
- "SHOW CREATE DATABASE IF NOT EXISTS %s",
- qdatabase);
+ /* Call the view or table specific function */
+ init_func(qdatabase);
- if (mysql_query(mysql, qbuf) || !(dbinfo = mysql_store_result(mysql)))
- {
- /* Old server version, dump generic CREATE DATABASE */
- if (opt_drop_database)
- fprintf(md_result_file,
- "\n/*!40000 DROP DATABASE IF EXISTS %s;*/\n",
- qdatabase);
- fprintf(md_result_file,
- "\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n",
- qdatabase);
- }
- else
- {
- if (opt_drop_database)
- fprintf(md_result_file,
- "\n/*!40000 DROP DATABASE IF EXISTS %s*/;\n",
- qdatabase);
- row = mysql_fetch_row(dbinfo);
- if (row[1])
- {
- fprintf(md_result_file,"\n%s;\n",row[1]);
- }
- }
- }
fprintf(md_result_file,"\nUSE %s;\n", qdatabase);
check_io(md_result_file);
}
@@ -2997,7 +3038,7 @@ static int dump_all_tables_in_db(char *database)
if (!strcmp(database, NDB_REP_DB)) /* Skip cluster internal database */
return 0;
- if (init_dumping(database))
+ if (init_dumping(database, init_dumping_tables))
return 1;
if (opt_xml)
print_xml_tag1(md_result_file, "", "database name=", database, "\n");
@@ -3075,23 +3116,8 @@ static my_bool dump_all_views_in_db(char *database)
uint numrows;
char table_buff[NAME_LEN*2+3];
- if (mysql_select_db(mysql, database))
- {
- DB_error(mysql, "when selecting the database");
+ if (init_dumping(database, init_dumping_views))
return 1;
- }
- if (opt_databases || opt_alldbs)
- {
- char quoted_database_buf[NAME_LEN*2+3];
- char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted);
- if (opt_comments)
- {
- fprintf(md_result_file,"\n--\n-- Current Database: %s\n--\n", qdatabase);
- check_io(md_result_file);
- }
- fprintf(md_result_file,"\nUSE %s;\n", qdatabase);
- check_io(md_result_file);
- }
if (opt_xml)
print_xml_tag1(md_result_file, "", "database name=", database, "\n");
if (lock_tables)
@@ -3186,7 +3212,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
char **dump_tables, **pos, **end;
DBUG_ENTER("dump_selected_tables");
- if (init_dumping(db))
+ if (init_dumping(db, init_dumping_tables))
DBUG_RETURN(1);
init_alloc_root(&root, 8192, 0);
diff --git a/configure.in b/configure.in
index 46d27beade3..fcbacd66475 100644
--- a/configure.in
+++ b/configure.in
@@ -1530,20 +1530,17 @@ AC_ARG_WITH(debug,
if test "$with_debug" = "yes"
then
# Medium debug.
- AC_DEFINE([DBUG_ON], [1], [Use libdbug])
- CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DSAFE_MUTEX $CFLAGS"
- CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS"
+ CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DDBUG_ON -DSAFE_MUTEX $CFLAGS"
+ CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DDBUG_ON -DSAFE_MUTEX $CXXFLAGS"
elif test "$with_debug" = "full"
then
# Full debug. Very slow in some cases
- AC_DEFINE([DBUG_ON], [1], [Use libdbug])
- CFLAGS="$DEBUG_CFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS"
- CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS"
+ CFLAGS="$DEBUG_CFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS"
+ CXXFLAGS="$DEBUG_CXXFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS"
else
# Optimized version. No debug
- AC_DEFINE([DBUG_OFF], [1], [Don't use libdbug])
- CFLAGS="$OPTIMIZE_CFLAGS $CFLAGS"
- CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS"
+ CFLAGS="$OPTIMIZE_CFLAGS -DDBUG_OFF $CFLAGS"
+ CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS"
fi
# If we should allow error injection tests
diff --git a/dbug/dbug.c b/dbug/dbug.c
index e377c78b3bd..831c69bcdfb 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -71,13 +71,10 @@
*
*/
-#include <my_global.h>
-
-/* This file won't compile unless DBUG_OFF is undefined locally */
#ifdef DBUG_OFF
#undef DBUG_OFF
#endif
-
+#include <my_global.h>
#include <m_string.h>
#include <errno.h>
#if defined(MSDOS) || defined(__WIN__)
diff --git a/extra/yassl/include/openssl/prefix_ssl.h b/extra/yassl/include/openssl/prefix_ssl.h
index 7f815156f47..0d740b6b97e 100644
--- a/extra/yassl/include/openssl/prefix_ssl.h
+++ b/extra/yassl/include/openssl/prefix_ssl.h
@@ -150,3 +150,4 @@
#define MD5_Init yaMD5_Init
#define MD5_Update yaMD5_Update
#define MD5_Final yaMD5_Final
+#define SSL_peek yaSSL_peek
diff --git a/include/config-netware.h b/include/config-netware.h
index e2fc75ab90d..c30fc099985 100644
--- a/include/config-netware.h
+++ b/include/config-netware.h
@@ -122,6 +122,10 @@ extern "C" {
/* On NetWare, to fix the problem with the deletion of open files */
#define CANT_DELETE_OPEN_FILES 1
+#define FN_LIBCHAR '\\'
+#define FN_ROOTDIR "\\"
+#define FN_DEVCHAR ':'
+
/* default directory information */
#define DEFAULT_MYSQL_HOME "sys:/mysql"
#define PACKAGE "mysql"
diff --git a/include/mysql.h b/include/mysql.h
index 72e5c457d5a..ae4a8222c5b 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -165,7 +165,6 @@ struct st_mysql_options {
char *ssl_ca; /* PEM CA file */
char *ssl_capath; /* PEM directory of CA-s? */
char *ssl_cipher; /* cipher to use */
- my_bool ssl_verify_server_cert; /* if to verify server cert */
char *shared_memory_base_name;
unsigned long max_allowed_packet;
my_bool use_ssl; /* if to use SSL or not */
diff --git a/include/mysql_com.h b/include/mysql_com.h
index cd75dbd6ab6..f1c48112467 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -138,8 +138,10 @@ enum enum_server_command
#define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */
#define CLIENT_RESERVED 16384 /* Old flag for 4.1 protocol */
#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */
-#define CLIENT_MULTI_STATEMENTS 65536 /* Enable/disable multi-stmt support */
-#define CLIENT_MULTI_RESULTS 131072 /* Enable/disable multi-results */
+#define CLIENT_MULTI_STATEMENTS (((ulong) 1) << 16) /* Enable/disable multi-stmt support */
+#define CLIENT_MULTI_RESULTS (((ulong) 1) << 17) /* Enable/disable multi-results */
+
+#define CLIENT_SSL_VERIFY_SERVER_CERT (((ulong) 1) << 30)
#define CLIENT_REMEMBER_OPTIONS (((ulong) 1) << 31)
#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index 7fa6fa1e23e..61bac05b224 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -24,7 +24,7 @@ benchdir_root= $(prefix)
testdir = $(benchdir_root)/mysql-test
EXTRA_SCRIPTS = mysql-test-run.sh install_test_db.sh valgrind.supp $(PRESCRIPTS)
EXTRA_DIST = $(EXTRA_SCRIPTS)
-GENSCRIPTS = mysql-test-run install_test_db
+GENSCRIPTS = mysql-test-run install_test_db mtr
PRESCRIPTS = mysql-test-run.pl
test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS)
test_DATA = std_data/client-key.pem std_data/client-cert.pem \
@@ -113,6 +113,10 @@ install-data-local:
uninstall-local:
@RM@ -f -r $(DESTDIR)$(testdir)
+# mtr - a shortcut for executing mysql-test-run.pl
+mtr:
+ $(RM) -f mtr
+ $(LN_S) mysql-test-run.pl mtr
SUFFIXES = .sh
diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl
index b0ba27e6736..daed111dfce 100644
--- a/mysql-test/lib/mtr_cases.pl
+++ b/mysql-test/lib/mtr_cases.pl
@@ -469,14 +469,6 @@ sub collect_one_test_case($$$$$$$) {
{
mtr_options_from_test_file($tinfo,"$testdir/${tname}.test");
- if ( ! $tinfo->{'innodb_test'} )
- {
- # mtr_verbose("Adding '--skip-innodb' to $tinfo->{'name'}");
- # FIXME activate the --skip-innodb only when running with
- # selected test cases
- # push(@{$tinfo->{'master_opt'}}, "--skip-innodb");
- }
-
if ( $tinfo->{'big_test'} and ! $::opt_big_test )
{
$tinfo->{'skip'}= 1;
diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl
index 0ab09a40b37..dd9d24ebc8e 100644
--- a/mysql-test/lib/mtr_misc.pl
+++ b/mysql-test/lib/mtr_misc.pl
@@ -139,6 +139,8 @@ sub mtr_copy_dir($$) {
my $from_dir= shift;
my $to_dir= shift;
+# mtr_verbose("Copying from $from_dir to $to_dir");
+
mkpath("$to_dir");
opendir(DIR, "$from_dir")
or mtr_error("Can't find $from_dir$!");
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index 42dd8f8d331..ab2af8c4ccf 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -115,6 +115,8 @@ sub spawn_impl ($$$$$$$$) {
my $pid_file= shift; # FIXME
my $spawn_opts= shift;
+ mtr_error("Can't spawn with empty \"path\"") unless defined $path;
+
if ( $::opt_script_debug )
{
print STDERR "\n";
@@ -702,7 +704,7 @@ sub mtr_check_stop_servers ($) {
}
else
{
- mtr_verbose("All ports where free, continuing");
+ mtr_verbose("All ports were free, continuing");
}
}
}
@@ -975,6 +977,7 @@ sub check_expected_crash_and_restart($)
sub mtr_record_dead_children () {
+ my $process_died= 0;
my $ret_pid;
# Wait without blockinng to see if any processes had died
@@ -983,7 +986,9 @@ sub mtr_record_dead_children () {
{
mtr_warning("mtr_record_dead_children: $ret_pid");
mark_process_dead($ret_pid);
+ $process_died= 1;
}
+ return $process_died;
}
sub start_reap_all {
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 13da2af0c45..ac9872ac2ab 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -216,7 +216,7 @@ our $opt_embedded_server;
our $opt_extern;
our $opt_fast;
our $opt_force;
-our $opt_reorder;
+our $opt_reorder= 1;
our $opt_enable_disabled;
our $opt_gcov;
@@ -258,6 +258,7 @@ our $opt_result_ext;
our $opt_skip;
our $opt_skip_rpl;
our $use_slaves;
+our $use_innodb;
our $opt_skip_test;
our $opt_skip_im;
@@ -357,9 +358,11 @@ sub run_benchmarks ($);
sub initialize_servers ();
sub mysql_install_db ();
sub install_db ($$);
+sub copy_install_db ($$);
sub run_testcase ($);
-sub run_testcase_stop_servers ($);
+sub run_testcase_stop_servers ($$$);
sub run_testcase_start_servers ($);
+sub run_testcase_check_skip_test($);
sub report_failure_and_restart ($);
sub do_before_start_master ($$);
sub do_before_start_slave ($$);
@@ -424,6 +427,7 @@ sub main () {
$need_ndbcluster||= $test->{ndb_test};
$need_im||= $test->{component_id} eq 'im';
$use_slaves||= $test->{slave_num};
+ $use_innodb||= $test->{'innodb_test'};
}
$opt_skip_ndbcluster= $opt_skip_ndbcluster_slave= 1
unless $need_ndbcluster;
@@ -1308,9 +1312,19 @@ sub executable_setup () {
}
+sub generate_cmdline_mysqldump ($) {
+ my($mysqld) = @_;
+ return
+ "$exe_mysqldump --no-defaults -uroot " .
+ "--port=$mysqld->{'port'} " .
+ "--socket=$mysqld->{'path_sock'} --password=";
+}
+
+
##############################################################################
#
-# Set environment to be used by childs of this process
+# Set environment to be used by childs of this process for
+# things that are constant duting the whole lifetime of mysql-test-run.pl
#
##############################################################################
@@ -1318,9 +1332,10 @@ sub executable_setup () {
sub environment_setup () {
- my $extra_ld_library_paths;
umask(022);
+ my $extra_ld_library_paths;
+
# --------------------------------------------------------------------------
# Setup LD_LIBRARY_PATH so the libraries from this distro/clone
# are used in favor of the system installed ones
@@ -1351,6 +1366,7 @@ sub environment_setup () {
# Also command lines in .opt files may contain env vars
# --------------------------------------------------------------------------
+ $ENV{'CHARSETSDIR'}= $path_charsetsdir;
$ENV{'UMASK'}= "0660"; # The octal *string*
$ENV{'UMASK_DIR'}= "0770"; # The octal *string*
$ENV{'LC_COLLATE'}= "C";
@@ -1368,10 +1384,28 @@ sub environment_setup () {
# $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME
$ENV{'MYSQL_TCP_PORT'}= 3306;
- $ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port;
- $ENV{'NDBCLUSTER_PORT_SLAVE'}=$opt_ndbcluster_port_slave;
- $ENV{'NDB_STATUS_OK'}= "YES";
+ $ENV{MTR_BUILD_THREAD}= 0 unless $ENV{MTR_BUILD_THREAD}; # Set if not set
+
+ # ----------------------------------------------------
+ # Setup env for NDB
+ # ----------------------------------------------------
+ $ENV{'NDB_MGM'}= $exe_ndb_mgm;
+
+ $ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port;
+ $ENV{'NDBCLUSTER_PORT_SLAVE'}= $opt_ndbcluster_port_slave;
+
+ $ENV{'NDB_EXTRA_TEST'}= $opt_ndb_extra_test;
+
+ $ENV{'NDB_BACKUP_DIR'}= $clusters->[0]->{'data_dir'};
+ $ENV{'NDB_DATA_DIR'}= $clusters->[0]->{'data_dir'};
+ $ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir;
+ $ENV{'NDB_TOOLS_OUTPUT'}= $file_ndb_testrun_log;
+ $ENV{'NDB_CONNECTSTRING'}= $opt_ndbconnectstring;
+
+ # ----------------------------------------------------
+ # Setup env for IM
+ # ----------------------------------------------------
$ENV{'IM_EXE'}= $exe_im;
$ENV{'IM_PATH_PID'}= $instance_manager->{path_pid};
$ENV{'IM_PATH_ANGEL_PID'}= $instance_manager->{path_angel_pid};
@@ -1386,9 +1420,174 @@ sub environment_setup () {
$ENV{'IM_MYSQLD2_PORT'}= $instance_manager->{instances}->[1]->{port};
$ENV{'IM_MYSQLD2_PATH_PID'}=$instance_manager->{instances}->[1]->{path_pid};
- $ENV{MTR_BUILD_THREAD}= 0 unless $ENV{MTR_BUILD_THREAD}; # Set if not set
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysqlcheck
+ # ----------------------------------------------------
+ my $cmdline_mysqlcheck=
+ "$exe_mysqlcheck --no-defaults -uroot " .
+ "--port=$master->[0]->{'port'} " .
+ "--socket=$master->[0]->{'path_sock'} --password=";
+
+ if ( $opt_debug )
+ {
+ $cmdline_mysqlcheck .=
+ " --debug=d:t:A,$opt_vardir_trace/log/mysqlcheck.trace";
+ }
+ $ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck;
+
+ # ----------------------------------------------------
+ # Setup env to childs can execute myqldump
+ # ----------------------------------------------------
+ my $cmdline_mysqldump= generate_cmdline_mysqldump($master->[0]);
+ my $cmdline_mysqldumpslave= generate_cmdline_mysqldump($slave->[0]);
+
+ if ( $opt_debug )
+ {
+ $cmdline_mysqldump .=
+ " --debug=d:t:A,$opt_vardir_trace/log/mysqldump-master.trace";
+ $cmdline_mysqldumpslave .=
+ " --debug=d:t:A,$opt_vardir_trace/log/mysqldump-slave.trace";
+ }
+ $ENV{'MYSQL_DUMP'}= $cmdline_mysqldump;
+ $ENV{'MYSQL_DUMP_SLAVE'}= $cmdline_mysqldumpslave;
+
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysqlslap
+ # ----------------------------------------------------
+ unless ( $glob_win32 )
+ {
+ my $cmdline_mysqlslap=
+ "$exe_mysqlslap -uroot " .
+ "--port=$master->[0]->{'port'} " .
+ "--socket=$master->[0]->{'path_sock'} --password= " .
+ "--lock-directory=$opt_tmpdir";
+
+ if ( $opt_debug )
+ {
+ $cmdline_mysqlslap .=
+ " --debug=d:t:A,$opt_vardir_trace/log/mysqlslap.trace";
+ }
+ $ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap;
+ }
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysqlimport
+ # ----------------------------------------------------
+ my $cmdline_mysqlimport=
+ "$exe_mysqlimport -uroot " .
+ "--port=$master->[0]->{'port'} " .
+ "--socket=$master->[0]->{'path_sock'} --password=";
+
+ if ( $opt_debug )
+ {
+ $cmdline_mysqlimport .=
+ " --debug=d:t:A,$opt_vardir_trace/log/mysqlimport.trace";
+ }
+ $ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport;
+
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysqlshow
+ # ----------------------------------------------------
+ my $cmdline_mysqlshow=
+ "$exe_mysqlshow -uroot " .
+ "--port=$master->[0]->{'port'} " .
+ "--socket=$master->[0]->{'path_sock'} --password=";
+
+ if ( $opt_debug )
+ {
+ $cmdline_mysqlshow .=
+ " --debug=d:t:A,$opt_vardir_trace/log/mysqlshow.trace";
+ }
+ $ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow;
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysqlbinlog
+ # ----------------------------------------------------
+ my $cmdline_mysqlbinlog=
+ "$exe_mysqlbinlog" .
+ " --no-defaults --local-load=$opt_tmpdir" .
+ " --character-sets-dir=$path_charsetsdir";
+
+ if ( $opt_debug )
+ {
+ $cmdline_mysqlbinlog .=
+ " --debug=d:t:A,$opt_vardir_trace/log/mysqlbinlog.trace";
+ }
+ $ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog;
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysql
+ # ----------------------------------------------------
+ my $cmdline_mysql=
+ "$exe_mysql --no-defaults --host=localhost --user=root --password= " .
+ "--port=$master->[0]->{'port'} " .
+ "--socket=$master->[0]->{'path_sock'}";
+
+ $ENV{'MYSQL'}= $cmdline_mysql;
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysql_client_test
+ # ----------------------------------------------------
+ my $cmdline_mysql_client_test=
+ "$exe_mysql_client_test --no-defaults --testcase --user=root --silent " .
+ "--port=$master->[0]->{'port'} " .
+ "--vardir=$opt_vardir " .
+ "--socket=$master->[0]->{'path_sock'}";
+
+ if ( $opt_debug )
+ {
+ $cmdline_mysql_client_test .=
+ " --debug=d:t:A,$opt_vardir_trace/log/mysql_client_test.trace";
+ }
+
+ if ( $glob_use_embedded_server )
+ {
+ $cmdline_mysql_client_test.=
+ " -A --language=$path_language" .
+ " -A --datadir=$slave->[0]->{'path_myddir'}" .
+ " -A --character-sets-dir=$path_charsetsdir";
+ }
+ $ENV{'MYSQL_CLIENT_TEST'}= $cmdline_mysql_client_test;
+
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysql_fix_system_tables
+ # ----------------------------------------------------
+ my $cmdline_mysql_fix_system_tables=
+ "$exe_mysql_fix_system_tables --no-defaults --host=localhost --user=root --password= " .
+ "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
+ "--port=$master->[0]->{'port'} " .
+ "--socket=$master->[0]->{'path_sock'}";
+
+ $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute my_print_defaults
+ # ----------------------------------------------------
+ $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= $exe_my_print_defaults;
+
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute perror
+ # ----------------------------------------------------
+ $ENV{'MY_PERROR'}= $exe_perror;
+
+ # ----------------------------------------------------
+ # Add the path where mysqld will find udf_example.so
+ # ----------------------------------------------------
+ $ENV{'UDF_EXAMPLE_LIB'}=
+ ($lib_udf_example ? basename($lib_udf_example) : "");
+
+ $ENV{'LD_LIBRARY_PATH'}=
+ ($lib_udf_example ? dirname($lib_udf_example) : "") .
+ ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : "");
+
+ # ----------------------------------------------------
# We are nice and report a bit about our settings
+ # ----------------------------------------------------
if (!$opt_extern)
{
print "Using MTR_BUILD_THREAD = $ENV{MTR_BUILD_THREAD}\n";
@@ -1756,6 +1955,23 @@ sub mysqld_wait_started($){
}
+sub ndb_mgmd_wait_started($) {
+ my ($cluster)= @_;
+
+ my $retries= 100;
+ while (ndbcluster_wait_started($cluster, "--no-contact") and
+ $retries)
+ {
+ # Millisceond sleep emulated with select
+ select(undef, undef, undef, (0.1));
+
+ $retries--;
+ }
+
+ return $retries == 0;
+
+}
+
sub ndb_mgmd_start ($) {
my $cluster= shift;
@@ -1776,13 +1992,12 @@ sub ndb_mgmd_start ($) {
"",
{ append_log_file => 1 });
-
# FIXME Should not be needed
# Unfortunately the cluster nodes will fail to start
# if ndb_mgmd has not started properly
- while (ndbcluster_wait_started($cluster, "--no-contact"))
+ if (ndb_mgmd_wait_started($cluster))
{
- select(undef, undef, undef, 0.1);
+ mtr_error("Failed to wait for start of ndb_mgmd");
}
# Remember pid of ndb_mgmd
@@ -1847,7 +2062,7 @@ sub ndbcluster_start ($$) {
mtr_error("Cluster '$cluster->{'name'}' already started");
}
- my $pid= ndb_mgmd_start($cluster);
+ ndb_mgmd_start($cluster);
for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ )
{
@@ -1958,6 +2173,11 @@ sub run_suite () {
foreach my $tinfo ( @$tests )
{
+ if (run_testcase_check_skip_test($tinfo))
+ {
+ next;
+ }
+
mtr_timer_start($glob_timers,"testcase", 60 * $opt_testcase_timeout);
run_testcase($tinfo);
mtr_timer_stop($glob_timers,"testcase");
@@ -2013,9 +2233,10 @@ sub initialize_servers () {
sub mysql_install_db () {
- # FIXME not exactly true I think, needs improvements
install_db('master', $master->[0]->{'path_myddir'});
- install_db('master', $master->[1]->{'path_myddir'});
+
+ # FIXME check if testcase really is using second master
+ copy_install_db('master', $master->[1]->{'path_myddir'});
if ( $use_slaves )
{
@@ -2029,10 +2250,8 @@ sub mysql_install_db () {
im_prepare_env($instance_manager);
}
-
my $cluster_started_ok= 1; # Assume it can be started
-
if (ndbcluster_start_install($clusters->[0]) ||
$use_slaves && ndbcluster_start_install($clusters->[1]))
{
@@ -2040,7 +2259,6 @@ sub mysql_install_db () {
$cluster_started_ok= 0;
}
-
foreach my $cluster (@{$clusters})
{
@@ -2058,6 +2276,9 @@ sub mysql_install_db () {
}
}
+ $ENV{'NDB_STATUS_OK'}= $clusters->[0]->{'installed_ok'};
+ $ENV{'NDB_SLAVE_STATUS_OK'}= $clusters->[1]->{'installed_ok'};;
+
if ( ! $cluster_started_ok )
{
if ( $opt_force)
@@ -2077,6 +2298,18 @@ sub mysql_install_db () {
}
+sub copy_install_db ($$) {
+ my $type= shift;
+ my $data_dir= shift;
+
+ mtr_report("Installing \u$type Database");
+
+ # Just copy the installed db from first master
+ mtr_copy_dir($master->[0]->{'path_myddir'}, $data_dir);
+
+}
+
+
sub install_db ($$) {
my $type= shift;
my $data_dir= shift;
@@ -2231,38 +2464,15 @@ sub im_prepare_data_dir($) {
foreach my $instance (@{$instance_manager->{'instances'}})
{
- install_db(
+ copy_install_db(
'im_mysqld_' . $instance->{'server_id'},
$instance->{'path_datadir'});
}
}
-
-##############################################################################
-#
-# Run a single test case
-#
-##############################################################################
-
-# When we get here, we have already filtered out test cases that doesn't
-# apply to the current setup, for example if we use a running server, test
-# cases that restart the server are dropped. So this function should mostly
-# be about doing things, not a lot of logic.
-
-# We don't start and kill the servers for each testcase. But some
-# testcases needs a restart, because they specify options to start
-# mysqld with. After that testcase, we need to restart again, to set
-# back the normal options.
-
-sub run_testcase ($) {
- my $tinfo= shift;
-
- my $tname= $tinfo->{'name'};
-
- mtr_tonewfile($path_current_test_log,"$tname\n"); # Always tell where we are
-
- # output current test to ndbcluster log file to enable diagnostics
- mtr_tofile($file_ndb_testrun_log,"CURRENT TEST $tname\n");
+sub run_testcase_check_skip_test($)
+{
+ my ($tinfo)= @_;
# ----------------------------------------------------------------------
# If marked to skip, just print out and return.
@@ -2275,7 +2485,7 @@ sub run_testcase ($) {
{
mtr_report_test_name($tinfo);
mtr_report_test_skipped($tinfo);
- return;
+ return 1;
}
# If test needs cluster, check that master installed ok
@@ -2283,7 +2493,7 @@ sub run_testcase ($) {
{
mtr_report_test_name($tinfo);
mtr_report_test_failed($tinfo);
- return;
+ return 1;
}
# If test needs slave cluster, check that it installed ok
@@ -2292,65 +2502,103 @@ sub run_testcase ($) {
{
mtr_report_test_name($tinfo);
mtr_report_test_failed($tinfo);
- return;
+ return 1;
}
- run_testcase_stop_servers($tinfo);
+ return 0;
+}
- # ----------------------------------------------------------------------
- # Prepare to start masters. Even if we use embedded, we want to run
- # the preparation.
- # ----------------------------------------------------------------------
- $ENV{'TZ'}= $tinfo->{'timezone'};
+sub do_before_run_mysqltest($)
+{
+ my $tinfo= shift;
+ my $tname= $tinfo->{'name'};
+
+ # Remove old reject file
+ if ( $opt_suite eq "main" )
+ {
+ unlink("r/$tname.reject");
+ }
+ else
+ {
+ unlink("suite/$opt_suite/r/$tname.reject");
+ }
+
+
+# MASV cleanup...
+ mtr_tonewfile($path_current_test_log,"$tname\n"); # Always tell where we are
+
+ # output current test to ndbcluster log file to enable diagnostics
+ mtr_tofile($file_ndb_testrun_log,"CURRENT TEST $tname\n");
mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n");
if ( $master->[1]->{'pid'} )
{
mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
}
+}
- # ----------------------------------------------------------------------
- # If any mysqld servers running died, we have to know
- # ----------------------------------------------------------------------
+sub do_after_run_mysqltest($)
+{
+ my $tinfo= shift;
+ my $tname= $tinfo->{'name'};
- mtr_record_dead_children();
+ #MASV cleanup
+ # Save info from this testcase run to mysqltest.log
+ my $testcase_log= mtr_fromfile($path_timefile) if -f $path_timefile;
+ mtr_tofile($path_mysqltest_log,"CURRENT TEST $tname\n");
+ mtr_tofile($path_mysqltest_log, $testcase_log);
+ }
- # ----------------------------------------------------------------------
- # Start masters needed by the testcase
- # ----------------------------------------------------------------------
- run_testcase_start_servers($tinfo);
+
+##############################################################################
+#
+# Run a single test case
+#
+##############################################################################
+
+# When we get here, we have already filtered out test cases that doesn't
+# apply to the current setup, for example if we use a running server, test
+# cases that restart the server are dropped. So this function should mostly
+# be about doing things, not a lot of logic.
+
+# We don't start and kill the servers for each testcase. But some
+# testcases needs a restart, because they specify options to start
+# mysqld with. After that testcase, we need to restart again, to set
+# back the normal options.
+
+sub run_testcase ($) {
+ my $tinfo= shift;
+
+ my $master_restart= run_testcase_need_master_restart($tinfo);
+ my $slave_restart= run_testcase_need_slave_restart($tinfo);
+
+ if ($master_restart or $slave_restart)
+ {
+ run_testcase_stop_servers($tinfo, $master_restart, $slave_restart);
+ }
+
+ my $died= mtr_record_dead_children();
+ if ($died or $master_restart or $slave_restart)
+ {
+ run_testcase_start_servers($tinfo);
+ }
# ----------------------------------------------------------------------
# If --start-and-exit or --start-dirty given, stop here to let user manually
# run tests
# ----------------------------------------------------------------------
-
if ( $opt_start_and_exit or $opt_start_dirty )
{
mtr_report("\nServers started, exiting");
exit(0);
}
- # ----------------------------------------------------------------------
- # Run the test case
- # ----------------------------------------------------------------------
-
- mtr_report_test_name($tinfo);
-
{
- # remove the old reject file
- if ( $opt_suite eq "main" )
- {
- unlink("r/$tname.reject");
- }
- else
- {
- unlink("suite/$opt_suite/r/$tname.reject");
- }
- unlink($path_timefile);
+ do_before_run_mysqltest($tinfo);
my $res= run_mysqltest($tinfo);
+ mtr_report_test_name($tinfo);
if ( $res == 0 )
{
mtr_report_test_passed($tinfo);
@@ -2362,7 +2610,8 @@ sub run_testcase ($) {
# Try to get reason from mysqltest.log
my $last_line= mtr_lastlinefromfile($path_timefile) if -f $path_timefile;
my $reason= mtr_match_prefix($last_line, "reason: ");
- $tinfo->{'comment'}= defined $reason ? $reason : "Detected by testcase(reason unknown) ";
+ $tinfo->{'comment'}=
+ defined $reason ? $reason : "Detected by testcase(reason unknown) ";
mtr_report_test_skipped($tinfo);
}
elsif ( $res == 63 )
@@ -2382,10 +2631,8 @@ sub run_testcase ($) {
report_failure_and_restart($tinfo);
}
- # Save info from this testcase run to mysqltest.log
- my $testcase_log= mtr_fromfile($path_timefile) if -f $path_timefile;
- mtr_tofile($path_mysqltest_log,"CURRENT TEST $tname\n");
- mtr_tofile($path_mysqltest_log, $testcase_log);
+
+ do_after_run_mysqltest($tinfo);
}
# ----------------------------------------------------------------------
@@ -2650,7 +2897,7 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--datadir=%s", $prefix,
$master->[$idx]->{'path_myddir'});
- if ( $idx > 0 )
+ if ( $idx > 0 or !$use_innodb)
{
mtr_add_arg($args, "%s--skip-innodb", $prefix);
}
@@ -2999,24 +3246,9 @@ sub stop_all_servers () {
}
-# ----------------------------------------------------------------------
-# If not using a running servers we may need to stop and restart.
-# We restart in the case we have initiation scripts, server options
-# etc to run. But we also restart again after the test first restart
-# and test is run, to get back to normal server settings.
-#
-# To make the code a bit more clean, we actually only stop servers
-# here, and mark this to be done. Then a generic "start" part will
-# start up the needed servers again.
-# ----------------------------------------------------------------------
-
-sub run_testcase_stop_servers($) {
- my $tinfo= shift;
-
- if ( $glob_use_running_server || $glob_use_embedded_server )
- {
- return;
- }
+sub run_testcase_need_master_restart($)
+{
+ my ($tinfo)= @_;
# We try to find out if we are to restart the master(s)
my $do_restart= 0; # Assumes we don't have to
@@ -3073,6 +3305,91 @@ sub run_testcase_stop_servers($) {
join(" ", @{$master->[0]->{'start_opts'}}) . "'" );
}
+ return $do_restart;
+}
+
+sub run_testcase_need_slave_restart($)
+{
+ my ($tinfo)= @_;
+
+ # We try to find out if we are to restart the slaves
+ my $do_slave_restart= 0; # Assumes we don't have to
+
+ # FIXME only restart slave when necessary
+ $do_slave_restart= 1;
+
+# if ( ! $slave->[0]->{'pid'} )
+# {
+# # mtr_verbose("Slave not started, no need to check slave restart");
+# }
+# elsif ( $do_restart )
+# {
+# $do_slave_restart= 1; # Always restart if master restart
+# mtr_verbose("Restart slave because: Master restart");
+# }
+# elsif ( $tinfo->{'slave_sh'} )
+# {
+# $do_slave_restart= 1; # Always restart if script to run
+# mtr_verbose("Restart slave because: Always restart if script to run");
+# }
+# elsif ( ! $opt_skip_ndbcluster_slave and
+# $tinfo->{'ndb_test'} == 0 and
+# $clusters->[1]->{'pid'} != 0 )
+# {
+# $do_slave_restart= 1; # Restart without slave cluster
+# mtr_verbose("Restart slave because: Test does not need slave cluster");
+# }
+# elsif ( ! $opt_with_ndbcluster_slave and
+# $tinfo->{'ndb_test'} == 1 and
+# $clusters->[1]->{'pid'} == 0 )
+# {
+# $do_slave_restart= 1; # Restart with slave cluster
+# mtr_verbose("Restart slave because: Test need slave cluster");
+# }
+# elsif ( $tinfo->{'slave_restart'} )
+# {
+# $do_slave_restart= 1;
+# mtr_verbose("Restart slave because: slave_restart");
+# }
+# elsif ( $slave->[0]->{'running_slave_is_special'} )
+# {
+# $do_slave_restart= 1;
+# mtr_verbose("Restart slave because: running_slave_is_special");
+# }
+# # Check that running slave was started with same options
+# # as the current test requires
+# elsif (! mtr_same_opts($slave->[0]->{'start_opts'},
+# $tinfo->{'slave_opt'}) )
+# {
+# $do_slave_restart= 1;
+# mtr_verbose("Restart slave because: running with different options '" .
+# join(" ", @{$tinfo->{'slave_opt'}}) . "' != '" .
+# join(" ", @{$slave->[0]->{'start_opts'}}) . "'" );
+# }
+
+ return $do_slave_restart;
+
+}
+
+# ----------------------------------------------------------------------
+# If not using a running servers we may need to stop and restart.
+# We restart in the case we have initiation scripts, server options
+# etc to run. But we also restart again after the test first restart
+# and test is run, to get back to normal server settings.
+#
+# To make the code a bit more clean, we actually only stop servers
+# here, and mark this to be done. Then a generic "start" part will
+# start up the needed servers again.
+# ----------------------------------------------------------------------
+
+sub run_testcase_stop_servers($$$) {
+ my ($tinfo, $do_restart, $do_slave_restart)= @_;
+
+ if ( $glob_use_running_server || $glob_use_embedded_server )
+ {
+ return;
+ }
+
my $pid;
my %admin_pids; # hash of admin processes that requests shutdown
my @kill_pids; # list of processes to shutdown/kill
@@ -3130,62 +3447,7 @@ sub run_testcase_stop_servers($) {
}
}
- # We try to find out if we are to restart the slaves
- my $do_slave_restart= 0; # Assumes we don't have to
-
- # FIXME only restaret when necessary
- $do_slave_restart= 1;
-
-# if ( ! $slave->[0]->{'pid'} )
-# {
-# # mtr_verbose("Slave not started, no need to check slave restart");
-# }
-# elsif ( $do_restart )
-# {
-# $do_slave_restart= 1; # Always restart if master restart
-# mtr_verbose("Restart slave because: Master restart");
-# }
-# elsif ( $tinfo->{'slave_sh'} )
-# {
-# $do_slave_restart= 1; # Always restart if script to run
-# mtr_verbose("Restart slave because: Always restart if script to run");
-# }
-# elsif ( ! $opt_skip_ndbcluster_slave and
-# $tinfo->{'ndb_test'} == 0 and
-# $clusters->[1]->{'pid'} != 0 )
-# {
-# $do_slave_restart= 1; # Restart without slave cluster
-# mtr_verbose("Restart slave because: Test does not need slave cluster");
-# }
-# elsif ( ! $opt_with_ndbcluster_slave and
-# $tinfo->{'ndb_test'} == 1 and
-# $clusters->[1]->{'pid'} == 0 )
-# {
-# $do_slave_restart= 1; # Restart with slave cluster
-# mtr_verbose("Restart slave because: Test need slave cluster");
-# }
-# elsif ( $tinfo->{'slave_restart'} )
-# {
-# $do_slave_restart= 1;
-# mtr_verbose("Restart slave because: slave_restart");
-# }
-# elsif ( $slave->[0]->{'running_slave_is_special'} )
-# {
-# $do_slave_restart= 1;
-# mtr_verbose("Restart slave because: running_slave_is_special");
-# }
-# # Check that running slave was started with same options
-# # as the current test requires
-# elsif (! mtr_same_opts($slave->[0]->{'start_opts'},
-# $tinfo->{'slave_opt'}) )
-# {
-# $do_slave_restart= 1;
-# mtr_verbose("Restart slave because: running with different options '" .
-# join(" ", @{$tinfo->{'slave_opt'}}) . "' != '" .
-# join(" ", @{$slave->[0]->{'start_opts'}}) . "'" );
-# }
-
- if ( $do_slave_restart )
+ if ( $do_restart || $do_slave_restart )
{
delete $slave->[0]->{'running_slave_is_special'}; # Forget history
@@ -3439,136 +3701,9 @@ sub run_check_testcase ($$) {
}
-sub generate_cmdline_mysqldump ($) {
- my($info) = @_;
- return
- "$exe_mysqldump --no-defaults -uroot " .
- "--port=$info->[0]->{'port'} " .
- "--socket=$info->[0]->{'path_sock'} --password=";
-}
sub run_mysqltest ($) {
- my $tinfo= shift;
- my $cmdline_mysqlcheck= "$exe_mysqlcheck --no-defaults -uroot " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'} --password=";
- if ( $opt_debug )
- {
- $cmdline_mysqlcheck .=
- " --debug=d:t:A,$opt_vardir_trace/log/mysqlcheck.trace";
- }
-
- my $cmdline_mysqldump= generate_cmdline_mysqldump $master;
- my $cmdline_mysqldumpslave= generate_cmdline_mysqldump $slave;
-
- if ( $opt_debug )
- {
- $cmdline_mysqldump .=
- " --debug=d:t:A,$opt_vardir_trace/log/mysqldump-master.trace";
- $cmdline_mysqldumpslave .=
- " --debug=d:t:A,$opt_vardir_trace/log/mysqldump-slave.trace";
- }
-
- my $cmdline_mysqlslap;
-
- unless ( $glob_win32 )
- {
- $cmdline_mysqlslap= "$exe_mysqlslap -uroot " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'} --password= " .
- "--lock-directory=$opt_tmpdir";
- if ( $opt_debug )
- {
- $cmdline_mysqlslap .=
- " --debug=d:t:A,$opt_vardir_trace/log/mysqlslap.trace";
- }
- }
-
- my $cmdline_mysqlimport= "$exe_mysqlimport -uroot " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'} --password=";
- if ( $opt_debug )
- {
- $cmdline_mysqlimport .=
- " --debug=d:t:A,$opt_vardir_trace/log/mysqlimport.trace";
- }
-
- my $cmdline_mysqlshow= "$exe_mysqlshow -uroot " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'} --password=";
- if ( $opt_debug )
- {
- $cmdline_mysqlshow .=
- " --debug=d:t:A,$opt_vardir_trace/log/mysqlshow.trace";
- }
-
- my $cmdline_mysqlbinlog=
- "$exe_mysqlbinlog" .
- " --no-defaults --local-load=$opt_tmpdir" .
- " --character-sets-dir=$path_charsetsdir";
-
- if ( $opt_debug )
- {
- $cmdline_mysqlbinlog .=
- " --debug=d:t:A,$opt_vardir_trace/log/mysqlbinlog.trace";
- }
-
- my $cmdline_mysql=
- "$exe_mysql --no-defaults --host=localhost --user=root --password= " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'}";
-
- my $cmdline_mysql_client_test=
- "$exe_mysql_client_test --no-defaults --testcase --user=root --silent " .
- "--port=$master->[0]->{'port'} " .
- "--vardir=$opt_vardir " .
- "--socket=$master->[0]->{'path_sock'}";
-
- if ( $opt_debug )
- {
- $cmdline_mysql_client_test .=
- " --debug=d:t:A,$opt_vardir_trace/log/mysql_client_test.trace";
- }
-
- if ( $glob_use_embedded_server )
- {
- $cmdline_mysql_client_test.=
- " -A --language=$path_language" .
- " -A --datadir=$slave->[0]->{'path_myddir'}" .
- " -A --character-sets-dir=$path_charsetsdir";
- }
-
- my $cmdline_mysql_fix_system_tables=
- "$exe_mysql_fix_system_tables --no-defaults --host=localhost --user=root --password= " .
- "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'}";
-
- $ENV{'MYSQL'}= $cmdline_mysql;
- $ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck;
- $ENV{'MYSQL_DUMP'}= $cmdline_mysqldump;
- $ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap unless $glob_win32;
- $ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport;
- $ENV{'MYSQL_DUMP_SLAVE'}= $cmdline_mysqldumpslave;
- $ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow;
- $ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog;
- $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
- $ENV{'MYSQL_CLIENT_TEST'}= $cmdline_mysql_client_test;
- $ENV{'CHARSETSDIR'}= $path_charsetsdir;
- $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= $exe_my_print_defaults;
- $ENV{'UDF_EXAMPLE_LIB'}=
- ($lib_udf_example ? basename($lib_udf_example) : "");
- $ENV{'MY_PERROR'}= $exe_perror;
-
- $ENV{'NDB_STATUS_OK'}= $clusters->[0]->{'installed_ok'};
- $ENV{'NDB_SLAVE_STATUS_OK'}= $clusters->[0]->{'installed_ok'};;
- $ENV{'NDB_EXTRA_TEST'}= $opt_ndb_extra_test;
- $ENV{'NDB_MGM'}= $exe_ndb_mgm;
- $ENV{'NDB_BACKUP_DIR'}= $clusters->[0]->{'data_dir'};
- $ENV{'NDB_DATA_DIR'}= $clusters->[0]->{'data_dir'};
- $ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir;
- $ENV{'NDB_TOOLS_OUTPUT'}= $file_ndb_testrun_log;
- $ENV{'NDB_CONNECTSTRING'}= $opt_ndbconnectstring;
+ my ($tinfo)= @_;
my $exe= $exe_mysqltest;
my $args;
@@ -3647,7 +3782,8 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
- mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace", $opt_vardir_trace);
+ mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace",
+ $opt_vardir_trace);
}
if ( $opt_ssl_supported )
@@ -3660,9 +3796,9 @@ sub run_mysqltest ($) {
$glob_mysql_test_dir);
}
- # Turn on SSL for all test cases
if ( $opt_ssl )
{
+ # Turn on SSL for _all_ test cases if option --ssl was used
mtr_add_arg($args, "--ssl",
$glob_mysql_test_dir);
}
@@ -3744,6 +3880,11 @@ sub run_mysqltest ($) {
}
}
+ # -------------------------------------------------------
+ # Init variables that change for each testcase
+ # -------------------------------------------------------
+ $ENV{'TZ'}= $tinfo->{'timezone'};
+
my $res = mtr_run_test($exe,$args,"","",$path_timefile,"");
if ( $opt_check_testcases )
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index dc2bb4c6c73..4382d864bde 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -730,6 +730,49 @@ id MIN(s)
1 ZZZ
2 ZZZ
DROP TABLE t1;
+drop table if exists bug20536;
+set names latin1;
+create table bug20536 (id bigint not null auto_increment primary key, name
+varchar(255) character set ucs2 not null);
+insert into `bug20536` (`id`,`name`) values (1, _latin1 x'7465737431'), (2, "'test\\_2'");
+select md5(name) from bug20536;
+md5(name)
+f4b7ce8b45a20e3c4e84bef515d1525c
+48d95db0d8305c2fe11548a3635c9385
+select sha1(name) from bug20536;
+sha1(name)
+e0b52f38deddb9f9e8d5336b153592794cb49baf
+677d4d505355eb5b0549b865fcae4b7f0c28aef5
+select make_set(3, name, upper(name)) from bug20536;
+make_set(3, name, upper(name))
+test1,TEST1
+'test\_2','TEST\_2'
+select export_set(5, name, upper(name)) from bug20536;
+export_set(5, name, upper(name))
+test1,TEST1,test1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1
+'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2'
+select export_set(5, name, upper(name), ",", 5) from bug20536;
+export_set(5, name, upper(name), ",", 5)
+test1,TEST1,test1,TEST1,TEST1
+'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2'
+select password(name) from bug20536;
+password(name)
+????????????????????
+????????????????????
+select old_password(name) from bug20536;
+old_password(name)
+????????
+????????
+select encrypt(name, 'SALT') from bug20536;
+encrypt(name, 'SALT')
+SA5pDi1UPZdys
+SA5pDi1UPZdys
+select quote(name) from bug20536;
+quote(name)
+????????
+????????????????
+drop table bug20536;
+End of 4.1 tests
CREATE TABLE t1 (a varchar(64) character set ucs2, b decimal(10,3));
INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0);
update t1 set b=a;
@@ -765,3 +808,4 @@ blob 65535 65535
text 65535 65535
text 65535 32767
drop table t1;
+End of 5.0 tests
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index 10d20c001f1..f383a717a85 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -87,6 +87,10 @@ SELECT IS_USED_LOCK('bug16501');
IS_USED_LOCK('bug16501')
NULL
DROP TABLE t1;
+select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
+export_set(3, _latin1'foo', _utf8'bar', ',', 4)
+foo,foo,bar,bar
+End of 4.1 tests
create table t1 as select uuid(), length(uuid());
show create table t1;
Table Create Table
@@ -130,3 +134,4 @@ timediff(b, a) >= '00:00:03'
drop table t2;
drop table t1;
set global query_cache_size=default;
+End of 5.0 tests
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 3034fc2035e..e26e6fb271a 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -1295,24 +1295,16 @@ insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
select count(*) from t1;
count(*)
-29267
+623
explain select * from t1 where c between 1 and 2500;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 5 NULL # Using where
update t1 set c=a;
explain select * from t1 where c between 1 and 2500;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 5 NULL # Using where
+1 SIMPLE t1 ALL c NULL NULL NULL # Using where
drop table t1,t2;
create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb;
insert into t1 (id) values (null),(null),(null),(null),(null);
@@ -1786,10 +1778,10 @@ Variable_name Value
Innodb_rows_deleted 2070
show status like "Innodb_rows_inserted";
Variable_name Value
-Innodb_rows_inserted 31727
+Innodb_rows_inserted 3083
show status like "Innodb_rows_updated";
Variable_name Value
-Innodb_rows_updated 29530
+Innodb_rows_updated 886
show status like "Innodb_row_lock_waits";
Variable_name Value
Innodb_row_lock_waits 0
diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
index ba4e9daf7cb..99633f5e12a 100644
--- a/mysql-test/r/mysql.result
+++ b/mysql-test/r/mysql.result
@@ -59,16 +59,16 @@ database()
test
unlock tables;
drop table t1;
-ソ
-ソ
+\
+\
c_cp932
+\
+\
+\
-ソ
-ソ
-ソ
-ソ
-ソ
+\
+\
+----------------------+------------+--------+
| concat('>',col1,'<') | col2 | col3 |
+----------------------+------------+--------+
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 3b4f223afbf..eb26b0324e7 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -2925,7 +2925,22 @@ mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SU
grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
drop table t1;
drop user mysqltest_1@localhost;
+create database mysqldump_myDB;
+use mysqldump_myDB;
+create user myDB_User;
+grant create view, select on mysqldump_myDB.* to myDB_User@localhost;
+create table t1 (c1 int);
+insert into t1 values (3);
+use mysqldump_myDB;
+create view v1 (c1) as select * from t1;
+use mysqldump_myDB;
+drop view v1;
+drop table t1;
+revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
+drop user myDB_User;
+drop database mysqldump_myDB;
End of 5.0 tests
+use test;
create table t1 (a text , b text);
create table t2 (a text , b text);
insert t1 values ("Duck, Duck", "goose");
diff --git a/mysql-test/r/ndb_dd_advance.result b/mysql-test/r/ndb_dd_advance.result
index 09fe75805d5..64c30aab9ab 100644
--- a/mysql-test/r/ndb_dd_advance.result
+++ b/mysql-test/r/ndb_dd_advance.result
@@ -226,7 +226,7 @@ t1 CREATE TABLE `t1` (
`b` int(11) NOT NULL,
`c` int(11) NOT NULL,
PRIMARY KEY (`pk1`)
-) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t2 TABLESPACE table_space1 STORAGE DISK
ENGINE=NDB;
SHOW CREATE TABLE test.t2;
@@ -236,7 +236,7 @@ t2 CREATE TABLE `t2` (
`b2` int(11) NOT NULL,
`c2` int(11) NOT NULL,
PRIMARY KEY (`pk2`)
-) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t1 ENGINE=NDBCLUSTER;
SHOW CREATE TABLE test.t1;
Table Create Table
@@ -331,7 +331,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
-) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -931,7 +931,7 @@ t1 CREATE TABLE `t1` (
`a1` int(11) DEFAULT NULL,
`a2` blob,
`a3` text
-) TABLESPACE ts STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
DROP TABLE test.t1;
CREATE TABLE test.t1 (a1 INT, a2 BLOB, a3 TEXT) ENGINE=MyISAM;
SHOW CREATE TABLE test.t1;
@@ -950,7 +950,7 @@ t1 CREATE TABLE `t1` (
`a1` int(11) DEFAULT NULL,
`a2` blob,
`a3` text
-) TABLESPACE ts STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
DROP TABLE test.t1;
CREATE TABLE test.t1 (a1 INT PRIMARY KEY, a2 BLOB, a3 TEXT) TABLESPACE ts STORAGE DISK ENGINE=NDB;
SHOW CREATE TABLE test.t1;
@@ -960,7 +960,7 @@ t1 CREATE TABLE `t1` (
`a2` blob,
`a3` text,
PRIMARY KEY (`a1`)
-) TABLESPACE ts STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t1 ENGINE=InnoDB;
SHOW CREATE TABLE test.t1;
Table Create Table
@@ -980,7 +980,7 @@ t1 CREATE TABLE `t1` (
`a1` int(11) DEFAULT NULL,
`a2` blob,
`a3` text
-) TABLESPACE ts STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t1 ENGINE=MyISAM;
SHOW CREATE TABLE test.t1;
Table Create Table
diff --git a/mysql-test/r/ndb_dd_advance2.result b/mysql-test/r/ndb_dd_advance2.result
index c7fcda650e6..86dc8df3b15 100644
--- a/mysql-test/r/ndb_dd_advance2.result
+++ b/mysql-test/r/ndb_dd_advance2.result
@@ -30,7 +30,7 @@ t1 CREATE TABLE `t1` (
`a2` varchar(256) DEFAULT NULL,
`a3` blob,
PRIMARY KEY (`a1`)
-) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
SHOW CREATE TABLE test.t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -38,7 +38,7 @@ t2 CREATE TABLE `t2` (
`a2` varchar(256) DEFAULT NULL,
`a3` blob,
PRIMARY KEY (`a1`)
-) TABLESPACE ts2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
INSERT INTO test.t1 VALUES (1,'111111','aaaaaaaa');
INSERT INTO test.t1 VALUES (2,'222222','bbbbbbbb');
SELECT * FROM test.t1 ORDER BY a1;
@@ -93,7 +93,7 @@ t1 CREATE TABLE `t1` (
`a2` varchar(5000) DEFAULT NULL,
`a3` blob,
PRIMARY KEY (`a1`)
-) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
SHOW CREATE TABLE test.t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -101,7 +101,7 @@ t2 CREATE TABLE `t2` (
`a2` varchar(5000) DEFAULT NULL,
`a3` blob,
PRIMARY KEY (`a1`)
-) TABLESPACE ts2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
INSERT INTO test.t1 VALUES (1,@vc1,@d1);
INSERT INTO test.t1 VALUES (2,@vc2,@b1);
INSERT INTO test.t1 VALUES (3,@vc3,@d2);
diff --git a/mysql-test/r/ndb_dd_backuprestore.result b/mysql-test/r/ndb_dd_backuprestore.result
index 705881ee20a..3c0815cbec8 100644
--- a/mysql-test/r/ndb_dd_backuprestore.result
+++ b/mysql-test/r/ndb_dd_backuprestore.result
@@ -175,7 +175,7 @@ t1 CREATE TABLE `t1` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
-) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */
+) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */
SHOW CREATE TABLE test.t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -184,7 +184,7 @@ t2 CREATE TABLE `t2` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
-) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
SHOW CREATE TABLE test.t3;
Table Create Table
t3 CREATE TABLE `t3` (
@@ -193,7 +193,7 @@ t3 CREATE TABLE `t3` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
-) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */
+) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */
SHOW CREATE TABLE test.t4;
Table Create Table
t4 CREATE TABLE `t4` (
@@ -341,7 +341,7 @@ t1 CREATE TABLE `t1` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
-) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */
+) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */
SHOW CREATE TABLE test.t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -350,7 +350,7 @@ t2 CREATE TABLE `t2` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
-) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
+) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
SHOW CREATE TABLE test.t3;
Table Create Table
t3 CREATE TABLE `t3` (
@@ -359,7 +359,7 @@ t3 CREATE TABLE `t3` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
-) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */
+) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */
SHOW CREATE TABLE test.t4;
Table Create Table
t4 CREATE TABLE `t4` (
diff --git a/mysql-test/r/ndb_dd_basic.result b/mysql-test/r/ndb_dd_basic.result
index 6c10fbe63b3..5a7e70e796d 100644
--- a/mysql-test/r/ndb_dd_basic.result
+++ b/mysql-test/r/ndb_dd_basic.result
@@ -49,7 +49,7 @@ t1 CREATE TABLE `t1` (
`b` int(11) NOT NULL,
`c` int(11) NOT NULL,
PRIMARY KEY (`pk1`)
-) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (0, 0, 0);
SELECT * FROM t1;
pk1 b c
diff --git a/mysql-test/r/ndb_dd_disk2memory.result b/mysql-test/r/ndb_dd_disk2memory.result
index bd5bbda42f3..9084ddc3e16 100644
--- a/mysql-test/r/ndb_dd_disk2memory.result
+++ b/mysql-test/r/ndb_dd_disk2memory.result
@@ -226,7 +226,7 @@ t1 CREATE TABLE `t1` (
`b` int(11) NOT NULL,
`c` int(11) NOT NULL,
PRIMARY KEY (`pk1`)
-) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t2 TABLESPACE table_space1 STORAGE DISK
ENGINE=NDB;
SHOW CREATE TABLE test.t2;
@@ -236,7 +236,7 @@ t2 CREATE TABLE `t2` (
`b2` int(11) NOT NULL,
`c2` int(11) NOT NULL,
PRIMARY KEY (`pk2`)
-) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
+) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t1 ENGINE=NDBCLUSTER;
SHOW CREATE TABLE test.t1;
Table Create Table
diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result
index 1fcfb11525e..8f9fd50eced 100644
--- a/mysql-test/r/openssl_1.result
+++ b/mysql-test/r/openssl_1.result
@@ -3,9 +3,12 @@ create table t1(f1 int);
insert into t1 values (5);
grant select on test.* to ssl_user1@localhost require SSL;
grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA";
-grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/emailAddress=abstract.mysql.developer@mysql.com";
-grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/emailAddress=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/emailAddress=abstract.mysql.developer@mysql.com";
+grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB";
+grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB" ISSUER "/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB";
+grant select on test.* to ssl_user5@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "xxx";
flush privileges;
+connect(localhost,ssl_user5,,test,MASTER_PORT,MASTER_SOCKET);
+ERROR 28000: Access denied for user 'ssl_user5'@'localhost' (using password: NO)
SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA
@@ -39,7 +42,7 @@ f1
delete from t1;
ERROR 42000: DELETE command denied to user 'ssl_user4'@'localhost' for table 't1'
drop user ssl_user1@localhost, ssl_user2@localhost,
-ssl_user3@localhost, ssl_user4@localhost;
+ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost;
drop table t1;
mysqltest: Could not open connection 'default': 2026 SSL connection error
mysqltest: Could not open connection 'default': 2026 SSL connection error
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 2e2af07bfdc..d8d433ef216 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -1134,12 +1134,12 @@ partition by range (a)
subpartition by hash (a)
(partition p0 VALUES LESS THAN (1) DATA DIRECTORY = 'hello/master-data/tmpdata' INDEX DIRECTORY = 'hello/master-data/tmpinx'
(SUBPARTITION subpart00, SUBPARTITION subpart01));
+hello/master-data/test/t1.frm
+hello/master-data/test/t1.par
hello/master-data/test/t1#P#p0#SP#subpart00.MYD
hello/master-data/test/t1#P#p0#SP#subpart00.MYI
hello/master-data/test/t1#P#p0#SP#subpart01.MYD
hello/master-data/test/t1#P#p0#SP#subpart01.MYI
-hello/master-data/test/t1.frm
-hello/master-data/test/t1.par
hello/master-data/tmpdata/t1#P#p0#SP#subpart00.MYD
hello/master-data/tmpdata/t1#P#p0#SP#subpart01.MYD
hello/master-data/tmpinx/t1#P#p0#SP#subpart00.MYI
@@ -1149,6 +1149,8 @@ ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
(SUBPARTITION subpart10, SUBPARTITION subpart11),
partition p2 VALUES LESS THAN (2) DATA DIRECTORY = 'hello/master-data/tmpdata' INDEX DIRECTORY = 'hello/master-data/tmpinx'
(SUBPARTITION subpart20, SUBPARTITION subpart21));
+hello/master-data/test/t1.frm
+hello/master-data/test/t1.par
hello/master-data/test/t1#P#p1#SP#subpart10.MYD
hello/master-data/test/t1#P#p1#SP#subpart10.MYI
hello/master-data/test/t1#P#p1#SP#subpart11.MYD
@@ -1157,8 +1159,6 @@ hello/master-data/test/t1#P#p2#SP#subpart20.MYD
hello/master-data/test/t1#P#p2#SP#subpart20.MYI
hello/master-data/test/t1#P#p2#SP#subpart21.MYD
hello/master-data/test/t1#P#p2#SP#subpart21.MYI
-hello/master-data/test/t1.frm
-hello/master-data/test/t1.par
hello/master-data/tmpdata/t1#P#p1#SP#subpart10.MYD
hello/master-data/tmpdata/t1#P#p1#SP#subpart11.MYD
hello/master-data/tmpdata/t1#P#p2#SP#subpart20.MYD
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 3b6bfc60a80..b55d8d9ef5a 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -689,6 +689,12 @@ select @@log_queries_not_using_indexes;
show variables like 'log_queries_not_using_indexes';
Variable_name Value
log_queries_not_using_indexes OFF
+select @@"";
+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 '""' at line 1
+select @@&;
+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 '&' at line 1
+select @@@;
+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 '@' at line 1
End of 5.0 tests
set global binlog_cache_size =@my_binlog_cache_size;
set global connect_timeout =@my_connect_timeout;
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index eea0b06b224..3690ac958a2 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -465,7 +465,46 @@ INSERT INTO t1 VALUES (1, 'ZZZZZ'), (1, 'ZZZ'), (2, 'ZZZ'), (2, 'ZZZZZ');
SELECT id, MIN(s) FROM t1 GROUP BY id;
DROP TABLE t1;
-# End of 4.1 tests
+
+#
+# Bug #20536: md5() with GROUP BY and UCS2 return different results on myisam/innodb
+#
+
+--disable_warnings
+drop table if exists bug20536;
+--enable_warnings
+
+set names latin1;
+create table bug20536 (id bigint not null auto_increment primary key, name
+varchar(255) character set ucs2 not null);
+insert into `bug20536` (`id`,`name`) values (1, _latin1 x'7465737431'), (2, "'test\\_2'");
+select md5(name) from bug20536;
+select sha1(name) from bug20536;
+select make_set(3, name, upper(name)) from bug20536;
+select export_set(5, name, upper(name)) from bug20536;
+select export_set(5, name, upper(name), ",", 5) from bug20536;
+
+# Some broken functions: add these tests just to document current behavior.
+
+# PASSWORD and OLD_PASSWORD don't work with UCS2 strings, but to fix it would
+# not be backwards compatible in all cases, so it's best to leave it alone
+select password(name) from bug20536;
+select old_password(name) from bug20536;
+
+# ENCRYPT relies on OS function crypt() which takes a NUL-terminated string; it
+# doesn't return good results for strings with embedded 0 bytes. It won't be
+# fixed unless we choose to re-implement the crypt() function ourselves to take
+# an extra size_t string_length argument.
+select encrypt(name, 'SALT') from bug20536;
+
+# QUOTE doesn't work with UCS2 data. It would require a total rewrite
+# of Item_func_quote::val_str(), which isn't worthwhile until UCS2 is
+# supported fully as a client character set.
+select quote(name) from bug20536;
+
+drop table bug20536;
+
+--echo End of 4.1 tests
#
# Conversion from an UCS2 string to a decimal column
@@ -497,3 +536,5 @@ create table t1(a blob, b text charset utf8, c text charset ucs2);
select data_type, character_octet_length, character_maximum_length
from information_schema.columns where table_name='t1';
drop table t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 81773dbf999..06f9cb7d2c6 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -32,7 +32,6 @@ rpl_ndb_innodb2ndb : Bug #19710 Cluster replication to partition table fa
#rpl_ndb_log : BUG#18947 2006-03-21 tomas CRBR: order in binlog of create table and insert (on different table) not determ
rpl_ndb_myisam2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement
rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly
-rpl_row_func003 : BUG#19074 2006-13-04 andrei test failed
rpl_sp : BUG#16456 2006-02-16 jmiller
rpl_sp_effects : BUG#19862 2006-06-15 mkindahl
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index 0475dd4bdb6..52a5512d070 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -78,7 +78,13 @@ connection default;
DROP TABLE t1;
-# End of 4.1 tests
+#
+# Bug #21531: EXPORT_SET() doesn't accept args with coercible character sets
+#
+select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
+
+--echo End of 4.1 tests
+
#
# Test for BUG#9535
@@ -87,7 +93,9 @@ create table t1 as select uuid(), length(uuid());
show create table t1;
drop table t1;
+#
# Bug #6760: Add SLEEP() function
+#
create table t1 (a timestamp default '2005-05-05 01:01:01',
b timestamp default '2005-05-05 01:01:01');
insert into t1 set a = now();
@@ -117,4 +125,4 @@ drop table t2;
drop table t1;
set global query_cache_size=default;
-# End of 5.0 tests
+--echo End of 5.0 tests
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index d00c5499ef9..1a2afad3b44 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -904,14 +904,6 @@ insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
select count(*) from t1;
--replace_column 9 #
explain select * from t1 where c between 1 and 2500;
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index 385c59d1503..cf4e6f4047c 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -52,8 +52,8 @@ drop table t1;
--exec $MYSQL --default-character-set=cp932 test -e "charset utf8;"
# its usage to switch internally in mysql to requested charset
---exec $MYSQL --default-character-set=utf8 test -e "charset cp932; set @@session.character_set_client= cp932; select '\'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('\'); select * from t1; drop table t1;"
---exec $MYSQL --default-character-set=utf8 test -e "charset cp932; set character_set_client= cp932; select '\'"
+--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select '\'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('\'); select * from t1; drop table t1;"
+--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select '\'"
--exec $MYSQL --default-character-set=utf8 test -e "/*charset cp932 */; set character_set_client= cp932; select '\'"
--exec $MYSQL --default-character-set=utf8 test -e "/*!\C cp932 */; set character_set_client= cp932; select '\'"
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 1f31c84ba68..545edcac315 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -1326,8 +1326,37 @@ grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
drop table t1;
drop user mysqltest_1@localhost;
---echo End of 5.0 tests
+#
+# Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the
+# information_schema database.
+#
+connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
+connection root;
+create database mysqldump_myDB;
+use mysqldump_myDB;
+create user myDB_User;
+grant create view, select on mysqldump_myDB.* to myDB_User@localhost;
+create table t1 (c1 int);
+insert into t1 values (3);
+
+connect (user1,localhost,myDB_User,,mysqldump_myDB,$MASTER_MYPORT,$MASTER_MYSOCK);
+connection user1;
+use mysqldump_myDB;
+create view v1 (c1) as select * from t1;
+
+# Backup should not fail.
+--exec $MYSQL_DUMP --all-databases --add-drop-table > $MYSQLTEST_VARDIR/tmp/bug21527.sql
+# Clean up
+connection root;
+use mysqldump_myDB;
+drop view v1;
+drop table t1;
+revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
+drop user myDB_User;
+drop database mysqldump_myDB;
+--echo End of 5.0 tests
+use test;
#
# Added for use-thread option
#
diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test
index afee381f5b7..49f8fc4d7d4 100644
--- a/mysql-test/t/openssl_1.test
+++ b/mysql-test/t/openssl_1.test
@@ -10,14 +10,18 @@ insert into t1 values (5);
grant select on test.* to ssl_user1@localhost require SSL;
grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA";
-grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/emailAddress=abstract.mysql.developer@mysql.com";
-grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/emailAddress=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/emailAddress=abstract.mysql.developer@mysql.com";
+grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB";
+grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB" ISSUER "/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB";
+grant select on test.* to ssl_user5@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "xxx";
flush privileges;
connect (con1,localhost,ssl_user1,,,,,SSL);
connect (con2,localhost,ssl_user2,,,,,SSL);
connect (con3,localhost,ssl_user3,,,,,SSL);
connect (con4,localhost,ssl_user4,,,,,SSL);
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error 1045
+connect (con5,localhost,ssl_user5,,,,,SSL);
connection con1;
# Check ssl turned on
@@ -49,7 +53,7 @@ delete from t1;
connection default;
drop user ssl_user1@localhost, ssl_user2@localhost,
-ssl_user3@localhost, ssl_user4@localhost;
+ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost;
drop table t1;
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index 771a4ad3ed3..9985ed4f7f5 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -585,6 +585,16 @@ show variables like 'ssl%';
select @@log_queries_not_using_indexes;
show variables like 'log_queries_not_using_indexes';
+#
+# Bug#20908: Crash if select @@""
+#
+--error ER_PARSE_ERROR
+select @@"";
+--error ER_PARSE_ERROR
+select @@&;
+--error ER_PARSE_ERROR
+select @@@;
+
--echo End of 5.0 tests
# This is at the very after the versioned tests, since it involves doing
@@ -620,3 +630,4 @@ set global server_id =@my_server_id;
set global slow_launch_time =@my_slow_launch_time;
set global storage_engine =@my_storage_engine;
set global thread_cache_size =@my_thread_cache_size;
+
diff --git a/sql-common/client.c b/sql-common/client.c
index fb76c864e79..79a5be938b2 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1509,7 +1509,6 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) ,
mysql->options.ssl_ca= strdup_if_not_null(ca);
mysql->options.ssl_capath= strdup_if_not_null(capath);
mysql->options.ssl_cipher= strdup_if_not_null(cipher);
- mysql->options.ssl_verify_server_cert= FALSE; /* Off by default */
#endif /* HAVE_OPENSSL */
DBUG_RETURN(0);
}
@@ -2198,7 +2197,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
DBUG_PRINT("info", ("IO layer change done!"));
/* Verify server cert */
- if (mysql->options.ssl_verify_server_cert &&
+ if ((client_flag & CLIENT_SSL_VERIFY_SERVER_CERT) &&
ssl_verify_server_cert(mysql->net.vio, mysql->host))
{
set_mysql_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate);
@@ -2945,7 +2944,10 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg)
mysql->reconnect= *(my_bool *) arg;
break;
case MYSQL_OPT_SSL_VERIFY_SERVER_CERT:
- mysql->options.ssl_verify_server_cert= *(my_bool *) arg;
+ if (!arg || test(*(uint*) arg))
+ mysql->options.client_flag|= CLIENT_SSL_VERIFY_SERVER_CERT;
+ else
+ mysql->options.client_flag&= ~CLIENT_SSL_VERIFY_SERVER_CERT;
break;
default:
DBUG_RETURN(1);
diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc
index 7e0b178f7af..5a8bd48d699 100644
--- a/sql/gen_lex_hash.cc
+++ b/sql/gen_lex_hash.cc
@@ -442,13 +442,17 @@ int main(int argc,char **argv)
if (get_options(argc,(char **) argv))
exit(1);
+ /* Broken up to indicate that it's not advice to you, gentle reader. */
+ printf("/*\n\n Do " "not " "edit " "this " "file " "directly!\n\n*/\n");
+
printf("/* Copyright (C) 2001-2004 MySQL AB\n\
This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
and you are welcome to modify and redistribute it under the GPL license\n\
\n*/\n\n");
- printf("/* This code is generated by gen_lex_hash.cc that seeks for\
- a perfect\nhash function */\n\n");
+ /* Broken up to indicate that it's not advice to you, gentle reader. */
+ printf("/* Do " "not " "edit " "this " "file! This is generated by "
+ "gen_lex_hash.cc\nthat seeks for a perfect hash function */\n\n");
printf("#include \"lex.h\"\n\n");
calc_length();
@@ -468,6 +472,14 @@ static inline SYMBOL *get_hash_symbol(const char *s,\n\
{\n\
register uchar *hash_map;\n\
register const char *cur_str= s;\n\
+\n\
+ if (len == 0) {\n\
+ DBUG_PRINT(\"warning\", (\"get_hash_symbol() received a request for a zero-length symbol, which is probably a mistake.\"));\
+ return(NULL);\n\
+ }\n"
+);
+
+ printf("\
if (function){\n\
if (len>sql_functions_max_len) return 0;\n\
hash_map= sql_functions_map;\n\
@@ -498,7 +510,10 @@ static inline SYMBOL *get_hash_symbol(const char *s,\n\
cur_struct= uint4korr(hash_map+\n\
(((uint16)cur_struct + cur_char - first_char)*4));\n\
cur_str++;\n\
- }\n\
+ }\n"
+);
+
+ printf("\
}else{\n\
if (len>symbols_max_len) return 0;\n\
hash_map= symbols_map;\n\
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 7f4d6abd4b7..6145b6518a8 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -206,6 +206,7 @@ static handler *innobase_create_handler(TABLE_SHARE *table,
MEM_ROOT *mem_root);
static const char innobase_hton_name[]= "InnoDB";
+
handlerton innobase_hton;
static handler *innobase_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
@@ -2363,8 +2364,7 @@ ha_innobase::open(
"have forgotten\nto delete the corresponding "
".frm files of InnoDB tables, or you\n"
"have moved .frm files to another database?\n"
- "Look from section 15.1 of "
- "http://www.innodb.com/ibman.html\n"
+ "See http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
"how you can resolve the problem.\n",
norm_name);
free_share(share);
@@ -2381,8 +2381,7 @@ ha_innobase::open(
"Have you deleted the .ibd file from the "
"database directory under\nthe MySQL datadir, "
"or have you used DISCARD TABLESPACE?\n"
- "Look from section 15.1 of "
- "http://www.innodb.com/ibman.html\n"
+ "See http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
"how you can resolve the problem.\n",
norm_name);
free_share(share);
@@ -3662,7 +3661,7 @@ ha_innobase::update_row(
DBUG_ENTER("ha_innobase::update_row");
- ut_ad(prebuilt->trx ==
+ ut_a(prebuilt->trx ==
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
@@ -3723,7 +3722,7 @@ ha_innobase::delete_row(
DBUG_ENTER("ha_innobase::delete_row");
- ut_ad(prebuilt->trx ==
+ ut_a(prebuilt->trx ==
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
if (last_query_id != user_thd->query_id) {
@@ -3821,6 +3820,9 @@ ha_innobase::try_semi_consistent_read(bool yes)
{
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
+ ut_a(prebuilt->trx ==
+ (trx_t*) current_thd->ha_data[innobase_hton.slot]);
+
/* Row read type is set to semi consistent read if this was
requested by the MySQL and either innodb_locks_unsafe_for_binlog
option is used or this session is using READ COMMITTED isolation
@@ -3985,7 +3987,7 @@ ha_innobase::index_read(
DBUG_ENTER("index_read");
- ut_ad(prebuilt->trx ==
+ ut_a(prebuilt->trx ==
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
statistic_increment(current_thd->status_var.ha_read_key_count,
@@ -4100,7 +4102,7 @@ ha_innobase::change_active_index(
DBUG_ENTER("change_active_index");
ut_ad(user_thd == current_thd);
- ut_ad(prebuilt->trx ==
+ ut_a(prebuilt->trx ==
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
active_index = keynr;
@@ -4190,7 +4192,7 @@ ha_innobase::general_fetch(
DBUG_ENTER("general_fetch");
- ut_ad(prebuilt->trx ==
+ ut_a(prebuilt->trx ==
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
innodb_srv_conc_enter_innodb(prebuilt->trx);
@@ -4426,7 +4428,7 @@ ha_innobase::rnd_pos(
statistic_increment(current_thd->status_var.ha_read_rnd_count,
&LOCK_status);
- ut_ad(prebuilt->trx ==
+ ut_a(prebuilt->trx ==
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
if (prebuilt->clust_index_was_generated) {
@@ -4476,7 +4478,7 @@ ha_innobase::position(
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
uint len;
- ut_ad(prebuilt->trx ==
+ ut_a(prebuilt->trx ==
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
if (prebuilt->clust_index_was_generated) {
@@ -5004,7 +5006,6 @@ ha_innobase::delete_all_rows(void)
{
row_prebuilt_t* prebuilt = (row_prebuilt_t*)innobase_prebuilt;
int error;
- trx_t* trx;
THD* thd = current_thd;
DBUG_ENTER("ha_innobase::delete_all_rows");
@@ -5017,13 +5018,13 @@ ha_innobase::delete_all_rows(void)
}
/* Get the transaction associated with the current thd, or create one
- if not yet created */
+ if not yet created, and update prebuilt->trx */
- trx = check_trx_exists(thd);
+ update_thd(thd);
/* Truncate the table in InnoDB */
- error = row_truncate_table_for_mysql(prebuilt->table, trx);
+ error = row_truncate_table_for_mysql(prebuilt->table, prebuilt->trx);
if (error == DB_ERROR) {
/* Cannot truncate; resort to ha_innobase::delete_row() */
goto fallback;
@@ -5306,6 +5307,9 @@ ha_innobase::records_in_range(
DBUG_ENTER("records_in_range");
+ ut_a(prebuilt->trx ==
+ (trx_t*) current_thd->ha_data[innobase_hton.slot]);
+
prebuilt->trx->op_info = (char*)"estimating records in index range";
/* In case MySQL calls this in the middle of a SELECT query, release
@@ -5602,13 +5606,14 @@ ha_innobase::info(
for (i = 0; i < table->s->keys; i++) {
if (index == NULL) {
ut_print_timestamp(stderr);
- sql_print_error("Table %s contains less "
+ sql_print_error("Table %s contains fewer "
"indexes inside InnoDB than "
"are defined in the MySQL "
".frm file. Have you mixed up "
".frm files from different "
- "installations? See section "
- "15.1 at http://www.innodb.com/ibman.html",
+ "installations? See "
+"http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n",
+
ib_table->name);
break;
}
@@ -5617,17 +5622,11 @@ ha_innobase::info(
if (j + 1 > index->n_uniq) {
ut_print_timestamp(stderr);
- sql_print_error("Index %s of %s has "
- "%lu columns unique "
- "inside InnoDB, but "
- "MySQL is asking "
- "statistics for %lu "
- "columns. Have you "
- "mixed up .frm files "
- "from different "
- "installations? See "
- "section 15.1 at "
- "http://www.innodb.com/ibman.html",
+ sql_print_error(
+"Index %s of %s has %lu columns unique inside InnoDB, but MySQL is asking "
+"statistics for %lu columns. Have you mixed up .frm files from different "
+"installations? "
+"See http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n",
index->name,
ib_table->name,
(unsigned long)
@@ -6033,6 +6032,10 @@ ha_innobase::can_switch_engines(void)
bool can_switch;
DBUG_ENTER("ha_innobase::can_switch_engines");
+
+ ut_a(prebuilt->trx ==
+ (trx_t*) current_thd->ha_data[innobase_hton.slot]);
+
prebuilt->trx->op_info =
"determining if there are foreign key constraints";
row_mysql_lock_data_dictionary(prebuilt->trx);
@@ -6170,14 +6173,6 @@ ha_innobase::start_stmt(
innobase_release_stat_resources(trx);
- if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
- && trx->global_read_view) {
- /* At low transaction isolation levels we let
- each consistent read set its own snapshot */
-
- read_view_close_for_mysql(trx);
- }
-
prebuilt->sql_stat_start = TRUE;
prebuilt->hint_need_to_fetch_extra_cols = 0;
prebuilt->read_just_key = 0;
@@ -6436,7 +6431,7 @@ ha_innobase::transactional_table_lock(
"table %s does not exist.\n"
"Have you deleted the .ibd file from the database directory under\n"
"the MySQL datadir?"
-"Look from section 15.1 of http://www.innodb.com/ibman.html\n"
+"See http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
"how you can resolve the problem.\n",
prebuilt->table->name);
DBUG_RETURN(HA_ERR_CRASHED);
@@ -6790,7 +6785,15 @@ ha_innobase::store_lock(
TL_IGNORE */
{
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
- trx_t* trx = prebuilt->trx;
+ trx_t* trx;
+
+ /* Call update_thd() to update prebuilt->trx to point to the trx
+ object of thd! Failure to do this caused a serious memory
+ corruption bug in 5.1.11. */
+
+ update_thd(thd);
+
+ trx = prebuilt->trx;
/* NOTE: MySQL can call this function with lock 'type' TL_IGNORE!
Be careful to ignore TL_IGNORE if we are going to do something with
@@ -6907,28 +6910,28 @@ ha_innobase::store_lock(
stored function call (MySQL does have thd->in_lock_tables
TRUE there). */
- if ((lock_type >= TL_WRITE_CONCURRENT_INSERT
- && lock_type <= TL_WRITE)
- && !(thd->in_lock_tables
- && thd->lex->sql_command == SQLCOM_LOCK_TABLES)
- && !thd->tablespace_op
- && thd->lex->sql_command != SQLCOM_TRUNCATE
- && thd->lex->sql_command != SQLCOM_OPTIMIZE
+ if ((lock_type >= TL_WRITE_CONCURRENT_INSERT
+ && lock_type <= TL_WRITE)
+ && !(thd->in_lock_tables
+ && thd->lex->sql_command == SQLCOM_LOCK_TABLES)
+ && !thd->tablespace_op
+ && thd->lex->sql_command != SQLCOM_TRUNCATE
+ && thd->lex->sql_command != SQLCOM_OPTIMIZE
+
#ifdef __WIN__
- /*
- for alter table on win32 for succesfull operation
- completion it is used TL_WRITE(=10) lock instead of
- TL_WRITE_ALLOW_READ(=6), however here in innodb handler
- TL_WRITE is lifted to TL_WRITE_ALLOW_WRITE, which causes
- race condition when several clients do alter table
- simultaneously (bug #17264). This fix avoids the problem.
- */
- && thd->lex->sql_command != SQLCOM_ALTER_TABLE
+ /* For alter table on win32 for succesful operation
+ completion it is used TL_WRITE(=10) lock instead of
+ TL_WRITE_ALLOW_READ(=6), however here in innodb handler
+ TL_WRITE is lifted to TL_WRITE_ALLOW_WRITE, which causes
+ race condition when several clients do alter table
+ simultaneously (bug #17264). This fix avoids the problem. */
+ && thd->lex->sql_command != SQLCOM_ALTER_TABLE
#endif
- && thd->lex->sql_command != SQLCOM_CREATE_TABLE) {
+
+ && thd->lex->sql_command != SQLCOM_CREATE_TABLE) {
lock_type = TL_WRITE_ALLOW_WRITE;
- }
+ }
/* In queries of type INSERT INTO t1 SELECT ... FROM t2 ...
MySQL would use the lock TL_READ_NO_INSERT on t2, and that
@@ -6975,10 +6978,11 @@ ha_innobase::innobase_read_and_init_auto_inc(
int error;
ut_a(prebuilt);
- ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[innobase_hton.slot]);
ut_a(prebuilt->table);
+ /* Prepare prebuilt->trx in the table handle */
+ update_thd(current_thd);
+
if (prebuilt->trx->conc_state == TRX_NOT_STARTED) {
trx_was_not_started = TRUE;
}
@@ -7063,10 +7067,16 @@ ha_innobase::innobase_read_and_init_auto_inc(
'found_next_number_field' below because MySQL in SHOW TABLE
STATUS does not seem to set 'next_number_field'. The comment
in table.h says that 'next_number_field' is set when it is
- 'active'. */
+ 'active'.
+ Since 5.1 MySQL enforces that we announce fields which we will
+ read; as we only do a val_*() call, dbug_tmp_use_all_columns()
+ with read_set is sufficient. */
+ my_bitmap_map *old_map;
+ old_map= dbug_tmp_use_all_columns(table, table->read_set);
auto_inc = (longlong) table->found_next_number_field->
val_int_offset(table->s->rec_buff_length) + 1;
+ dbug_tmp_restore_column_map(table->read_set, old_map);
}
dict_table_autoinc_initialize(prebuilt->table, auto_inc);
@@ -7113,6 +7123,9 @@ void ha_innobase::get_auto_increment(
longlong nr;
int error;
+ /* Prepare prebuilt->trx in the table handle */
+ update_thd(current_thd);
+
error = innobase_read_and_init_auto_inc(&nr);
if (error) {
@@ -7141,6 +7154,8 @@ ha_innobase::reset_auto_increment(ulonglong value)
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
int error;
+ update_thd(current_thd);
+
error = row_lock_table_autoinc_for_mysql(prebuilt);
if (error != DB_SUCCESS) {
@@ -7181,7 +7196,7 @@ ha_innobase::cmp_ref(
const mysql_byte* ref2) /* in: an (internal) primary key value in the
MySQL key value format */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
+ row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
enum_field_types mysql_type;
Field* field;
KEY_PART_INFO* key_part;
diff --git a/sql/handler.cc b/sql/handler.cc
index dd1be47e3c2..6ef32025a42 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -3535,7 +3535,7 @@ int handler::ha_external_lock(THD *thd, int lock_type)
int handler::ha_reset()
{
DBUG_ENTER("ha_reset");
- /* Check that we have called all proper delallocation functions */
+ /* Check that we have called all proper deallocation functions */
DBUG_ASSERT((byte*) table->def_read_set.bitmap +
table->s->column_bitmap_size ==
(byte*) table->def_write_set.bitmap);
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 73a56fb34e9..ab0e7fcafea 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -124,6 +124,7 @@ String *Item_func_md5::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
String * sptr= args[0]->val_str(str);
+ str->set_charset(&my_charset_bin);
if (sptr)
{
my_MD5_CTX context;
@@ -170,6 +171,7 @@ String *Item_func_sha::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
String * sptr= args[0]->val_str(str);
+ str->set_charset(&my_charset_bin);
if (sptr) /* If we got value different from NULL */
{
SHA1_CONTEXT context; /* Context used to generate SHA1 hash */
@@ -1605,7 +1607,7 @@ String *Item_func_encrypt::val_str(String *str)
null_value= 1;
return 0;
}
- str->set(tmp,(uint) strlen(tmp),res->charset());
+ str->set(tmp, (uint) strlen(tmp), &my_charset_bin);
str->copy();
pthread_mutex_unlock(&LOCK_crypt);
return str;
@@ -2041,7 +2043,7 @@ String *Item_func_make_set::val_str(String *str)
return &my_empty_string;
result= &tmp_str;
}
- if (tmp_str.append(',') || tmp_str.append(*res))
+ if (tmp_str.append(STRING_WITH_LEN(","), &my_charset_bin) || tmp_str.append(*res))
return &my_empty_string;
}
}
@@ -2719,8 +2721,12 @@ String* Item_func_export_set::val_str(String* str)
}
break;
case 3:
- sep_buf.set(STRING_WITH_LEN(","), default_charset());
- sep = &sep_buf;
+ {
+ /* errors is not checked - assume "," can always be converted */
+ uint errors;
+ sep_buf.copy(STRING_WITH_LEN(","), &my_charset_bin, collation.collation, &errors);
+ sep = &sep_buf;
+ }
break;
default:
DBUG_ASSERT(0); // cannot happen
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 0a9ca50a028..da72ed531c1 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -43,7 +43,10 @@ class Item_func_md5 :public Item_str_func
{
String tmp_value;
public:
- Item_func_md5(Item *a) :Item_str_func(a) {}
+ Item_func_md5(Item *a) :Item_str_func(a)
+ {
+ collation.set(&my_charset_bin);
+ }
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "md5"; }
@@ -54,7 +57,10 @@ public:
class Item_func_sha :public Item_str_func
{
public:
- Item_func_sha(Item *a) :Item_str_func(a) {}
+ Item_func_sha(Item *a) :Item_str_func(a)
+ {
+ collation.set(&my_charset_bin);
+ }
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "sha"; }
@@ -333,9 +339,21 @@ public:
class Item_func_encrypt :public Item_str_func
{
String tmp_value;
+
+ /* Encapsulate common constructor actions */
+ void constructor_helper()
+ {
+ collation.set(&my_charset_bin);
+ }
public:
- Item_func_encrypt(Item *a) :Item_str_func(a) {}
- Item_func_encrypt(Item *a, Item *b): Item_str_func(a,b) {}
+ Item_func_encrypt(Item *a) :Item_str_func(a)
+ {
+ constructor_helper();
+ }
+ Item_func_encrypt(Item *a, Item *b): Item_str_func(a,b)
+ {
+ constructor_helper();
+ }
String *val_str(String *);
void fix_length_and_dec() { maybe_null=1; max_length = 13; }
const char *func_name() const { return "encrypt"; }
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index f603cafd89d..a259fd90485 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -224,7 +224,7 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
tmp= (char*) val + min(2, val_len);
l_time->day= (int) my_strtoll10(val, &tmp, &error);
/* Skip 'st, 'nd, 'th .. */
- val= tmp + min((int) (end-tmp), 2);
+ val= tmp + min((int) (val_end-tmp), 2);
break;
/* Hour */
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 86a7a0a3b58..c3cc6679a44 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -6216,7 +6216,7 @@ The minimum value for this variable is 4096.",
"If an in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM table.",
(gptr*) &global_system_variables.tmp_table_size,
(gptr*) &max_system_variables.tmp_table_size, 0, GET_ULONG,
- REQUIRED_ARG, 32*1024*1024L, 1024, ~0L, 0, 1, 0},
+ REQUIRED_ARG, 16*1024*1024L, 1024, ~0L, 0, 1, 0}, /* See max_heap_table_size . */
{"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE,
"Allocation block size for transactions to be stored in binary log",
(gptr*) &global_system_variables.trans_alloc_block_size,
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index c7776db324b..2259794d44d 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1006,6 +1006,7 @@ int acl_getroot(THD *thd, USER_RESOURCES *mqh,
sql_print_information("X509 issuer mismatch: should be '%s' "
"but is '%s'", acl_user->x509_issuer, ptr);
free(ptr);
+ user_access=NO_ACCESS;
break;
}
user_access= acl_user->access;
@@ -1021,11 +1022,13 @@ int acl_getroot(THD *thd, USER_RESOURCES *mqh,
if (strcmp(acl_user->x509_subject,ptr))
{
if (global_system_variables.log_warnings)
- sql_print_information("X509 subject mismatch: '%s' vs '%s'",
+ sql_print_information("X509 subject mismatch: should be '%s' but is '%s'",
acl_user->x509_subject, ptr);
+ free(ptr);
+ user_access=NO_ACCESS;
+ break;
}
- else
- user_access= acl_user->access;
+ user_access= acl_user->access;
free(ptr);
}
break;
@@ -5576,8 +5579,6 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
}
if (!find_acl_user(lex_user->host.str, lex_user->user.str, TRUE))
{
- sql_print_error("REVOKE ALL PRIVILEGES, GRANT: User '%s'@'%s' does not "
- "exists", lex_user->user.str, lex_user->host.str);
result= -1;
continue;
}
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index c5064df931b..935a2b2486e 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1047,6 +1047,8 @@ int MYSQLlex(void *arg, void *yythd)
if (c == '.')
lex->next_state=MY_LEX_IDENT_SEP;
length= (uint) (lex->ptr - lex->tok_start)-1;
+ if (length == 0)
+ return(ABORT_SYM); // Names must be nonempty.
if ((tokval= find_keyword(lex,length,0)))
{
yyUnget(); // Put back 'c'
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 337f1cc2492..63a129918d0 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1916,7 +1916,8 @@ void mysql_stmt_prepare(THD *thd, const char *packet, uint packet_length)
thd->stmt_map.erase(stmt);
}
else
- general_log_print(thd, COM_STMT_PREPARE, "[%lu] %s", stmt->id, packet);
+ general_log_print(thd, COM_STMT_PREPARE, "[%lu] %.*b", stmt->id,
+ stmt->query_length, stmt->query);
/* check_prepared_statemnt sends the metadata packet in case of success */
DBUG_VOID_RETURN;
@@ -2291,7 +2292,8 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
if (!(specialflag & SPECIAL_NO_PRIOR))
my_pthread_setprio(pthread_self(), WAIT_PRIOR);
if (error == 0)
- general_log_print(thd, COM_STMT_EXECUTE, "[%lu] %s", stmt->id, thd->query);
+ general_log_print(thd, COM_STMT_EXECUTE, "[%lu] %.*b", stmt->id,
+ thd->query_length, thd->query);
DBUG_VOID_RETURN;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index a8bf2695ac4..92e450f8efc 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1227,9 +1227,10 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
store_key_options(thd, packet, table, key_info);
if (key_info->parser)
{
- packet->append(" WITH PARSER ", 13);
+ packet->append(STRING_WITH_LEN(" /*!50100 WITH PARSER "));
append_identifier(thd, packet, key_info->parser->name.str,
key_info->parser->name.length);
+ packet->append(STRING_WITH_LEN(" */ "));
}
}
@@ -1255,9 +1256,9 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
if ((for_str= file->get_tablespace_name(thd)))
{
- packet->append(" TABLESPACE ");
+ packet->append(STRING_WITH_LEN(" /*!50100 TABLESPACE "));
packet->append(for_str, strlen(for_str));
- packet->append(" STORAGE DISK");
+ packet->append(STRING_WITH_LEN(" STORAGE DISK */"));
my_free(for_str, MYF(0));
}
@@ -1296,7 +1297,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
if(create_info.auto_increment_value > 1)
{
- packet->append(" AUTO_INCREMENT=", 16);
+ packet->append(STRING_WITH_LEN(" AUTO_INCREMENT="));
end= longlong10_to_str(create_info.auto_increment_value, buff,10);
packet->append(buff, (uint) (end - buff));
}
diff --git a/sql/stacktrace.c b/sql/stacktrace.c
index 838f547dc02..43f35c452f7 100644
--- a/sql/stacktrace.c
+++ b/sql/stacktrace.c
@@ -21,6 +21,7 @@
#ifdef HAVE_STACKTRACE
#include <unistd.h>
+#include <strings.h>
#define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end)
@@ -44,7 +45,29 @@ void safe_print_str(const char* name, const char* val, int max_len)
}
#ifdef TARGET_OS_LINUX
-#define SIGRETURN_FRAME_COUNT 2
+
+#ifdef __i386__
+#define SIGRETURN_FRAME_OFFSET 17
+#endif
+
+#ifdef __x86_64__
+#define SIGRETURN_FRAME_OFFSET 23
+#endif
+
+static my_bool is_nptl;
+
+/* Check if we are using NPTL or LinuxThreads on Linux */
+void check_thread_lib(void)
+{
+ char buf[5];
+
+#ifdef _CS_GNU_LIBPTHREAD_VERSION
+ confstr(_CS_GNU_LIBPTHREAD_VERSION, buf, sizeof(buf));
+ is_nptl = !strncasecmp(buf, "NPTL", sizeof(buf));
+#else
+ is_nptl = 0;
+#endif
+}
#if defined(__alpha__) && defined(__GNUC__)
/*
@@ -90,7 +113,7 @@ inline uint32* find_prev_pc(uint32* pc, uchar** fp)
void print_stacktrace(gptr stack_bottom, ulong thread_stack)
{
uchar** fp;
- uint frame_count = 0;
+ uint frame_count = 0, sigreturn_frame_count;
#if defined(__alpha__) && defined(__GNUC__)
uint32* pc;
#endif
@@ -100,28 +123,27 @@ void print_stacktrace(gptr stack_bottom, ulong thread_stack)
Attempting backtrace. You can use the following information to find out\n\
where mysqld died. If you see no messages after this, something went\n\
terribly wrong...\n");
-#ifdef __i386__
+#ifdef __i386__
__asm __volatile__ ("movl %%ebp,%0"
:"=r"(fp)
:"r"(fp));
- if (!fp)
- {
- fprintf(stderr, "frame pointer (ebp) is NULL, did you compile with\n\
--fomit-frame-pointer? Aborting backtrace!\n");
- return;
- }
+#endif
+#ifdef __x86_64__
+ __asm __volatile__ ("movq %%rbp,%0"
+ :"=r"(fp)
+ :"r"(fp));
#endif
#if defined(__alpha__) && defined(__GNUC__)
__asm __volatile__ ("mov $30,%0"
:"=r"(fp)
:"r"(fp));
+#endif
if (!fp)
{
- fprintf(stderr, "frame pointer (fp) is NULL, did you compile with\n\
+ fprintf(stderr, "frame pointer is NULL, did you compile with\n\
-fomit-frame-pointer? Aborting backtrace!\n");
return;
}
-#endif /* __alpha__ */
if (!stack_bottom || (gptr) stack_bottom > (gptr) &fp)
{
@@ -151,13 +173,16 @@ terribly wrong...\n");
:"r"(pc));
#endif /* __alpha__ */
+ /* We are 1 frame above signal frame with NPTL and 2 frames above with LT */
+ sigreturn_frame_count = is_nptl ? 1 : 2;
+
while (fp < (uchar**) stack_bottom)
{
-#ifdef __i386__
+#if defined(__i386__) || defined(__x86_64__)
uchar** new_fp = (uchar**)*fp;
- fprintf(stderr, "%p\n", frame_count == SIGRETURN_FRAME_COUNT ?
- *(fp+17) : *(fp+1));
-#endif /* __386__ */
+ fprintf(stderr, "%p\n", frame_count == sigreturn_frame_count ?
+ *(fp + SIGRETURN_FRAME_OFFSET) : *(fp + 1));
+#endif /* defined(__386__) || defined(__x86_64__) */
#if defined(__alpha__) && defined(__GNUC__)
uchar** new_fp = find_prev_fp(pc, fp);
diff --git a/sql/stacktrace.h b/sql/stacktrace.h
index d5d1e05ef0e..527d10d70a2 100644
--- a/sql/stacktrace.h
+++ b/sql/stacktrace.h
@@ -19,16 +19,20 @@ extern "C" {
#endif
#ifdef TARGET_OS_LINUX
-#if defined(HAVE_STACKTRACE) || (defined (__i386__) || (defined(__alpha__) && defined(__GNUC__)))
+#if defined(HAVE_STACKTRACE) || (defined (__x86_64__) || defined (__i386__) || (defined(__alpha__) && defined(__GNUC__)))
#undef HAVE_STACKTRACE
#define HAVE_STACKTRACE
extern char* __bss_start;
extern char* heap_start;
-#define init_stacktrace() { heap_start = (char*) &__bss_start; }
+#define init_stacktrace() do { \
+ heap_start = (char*) &__bss_start; \
+ check_thread_lib(); \
+ } while(0);
void print_stacktrace(gptr stack_bottom, ulong thread_stack);
void safe_print_str(const char* name, const char* val, int max_len);
+void check_thread_lib(void);
#endif /* (defined (__i386__) || (defined(__alpha__) && defined(__GNUC__))) */
#endif /* TARGET_OS_LINUX */
diff --git a/storage/innobase/Makefile.am b/storage/innobase/Makefile.am
index a68dbbcc2e6..a5b84e0a908 100644
--- a/storage/innobase/Makefile.am
+++ b/storage/innobase/Makefile.am
@@ -87,8 +87,7 @@ EXTRA_DIST = include/btr0btr.h include/btr0btr.ic include/btr0cur.h include/btr
include/ut0byte.h include/ut0byte.ic include/ut0dbg.h include/ut0lst.h \
include/ut0mem.h include/ut0mem.ic include/ut0rnd.h include/ut0rnd.ic \
include/ut0sort.h include/ut0ut.h include/ut0ut.ic include/ut0vec.h include/ut0vec.ic include/ha_prototypes.h \
- include/ut0list.h include/ut0list.ic \
- include/ut0wqueue.h \
+ include/ut0list.h include/ut0list.ic include/ut0wqueue.h \
CMakeLists.txt
noinst_LIBRARIES = libinnobase.a
diff --git a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c
index ae3e722b513..57c6289e5f7 100644
--- a/storage/innobase/btr/btr0btr.c
+++ b/storage/innobase/btr/btr0btr.c
@@ -624,7 +624,7 @@ btr_page_get_father_for_rec(
fputs(
"InnoDB: You should dump + drop + reimport the table to fix the\n"
"InnoDB: corruption. If the crash happens at the database startup, see\n"
-"InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html about\n"
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html about\n"
"InnoDB: forcing recovery. Then dump + drop + reimport.\n", stderr);
}
diff --git a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
index 5f3e4a9ea50..ad23da4af93 100644
--- a/storage/innobase/buf/buf0buf.c
+++ b/storage/innobase/buf/buf0buf.c
@@ -323,7 +323,8 @@ buf_page_is_corrupted(
"InnoDB: is in the future! Current system log sequence number %lu %lu.\n"
"InnoDB: Your database may be corrupt or you may have copied the InnoDB\n"
"InnoDB: tablespace but not the InnoDB log files. See\n"
-"http://dev.mysql.com/doc/mysql/en/backing-up.html for more information.\n",
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n"
+"InnoDB: for more information.\n",
(ulong) mach_read_from_4(read_buf + FIL_PAGE_OFFSET),
(ulong) ut_dulint_get_high(
mach_read_from_8(read_buf + FIL_PAGE_LSN)),
@@ -1923,7 +1924,7 @@ buf_page_io_complete(
"InnoDB: the corrupt table. You can use CHECK\n"
"InnoDB: TABLE to scan your table for corruption.\n"
"InnoDB: See also "
- "http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html\n"
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr);
if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
index ce075138cb1..3470b19ed71 100644
--- a/storage/innobase/dict/dict0dict.c
+++ b/storage/innobase/dict/dict0dict.c
@@ -2215,8 +2215,8 @@ dict_foreign_error_report(
if (fk->foreign_index) {
fputs("The index in the foreign key in table is ", file);
ut_print_name(file, NULL, FALSE, fk->foreign_index->name);
- fputs(
-"\nSee http://dev.mysql.com/doc/mysql/en/InnoDB_foreign_key_constraints.html\n"
+ fputs("\n"
+"See http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html\n"
"for correct foreign key definition.\n",
file);
}
@@ -3119,7 +3119,7 @@ col_loop1:
ut_print_name(ef, NULL, TRUE, name);
fprintf(ef, " where the columns appear\n"
"as the first columns. Constraint:\n%s\n"
-"See http://dev.mysql.com/doc/mysql/en/InnoDB_foreign_key_constraints.html\n"
+"See http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html\n"
"for correct foreign key definition.\n",
start_of_latest_foreign);
mutex_exit(&dict_foreign_err_mutex);
@@ -3387,7 +3387,7 @@ try_find_index:
"Note that the internal storage type of ENUM and SET changed in\n"
"tables created with >= InnoDB-4.1.12, and such columns in old tables\n"
"cannot be referenced by such columns in new tables.\n"
-"See http://dev.mysql.com/doc/mysql/en/InnoDB_foreign_key_constraints.html\n"
+"See http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html\n"
"for correct foreign key definition.\n",
start_of_latest_foreign);
mutex_exit(&dict_foreign_err_mutex);
@@ -3941,8 +3941,7 @@ dict_update_statistics_low(
fprintf(stderr,
" InnoDB: cannot calculate statistics for table %s\n"
"InnoDB: because the .ibd file is missing. For help, please refer to\n"
-"InnoDB: "
-"http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n",
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n",
table->name);
return;
diff --git a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
index b2935a119a5..722ffc12743 100644
--- a/storage/innobase/fil/fil0fil.c
+++ b/storage/innobase/fil/fil0fil.c
@@ -251,9 +251,6 @@ struct fil_system_struct {
initialized. */
fil_system_t* fil_system = NULL;
-/* The tablespace memory cache hash table size */
-#define FIL_SYSTEM_HASH_SIZE 50 /* TODO: make bigger! */
-
/************************************************************************
NOTE: you must call fil_mutex_enter_and_prepare_for_io() first!
@@ -1323,11 +1320,17 @@ fil_init(
/*=====*/
ulint max_n_open) /* in: max number of open files */
{
+ ulint hash_size;
+
ut_a(fil_system == NULL);
- /*printf("Initializing the tablespace cache with max %lu open files\n",
- max_n_open); */
- fil_system = fil_system_create(FIL_SYSTEM_HASH_SIZE, max_n_open);
+ if (srv_file_per_table) {
+ hash_size = 50000;
+ } else {
+ hash_size = 5000;
+ }
+
+ fil_system = fil_system_create(hash_size, max_n_open);
}
/***********************************************************************
@@ -2560,7 +2563,7 @@ fil_reset_too_high_lsns(
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Flush lsn in the tablespace file %lu to be imported\n"
+" InnoDB: Flush lsn in the tablespace file %lu to be imported\n"
"InnoDB: is %lu %lu, which exceeds current system lsn %lu %lu.\n"
"InnoDB: We reset the lsn's in the file ",
(ulong) space_id,
@@ -2685,8 +2688,7 @@ fil_open_single_table_tablespace(
"InnoDB: It is also possible that this is a temporary table #sql...,\n"
"InnoDB: and MySQL removed the .ibd file for this.\n"
"InnoDB: Please refer to\n"
-"InnoDB:"
-" http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n"
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
"InnoDB: for how to resolve the issue.\n", stderr);
mem_free(filepath);
@@ -2725,8 +2727,7 @@ fil_open_single_table_tablespace(
"InnoDB: Have you moved InnoDB .ibd files around without using the\n"
"InnoDB: commands DISCARD TABLESPACE and IMPORT TABLESPACE?\n"
"InnoDB: Please refer to\n"
-"InnoDB:"
-" http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n"
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
"InnoDB: for how to resolve the issue.\n", (ulong) space_id, (ulong) id);
ret = FALSE;
@@ -3373,8 +3374,7 @@ fil_space_for_table_exists_in_mem(
error_exit:
fputs(
"InnoDB: Please refer to\n"
-"InnoDB:"
-" http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n"
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
"InnoDB: for how to resolve the issue.\n", stderr);
mem_free(path);
diff --git a/storage/innobase/fsp/fsp0fsp.c b/storage/innobase/fsp/fsp0fsp.c
index 43c7ba005cb..9b0406a1c26 100644
--- a/storage/innobase/fsp/fsp0fsp.c
+++ b/storage/innobase/fsp/fsp0fsp.c
@@ -2988,7 +2988,7 @@ fseg_free_page_low(
crash:
fputs(
"InnoDB: Please refer to\n"
-"InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html\n"
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr);
ut_error;
}
diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c
index f1ae43033bd..4e38e1f0353 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.c
+++ b/storage/innobase/ibuf/ibuf0ibuf.c
@@ -373,7 +373,6 @@ ibuf_init_at_db_start(void)
ibuf->max_size = buf_pool_get_curr_size() / UNIV_PAGE_SIZE
/ IBUF_POOL_SIZE_PER_MAX_SIZE;
- ibuf->meter = IBUF_THRESHOLD + 1;
UT_LIST_INIT(ibuf->data_list);
@@ -3517,21 +3516,9 @@ ibuf_print(
data = UT_LIST_GET_FIRST(ibuf->data_list);
while (data) {
- fprintf(file,
- "Ibuf for space %lu: size %lu, free list len %lu, seg size %lu,",
- (ulong) data->space, (ulong) data->size,
- (ulong) data->free_list_len,
- (ulong) data->seg_size);
-
- if (data->empty) {
- fputs(" is empty\n", file);
- } else {
- fputs(" is not empty\n", file);
- }
fprintf(file,
- "Ibuf for space %lu: size %lu, free list len %lu, seg size %lu,\n"
- "%lu inserts, %lu merged recs, %lu merges\n",
- (ulong) data->space,
+ "Ibuf: size %lu, free list len %lu, seg size %lu,\n"
+ "%lu inserts, %lu merged recs, %lu merges\n",
(ulong) data->size,
(ulong) data->free_list_len,
(ulong) data->seg_size,
diff --git a/storage/innobase/include/btr0cur.ic b/storage/innobase/include/btr0cur.ic
index a199c3d4d32..7fbdf6035b0 100644
--- a/storage/innobase/include/btr0cur.ic
+++ b/storage/innobase/include/btr0cur.ic
@@ -52,10 +52,7 @@ btr_cur_get_page(
/* out: pointer to page */
btr_cur_t* cursor) /* in: tree cursor */
{
- page_t* page = buf_frame_align(page_cur_get_rec(&(cursor->page_cur)));
- ut_ad(!!page_is_comp(page)
- == dict_table_is_comp(cursor->index->table));
- return(page);
+ return(buf_frame_align(page_cur_get_rec(&(cursor->page_cur))));
}
/*************************************************************
diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
index 15187c03636..3c7a64cbcb0 100644
--- a/storage/innobase/include/buf0buf.ic
+++ b/storage/innobase/include/buf0buf.ic
@@ -216,8 +216,8 @@ buf_block_align(
"InnoDB: Error: trying to access a stray pointer %p\n"
"InnoDB: buf pool start is at %p, end at %p\n"
"InnoDB: Probable reason is database corruption or memory\n"
-"InnoDB: corruption. If this happens in an InnoDB database recovery,\n"
-"InnoDB: you can look from section 6.1 at http://www.innodb.com/ibman.html\n"
+"InnoDB: corruption. If this happens in an InnoDB database recovery, see\n"
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n"
"InnoDB: how to force recovery.\n",
ptr, frame_zero,
buf_pool->high_end);
@@ -252,8 +252,8 @@ buf_frame_align(
"InnoDB: Error: trying to access a stray pointer %p\n"
"InnoDB: buf pool start is at %p, end at %p\n"
"InnoDB: Probable reason is database corruption or memory\n"
-"InnoDB: corruption. If this happens in an InnoDB database recovery,\n"
-"InnoDB: you can look from section 6.1 at http://www.innodb.com/ibman.html\n"
+"InnoDB: corruption. If this happens in an InnoDB database recovery, see\n"
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n"
"InnoDB: how to force recovery.\n",
ptr, buf_pool->frame_zero,
buf_pool->high_end);
diff --git a/storage/innobase/include/ibuf0ibuf.ic b/storage/innobase/include/ibuf0ibuf.ic
index 4eea8f41e32..7e75fccc160 100644
--- a/storage/innobase/include/ibuf0ibuf.ic
+++ b/storage/innobase/include/ibuf0ibuf.ic
@@ -39,19 +39,11 @@ struct ibuf_data_struct{
ulint n_merged_recs;/* number of records merged */
};
-/* If the ibuf meter exceeds this value, then the suitable inserts are made to
-the insert buffer instead of directly to the disk page */
-#define IBUF_THRESHOLD 50
-
struct ibuf_struct{
ulint size; /* current size of the ibuf index
trees in pages */
ulint max_size; /* recommended maximum size in pages
for the ibuf index tree */
- ulint meter; /* heuristic meter which measures
- desirability of doing inserts to the
- insert buffer instead of directly to
- the disk page */
UT_LIST_BASE_NODE_T(ibuf_data_t) data_list;
/* list of ibuf data structs for
each tablespace */
@@ -88,8 +80,7 @@ ibuf_should_try(
decide */
{
if (!(index->type & DICT_CLUSTERED)
- && (ignore_sec_unique || !(index->type & DICT_UNIQUE))
- && ibuf->meter > IBUF_THRESHOLD) {
+ && (ignore_sec_unique || !(index->type & DICT_UNIQUE))) {
ibuf_flush_count++;
diff --git a/storage/innobase/log/log0log.c b/storage/innobase/log/log0log.c
index db6b8fabf6f..2351c6055de 100644
--- a/storage/innobase/log/log0log.c
+++ b/storage/innobase/log/log0log.c
@@ -720,7 +720,7 @@ failure:
"InnoDB: To get mysqld to start up, set innodb_thread_concurrency in my.cnf\n"
"InnoDB: to a lower value, for example, to 8. After an ERROR-FREE shutdown\n"
"InnoDB: of mysqld you can adjust the size of ib_logfiles, as explained in\n"
-"InnoDB: http://dev.mysql.com/doc/mysql/en/Adding_and_removing.html\n"
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/adding-and-removing.html\n"
"InnoDB: Cannot continue operation. Calling exit(1).\n",
(ulong)srv_thread_concurrency);
diff --git a/storage/innobase/log/log0recv.c b/storage/innobase/log/log0recv.c
index 63a90f05212..8150dba165c 100644
--- a/storage/innobase/log/log0recv.c
+++ b/storage/innobase/log/log0recv.c
@@ -542,7 +542,7 @@ recv_find_max_checkpoint(
"InnoDB: the problem may be that during an earlier attempt you managed\n"
"InnoDB: to create the InnoDB data files, but log file creation failed.\n"
"InnoDB: If that is the case, please refer to\n"
-"InnoDB: http://dev.mysql.com/doc/mysql/en/Error_creating_InnoDB.html\n");
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/error-creating-innodb.html\n");
return(DB_ERROR);
}
@@ -1962,7 +1962,7 @@ recv_report_corrupt_log(
"InnoDB: far enough in recovery! Please run CHECK TABLE\n"
"InnoDB: on your InnoDB tables to check that they are ok!\n"
"InnoDB: If mysqld crashes after this recovery, look at\n"
- "InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr);
fflush(stderr);
diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
index 74905ce06dd..3aebf20ac41 100644
--- a/storage/innobase/os/os0file.c
+++ b/storage/innobase/os/os0file.c
@@ -248,7 +248,7 @@ os_file_get_last_error(
fprintf(stderr,
"InnoDB: Some operating system error numbers are described at\n"
"InnoDB: "
- "http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html\n");
+ "http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html\n");
}
}
@@ -295,7 +295,7 @@ os_file_get_last_error(
fprintf(stderr,
"InnoDB: Some operating system error numbers are described at\n"
"InnoDB: "
- "http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html\n");
+ "http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html\n");
}
}
@@ -688,7 +688,7 @@ next_file:
/* TODO: test Windows symlinks */
/* TODO: MySQL has apparently its own symlink implementation in Windows,
dbname.sym can redirect a database directory:
-http://www.mysql.com/doc/en/Windows_symbolic_links.html */
+http://dev.mysql.com/doc/refman/5.1/en/windows-symbolic-links.html */
info->type = OS_FILE_TYPE_LINK;
} else if (lpFindFileData->dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY) {
@@ -2343,7 +2343,7 @@ retry:
"InnoDB: offset %lu %lu. Operating system error number %lu.\n"
"InnoDB: Some operating system error numbers are described at\n"
"InnoDB: "
-"http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html\n",
+"http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html\n",
name, (ulong) offset_high, (ulong) offset,
(ulong) GetLastError());
@@ -2408,7 +2408,7 @@ retry:
fprintf(stderr,
"InnoDB: Some operating system error numbers are described at\n"
"InnoDB: "
-"http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html\n");
+"http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html\n");
os_has_said_disk_full = TRUE;
}
@@ -2444,7 +2444,7 @@ retry:
fprintf(stderr,
"InnoDB: Some operating system error numbers are described at\n"
"InnoDB: "
-"http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html\n");
+"http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html\n");
os_has_said_disk_full = TRUE;
}
@@ -2613,7 +2613,7 @@ os_file_get_status(
The function os_file_dirname returns a directory component of a
null-terminated pathname string. In the usual case, dirname returns
the string up to, but not including, the final '/', and basename
-is the component following the final '/'. Trailing '/' charac
+is the component following the final '/'. Trailing '/' charac­
ters are not counted as part of the pathname.
If path does not contain a slash, dirname returns the string ".".
diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
index 5f4a882f4a8..f2d501e0ba7 100644
--- a/storage/innobase/row/row0mysql.c
+++ b/storage/innobase/row/row0mysql.c
@@ -54,27 +54,6 @@ static const char S_innodb_tablespace_monitor[] = "innodb_tablespace_monitor";
static const char S_innodb_table_monitor[] = "innodb_table_monitor";
static const char S_innodb_mem_validate[] = "innodb_mem_validate";
-/* Name suffix for recovered orphaned temporary tables */
-static const char S_recover_innodb_tmp_table[] = "_recover_innodb_tmp_table";
-/***********************************************************************
-Determine if the given name ends in the suffix reserved for recovered
-orphaned temporary tables. */
-static
-ibool
-row_mysql_is_recovered_tmp_table(
-/*=============================*/
- /* out: TRUE if table name ends in
- the reserved suffix */
- const char* name)
-{
- ulint namelen = strlen(name) + 1;
- return(namelen >= sizeof S_recover_innodb_tmp_table
- && !memcmp(name + namelen -
- sizeof S_recover_innodb_tmp_table,
- S_recover_innodb_tmp_table,
- sizeof S_recover_innodb_tmp_table));
-}
-
/***********************************************************************
Determine if the given name is a name reserved for MySQL system tables. */
static
@@ -550,7 +529,7 @@ handle_new_error:
"InnoDB: tables and recreate the whole InnoDB tablespace.\n"
"InnoDB: If the mysqld server crashes after the startup or when\n"
"InnoDB: you dump the tables, look at\n"
- "InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html"
" for help.\n", stderr);
} else {
@@ -1083,7 +1062,7 @@ row_insert_for_mysql(
"InnoDB: Have you deleted the .ibd file from the database directory under\n"
"InnoDB: the MySQL datadir, or have you used DISCARD TABLESPACE?\n"
"InnoDB: Look from\n"
-"http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n"
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
"InnoDB: how you can resolve the problem.\n",
prebuilt->table->name);
return(DB_ERROR);
@@ -1319,7 +1298,7 @@ row_update_for_mysql(
"InnoDB: Have you deleted the .ibd file from the database directory under\n"
"InnoDB: the MySQL datadir, or have you used DISCARD TABLESPACE?\n"
"InnoDB: Look from\n"
-"http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n"
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
"InnoDB: how you can resolve the problem.\n",
prebuilt->table->name);
return(DB_ERROR);
@@ -1660,48 +1639,6 @@ row_get_mysql_key_number_for_index(
}
/*************************************************************************
-Recovers an orphaned tmp table inside InnoDB by renaming it. In the table
-name #sql becomes rsql, and "_recover_innodb_tmp_table" is catenated to
-the end of name. table->name should be of the form
-"dbname/rsql..._recover_innodb_tmp_table". This renames a table whose
-name is "#sql..." */
-static
-int
-row_mysql_recover_tmp_table(
-/*========================*/
- /* out: error code or DB_SUCCESS */
- dict_table_t* table, /* in: table definition */
- trx_t* trx) /* in: transaction handle */
-{
- const char* ptr = strstr(table->name, "/rsql");
-
- if (!ptr) {
- /* table name does not begin with "/rsql" */
- dict_mem_table_free(table);
- trx_commit_for_mysql(trx);
-
- return(DB_ERROR);
- }
- else {
- int status;
- int namelen = (int) strlen(table->name);
- char* old_name = mem_strdupl(table->name, namelen);
- /* replace "rsql" with "#sql" */
- old_name[ptr - table->name + 1] = '#';
- /* remove "_recover_innodb_tmp_table" suffix */
- ut_ad(namelen > (int) sizeof S_recover_innodb_tmp_table);
- ut_ad(!strcmp(old_name + namelen + 1 -
- sizeof S_recover_innodb_tmp_table,
- S_recover_innodb_tmp_table));
- old_name[namelen + 1 - sizeof S_recover_innodb_tmp_table] = 0;
- status = row_rename_table_for_mysql(old_name,
- table->name, trx);
- mem_free(old_name);
- return(status);
- }
-}
-
-/*************************************************************************
Locks the data dictionary in shared mode from modifications, for performing
foreign key check, rollback, or other operation invisible to MySQL. */
@@ -1845,18 +1782,6 @@ row_create_table_for_mysql(
trx_start_if_not_started(trx);
- if (row_mysql_is_recovered_tmp_table(table->name)) {
-
- /* MySQL prevents accessing of tables whose name begins
- with #sql, that is temporary tables. If mysqld crashes in
- the middle of an ALTER TABLE, we may get an orphaned
- #sql-table in the tablespace. We have here a special
- mechanism to recover such tables by renaming them to
- rsql... */
-
- return(row_mysql_recover_tmp_table(table, trx));
- }
-
/* The table name is prefixed with the database name and a '/'.
Certain table names starting with 'innodb_' have their special
meaning regardless of the database name. Thus, we need to
@@ -1968,8 +1893,8 @@ row_create_table_for_mysql(
"InnoDB: Then MySQL thinks the table exists, and DROP TABLE will\n"
"InnoDB: succeed.\n"
"InnoDB: You can look for further help from\n"
- "InnoDB: http://dev.mysql.com/doc/mysql/en/"
- "InnoDB_troubleshooting_datadict.html\n", stderr);
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n",
+ stderr);
}
/* We may also get err == DB_ERROR if the .ibd file for the
@@ -2063,11 +1988,6 @@ row_create_index_for_mysql(
}
}
- if (row_mysql_is_recovered_tmp_table(index->table_name)) {
-
- return(DB_SUCCESS);
- }
-
heap = mem_heap_create(512);
trx->dict_operation = TRUE;
@@ -2142,11 +2062,6 @@ row_table_add_foreign_constraints(
trx_start_if_not_started(trx);
- if (row_mysql_is_recovered_tmp_table(name)) {
-
- return(DB_SUCCESS);
- }
-
trx->dict_operation = TRUE;
err = dict_create_foreign_constraints(trx, sql_string, name,
@@ -3054,8 +2969,8 @@ row_drop_table_for_mysql(
"InnoDB: Have you copied the .frm file of the table to the\n"
"InnoDB: MySQL database directory from another database?\n"
"InnoDB: You can look for further help from\n"
- "InnoDB: http://dev.mysql.com/doc/mysql/en/"
- "InnoDB_troubleshooting_datadict.html\n", stderr);
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n",
+ stderr);
goto funct_exit;
}
@@ -3495,7 +3410,6 @@ row_rename_table_for_mysql(
mem_heap_t* heap = NULL;
const char** constraints_to_drop = NULL;
ulint n_constraints_to_drop = 0;
- ibool recovering_temp_table = FALSE;
ibool old_is_tmp, new_is_tmp;
pars_info_t* info = NULL;
@@ -3533,15 +3447,10 @@ row_rename_table_for_mysql(
old_is_tmp = row_is_mysql_tmp_table_name(old_name);
new_is_tmp = row_is_mysql_tmp_table_name(new_name);
- if (row_mysql_is_recovered_tmp_table(new_name)) {
-
- recovering_temp_table = TRUE;
- } else {
- /* Serialize data dictionary operations with dictionary mutex:
- no deadlocks can occur then in these operations */
+ /* Serialize data dictionary operations with dictionary mutex:
+ no deadlocks can occur then in these operations */
- row_mysql_lock_data_dictionary(trx);
- }
+ row_mysql_lock_data_dictionary(trx);
table = dict_table_get_low(old_name);
@@ -3556,8 +3465,8 @@ row_rename_table_for_mysql(
"InnoDB: Have you copied the .frm file of the table to the\n"
"InnoDB: MySQL database directory from another database?\n"
"InnoDB: You can look for further help from\n"
- "InnoDB: http://dev.mysql.com/doc/mysql/en/"
- "InnoDB_troubleshooting_datadict.html\n", stderr);
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n",
+ stderr);
goto funct_exit;
}
@@ -3570,8 +3479,8 @@ row_rename_table_for_mysql(
fputs(
" does not have an .ibd file in the database directory.\n"
"InnoDB: You can look for further help from\n"
- "InnoDB: http://dev.mysql.com/doc/mysql/en/"
- "InnoDB_troubleshooting_datadict.html\n", stderr);
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n",
+ stderr);
goto funct_exit;
}
@@ -3719,8 +3628,7 @@ end:
fputs(" to it.\n"
"InnoDB: Have you deleted the .frm file and not used DROP TABLE?\n"
"InnoDB: You can look for further help from\n"
- "InnoDB: http://dev.mysql.com/doc/mysql/en/"
- "InnoDB_troubleshooting_datadict.html\n"
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
"InnoDB: If table ", stderr);
ut_print_name(stderr, trx, TRUE, new_name);
fputs(
@@ -3748,8 +3656,8 @@ end:
trx_general_rollback_for_mysql(trx, FALSE, NULL);
trx->error_state = DB_SUCCESS;
ut_print_timestamp(stderr);
- fputs(" InnoDB: Error in table rename, cannot rename ",
- stderr);
+ fputs(
+" InnoDB: Error in table rename, cannot rename ", stderr);
ut_print_name(stderr, trx, TRUE, old_name);
fputs(" to ", stderr);
ut_print_name(stderr, trx, TRUE, new_name);
@@ -3797,10 +3705,7 @@ end:
funct_exit:
trx_commit_for_mysql(trx);
-
- if (!recovering_temp_table) {
- row_mysql_unlock_data_dictionary(trx);
- }
+ row_mysql_unlock_data_dictionary(trx);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
@@ -3968,7 +3873,7 @@ row_check_table_for_mysql(
"InnoDB: Have you deleted the .ibd file from the database directory under\n"
"InnoDB: the MySQL datadir, or have you used DISCARD TABLESPACE?\n"
"InnoDB: Look from\n"
-"http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n"
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
"InnoDB: how you can resolve the problem.\n",
prebuilt->table->name);
return(DB_ERROR);
diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
index f79bda5d6d8..251ee95886f 100644
--- a/storage/innobase/row/row0sel.c
+++ b/storage/innobase/row/row0sel.c
@@ -3245,7 +3245,7 @@ row_search_for_mysql(
"InnoDB: Have you deleted the .ibd file from the database directory under\n"
"InnoDB: the MySQL datadir, or have you used DISCARD TABLESPACE?\n"
"InnoDB: Look from\n"
-"http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n"
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
"InnoDB: how you can resolve the problem.\n",
prebuilt->table->name);
diff --git a/storage/innobase/row/row0vers.c b/storage/innobase/row/row0vers.c
index ab3b6385146..07b75a34347 100644
--- a/storage/innobase/row/row0vers.c
+++ b/storage/innobase/row/row0vers.c
@@ -553,7 +553,7 @@ row_vers_build_for_semi_consistent_read(
mem_heap_t* heap = NULL;
byte* buf;
ulint err;
- dulint rec_trx_id;
+ dulint rec_trx_id = ut_dulint_create(0, 0);
ut_ad(index->type & DICT_CLUSTERED);
ut_ad(mtr_memo_contains(mtr, buf_block_align(rec), MTR_MEMO_PAGE_X_FIX)
diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
index 205b54004ce..8346203f3f7 100644
--- a/storage/innobase/srv/srv0start.c
+++ b/storage/innobase/srv/srv0start.c
@@ -1691,7 +1691,7 @@ NetWare. */
"InnoDB: You have now successfully upgraded to the multiple tablespaces\n"
"InnoDB: format. You should NOT DOWNGRADE to an earlier version of\n"
"InnoDB: InnoDB! But if you absolutely need to downgrade, see\n"
-"InnoDB: http://dev.mysql.com/doc/mysql/en/Multiple_tablespaces.html\n"
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/multiple-tablespaces.html\n"
"InnoDB: for instructions.\n");
}
diff --git a/storage/innobase/ut/ut0dbg.c b/storage/innobase/ut/ut0dbg.c
index a9391cd3adc..87960b98556 100644
--- a/storage/innobase/ut/ut0dbg.c
+++ b/storage/innobase/ut/ut0dbg.c
@@ -42,7 +42,7 @@ ut_dbg_assertion_failed(
{
ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Assertion failure in thread %lu"
+ " InnoDB: Assertion failure in thread %lu"
" in file %s line %lu\n",
os_thread_pf(os_thread_get_curr_id()), file, line);
if (expr) {
@@ -56,7 +56,7 @@ ut_dbg_assertion_failed(
"InnoDB: If you get repeated assertion failures or crashes, even\n"
"InnoDB: immediately after the mysqld startup, there may be\n"
"InnoDB: corruption in the InnoDB tablespace. Please refer to\n"
-"InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html\n"
+"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr);
#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
ut_dbg_stop_threads = TRUE;
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index d0bbe74d046..20bfd7188d2 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -626,6 +626,9 @@ fi
%attr(755, root, root) %{_bindir}/ndb_show_tables
%attr(755, root, root) %{_bindir}/ndb_test_platform
%attr(755, root, root) %{_bindir}/ndb_config
+%attr(755, root, root) %{_bindir}/ndb_error_reporter
+%attr(755, root, root) %{_bindir}/ndb_size.pl
+%attr(-, root, root) %{_datadir}/mysql/ndb_size.tmpl
%files ndb-extra
%defattr(-,root,root,0755)
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 02170f6aacb..5c697312db4 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -10444,8 +10444,8 @@ static void test_ps_i18n()
const char *stmt_text;
MYSQL_BIND bind_array[2];
- const char *koi8= ", ";
- const char *cp1251= ", ";
+ const char *koi8= "îÕ, ÚÁ ÒÙÂÁÌËÕ";
+ const char *cp1251= "Íó, çà ðûáàëêó";
char buf1[16], buf2[16];
ulong buf1_len, buf2_len;
@@ -14930,22 +14930,31 @@ static void test_bug15613()
/*
Bug#17667: An attacker has the opportunity to bypass query logging.
+
+ Note! Also tests Bug#21813, where prepared statements are used to
+ run queries
*/
static void test_bug17667()
{
int rc;
+ MYSQL_STMT *stmt;
+ enum query_type { QT_NORMAL, QT_PREPARED};
struct buffer_and_length {
+ enum query_type qt;
const char *buffer;
const uint length;
} statements[]= {
- { "drop table if exists bug17667", 29 },
- { "create table bug17667 (c varchar(20))", 37 },
- { "insert into bug17667 (c) values ('regular') /* NUL=\0 with comment */", 68 },
- { "insert into bug17667 (c) values ('NUL=\0 in value')", 50 },
- { "insert into bug17667 (c) values ('5 NULs=\0\0\0\0\0')", 48 },
- { "/* NUL=\0 with comment */ insert into bug17667 (c) values ('encore')", 67 },
- { "drop table bug17667", 19 },
- { NULL, 0 } };
+ { QT_NORMAL, "drop table if exists bug17667", 29 },
+ { QT_NORMAL, "create table bug17667 (c varchar(20))", 37 },
+ { QT_NORMAL, "insert into bug17667 (c) values ('regular') /* NUL=\0 with comment */", 68 },
+ { QT_PREPARED,
+ "insert into bug17667 (c) values ('prepared') /* NUL=\0 with comment */", 69, },
+ { QT_NORMAL, "insert into bug17667 (c) values ('NUL=\0 in value')", 50 },
+ { QT_NORMAL, "insert into bug17667 (c) values ('5 NULs=\0\0\0\0\0')", 48 },
+ { QT_PREPARED, "insert into bug17667 (c) values ('6 NULs=\0\0\0\0\0\0')", 50 },
+ { QT_NORMAL, "/* NUL=\0 with comment */ insert into bug17667 (c) values ('encore')", 67 },
+ { QT_NORMAL, "drop table bug17667", 19 },
+ { QT_NORMAL, NULL, 0 } };
struct buffer_and_length *statement_cursor;
FILE *log_file;
@@ -14955,9 +14964,36 @@ static void test_bug17667()
for (statement_cursor= statements; statement_cursor->buffer != NULL;
statement_cursor++) {
- rc= mysql_real_query(mysql, statement_cursor->buffer,
- statement_cursor->length);
- myquery(rc);
+ if (statement_cursor->qt == QT_NORMAL)
+ {
+ /* Run statement as normal query */
+ rc= mysql_real_query(mysql, statement_cursor->buffer,
+ statement_cursor->length);
+ myquery(rc);
+ }
+ else if (statement_cursor->qt == QT_PREPARED)
+ {
+ /*
+ Run as prepared statement
+
+ NOTE! All these queries should be in the log twice,
+ one time for prepare and one time for execute
+ */
+ stmt= mysql_stmt_init(mysql);
+
+ rc= mysql_stmt_prepare(stmt, statement_cursor->buffer,
+ statement_cursor->length);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ mysql_stmt_close(stmt);
+ }
+ else
+ {
+ assert(0==1);
+ }
}
/* Make sure the server has written the logs to disk before reading it */
@@ -14968,34 +15004,43 @@ static void test_bug17667()
strcpy(master_log_filename, opt_vardir);
strcat(master_log_filename, "/log/master.log");
printf("Opening '%s'\n", master_log_filename);
- log_file= fopen(master_log_filename, "r");
+ log_file= my_fopen(master_log_filename, (int) (O_RDONLY | O_BINARY), MYF(MY_WME));
free(master_log_filename);
if (log_file != NULL) {
for (statement_cursor= statements; statement_cursor->buffer != NULL;
statement_cursor++) {
+ int expected_hits= 1, hits= 0;
char line_buffer[MAX_TEST_QUERY_LENGTH*2];
/* more than enough room for the query and some marginalia. */
+ /* Prepared statments always occurs twice in log */
+ if (statement_cursor->qt == QT_PREPARED)
+ expected_hits++;
+
+ /* Loop until we found expected number of log entries */
do {
- memset(line_buffer, '/', MAX_TEST_QUERY_LENGTH*2);
+ /* Loop until statement is found in log */
+ do {
+ memset(line_buffer, '/', MAX_TEST_QUERY_LENGTH*2);
- if(fgets(line_buffer, MAX_TEST_QUERY_LENGTH*2, log_file) == NULL)
- {
- /* If fgets returned NULL, it indicates either error or EOF */
- if (feof(log_file))
- DIE("Found EOF before all statements where found");
- else
+ if(fgets(line_buffer, MAX_TEST_QUERY_LENGTH*2, log_file) == NULL)
{
+ /* If fgets returned NULL, it indicates either error or EOF */
+ if (feof(log_file))
+ DIE("Found EOF before all statements where found");
+
fprintf(stderr, "Got error %d while reading from file\n",
ferror(log_file));
DIE("Read error");
}
- }
- } while (my_memmem(line_buffer, MAX_TEST_QUERY_LENGTH*2,
- statement_cursor->buffer, statement_cursor->length) == NULL);
+ } while (my_memmem(line_buffer, MAX_TEST_QUERY_LENGTH*2,
+ statement_cursor->buffer,
+ statement_cursor->length) == NULL);
+ hits++;
+ } while (hits < expected_hits);
printf("Found statement starting with \"%s\"\n",
statement_cursor->buffer);
@@ -15013,7 +15058,7 @@ static void test_bug17667()
}
if (log_file != NULL)
- fclose(log_file);
+ my_fclose(log_file, MYF(0));
}