summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <bar@mysql.com/bar.intranet.mysql.r18.ru>2006-09-14 09:12:47 +0500
committerunknown <bar@mysql.com/bar.intranet.mysql.r18.ru>2006-09-14 09:12:47 +0500
commit4fd663b896bbbc22ff5b1aba805e460dfcc3d4e6 (patch)
tree675f76ed44e10cc3a6790ad57b049fdfa0401895
parentd2f7fe35584a75d5bc3a9a6950cc15d264e31241 (diff)
parentec2512cf184c6746df48e2dfd5f493c3278e393a (diff)
downloadmariadb-git-4fd663b896bbbc22ff5b1aba805e460dfcc3d4e6.tar.gz
Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/usr/home/bar/mysql-4.1.b20471v2 mysql-test/r/ctype_utf8.result: Auto merged mysql-test/t/ctype_utf8.test: Auto merged
-rw-r--r--.bzrignore1
-rwxr-xr-xBUILD/SETUP.sh12
-rwxr-xr-xBUILD/check-cpu355
-rwxr-xr-xBUILD/compile-ndb-autotest19
-rw-r--r--VC++Files/libmysqld/libmysqld.dsp4
-rw-r--r--VC++Files/libmysqld/libmysqld.vcproj36
-rw-r--r--VC++Files/libmysqld/libmysqld_ia64.dsp4
-rw-r--r--VC++Files/mysqldemb/mysqldemb.dsp4
-rw-r--r--VC++Files/mysqldemb/mysqldemb.vcproj36
-rw-r--r--VC++Files/mysqldemb/mysqldemb_ia64.dsp4
-rw-r--r--VC++Files/sql/mysqld.dsp4
-rw-r--r--VC++Files/sql/mysqld.vcproj76
-rw-r--r--VC++Files/sql/mysqld_ia64.dsp4
-rw-r--r--VC++Files/sql/mysqldmax.dsp16
-rw-r--r--VC++Files/sql/mysqldmax_ia64.dsp25
-rw-r--r--client/mysql.cc48
-rw-r--r--client/mysqldump.c16
-rw-r--r--client/mysqltest.c6
-rw-r--r--configure.in4
-rw-r--r--heap/hp_delete.c3
-rw-r--r--include/mysql_com.h3
-rw-r--r--innobase/ibuf/ibuf0ibuf.c15
-rw-r--r--libmysqld/lib_sql.cc8
-rw-r--r--man/Makefile.am3
-rw-r--r--myisam/mi_unique.c2
-rw-r--r--myisam/mi_update.c12
-rw-r--r--myisam/sort.c12
-rw-r--r--mysql-test/Makefile.am9
-rw-r--r--mysql-test/lib/mtr_cases.pl22
-rw-r--r--mysql-test/lib/mtr_match.pl17
-rw-r--r--mysql-test/lib/mtr_misc.pl18
-rwxr-xr-xmysql-test/mysql-test-run.pl33
-rw-r--r--mysql-test/r/ctype_cp1250_ch.result8
-rw-r--r--mysql-test/r/ctype_recoding.result11
-rw-r--r--mysql-test/r/ctype_ucs.result39
-rw-r--r--mysql-test/r/ctype_ucs2_def.result3
-rw-r--r--mysql-test/r/ctype_utf8.result59
-rw-r--r--mysql-test/r/distinct.result11
-rw-r--r--mysql-test/r/func_group.result2
-rw-r--r--mysql-test/r/func_misc.result4
-rw-r--r--mysql-test/r/func_str.result28
-rw-r--r--mysql-test/r/func_time.result28
-rw-r--r--mysql-test/r/grant.result9
-rw-r--r--mysql-test/r/grant2.result10
-rw-r--r--mysql-test/r/heap_btree.result35
-rw-r--r--mysql-test/r/innodb_mysql.result21
-rw-r--r--mysql-test/r/limit.result14
-rw-r--r--mysql-test/r/myisam.result4
-rw-r--r--mysql-test/r/mysqldump.result27
-rw-r--r--mysql-test/r/ndb_lock.result15
-rw-r--r--mysql-test/r/ps_1general.result2
-rw-r--r--mysql-test/r/repair.result11
-rw-r--r--mysql-test/r/select.result75
-rw-r--r--mysql-test/r/subselect.result51
-rw-r--r--mysql-test/r/subselect2.result12
-rw-r--r--mysql-test/t/ctype_cp1250_ch.test10
-rw-r--r--mysql-test/t/ctype_recoding.test12
-rw-r--r--mysql-test/t/ctype_ucs.test35
-rw-r--r--mysql-test/t/ctype_ucs2_def-master.opt2
-rw-r--r--mysql-test/t/ctype_ucs2_def.test5
-rw-r--r--mysql-test/t/ctype_utf8.test48
-rw-r--r--mysql-test/t/distinct.test11
-rw-r--r--mysql-test/t/func_misc.test7
-rw-r--r--mysql-test/t/func_str.test15
-rw-r--r--mysql-test/t/func_time.test30
-rw-r--r--mysql-test/t/grant.test10
-rw-r--r--mysql-test/t/grant2.test17
-rw-r--r--mysql-test/t/handler.test1
-rw-r--r--mysql-test/t/heap_btree.test20
-rw-r--r--mysql-test/t/innodb_mysql.test27
-rw-r--r--mysql-test/t/limit.test10
-rw-r--r--mysql-test/t/myisam.test10
-rw-r--r--mysql-test/t/mysql_client.test6
-rw-r--r--mysql-test/t/mysqlbinlog.test17
-rw-r--r--mysql-test/t/mysqldump.test8
-rw-r--r--mysql-test/t/ndb_lock.test15
-rw-r--r--mysql-test/t/ps_1general.test1
-rw-r--r--mysql-test/t/repair.test11
-rw-r--r--mysql-test/t/select.test45
-rw-r--r--mysql-test/t/subselect.test41
-rw-r--r--mysql-test/t/subselect2.test18
-rw-r--r--mysys/my_bitmap.c2
-rw-r--r--mysys/my_read.c47
-rw-r--r--ndb/include/ndbapi/NdbConnection.hpp4
-rw-r--r--ndb/include/ndbapi/NdbOperation.hpp2
-rw-r--r--ndb/src/kernel/blocks/ERROR_codes.txt3
-rw-r--r--ndb/src/kernel/blocks/dbdih/DbdihMain.cpp1
-rw-r--r--ndb/src/kernel/blocks/dblqh/DblqhMain.cpp15
-rw-r--r--ndb/src/kernel/blocks/dbtc/Dbtc.hpp4
-rw-r--r--ndb/src/kernel/blocks/dbtc/DbtcMain.cpp159
-rw-r--r--ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp10
-rw-r--r--ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp30
-rw-r--r--ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp16
-rw-r--r--ndb/src/ndbapi/NdbScanOperation.cpp13
-rw-r--r--ndb/test/ndbapi/testIndex.cpp52
-rw-r--r--ndb/test/ndbapi/testSystemRestart.cpp47
-rw-r--r--ndb/test/run-test/daily-basic-tests.txt4
-rwxr-xr-xnetware/BUILD/mwasmnlm5
-rwxr-xr-xnetware/BUILD/mwccnlm5
-rwxr-xr-xnetware/BUILD/mwldnlm5
-rw-r--r--scripts/fill_func_tables.sh11
-rw-r--r--scripts/make_binary_distribution.sh4
-rw-r--r--scripts/make_win_src_distribution.sh2
-rw-r--r--scripts/mysql_install_db.sh1
-rw-r--r--sql-common/client.c39
-rw-r--r--sql/field.cc48
-rw-r--r--sql/field.h2
-rw-r--r--sql/ha_ndbcluster.cc34
-rw-r--r--sql/ha_ndbcluster.h2
-rw-r--r--sql/item_cmpfunc.cc22
-rw-r--r--sql/item_cmpfunc.h2
-rw-r--r--sql/item_func.h3
-rw-r--r--sql/item_strfunc.cc35
-rw-r--r--sql/item_strfunc.h30
-rw-r--r--sql/item_subselect.cc16
-rw-r--r--sql/item_subselect.h9
-rw-r--r--sql/item_timefunc.cc6
-rw-r--r--sql/log.cc16
-rw-r--r--sql/mysql_priv.h3
-rw-r--r--sql/mysqld.cc11
-rw-r--r--sql/net_serv.cc2
-rw-r--r--sql/opt_range.h2
-rw-r--r--sql/set_var.cc5
-rw-r--r--sql/slave.cc2
-rw-r--r--sql/sql_acl.cc21
-rw-r--r--sql/sql_class.h1
-rw-r--r--sql/sql_lex.cc5
-rw-r--r--sql/sql_lex.h2
-rw-r--r--sql/sql_parse.cc6
-rw-r--r--sql/sql_repl.cc8
-rw-r--r--sql/sql_select.cc145
-rw-r--r--sql/sql_table.cc63
-rw-r--r--sql/sql_update.cc2
-rw-r--r--sql/sql_yacc.yy4
-rw-r--r--sql/table.cc6
-rw-r--r--strings/ctype-win1250ch.c4
-rw-r--r--strings/strtod.c2
-rw-r--r--support-files/mysql.spec.sh4
-rw-r--r--tests/mysql_client_test.c7
-rw-r--r--vio/viosocket.c30
140 files changed, 2234 insertions, 549 deletions
diff --git a/.bzrignore b/.bzrignore
index 6dd06504096..4325a9177fa 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -1059,3 +1059,4 @@ vio/test-sslserver
vio/viotest-ssl
libmysql/libmysql.ver
libmysqld/sql_locale.cc
+mysql-test/mtr
diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh
index 3f8a9ccaf22..285ed0ec402 100755
--- a/BUILD/SETUP.sh
+++ b/BUILD/SETUP.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-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
@@ -109,12 +109,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 b970a4b9a5b..e207d12d972 100755
--- a/BUILD/check-cpu
+++ b/BUILD/check-cpu
@@ -3,203 +3,206 @@
# 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
+ *Xeon*)
+ # 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
- *Xeon*)
- # 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*Mobile*)
- cpu_arg="pentium3m";
- ;;
- *Pentium*III*)
- cpu_arg="pentium3";
- ;;
- *Pentium*M*pro*)
- cpu_arg="pentium-m";
- ;;
- *Athlon*64*)
- cpu_arg="athlon64";
+ *Pentium*III*)
+ cpu_arg="pentium3";
;;
- *Athlon*)
- cpu_arg="athlon";
+ *Pentium*M*pro*)
+ cpu_arg="pentium-m";
;;
+ *Athlon*64*)
+ cpu_arg="athlon64";
+ ;;
+ *Athlon*)
+ cpu_arg="athlon";
+ ;;
- # 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'
- ;;
- *)
- 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'
+ ;;
+ *)
+ 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/BUILD/compile-ndb-autotest b/BUILD/compile-ndb-autotest
new file mode 100755
index 00000000000..be28cc28346
--- /dev/null
+++ b/BUILD/compile-ndb-autotest
@@ -0,0 +1,19 @@
+#! /bin/sh
+
+path=`dirname $0`
+. "$path/SETUP.sh"
+
+extra_configs="$max_configs --with-ndb-test --with-ndb-ccflags='-DERROR_INSERT'"
+if [ "$full_debug" ]
+then
+ extra_flags="$debug_cflags"
+ c_warnings="$c_warnings $debug_extra_warnings"
+ cxx_warnings="$cxx_warnings $debug_extra_warnings"
+ extra_configs="$debug_configs $extra_configs"
+else
+ extra_flags="$fast_cflags"
+fi
+
+extra_flags="$extra_flags $max_cflags -g"
+
+. "$path/FINISH.sh"
diff --git a/VC++Files/libmysqld/libmysqld.dsp b/VC++Files/libmysqld/libmysqld.dsp
index 0e3e6af03f0..a07f94ef135 100644
--- a/VC++Files/libmysqld/libmysqld.dsp
+++ b/VC++Files/libmysqld/libmysqld.dsp
@@ -468,6 +468,10 @@ SOURCE=..\sql\sql_load.cpp
# End Source File
# Begin Source File
+SOURCE=..\sql\sql_locale.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\sql\sql_manager.cpp
# End Source File
# Begin Source File
diff --git a/VC++Files/libmysqld/libmysqld.vcproj b/VC++Files/libmysqld/libmysqld.vcproj
index ecbd7383478..a557290117b 100644
--- a/VC++Files/libmysqld/libmysqld.vcproj
+++ b/VC++Files/libmysqld/libmysqld.vcproj
@@ -2946,6 +2946,42 @@
</FileConfiguration>
</File>
<File
+ RelativePath="..\sql\sql_locale.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;SAFEMALLOC;HAVE_BERKELEY_DB;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;USE_TLS;__WIN__;$(NoInherit)"
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="pro|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="classic|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/>
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\sql\sql_manager.cpp">
<FileConfiguration
Name="Debug|Win32">
diff --git a/VC++Files/libmysqld/libmysqld_ia64.dsp b/VC++Files/libmysqld/libmysqld_ia64.dsp
index fe99ea480c7..49e4750ce6e 100644
--- a/VC++Files/libmysqld/libmysqld_ia64.dsp
+++ b/VC++Files/libmysqld/libmysqld_ia64.dsp
@@ -450,6 +450,10 @@ SOURCE=..\sql\sql_load.cpp
# End Source File
# Begin Source File
+SOURCE=..\sql\sql_locale.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\sql\sql_manager.cpp
# End Source File
# Begin Source File
diff --git a/VC++Files/mysqldemb/mysqldemb.dsp b/VC++Files/mysqldemb/mysqldemb.dsp
index a8207d436a0..63a91ee674e 100644
--- a/VC++Files/mysqldemb/mysqldemb.dsp
+++ b/VC++Files/mysqldemb/mysqldemb.dsp
@@ -363,6 +363,10 @@ SOURCE=..\sql\sql_lex.cpp
SOURCE=..\sql\sql_list.cpp
# End Source File
+# Begin Source File
+
+SOURCE=..\sql\sql_locale.cpp
+# End Source File
# Begin Source File
SOURCE=..\sql\sql_manager.cpp
diff --git a/VC++Files/mysqldemb/mysqldemb.vcproj b/VC++Files/mysqldemb/mysqldemb.vcproj
index 1105e750ee7..8c052735661 100644
--- a/VC++Files/mysqldemb/mysqldemb.vcproj
+++ b/VC++Files/mysqldemb/mysqldemb.vcproj
@@ -2234,6 +2234,42 @@
</FileConfiguration>
</File>
<File
+ RelativePath="..\sql\sql_locale.cpp">
+ <FileConfiguration
+ Name="classic|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="pro|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\sql\sql_manager.cpp">
<FileConfiguration
Name="classic|Win32">
diff --git a/VC++Files/mysqldemb/mysqldemb_ia64.dsp b/VC++Files/mysqldemb/mysqldemb_ia64.dsp
index 5b54a7756e1..9d7367e4c0f 100644
--- a/VC++Files/mysqldemb/mysqldemb_ia64.dsp
+++ b/VC++Files/mysqldemb/mysqldemb_ia64.dsp
@@ -365,6 +365,10 @@ SOURCE=..\sql\sql_list.cpp
# End Source File
# Begin Source File
+SOURCE=..\sql\sql_locale.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\sql\sql_manager.cpp
# End Source File
# Begin Source File
diff --git a/VC++Files/sql/mysqld.dsp b/VC++Files/sql/mysqld.dsp
index 4034ac9f5d0..67521a77c6b 100644
--- a/VC++Files/sql/mysqld.dsp
+++ b/VC++Files/sql/mysqld.dsp
@@ -1610,6 +1610,10 @@ SOURCE=.\sql_load.cpp
# End Source File
# Begin Source File
+SOURCE=.\sql\sql_locale.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\sql_manager.cpp
# End Source File
# Begin Source File
diff --git a/VC++Files/sql/mysqld.vcproj b/VC++Files/sql/mysqld.vcproj
index cc1c0a0e83f..4df723a6560 100644
--- a/VC++Files/sql/mysqld.vcproj
+++ b/VC++Files/sql/mysqld.vcproj
@@ -6084,6 +6084,82 @@
</FileConfiguration>
</File>
<File
+ RelativePath="sql_locale.cpp">
+ <FileConfiguration
+ Name="classic nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Max|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Max nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="pro nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ OptimizeForProcessor="1"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="pro|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="classic|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="sql_manager.cpp">
<FileConfiguration
Name="classic nt|Win32">
diff --git a/VC++Files/sql/mysqld_ia64.dsp b/VC++Files/sql/mysqld_ia64.dsp
index 310f48fcfb9..b7d35751257 100644
--- a/VC++Files/sql/mysqld_ia64.dsp
+++ b/VC++Files/sql/mysqld_ia64.dsp
@@ -1607,6 +1607,10 @@ SOURCE=.\sql_load.cpp
# End Source File
# Begin Source File
+SOURCE=.\sql_locale.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\sql_manager.cpp
# End Source File
# Begin Source File
diff --git a/VC++Files/sql/mysqldmax.dsp b/VC++Files/sql/mysqldmax.dsp
index a7ed1b918c7..0b32a59c6d9 100644
--- a/VC++Files/sql/mysqldmax.dsp
+++ b/VC++Files/sql/mysqldmax.dsp
@@ -789,6 +789,22 @@ SOURCE=.\sql_load.cpp
# End Source File
# Begin Source File
+SOURCE=.\sql_locale.cpp
+
+!IF "$(CFG)" == "mysqldmax - Win32 Release"
+
+!ELSEIF "$(CFG)" == "mysqldmax - Win32 Debug"
+
+# ADD CPP /G5
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "mysqldmax - Win32 nt"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
SOURCE=.\sql_manager.cpp
# End Source File
# Begin Source File
diff --git a/VC++Files/sql/mysqldmax_ia64.dsp b/VC++Files/sql/mysqldmax_ia64.dsp
index 9d79d224e4a..444b043b5c2 100644
--- a/VC++Files/sql/mysqldmax_ia64.dsp
+++ b/VC++Files/sql/mysqldmax_ia64.dsp
@@ -1195,6 +1195,31 @@ SOURCE=.\sql_load.cpp
# End Source File
# Begin Source File
+SOURCE=.\sql_locale.cpp
+
+!IF "$(CFG)" == "mysqldmax - Win32 Release"
+
+!ELSEIF "$(CFG)" == "mysqldmax - Win32 Debug"
+
+# ADD CPP /G5 /Od
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "mysqldmax - Win32 nt"
+
+!ELSEIF "$(CFG)" == "mysqldmax - WinIA64 Release"
+
+!ELSEIF "$(CFG)" == "mysqldmax - WinIA64 Debug"
+
+# ADD CPP /G5 /Od /G2 /EHsc /D"_IA64_" /Zi /D"WIN64" /D"WIN32" /D"_AFX_NO_DAO_SUPPORT" /Wp64 /Zm600
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "mysqldmax - WinIA64 nt"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
SOURCE=.\sql_manager.cpp
# End Source File
# Begin Source File
diff --git a/client/mysql.cc b/client/mysql.cc
index 09818ae27b3..f9ca9d4f829 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -550,13 +550,13 @@ static struct my_option my_long_options[] =
{"force", 'f', "Continue even if we get an sql error.",
(gptr*) &ignore_errors, (gptr*) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
- {"no-named-commands", 'g',
- "Named commands are disabled. Use \\* form only, or use named commands only in the beginning of a line ending with a semicolon (;) Since version 10.9 the client now starts with this option ENABLED by default! Disable with '-G'. Long format commands still work from the first line. WARNING: option deprecated; use --disable-named-commands instead.",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"named-commands", 'G',
"Enable named commands. Named commands mean this program's internal commands; see mysql> help . When enabled, the named commands can be used from any line of the query, otherwise only from the first line, before an enter. Disable with --disable-named-commands. This option is disabled by default.",
(gptr*) &named_cmds, (gptr*) &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
+ {"no-named-commands", 'g',
+ "Named commands are disabled. Use \\* form only, or use named commands only in the beginning of a line ending with a semicolon (;) Since version 10.9 the client now starts with this option ENABLED by default! Disable with '-G'. Long format commands still work from the first line. WARNING: option deprecated; use --disable-named-commands instead.",
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"ignore-spaces", 'i', "Ignore space after function names.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.",
@@ -575,13 +575,6 @@ static struct my_option my_long_options[] =
NO_ARG, 1, 0, 0, 0, 0, 0},
{"skip-line-numbers", 'L', "Don't write line number for errors. WARNING: -L is deprecated, use long version of this option instead.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
-#ifdef USE_POPEN
- {"no-pager", OPT_NOPAGER,
- "Disable pager and print to stdout. See interactive help (\\h) also. WARNING: option deprecated; use --disable-pager instead.",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-#endif
- {"no-tee", OPT_NOTEE, "Disable outfile. See interactive help (\\h) also. WARNING: option deprecated; use --disable-tee instead", 0, 0, 0, GET_NO_ARG,
- NO_ARG, 0, 0, 0, 0, 0, 0},
{"unbuffered", 'n', "Flush buffer after each query.", (gptr*) &unbuffered,
(gptr*) &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"column-names", OPT_COLUMN_NAMES, "Write column names in results.",
@@ -601,8 +594,11 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef USE_POPEN
{"pager", OPT_PAGER,
- "Pager to use to display results. If you don't supply an option the default pager is taken from your ENV variable PAGER. Valid pagers are less, more, cat [> filename], etc. See interactive help (\\h) also. This option does not work in batch mode.",
+ "Pager to use to display results. If you don't supply an option the default pager is taken from your ENV variable PAGER. Valid pagers are less, more, cat [> filename], etc. See interactive help (\\h) also. This option does not work in batch mode. Disable with --disable-pager. This option is disabled by default.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"no-pager", OPT_NOPAGER,
+ "Disable pager and print to stdout. See interactive help (\\h) also. WARNING: option deprecated; use --disable-pager instead.",
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"password", 'p',
"Password to use when connecting to server. If password is not given it's asked from the tty.",
@@ -643,8 +639,10 @@ static struct my_option my_long_options[] =
{"debug-info", 'T', "Print some debug info at exit.", (gptr*) &info_flag,
(gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"tee", OPT_TEE,
- "Append everything into outfile. See interactive help (\\h) also. Does not work in batch mode.",
+ "Append everything into outfile. See interactive help (\\h) also. Does not work in batch mode. Disable with --disable-tee. This option is disabled by default.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"no-tee", OPT_NOTEE, "Disable outfile. See interactive help (\\h) also. WARNING: option deprecated; use --disable-tee instead", 0, 0, 0, GET_NO_ARG,
+ NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user.", (gptr*) &current_user,
(gptr*) &current_user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -1725,7 +1723,14 @@ static int com_server_help(String *buffer __attribute__((unused)),
if (help_arg[0] != '\'')
{
- (void) strxnmov(cmd_buf, sizeof(cmd_buf), "help '", help_arg, "'", NullS);
+ char *end_arg= strend(help_arg);
+ if(--end_arg)
+ {
+ while (my_isspace(charset_info,*end_arg))
+ end_arg--;
+ *++end_arg= '\0';
+ }
+ (void) strxnmov(cmd_buf, sizeof(cmd_buf), "help '", help_arg, "'", NullS);
server_cmd= cmd_buf;
}
@@ -1811,9 +1816,13 @@ com_help(String *buffer __attribute__((unused)),
{
reg1 int i, j;
char * help_arg= strchr(line,' '), buff[32], *end;
-
if (help_arg)
- return com_server_help(buffer,line,help_arg+1);
+ {
+ while (my_isspace(charset_info,*help_arg))
+ help_arg++;
+ if (*help_arg)
+ return com_server_help(buffer,line,help_arg);
+ }
put_info("\nFor information about MySQL products and services, visit:\n"
" http://www.mysql.com/\n"
@@ -2145,9 +2154,14 @@ print_table_data(MYSQL_RES *result)
(void) tee_fputs("|", PAGER);
for (uint off=0; (field = mysql_fetch_field(result)) ; off++)
{
- tee_fprintf(PAGER, " %-*s|",(int) min(field->max_length,
+ uint name_length= (uint) strlen(field->name);
+ uint numcells= charset_info->cset->numcells(charset_info,
+ field->name,
+ field->name + name_length);
+ uint display_length= field->max_length + name_length - numcells;
+ tee_fprintf(PAGER, " %-*s|",(int) min(display_length,
MAX_COLUMN_LENGTH),
- field->name);
+ field->name);
num_flag[off]= IS_NUM(field->type);
}
(void) tee_fputs("\n", PAGER);
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 58e51b9b955..7f495ccdafb 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -783,8 +783,8 @@ static int get_options(int *argc, char ***argv)
static void DBerror(MYSQL *mysql, const char *when)
{
DBUG_ENTER("DBerror");
- my_printf_error(0,"Got error: %d: %s %s", MYF(0),
- mysql_errno(mysql), mysql_error(mysql), when);
+ fprintf(stderr, "%s: Got error: %d: %s %s\n", my_progname,
+ mysql_errno(mysql), mysql_error(mysql), when);
safe_exit(EX_MYSQLERR);
DBUG_VOID_RETURN;
} /* DBerror */
@@ -811,9 +811,9 @@ static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res,
if (mysql_query(mysql_con, query) ||
(res && !((*res)= mysql_store_result(mysql_con))))
{
- my_printf_error(0, "%s: Couldn't execute '%s': %s (%d)",
- MYF(0), my_progname, query,
- mysql_error(mysql_con), mysql_errno(mysql_con));
+ fprintf(stderr, "%s: Couldn't execute '%s': %s (%d)\n",
+ my_progname, query,
+ mysql_error(mysql_con), mysql_errno(mysql_con));
return 1;
}
return 0;
@@ -1705,13 +1705,19 @@ static void dumpTable(uint numFields, char *table)
check_io(md_result_file);
}
if (mysql_query_with_error_report(sock, 0, query))
+ {
DBerror(sock, "when retrieving data from server");
+ goto err;
+ }
if (quick)
res=mysql_use_result(sock);
else
res=mysql_store_result(sock);
if (!res)
+ {
DBerror(sock, "when retrieving data from server");
+ goto err;
+ }
if (verbose)
fprintf(stderr, "-- Retrieving rows...\n");
if (mysql_num_fields(res) != numFields)
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 3f2e7d8edb6..ad0f9f857bb 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -147,7 +147,7 @@ const char *user = 0, *host = 0, *unix_sock = 0, *opt_basedir="./";
static int port = 0;
static my_bool opt_big_test= 0, opt_compress= 0, silent= 0, verbose = 0;
static my_bool tty_password= 0, ps_protocol= 0, ps_protocol_enabled= 0;
-static uint start_lineno, *lineno;
+static uint start_lineno= 0, *lineno;
const char *manager_user="root",*manager_host=0;
char *manager_pass=0;
int manager_port=MYSQL_MANAGER_PORT;
@@ -580,7 +580,7 @@ static void die(const char *fmt, ...)
if (cur_file && cur_file != file_stack)
fprintf(stderr, "In included file \"%s\": ",
cur_file->file_name);
- if (start_lineno != 0)
+ if (start_lineno > 0)
fprintf(stderr, "At line %u: ", start_lineno);
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
@@ -4072,6 +4072,8 @@ int main(int argc, char **argv)
parser.current_line += current_line_inc;
}
+ start_lineno= 0;
+
if (!query_executed && result_file && my_stat(result_file, &res_info, 0))
{
/*
diff --git a/configure.in b/configure.in
index 314f9117ad8..6cccb1bb90e 100644
--- a/configure.in
+++ b/configure.in
@@ -2380,12 +2380,16 @@ then
man_dirs="man"
man1_files=`ls -1 $srcdir/man/*.1 | sed -e 's;^.*man/;;'`
man1_files=`echo $man1_files`
+ man8_files=`ls -1 $srcdir/man/*.8 | sed -e 's;^.*man/;;'`
+ man8_files=`echo $man8_files`
else
man_dirs=""
man1_files=""
+ man8_files=""
fi
AC_SUBST(man_dirs)
AC_SUBST(man1_files)
+AC_SUBST(man8_files)
# Shall we build the bench code?
AC_ARG_WITH(bench,
diff --git a/heap/hp_delete.c b/heap/hp_delete.c
index 90e537081d3..266a9da6ca3 100644
--- a/heap/hp_delete.c
+++ b/heap/hp_delete.c
@@ -73,7 +73,10 @@ int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
int res;
if (flag)
+ {
info->last_pos= NULL; /* For heap_rnext/heap_rprev */
+ info->lastkey_len= 0;
+ }
custom_arg.keyseg= keyinfo->seg;
custom_arg.key_length= hp_rb_make_key(keyinfo, info->recbuf, record, recpos);
diff --git a/include/mysql_com.h b/include/mysql_com.h
index 56c7f7d2ab5..28c3f86701f 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -26,6 +26,9 @@
#define USERNAME_LENGTH 16
#define SERVER_VERSION_LENGTH 60
#define SQLSTATE_LENGTH 5
+#define SYSTEM_CHARSET_MBMAXLEN 3
+#define NAME_BYTE_LEN NAME_LEN*SYSTEM_CHARSET_MBMAXLEN
+#define USERNAME_BYTE_LENGTH USERNAME_LENGTH*SYSTEM_CHARSET_MBMAXLEN
#define LOCAL_HOST "localhost"
#define LOCAL_HOST_NAMEDPIPE "."
diff --git a/innobase/ibuf/ibuf0ibuf.c b/innobase/ibuf/ibuf0ibuf.c
index 2191cdc0ee6..a0011629427 100644
--- a/innobase/ibuf/ibuf0ibuf.c
+++ b/innobase/ibuf/ibuf0ibuf.c
@@ -945,14 +945,11 @@ ibool
ibuf_fixed_addr_page(
/*=================*/
/* out: TRUE if a fixed address ibuf i/o page */
+ ulint space, /* in: space id */
ulint page_no)/* in: page number */
{
- if ((ibuf_bitmap_page(page_no))
- || (page_no == IBUF_TREE_ROOT_PAGE_NO)) {
- return(TRUE);
- }
-
- return(FALSE);
+ return((space == 0 && page_no == IBUF_TREE_ROOT_PAGE_NO)
+ || ibuf_bitmap_page(page_no));
}
/***************************************************************************
@@ -976,7 +973,7 @@ ibuf_page(
return(FALSE);
}
- if (ibuf_fixed_addr_page(page_no)) {
+ if (ibuf_fixed_addr_page(space, page_no)) {
return(TRUE);
}
@@ -1024,7 +1021,7 @@ ibuf_page_low(
return(FALSE);
}
#endif
- if (ibuf_fixed_addr_page(page_no)) {
+ if (ibuf_fixed_addr_page(space, page_no)) {
return(TRUE);
}
@@ -2931,7 +2928,7 @@ ibuf_merge_or_delete_for_page(
return;
}
#endif
- if (ibuf_fixed_addr_page(page_no) || fsp_descr_page(page_no)
+ if (ibuf_fixed_addr_page(space, page_no) || fsp_descr_page(page_no)
|| trx_sys_hdr_page(space, page_no)) {
return;
}
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index d270fe25306..1a3e10f08a8 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -674,10 +674,14 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
}
else
{
+ uint max_char_len;
/* With conversion */
client_field->charsetnr= thd_cs->number;
- uint char_len= server_field.length / item->collation.collation->mbmaxlen;
- client_field->length= char_len * thd_cs->mbmaxlen;
+ max_char_len= (server_field.type >= (int) MYSQL_TYPE_TINY_BLOB &&
+ server_field.type <= (int) MYSQL_TYPE_BLOB) ?
+ server_field.length / item->collation.collation->mbminlen :
+ server_field.length / item->collation.collation->mbmaxlen;
+ client_field->length= max_char_len * thd_cs->mbmaxlen;
}
client_field->type= server_field.type;
client_field->flags= server_field.flags;
diff --git a/man/Makefile.am b/man/Makefile.am
index 9702c4b2ace..5753259fd3d 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -18,7 +18,8 @@
## Process this file with automake to create Makefile.in
man1_MANS = @man1_files@
-EXTRA_DIST = $(man1_MANS)
+man8_MANS = @man8_files@
+EXTRA_DIST = $(man1_MANS) $(man8_MANS)
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/myisam/mi_unique.c b/myisam/mi_unique.c
index b5baa448609..1a116e50174 100644
--- a/myisam/mi_unique.c
+++ b/myisam/mi_unique.c
@@ -185,7 +185,7 @@ int mi_unique_comp(MI_UNIQUEDEF *def, const byte *a, const byte *b,
if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT)
{
if (mi_compare_text(keyseg->charset, (uchar *) pos_a, length,
- (uchar *) pos_b, length, 0, 0))
+ (uchar *) pos_b, length, 0, 1))
return 1;
}
else
diff --git a/myisam/mi_update.c b/myisam/mi_update.c
index 672c8407353..00eee18bfab 100644
--- a/myisam/mi_update.c
+++ b/myisam/mi_update.c
@@ -168,7 +168,17 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
info->update= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED | HA_STATE_AKTIV |
key_changed);
myisam_log_record(MI_LOG_UPDATE,info,newrec,info->lastpos,0);
- VOID(_mi_writeinfo(info,key_changed ? WRITEINFO_UPDATE_KEYFILE : 0));
+ /*
+ Every myisam function that updates myisam table must end with
+ call to _mi_writeinfo(). If operation (second param of
+ _mi_writeinfo()) is not 0 it sets share->changed to 1, that is
+ flags that data has changed. If operation is 0, this function
+ equals to no-op in this case.
+
+ mi_update() must always pass !0 value as operation, since even if
+ there is no index change there could be data change.
+ */
+ VOID(_mi_writeinfo(info, WRITEINFO_UPDATE_KEYFILE));
allow_break(); /* Allow SIGHUP & SIGINT */
if (info->invalidator != 0)
{
diff --git a/myisam/sort.c b/myisam/sort.c
index 96b55d599c8..1a3dc147cd9 100644
--- a/myisam/sort.c
+++ b/myisam/sort.c
@@ -480,13 +480,6 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
if (!got_error)
{
share->state.key_map|=(ulonglong) 1 << sinfo->key;
- if (param->testflag & T_STATISTICS)
- update_key_parts(sinfo->keyinfo, rec_per_key_part, sinfo->unique,
- param->stats_method == MI_STATS_METHOD_IGNORE_NULLS?
- sinfo->notnull: NULL,
- (ulonglong) info->state->records);
-
-
if (!sinfo->buffpek.elements)
{
if (param->testflag & T_VERBOSE)
@@ -498,6 +491,11 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
flush_ft_buf(sinfo) || flush_pending_blocks(sinfo))
got_error=1;
}
+ if (!got_error && param->testflag & T_STATISTICS)
+ update_key_parts(sinfo->keyinfo, rec_per_key_part, sinfo->unique,
+ param->stats_method == MI_STATS_METHOD_IGNORE_NULLS?
+ sinfo->notnull: NULL,
+ (ulonglong) info->state->records);
}
my_free((gptr) sinfo->sort_keys,MYF(0));
my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff),
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index 7c2415dd6b6..1e6eb12f7b2 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -34,7 +34,7 @@ benchdir_root= $(prefix)
testdir = $(benchdir_root)/mysql-test
EXTRA_SCRIPTS = mysql-test-run.sh install_test_db.sh $(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 std_data/cacert.pem \
@@ -60,6 +60,7 @@ dist-hook:
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.000001 $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data
+ $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(distdir)/lib
$(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib
@@ -83,6 +84,7 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/include/*.inc $(DESTDIR)$(testdir)/include
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.*001 $(DESTDIR)$(testdir)/std_data
+ $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data
@@ -103,6 +105,11 @@ std_data/server-cert.pem:
std_data/server-key.pem:
@CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
+# mtr - a shortcut for executing mysql-test-run.pl
+mtr:
+ $(RM) -f mtr
+ $(LN_S) mysql-test-run.pl mtr
+
SUFFIXES = .sh
.sh:
diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl
index 3666c1aa01b..650fb79155d 100644
--- a/mysql-test/lib/mtr_cases.pl
+++ b/mysql-test/lib/mtr_cases.pl
@@ -193,6 +193,28 @@ sub collect_one_test_case($$$$$$) {
$tinfo->{'slave_restart'}= 1;
}
+ # Cluster is needed by test case if testname contains ndb
+ if ( defined mtr_match_substring($tname,"ndb") )
+ {
+ $tinfo->{'ndb_test'}= 1;
+ if ( $::opt_skip_ndbcluster )
+ {
+ # Skip all ndb tests
+ $tinfo->{'skip'}= 1;
+ return;
+ }
+ if ( ! $::opt_with_ndbcluster )
+ {
+ # Ndb is not supported, skip them
+ $tinfo->{'skip'}= 1;
+ return;
+ }
+ }
+ else
+ {
+ $tinfo->{'ndb_test'}= 0;
+ }
+
# FIXME what about embedded_server + ndbcluster, skip ?!
my $master_opt_file= "$testdir/$tname-master.opt";
diff --git a/mysql-test/lib/mtr_match.pl b/mysql-test/lib/mtr_match.pl
index eb5de655520..66b639c7f8e 100644
--- a/mysql-test/lib/mtr_match.pl
+++ b/mysql-test/lib/mtr_match.pl
@@ -50,6 +50,23 @@ sub mtr_match_extension ($$) {
}
+# Match a substring anywere in a string
+
+sub mtr_match_substring ($$) {
+ my $string= shift;
+ my $substring= shift;
+
+ if ( $string =~ /(.*)\Q$substring\E(.*)$/ ) # strncmp
+ {
+ return $1;
+ }
+ else
+ {
+ return undef; # NULL
+ }
+}
+
+
sub mtr_match_any_exact ($$) {
my $string= shift;
my $mlist= shift;
diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl
index 26d5b9ed283..08c99e90906 100644
--- a/mysql-test/lib/mtr_misc.pl
+++ b/mysql-test/lib/mtr_misc.pl
@@ -82,7 +82,14 @@ sub mtr_path_exists (@) {
sub mtr_script_exists (@) {
foreach my $path ( @_ )
{
- return $path if -x $path;
+ if($::glob_win32)
+ {
+ return $path if -f $path;
+ }
+ else
+ {
+ return $path if -x $path;
+ }
}
if ( @_ == 1 )
{
@@ -99,7 +106,14 @@ sub mtr_exe_exists (@) {
map {$_.= ".exe"} @path if $::glob_win32;
foreach my $path ( @path )
{
- return $path if -x $path;
+ if($::glob_win32)
+ {
+ return $path if -f $path;
+ }
+ else
+ {
+ return $path if -x $path;
+ }
}
if ( @path == 1 )
{
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 8cf14faec0c..d1e049ff883 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -233,6 +233,7 @@ our $opt_result_ext;
our $opt_skip;
our $opt_skip_rpl;
+our $opt_skip_im; # --skip-im on command line will just be ignored
our $opt_skip_test;
our $opt_sleep;
@@ -519,6 +520,7 @@ sub command_line_setup () {
'do-test=s' => \$opt_do_test,
'suite=s' => \$opt_suite,
'skip-rpl' => \$opt_skip_rpl,
+ 'skip-im' => \$opt_skip_im,
'skip-test=s' => \$opt_skip_test,
# Specify ports
@@ -898,7 +900,8 @@ sub executable_setup () {
$exe_mysqld= mtr_exe_exists ("$path_client_bindir/mysqld-nt",
"$path_client_bindir/mysqld",
"$path_client_bindir/mysqld-debug",
- "$path_client_bindir/mysqld-max");
+ "$path_client_bindir/mysqld-max",
+ "$path_client_bindir/mysqld-max-nt");
$path_language= mtr_path_exists("$glob_basedir/share/english/");
$path_charsetsdir= mtr_path_exists("$glob_basedir/share/charsets");
$exe_my_print_defaults=
@@ -1581,6 +1584,16 @@ sub run_testcase ($) {
{
$do_restart= 1; # Always restart if script to run
}
+ elsif ( $tinfo->{'ndb_test'} and $master->[0]->{'ndbcluster'} == 1 )
+ {
+ $do_restart= 1; # Restart with cluster
+ # print "Restarting because cluster need to be enabled\n";
+ }
+ elsif ($tinfo->{'ndb_test'} == 0 and $master->[0]->{'ndbcluster'} == 0)
+ {
+ $do_restart= 1; # Restart without cluster
+ # print "Restarting because cluster need to be disabled\n";
+ }
elsif ( $master->[0]->{'running_master_is_special'} and
$master->[0]->{'running_master_is_special'}->{'timezone'} eq
$tinfo->{'timezone'} and
@@ -1646,7 +1659,7 @@ sub run_testcase ($) {
if ( ! $opt_local_master )
{
- if ( $master->[0]->{'ndbcluster'} )
+ if ( $master->[0]->{'ndbcluster'} && $tinfo->{'ndb_test'})
{
$master->[0]->{'ndbcluster'}= ndbcluster_start();
if ( $master->[0]->{'ndbcluster'} )
@@ -1659,8 +1672,22 @@ sub run_testcase ($) {
{
# FIXME not correct location for do_before_start_master()
do_before_start_master($tname,$tinfo->{'master_sh'});
+
+ # Save skip_ndbcluster
+ my $save_opt_skip_ndbcluster= $opt_skip_ndbcluster;
+ if (!$tinfo->{'ndb_test'})
+ {
+ # Modify skip_ndbcluster so cluster is skipped for this
+ # and subsequent testcases(until we find one that does not cluster)
+ $opt_skip_ndbcluster= 1;
+ }
+
$master->[0]->{'pid'}=
mysqld_start('master',0,$tinfo->{'master_opt'},[]);
+
+ # Restore skip_ndbcluster
+ $opt_skip_ndbcluster= $save_opt_skip_ndbcluster;
+
if ( ! $master->[0]->{'pid'} )
{
report_failure_and_restart($tinfo);
@@ -2026,7 +2053,7 @@ sub mysqld_arguments ($$$$$) {
}
}
- if ( $opt_with_ndbcluster )
+ if ( $opt_with_ndbcluster && !$opt_skip_ndbcluster && $type eq 'master')
{
mtr_add_arg($args, "%s--ndbcluster", $prefix);
mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
diff --git a/mysql-test/r/ctype_cp1250_ch.result b/mysql-test/r/ctype_cp1250_ch.result
index 533bfb8cb53..b55849e4e12 100644
--- a/mysql-test/r/ctype_cp1250_ch.result
+++ b/mysql-test/r/ctype_cp1250_ch.result
@@ -42,3 +42,11 @@ id str
6 aaaaaa
7 aaaaaaa
drop table t1;
+set names cp1250;
+create table t1 (a varchar(15) collate cp1250_czech_cs NOT NULL, primary key(a));
+insert into t1 values("abcdefghá");
+insert into t1 values("ááèè");
+select a from t1 where a like "abcdefghá";
+a
+abcdefghá
+drop table t1;
diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result
index 0b5c6f8974c..2daa2d5ba0b 100644
--- a/mysql-test/r/ctype_recoding.result
+++ b/mysql-test/r/ctype_recoding.result
@@ -247,3 +247,14 @@ lpad(c1,3,'ö') lpad('ö',3,c1)
select rpad(c1,3,'ö'), rpad('ö',3,c1) from t1;
rpad(c1,3,'ö') rpad('ö',3,c1)
ßöö ößß
+drop table t1;
+set names koi8r;
+create table t1(a char character set cp1251 default _koi8r 0xFF);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(1) character set cp1251 default 'ÿ'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1(a char character set latin1 default _cp1251 0xFF);
+ERROR 42000: Invalid default value for 'a'
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index bcf9cc77519..24a4ca9a85f 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -722,3 +722,42 @@ 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 quote(name) from bug20536;
+quote(name)
+????????
+????????????????
+drop table bug20536;
+End of 4.1 tests
diff --git a/mysql-test/r/ctype_ucs2_def.result b/mysql-test/r/ctype_ucs2_def.result
index 897dbac251c..2f9dc4ae616 100644
--- a/mysql-test/r/ctype_ucs2_def.result
+++ b/mysql-test/r/ctype_ucs2_def.result
@@ -1,3 +1,6 @@
+show variables like 'collation_server';
+Variable_name Value
+collation_server ucs2_unicode_ci
show variables like "%character_set_ser%";
Variable_name Value
character_set_server ucs2
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 61083510854..452c071c010 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -924,6 +924,37 @@ NULL
select ifnull(NULL, _utf8'string');
ifnull(NULL, _utf8'string')
string
+set names utf8;
+create table t1 (s1 char(5) character set utf8 collate utf8_lithuanian_ci);
+insert into t1 values ('I'),('K'),('Y');
+select * from t1 where s1 < 'K' and s1 = 'Y';
+s1
+I
+Y
+select * from t1 where 'K' > s1 and s1 = 'Y';
+s1
+I
+Y
+drop table t1;
+create table t1 (s1 char(5) character set utf8 collate utf8_czech_ci);
+insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i');
+select * from t1 where s1 > 'd' and s1 = 'CH';
+s1
+ch
+CH
+Ch
+select * from t1 where 'd' < s1 and s1 = 'CH';
+s1
+ch
+CH
+Ch
+select * from t1 where s1 = 'cH' and s1 <> 'ch';
+s1
+cH
+select * from t1 where 'cH' = s1 and s1 <> 'ch';
+s1
+cH
+drop table t1;
create table t1 (a varchar(255)) default character set utf8;
insert into t1 values (1.0);
drop table t1;
@@ -1368,3 +1399,31 @@ id tid val
42749 72 VOLNÝ ADSL
44205 72 VOLNÝ ADSL
DROP TABLE t1;
+create table t1(a char(200) collate utf8_unicode_ci NOT NULL default '')
+default charset=utf8 collate=utf8_unicode_ci;
+insert into t1 values (unhex('65')), (unhex('C3A9')), (unhex('65'));
+explain select distinct a from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary
+select distinct a from t1;
+a
+e
+explain select a from t1 group by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
+select a from t1 group by a;
+a
+e
+drop table t1;
+set names utf8;
+grant select on test.* to юзер_юзер@localhost;
+user()
+юзер_юзер@localhost
+revoke all on test.* from юзер_юзер@localhost;
+drop user юзер_юзер@localhost;
+create database имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
+use имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
+select database();
+database()
+имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45
+drop database имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index c6c614a5646..6cdf4063291 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -555,3 +555,14 @@ EXPLAIN SELECT DISTINCT a,b,d FROM t2 GROUP BY c,b,d;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
DROP TABLE t1,t2;
+CREATE TABLE t1 (a int primary key, b int);
+INSERT INTO t1 (a,b) values (1,1), (2,3), (3,2);
+explain SELECT DISTINCT a, b FROM t1 ORDER BY b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
+SELECT DISTINCT a, b FROM t1 ORDER BY b;
+a b
+1 1
+3 2
+2 3
+DROP TABLE t1;
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index ffa68f279f3..932ef133087 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -824,6 +824,7 @@ select 1, min(a) from t1m where 1=99;
1 NULL
select 1, min(1) from t1m where a=99;
1 min(1)
+1 NULL
select 1, min(1) from t1m where 1=99;
1 min(1)
1 NULL
@@ -835,6 +836,7 @@ select 1, max(a) from t1m where 1=99;
1 NULL
select 1, max(1) from t1m where a=99;
1 max(1)
+1 NULL
select 1, max(1) from t1m where 1=99;
1 max(1)
1 NULL
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index 8bcdd8b7cbc..adf2035173f 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -93,3 +93,7 @@ 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
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 61a77c211d7..2c15e5581e8 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -1036,4 +1036,32 @@ a c
abc abc abc
xyz xyz xyz
DROP TABLE t1;
+CREATE TABLE t1 (s varchar(10));
+INSERT INTO t1 VALUES ('yadda'), ('yaddy');
+EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(s) > 'ab';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+Warnings:
+Note 1003 select test.t1.s AS `s` from test.t1 where (trim(test.t1.s) > _latin1'ab')
+EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM('y' FROM s) > 'ab';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+Warnings:
+Note 1003 select test.t1.s AS `s` from test.t1 where (trim(both _latin1'y' from test.t1.s) > _latin1'ab')
+EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(LEADING 'y' FROM s) > 'ab';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+Warnings:
+Note 1003 select test.t1.s AS `s` from test.t1 where (trim(leading _latin1'y' from test.t1.s) > _latin1'ab')
+EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(TRAILING 'y' FROM s) > 'ab';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+Warnings:
+Note 1003 select test.t1.s AS `s` from test.t1 where (trim(trailing _latin1'y' from test.t1.s) > _latin1'ab')
+EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(BOTH 'y' FROM s) > 'ab';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+Warnings:
+Note 1003 select test.t1.s AS `s` from test.t1 where (trim(both _latin1'y' from test.t1.s) > _latin1'ab')
+DROP TABLE t1;
End of 4.1 tests
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index fab0bf01f58..47a0f83802c 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -636,6 +636,13 @@ select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
monthname(str_to_date(null, '%m')) monthname(str_to_date(null, '%m')) monthname(str_to_date(1, '%m')) monthname(str_to_date(0, '%m'))
NULL NULL January NULL
+set time_zone='-6:00';
+create table t1(a timestamp);
+insert into t1 values (19691231190001);
+select * from t1;
+a
+1969-12-31 19:00:01
+drop table t1;
create table t1(f1 date, f2 time, f3 datetime);
insert into t1 values ("2006-01-01", "12:01:01", "2006-01-01 12:01:01");
insert into t1 values ("2006-01-02", "12:01:02", "2006-01-02 12:01:02");
@@ -688,3 +695,24 @@ t1 CREATE TABLE `t1` (
`from_unixtime(1) + 0` double(23,6) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H)
+union
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H);
+H
+120
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H)
+union
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H);
+H
+120
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H)
+union
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H);
+H
+05
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H)
+union
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
+H
+5
+End of 4.1 tests
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index dffa4988ea7..1960f3a76b9 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -383,7 +383,7 @@ GRANT SELECT (c) ON `mysqltest_2`.`t1` TO 'mysqltest_3'@'localhost'
update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1;
ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'q' in table 't1'
update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1;
-ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'd' in table 't2'
+ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1'
update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1;
ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1'
update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2;
@@ -402,6 +402,7 @@ revoke all on mysqltest_2.t1 from mysqltest_3@localhost;
revoke all on mysqltest_2.t2 from mysqltest_3@localhost;
grant all on mysqltest_2.* to mysqltest_3@localhost;
grant select on *.* to mysqltest_3@localhost;
+grant select on mysqltest_2.t1 to mysqltest_3@localhost;
flush privileges;
use mysqltest_1;
update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600;
@@ -409,11 +410,11 @@ update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'a' in table 't1'
use mysqltest_2;
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
-ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1'
+ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't1'
update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200;
-ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1'
+ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't2'
update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200;
-ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1'
+ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't1'
select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2;
a q b r
10 2 1 2
diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result
index 85963705718..c047dc033c6 100644
--- a/mysql-test/r/grant2.result
+++ b/mysql-test/r/grant2.result
@@ -143,3 +143,13 @@ flush privileges;
drop user mysqltest_3@host3;
drop user mysqltest_1@host1, mysqltest_2@host2, mysqltest_4@host4,
mysqltest_5@host5, mysqltest_6@host6, mysqltest_7@host7;
+create database mysqltest_1;
+grant select, insert, update on `mysqltest\_1`.* to mysqltest_1@localhost;
+set sql_log_off = 1;
+ERROR HY000: Access denied; you need the SUPER privilege for this operation
+set sql_log_bin = 0;
+ERROR HY000: Access denied; you need the SUPER privilege for this operation
+delete from mysql.user where user like 'mysqltest\_1';
+delete from mysql.db where user like 'mysqltest\_1';
+drop database mysqltest_1;
+flush privileges;
diff --git a/mysql-test/r/heap_btree.result b/mysql-test/r/heap_btree.result
index 5c60c97d674..e6492e90b80 100644
--- a/mysql-test/r/heap_btree.result
+++ b/mysql-test/r/heap_btree.result
@@ -246,3 +246,38 @@ DELETE from t1 where a < 100;
SELECT * from t1;
a
DROP TABLE t1;
+create table t1(a int not null, key using btree(a)) engine=heap;
+insert into t1 values (2), (2), (2), (1), (1), (3), (3), (3), (3);
+select a from t1 where a > 2;
+a
+3
+3
+3
+3
+delete from t1 where a < 4;
+select a from t1 order by a;
+a
+insert into t1 values (2), (2), (2), (1), (1), (3), (3), (3), (3);
+select a from t1 where a > 4;
+a
+delete from t1 where a > 4;
+select a from t1 order by a;
+a
+1
+1
+2
+2
+2
+3
+3
+3
+3
+select a from t1 where a > 3;
+a
+delete from t1 where a >= 2;
+select a from t1 order by a;
+a
+1
+1
+drop table t1;
+End of 4.1 tests
diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result
index 920d7aa42ce..ee4c114087d 100644
--- a/mysql-test/r/innodb_mysql.result
+++ b/mysql-test/r/innodb_mysql.result
@@ -83,3 +83,24 @@ b a
3 3
3 3
DROP TABLE t1, t2, t3;
+CREATE TABLE `t1` (`id1` INT) ;
+INSERT INTO `t1` (`id1`) VALUES (1),(5),(2);
+CREATE TABLE `t2` (
+`id1` INT,
+`id2` INT NOT NULL,
+`id3` INT,
+`id4` INT NOT NULL,
+UNIQUE (`id2`,`id4`),
+KEY (`id1`)
+) ENGINE=InnoDB;
+INSERT INTO `t2`(`id1`,`id2`,`id3`,`id4`) VALUES
+(1,1,1,0),
+(1,1,2,1),
+(5,1,2,2),
+(6,1,2,3),
+(1,2,2,2),
+(1,2,1,1);
+SELECT `id1` FROM `t1` WHERE `id1` NOT IN (SELECT `id1` FROM `t2` WHERE `id2` = 1 AND `id3` = 2);
+id1
+2
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/limit.result b/mysql-test/r/limit.result
index 6a3d2bffab0..92803ec3449 100644
--- a/mysql-test/r/limit.result
+++ b/mysql-test/r/limit.result
@@ -76,3 +76,17 @@ a
a
1
drop table t1;
+create table t1 (a int);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7);
+explain select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using temporary
+select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
+c
+7
+explain select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using temporary
+select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
+c
+28
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index ce601944f97..d7c9ba19a8a 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -773,12 +773,12 @@ show create table t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/'
show create table t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/'
create table t1 (a int) engine=myisam select 42 a;
select * from t1;
a
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 6c5c757061d..721982e11e3 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -1557,4 +1557,31 @@ CREATE TABLE `t2` (
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop table t1, t2, t3;
+create table t1 (a int);
+mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ * FROM `t1` WHERE xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': 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 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 (1064)
+mysqldump: Got error: 1064: 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 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 when retrieving data from server
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+drop table t1;
End of 4.1 tests
diff --git a/mysql-test/r/ndb_lock.result b/mysql-test/r/ndb_lock.result
index 875dcd775e6..c7413949f42 100644
--- a/mysql-test/r/ndb_lock.result
+++ b/mysql-test/r/ndb_lock.result
@@ -64,17 +64,26 @@ pk u o
insert into t1 values (1,1,1);
drop table t1;
create table t1 (x integer not null primary key, y varchar(32), z integer, key(z)) engine = ndb;
-insert into t1 values (1,'one',1), (2,'two',2),(3,"three",3);
+insert into t1 values (1,'one',1);
begin;
select * from t1 where x = 1 for update;
x y z
1 one 1
begin;
-select * from t1 where x = 2 for update;
+select * from t1 where x = 1 for update;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+rollback;
+rollback;
+insert into t1 values (2,'two',2),(3,"three",3);
+begin;
+select * from t1 where x = 1 for update;
x y z
-2 two 2
+1 one 1
select * from t1 where x = 1 for update;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+select * from t1 where x = 2 for update;
+x y z
+2 two 2
rollback;
commit;
begin;
diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result
index 49e858eca56..67b6c0d1b0b 100644
--- a/mysql-test/r/ps_1general.result
+++ b/mysql-test/r/ps_1general.result
@@ -282,7 +282,7 @@ t9 MyISAM 9 Dynamic 2 220 440 4294967295 2048 0 NULL # # # latin1_swedish_ci NUL
prepare stmt4 from ' show status like ''Threads_running'' ';
execute stmt4;
Variable_name Value
-Threads_running 1
+Threads_running #
prepare stmt4 from ' show variables like ''sql_mode'' ';
execute stmt4;
Variable_name Value
diff --git a/mysql-test/r/repair.result b/mysql-test/r/repair.result
index dbca5c39a6c..e0849452399 100644
--- a/mysql-test/r/repair.result
+++ b/mysql-test/r/repair.result
@@ -37,3 +37,14 @@ Table Op Msg_type Msg_text
test.t1 repair warning Number of rows changed from 0 to 1
test.t1 repair status OK
drop table t1;
+CREATE TABLE t1(a INT, KEY(a));
+INSERT INTO t1 VALUES(1),(2),(3),(4),(5);
+SET myisam_repair_threads=2;
+REPAIR TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A 5 NULL NULL YES BTREE
+SET myisam_repair_threads=@@global.myisam_repair_threads;
+DROP TABLE t1;
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index c7df11ab018..f09143fcaa6 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -2744,3 +2744,78 @@ SELECT i='1e+01',i=1e+01, i in (1e+01), i in ('1e+01') FROM t1;
i='1e+01' i=1e+01 i in (1e+01) i in ('1e+01')
0 1 1 1
DROP TABLE t1;
+CREATE TABLE t1 (a int, b int);
+INSERT INTO t1 VALUES (1,1), (2,1), (4,10);
+CREATE TABLE t2 (a int PRIMARY KEY, b int, KEY b (b));
+INSERT INTO t2 VALUES (1,NULL), (2,10);
+ALTER TABLE t1 ENABLE KEYS;
+EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index b b 5 NULL 2 Using index
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
+SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
+a b a b
+1 NULL 1 1
+1 NULL 2 1
+1 NULL 4 10
+2 10 4 10
+EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index b b 5 NULL 2 Using index
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
+SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
+a b a b
+1 NULL 1 1
+1 NULL 2 1
+1 NULL 4 10
+2 10 4 10
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (key1 float default NULL, UNIQUE KEY key1 (key1));
+CREATE TABLE t2 (key2 float default NULL, UNIQUE KEY key2 (key2));
+INSERT INTO t1 VALUES (0.3762),(0.3845),(0.6158),(0.7941);
+INSERT INTO t2 VALUES (1.3762),(1.3845),(1.6158),(1.7941);
+explain select max(key1) from t1 where key1 <= 0.6158;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+explain select max(key2) from t2 where key2 <= 1.6158;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+explain select min(key1) from t1 where key1 >= 0.3762;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+explain select min(key2) from t2 where key2 >= 1.3762;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+explain select max(key1), min(key2) from t1, t2
+where key1 <= 0.6158 and key2 >= 1.3762;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+explain select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+explain select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select max(key1) from t1 where key1 <= 0.6158;
+max(key1)
+0.61580002307892
+select max(key2) from t2 where key2 <= 1.6158;
+max(key2)
+1.6158000230789
+select min(key1) from t1 where key1 >= 0.3762;
+min(key1)
+0.37619999051094
+select min(key2) from t2 where key2 >= 1.3762;
+min(key2)
+1.3761999607086
+select max(key1), min(key2) from t1, t2
+where key1 <= 0.6158 and key2 >= 1.3762;
+max(key1) min(key2)
+0.61580002307892 1.3761999607086
+select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
+max(key1)
+0.61580002307892
+select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
+min(key1)
+0.37619999051094
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index c78f0951469..f5abc4ed42a 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -539,7 +539,7 @@ EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select max(test.t1.numreponse) AS `MAX(numreponse)` from test.t1 where (test.t1.numeropost = _latin1'1')
+Note 1003 select max(test.t1.numreponse) AS `MAX(numreponse)` from test.t1
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 Using index
@@ -2868,3 +2868,52 @@ select 1 from dual where 1 < any (select 2 from dual);
select 1 from dual where 1 < all (select 2 from dual where 1!=1);
1
1
+create table t1 (s1 char);
+insert into t1 values (1),(2);
+select * from t1 where (s1 < any (select s1 from t1));
+s1
+1
+select * from t1 where not (s1 < any (select s1 from t1));
+s1
+2
+select * from t1 where (s1 < ALL (select s1+1 from t1));
+s1
+1
+select * from t1 where not(s1 < ALL (select s1+1 from t1));
+s1
+2
+select * from t1 where (s1+1 = ANY (select s1 from t1));
+s1
+1
+select * from t1 where NOT(s1+1 = ANY (select s1 from t1));
+s1
+2
+select * from t1 where (s1 = ALL (select s1/s1 from t1));
+s1
+1
+select * from t1 where NOT(s1 = ALL (select s1/s1 from t1));
+s1
+2
+drop table t1;
+create table t1 (
+retailerID varchar(8) NOT NULL,
+statusID int(10) unsigned NOT NULL,
+changed datetime NOT NULL,
+UNIQUE KEY retailerID (retailerID, statusID, changed)
+);
+INSERT INTO t1 VALUES("0026", "1", "2005-12-06 12:18:56");
+INSERT INTO t1 VALUES("0026", "2", "2006-01-06 12:25:53");
+INSERT INTO t1 VALUES("0037", "1", "2005-12-06 12:18:56");
+INSERT INTO t1 VALUES("0037", "2", "2006-01-06 12:25:53");
+INSERT INTO t1 VALUES("0048", "1", "2006-01-06 12:37:50");
+INSERT INTO t1 VALUES("0059", "1", "2006-01-06 12:37:50");
+select * from t1 r1
+where (r1.retailerID,(r1.changed)) in
+(SELECT r2.retailerId,(max(changed)) from t1 r2
+group by r2.retailerId);
+retailerID statusID changed
+0026 2 2006-01-06 12:25:53
+0037 2 2006-01-06 12:25:53
+0048 1 2006-01-06 12:37:50
+0059 1 2006-01-06 12:37:50
+drop table t1;
diff --git a/mysql-test/r/subselect2.result b/mysql-test/r/subselect2.result
index 8fcfa06a8ae..db1848105f8 100644
--- a/mysql-test/r/subselect2.result
+++ b/mysql-test/r/subselect2.result
@@ -130,3 +130,15 @@ id select_type table type possible_keys key key_len ref rows Extra
5 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX PRIMARY 32 func 1 Using index; Using where
6 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 32 func 1 Using index; Using where
drop table t1, t2, t3, t4;
+CREATE TABLE t1 (a int(10) , PRIMARY KEY (a)) Engine=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (a int(10), PRIMARY KEY (a)) Engine=InnoDB;
+INSERT INTO t2 VALUES (1);
+CREATE TABLE t3 (a int(10), b int(10), c int(10),
+PRIMARY KEY (a)) Engine=InnoDB;
+INSERT INTO t3 VALUES (1,2,1);
+SELECT t1.* FROM t1 WHERE (SELECT COUNT(*) FROM t3,t2 WHERE t3.c=t2.a
+and t2.a='1' AND t1.a=t3.b) > 0;
+a
+2
+DROP TABLE t1,t2,t3;
diff --git a/mysql-test/t/ctype_cp1250_ch.test b/mysql-test/t/ctype_cp1250_ch.test
index 2d1e5f0bf9d..65550e0c193 100644
--- a/mysql-test/t/ctype_cp1250_ch.test
+++ b/mysql-test/t/ctype_cp1250_ch.test
@@ -44,4 +44,14 @@ INSERT INTO t1 VALUES (NULL, 'aaaaaaa');
select * from t1 where str like 'aa%';
drop table t1;
+#
+# Bug#19741 segfault with cp1250 charset + like + primary key + 64bit os
+#
+set names cp1250;
+create table t1 (a varchar(15) collate cp1250_czech_cs NOT NULL, primary key(a));
+insert into t1 values("abcdefghá");
+insert into t1 values("ááèè");
+select a from t1 where a like "abcdefghá";
+drop table t1;
+
# End of 4.1 tests
diff --git a/mysql-test/t/ctype_recoding.test b/mysql-test/t/ctype_recoding.test
index 5648cea7fd3..ddaaa7b9e4f 100644
--- a/mysql-test/t/ctype_recoding.test
+++ b/mysql-test/t/ctype_recoding.test
@@ -186,5 +186,17 @@ select rpad(c1,3,'ö'), rpad('ö',3,c1) from t1;
# TODO
#select case c1 when 'ß' then 'ß' when 'ö' then 'ö' else 'c' end from t1;
#select export_set(5,c1,'ö'), export_set(5,'ö',c1) from t1;
+drop table t1;
+
+#
+# Bug 20695: problem with field default value's character set
+#
+
+set names koi8r;
+create table t1(a char character set cp1251 default _koi8r 0xFF);
+show create table t1;
+drop table t1;
+--error 1067
+create table t1(a char character set latin1 default _cp1251 0xFF);
# End of 4.1 tests
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index a4d4d1846a7..d96b9938f1b 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -463,4 +463,37 @@ 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;
+
+# 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
diff --git a/mysql-test/t/ctype_ucs2_def-master.opt b/mysql-test/t/ctype_ucs2_def-master.opt
index 1f884ff1d67..a0b5b061860 100644
--- a/mysql-test/t/ctype_ucs2_def-master.opt
+++ b/mysql-test/t/ctype_ucs2_def-master.opt
@@ -1 +1 @@
---default-character-set=ucs2 --default-collation=ucs2_unicode_ci
+--default-collation=ucs2_unicode_ci --default-character-set=ucs2
diff --git a/mysql-test/t/ctype_ucs2_def.test b/mysql-test/t/ctype_ucs2_def.test
index fb174d551cf..00f636d79dc 100644
--- a/mysql-test/t/ctype_ucs2_def.test
+++ b/mysql-test/t/ctype_ucs2_def.test
@@ -1,4 +1,9 @@
#
+# MySQL Bug#15276: MySQL ignores collation-server
+#
+show variables like 'collation_server';
+
+#
# Bug#18004 Connecting crashes server when default charset is UCS2
#
show variables like "%character_set_ser%";
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 0f6f6978e6c..d17544bea14 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -728,6 +728,24 @@ select repeat(_utf8'+',3) as h union select NULL;
select ifnull(NULL, _utf8'string');
#
+# Bug#9509 Optimizer: wrong result after AND with comparisons
+#
+set names utf8;
+create table t1 (s1 char(5) character set utf8 collate utf8_lithuanian_ci);
+insert into t1 values ('I'),('K'),('Y');
+select * from t1 where s1 < 'K' and s1 = 'Y';
+select * from t1 where 'K' > s1 and s1 = 'Y';
+drop table t1;
+
+create table t1 (s1 char(5) character set utf8 collate utf8_czech_ci);
+insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i');
+select * from t1 where s1 > 'd' and s1 = 'CH';
+select * from t1 where 'd' < s1 and s1 = 'CH';
+select * from t1 where s1 = 'cH' and s1 <> 'ch';
+select * from t1 where 'cH' = s1 and s1 <> 'ch';
+drop table t1;
+
+#
# Bug#10714: Inserting double value into utf8 column crashes server
#
create table t1 (a varchar(255)) default character set utf8;
@@ -1110,4 +1128,34 @@ ALTER TABLE t1 ADD KEY idx (tid,val(11));
SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLNÝ ADSL';
DROP TABLE t1;
+
+#
+# Bug 20709: problem with utf8 fields in temporary tables
+#
+
+create table t1(a char(200) collate utf8_unicode_ci NOT NULL default '')
+ default charset=utf8 collate=utf8_unicode_ci;
+insert into t1 values (unhex('65')), (unhex('C3A9')), (unhex('65'));
+explain select distinct a from t1;
+select distinct a from t1;
+explain select a from t1 group by a;
+select a from t1 group by a;
+drop table t1;
+
+#
+# Bug#20393: User name truncation in mysql client
+# Bug#21432: Database/Table name limited to 64 bytes, not chars, problems with multi-byte
+#
+set names utf8;
+#create user юзер_юзер@localhost;
+grant select on test.* to юзер_юзер@localhost;
+--exec $MYSQL --default-character-set=utf8 --user=юзер_юзер -e "select user()"
+revoke all on test.* from юзер_юзер@localhost;
+drop user юзер_юзер@localhost;
+
+create database имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
+use имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
+select database();
+drop database имÑ_базы_в_кодировке_утф8_длиной_больше_чем_45;
+
# End of 4.1 tests
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test
index 8ca6f350b8d..2a87427a2b6 100644
--- a/mysql-test/t/distinct.test
+++ b/mysql-test/t/distinct.test
@@ -378,4 +378,15 @@ EXPLAIN SELECT DISTINCT a,b,d FROM t2 GROUP BY c,b,d;
DROP TABLE t1,t2;
+#
+# Bug 21456: SELECT DISTINCT(x) produces incorrect results when using order by
+#
+CREATE TABLE t1 (a int primary key, b int);
+
+INSERT INTO t1 (a,b) values (1,1), (2,3), (3,2);
+
+explain SELECT DISTINCT a, b FROM t1 ORDER BY b;
+SELECT DISTINCT a, b FROM t1 ORDER BY b;
+DROP TABLE t1;
+
# End of 4.1 tests
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index e2641f8d6cd..a7dc9e7c966 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -83,4 +83,9 @@ 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
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 9a1c75a8dc0..3c855a32eed 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -697,5 +697,20 @@ SELECT a, CONCAT(a,' ',a) AS c FROM t1
INSTR(REVERSE(CONCAT(a,' ',a))," ")) = a;
DROP TABLE t1;
+
+#
+# Bug#17526: WRONG PRINT for TRIM FUNCTION with two arguments
+#
+
+CREATE TABLE t1 (s varchar(10));
+INSERT INTO t1 VALUES ('yadda'), ('yaddy');
+
+EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(s) > 'ab';
+EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM('y' FROM s) > 'ab';
+EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(LEADING 'y' FROM s) > 'ab';
+EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(TRAILING 'y' FROM s) > 'ab';
+EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(BOTH 'y' FROM s) > 'ab';
+
+DROP TABLE t1;
--echo End of 4.1 tests
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index b232fb14e1e..472f3d81d2b 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -329,6 +329,16 @@ select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
#
+# Bug #16327: problem with timestamp < 1970
+#
+
+set time_zone='-6:00';
+create table t1(a timestamp);
+insert into t1 values (19691231190001);
+select * from t1;
+drop table t1;
+
+#
# Bug#16377 result of DATE/TIME functions were compared as strings which
# can lead to a wrong result.
#
@@ -358,4 +368,22 @@ create table t1 select now() - now(), curtime() - curtime(),
show create table t1;
drop table t1;
-# End of 4.1 tests
+#
+# Bug #19844 time_format in Union truncates values
+#
+
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H)
+union
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H);
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H)
+union
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H);
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H)
+union
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H);
+
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H)
+union
+(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
+
+--echo End of 4.1 tests
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index 60b60547fcc..3365145650a 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -323,7 +323,7 @@ connection conn1;
show grants for mysqltest_3@localhost;
--error 1143
update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1;
---error 1143
+--error 1142
update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1;
--error 1143
update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1;
@@ -343,6 +343,8 @@ revoke all on mysqltest_2.t2 from mysqltest_3@localhost;
#test the db/table level privileges
grant all on mysqltest_2.* to mysqltest_3@localhost;
grant select on *.* to mysqltest_3@localhost;
+# Next grant is needed to trigger bug#7391. Do not optimize!
+grant select on mysqltest_2.t1 to mysqltest_3@localhost;
flush privileges;
disconnect conn1;
connect (conn2,localhost,mysqltest_3,,);
@@ -354,11 +356,11 @@ update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600;
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
use mysqltest_2;
#the following used to succeed, it must fail now.
---error 1044
+--error 1142
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
---error 1044
+--error 1142
update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200;
---error 1044
+--error 1142
update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200;
#lets see the result
connection master;
diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test
index 79ea7f70712..9da95cd42da 100644
--- a/mysql-test/t/grant2.test
+++ b/mysql-test/t/grant2.test
@@ -238,5 +238,22 @@ connect (con9,127.0.0.1,root,,test,$MASTER_MYPORT,);
disconnect con9;
connection default;
+#
+# Bug# 16180 - Setting SQL_LOG_OFF without SUPER privilege is silently ignored
+#
+create database mysqltest_1;
+grant select, insert, update on `mysqltest\_1`.* to mysqltest_1@localhost;
+connect (con10,localhost,mysqltest_1,,);
+connection con10;
+--error 1227
+set sql_log_off = 1;
+--error 1227
+set sql_log_bin = 0;
+disconnect con10;
+connection default;
+delete from mysql.user where user like 'mysqltest\_1';
+delete from mysql.db where user like 'mysqltest\_1';
+drop database mysqltest_1;
+flush privileges;
# End of 4.1 tests
diff --git a/mysql-test/t/handler.test b/mysql-test/t/handler.test
index a78800d3d5a..55936e44b32 100644
--- a/mysql-test/t/handler.test
+++ b/mysql-test/t/handler.test
@@ -1,3 +1,4 @@
+-- source include/not_embedded.inc
#
# test of HANDLER ...
#
diff --git a/mysql-test/t/heap_btree.test b/mysql-test/t/heap_btree.test
index aea9e9486e5..9aa820becd9 100644
--- a/mysql-test/t/heap_btree.test
+++ b/mysql-test/t/heap_btree.test
@@ -164,4 +164,22 @@ DELETE from t1 where a < 100;
SELECT * from t1;
DROP TABLE t1;
-# End of 4.1 tests
+#
+# Bug #9719: problem with delete
+#
+
+create table t1(a int not null, key using btree(a)) engine=heap;
+insert into t1 values (2), (2), (2), (1), (1), (3), (3), (3), (3);
+select a from t1 where a > 2;
+delete from t1 where a < 4;
+select a from t1 order by a;
+insert into t1 values (2), (2), (2), (1), (1), (3), (3), (3), (3);
+select a from t1 where a > 4;
+delete from t1 where a > 4;
+select a from t1 order by a;
+select a from t1 where a > 3;
+delete from t1 where a >= 2;
+select a from t1 order by a;
+drop table t1;
+
+--echo End of 4.1 tests
diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test
index 0b789e1a6d5..a5fe248604f 100644
--- a/mysql-test/t/innodb_mysql.test
+++ b/mysql-test/t/innodb_mysql.test
@@ -90,3 +90,30 @@ SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
ORDER BY t1.b LIMIT 5;
DROP TABLE t1, t2, t3;
+
+
+# BUG#21077 (The testcase is not deterministic so correct execution doesn't
+# prove anything) For proof one should track if sequence of ha_innodb::* func
+# calls is correct.
+CREATE TABLE `t1` (`id1` INT) ;
+INSERT INTO `t1` (`id1`) VALUES (1),(5),(2);
+
+CREATE TABLE `t2` (
+ `id1` INT,
+ `id2` INT NOT NULL,
+ `id3` INT,
+ `id4` INT NOT NULL,
+ UNIQUE (`id2`,`id4`),
+ KEY (`id1`)
+) ENGINE=InnoDB;
+
+INSERT INTO `t2`(`id1`,`id2`,`id3`,`id4`) VALUES
+(1,1,1,0),
+(1,1,2,1),
+(5,1,2,2),
+(6,1,2,3),
+(1,2,2,2),
+(1,2,1,1);
+
+SELECT `id1` FROM `t1` WHERE `id1` NOT IN (SELECT `id1` FROM `t2` WHERE `id2` = 1 AND `id3` = 2);
+DROP TABLE t1, t2;
diff --git a/mysql-test/t/limit.test b/mysql-test/t/limit.test
index ef9f63067a4..f70cf835588 100644
--- a/mysql-test/t/limit.test
+++ b/mysql-test/t/limit.test
@@ -60,4 +60,14 @@ select 1 as a from t1 union all select 1 from dual limit 1;
(select 1 as a from t1) union all (select 1 from dual) limit 1;
drop table t1;
+#
+# Bug #21787: COUNT(*) + ORDER BY + LIMIT returns wrong result
+#
+create table t1 (a int);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7);
+explain select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
+select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
+explain select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
+select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
+
# End of 4.1 tests
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index be7bec117f3..11d0693b511 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -734,14 +734,20 @@ connect (session2,localhost,root,,);
connection session1;
disable_query_log;
-eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/tmp" select 9 a;
+eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/log" select 9 a;
enable_query_log;
+# If running test suite with a non standard tmp dir, the "show create table"
+# will print "DATA_DIRECTORY=". Use replace_result to mask it out
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
show create table t1;
connection session2;
disable_query_log;
-eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/tmp" select 99 a;
+eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/log" select 99 a;
enable_query_log;
+# If running test suite with a non standard tmp dir, the "show create table"
+# will print "DATA_DIRECTORY=". Use replace_result to mask it out
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
show create table t1;
connection default;
diff --git a/mysql-test/t/mysql_client.test b/mysql-test/t/mysql_client.test
index e4b6658b631..b382357dacf 100644
--- a/mysql-test/t/mysql_client.test
+++ b/mysql-test/t/mysql_client.test
@@ -27,3 +27,9 @@
# client comment recognized, but parameter missing => error
--exec echo "use" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
+
+#
+# Bug #20328: mysql client: dumb about trailing spaces on 'help' command
+#
+--exec echo 'help' | $MYSQL > $MYSQLTEST_VARDIR/tmp/bug20328.tmp
+--exec echo 'help ' | $MYSQL > $MYSQLTEST_VARDIR/tmp/bug20328.tmp
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index 0e4d16efb64..6fed78fe4ae 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -43,21 +43,21 @@ select "--- Local --" as "";
#
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ $MYSQL_TEST_DIR/var/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ $MYSQL_TEST_DIR/var/log/master-bin.000001
# this should not fail but shouldn't produce any working statements
--disable_query_log
select "--- Broken LOAD DATA --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ $MYSQL_TEST_DIR/var/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ $MYSQL_TEST_DIR/var/log/master-bin.000002 2> /dev/null
# this should show almost nothing
--disable_query_log
select "--- --database --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --database=nottest $MYSQL_TEST_DIR/var/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --database=nottest $MYSQL_TEST_DIR/var/log/master-bin.000001 2> /dev/null
# this test for position option
--disable_query_log
@@ -82,14 +82,14 @@ select "--- Remote --" as "";
select "--- Broken LOAD DATA --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 2> /dev/null
# And this too ! (altough it is documented)
--disable_query_log
select "--- --database --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --database=nottest master-bin.000001
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --database=nottest master-bin.000001 2> /dev/null
# Strangely but this works
--disable_query_log
@@ -107,7 +107,8 @@ create table t4 (f text character set cp932);
--exec $MYSQL --default-character-set=cp932 test -e "insert into t4 values(_cp932'ƒ\');"
flush logs;
rename table t3 to t03, t4 to t04;
---exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000004 | $MYSQL --default-character-set=utf8
+--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000004 > $MYSQL_TEST_DIR/var/tmp/bug16217.sql
+--exec $MYSQL --default-character-set=utf8 < $MYSQL_TEST_DIR/var/tmp/bug16217.sql
# original and recovered data must be equal
select HEX(f) from t03;
select HEX(f) from t3;
@@ -123,10 +124,12 @@ flush logs;
# resulted binlog, parly consisting of multi-byte utf8 chars,
# must be digestable for both client and server. In 4.1 the client
# should use default-character-set same as the server.
---exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000006 | $MYSQL
+--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000006 > $MYSQL_TEST_DIR/var/tmp/bug14157.sql
+--exec $MYSQL < $MYSQL_TEST_DIR/var/tmp/bug14157.sql
select * from t5 /* must be (1),(1) */;
# clean up
drop table t1, t2, t03, t04, t3, t4, t5;
# End of 4.1 tests
+
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index e86635e24d0..b0df2bb9db2 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -694,4 +694,12 @@ create table t3(a int);
--exec $MYSQL_DUMP --skip-comments --force --no-data test t3 t1 non_existing t2
drop table t1, t2, t3;
+#
+# Bug #21288: mysqldump segmentation fault when using --where
+#
+create table t1 (a int);
+--error 2
+--exec $MYSQL_DUMP --skip-comments --force test t1 --where='xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 2>&1
+drop table t1;
+
--echo End of 4.1 tests
diff --git a/mysql-test/t/ndb_lock.test b/mysql-test/t/ndb_lock.test
index e8f7c57ac96..3804782b150 100644
--- a/mysql-test/t/ndb_lock.test
+++ b/mysql-test/t/ndb_lock.test
@@ -73,7 +73,7 @@ drop table t1;
create table t1 (x integer not null primary key, y varchar(32), z integer, key(z)) engine = ndb;
-insert into t1 values (1,'one',1), (2,'two',2),(3,"three",3);
+insert into t1 values (1,'one',1);
# PK access
connection con1;
@@ -82,12 +82,23 @@ select * from t1 where x = 1 for update;
connection con2;
begin;
-select * from t1 where x = 2 for update;
--error 1205
select * from t1 where x = 1 for update;
rollback;
connection con1;
+rollback;
+insert into t1 values (2,'two',2),(3,"three",3);
+begin;
+select * from t1 where x = 1 for update;
+
+connection con2;
+--error 1205
+select * from t1 where x = 1 for update;
+select * from t1 where x = 2 for update;
+rollback;
+
+connection con1;
commit;
# table scan
diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test
index 5752e6b0b66..6f15ba8f673 100644
--- a/mysql-test/t/ps_1general.test
+++ b/mysql-test/t/ps_1general.test
@@ -305,6 +305,7 @@ prepare stmt4 from ' show table status from test like ''t9%'' ';
--replace_result 2147483647 4294967295
# Bug#4288
execute stmt4;
+--replace_column 2 #
prepare stmt4 from ' show status like ''Threads_running'' ';
execute stmt4;
prepare stmt4 from ' show variables like ''sql_mode'' ';
diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test
index 5e39e0b6a50..f086d5b0c2a 100644
--- a/mysql-test/t/repair.test
+++ b/mysql-test/t/repair.test
@@ -34,4 +34,15 @@ repair table t1;
repair table t1 use_frm;
drop table t1;
+#
+# BUG#18874 - Setting myisam_repair_threads > 1, index cardinality always 1
+#
+CREATE TABLE t1(a INT, KEY(a));
+INSERT INTO t1 VALUES(1),(2),(3),(4),(5);
+SET myisam_repair_threads=2;
+REPAIR TABLE t1;
+SHOW INDEX FROM t1;
+SET myisam_repair_threads=@@global.myisam_repair_threads;
+DROP TABLE t1;
+
# End of 4.1 tests
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 4cdfc220350..3f9fb59d26f 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -2297,4 +2297,49 @@ INSERT INTO t1 VALUES (10);
SELECT i='1e+01',i=1e+01, i in (1e+01), i in ('1e+01') FROM t1;
DROP TABLE t1;
+#
+# Bug #21019: First result of SELECT COUNT(*) different than consecutive runs
+#
+CREATE TABLE t1 (a int, b int);
+INSERT INTO t1 VALUES (1,1), (2,1), (4,10);
+
+CREATE TABLE t2 (a int PRIMARY KEY, b int, KEY b (b));
+INSERT INTO t2 VALUES (1,NULL), (2,10);
+ALTER TABLE t1 ENABLE KEYS;
+
+EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
+SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
+EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
+SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
+DROP TABLE IF EXISTS t1,t2;
+#
+# Bug #20954 "avg(keyval) retuns 0.38 but max(keyval) returns an empty set"
+#
+--disable_ps_protocol
+CREATE TABLE t1 (key1 float default NULL, UNIQUE KEY key1 (key1));
+CREATE TABLE t2 (key2 float default NULL, UNIQUE KEY key2 (key2));
+INSERT INTO t1 VALUES (0.3762),(0.3845),(0.6158),(0.7941);
+INSERT INTO t2 VALUES (1.3762),(1.3845),(1.6158),(1.7941);
+
+explain select max(key1) from t1 where key1 <= 0.6158;
+explain select max(key2) from t2 where key2 <= 1.6158;
+explain select min(key1) from t1 where key1 >= 0.3762;
+explain select min(key2) from t2 where key2 >= 1.3762;
+explain select max(key1), min(key2) from t1, t2
+where key1 <= 0.6158 and key2 >= 1.3762;
+explain select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
+explain select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
+
+select max(key1) from t1 where key1 <= 0.6158;
+select max(key2) from t2 where key2 <= 1.6158;
+select min(key1) from t1 where key1 >= 0.3762;
+select min(key2) from t2 where key2 >= 1.3762;
+select max(key1), min(key2) from t1, t2
+where key1 <= 0.6158 and key2 >= 1.3762;
+select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
+select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
+
+DROP TABLE t1,t2;
+--enable_ps_protocol
+
# End of 4.1 tests
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index e01310bba45..10dfb788c10 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -1844,4 +1844,45 @@ select 1 from dual where 2 > any (select 1);
select 1 from dual where 2 > all (select 1);
select 1 from dual where 1 < any (select 2 from dual);
select 1 from dual where 1 < all (select 2 from dual where 1!=1);
+
+# BUG#20975 Wrong query results for subqueries within NOT
+create table t1 (s1 char);
+insert into t1 values (1),(2);
+
+select * from t1 where (s1 < any (select s1 from t1));
+select * from t1 where not (s1 < any (select s1 from t1));
+
+select * from t1 where (s1 < ALL (select s1+1 from t1));
+select * from t1 where not(s1 < ALL (select s1+1 from t1));
+
+select * from t1 where (s1+1 = ANY (select s1 from t1));
+select * from t1 where NOT(s1+1 = ANY (select s1 from t1));
+
+select * from t1 where (s1 = ALL (select s1/s1 from t1));
+select * from t1 where NOT(s1 = ALL (select s1/s1 from t1));
+drop table t1;
+
+#
+# Bug #16255: Subquery in where
+#
+create table t1 (
+ retailerID varchar(8) NOT NULL,
+ statusID int(10) unsigned NOT NULL,
+ changed datetime NOT NULL,
+ UNIQUE KEY retailerID (retailerID, statusID, changed)
+);
+
+INSERT INTO t1 VALUES("0026", "1", "2005-12-06 12:18:56");
+INSERT INTO t1 VALUES("0026", "2", "2006-01-06 12:25:53");
+INSERT INTO t1 VALUES("0037", "1", "2005-12-06 12:18:56");
+INSERT INTO t1 VALUES("0037", "2", "2006-01-06 12:25:53");
+INSERT INTO t1 VALUES("0048", "1", "2006-01-06 12:37:50");
+INSERT INTO t1 VALUES("0059", "1", "2006-01-06 12:37:50");
+
+select * from t1 r1
+ where (r1.retailerID,(r1.changed)) in
+ (SELECT r2.retailerId,(max(changed)) from t1 r2
+ group by r2.retailerId);
+drop table t1;
+
# End of 4.1 tests
diff --git a/mysql-test/t/subselect2.test b/mysql-test/t/subselect2.test
index b21eda176b6..162bdd0d90a 100644
--- a/mysql-test/t/subselect2.test
+++ b/mysql-test/t/subselect2.test
@@ -150,3 +150,21 @@ EXPLAIN SELECT t2.*, t4.DOCTYPENAME, t1.CONTENTSIZE,t1.MIMETYPE FROM t2 INNER JO
drop table t1, t2, t3, t4;
# End of 4.1 tests
+
+#
+# Bug #20792: Incorrect results from aggregate subquery
+#
+CREATE TABLE t1 (a int(10) , PRIMARY KEY (a)) Engine=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (a int(10), PRIMARY KEY (a)) Engine=InnoDB;
+INSERT INTO t2 VALUES (1);
+
+CREATE TABLE t3 (a int(10), b int(10), c int(10),
+ PRIMARY KEY (a)) Engine=InnoDB;
+INSERT INTO t3 VALUES (1,2,1);
+
+SELECT t1.* FROM t1 WHERE (SELECT COUNT(*) FROM t3,t2 WHERE t3.c=t2.a
+ and t2.a='1' AND t1.a=t3.b) > 0;
+
+DROP TABLE t1,t2,t3;
diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c
index f0d3339535d..2af4edbf1a5 100644
--- a/mysys/my_bitmap.c
+++ b/mysys/my_bitmap.c
@@ -110,7 +110,7 @@ uint bitmap_set_next(MY_BITMAP *map)
{
uchar *bitmap=map->bitmap;
uint bit_found = MY_BIT_NONE;
- uint bitmap_size=map->bitmap_size*8;
+ uint bitmap_size=map->bitmap_size;
uint i;
DBUG_ASSERT(map->bitmap);
diff --git a/mysys/my_read.c b/mysys/my_read.c
index 9de070e772d..2e23f2175f8 100644
--- a/mysys/my_read.c
+++ b/mysys/my_read.c
@@ -36,48 +36,51 @@
uint my_read(File Filedes, byte *Buffer, uint Count, myf MyFlags)
{
- uint readbytes,save_count;
+ uint readbytes, save_count;
DBUG_ENTER("my_read");
DBUG_PRINT("my",("Fd: %d Buffer: 0x%lx Count: %u MyFlags: %d",
- Filedes, Buffer, Count, MyFlags));
- save_count=Count;
+ Filedes, Buffer, Count, MyFlags));
+ save_count= Count;
for (;;)
{
- errno=0; /* Linux doesn't reset this */
- if ((readbytes = (uint) read(Filedes, Buffer, Count)) != Count)
+ errno= 0; /* Linux doesn't reset this */
+ if ((readbytes= (uint) read(Filedes, Buffer, Count)) != Count)
{
- my_errno=errno ? errno : -1;
+ my_errno= errno ? errno : -1;
DBUG_PRINT("warning",("Read only %ld bytes off %ld from %d, errno: %d",
- readbytes,Count,Filedes,my_errno));
+ readbytes, Count, Filedes, my_errno));
#ifdef THREAD
- if (readbytes == 0 && errno == EINTR)
- continue; /* Interrupted */
+ if ((int) readbytes <= 0 && errno == EINTR)
+ {
+ DBUG_PRINT("debug", ("my_read() was interrupted and returned %d", (int) readbytes));
+ continue; /* Interrupted */
+ }
#endif
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
{
- if ((int) readbytes == -1)
- my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
- my_filename(Filedes),my_errno);
- else if (MyFlags & (MY_NABP | MY_FNABP))
- my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
- my_filename(Filedes),my_errno);
+ if ((int) readbytes == -1)
+ my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
+ my_filename(Filedes),my_errno);
+ else if (MyFlags & (MY_NABP | MY_FNABP))
+ my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
+ my_filename(Filedes),my_errno);
}
if ((int) readbytes == -1 ||
- ((MyFlags & (MY_FNABP | MY_NABP)) && !(MyFlags & MY_FULL_IO)))
- DBUG_RETURN(MY_FILE_ERROR); /* Return with error */
+ ((MyFlags & (MY_FNABP | MY_NABP)) && !(MyFlags & MY_FULL_IO)))
+ DBUG_RETURN(MY_FILE_ERROR); /* Return with error */
if (readbytes > 0 && (MyFlags & MY_FULL_IO))
{
- Buffer+=readbytes;
- Count-=readbytes;
- continue;
+ Buffer+= readbytes;
+ Count-= readbytes;
+ continue;
}
}
if (MyFlags & (MY_NABP | MY_FNABP))
- readbytes=0; /* Ok on read */
+ readbytes= 0; /* Ok on read */
else if (MyFlags & MY_FULL_IO)
- readbytes=save_count;
+ readbytes= save_count;
break;
}
DBUG_RETURN(readbytes);
diff --git a/ndb/include/ndbapi/NdbConnection.hpp b/ndb/include/ndbapi/NdbConnection.hpp
index 75c3f80121d..c367e156f08 100644
--- a/ndb/include/ndbapi/NdbConnection.hpp
+++ b/ndb/include/ndbapi/NdbConnection.hpp
@@ -163,7 +163,8 @@ class NdbConnection
friend class NdbIndexOperation;
friend class NdbIndexScanOperation;
friend class NdbBlob;
-
+ friend class ha_ndbcluster;
+
public:
/**
@@ -675,6 +676,7 @@ private:
// optim: any blobs
bool theBlobFlag;
Uint8 thePendingBlobOps;
+ inline bool hasBlobOperation() { return theBlobFlag; }
static void sendTC_COMMIT_ACK(NdbApiSignal *,
Uint32 transId1, Uint32 transId2,
diff --git a/ndb/include/ndbapi/NdbOperation.hpp b/ndb/include/ndbapi/NdbOperation.hpp
index 46e44226e18..5498b21a962 100644
--- a/ndb/include/ndbapi/NdbOperation.hpp
+++ b/ndb/include/ndbapi/NdbOperation.hpp
@@ -445,7 +445,7 @@ public:
/**
* Interpreted program instruction:
- * Substract RegSource1 from RegSource2 and put the result in RegDest.
+ * Substract RegSource2 from RegSource1 and put the result in RegDest.
*
* @param RegSource1 First register.
* @param RegSource2 Second register.
diff --git a/ndb/src/kernel/blocks/ERROR_codes.txt b/ndb/src/kernel/blocks/ERROR_codes.txt
index de32ce91ee8..d6dfcfe8587 100644
--- a/ndb/src/kernel/blocks/ERROR_codes.txt
+++ b/ndb/src/kernel/blocks/ERROR_codes.txt
@@ -6,7 +6,7 @@ Next DBTUP 4014
Next DBLQH 5043
Next DBDICT 6006
Next DBDIH 7174
-Next DBTC 8037
+Next DBTC 8038
Next CMVMI 9000
Next BACKUP 10022
Next DBUTIL 11002
@@ -281,6 +281,7 @@ ABORT OF TCKEYREQ
8032: No free TC records any more
+8037 : Invalid schema version in TCINDXREQ
CMVMI
-----
diff --git a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
index 65c864bd853..02ec5782c3e 100644
--- a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
+++ b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
@@ -8338,6 +8338,7 @@ Dbdih::resetReplicaSr(TabRecordPtr tabPtr){
}
replicaPtr.i = nextReplicaPtrI;
}//while
+ updateNodeInfo(fragPtr);
}
}
diff --git a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
index 42e38b41b4b..bc6671f805d 100644
--- a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
+++ b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
@@ -6435,6 +6435,7 @@ void Dblqh::execACC_ABORTCONF(Signal* signal)
* A NORMAL EVENT DURING CREATION OF A FRAGMENT. WE NOW NEED TO CONTINUE
* WITH NORMAL COMMIT PROCESSING.
* ---------------------------------------------------------------------- */
+ regTcPtr->totSendlenAi = regTcPtr->totReclenAi;
if (regTcPtr->currTupAiLen == regTcPtr->totReclenAi) {
jam();
regTcPtr->abortState = TcConnectionrec::ABORT_IDLE;
@@ -12508,6 +12509,20 @@ void Dblqh::lastWriteInFileLab(Signal* signal)
void Dblqh::writePageZeroLab(Signal* signal)
{
+ if (logPartPtr.p->logPartState == LogPartRecord::FILE_CHANGE_PROBLEM)
+ {
+ if (logPartPtr.p->firstLogQueue == RNIL)
+ {
+ jam();
+ logPartPtr.p->logPartState = LogPartRecord::IDLE;
+ }
+ else
+ {
+ jam();
+ logPartPtr.p->logPartState = LogPartRecord::ACTIVE;
+ }
+ }
+
logFilePtr.p->fileChangeState = LogFileRecord::NOT_ONGOING;
/*---------------------------------------------------------------------------*/
/* IT COULD HAVE ARRIVED PAGE WRITES TO THE CURRENT FILE WHILE WE WERE */
diff --git a/ndb/src/kernel/blocks/dbtc/Dbtc.hpp b/ndb/src/kernel/blocks/dbtc/Dbtc.hpp
index 25c746b0a89..4488e7500f5 100644
--- a/ndb/src/kernel/blocks/dbtc/Dbtc.hpp
+++ b/ndb/src/kernel/blocks/dbtc/Dbtc.hpp
@@ -718,7 +718,7 @@ public:
// Index data
- bool isIndexOp; // Used to mark on-going TcKeyReq as indx table access
+ Uint8 isIndexOp; // Used to mark on-going TcKeyReq as indx table access
bool indexOpReturn;
UintR noIndexOp; // No outstanding index ops
@@ -806,7 +806,7 @@ public:
UintR savedState[LqhKeyConf::SignalLength];
// Index data
- bool isIndexOp; // Used to mark on-going TcKeyReq as index table access
+ Uint8 isIndexOp; // Used to mark on-going TcKeyReq as index table access
UintR indexOp;
UintR currentIndexId;
UintR attrInfoLen;
diff --git a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
index a71942f5cc8..ab0981a98ef 100644
--- a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
+++ b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
@@ -1757,8 +1757,7 @@ void Dbtc::execKEYINFO(Signal* signal)
apiConnectptr.i = signal->theData[0];
tmaxData = 20;
if (apiConnectptr.i >= capiConnectFilesize) {
- jam();
- warningHandlerLab(signal);
+ TCKEY_abort(signal, 18);
return;
}//if
ptrAss(apiConnectptr, apiConnectRecord);
@@ -1767,9 +1766,7 @@ void Dbtc::execKEYINFO(Signal* signal)
compare_transid2 = apiConnectptr.p->transid[1] ^ signal->theData[2];
compare_transid1 = compare_transid1 | compare_transid2;
if (compare_transid1 != 0) {
- jam();
- printState(signal, 10);
- sendSignalErrorRefuseLab(signal);
+ TCKEY_abort(signal, 19);
return;
}//if
switch (apiConnectptr.p->apiConnectstate) {
@@ -2467,7 +2464,7 @@ void Dbtc::execTCKEYREQ(Signal* signal)
Uint32 TstartFlag = tcKeyReq->getStartFlag(Treqinfo);
Uint32 TexecFlag = TcKeyReq::getExecuteFlag(Treqinfo);
- bool isIndexOp = regApiPtr->isIndexOp;
+ Uint8 isIndexOp = regApiPtr->isIndexOp;
bool isIndexOpReturn = regApiPtr->indexOpReturn;
regApiPtr->isIndexOp = false; // Reset marker
regApiPtr->m_exec_flag |= TexecFlag;
@@ -3210,7 +3207,7 @@ void Dbtc::sendlqhkeyreq(Signal* signal,
sig1 = regCachePtr->fragmentid + (regTcPtr->tcNodedata[1] << 16);
sig2 = regApiPtr->transid[0];
sig3 = regApiPtr->transid[1];
- sig4 = regApiPtr->ndbapiBlockref;
+ sig4 = (regTcPtr->isIndexOp == 2) ? reference() : regApiPtr->ndbapiBlockref;
sig5 = regTcPtr->clientData;
sig6 = regCachePtr->scanInfo;
@@ -8551,6 +8548,7 @@ void Dbtc::execSCAN_TABREQ(Signal* signal)
// left over from simple/dirty read
} else {
jam();
+ jamLine(transP->apiConnectstate);
errCode = ZSTATE_ERROR;
goto SCAN_TAB_error_no_state_change;
}
@@ -11915,14 +11913,18 @@ void Dbtc::readIndexTable(Signal* signal,
opType == ZREAD ? ZREAD : ZREAD_EX);
TcKeyReq::setAIInTcKeyReq(tcKeyRequestInfo, 1); // Allways send one AttrInfo
TcKeyReq::setExecutingTrigger(tcKeyRequestInfo, 0);
- BlockReference originalReceiver = regApiPtr->ndbapiBlockref;
- regApiPtr->ndbapiBlockref = reference(); // Send result to me
tcKeyReq->senderData = indexOp->indexOpId;
indexOp->indexOpState = IOS_INDEX_ACCESS;
regApiPtr->executingIndexOp = regApiPtr->accumulatingIndexOp;
regApiPtr->accumulatingIndexOp = RNIL;
- regApiPtr->isIndexOp = true;
+ regApiPtr->isIndexOp = 2;
+ if (ERROR_INSERTED(8037))
+ {
+ ndbout_c("shifting index version");
+ tcKeyReq->tableSchemaVersion = ~(Uint32)indexOp->tcIndxReq.indexSchemaVersion;
+ }
+
Uint32 remainingKey = indexOp->keyInfo.getSize();
bool moreKeyData = indexOp->keyInfo.first(keyIter);
// *********** KEYINFO in TCKEYREQ ***********
@@ -11941,21 +11943,13 @@ void Dbtc::readIndexTable(Signal* signal,
ndbassert(TcKeyReq::getDirtyFlag(tcKeyRequestInfo) == 0);
ndbassert(TcKeyReq::getSimpleFlag(tcKeyRequestInfo) == 0);
EXECUTE_DIRECT(DBTC, GSN_TCKEYREQ, signal, tcKeyLength);
-
- /**
- * "Fool" TC not to start commiting transaction since it always will
- * have one outstanding lqhkeyreq
- * This is later decreased when the index read is complete
- */
- regApiPtr->lqhkeyreqrec++;
+ jamEntry();
- /**
- * Remember ptr to index read operation
- * (used to set correct save point id on index operation later)
- */
- indexOp->indexReadTcConnect = regApiPtr->lastTcConnect;
+ if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
+ {
+ goto err;
+ }
- jamEntry();
// *********** KEYINFO ***********
if (moreKeyData) {
jam();
@@ -11975,6 +11969,10 @@ void Dbtc::readIndexTable(Signal* signal,
EXECUTE_DIRECT(DBTC, GSN_KEYINFO, signal,
KeyInfo::HeaderLength + KeyInfo::DataLength);
jamEntry();
+ if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
+ {
+ goto err;
+ }
dataPos = 0;
dataPtr = (Uint32 *) &keyInfo->keyData;
}
@@ -11985,10 +11983,32 @@ void Dbtc::readIndexTable(Signal* signal,
EXECUTE_DIRECT(DBTC, GSN_KEYINFO, signal,
KeyInfo::HeaderLength + dataPos);
jamEntry();
+ if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
+ {
+ goto err;
+ }
}
}
- regApiPtr->ndbapiBlockref = originalReceiver; // reset original receiver
+ /**
+ * "Fool" TC not to start commiting transaction since it always will
+ * have one outstanding lqhkeyreq
+ * This is later decreased when the index read is complete
+ */
+ regApiPtr->lqhkeyreqrec++;
+
+ /**
+ * Remember ptr to index read operation
+ * (used to set correct save point id on index operation later)
+ */
+ indexOp->indexReadTcConnect = regApiPtr->lastTcConnect;
+
+done:
+ return;
+
+err:
+ jam();
+ goto done;
}
/**
@@ -12039,7 +12059,7 @@ void Dbtc::executeIndexOperation(Signal* signal,
tcKeyReq->transId2 = regApiPtr->transid[1];
tcKeyReq->senderData = tcIndxReq->senderData; // Needed for TRANSID_AI to API
indexOp->indexOpState = IOS_INDEX_OPERATION;
- regApiPtr->isIndexOp = true;
+ regApiPtr->isIndexOp = 1;
regApiPtr->executingIndexOp = indexOp->indexOpId;;
regApiPtr->noIndexOp++; // Increase count
@@ -12112,9 +12132,16 @@ void Dbtc::executeIndexOperation(Signal* signal,
const Uint32 currSavePointId = regApiPtr->currSavePointId;
regApiPtr->currSavePointId = tmp.p->savePointId;
EXECUTE_DIRECT(DBTC, GSN_TCKEYREQ, signal, tcKeyLength);
+ jamEntry();
+
+ if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
+ {
+ jam();
+ return;
+ }
+
regApiPtr->currSavePointId = currSavePointId;
- jamEntry();
// *********** KEYINFO ***********
if (moreKeyData) {
jam();
@@ -12135,6 +12162,13 @@ void Dbtc::executeIndexOperation(Signal* signal,
EXECUTE_DIRECT(DBTC, GSN_KEYINFO, signal,
KeyInfo::HeaderLength + KeyInfo::DataLength);
jamEntry();
+
+ if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
+ {
+ jam();
+ return;
+ }
+
dataPos = 0;
dataPtr = (Uint32 *) &keyInfo->keyData;
}
@@ -12145,6 +12179,12 @@ void Dbtc::executeIndexOperation(Signal* signal,
EXECUTE_DIRECT(DBTC, GSN_KEYINFO, signal,
KeyInfo::HeaderLength + dataPos);
jamEntry();
+
+ if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
+ {
+ jam();
+ return;
+ }
}
}
@@ -12174,6 +12214,13 @@ void Dbtc::executeIndexOperation(Signal* signal,
EXECUTE_DIRECT(DBTC, GSN_ATTRINFO, signal,
AttrInfo::HeaderLength + AttrInfo::DataLength);
jamEntry();
+
+ if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
+ {
+ jam();
+ return;
+ }
+
attrInfoPos = 0;
dataPtr = (Uint32 *) &attrInfo->attrData;
}
@@ -12573,9 +12620,16 @@ void Dbtc::insertIntoIndexTable(Signal* signal,
const Uint32 currSavePointId = regApiPtr->currSavePointId;
regApiPtr->currSavePointId = opRecord->savePointId;
EXECUTE_DIRECT(DBTC, GSN_TCKEYREQ, signal, tcKeyLength);
+ jamEntry();
+
+ if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
+ {
+ jam();
+ return;
+ }
+
regApiPtr->currSavePointId = currSavePointId;
tcConnectptr.p->currentIndexId = indexData->indexId;
- jamEntry();
// *********** KEYINFO ***********
if (moreKeyData) {
@@ -12605,6 +12659,12 @@ void Dbtc::insertIntoIndexTable(Signal* signal,
KeyInfo::HeaderLength + KeyInfo::DataLength);
jamEntry();
#endif
+ if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
+ {
+ jam();
+ return;
+ }
+
dataPtr = (Uint32 *) &keyInfo->keyData;
dataPos = 0;
}
@@ -12640,6 +12700,13 @@ void Dbtc::insertIntoIndexTable(Signal* signal,
KeyInfo::HeaderLength + KeyInfo::DataLength);
jamEntry();
#endif
+
+ if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
+ {
+ jam();
+ return;
+ }
+
dataPtr = (Uint32 *) &keyInfo->keyData;
dataPos = 0;
}
@@ -12657,6 +12724,11 @@ void Dbtc::insertIntoIndexTable(Signal* signal,
KeyInfo::HeaderLength + dataPos);
jamEntry();
#endif
+ if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
+ {
+ jam();
+ return;
+ }
}
}
@@ -12692,6 +12764,12 @@ void Dbtc::insertIntoIndexTable(Signal* signal,
AttrInfo::HeaderLength + AttrInfo::DataLength);
jamEntry();
#endif
+ if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
+ {
+ jam();
+ return;
+ }
+
dataPtr = (Uint32 *) &attrInfo->attrData;
attrInfoPos = 0;
}
@@ -12728,6 +12806,12 @@ void Dbtc::insertIntoIndexTable(Signal* signal,
AttrInfo::HeaderLength + AttrInfo::DataLength);
jamEntry();
#endif
+ if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
+ {
+ jam();
+ return;
+ }
+
dataPtr = (Uint32 *) &attrInfo->attrData;
attrInfoPos = 0;
}
@@ -12873,9 +12957,16 @@ void Dbtc::deleteFromIndexTable(Signal* signal,
const Uint32 currSavePointId = regApiPtr->currSavePointId;
regApiPtr->currSavePointId = opRecord->savePointId;
EXECUTE_DIRECT(DBTC, GSN_TCKEYREQ, signal, tcKeyLength);
+ jamEntry();
+
+ if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
+ {
+ jam();
+ return;
+ }
+
regApiPtr->currSavePointId = currSavePointId;
tcConnectptr.p->currentIndexId = indexData->indexId;
- jamEntry();
// *********** KEYINFO ***********
if (moreKeyData) {
@@ -12906,6 +12997,12 @@ void Dbtc::deleteFromIndexTable(Signal* signal,
KeyInfo::HeaderLength + KeyInfo::DataLength);
jamEntry();
#endif
+ if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
+ {
+ jam();
+ return;
+ }
+
dataPtr = (Uint32 *) &keyInfo->keyData;
dataPos = 0;
}
@@ -12942,6 +13039,12 @@ void Dbtc::deleteFromIndexTable(Signal* signal,
KeyInfo::HeaderLength + KeyInfo::DataLength);
jamEntry();
#endif
+ if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
+ {
+ jam();
+ return;
+ }
+
dataPtr = (Uint32 *) &keyInfo->keyData;
dataPos = 0;
}
diff --git a/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp b/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp
index 8171fa65771..a1f8b827752 100644
--- a/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp
+++ b/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp
@@ -1111,14 +1111,16 @@ Dbtup::updateStartLab(Signal* signal,
regOperPtr->pageOffset,
&cinBuffer[0],
regOperPtr->attrinbufLen);
- if (retValue == -1) {
- tupkeyErrorLab(signal);
- return -1;
- }//if
} else {
jam();
retValue = interpreterStartLab(signal, pagePtr, regOperPtr->pageOffset);
}//if
+
+ if (retValue == -1) {
+ tupkeyErrorLab(signal);
+ return -1;
+ }//if
+
ndbrequire(regOperPtr->tupVersion != ZNIL);
pagePtr->pageWord[regOperPtr->pageOffset + 1] = regOperPtr->tupVersion;
if (regTabPtr->checksumIndicator) {
diff --git a/ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp b/ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp
index 9722aa437c0..8a18fddae19 100644
--- a/ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp
+++ b/ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp
@@ -184,24 +184,28 @@ void Dbtup::allocConsPages(Uint32 noOfPagesToAllocate,
/* PROPER AMOUNT OF PAGES WERE NOT FOUND. FIND AS MUCH AS */
/* POSSIBLE. */
/* ---------------------------------------------------------------- */
- for (Uint32 j = firstListToCheck; (Uint32)~j; j--) {
+ if (firstListToCheck)
+ {
ljam();
- if (cfreepageList[j] != RNIL) {
+ for (Uint32 j = firstListToCheck - 1; (Uint32)~j; j--) {
ljam();
+ if (cfreepageList[j] != RNIL) {
+ ljam();
/* ---------------------------------------------------------------- */
/* SOME AREA WAS FOUND, ALLOCATE ALL OF IT. */
/* ---------------------------------------------------------------- */
- allocPageRef = cfreepageList[j];
- removeCommonArea(allocPageRef, j);
- noOfPagesAllocated = 1 << j;
- findFreeLeftNeighbours(allocPageRef, noOfPagesAllocated,
- noOfPagesToAllocate);
- findFreeRightNeighbours(allocPageRef, noOfPagesAllocated,
- noOfPagesToAllocate);
-
- return;
- }//if
- }//for
+ allocPageRef = cfreepageList[j];
+ removeCommonArea(allocPageRef, j);
+ noOfPagesAllocated = 1 << j;
+ findFreeLeftNeighbours(allocPageRef, noOfPagesAllocated,
+ noOfPagesToAllocate);
+ findFreeRightNeighbours(allocPageRef, noOfPagesAllocated,
+ noOfPagesToAllocate);
+
+ return;
+ }//if
+ }//for
+ }
/* ---------------------------------------------------------------- */
/* NO FREE AREA AT ALL EXISTED. RETURN ZERO PAGES */
/* ---------------------------------------------------------------- */
diff --git a/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp b/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
index 5a841d6f836..f6970ecce2d 100644
--- a/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
+++ b/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
@@ -177,13 +177,12 @@ void Ndbcntr::execSYSTEM_ERROR(Signal* signal)
"the state of a fragment scan was out of sync.",
killingNode);
break;
-
+
case SystemError::CopyFragRefError:
BaseString::snprintf(buf, sizeof(buf),
- "Node %d killed this node because "
- "it could not copy a fragment during node restart. "
- "Copy fragment error code: %u.",
- killingNode, data1);
+ "Killed by node %d as "
+ "copyfrag failed, error: %u",
+ killingNode, data1);
break;
default:
@@ -2037,6 +2036,11 @@ void Ndbcntr::execSET_VAR_REQ(Signal* signal) {
void Ndbcntr::updateNodeState(Signal* signal, const NodeState& newState) const{
NodeStateRep * const stateRep = (NodeStateRep *)&signal->theData[0];
+ if (newState.startLevel == NodeState::SL_STARTED)
+ {
+ CRASH_INSERTION(1000);
+ }
+
stateRep->nodeState = newState;
stateRep->nodeState.masterNodeId = cmasterNodeId;
stateRep->nodeState.setNodeGroup(c_nodeGroup);
@@ -2827,7 +2831,7 @@ void Ndbcntr::Missra::sendNextSTTOR(Signal* signal){
cntr.sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 3, JBB);
}
}
-
+
signal->theData[0] = EventReport::NDBStartCompleted;
signal->theData[1] = NDB_VERSION;
cntr.sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);
diff --git a/ndb/src/ndbapi/NdbScanOperation.cpp b/ndb/src/ndbapi/NdbScanOperation.cpp
index 0a39651ce28..469231512f5 100644
--- a/ndb/src/ndbapi/NdbScanOperation.cpp
+++ b/ndb/src/ndbapi/NdbScanOperation.cpp
@@ -504,6 +504,8 @@ int NdbScanOperation::nextResult(bool fetchAllowed, bool forceSend)
idx = m_current_api_receiver;
last = m_api_receivers_count;
+
+ Uint32 timeout = tp->m_waitfor_timeout;
do {
if(theError.code){
@@ -531,7 +533,7 @@ int NdbScanOperation::nextResult(bool fetchAllowed, bool forceSend)
*/
theNdb->theImpl->theWaiter.m_node = nodeId;
theNdb->theImpl->theWaiter.m_state = WAIT_SCAN;
- int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT);
+ int return_code = theNdb->receiveResponse(3*timeout);
if (return_code == 0 && seq == tp->getNodeSequence(nodeId)) {
continue;
} else {
@@ -1372,6 +1374,7 @@ NdbIndexScanOperation::next_result_ordered(bool fetchAllowed,
return -1;
Uint32 seq = theNdbCon->theNodeSequence;
Uint32 nodeId = theNdbCon->theDBnode;
+ Uint32 timeout = tp->m_waitfor_timeout;
if(seq == tp->getNodeSequence(nodeId) &&
!send_next_scan_ordered(s_idx, forceSend)){
Uint32 tmp = m_sent_receivers_count;
@@ -1379,7 +1382,7 @@ NdbIndexScanOperation::next_result_ordered(bool fetchAllowed,
while(m_sent_receivers_count > 0 && !theError.code){
theNdb->theImpl->theWaiter.m_node = nodeId;
theNdb->theImpl->theWaiter.m_state = WAIT_SCAN;
- int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT);
+ int return_code = theNdb->receiveResponse(3*timeout);
if (return_code == 0 && seq == tp->getNodeSequence(nodeId)) {
continue;
}
@@ -1520,6 +1523,8 @@ NdbScanOperation::close_impl(TransporterFacade* tp, bool forceSend){
return -1;
}
+ Uint32 timeout = tp->m_waitfor_timeout;
+
/**
* Wait for outstanding
*/
@@ -1527,7 +1532,7 @@ NdbScanOperation::close_impl(TransporterFacade* tp, bool forceSend){
{
theNdb->theImpl->theWaiter.m_node = nodeId;
theNdb->theImpl->theWaiter.m_state = WAIT_SCAN;
- int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT);
+ int return_code = theNdb->receiveResponse(3*timeout);
switch(return_code){
case 0:
break;
@@ -1597,7 +1602,7 @@ NdbScanOperation::close_impl(TransporterFacade* tp, bool forceSend){
{
theNdb->theImpl->theWaiter.m_node = nodeId;
theNdb->theImpl->theWaiter.m_state = WAIT_SCAN;
- int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT);
+ int return_code = theNdb->receiveResponse(3*timeout);
switch(return_code){
case 0:
break;
diff --git a/ndb/test/ndbapi/testIndex.cpp b/ndb/test/ndbapi/testIndex.cpp
index d359f83257f..174f6f170f4 100644
--- a/ndb/test/ndbapi/testIndex.cpp
+++ b/ndb/test/ndbapi/testIndex.cpp
@@ -1201,6 +1201,48 @@ int runLQHKEYREF(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_OK;
}
+int
+runBug21384(NDBT_Context* ctx, NDBT_Step* step)
+{
+ Ndb* pNdb = GETNDB(step);
+ HugoTransactions hugoTrans(*ctx->getTab());
+ NdbRestarter restarter;
+
+ int loops = ctx->getNumLoops();
+ const int rows = ctx->getNumRecords();
+ const int batchsize = ctx->getProperty("BatchSize", 50);
+
+ while (loops--)
+ {
+ if(restarter.insertErrorInAllNodes(8037) != 0)
+ {
+ g_err << "Failed to error insert(8037)" << endl;
+ return NDBT_FAILED;
+ }
+
+ if (hugoTrans.indexReadRecords(pNdb, pkIdxName, rows, batchsize) == 0)
+ {
+ g_err << "Index succeded (it should have failed" << endl;
+ return NDBT_FAILED;
+ }
+
+ if(restarter.insertErrorInAllNodes(0) != 0)
+ {
+ g_err << "Failed to error insert(0)" << endl;
+ return NDBT_FAILED;
+ }
+
+ if (hugoTrans.indexReadRecords(pNdb, pkIdxName, rows, batchsize) != 0){
+ g_err << "Index read failed" << endl;
+ return NDBT_FAILED;
+ }
+ }
+
+ return NDBT_OK;
+}
+
+
+
NDBT_TESTSUITE(testIndex);
TESTCASE("CreateAll",
"Test that we can create all various indexes on each table\n"
@@ -1507,6 +1549,16 @@ TESTCASE("UniqueNull",
FINALIZER(createPkIndex_Drop);
FINALIZER(runClearTable);
}
+TESTCASE("Bug21384",
+ "Test that unique indexes and nulls"){
+ TC_PROPERTY("LoggedIndexes", (unsigned)0);
+ INITIALIZER(runClearTable);
+ INITIALIZER(createPkIndex);
+ INITIALIZER(runLoadTable);
+ STEP(runBug21384);
+ FINALIZER(createPkIndex_Drop);
+ FINALIZER(runClearTable);
+}
NDBT_TESTSUITE_END(testIndex);
int main(int argc, const char** argv){
diff --git a/ndb/test/ndbapi/testSystemRestart.cpp b/ndb/test/ndbapi/testSystemRestart.cpp
index 30f7aca9b06..8a0100ff3e4 100644
--- a/ndb/test/ndbapi/testSystemRestart.cpp
+++ b/ndb/test/ndbapi/testSystemRestart.cpp
@@ -1121,6 +1121,46 @@ int runClearTable(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_OK;
}
+int
+runBug21536(NDBT_Context* ctx, NDBT_Step* step)
+{
+ NdbRestarter restarter;
+ const Uint32 nodeCount = restarter.getNumDbNodes();
+ if(nodeCount != 2){
+ g_info << "Bug21536 - 2 nodes to test" << endl;
+ return NDBT_OK;
+ }
+
+ int node1 = restarter.getDbNodeId(rand() % nodeCount);
+ int node2 = restarter.getRandomNodeSameNodeGroup(node1, rand());
+
+ if (node1 == -1 || node2 == -1)
+ return NDBT_OK;
+
+ int result = NDBT_OK;
+ do {
+ CHECK(restarter.restartOneDbNode(node1, false, true, true) == 0);
+ CHECK(restarter.waitNodesNoStart(&node1, 1) == 0);
+ CHECK(restarter.insertErrorInNode(node1, 1000) == 0);
+ int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
+ CHECK(restarter.dumpStateOneNode(node1, val2, 2) == 0);
+ CHECK(restarter.startNodes(&node1, 1) == 0);
+ restarter.waitNodesStartPhase(&node1, 1, 3, 120);
+ CHECK(restarter.waitNodesNoStart(&node1, 1) == 0);
+
+ CHECK(restarter.restartOneDbNode(node2, true, true, true) == 0);
+ CHECK(restarter.waitNodesNoStart(&node2, 1) == 0);
+ CHECK(restarter.startNodes(&node1, 1) == 0);
+ CHECK(restarter.waitNodesStarted(&node1, 1) == 0);
+ CHECK(restarter.startNodes(&node2, 1) == 0);
+ CHECK(restarter.waitClusterStarted() == 0);
+
+ } while(0);
+
+ g_info << "Bug21536 finished" << endl;
+
+ return result;
+}
NDBT_TESTSUITE(testSystemRestart);
TESTCASE("SR1",
@@ -1287,6 +1327,13 @@ TESTCASE("Bug18385",
STEP(runBug18385);
FINALIZER(runClearTable);
}
+TESTCASE("Bug21536",
+ "Perform partition system restart with other nodes with higher GCI"){
+ INITIALIZER(runWaitStarted);
+ INITIALIZER(runClearTable);
+ STEP(runBug21536);
+ FINALIZER(runClearTable);
+}
NDBT_TESTSUITE_END(testSystemRestart);
int main(int argc, const char** argv){
diff --git a/ndb/test/run-test/daily-basic-tests.txt b/ndb/test/run-test/daily-basic-tests.txt
index e9064d6e30b..39782ecbbc7 100644
--- a/ndb/test/run-test/daily-basic-tests.txt
+++ b/ndb/test/run-test/daily-basic-tests.txt
@@ -474,6 +474,10 @@ max-time: 1000
cmd: testNodeRestart
args: -n Bug20185 T1
+max-time: 1000
+cmd: testIndex
+args: -n Bug21384
+
# OLD FLEX
max-time: 500
cmd: flexBench
diff --git a/netware/BUILD/mwasmnlm b/netware/BUILD/mwasmnlm
index 381f84ec0c8..11fc2bc3842 100755
--- a/netware/BUILD/mwasmnlm
+++ b/netware/BUILD/mwasmnlm
@@ -5,4 +5,7 @@ set -e
args=" $*"
-wine --debugmsg -all -- mwasmnlm $args
+# NOTE: Option 'pipefail' is not standard sh
+set -o pipefail
+wine --debugmsg -all -- mwasmnlm $args | \
+perl -pe 's/\r//g; s/^\e.*\e(\[J|>)?//; s/[[^:print:]]//g'
diff --git a/netware/BUILD/mwccnlm b/netware/BUILD/mwccnlm
index cb2d62fe8cf..e6840e781f8 100755
--- a/netware/BUILD/mwccnlm
+++ b/netware/BUILD/mwccnlm
@@ -7,4 +7,7 @@ set -e
# convert it to "-I../include"
args=" "`echo $* | sed -e 's/-I.\/../-I../g'`
-wine --debugmsg -all -- mwccnlm $args
+# NOTE: Option 'pipefail' is not standard sh
+set -o pipefail
+wine --debugmsg -all -- mwccnlm $args | \
+perl -pe 's/\r//g; s/^\e.*\e(\[J|>)?//; s/[[^:print:]]//g'
diff --git a/netware/BUILD/mwldnlm b/netware/BUILD/mwldnlm
index 28566fc5cb1..cc8c9e63c6e 100755
--- a/netware/BUILD/mwldnlm
+++ b/netware/BUILD/mwldnlm
@@ -5,4 +5,7 @@ set -e
args=" $*"
-wine --debugmsg -all -- mwldnlm $args
+# NOTE: Option 'pipefail' is not standard sh
+set -o pipefail
+wine --debugmsg -all -- mwldnlm $args | \
+perl -pe 's/\r//g; s/^\e.*\e(\[J|>)?//; s/[[^:print:]]//g'
diff --git a/scripts/fill_func_tables.sh b/scripts/fill_func_tables.sh
index 459afee2fe1..b7bd3736392 100644
--- a/scripts/fill_func_tables.sh
+++ b/scripts/fill_func_tables.sh
@@ -1,7 +1,12 @@
-#!/usr/bin/perl
+#!@PERL@
+#
+# Copyright (C) 2003 MySQL AB
+# For a more info consult the file COPYRIGHT distributed with this file.
+#
# fill_func_tables - parse ../Docs/manual.texi
-
-# Original version by vva
+#
+# Original version by Victor Vagin <vva@mysql.com>
+#
my $cat_name= "";
my $func_name= "";
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index 9b1cddbb7e4..b2eb9f3b727 100644
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -80,7 +80,7 @@ mkdir $BASE $BASE/bin $BASE/docs \
if [ $BASE_SYSTEM != "netware" ] ; then
mkdir $BASE/share/mysql $BASE/tests $BASE/sql-bench $BASE/man \
- $BASE/man/man1 $BASE/data $BASE/data/mysql $BASE/data/test
+ $BASE/man/man1 $BASE/man/man8 $BASE/data $BASE/data/mysql $BASE/data/test
chmod o-rwx $BASE/data $BASE/data/*
fi
@@ -203,6 +203,7 @@ if [ $BASE_SYSTEM != "netware" ] ; then
fi
if [ -d man ] ; then
$CP man/*.1 $BASE/man/man1
+ $CP man/*.8 $BASE/man/man8
fi
fi
@@ -287,7 +288,6 @@ else
fi
# Make safe_mysqld a symlink to mysqld_safe for backwards portability
-# To be removed in MySQL 4.1
(cd $BASE/bin ; ln -s mysqld_safe safe_mysqld )
# Clean up if we did this from a bk tree
diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh
index 4e5cc2ada46..742f6b9e994 100644
--- a/scripts/make_win_src_distribution.sh
+++ b/scripts/make_win_src_distribution.sh
@@ -206,7 +206,7 @@ copy_dir_files()
for i in *.c *.cpp *.h *.ih *.i *.ic *.asm *.def *.hpp *.yy \
README INSTALL* LICENSE AUTHORS NEWS ChangeLog \
*.inc *.test *.result *.pem Moscow_leap des_key_file \
- *.vcproj *.sln *.dat *.000001 *.require *.opt
+ *.vcproj *.sln *.dat *.000001 *.require *.opt *.cnf
do
if [ -f $i ]
then
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index 5c2bca9a393..56a432db741 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -1,4 +1,3 @@
-
#!/bin/sh
# Copyright (C) 2002-2003 MySQL AB
# For a more info consult the file COPYRIGHT distributed with this file.
diff --git a/sql-common/client.c b/sql-common/client.c
index e5bab51ca8a..4d37b850bcb 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1544,11 +1544,18 @@ C_MODE_START
int mysql_init_character_set(MYSQL *mysql)
{
NET *net= &mysql->net;
+ const char *default_collation_name;
+
/* Set character set */
- if (!mysql->options.charset_name &&
- !(mysql->options.charset_name=
+ if (!mysql->options.charset_name)
+ {
+ default_collation_name= MYSQL_DEFAULT_COLLATION_NAME;
+ if (!(mysql->options.charset_name=
my_strdup(MYSQL_DEFAULT_CHARSET_NAME,MYF(MY_WME))))
return 1;
+ }
+ else
+ default_collation_name= NULL;
{
const char *save= charsets_dir;
@@ -1556,6 +1563,28 @@ int mysql_init_character_set(MYSQL *mysql)
charsets_dir=mysql->options.charset_dir;
mysql->charset=get_charset_by_csname(mysql->options.charset_name,
MY_CS_PRIMARY, MYF(MY_WME));
+ if (mysql->charset && default_collation_name)
+ {
+ CHARSET_INFO *collation;
+ if ((collation=
+ get_charset_by_name(default_collation_name, MYF(MY_WME))))
+ {
+ if (!my_charset_same(mysql->charset, collation))
+ {
+ my_printf_error(ER_UNKNOWN_ERROR,
+ "COLLATION %s is not valid for CHARACTER SET %s",
+ MYF(0),
+ default_collation_name, mysql->options.charset_name);
+ mysql->charset= NULL;
+ }
+ else
+ {
+ mysql->charset= collation;
+ }
+ }
+ else
+ mysql->charset= NULL;
+ }
charsets_dir= save;
}
@@ -1589,7 +1618,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
const char *passwd, const char *db,
uint port, const char *unix_socket,ulong client_flag)
{
- char buff[NAME_LEN+USERNAME_LENGTH+100];
+ char buff[NAME_BYTE_LEN+USERNAME_BYTE_LENGTH+100];
char *end,*host_info;
my_socket sock;
in_addr_t ip_addr;
@@ -2034,7 +2063,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
mysql->server_status, client_flag));
/* This needs to be changed as it's not useful with big packets */
if (user && user[0])
- strmake(end,user,USERNAME_LENGTH); /* Max user name */
+ strmake(end,user,USERNAME_BYTE_LENGTH); /* Max user name */
else
read_user_name((char*) end);
@@ -2064,7 +2093,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
/* Add database if needed */
if (db && (mysql->server_capabilities & CLIENT_CONNECT_WITH_DB))
{
- end= strmake(end, db, NAME_LEN) + 1;
+ end= strmake(end, db, NAME_BYTE_LEN) + 1;
mysql->db= my_strdup(db,MYF(MY_WME));
db= 0;
}
diff --git a/sql/field.cc b/sql/field.cc
index 3cb0c0d3a7c..b66a7d736d0 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -3680,7 +3680,7 @@ int Field_timestamp::store(const char *from,uint len,CHARSET_INFO *cs)
error= 2;
#ifdef WORDS_BIGENDIAN
- if (table->db_low_byte_first)
+ if (table && table->db_low_byte_first)
{
int4store(ptr,tmp);
}
@@ -3738,7 +3738,7 @@ int Field_timestamp::store(longlong nr)
nr, MYSQL_TIMESTAMP_DATETIME, 1);
#ifdef WORDS_BIGENDIAN
- if (table->db_low_byte_first)
+ if (table && table->db_low_byte_first)
{
int4store(ptr,timestamp);
}
@@ -3762,7 +3762,7 @@ longlong Field_timestamp::val_int(void)
THD *thd= table->in_use;
#ifdef WORDS_BIGENDIAN
- if (table->db_low_byte_first)
+ if (table && table->db_low_byte_first)
temp=uint4korr(ptr);
else
#endif
@@ -3792,7 +3792,7 @@ String *Field_timestamp::val_str(String *val_buffer, String *val_ptr)
val_buffer->length(field_length);
#ifdef WORDS_BIGENDIAN
- if (table->db_low_byte_first)
+ if (table && table->db_low_byte_first)
temp=uint4korr(ptr);
else
#endif
@@ -3809,7 +3809,7 @@ String *Field_timestamp::val_str(String *val_buffer, String *val_ptr)
thd->time_zone_used= 1;
temp= time_tmp.year % 100;
- if (temp < YY_PART_YEAR)
+ if (temp < YY_PART_YEAR - 1)
{
*to++= '2';
*to++= '0';
@@ -3857,7 +3857,7 @@ bool Field_timestamp::get_date(TIME *ltime, uint fuzzydate)
long temp;
THD *thd= table->in_use;
#ifdef WORDS_BIGENDIAN
- if (table->db_low_byte_first)
+ if (table && table->db_low_byte_first)
temp=uint4korr(ptr);
else
#endif
@@ -3894,7 +3894,7 @@ int Field_timestamp::cmp(const char *a_ptr, const char *b_ptr)
{
int32 a,b;
#ifdef WORDS_BIGENDIAN
- if (table->db_low_byte_first)
+ if (table && table->db_low_byte_first)
{
a=sint4korr(a_ptr);
b=sint4korr(b_ptr);
@@ -3912,7 +3912,7 @@ int Field_timestamp::cmp(const char *a_ptr, const char *b_ptr)
void Field_timestamp::sort_string(char *to,uint length __attribute__((unused)))
{
#ifdef WORDS_BIGENDIAN
- if (!table->db_low_byte_first)
+ if (!table || !table->db_low_byte_first)
{
to[0] = ptr[0];
to[1] = ptr[1];
@@ -3941,7 +3941,7 @@ void Field_timestamp::set_time()
long tmp= (long) table->in_use->query_start();
set_notnull();
#ifdef WORDS_BIGENDIAN
- if (table->db_low_byte_first)
+ if (table && table->db_low_byte_first)
{
int4store(ptr,tmp);
}
@@ -4329,7 +4329,7 @@ int Field_date::store(const char *from, uint len,CHARSET_INFO *cs)
from, len, MYSQL_TIMESTAMP_DATE, 1);
#ifdef WORDS_BIGENDIAN
- if (table->db_low_byte_first)
+ if (table && table->db_low_byte_first)
{
int4store(ptr,tmp);
}
@@ -4357,7 +4357,7 @@ int Field_date::store(double nr)
else
tmp=(long) rint(nr);
#ifdef WORDS_BIGENDIAN
- if (table->db_low_byte_first)
+ if (table && table->db_low_byte_first)
{
int4store(ptr,tmp);
}
@@ -4385,7 +4385,7 @@ int Field_date::store(longlong nr)
else
tmp=(long) nr;
#ifdef WORDS_BIGENDIAN
- if (table->db_low_byte_first)
+ if (table && table->db_low_byte_first)
{
int4store(ptr,tmp);
}
@@ -4411,7 +4411,7 @@ double Field_date::val_real(void)
{
int32 j;
#ifdef WORDS_BIGENDIAN
- if (table->db_low_byte_first)
+ if (table && table->db_low_byte_first)
j=sint4korr(ptr);
else
#endif
@@ -4423,7 +4423,7 @@ longlong Field_date::val_int(void)
{
int32 j;
#ifdef WORDS_BIGENDIAN
- if (table->db_low_byte_first)
+ if (table && table->db_low_byte_first)
j=sint4korr(ptr);
else
#endif
@@ -4438,7 +4438,7 @@ String *Field_date::val_str(String *val_buffer,
val_buffer->alloc(field_length);
int32 tmp;
#ifdef WORDS_BIGENDIAN
- if (table->db_low_byte_first)
+ if (table && table->db_low_byte_first)
tmp=sint4korr(ptr);
else
#endif
@@ -4456,7 +4456,7 @@ int Field_date::cmp(const char *a_ptr, const char *b_ptr)
{
int32 a,b;
#ifdef WORDS_BIGENDIAN
- if (table->db_low_byte_first)
+ if (table && table->db_low_byte_first)
{
a=sint4korr(a_ptr);
b=sint4korr(b_ptr);
@@ -4474,7 +4474,7 @@ int Field_date::cmp(const char *a_ptr, const char *b_ptr)
void Field_date::sort_string(char *to,uint length __attribute__((unused)))
{
#ifdef WORDS_BIGENDIAN
- if (!table->db_low_byte_first)
+ if (!table || !table->db_low_byte_first)
{
to[0] = ptr[0];
to[1] = ptr[1];
@@ -4698,7 +4698,7 @@ int Field_datetime::store(const char *from,uint len,CHARSET_INFO *cs)
from, len, MYSQL_TIMESTAMP_DATETIME, 1);
#ifdef WORDS_BIGENDIAN
- if (table->db_low_byte_first)
+ if (table && table->db_low_byte_first)
{
int8store(ptr,tmp);
}
@@ -4739,7 +4739,7 @@ int Field_datetime::store(longlong nr)
MYSQL_TIMESTAMP_DATETIME, 1);
#ifdef WORDS_BIGENDIAN
- if (table->db_low_byte_first)
+ if (table && table->db_low_byte_first)
{
int8store(ptr,nr);
}
@@ -4766,7 +4766,7 @@ void Field_datetime::store_time(TIME *ltime,timestamp_type type)
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED, 1);
}
#ifdef WORDS_BIGENDIAN
- if (table->db_low_byte_first)
+ if (table && table->db_low_byte_first)
{
int8store(ptr,tmp);
}
@@ -4792,7 +4792,7 @@ longlong Field_datetime::val_int(void)
{
longlong j;
#ifdef WORDS_BIGENDIAN
- if (table->db_low_byte_first)
+ if (table && table->db_low_byte_first)
j=sint8korr(ptr);
else
#endif
@@ -4812,7 +4812,7 @@ String *Field_datetime::val_str(String *val_buffer,
int part3;
#ifdef WORDS_BIGENDIAN
- if (table->db_low_byte_first)
+ if (table && table->db_low_byte_first)
tmp=sint8korr(ptr);
else
#endif
@@ -4877,7 +4877,7 @@ int Field_datetime::cmp(const char *a_ptr, const char *b_ptr)
{
longlong a,b;
#ifdef WORDS_BIGENDIAN
- if (table->db_low_byte_first)
+ if (table && table->db_low_byte_first)
{
a=sint8korr(a_ptr);
b=sint8korr(b_ptr);
@@ -4895,7 +4895,7 @@ int Field_datetime::cmp(const char *a_ptr, const char *b_ptr)
void Field_datetime::sort_string(char *to,uint length __attribute__((unused)))
{
#ifdef WORDS_BIGENDIAN
- if (!table->db_low_byte_first)
+ if (!table || !table->db_low_byte_first)
{
to[0] = ptr[0];
to[1] = ptr[1];
diff --git a/sql/field.h b/sql/field.h
index 966549516b1..a33cb0a93aa 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -713,7 +713,7 @@ public:
if ((*null_value= is_null()))
return 0;
#ifdef WORDS_BIGENDIAN
- if (table->db_low_byte_first)
+ if (table && table->db_low_byte_first)
return sint4korr(ptr);
#endif
long tmp;
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 10240e597bf..e4c20de2390 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -161,6 +161,7 @@ int execute_no_commit(ha_ndbcluster *h, NdbConnection *trans)
if (m_batch_execute)
return 0;
#endif
+ h->release_completed_operations(trans);
return trans->execute(NoCommit,AbortOnError,h->m_force_send);
}
@@ -194,6 +195,7 @@ int execute_no_commit_ie(ha_ndbcluster *h, NdbConnection *trans)
if (m_batch_execute)
return 0;
#endif
+ h->release_completed_operations(trans);
return trans->execute(NoCommit, AO_IgnoreError,h->m_force_send);
}
@@ -2747,6 +2749,25 @@ int ha_ndbcluster::close_scan()
if (!cursor)
DBUG_RETURN(1);
+ if (m_lock_tuple)
+ {
+ /*
+ Lock level m_lock.type either TL_WRITE_ALLOW_WRITE
+ (SELECT FOR UPDATE) or TL_READ_WITH_SHARED_LOCKS (SELECT
+ LOCK WITH SHARE MODE) and row was not explictly unlocked
+ with unlock_row() call
+ */
+ NdbOperation *op;
+ // Lock row
+ DBUG_PRINT("info", ("Keeping lock on scanned row"));
+
+ if (!(op= m_active_cursor->lockTuple()))
+ {
+ m_lock_tuple= false;
+ ERR_RETURN(trans->getNdbError());
+ }
+ m_ops_pending++;
+ }
m_lock_tuple= false;
if (m_ops_pending)
{
@@ -5350,6 +5371,19 @@ int ha_ndbcluster::write_ndb_file()
DBUG_RETURN(error);
}
+void
+ha_ndbcluster::release_completed_operations(NdbConnection *trans)
+{
+ if (trans->hasBlobOperation())
+ {
+ /* We are reading/writing BLOB fields,
+ releasing operation records is unsafe
+ */
+ return;
+ }
+ trans->releaseCompletedOperations();
+}
+
int
ndbcluster_show_status(THD* thd)
{
diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
index 313e497f9b5..4a53b4007fe 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -262,6 +262,8 @@ class ha_ndbcluster: public handler
void no_uncommitted_rows_init(THD *);
void no_uncommitted_rows_reset(THD *);
+ void release_completed_operations(NdbConnection*);
+
friend int execute_no_commit(ha_ndbcluster*, NdbConnection*);
friend int execute_commit(ha_ndbcluster*, NdbConnection*);
friend int execute_no_commit_ie(ha_ndbcluster*, NdbConnection*);
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index f14efc7187b..a32bd0a7337 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -3099,6 +3099,28 @@ Item *Item_cond_or::neg_transformer(THD *thd) /* NOT(a OR b OR ...) -> */
}
+Item *Item_func_nop_all::neg_transformer(THD *thd)
+{
+ /* "NOT (e $cmp$ ANY (SELECT ...)) -> e $rev_cmp$" ALL (SELECT ...) */
+ Item_func_not_all *new_item= new Item_func_not_all(args[0]);
+ Item_allany_subselect *allany= (Item_allany_subselect*)args[0];
+ allany->func= allany->func_creator(FALSE);
+ allany->all= !allany->all;
+ allany->upper_item= new_item;
+ return new_item;
+}
+
+Item *Item_func_not_all::neg_transformer(THD *thd)
+{
+ /* "NOT (e $cmp$ ALL (SELECT ...)) -> e $rev_cmp$" ANY (SELECT ...) */
+ Item_func_nop_all *new_item= new Item_func_nop_all(args[0]);
+ Item_allany_subselect *allany= (Item_allany_subselect*)args[0];
+ allany->all= !allany->all;
+ allany->func= allany->func_creator(TRUE);
+ allany->upper_item= new_item;
+ return new_item;
+}
+
Item *Item_func_eq::negated_item() /* a = b -> a != b */
{
return new Item_func_ne(args[0], args[1]);
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 73abe208d9e..0e157fd412c 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -268,6 +268,7 @@ public:
void set_sum_test(Item_sum_hybrid *item) { test_sum_item= item; };
void set_sub_test(Item_maxmin_subselect *item) { test_sub_item= item; };
bool empty_underlying_subquery();
+ Item *neg_transformer(THD *thd);
};
@@ -278,6 +279,7 @@ public:
Item_func_nop_all(Item *a) :Item_func_not_all(a) {}
longlong val_int();
const char *func_name() const { return "<nop>"; }
+ Item *neg_transformer(THD *thd);
};
diff --git a/sql/item_func.h b/sql/item_func.h
index f4a1258a02c..bc6c955b99f 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -159,8 +159,7 @@ public:
return agg_item_collations_for_comparison(c, func_name(),
items, nitems, flags);
}
- bool agg_arg_charsets(DTCollation &c, Item **items, uint nitems,
- uint flags= 0)
+ bool agg_arg_charsets(DTCollation &c, Item **items, uint nitems, uint flags)
{
return agg_item_charsets(c, func_name(), items, nitems, flags);
}
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 7bc7956283b..1ef11945bd5 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -88,6 +88,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;
@@ -134,6 +135,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 */
@@ -1444,6 +1446,23 @@ void Item_func_trim::fix_length_and_dec()
}
}
+void Item_func_trim::print(String *str)
+{
+ if (arg_count == 1)
+ {
+ Item_func::print(str);
+ return;
+ }
+ str->append(Item_func_trim::func_name());
+ str->append('(');
+ str->append(mode_name());
+ str->append(' ');
+ args[1]->print(str);
+ str->append(" from ",6);
+ args[0]->print(str);
+ str->append(')');
+}
+
/* Item_func_password */
@@ -1529,7 +1548,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;
@@ -1926,7 +1945,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(",", 1, &my_charset_bin) || tmp_str.append(*res))
return &my_empty_string;
}
}
@@ -2592,8 +2611,12 @@ String* Item_func_export_set::val_str(String* str)
}
break;
case 3:
- sep_buf.set(",", 1, default_charset());
- sep = &sep_buf;
+ {
+ /* errors is not checked - assume "," can always be converted */
+ uint errors;
+ sep_buf.copy(",", 1, &my_charset_bin, collation.collation, &errors);
+ sep = &sep_buf;
+ }
break;
default:
DBUG_ASSERT(0); // cannot happen
@@ -2618,8 +2641,8 @@ void Item_func_export_set::fix_length_and_dec()
uint sep_length=(arg_count > 3 ? args[3]->max_length : 1);
max_length=length*64+sep_length*63;
- if (agg_arg_charsets(collation, args+1, min(4,arg_count)-1),
- MY_COLL_ALLOW_CONV)
+ if (agg_arg_charsets(collation, args+1, min(4,arg_count)-1,
+ MY_COLL_ALLOW_CONV))
return;
}
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index f800c17182b..b7cecad9516 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -41,7 +41,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"; }
@@ -51,7 +54,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"; }
@@ -218,6 +224,8 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "trim"; }
+ void print(String *str);
+ virtual const char *mode_name() const { return "both"; }
};
@@ -228,6 +236,7 @@ public:
Item_func_ltrim(Item *a) :Item_func_trim(a) {}
String *val_str(String *);
const char *func_name() const { return "ltrim"; }
+ const char *mode_name() const { return "leading"; }
};
@@ -238,6 +247,7 @@ public:
Item_func_rtrim(Item *a) :Item_func_trim(a) {}
String *val_str(String *);
const char *func_name() const { return "rtrim"; }
+ const char *mode_name() const { return "trailing"; }
};
@@ -306,9 +316,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 "ecrypt"; }
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index f6f8eec9af5..13beb022c9d 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -542,14 +542,14 @@ Item_in_subselect::Item_in_subselect(Item * left_exp,
}
Item_allany_subselect::Item_allany_subselect(Item * left_exp,
- Comp_creator *fn,
+ chooser_compare_func_creator fc,
st_select_lex *select_lex,
bool all_arg)
- :Item_in_subselect(), all(all_arg)
+ :Item_in_subselect(), all(all_arg), func_creator(fc)
{
DBUG_ENTER("Item_in_subselect::Item_in_subselect");
left_expr= left_exp;
- func= fn;
+ func= func_creator(all_arg);
init(select_lex, new select_exists_subselect(this));
max_columns= 1;
abort_on_null= 0;
@@ -976,18 +976,18 @@ Item_in_subselect::row_value_transformer(JOIN *join)
DBUG_RETURN(RES_ERROR);
Item *item_eq=
new Item_func_eq(new
- Item_direct_ref((*optimizer->get_cache())->
+ Item_ref((*optimizer->get_cache())->
addr(i),
(char *)"<no matter>",
(char *)in_left_expr_name),
new
- Item_direct_ref(select_lex->ref_pointer_array + i,
+ Item_ref(select_lex->ref_pointer_array + i,
(char *)"<no matter>",
(char *)"<list ref>")
);
Item *item_isnull=
new Item_func_isnull(new
- Item_direct_ref( select_lex->
+ Item_ref( select_lex->
ref_pointer_array+i,
(char *)"<no matter>",
(char *)"<list ref>")
@@ -1000,7 +1000,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
new
Item_is_not_null_test(this,
new
- Item_direct_ref(select_lex->
+ Item_ref(select_lex->
ref_pointer_array + i,
(char *)"<no matter>",
(char *)"<list ref>")
@@ -1057,7 +1057,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
new
Item_is_not_null_test(this,
new
- Item_direct_ref(select_lex->
+ Item_ref(select_lex->
ref_pointer_array + i,
(char *)"<no matter>",
(char *)"<list ref>")
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index dec32398a80..93171ad64a1 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -251,14 +251,13 @@ public:
/* ALL/ANY/SOME subselect */
class Item_allany_subselect :public Item_in_subselect
{
-protected:
- Comp_creator *func;
-
public:
+ chooser_compare_func_creator func_creator;
+ Comp_creator *func;
bool all;
- Item_allany_subselect(Item * left_expr, Comp_creator *f,
- st_select_lex *select_lex, bool all);
+ Item_allany_subselect(Item * left_expr, chooser_compare_func_creator fc,
+ st_select_lex *select_lex, bool all);
// only ALL subquery has upper not
subs_type substype() { return all?ALL_SUBS:ANY_SUBS; }
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 44d9b422263..febc92e34f6 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1600,14 +1600,12 @@ uint Item_func_date_format::format_length(const String *format)
case 'u': /* week (00..52), where week starts with Monday */
case 'V': /* week 1..53 used with 'x' */
case 'v': /* week 1..53 used with 'x', where week starts with Monday */
- case 'H': /* hour (00..23) */
case 'y': /* year, numeric, 2 digits */
case 'm': /* month, numeric */
case 'd': /* day (of the month), numeric */
case 'h': /* hour (01..12) */
case 'I': /* --||-- */
case 'i': /* minutes, numeric */
- case 'k': /* hour ( 0..23) */
case 'l': /* hour ( 1..12) */
case 'p': /* locale's AM or PM */
case 'S': /* second (00..61) */
@@ -1616,6 +1614,10 @@ uint Item_func_date_format::format_length(const String *format)
case 'e': /* day (0..31) */
size += 2;
break;
+ case 'k': /* hour ( 0..23) */
+ case 'H': /* hour (00..23; value > 23 OK, padding always 2-digit) */
+ size += 7; /* docs allow > 23, range depends on sizeof(unsigned int) */
+ break;
case 'r': /* time, 12-hour (hh:mm:ss [AP]M) */
size += 11;
break;
diff --git a/sql/log.cc b/sql/log.cc
index c530f15a84f..7e97bfd0712 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -409,13 +409,18 @@ shutdown the MySQL server and restart it.", log_name, errno);
int MYSQL_LOG::get_current_log(LOG_INFO* linfo)
{
pthread_mutex_lock(&LOCK_log);
+ int ret = raw_get_current_log(linfo);
+ pthread_mutex_unlock(&LOCK_log);
+ return ret;
+}
+
+int MYSQL_LOG::raw_get_current_log(LOG_INFO* linfo)
+{
strmake(linfo->log_file_name, log_file_name, sizeof(linfo->log_file_name)-1);
linfo->pos = my_b_tell(&log_file);
- pthread_mutex_unlock(&LOCK_log);
return 0;
}
-
/*
Move all data up in a file in an filename index file
@@ -2321,6 +2326,12 @@ void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
void
*/
+#ifdef EMBEDDED_LIBRARY
+void vprint_msg_to_log(enum loglevel level __attribute__((unused)),
+ const char *format __attribute__((unused)),
+ va_list argsi __attribute__((unused)))
+{}
+#else /*!EMBEDDED_LIBRARY*/
void vprint_msg_to_log(enum loglevel level, const char *format, va_list args)
{
char buff[1024];
@@ -2336,6 +2347,7 @@ void vprint_msg_to_log(enum loglevel level, const char *format, va_list args)
DBUG_VOID_RETURN;
}
+#endif /*EMBEDDED_LIBRARY*/
void sql_print_error(const char *format, ...)
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index b9faa062850..9c5bcc2d53f 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -387,8 +387,9 @@ enum enum_var_type
OPT_DEFAULT, OPT_SESSION, OPT_GLOBAL
};
class sys_var;
-#include "item.h"
+class Comp_creator;
typedef Comp_creator* (*chooser_compare_func_creator)(bool invert);
+#include "item.h"
/* sql_parse.cc */
void free_items(Item *item);
void cleanup_items(Item *item);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 0de8f005247..bf83772a8d8 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -378,6 +378,7 @@ key_map key_map_full(0); // Will be initialized later
const char *opt_date_time_formats[3];
+char compiled_default_collation_name[]= MYSQL_DEFAULT_COLLATION_NAME;
char *language_ptr, *default_collation_name, *default_character_set_name;
char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home;
struct passwd *user_info;
@@ -2646,6 +2647,11 @@ You should consider changing lower_case_table_names to 1 or 2",
mysql_real_data_home);
lower_case_table_names= 0;
}
+ else
+ {
+ lower_case_file_system=
+ (test_if_case_insensitive(mysql_real_data_home) == 1);
+ }
/* Reset table_alias_charset, now that lower_case_table_names is set. */
table_alias_charset= (lower_case_table_names ?
@@ -5931,7 +5937,7 @@ static void mysql_init_variables(void)
/* Variables in libraries */
charsets_dir= 0;
default_character_set_name= (char*) MYSQL_DEFAULT_CHARSET_NAME;
- default_collation_name= (char*) MYSQL_DEFAULT_COLLATION_NAME;
+ default_collation_name= compiled_default_collation_name;
sys_charset_system.value= (char*) system_charset_info->csname;
@@ -6086,7 +6092,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
strmake(mysql_home,argument,sizeof(mysql_home)-1);
break;
case 'C':
- default_collation_name= 0;
+ if (default_collation_name == compiled_default_collation_name)
+ default_collation_name= 0;
break;
case 'l':
opt_log=1;
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 93fa7ac938c..08184537896 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -747,7 +747,7 @@ my_real_read(NET *net, ulong *complen)
#endif /* EXTRA_DEBUG */
}
#if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER)
- if (vio_should_retry(net->vio))
+ if (vio_errno(net->vio) == SOCKET_EINTR)
{
DBUG_PRINT("warning",("Interrupted read. Retrying..."));
continue;
diff --git a/sql/opt_range.h b/sql/opt_range.h
index 15f0bf02b34..d2f4452a762 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -86,7 +86,7 @@ public:
QUICK_SELECT(THD *thd, TABLE *table,uint index_arg,bool no_alloc=0);
virtual ~QUICK_SELECT();
- void reset(void) { next=0; it.rewind(); }
+ void reset(void) { next=0; it.rewind(); range= NULL;}
int init()
{
key_part_info= head->key_info[index].key_part;
diff --git a/sql/set_var.cc b/sql/set_var.cc
index a665a6dc3aa..4acedc7bcbd 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -424,7 +424,8 @@ static sys_var_thd_bit sys_sql_big_tables("sql_big_tables", 0,
static sys_var_thd_bit sys_big_selects("sql_big_selects", 0,
set_option_bit,
OPTION_BIG_SELECTS);
-static sys_var_thd_bit sys_log_off("sql_log_off", 0,
+static sys_var_thd_bit sys_log_off("sql_log_off",
+ check_log_update,
set_option_bit,
OPTION_LOG_OFF);
static sys_var_thd_bit sys_log_update("sql_log_update",
@@ -737,8 +738,8 @@ struct show_var_st init_vars[]= {
{"have_geometry", (char*) &have_geometry, SHOW_HAVE},
{"have_innodb", (char*) &have_innodb, SHOW_HAVE},
{"have_isam", (char*) &have_isam, SHOW_HAVE},
- {"have_ndbcluster", (char*) &have_ndbcluster, SHOW_HAVE},
{"have_merge_engine", (char*) &have_merge_db, SHOW_HAVE},
+ {"have_ndbcluster", (char*) &have_ndbcluster, SHOW_HAVE},
{"have_openssl", (char*) &have_openssl, SHOW_HAVE},
{"have_query_cache", (char*) &have_query_cache, SHOW_HAVE},
{"have_raid", (char*) &have_raid, SHOW_HAVE},
diff --git a/sql/slave.cc b/sql/slave.cc
index b2862a437bb..bceeca1055c 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -2946,7 +2946,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
rli->is_until_satisfied())
{
char buf[22];
- sql_print_error("Slave SQL thread stopped because it reached its"
+ sql_print_information("Slave SQL thread stopped because it reached its"
" UNTIL position %s", llstr(rli->until_pos(), buf));
/*
Setting abort_slave flag because we do not want additional message about
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 734bccb6b46..6ede19d0e96 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2640,7 +2640,11 @@ int mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
while ((Str = str_list++))
{
if (Str->host.length > HOSTNAME_LENGTH ||
- Str->user.length > USERNAME_LENGTH)
+ system_charset_info->cset->charpos(system_charset_info,
+ Str->user.str,
+ Str->user.str +
+ Str->user.length,
+ USERNAME_LENGTH) < Str->user.length)
{
my_error(ER_GRANT_WRONG_HOST_OR_USER,MYF(0));
result= -1;
@@ -3671,17 +3675,11 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
{
if (!(acl_user= check_acl_user(user_name, &counter)))
{
- sql_print_error("DROP USER: Can't drop user: '%s'@'%s'; No such user",
- user_name->user.str,
- user_name->host.str);
result= -1;
continue;
}
if ((acl_user->access & ~0))
{
- sql_print_error("DROP USER: Can't drop user: '%s'@'%s'; Global privileges exists",
- user_name->user.str,
- user_name->host.str);
result= -1;
continue;
}
@@ -3702,9 +3700,6 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
}
if (counter != acl_dbs.elements)
{
- sql_print_error("DROP USER: Can't drop user: '%s'@'%s'; Database privileges exists",
- user_name->user.str,
- user_name->host.str);
result= -1;
continue;
}
@@ -3725,9 +3720,6 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
}
if (counter != column_priv_hash.records)
{
- sql_print_error("DROP USER: Can't drop user: '%s'@'%s'; Table privileges exists",
- user_name->user.str,
- user_name->host.str);
result= -1;
continue;
}
@@ -3793,9 +3785,6 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
{
if (!check_acl_user(lex_user, &counter))
{
- sql_print_error("REVOKE ALL PRIVILEGES, GRANT: User '%s'@'%s' not exists",
- lex_user->user.str,
- lex_user->host.str);
result= -1;
continue;
}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index e8fe175cd7c..a995a492bc8 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -177,6 +177,7 @@ public:
bool need_mutex);
int find_next_log(LOG_INFO* linfo, bool need_mutex);
int get_current_log(LOG_INFO* linfo);
+ int raw_get_current_log(LOG_INFO* linfo);
uint next_file_id();
inline bool is_open() { return log_type != LOG_CLOSED; }
inline char* get_index_fname() { return index_file_name;}
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index fb9a765f12c..dfe406c351e 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -643,8 +643,9 @@ int yylex(void *arg, void *yythd)
*/
if ((yylval->lex_str.str[0]=='_') &&
- (lex->charset=get_charset_by_csname(yylval->lex_str.str+1,
- MY_CS_PRIMARY,MYF(0))))
+ (lex->underscore_charset=
+ get_charset_by_csname(yylval->lex_str.str + 1,
+ MY_CS_PRIMARY,MYF(0))))
return(UNDERSCORE_CHARSET);
return(result_state); // IDENT or IDENT_QUOTED
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 35f02db6cf9..12f89202e2d 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -613,7 +613,7 @@ typedef struct st_lex
LEX_USER *grant_user;
gptr yacc_yyss,yacc_yyvs;
THD *thd;
- CHARSET_INFO *charset;
+ CHARSET_INFO *charset, *underscore_charset;
List<key_part_spec> col_list;
List<key_part_spec> ref_list;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index ad3accbe187..89ecceeb1bf 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -902,8 +902,8 @@ static int check_connection(THD *thd)
char *user= end;
char *passwd= strend(user)+1;
char *db= passwd;
- char db_buff[NAME_LEN+1]; // buffer to store db in utf8
- char user_buff[USERNAME_LENGTH+1]; // buffer to store user in utf8
+ char db_buff[NAME_BYTE_LEN + 1]; // buffer to store db in utf8
+ char user_buff[USERNAME_BYTE_LENGTH + 1]; // buffer to store user in utf8
uint dummy_errors;
/*
@@ -5442,7 +5442,7 @@ Item * all_any_subquery_creator(Item *left_expr,
return new Item_func_not(new Item_in_subselect(left_expr, select_lex));
Item_allany_subselect *it=
- new Item_allany_subselect(left_expr, (*cmp)(all), select_lex, all);
+ new Item_allany_subselect(left_expr, cmp, select_lex, all);
if (all)
return it->upper_item= new Item_func_not_all(it); /* ALL */
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 963c4ccf5a6..2a7ab55b8c4 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -1359,10 +1359,14 @@ int show_binlogs(THD* thd)
MYSQL_TYPE_LONGLONG));
if (protocol->send_fields(&field_list, 1))
DBUG_RETURN(1);
+
+ pthread_mutex_lock(mysql_bin_log.get_log_lock());
mysql_bin_log.lock_index();
index_file=mysql_bin_log.get_index_file();
-
- mysql_bin_log.get_current_log(&cur);
+
+ mysql_bin_log.raw_get_current_log(&cur); // dont take mutex
+ pthread_mutex_unlock(mysql_bin_log.get_log_lock()); // lockdep, OK
+
cur_dir_len= dirname_length(cur.log_file_name);
reinit_io_cache(index_file, READ_CACHE, (my_off_t) 0, 0, 0);
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index fd8a5149edd..f0859564a5e 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -547,6 +547,24 @@ JOIN::optimize()
}
zero_result_cause= "Select tables optimized away";
tables_list= 0; // All tables resolved
+ /*
+ Extract all table-independent conditions and replace the WHERE
+ clause with them. All other conditions were computed by opt_sum_query
+ and the MIN/MAX/COUNT function(s) have been replaced by constants,
+ so there is no need to compute the whole WHERE clause again.
+ Notice that make_cond_for_table() will always succeed to remove all
+ computed conditions, because opt_sum_query() is applicable only to
+ conjunctions.
+ */
+ if (conds)
+ {
+ COND *table_independent_conds=
+ make_cond_for_table(conds, PSEUDO_TABLE_BITS, 0);
+ DBUG_EXECUTE("where",
+ print_where(table_independent_conds,
+ "where after opt_sum_query()"););
+ conds= table_independent_conds;
+ }
}
}
if (!tables_list)
@@ -630,6 +648,36 @@ JOIN::optimize()
if (!order && org_order)
skip_sort_order= 1;
}
+ /*
+ Check if we can optimize away GROUP BY/DISTINCT.
+ We can do that if there are no aggregate functions and the
+ fields in DISTINCT clause (if present) and/or columns in GROUP BY
+ (if present) contain direct references to all key parts of
+ an unique index (in whatever order).
+ Note that the unique keys for DISTINCT and GROUP BY should not
+ be the same (as long as they are unique).
+
+ The FROM clause must contain a single non-constant table.
+ */
+ if (tables - const_tables == 1 && (group_list || select_distinct) &&
+ !tmp_table_param.sum_func_count)
+ {
+ if (group_list &&
+ list_contains_unique_index(join_tab[const_tables].table,
+ find_field_in_order_list,
+ (void *) group_list))
+ {
+ group_list= 0;
+ group= 0;
+ }
+ if (select_distinct &&
+ list_contains_unique_index(join_tab[const_tables].table,
+ find_field_in_item_list,
+ (void *) &fields_list))
+ {
+ select_distinct= 0;
+ }
+ }
if (group_list || tmp_table_param.sum_func_count)
{
if (! hidden_group_fields && rollup.state == ROLLUP::STATE_NONE)
@@ -699,36 +747,6 @@ JOIN::optimize()
if (old_group_list && !group_list)
select_distinct= 0;
}
- /*
- Check if we can optimize away GROUP BY/DISTINCT.
- We can do that if there are no aggregate functions and the
- fields in DISTINCT clause (if present) and/or columns in GROUP BY
- (if present) contain direct references to all key parts of
- an unique index (in whatever order).
- Note that the unique keys for DISTINCT and GROUP BY should not
- be the same (as long as they are unique).
-
- The FROM clause must contain a single non-constant table.
- */
- if (tables - const_tables == 1 && (group_list || select_distinct) &&
- !tmp_table_param.sum_func_count)
- {
- if (group_list &&
- list_contains_unique_index(join_tab[const_tables].table,
- find_field_in_order_list,
- (void *) group_list))
- {
- group_list= 0;
- group= 0;
- }
- if (select_distinct &&
- list_contains_unique_index(join_tab[const_tables].table,
- find_field_in_item_list,
- (void *) &fields_list))
- {
- select_distinct= 0;
- }
- }
if (!group_list && group)
{
order=0; // The output has only one row
@@ -2143,8 +2161,11 @@ merge_key_fields(KEY_FIELD *start,KEY_FIELD *new_fields,KEY_FIELD *end,
/* field = expression OR field IS NULL */
old->level= and_level;
old->optimize= KEY_OPTIMIZE_REF_OR_NULL;
- /* Remember the NOT NULL value */
- if (old->val->is_null())
+ /*
+ Remember the NOT NULL value unless the value does not depend
+ on other tables.
+ */
+ if (!old->val->used_tables() && old->val->is_null())
old->val= new_fields->val;
/* The referred expression can be NULL: */
old->null_rejecting= 0;
@@ -4452,10 +4473,16 @@ return_zero_rows(JOIN *join, select_result *result,TABLE_LIST *tables,
DBUG_RETURN(0);
}
-
+/*
+ used only in JOIN::clear
+*/
static void clear_tables(JOIN *join)
{
- for (uint i=0 ; i < join->tables ; i++)
+ /*
+ must clear only the non-const tables, as const tables
+ are not re-calculated.
+ */
+ for (uint i=join->const_tables ; i < join->tables ; i++)
mark_as_null_row(join->table[i]); // All fields are NULL
}
@@ -4522,6 +4549,8 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
left_item->collation.collation == value->collation.collation))
{
Item *tmp=value->new_item();
+ tmp->collation.set(right_item->collation);
+
if (tmp)
{
thd->change_item_tree(args + 1, tmp);
@@ -4543,6 +4572,8 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
right_item->collation.collation == value->collation.collation))
{
Item *tmp=value->new_item();
+ tmp->collation.set(left_item->collation);
+
if (tmp)
{
thd->change_item_tree(args, tmp);
@@ -5240,12 +5271,14 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
param->group_length : 0,
NullS))
{
- bitmap_clear_bit(&temp_pool, temp_pool_slot);
+ if (temp_pool_slot != MY_BIT_NONE)
+ bitmap_clear_bit(&temp_pool, temp_pool_slot);
DBUG_RETURN(NULL); /* purecov: inspected */
}
if (!(param->copy_field=copy=new Copy_field[field_count]))
{
- bitmap_clear_bit(&temp_pool, temp_pool_slot);
+ if (temp_pool_slot != MY_BIT_NONE)
+ bitmap_clear_bit(&temp_pool, temp_pool_slot);
my_free((gptr) table,MYF(0)); /* purecov: inspected */
DBUG_RETURN(NULL); /* purecov: inspected */
}
@@ -5543,10 +5576,11 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
keyinfo->key_length=0;
keyinfo->rec_per_key=0;
keyinfo->algorithm= HA_KEY_ALG_UNDEF;
- for (; group ; group=group->next,key_part_info++)
+ ORDER *cur_group= group;
+ for (; cur_group ; cur_group= cur_group->next, key_part_info++)
{
- Field *field=(*group->item)->get_tmp_table_field();
- bool maybe_null=(*group->item)->maybe_null;
+ Field *field=(*cur_group->item)->get_tmp_table_field();
+ bool maybe_null=(*cur_group->item)->maybe_null;
key_part_info->null_bit=0;
key_part_info->field= field;
key_part_info->offset= field->offset();
@@ -5558,8 +5592,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
0 : FIELDFLAG_BINARY;
if (!using_unique_constraint)
{
- group->buff=(char*) group_buff;
- if (!(group->field=field->new_field(thd->mem_root,table)))
+ cur_group->buff=(char*) group_buff;
+ if (!(cur_group->field=field->new_field(thd->mem_root,table)))
goto err; /* purecov: inspected */
if (maybe_null)
{
@@ -5573,21 +5607,16 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
key_part_info->null_bit=field->null_bit;
key_part_info->null_offset= (uint) (field->null_ptr -
(uchar*) table->record[0]);
- group->field->move_field((char*) ++group->buff);
+ cur_group->field->move_field((char*) ++cur_group->buff);
group_buff++;
}
else
- group->field->move_field((char*) group_buff);
+ cur_group->field->move_field((char*) group_buff);
group_buff+= key_part_info->length;
}
keyinfo->key_length+= key_part_info->length;
}
}
- else
- {
- set_if_smaller(table->max_rows, rows_limit);
- param->end_write_records= rows_limit;
- }
if (distinct && field_count != param->hidden_field_count)
{
@@ -5650,6 +5679,20 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
0 : FIELDFLAG_BINARY;
}
}
+
+ /*
+ Push the LIMIT clause to the temporary table creation, so that we
+ materialize only up to 'rows_limit' records instead of all result records.
+ This optimization is not applicable when there is GROUP BY or there is
+ no GROUP BY, but there are aggregate functions, because both must be
+ computed for all result rows.
+ */
+ if (!group && !thd->lex->current_select->with_sum_func)
+ {
+ set_if_smaller(table->max_rows, rows_limit);
+ param->end_write_records= rows_limit;
+ }
+
if (thd->is_fatal_error) // If end of memory
goto err; /* purecov: inspected */
table->db_record_offset=1;
@@ -5668,7 +5711,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
*/
*table->blob_field= 0;
free_tmp_table(thd,table); /* purecov: inspected */
- bitmap_clear_bit(&temp_pool, temp_pool_slot);
+ if (temp_pool_slot != MY_BIT_NONE)
+ bitmap_clear_bit(&temp_pool, temp_pool_slot);
DBUG_RETURN(NULL); /* purecov: inspected */
}
@@ -5831,7 +5875,8 @@ free_tmp_table(THD *thd, TABLE *entry)
my_free((gptr) entry->record[0],MYF(0));
free_io_cache(entry);
- bitmap_clear_bit(&temp_pool, entry->temp_pool_slot);
+ if (entry->temp_pool_slot != MY_BIT_NONE)
+ bitmap_clear_bit(&temp_pool, entry->temp_pool_slot);
my_free((gptr) entry,MYF(0));
thd->proc_info=save_proc_info;
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 631d2d89bbb..a5cb0d45664 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -516,6 +516,40 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
DBUG_RETURN(-1);
}
+ /*
+ Convert the default value character
+ set into the column character set if necessary.
+ */
+ if (sql_field->def &&
+ savecs != sql_field->def->collation.collation &&
+ (sql_field->sql_type == FIELD_TYPE_VAR_STRING ||
+ sql_field->sql_type == FIELD_TYPE_STRING ||
+ sql_field->sql_type == FIELD_TYPE_SET ||
+ sql_field->sql_type == FIELD_TYPE_ENUM))
+ {
+ Item_arena backup_arena;
+ bool need_to_change_arena=
+ !thd->current_arena->is_conventional_execution();
+ if (need_to_change_arena)
+ {
+ /* Assert that we don't do that at every PS execute */
+ DBUG_ASSERT(thd->current_arena->is_first_stmt_execute());
+ thd->set_n_backup_item_arena(thd->current_arena, &backup_arena);
+ }
+
+ sql_field->def= sql_field->def->safe_charset_converter(savecs);
+
+ if (need_to_change_arena)
+ thd->restore_backup_item_arena(thd->current_arena, &backup_arena);
+
+ if (sql_field->def == NULL)
+ {
+ /* Could not convert */
+ my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
+ DBUG_RETURN(-1);
+ }
+ }
+
if (sql_field->sql_type == FIELD_TYPE_SET ||
sql_field->sql_type == FIELD_TYPE_ENUM)
{
@@ -580,35 +614,6 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
sql_field->interval_list.empty(); // Don't need interval_list anymore
}
- /*
- Convert the default value from client character
- set into the column character set if necessary.
- */
- if (sql_field->def && cs != sql_field->def->collation.collation)
- {
- Item_arena backup_arena;
- bool need_to_change_arena=
- !thd->current_arena->is_conventional_execution();
- if (need_to_change_arena)
- {
- /* Asser that we don't do that at every PS execute */
- DBUG_ASSERT(thd->current_arena->is_first_stmt_execute());
- thd->set_n_backup_item_arena(thd->current_arena, &backup_arena);
- }
-
- sql_field->def= sql_field->def->safe_charset_converter(cs);
-
- if (need_to_change_arena)
- thd->restore_backup_item_arena(thd->current_arena, &backup_arena);
-
- if (sql_field->def == NULL)
- {
- /* Could not convert */
- my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
- DBUG_RETURN(-1);
- }
- }
-
if (sql_field->sql_type == FIELD_TYPE_SET)
{
if (sql_field->def != NULL)
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 089d0bf0660..af4ba8025f9 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -628,7 +628,7 @@ int mysql_multi_update_lock(THD *thd,
if (!using_lock_tables)
tl->table->reginfo.lock_type= tl->lock_type;
if (check_access(thd, wants, tl->db, &tl->grant.privilege, 0, 0) ||
- (grant_option && check_grant(thd, wants, tl, 0, 0, 0)))
+ (grant_option && check_grant(thd, wants, tl, 0, 1, 0)))
{
tl->next= save;
DBUG_RETURN(1);
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 162b4183c84..efd83549312 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -4896,7 +4896,7 @@ text_literal:
| NCHAR_STRING
{ $$= new Item_string($1.str,$1.length,national_charset_info); }
| UNDERSCORE_CHARSET TEXT_STRING
- { $$ = new Item_string($2.str,$2.length,Lex->charset); }
+ { $$ = new Item_string($2.str,$2.length,Lex->underscore_charset); }
| text_literal TEXT_STRING_literal
{ ((Item_string*) $1)->append($2.str,$2.length); }
;
@@ -4963,7 +4963,7 @@ literal:
(String*) 0;
$$= new Item_string(str ? str->ptr() : "",
str ? str->length() : 0,
- Lex->charset);
+ Lex->underscore_charset);
}
| DATE_SYM text_literal { $$ = $2; }
| TIME_SYM text_literal { $$ = $2; }
diff --git a/sql/table.cc b/sql/table.cc
index 29e7d5ebf26..7587531b2f9 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1413,7 +1413,7 @@ char *get_field(MEM_ROOT *mem, Field *field)
bool check_db_name(char *name)
{
- char *start=name;
+ uint name_length= 0; // name length in symbols
/* Used to catch empty names and names with end space */
bool last_char_is_space= TRUE;
@@ -1430,6 +1430,7 @@ bool check_db_name(char *name)
name+system_charset_info->mbmaxlen);
if (len)
{
+ name_length++;
name += len;
continue;
}
@@ -1437,12 +1438,13 @@ bool check_db_name(char *name)
#else
last_char_is_space= *name==' ';
#endif
+ name_length++;
if (*name == '/' || *name == '\\' || *name == FN_LIBCHAR ||
*name == FN_EXTCHAR)
return 1;
name++;
}
- return last_char_is_space || (uint) (name - start) > NAME_LEN;
+ return (last_char_is_space || name_length > NAME_LEN);
}
diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c
index e936ef1d423..b03bbbc155c 100644
--- a/strings/ctype-win1250ch.c
+++ b/strings/ctype-win1250ch.c
@@ -634,11 +634,11 @@ my_like_range_win1250ch(CHARSET_INFO *cs __attribute__((unused)),
ptr++; /* Skip escape */
else if (*ptr == w_one || *ptr == w_many) /* '_' or '%' in SQL */
break;
- *min_str = like_range_prefix_min_win1250ch[(uint)(*ptr)];
+ *min_str = like_range_prefix_min_win1250ch[(uint) (uchar) (*ptr)];
if (*min_str != min_sort_char)
only_min_found= 0;
min_str++;
- *max_str++ = like_range_prefix_max_win1250ch[(uint)(*ptr)];
+ *max_str++ = like_range_prefix_max_win1250ch[(uint) (uchar) (*ptr)];
}
*min_length = (uint) (min_str - min_org);
diff --git a/strings/strtod.c b/strings/strtod.c
index da1b4f4baa6..1663cd61b78 100644
--- a/strings/strtod.c
+++ b/strings/strtod.c
@@ -26,7 +26,7 @@
*/
-#include <my_global.h> /* Includes errno.h */
+#include <my_base.h> /* Includes errno.h */
#include <m_ctype.h>
#define MAX_DBL_EXP 308
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index 23bd98aa3c2..1daac2d0e95 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -546,7 +546,7 @@ fi
%doc %attr(644, root, man) %{_mandir}/man1/myisamlog.1*
%doc %attr(644, root, man) %{_mandir}/man1/myisampack.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_explain_log.1*
-%doc %attr(644, root, man) %{_mandir}/man1/mysqld.1*
+%doc %attr(644, root, man) %{_mandir}/man8/mysqld.8*
%doc %attr(644, root, man) %{_mandir}/man1/mysqld_multi.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqld_safe.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_fix_privilege_tables.1*
@@ -649,6 +649,8 @@ 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_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 94034141d81..9fabde993b8 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -9952,8 +9952,9 @@ static void test_ps_i18n()
const char *stmt_text;
MYSQL_BIND bind_array[2];
- const char *koi8= "îÕ, ÚÁ ÒÙÂÁÌËÕ";
- const char *cp1251= "Íó, çà ðûáàëêó";
+ /* Represented as numbers to keep UTF8 tools from clobbering them. */
+ const char *koi8= "\xee\xd5\x2c\x20\xda\xc1\x20\xd2\xd9\xc2\xc1\xcc\xcb\xd5";
+ const char *cp1251= "\xcd\xf3\x2c\x20\xe7\xe0\x20\xf0\xfb\xe1\xe0\xeb\xea\xf3";
char buf1[16], buf2[16];
ulong buf1_len, buf2_len;
@@ -12125,7 +12126,9 @@ static struct my_tests_st my_tests[]= {
{ "test_bug8378", test_bug8378 },
{ "test_bug9735", test_bug9735 },
{ "test_bug11183", test_bug11183 },
+#ifndef EMBEDDED_LIBRARY
{ "test_bug12744", test_bug12744 },
+#endif
{ "test_bug12001", test_bug12001 },
{ "test_bug11718", test_bug11718 },
{ "test_bug12925", test_bug12925 },
diff --git a/vio/viosocket.c b/vio/viosocket.c
index 8d4c2387632..847e036d3b2 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -333,16 +333,30 @@ my_bool vio_poll_read(Vio *vio,uint timeout)
}
-void vio_timeout(Vio *vio __attribute__((unused)),
- uint which __attribute__((unused)),
- uint timeout __attribute__((unused)))
+void vio_timeout(Vio *vio, uint which, uint timeout)
{
+/* TODO: some action should be taken if socket timeouts are not supported. */
+#if defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO)
+
#ifdef __WIN__
- ulong wait_timeout= (ulong) timeout * 1000;
- (void) setsockopt(vio->sd, SOL_SOCKET,
- which ? SO_SNDTIMEO : SO_RCVTIMEO, (char*) &wait_timeout,
- sizeof(wait_timeout));
-#endif /* __WIN__ */
+
+ /* Windows expects time in milliseconds as int. */
+ int wait_timeout= (int) timeout * 1000;
+
+#else /* ! __WIN__ */
+
+ /* POSIX specifies time as struct timeval. */
+ struct timeval wait_timeout;
+ wait_timeout.tv_sec= timeout;
+ wait_timeout.tv_usec= 0;
+
+#endif /* ! __WIN__ */
+
+ /* TODO: return value should be checked. */
+ (void) setsockopt(vio->sd, SOL_SOCKET, which ? SO_SNDTIMEO : SO_RCVTIMEO,
+ (char*) &wait_timeout, sizeof(wait_timeout));
+
+#endif /* defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO) */
}