1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

Merge mysql.com:/home/mydev/mysql-4.1

into  mysql.com:/home/mydev/mysql-4.1-bug5390
This commit is contained in:
ingo@mysql.com
2006-04-11 15:18:16 +02:00
212 changed files with 13255 additions and 1002 deletions

View File

@@ -63,7 +63,7 @@ Licensee.
4. Price and payment. 4. Price and payment.
No later than thirty (30) days after submission of the Order Form, Licensee No later than thirty (30) days after submission of the Order Form, Licensee
shall remit one non-refundable license fee per Licensed Copy as posted on shall remit one non-refundable license fee per Licensed Copy as posted on
http://order.mysql.com on the date Licensee submitted the Order Form (the http://shop.mysql.com on the date Licensee submitted the Order Form (the
"License Fee"). All payments shall be made in Euros or U.S. dollars. Licensee "License Fee"). All payments shall be made in Euros or U.S. dollars. Licensee
shall be responsible for paying all local, state, federal and international shall be responsible for paying all local, state, federal and international
sales, value added, excise and other taxes and duties payable in connection sales, value added, excise and other taxes and duties payable in connection

2
README
View File

@@ -8,7 +8,7 @@ License information can be found in these files:
For further information about MySQL or additional documentation, see: For further information about MySQL or additional documentation, see:
- The latest information about MySQL: http://www.mysql.com - The latest information about MySQL: http://www.mysql.com
- The current MySQL documentation: http:/dev.mysql.com/doc - The current MySQL documentation: http://dev.mysql.com/doc
Some manual sections of special interest: Some manual sections of special interest:

View File

@@ -19,7 +19,6 @@
ATLMinimizesCRunTimeLibraryUsage="FALSE"> ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-max"
Optimization="2" Optimization="2"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
OptimizeForProcessor="2" OptimizeForProcessor="2"

View File

@@ -20,7 +20,6 @@
CharacterSet="2"> CharacterSet="2">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-nt-max"
Optimization="2" Optimization="2"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
OptimizeForProcessor="2" OptimizeForProcessor="2"
@@ -175,7 +174,6 @@
CharacterSet="2"> CharacterSet="2">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-nt"
Optimization="2" Optimization="2"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
OptimizeForProcessor="2" OptimizeForProcessor="2"

View File

@@ -86,7 +86,6 @@
CharacterSet="2"> CharacterSet="2">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-pro"
Optimization="2" Optimization="2"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
OptimizeForProcessor="2" OptimizeForProcessor="2"

View File

@@ -71,7 +71,6 @@
CharacterSet="2"> CharacterSet="2">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-pro"
Optimization="2" Optimization="2"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../include,../regex,../libmysqld,../sql,../zlib" AdditionalIncludeDirectories="../include,../regex,../libmysqld,../sql,../zlib"

View File

@@ -67,7 +67,6 @@
ATLMinimizesCRunTimeLibraryUsage="FALSE"> ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-max"
Optimization="2" Optimization="2"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
OptimizeForProcessor="2" OptimizeForProcessor="2"

View File

@@ -20,7 +20,6 @@
CharacterSet="2"> CharacterSet="2">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-classic-nt"
Optimization="2" Optimization="2"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
OptimizeForProcessor="2" OptimizeForProcessor="2"
@@ -82,7 +81,6 @@
CharacterSet="2"> CharacterSet="2">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-max"
Optimization="2" Optimization="2"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
OptimizeForProcessor="2" OptimizeForProcessor="2"
@@ -143,7 +141,6 @@
CharacterSet="2"> CharacterSet="2">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-nt-max"
Optimization="2" Optimization="2"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
OptimizeForProcessor="2" OptimizeForProcessor="2"
@@ -207,7 +204,6 @@
CharacterSet="2"> CharacterSet="2">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-nt"
Optimization="2" Optimization="2"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
OptimizeForProcessor="2" OptimizeForProcessor="2"
@@ -271,7 +267,6 @@
CharacterSet="2"> CharacterSet="2">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-pro-nt"
Optimization="2" Optimization="2"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
OptimizeForProcessor="2" OptimizeForProcessor="2"
@@ -393,7 +388,6 @@
CharacterSet="2"> CharacterSet="2">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-pro"
Optimization="2" Optimization="2"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
OptimizeForProcessor="2" OptimizeForProcessor="2"
@@ -455,7 +449,6 @@
CharacterSet="2"> CharacterSet="2">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/D MYSQL_SERVER_SUFFIX=-classic"
Optimization="2" Optimization="2"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
OptimizeForProcessor="2" OptimizeForProcessor="2"

View File

@@ -233,9 +233,9 @@ mysql_cv_compress="yes"
dnl Auxiliary macro to check for zlib at given path dnl Auxiliary macro to check for zlib at given path
AC_DEFUN([MYSQL_CHECK_ZLIB_DIR], [ AC_DEFUN([MYSQL_CHECK_ZLIB_DIR], [
save_INCLUDES="$INCLUDES" save_CPPFLAGS="$CPPFLAGS"
save_LIBS="$LIBS" save_LIBS="$LIBS"
INCLUDES="$INCLUDES $ZLIB_INCLUDES" CPPFLAGS="$ZLIB_INCLUDES $CPPFLAGS"
LIBS="$LIBS $ZLIB_LIBS" LIBS="$LIBS $ZLIB_LIBS"
AC_CACHE_VAL([mysql_cv_compress], AC_CACHE_VAL([mysql_cv_compress],
[AC_TRY_LINK([#include <zlib.h>], [AC_TRY_LINK([#include <zlib.h>],
@@ -244,7 +244,7 @@ AC_CACHE_VAL([mysql_cv_compress],
AC_MSG_RESULT([ok])], AC_MSG_RESULT([ok])],
[mysql_cv_compress="no"]) [mysql_cv_compress="no"])
]) ])
INCLUDES="$save_INCLUDES" CPPFLAGS="$save_CPPFLAGS"
LIBS="$save_LIBS" LIBS="$save_LIBS"
]) ])
@@ -310,8 +310,9 @@ case $SYSTEM_TYPE in
fi fi
;; ;;
*) *)
# Just to be safe, we test for ".so" anyway
if test \( -f "$mysql_zlib_dir/lib/libz.a" -o -f "$mysql_zlib_dir/lib/libz.so" -o \ if test \( -f "$mysql_zlib_dir/lib/libz.a" -o -f "$mysql_zlib_dir/lib/libz.so" -o \
-f "$mysql_zlib_dir/lib/libz.sl" -o -f "$mysql_zlib_dir/lib/libz.dylib" \) \ -f "$mysql_zlib_dir/lib/libz$shrext_cmds" \) \
-a -f "$mysql_zlib_dir/include/zlib.h"; then -a -f "$mysql_zlib_dir/include/zlib.h"; then
ZLIB_INCLUDES="-I$mysql_zlib_dir/include" ZLIB_INCLUDES="-I$mysql_zlib_dir/include"
ZLIB_LIBS="-L$mysql_zlib_dir/lib -lz" ZLIB_LIBS="-L$mysql_zlib_dir/lib -lz"
@@ -976,7 +977,8 @@ AC_DEFUN([MYSQL_FIND_OPENSSL], [
for d in /usr/ssl/lib /usr/local/ssl/lib /usr/lib/openssl \ for d in /usr/ssl/lib /usr/local/ssl/lib /usr/lib/openssl \
/usr/lib /usr/lib64 /opt/ssl/lib /opt/openssl/lib \ /usr/lib /usr/lib64 /opt/ssl/lib /opt/openssl/lib \
/usr/freeware/lib32 /usr/local/lib/ ; do /usr/freeware/lib32 /usr/local/lib/ ; do
if test -f $d/libssl.a || test -f $d/libssl.so || test -f $d/libssl.dylib ; then # Just to be safe, we test for ".so" anyway
if test -f $d/libssl.a || test -f $d/libssl.so || test -f $d/libssl$shrext_cmds ; then
OPENSSL_LIB=$d OPENSSL_LIB=$d
fi fi
done done
@@ -988,7 +990,8 @@ AC_DEFUN([MYSQL_FIND_OPENSSL], [
if test -f $incs/openssl/ssl.h ; then if test -f $incs/openssl/ssl.h ; then
OPENSSL_INCLUDE=-I$incs OPENSSL_INCLUDE=-I$incs
fi fi
if test -f $libs/libssl.a || test -f $libs/libssl.so || test -f $libs/libssl.dylib ; then # Just to be safe, we test for ".so" anyway
if test -f $libs/libssl.a || test -f $libs/libssl.so || test -f $libs/libssl$shrext_cmds ; then
OPENSSL_LIB=$libs OPENSSL_LIB=$libs
fi fi
;; ;;

View File

@@ -190,7 +190,7 @@ static int com_quit(String *str,char*),
com_connect(String *str,char*), com_status(String *str,char*), com_connect(String *str,char*), com_status(String *str,char*),
com_use(String *str,char*), com_source(String *str, char*), com_use(String *str,char*), com_source(String *str, char*),
com_rehash(String *str, char*), com_tee(String *str, char*), com_rehash(String *str, char*), com_tee(String *str, char*),
com_notee(String *str, char*), com_notee(String *str, char*), com_charset(String *str,char*),
com_prompt(String *str, char*), com_delimiter(String *str, char*); com_prompt(String *str, char*), com_delimiter(String *str, char*);
#ifdef USE_POPEN #ifdef USE_POPEN
@@ -263,6 +263,8 @@ static COMMANDS commands[] = {
"Set outfile [to_outfile]. Append everything into given outfile." }, "Set outfile [to_outfile]. Append everything into given outfile." },
{ "use", 'u', com_use, 1, { "use", 'u', com_use, 1,
"Use another database. Takes database name as argument." }, "Use another database. Takes database name as argument." },
{ "charset_name", 'C', com_charset, 1,
"Switch to another charset. Might be needed for processing binlog." },
/* Get bash-like expansion for some commands */ /* Get bash-like expansion for some commands */
{ "create table", 0, 0, 0, ""}, { "create table", 0, 0, 0, ""},
{ "create database", 0, 0, 0, ""}, { "create database", 0, 0, 0, ""},
@@ -1850,6 +1852,28 @@ com_clear(String *buffer,char *line __attribute__((unused)))
return 0; return 0;
} }
/* ARGSUSED */
static int
com_charset(String *buffer __attribute__((unused)), char *line)
{
char buff[256], *param;
CHARSET_INFO * new_cs;
strmake(buff, line, sizeof(buff) - 1);
param= get_arg(buff, 0);
if (!param || !*param)
{
return put_info("Usage: \\C char_setname | charset charset_name",
INFO_ERROR, 0);
}
new_cs= get_charset_by_csname(param, MY_CS_PRIMARY, MYF(MY_WME));
if (new_cs)
{
charset_info= new_cs;
put_info("Charset changed", INFO_INFO);
}
else put_info("Charset is not found", INFO_INFO);
return 0;
}
/* /*
Execute command Execute command

View File

@@ -2557,8 +2557,11 @@ static const char *check_if_ignore_table(const char *table_name)
mysql_free_result(res); mysql_free_result(res);
return 0; /* assume table is ok */ return 0; /* assume table is ok */
} }
if (strcmp(row[1], (result= "MRG_MyISAM")) && /* Some forward-compatibility: don't dump data from a VIEW */
strcmp(row[1], (result= "MRG_ISAM"))) if (!row[1])
result= "VIEW";
else if (strcmp(row[1], (result= "MRG_MyISAM")) &&
strcmp(row[1], (result= "MRG_ISAM")))
result= 0; result= 0;
mysql_free_result(res); mysql_free_result(res);
return result; return result;

View File

@@ -115,8 +115,8 @@ enum {OPT_MANAGER_USER=256,OPT_MANAGER_HOST,OPT_MANAGER_PASSWD,
The list of error codes to --error are stored in an internal array of The list of error codes to --error are stored in an internal array of
structs. This struct can hold numeric SQL error codes or SQLSTATE codes structs. This struct can hold numeric SQL error codes or SQLSTATE codes
as strings. The element next to the last active element in the list is as strings. The element next to the last active element in the list is
set to type ERR_EMPTY. When an SQL statement return an error we use set to type ERR_EMPTY. When an SQL statement returns an error, we use
this list to check if this is an expected error. this list to check if this is an expected error.
*/ */
enum match_err_type enum match_err_type
@@ -320,13 +320,6 @@ const char *command_names[]=
"connection", "connection",
"query", "query",
"connect", "connect",
/* the difference between sleep and real_sleep is that sleep will use
the delay from command line (--sleep) if there is one.
real_sleep always uses delay from mysqltest's command line argument.
the logic is that sometimes delays are cpu-dependent (and --sleep
can be used to set this delay. real_sleep is used for cpu-independent
delays
*/
"sleep", "sleep",
"real_sleep", "real_sleep",
"inc", "inc",
@@ -986,8 +979,8 @@ int do_source(struct st_query *query)
*p++= 0; *p++= 0;
query->last_argument= p; query->last_argument= p;
/* /*
If this file has already been sourced, dont source it again. If this file has already been sourced, don't source it again.
It's already available in the q_lines cache It's already available in the q_lines cache.
*/ */
if (parser.current_line < (parser.read_lines - 1)) if (parser.current_line < (parser.read_lines - 1))
return 0; return 0;
@@ -1536,11 +1529,19 @@ int do_disable_rpl_parse(struct st_query *query __attribute__((unused)))
do_sleep() do_sleep()
q called command q called command
real_sleep use the value from opt_sleep as number of seconds to sleep real_sleep use the value from opt_sleep as number of seconds to sleep
if real_sleep is false
DESCRIPTION DESCRIPTION
sleep <seconds> sleep <seconds>
real_sleep real_sleep <seconds>
The difference between the sleep and real_sleep commands is that sleep
uses the delay from the --sleep command-line option if there is one.
(If the --sleep option is not given, the sleep command uses the delay
specified by its argument.) The real_sleep command always uses the
delay specified by its argument. The logic is that sometimes delays are
cpu-dependent, and --sleep can be used to set this delay. real_sleep is
used for cpu-independent delays.
*/ */
int do_sleep(struct st_query *query, my_bool real_sleep) int do_sleep(struct st_query *query, my_bool real_sleep)
@@ -1553,14 +1554,16 @@ int do_sleep(struct st_query *query, my_bool real_sleep)
while (my_isspace(charset_info, *p)) while (my_isspace(charset_info, *p))
p++; p++;
if (!*p) if (!*p)
die("Missing argument to sleep"); die("Missing argument to %.*s", query->first_word_len, query->query);
sleep_start= p; sleep_start= p;
/* Check that arg starts with a digit, not handled by my_strtod */ /* Check that arg starts with a digit, not handled by my_strtod */
if (!my_isdigit(charset_info, *sleep_start)) if (!my_isdigit(charset_info, *sleep_start))
die("Invalid argument to sleep \"%s\"", query->first_argument); die("Invalid argument to %.*s \"%s\"", query->first_word_len, query->query,
query->first_argument);
sleep_val= my_strtod(sleep_start, &sleep_end, &error); sleep_val= my_strtod(sleep_start, &sleep_end, &error);
if (error) if (error)
die("Invalid argument to sleep \"%s\"", query->first_argument); die("Invalid argument to %.*s \"%s\"", query->first_word_len, query->query,
query->first_argument);
/* Fixed sleep time selected by --sleep option */ /* Fixed sleep time selected by --sleep option */
if (opt_sleep && !real_sleep) if (opt_sleep && !real_sleep)
@@ -2151,7 +2154,7 @@ my_bool end_of_query(int c)
Normally that means it will read lines until it reaches the Normally that means it will read lines until it reaches the
"delimiter" that marks end of query. Default delimiter is ';' "delimiter" that marks end of query. Default delimiter is ';'
The function should be smart enough not to detect delimiter's The function should be smart enough not to detect delimiter's
found inside strings sorrounded with '"' and '\'' escaped strings. found inside strings surrounded with '"' and '\'' escaped strings.
If the first line in a query starts with '#' or '-' this line is treated If the first line in a query starts with '#' or '-' this line is treated
as a comment. A comment is always terminated when end of line '\n' is as a comment. A comment is always terminated when end of line '\n' is
@@ -2485,7 +2488,7 @@ static struct my_option my_long_options[] =
{"result-file", 'R', "Read/Store result from/in this file.", {"result-file", 'R', "Read/Store result from/in this file.",
(gptr*) &result_file, (gptr*) &result_file, 0, GET_STR, REQUIRED_ARG, (gptr*) &result_file, (gptr*) &result_file, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
{"server-arg", 'A', "Send enbedded server this as a paramenter.", {"server-arg", 'A', "Send option value to embedded server as a parameter.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-file", 'F', "Read embedded server arguments from file.", {"server-file", 'F', "Read embedded server arguments from file.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -2966,8 +2969,8 @@ static int run_query_normal(MYSQL* mysql, struct st_query* q, int flags)
warn_res= mysql_store_result(mysql); warn_res= mysql_store_result(mysql);
} }
if (!warn_res) if (!warn_res)
verbose_msg("Warning count is %u but didn't get any warnings\n", die("Warning count is %u but didn't get any warnings\n",
count); count);
else else
{ {
dynstr_append_mem(ds, "Warnings:\n", 10); dynstr_append_mem(ds, "Warnings:\n", 10);
@@ -3446,8 +3449,8 @@ static void run_query_stmt_handle_warnings(MYSQL *mysql, DYNAMIC_STRING *ds)
{ {
MYSQL_RES *warn_res= mysql_store_result(mysql); MYSQL_RES *warn_res= mysql_store_result(mysql);
if (!warn_res) if (!warn_res)
verbose_msg("Warning count is %u but didn't get any warnings\n", die("Warning count is %u but didn't get any warnings\n",
count); count);
else else
{ {
dynstr_append_mem(ds, "Warnings:\n", 10); dynstr_append_mem(ds, "Warnings:\n", 10);
@@ -4074,8 +4077,8 @@ int main(int argc, char **argv)
/* /*
my_stat() successful on result file. Check if we have not run a my_stat() successful on result file. Check if we have not run a
single query, but we do have a result file that contains data. single query, but we do have a result file that contains data.
Note that we don't care, if my_stat() fails. For example for Note that we don't care, if my_stat() fails. For example, for a
non-existing or non-readable file we assume it's fine to have non-existing or non-readable file, we assume it's fine to have
no query output from the test file, e.g. regarded as no error. no query output from the test file, e.g. regarded as no error.
*/ */
if (res_info.st_size) if (res_info.st_size)

View File

@@ -5,7 +5,7 @@ AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line! # The Docs Makefile.am parses this line!
# remember to also change ndb version below and update version.c in ndb # remember to also change ndb version below and update version.c in ndb
AM_INIT_AUTOMAKE(mysql, 4.1.18) AM_INIT_AUTOMAKE(mysql, 4.1.19)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10 PROTOCOL_VERSION=10
@@ -17,7 +17,7 @@ SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
# ndb version # ndb version
NDB_VERSION_MAJOR=4 NDB_VERSION_MAJOR=4
NDB_VERSION_MINOR=1 NDB_VERSION_MINOR=1
NDB_VERSION_BUILD=18 NDB_VERSION_BUILD=19
NDB_VERSION_STATUS="" NDB_VERSION_STATUS=""
# Set all version vars based on $VERSION. How do we do this more elegant ? # Set all version vars based on $VERSION. How do we do this more elegant ?
@@ -435,7 +435,7 @@ fi
# libmysqlclient versioning when linked with GNU ld. # libmysqlclient versioning when linked with GNU ld.
if $LD --version 2>/dev/null|grep -q GNU; then if $LD --version 2>/dev/null|grep -q GNU; then
LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_srcdir)/libmysql/libmysql.ver" LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_builddir)/libmysql/libmysql.ver"
AC_CONFIG_FILES(libmysql/libmysql.ver) AC_CONFIG_FILES(libmysql/libmysql.ver)
fi fi
AC_SUBST(LD_VERSION_SCRIPT) AC_SUBST(LD_VERSION_SCRIPT)

View File

@@ -104,6 +104,7 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
DBUG_RETURN(1); DBUG_RETURN(1);
} }
share->keydef= (HP_KEYDEF*) (share + 1); share->keydef= (HP_KEYDEF*) (share + 1);
share->key_stat_version= 1;
keyseg= (HA_KEYSEG*) (share->keydef + keys); keyseg= (HA_KEYSEG*) (share->keydef + keys);
init_block(&share->block, reclength + 1, min_records, max_records); init_block(&share->block, reclength + 1, min_records, max_records);
/* Fix keys */ /* Fix keys */

View File

@@ -377,8 +377,15 @@ inline double ulonglong2double(ulonglong value)
#define shared_memory_buffer_length 16000 #define shared_memory_buffer_length 16000
#define default_shared_memory_base_name "MYSQL" #define default_shared_memory_base_name "MYSQL"
#ifdef CYBOZU
#define MYSQL_DEFAULT_CHARSET_NAME "utf8"
#define MYSQL_DEFAULT_COLLATION_NAME "utf8_general_cs"
#define HAVE_UTF8_GENERAL_CS 1
#else
#define MYSQL_DEFAULT_CHARSET_NAME "latin1" #define MYSQL_DEFAULT_CHARSET_NAME "latin1"
#define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci" #define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
#enfif
#define HAVE_SPATIAL 1 #define HAVE_SPATIAL 1
#define HAVE_RTREE_KEYS 1 #define HAVE_RTREE_KEYS 1
@@ -386,8 +393,10 @@ inline double ulonglong2double(ulonglong value)
/* Define charsets you want */ /* Define charsets you want */
/* #undef HAVE_CHARSET_armscii8 */ /* #undef HAVE_CHARSET_armscii8 */
/* #undef HAVE_CHARSET_ascii */ /* #undef HAVE_CHARSET_ascii */
#ifndef CYBOZU
#define HAVE_CHARSET_big5 1 #define HAVE_CHARSET_big5 1
#define HAVE_CHARSET_cp1250 1 #define HAVE_CHARSET_cp1250 1
#endif
/* #undef HAVE_CHARSET_cp1251 */ /* #undef HAVE_CHARSET_cp1251 */
/* #undef HAVE_CHARSET_cp1256 */ /* #undef HAVE_CHARSET_cp1256 */
/* #undef HAVE_CHARSET_cp1257 */ /* #undef HAVE_CHARSET_cp1257 */
@@ -396,26 +405,32 @@ inline double ulonglong2double(ulonglong value)
/* #undef HAVE_CHARSET_cp866 */ /* #undef HAVE_CHARSET_cp866 */
#define HAVE_CHARSET_cp932 1 #define HAVE_CHARSET_cp932 1
/* #undef HAVE_CHARSET_dec8 */ /* #undef HAVE_CHARSET_dec8 */
#ifndef CYBOZU
#define HAVE_CHARSET_euckr 1 #define HAVE_CHARSET_euckr 1
#define HAVE_CHARSET_gb2312 1 #define HAVE_CHARSET_gb2312 1
#define HAVE_CHARSET_gbk 1 #define HAVE_CHARSET_gbk 1
#endif
/* #undef HAVE_CHARSET_greek */ /* #undef HAVE_CHARSET_greek */
/* #undef HAVE_CHARSET_hebrew */ /* #undef HAVE_CHARSET_hebrew */
/* #undef HAVE_CHARSET_hp8 */ /* #undef HAVE_CHARSET_hp8 */
/* #undef HAVE_CHARSET_keybcs2 */ /* #undef HAVE_CHARSET_keybcs2 */
/* #undef HAVE_CHARSET_koi8r */ /* #undef HAVE_CHARSET_koi8r */
/* #undef HAVE_CHARSET_koi8u */ /* #undef HAVE_CHARSET_koi8u */
#ifndef CYBOZU
#define HAVE_CHARSET_latin1 1 #define HAVE_CHARSET_latin1 1
#define HAVE_CHARSET_latin2 1 #define HAVE_CHARSET_latin2 1
#endif
/* #undef HAVE_CHARSET_latin5 */ /* #undef HAVE_CHARSET_latin5 */
/* #undef HAVE_CHARSET_latin7 */ /* #undef HAVE_CHARSET_latin7 */
/* #undef HAVE_CHARSET_macce */ /* #undef HAVE_CHARSET_macce */
/* #undef HAVE_CHARSET_macroman */ /* #undef HAVE_CHARSET_macroman */
#define HAVE_CHARSET_sjis 1 #define HAVE_CHARSET_sjis 1
/* #undef HAVE_CHARSET_swe7 */ /* #undef HAVE_CHARSET_swe7 */
#ifndef CYBOZU
#define HAVE_CHARSET_tis620 1 #define HAVE_CHARSET_tis620 1
#define HAVE_CHARSET_ucs2 1 #define HAVE_CHARSET_ucs2 1
#define HAVE_CHARSET_ujis 1 #define HAVE_CHARSET_ujis 1
#endif
#define HAVE_CHARSET_utf8 1 #define HAVE_CHARSET_utf8 1
#define HAVE_UCA_COLLATIONS 1 #define HAVE_UCA_COLLATIONS 1

View File

@@ -136,6 +136,7 @@ typedef struct st_heap_share
HP_KEYDEF *keydef; HP_KEYDEF *keydef;
ulong min_records,max_records; /* Params to open */ ulong min_records,max_records; /* Params to open */
ulong data_length,index_length,max_table_size; ulong data_length,index_length,max_table_size;
uint key_stat_version; /* version to indicate insert/delete */
uint records; /* records */ uint records; /* records */
uint blength; /* records rounded up to 2^n */ uint blength; /* records rounded up to 2^n */
uint deleted; /* Deleted records in database */ uint deleted; /* Deleted records in database */

View File

@@ -44,10 +44,19 @@ typedef struct unicase_info_st
uint16 sort; uint16 sort;
} MY_UNICASE_INFO; } MY_UNICASE_INFO;
#define MY_CS_ILSEQ 0
#define MY_CS_ILUNI 0 /* wm_wc and wc_mb return codes */
#define MY_CS_TOOSMALL -1 #define MY_CS_ILSEQ 0 /* Wrong by sequence: wb_wc */
#define MY_CS_TOOFEW(n) (-1-(n)) #define MY_CS_ILUNI 0 /* Cannot encode Unicode to charset: wc_mb */
#define MY_CS_TOOSMALL -101 /* Need at least one byte: wc_mb and mb_wc */
#define MY_CS_TOOSMALL2 -102 /* Need at least two bytes: wc_mb and mb_wc */
#define MY_CS_TOOSMALL3 -103 /* Need at least three bytes: wc_mb and mb_wc */
/* These following three are currently not really used */
#define MY_CS_TOOSMALL4 -104 /* Need at least 4 bytes: wc_mb and mb_wc */
#define MY_CS_TOOSMALL5 -105 /* Need at least 5 bytes: wc_mb and mb_wc */
#define MY_CS_TOOSMALL6 -106 /* Need at least 6 bytes: wc_mb and mb_wc */
/* A helper macros for "need at least n bytes" */
#define MY_CS_TOOSMALLN(n) (-100-(n))
#define MY_SEQ_INTTAIL 1 #define MY_SEQ_INTTAIL 1
#define MY_SEQ_SPACES 2 #define MY_SEQ_SPACES 2
@@ -342,6 +351,11 @@ int my_wildcmp_8bit(CHARSET_INFO *,
const char *wildstr,const char *wildend, const char *wildstr,const char *wildend,
int escape, int w_one, int w_many); int escape, int w_one, int w_many);
int my_wildcmp_bin(CHARSET_INFO *,
const char *str,const char *str_end,
const char *wildstr,const char *wildend,
int escape, int w_one, int w_many);
uint my_numchars_8bit(CHARSET_INFO *, const char *b, const char *e); uint my_numchars_8bit(CHARSET_INFO *, const char *b, const char *e);
uint my_numcells_8bit(CHARSET_INFO *, const char *b, const char *e); uint my_numcells_8bit(CHARSET_INFO *, const char *b, const char *e);
uint my_charpos_8bit(CHARSET_INFO *, const char *b, const char *e, uint pos); uint my_charpos_8bit(CHARSET_INFO *, const char *b, const char *e, uint pos);

View File

@@ -340,7 +340,7 @@ enum ha_base_keytype {
#define HA_STATE_BUFF_SAVED 512 /* If current keybuff is info->buff */ #define HA_STATE_BUFF_SAVED 512 /* If current keybuff is info->buff */
#define HA_STATE_ROW_CHANGED 1024 /* To invalide ROW cache */ #define HA_STATE_ROW_CHANGED 1024 /* To invalide ROW cache */
#define HA_STATE_EXTEND_BLOCK 2048 #define HA_STATE_EXTEND_BLOCK 2048
#define HA_STATE_RNEXT_SAME 4096 /* rnext_same was called */ #define HA_STATE_RNEXT_SAME 4096 /* rnext_same occupied lastkey2 */
enum en_fieldtype { enum en_fieldtype {
FIELD_LAST=-1,FIELD_NORMAL,FIELD_SKIP_ENDSPACE,FIELD_SKIP_PRESPACE, FIELD_LAST=-1,FIELD_NORMAL,FIELD_SKIP_ENDSPACE,FIELD_SKIP_PRESPACE,

View File

@@ -191,7 +191,7 @@ static
void void
btr_search_info_update_hash( btr_search_info_update_hash(
/*========================*/ /*========================*/
btr_search_t* info, /* in: search info */ btr_search_t* info, /* in/out: search info */
btr_cur_t* cursor) /* in: cursor which was just positioned */ btr_cur_t* cursor) /* in: cursor which was just positioned */
{ {
dict_index_t* index; dict_index_t* index;
@@ -443,7 +443,7 @@ Updates the search info. */
void void
btr_search_info_update_slow( btr_search_info_update_slow(
/*========================*/ /*========================*/
btr_search_t* info, /* in: search info */ btr_search_t* info, /* in/out: search info */
btr_cur_t* cursor) /* in: cursor which was just positioned */ btr_cur_t* cursor) /* in: cursor which was just positioned */
{ {
buf_block_t* block; buf_block_t* block;
@@ -931,7 +931,7 @@ btr_search_drop_page_hash_index(
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED)); ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX)); ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
retry:
rw_lock_s_lock(&btr_search_latch); rw_lock_s_lock(&btr_search_latch);
block = buf_block_align(page); block = buf_block_align(page);
@@ -1007,6 +1007,24 @@ next_rec:
rw_lock_x_lock(&btr_search_latch); rw_lock_x_lock(&btr_search_latch);
if (!block->is_hashed) {
/* Someone else has meanwhile dropped the hash index */
goto cleanup;
}
if (block->curr_n_fields != n_fields
|| block->curr_n_bytes != n_bytes) {
/* Someone else has meanwhile built a new hash index on the
page, with different parameters */
rw_lock_x_unlock(&btr_search_latch);
mem_free(folds);
goto retry;
}
for (i = 0; i < n_cached; i++) { for (i = 0; i < n_cached; i++) {
ha_remove_all_nodes_to_page(table, folds[i], page); ha_remove_all_nodes_to_page(table, folds[i], page);
@@ -1014,7 +1032,22 @@ next_rec:
block->is_hashed = FALSE; block->is_hashed = FALSE;
rw_lock_x_unlock(&btr_search_latch); cleanup:
if (block->n_pointers) {
/* Corruption */
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Corruption of adaptive hash index. After dropping\n"
"InnoDB: the hash index to a page of %lu %lu, still %lu hash nodes remain.\n",
(ulong) ut_dulint_get_high(tree_id),
(ulong) ut_dulint_get_low(tree_id),
(ulong) block->n_pointers);
rw_lock_x_unlock(&btr_search_latch);
btr_search_validate();
} else {
rw_lock_x_unlock(&btr_search_latch);
}
mem_free(folds); mem_free(folds);
} }

View File

@@ -2755,7 +2755,8 @@ dict_table_get_highest_foreign_id(
if (ut_strlen(foreign->id) > ((sizeof dict_ibfk) - 1) + len if (ut_strlen(foreign->id) > ((sizeof dict_ibfk) - 1) + len
&& 0 == ut_memcmp(foreign->id, table->name, len) && 0 == ut_memcmp(foreign->id, table->name, len)
&& 0 == ut_memcmp(foreign->id + len, && 0 == ut_memcmp(foreign->id + len,
dict_ibfk, (sizeof dict_ibfk) - 1)) { dict_ibfk, (sizeof dict_ibfk) - 1)
&& foreign->id[len + ((sizeof dict_ibfk) - 1)] != '0') {
/* It is of the >= 4.0.18 format */ /* It is of the >= 4.0.18 format */
id = strtoul(foreign->id + len + ((sizeof dict_ibfk) - 1), id = strtoul(foreign->id + len + ((sizeof dict_ibfk) - 1),

View File

@@ -179,6 +179,11 @@ struct fil_space_struct {
hash_node_t name_hash;/* hash chain the name_hash table */ hash_node_t name_hash;/* hash chain the name_hash table */
rw_lock_t latch; /* latch protecting the file space storage rw_lock_t latch; /* latch protecting the file space storage
allocation */ allocation */
UT_LIST_NODE_T(fil_space_t) unflushed_spaces;
/* list of spaces with at least one unflushed
file we have written to */
ibool is_in_unflushed_spaces; /* TRUE if this space is
currently in the list above */
UT_LIST_NODE_T(fil_space_t) space_list; UT_LIST_NODE_T(fil_space_t) space_list;
/* list of all spaces */ /* list of all spaces */
ibuf_data_t* ibuf_data; ibuf_data_t* ibuf_data;
@@ -211,6 +216,12 @@ struct fil_system_struct {
not put to this list: they are opened not put to this list: they are opened
after the startup, and kept open until after the startup, and kept open until
shutdown */ shutdown */
UT_LIST_BASE_NODE_T(fil_space_t) unflushed_spaces;
/* base node for the list of those
tablespaces whose files contain
unflushed writes; those spaces have
at least one file node where
modification_counter > flush_counter */
ulint n_open; /* number of files currently open */ ulint n_open; /* number of files currently open */
ulint max_n_open; /* n_open is not allowed to exceed ulint max_n_open; /* n_open is not allowed to exceed
this */ this */
@@ -387,6 +398,36 @@ fil_space_get_ibuf_data(
return(space->ibuf_data); return(space->ibuf_data);
} }
/**************************************************************************
Checks if all the file nodes in a space are flushed. The caller must hold
the fil_system mutex. */
static
ibool
fil_space_is_flushed(
/*=================*/
/* out: TRUE if all are flushed */
fil_space_t* space) /* in: space */
{
fil_node_t* node;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(fil_system->mutex)));
#endif /* UNIV_SYNC_DEBUG */
node = UT_LIST_GET_FIRST(space->chain);
while (node) {
if (node->modification_counter > node->flush_counter) {
return(FALSE);
}
node = UT_LIST_GET_NEXT(chain, node);
}
return(TRUE);
}
/*********************************************************************** /***********************************************************************
Appends a new file to the chain of files of a space. File must be closed. */ Appends a new file to the chain of files of a space. File must be closed. */
@@ -517,7 +558,7 @@ fil_node_open_file(
if (size_bytes < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) { if (size_bytes < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: the size of single-table tablespace file %s\n" "InnoDB: Error: the size of single-table tablespace file %s\n"
"InnoDB: is only %lu %lu, should be at least %lu!", node->name, "InnoDB: is only %lu %lu, should be at least %lu!\n", node->name,
(ulong) size_high, (ulong) size_high,
(ulong) size_low, (ulong) (4 * UNIV_PAGE_SIZE)); (ulong) size_low, (ulong) (4 * UNIV_PAGE_SIZE));
@@ -687,8 +728,8 @@ fil_try_to_close_file_in_LRU(
ut_print_filename(stderr, node->name); ut_print_filename(stderr, node->name);
fprintf(stderr, fprintf(stderr,
", because mod_count %ld != fl_count %ld\n", ", because mod_count %ld != fl_count %ld\n",
(ulong) node->modification_counter, (long) node->modification_counter,
(ulong) node->flush_counter); (long) node->flush_counter);
} }
node = UT_LIST_GET_PREV(LRU, node); node = UT_LIST_GET_PREV(LRU, node);
@@ -839,6 +880,16 @@ fil_node_free(
node->modification_counter = node->flush_counter; node->modification_counter = node->flush_counter;
if (space->is_in_unflushed_spaces
&& fil_space_is_flushed(space)) {
space->is_in_unflushed_spaces = FALSE;
UT_LIST_REMOVE(unflushed_spaces,
system->unflushed_spaces,
space);
}
fil_node_close_file(node, system); fil_node_close_file(node, system);
} }
@@ -1002,6 +1053,8 @@ try_again:
HASH_INSERT(fil_space_t, name_hash, system->name_hash, HASH_INSERT(fil_space_t, name_hash, system->name_hash,
ut_fold_string(name), space); ut_fold_string(name), space);
space->is_in_unflushed_spaces = FALSE;
UT_LIST_ADD_LAST(space_list, system->space_list, space); UT_LIST_ADD_LAST(space_list, system->space_list, space);
mutex_exit(&(system->mutex)); mutex_exit(&(system->mutex));
@@ -1097,6 +1150,13 @@ fil_space_free(
HASH_DELETE(fil_space_t, name_hash, system->name_hash, HASH_DELETE(fil_space_t, name_hash, system->name_hash,
ut_fold_string(space->name), space); ut_fold_string(space->name), space);
if (space->is_in_unflushed_spaces) {
space->is_in_unflushed_spaces = FALSE;
UT_LIST_REMOVE(unflushed_spaces, system->unflushed_spaces,
space);
}
UT_LIST_REMOVE(space_list, system->space_list, space); UT_LIST_REMOVE(space_list, system->space_list, space);
ut_a(space->magic_n == FIL_SPACE_MAGIC_N); ut_a(space->magic_n == FIL_SPACE_MAGIC_N);
@@ -1248,6 +1308,7 @@ fil_system_create(
system->tablespace_version = 0; system->tablespace_version = 0;
UT_LIST_INIT(system->unflushed_spaces);
UT_LIST_INIT(system->space_list); UT_LIST_INIT(system->space_list);
return(system); return(system);
@@ -2612,12 +2673,12 @@ fil_open_single_table_tablespace(
fputs("!\n" fputs("!\n"
"InnoDB: Have you moved InnoDB .ibd files around without using the\n" "InnoDB: Have you moved InnoDB .ibd files around without using the\n"
"InnoDB: commands DISCARD TABLESPACE and IMPORT TABLESPACE?\n" "InnoDB: commands DISCARD TABLESPACE and IMPORT TABLESPACE?\n"
"InnoDB: It is also possible that this is a table created with\n" "InnoDB: It is also possible that this is a temporary table #sql...,\n"
"InnoDB: CREATE TEMPORARY TABLE, and MySQL removed the .ibd file for this.\n" "InnoDB: and MySQL removed the .ibd file for this.\n"
"InnoDB: Please refer to\n" "InnoDB: Please refer to\n"
"InnoDB:" "InnoDB:"
" http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n" " http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n"
"InnoDB: how to resolve the issue.\n", stderr); "InnoDB: for how to resolve the issue.\n", stderr);
mem_free(filepath); mem_free(filepath);
@@ -2657,7 +2718,7 @@ fil_open_single_table_tablespace(
"InnoDB: Please refer to\n" "InnoDB: Please refer to\n"
"InnoDB:" "InnoDB:"
" http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n" " http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n"
"InnoDB: how to resolve the issue.\n", (ulong) space_id, (ulong) id); "InnoDB: for how to resolve the issue.\n", (ulong) space_id, (ulong) id);
ret = FALSE; ret = FALSE;
@@ -3292,7 +3353,7 @@ fil_space_for_table_exists_in_mem(
ut_print_filename(stderr, name); ut_print_filename(stderr, name);
fprintf(stderr, "\n" fprintf(stderr, "\n"
"InnoDB: in InnoDB data dictionary has tablespace id %lu,\n" "InnoDB: in InnoDB data dictionary has tablespace id %lu,\n"
"InnoDB: but tablespace with that id does not exist. There is\n" "InnoDB: but a tablespace with that id does not exist. There is\n"
"InnoDB: a tablespace of name %s and id %lu, though. Have\n" "InnoDB: a tablespace of name %s and id %lu, though. Have\n"
"InnoDB: you deleted or moved .ibd files?\n", "InnoDB: you deleted or moved .ibd files?\n",
(ulong) id, namespace->name, (ulong) id, namespace->name,
@@ -3303,7 +3364,7 @@ fil_space_for_table_exists_in_mem(
"InnoDB: Please refer to\n" "InnoDB: Please refer to\n"
"InnoDB:" "InnoDB:"
" http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n" " http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n"
"InnoDB: how to resolve the issue.\n", stderr); "InnoDB: for how to resolve the issue.\n", stderr);
mem_free(path); mem_free(path);
mutex_exit(&(system->mutex)); mutex_exit(&(system->mutex));
@@ -3317,7 +3378,7 @@ fil_space_for_table_exists_in_mem(
ut_print_filename(stderr, name); ut_print_filename(stderr, name);
fprintf(stderr, "\n" fprintf(stderr, "\n"
"InnoDB: in InnoDB data dictionary has tablespace id %lu,\n" "InnoDB: in InnoDB data dictionary has tablespace id %lu,\n"
"InnoDB: but tablespace with that id has name %s.\n" "InnoDB: but the tablespace with that id has name %s.\n"
"InnoDB: Have you deleted or moved .ibd files?\n", (ulong) id, space->name); "InnoDB: Have you deleted or moved .ibd files?\n", (ulong) id, space->name);
if (namespace != NULL) { if (namespace != NULL) {
@@ -3732,6 +3793,14 @@ fil_node_complete_io(
if (type == OS_FILE_WRITE) { if (type == OS_FILE_WRITE) {
system->modification_counter++; system->modification_counter++;
node->modification_counter = system->modification_counter; node->modification_counter = system->modification_counter;
if (!node->space->is_in_unflushed_spaces) {
node->space->is_in_unflushed_spaces = TRUE;
UT_LIST_ADD_FIRST(unflushed_spaces,
system->unflushed_spaces,
node->space);
}
} }
if (node->n_pending == 0 && node->space->purpose == FIL_TABLESPACE if (node->n_pending == 0 && node->space->purpose == FIL_TABLESPACE
@@ -4145,6 +4214,16 @@ retry:
skip_flush: skip_flush:
if (node->flush_counter < old_mod_counter) { if (node->flush_counter < old_mod_counter) {
node->flush_counter = old_mod_counter; node->flush_counter = old_mod_counter;
if (space->is_in_unflushed_spaces
&& fil_space_is_flushed(space)) {
space->is_in_unflushed_spaces = FALSE;
UT_LIST_REMOVE(unflushed_spaces,
system->unflushed_spaces,
space);
}
} }
if (space->purpose == FIL_TABLESPACE) { if (space->purpose == FIL_TABLESPACE) {
@@ -4176,7 +4255,7 @@ fil_flush_file_spaces(
mutex_enter(&(system->mutex)); mutex_enter(&(system->mutex));
space = UT_LIST_GET_FIRST(system->space_list); space = UT_LIST_GET_FIRST(system->unflushed_spaces);
while (space) { while (space) {
if (space->purpose == purpose && !space->is_being_deleted) { if (space->purpose == purpose && !space->is_being_deleted) {
@@ -4192,7 +4271,7 @@ fil_flush_file_spaces(
space->n_pending_flushes--; space->n_pending_flushes--;
} }
space = UT_LIST_GET_NEXT(space_list, space); space = UT_LIST_GET_NEXT(unflushed_spaces, space);
} }
mutex_exit(&(system->mutex)); mutex_exit(&(system->mutex));

View File

@@ -16,7 +16,7 @@ Updates the search info. */
void void
btr_search_info_update_slow( btr_search_info_update_slow(
/*========================*/ /*========================*/
btr_search_t* info, /* in: search info */ btr_search_t* info, /* in/out: search info */
btr_cur_t* cursor);/* in: cursor which was just positioned */ btr_cur_t* cursor);/* in: cursor which was just positioned */
/************************************************************************ /************************************************************************

View File

@@ -1530,6 +1530,9 @@ int STDCALL mysql_set_character_set(MYSQL *mysql, const char *cs_name)
{ {
char buff[MY_CS_NAME_SIZE + 10]; char buff[MY_CS_NAME_SIZE + 10];
charsets_dir= save_csdir; charsets_dir= save_csdir;
/* Skip execution of "SET NAMES" for pre-4.1 servers */
if (mysql_get_server_version(mysql) < 40100)
return 0;
sprintf(buff, "SET NAMES %s", cs_name); sprintf(buff, "SET NAMES %s", cs_name);
if (!mysql_query(mysql, buff)) if (!mysql_query(mysql, buff))
{ {
@@ -2733,7 +2736,7 @@ my_bool STDCALL mysql_stmt_attr_get(MYSQL_STMT *stmt,
{ {
switch (attr_type) { switch (attr_type) {
case STMT_ATTR_UPDATE_MAX_LENGTH: case STMT_ATTR_UPDATE_MAX_LENGTH:
*(my_bool*) value= stmt->update_max_length; *(unsigned long *) value= stmt->update_max_length;
break; break;
default: default:
return TRUE; return TRUE;
@@ -4628,6 +4631,12 @@ my_bool STDCALL mysql_stmt_reset(MYSQL_STMT *stmt)
/* If statement hasnt been prepared there is nothing to reset */ /* If statement hasnt been prepared there is nothing to reset */
if ((int) stmt->state < (int) MYSQL_STMT_PREPARE_DONE) if ((int) stmt->state < (int) MYSQL_STMT_PREPARE_DONE)
DBUG_RETURN(0); DBUG_RETURN(0);
if (!stmt->mysql)
{
/* mysql can be reset in mysql_close called from mysql_reconnect */
set_stmt_error(stmt, CR_SERVER_LOST, unknown_sqlstate);
DBUG_RETURN(1);
}
mysql= stmt->mysql->last_used_con; mysql= stmt->mysql->last_used_con;
int4store(buff, stmt->stmt_id); /* Send stmt id to server */ int4store(buff, stmt->stmt_id); /* Send stmt id to server */

View File

@@ -82,6 +82,8 @@ int mi_delete(MI_INFO *info,const byte *record)
_mi_make_key(info,i,old_key,record,info->lastpos))) _mi_make_key(info,i,old_key,record,info->lastpos)))
goto err; goto err;
} }
/* The above changed info->lastkey2. Inform mi_rnext_same(). */
info->update&= ~HA_STATE_RNEXT_SAME;
} }
} }

View File

@@ -393,6 +393,10 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
(char*) &blob_ptr,sizeof(char*)); (char*) &blob_ptr,sizeof(char*));
memcpy(blob_ptr,key,length); memcpy(blob_ptr,key,length);
blob_ptr+=length; blob_ptr+=length;
/* The above changed info->lastkey2. Inform mi_rnext_same(). */
info->update&= ~HA_STATE_RNEXT_SAME;
_my_store_blob_length(record+keyseg->start, _my_store_blob_length(record+keyseg->start,
(uint) keyseg->bit_start,length); (uint) keyseg->bit_start,length);
key+=length; key+=length;

View File

@@ -40,7 +40,7 @@ int mi_rnext_same(MI_INFO *info, byte *buf)
if (info->s->concurrent_insert) if (info->s->concurrent_insert)
rw_rdlock(&info->s->key_root_lock[inx]); rw_rdlock(&info->s->key_root_lock[inx]);
switch (keyinfo->key_alg) switch (keyinfo->key_alg)
{ {
#ifdef HAVE_RTREE_KEYS #ifdef HAVE_RTREE_KEYS
@@ -102,4 +102,4 @@ int mi_rnext_same(MI_INFO *info, byte *buf)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
DBUG_RETURN(my_errno); DBUG_RETURN(my_errno);
} /* mi_rnext */ } /* mi_rnext_same */

View File

@@ -1456,7 +1456,7 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
if (!*key++) if (!*key++)
{ {
s_temp->key=key; s_temp->key=key;
s_temp->ref_length=s_temp->key_length=0; s_temp->key_length= 0;
s_temp->totlength=key_length-1+diff_flag; s_temp->totlength=key_length-1+diff_flag;
s_temp->next_key_pos=0; /* No next key */ s_temp->next_key_pos=0; /* No next key */
return (s_temp->totlength); return (s_temp->totlength);
@@ -1611,12 +1611,12 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
s_temp->prev_length= org_key_length; s_temp->prev_length= org_key_length;
s_temp->n_ref_length=s_temp->n_length= org_key_length; s_temp->n_ref_length=s_temp->n_length= org_key_length;
length+= org_key_length; length+= org_key_length;
/* +get_pack_length(org_key_length); */
} }
return (int) length; return (int) length;
} }
ref_length=n_length; ref_length=n_length;
/* Get information about not packed key suffix */
get_key_pack_length(n_length,next_length_pack,next_key); get_key_pack_length(n_length,next_length_pack,next_key);
/* Test if new keys has fewer characters that match the previous key */ /* Test if new keys has fewer characters that match the previous key */
@@ -1625,7 +1625,6 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
s_temp->part_of_prev_key= 0; s_temp->part_of_prev_key= 0;
s_temp->prev_length= ref_length; s_temp->prev_length= ref_length;
s_temp->n_ref_length= s_temp->n_length= n_length+ref_length; s_temp->n_ref_length= s_temp->n_length= n_length+ref_length;
/* s_temp->prev_key+= get_pack_length(org_key_length); */
return (int) length+ref_length-next_length_pack; return (int) length+ref_length-next_length_pack;
} }
if (ref_length+pack_marker > new_ref_length) if (ref_length+pack_marker > new_ref_length)
@@ -1636,9 +1635,7 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
s_temp->prev_length= ref_length - new_pack_length; s_temp->prev_length= ref_length - new_pack_length;
s_temp->n_ref_length=s_temp->n_length=n_length + s_temp->prev_length; s_temp->n_ref_length=s_temp->n_length=n_length + s_temp->prev_length;
s_temp->prev_key+= new_pack_length; s_temp->prev_key+= new_pack_length;
/* +get_pack_length(org_key_length); */ length-= (next_length_pack - get_pack_length(s_temp->n_length));
length= length-get_pack_length(ref_length)+
get_pack_length(new_pack_length);
return (int) length + s_temp->prev_length; return (int) length + s_temp->prev_length;
} }
} }
@@ -1647,7 +1644,7 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
/* Next key wasn't a prefix of previous key */ /* Next key wasn't a prefix of previous key */
ref_length=0; ref_length=0;
next_length_pack=0; next_length_pack=0;
} }
DBUG_PRINT("test",("length: %d next_key: %lx", length, DBUG_PRINT("test",("length: %d next_key: %lx", length,
(long) next_key)); (long) next_key));

View File

@@ -30,6 +30,9 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record,
mi_unique_store(record+key->seg->start, unique_hash); mi_unique_store(record+key->seg->start, unique_hash);
_mi_make_key(info,def->key,key_buff,record,0); _mi_make_key(info,def->key,key_buff,record,0);
/* The above changed info->lastkey2. Inform mi_rnext_same(). */
info->update&= ~HA_STATE_RNEXT_SAME;
if (_mi_search(info,info->s->keyinfo+def->key,key_buff,MI_UNIQUE_HASH_LENGTH, if (_mi_search(info,info->s->keyinfo+def->key,key_buff,MI_UNIQUE_HASH_LENGTH,
SEARCH_FIND,info->s->state.key_root[def->key])) SEARCH_FIND,info->s->state.key_root[def->key]))
{ {

View File

@@ -108,6 +108,10 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
{ {
uint new_length=_mi_make_key(info,i,new_key,newrec,pos); uint new_length=_mi_make_key(info,i,new_key,newrec,pos);
uint old_length=_mi_make_key(info,i,old_key,oldrec,pos); uint old_length=_mi_make_key(info,i,old_key,oldrec,pos);
/* The above changed info->lastkey2. Inform mi_rnext_same(). */
info->update&= ~HA_STATE_RNEXT_SAME;
if (new_length != old_length || if (new_length != old_length ||
memcmp((byte*) old_key,(byte*) new_key,new_length)) memcmp((byte*) old_key,(byte*) new_key,new_length))
{ {

View File

@@ -128,6 +128,10 @@ int mi_write(MI_INFO *info, byte *record)
goto err; goto err;
} }
} }
/* The above changed info->lastkey2. Inform mi_rnext_same(). */
info->update&= ~HA_STATE_RNEXT_SAME;
if (local_lock_tree) if (local_lock_tree)
rw_unlock(&share->key_root_lock[i]); rw_unlock(&share->key_root_lock[i]);
} }

View File

@@ -32,12 +32,14 @@ endif
benchdir_root= $(prefix) benchdir_root= $(prefix)
testdir = $(benchdir_root)/mysql-test testdir = $(benchdir_root)/mysql-test
EXTRA_SCRIPTS = mysql-test-run.sh mysql-test-run.pl install_test_db.sh EXTRA_SCRIPTS = mysql-test-run.sh install_test_db.sh $(PRESCRIPTS)
EXTRA_DIST = $(EXTRA_SCRIPTS) EXTRA_DIST = $(EXTRA_SCRIPTS)
test_SCRIPTS = mysql-test-run install_test_db GENSCRIPTS = mysql-test-run install_test_db
PRESCRIPTS = mysql-test-run.pl
test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS)
test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem \ test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem \
std_data/server-cert.pem std_data/server-key.pem std_data/server-cert.pem std_data/server-key.pem
CLEANFILES = $(test_SCRIPTS) $(test_DATA) CLEANFILES = $(GENSCRIPTS) $(test_DATA)
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I.. INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I..
EXTRA_PROGRAMS = mysql_test_run_new EXTRA_PROGRAMS = mysql_test_run_new

View File

@@ -1,45 +1,51 @@
This directory contains a test suite for mysql daemon. To run This directory contains a test suite for the MySQL daemon. To run
the currently existing test cases, simply execute ./mysql-test-run in the currently existing test cases, simply execute ./mysql-test-run in
this directory. It will fire up the newly built mysqld and test it. this directory. It will fire up the newly built mysqld and test it.
If you want to run a test with a running MySQL server use the --extern Note that you do not have to have to do "make install", and you could
option to mysql-test-run. Please note that in this mode the test suite actually have a co-existing MySQL installation. The tests will not
expects user to specify test names to run. Otherwise it falls back to the
normal "non-extern" behaviour. The reason is that some tests
could not run with external server. Here is the sample command
to test "alias" and "analyze" tests on external server:
mysql-test-run --extern alias analyze
To match your setup you might also need to provide --socket, --user and
other relevant options.
Note that you do not have to have to do make install, and you could
actually have a co-existing MySQL installation - the tests will not
conflict with it. conflict with it.
All tests must pass. If one or more of them fail on your system, please All tests must pass. If one or more of them fail on your system, please
read the following manual section of how to report the problem: read the following manual section for instructions on how to report the
problem:
http://dev.mysql.com/doc/mysql/en/MySQL_test_suite.html http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html
If you want to use an already running MySQL server for specific tests,
use the --extern option to mysql-test-run. Please note that in this mode,
the test suite expects you to provide the names of the tests to run.
For example, here is the command to run the "alias" and "analyze" tests
with an external server:
mysql-test-run --extern alias analyze
To match your setup, you might also need to provide --socket, --user, and
other relevant options.
With no test cases named on the command line, mysql-test-run falls back
to the normal "non-extern" behavior. The reason for this is that some
tests cannot run with an external server.
You can create your own test cases. To create a test case: You can create your own test cases. To create a test case, create a new
file in the t subdirectory using a text editor. The file should have a .test
extension. For example:
xemacs t/test_case_name.test xemacs t/test_case_name.test
in the file, put a set of SQL commands that will create some tables, In the file, put a set of SQL statements that create some tables,
load test data, run some queries to manipulate it. load test data, and run some queries to manipulate it.
We would appreciate if the test tables were called t1, t2, t3 ... (to not We would appreciate it if you name your test tables t1, t2, t3 ... (to not
conflict too much with existing tables). conflict too much with existing tables).
Your test should begin by dropping the tables you are going to create and Your test should begin by dropping the tables you are going to create and
end by dropping them again. This will ensure that one can run the test end by dropping them again. This ensures that you can run the test over
over and over again. and over again.
If you are using mysqltest commands (like result file names) in your If you are using mysqltest commands (like result file names) in your
test case you should do create the result file as follows: test case, you should create the result file as follows:
mysql-test-run --record test_case_name mysql-test-run --record test_case_name
@@ -47,8 +53,8 @@ You can create your own test cases. To create a test case:
mysqltest --record < t/test_case_name.test mysqltest --record < t/test_case_name.test
If you only have a simple test cases consistent of SQL commands and comments If you only have a simple test cases consisting of SQL statements and
you can create the test case one of the following ways: comments, you can create the test case in one of the following ways:
mysql-test-run --record test_case_name mysql-test-run --record test_case_name
@@ -57,11 +63,11 @@ You can create your own test cases. To create a test case:
mysqltest --record --record-file=r/test_case_name.result < t/test_case_name.test mysqltest --record --record-file=r/test_case_name.result < t/test_case_name.test
When this is done, take a look at r/test_case_name.result When this is done, take a look at r/test_case_name.result
- If the result is wrong, you have found a bug; In this case you should - If the result is incorrect, you have found a bug. In this case, you should
edit the test result to the correct results so that we can verify edit the test result to the correct results so that we can verify
that the bug is corrected in future releases. that the bug is corrected in future releases.
To submit your test case, put your .test file and .result file(s) into To submit your test case, put your .test file and .result file(s) into
a tar.gz archive, add a README that explains the problem, ftp the a tar.gz archive, add a README that explains the problem, ftp the
archive to ftp://support.mysql.com/pub/mysql/secret/ and send a mail archive to ftp://support.mysql.com/pub/mysql/secret/ and send a mail
to bugs@lists.mysql.com to bugs@lists.mysql.com

View File

@@ -1,11 +1,13 @@
To be able to see the level of coverage with the current test suite, To be able to see the level of coverage with the current test suite,
do the following: do the following:
- make sure gcov is installed - Make sure gcov is installed
- compile with BUILD/compile-pentium-gcov ( if your machine is not pentium, hack - Compile the MySQL distribution with BUILD/compile-pentium-gcov (if your
this script, or just live with the pentium-specific stuff) machine does not have a pentium CPU, hack this script, or just live with
- ./mysql-test-run -gcov the pentium-specific stuff)
- to see the level of coverage for a given source file: - In the mysql-test directory, run this command: ./mysql-test-run -gcov
- To see the level of coverage for a given source file:
grep source_file_name /tmp/gcov.out grep source_file_name /tmp/gcov.out
- to see which lines are not yet covered, look at source_file_name.gcov in the source tree. Then think hard about a test case that will cover those - To see which lines are not yet covered, look at source_file_name.gcov in
lines, and write one! the source tree. Then think hard about a test case that will cover those
lines, and write one!

View File

@@ -0,0 +1,4 @@
-- require r/have_latin2_ch.require
disable_query_log;
show collation like "latin2_czech_cs";
enable_query_log;

View File

@@ -85,11 +85,24 @@ sub collect_test_cases ($) {
if ( $::opt_reorder ) if ( $::opt_reorder )
{ {
@$cases = sort { @$cases = sort {
if ( $a->{'master_restart'} and $b->{'master_restart'} or if ( ! $a->{'master_restart'} and ! $b->{'master_restart'} )
! $a->{'master_restart'} and ! $b->{'master_restart'} )
{ {
return $a->{'name'} cmp $b->{'name'}; return $a->{'name'} cmp $b->{'name'};
} }
if ( $a->{'master_restart'} and $b->{'master_restart'} )
{
my $cmp= mtr_cmp_opts($a->{'master_opt'}, $b->{'master_opt'});
if ( $cmp == 0 )
{
return $a->{'name'} cmp $b->{'name'};
}
else
{
return $cmp;
}
}
if ( $a->{'master_restart'} ) if ( $a->{'master_restart'} )
{ {
return 1; # Is greater return 1; # Is greater
@@ -189,8 +202,8 @@ sub collect_one_test_case($$$$$$) {
my $slave_sh= "$testdir/$tname-slave.sh"; my $slave_sh= "$testdir/$tname-slave.sh";
my $disabled_file= "$testdir/$tname.disabled"; my $disabled_file= "$testdir/$tname.disabled";
$tinfo->{'master_opt'}= $::glob_win32 ? ["--default-time-zone=+3:00"] : []; $tinfo->{'master_opt'}= [];
$tinfo->{'slave_opt'}= $::glob_win32 ? ["--default-time-zone=+3:00"] : []; $tinfo->{'slave_opt'}= [];
$tinfo->{'slave_mi'}= []; $tinfo->{'slave_mi'}= [];
if ( -f $master_opt_file ) if ( -f $master_opt_file )
@@ -213,7 +226,6 @@ sub collect_one_test_case($$$$$$) {
if ( defined $value ) if ( defined $value )
{ {
$tinfo->{'timezone'}= $value; $tinfo->{'timezone'}= $value;
$tinfo->{'skip'}= 1 if $::glob_win32; # FIXME server unsets TZ
last MASTER_OPT; last MASTER_OPT;
} }

View File

@@ -13,6 +13,9 @@ sub mtr_add_arg ($$);
sub mtr_path_exists(@); sub mtr_path_exists(@);
sub mtr_script_exists(@); sub mtr_script_exists(@);
sub mtr_exe_exists(@); sub mtr_exe_exists(@);
sub mtr_copy_dir($$);
sub mtr_same_opts($$);
sub mtr_cmp_opts($$);
############################################################################## ##############################################################################
# #
@@ -108,5 +111,44 @@ sub mtr_exe_exists (@) {
} }
} }
sub mtr_copy_dir($$) {
my $srcdir= shift;
my $dstdir= shift;
# Create destination directory
mkpath($dstdir);
find(\&mtr_copy_one_file, $dstdir);
}
sub mtr_copy_one_file {
print $File::Find::name, "\n";
}
sub mtr_same_opts ($$) {
my $l1= shift;
my $l2= shift;
return mtr_cmp_opts($l1,$l2) == 0;
}
sub mtr_cmp_opts ($$) {
my $l1= shift;
my $l2= shift;
my @l1= @$l1;
my @l2= @$l2;
return -1 if @l1 < @l2;
return 1 if @l1 > @l2;
while ( @l1 ) # Same length
{
my $e1= shift @l1;
my $e2= shift @l2;
my $cmp= ($e1 cmp $e2);
return $cmp if $cmp != 0;
}
return 0; # They are the same
}
1; 1;

View File

@@ -454,8 +454,7 @@ sub mtr_kill_leftovers () {
if ( kill(0, @pids) ) # Check if some left if ( kill(0, @pids) ) # Check if some left
{ {
# FIXME maybe just mtr_warning() ? mtr_warning("can't kill process(es) " . join(" ", @pids));
mtr_error("can't kill process(es) " . join(" ", @pids));
} }
} }
} }
@@ -468,7 +467,7 @@ sub mtr_kill_leftovers () {
{ {
if ( mtr_ping_mysqld_server($srv->{'port'}, $srv->{'sockfile'}) ) if ( mtr_ping_mysqld_server($srv->{'port'}, $srv->{'sockfile'}) )
{ {
mtr_error("can't kill old mysqld holding port $srv->{'port'}"); mtr_warning("can't kill old mysqld holding port $srv->{'port'}");
} }
} }
} }
@@ -770,7 +769,15 @@ sub mtr_record_dead_children () {
} }
sub start_reap_all { sub start_reap_all {
$SIG{CHLD}= 'IGNORE'; # FIXME is this enough? # This causes terminating processes to not become zombies, avoiding
# the need for (or possibility of) explicit waitpid().
$SIG{CHLD}= 'IGNORE';
# On some platforms (Linux, QNX, OSX, ...) there is potential race
# here. If a process terminated before setting $SIG{CHLD} (but after
# any attempt to waitpid() it), it will still be a zombie. So we
# have to handle any such process here.
while(waitpid(-1, &WNOHANG) > 0) { };
} }
sub stop_reap_all { sub stop_reap_all {

View File

@@ -78,6 +78,12 @@ sub mtr_timer_start($$$) {
{ {
# Child, redirect output and exec # Child, redirect output and exec
# FIXME do we need to redirect streams? # FIXME do we need to redirect streams?
# Don't do the ^C cleanup in the timeout child processes!
# There is actually a race here, if we get ^C after fork(), but before
# clearing the signal handler.
$SIG{INT}= 'DEFAULT';
$0= "mtr_timer(timers,$name,$duration)"; $0= "mtr_timer(timers,$name,$duration)";
sleep($duration); sleep($duration);
exit(0); exit(0);

View File

@@ -76,6 +76,7 @@ $Devel::Trace::TRACE= 0; # Don't trace boring init stuff
#require 5.6.1; #require 5.6.1;
use File::Path; use File::Path;
use File::Basename; use File::Basename;
use File::Copy;
use Cwd; use Cwd;
use Getopt::Long; use Getopt::Long;
use Sys::Hostname; use Sys::Hostname;
@@ -152,6 +153,7 @@ our $path_language;
our $path_timefile; our $path_timefile;
our $path_manager_log; # Used by mysqldadmin our $path_manager_log; # Used by mysqldadmin
our $path_slave_load_tmpdir; # What is this?! our $path_slave_load_tmpdir; # What is this?!
our $path_mysqltest_log;
our $path_my_basedir; our $path_my_basedir;
our $opt_vardir; # A path but set directly on cmd line our $opt_vardir; # A path but set directly on cmd line
our $opt_tmpdir; # A path but set directly on cmd line our $opt_tmpdir; # A path but set directly on cmd line
@@ -184,6 +186,7 @@ our $opt_big_test= 0; # Send --big-test to mysqltest
our @opt_extra_mysqld_opt; our @opt_extra_mysqld_opt;
our $opt_comment;
our $opt_compress; our $opt_compress;
our $opt_current_test; our $opt_current_test;
our $opt_ddd; our $opt_ddd;
@@ -238,7 +241,7 @@ our $opt_sleep_time_after_restart= 1;
our $opt_sleep_time_for_delete= 10; our $opt_sleep_time_for_delete= 10;
our $opt_testcase_timeout; our $opt_testcase_timeout;
our $opt_suite_timeout; our $opt_suite_timeout;
my $default_testcase_timeout= 10; # 10 min max my $default_testcase_timeout= 15; # 15 min max
my $default_suite_timeout= 120; # 2 hours max my $default_suite_timeout= 120; # 2 hours max
our $opt_socket; our $opt_socket;
@@ -257,6 +260,7 @@ our $opt_user;
our $opt_user_test; our $opt_user_test;
our $opt_valgrind; our $opt_valgrind;
our $opt_valgrind_mysqld;
our $opt_valgrind_mysqltest; our $opt_valgrind_mysqltest;
our $opt_valgrind_all; our $opt_valgrind_all;
our $opt_valgrind_options; our $opt_valgrind_options;
@@ -273,6 +277,8 @@ our $opt_udiff;
our $opt_skip_ndbcluster; our $opt_skip_ndbcluster;
our $opt_with_ndbcluster; our $opt_with_ndbcluster;
our $opt_with_ndbcluster_only= 0; # dummy, ignored
our $opt_with_openssl; our $opt_with_openssl;
our $exe_ndb_mgm; our $exe_ndb_mgm;
@@ -428,9 +434,9 @@ sub initial_setup () {
if ( $glob_cygwin_perl ) if ( $glob_cygwin_perl )
{ {
# Windows programs like 'mysqld' needs Windows paths # Windows programs like 'mysqld' needs Windows paths
$glob_mysql_test_dir= `cygpath -m $glob_mysql_test_dir`; $glob_mysql_test_dir= `cygpath -m "$glob_mysql_test_dir"`;
my $shell= $ENV{'SHELL'} || "/bin/bash"; my $shell= $ENV{'SHELL'} || "/bin/bash";
$glob_cygwin_shell= `cygpath -w $shell`; # The Windows path c:\... $glob_cygwin_shell= `cygpath -w "$shell"`; # The Windows path c:\...
chomp($glob_mysql_test_dir); chomp($glob_mysql_test_dir);
chomp($glob_cygwin_shell); chomp($glob_cygwin_shell);
} }
@@ -463,11 +469,33 @@ sub command_line_setup () {
my $opt_slave_myport= 9308; my $opt_slave_myport= 9308;
$opt_ndbcluster_port= 9350; $opt_ndbcluster_port= 9350;
#
# To make it easier for different devs to work on the same host,
# an environment variable can be used to control all ports. A small
# number is to be used, 0 - 16 or similar.
#
# Note the MASTER_MYPORT has to be set the same in all 4.x and 5.x
# versions of this script, else a 4.0 test run might conflict with a
# 5.1 test run, even if different MTR_BUILD_THREAD is used. This means
# all port numbers might not be used in this version of the script.
#
# Also note the limiteation of ports we are allowed to hand out. This
# differs between operating systems and configuration, see
# http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html
# But a fairly safe range seems to be 5001 - 32767
if ( $ENV{'MTR_BUILD_THREAD'} ) if ( $ENV{'MTR_BUILD_THREAD'} )
{ {
$opt_master_myport= $ENV{'MTR_BUILD_THREAD'} * 40 + 8120; # Up to two masters, up to three slaves
$opt_slave_myport= $opt_master_myport + 16; $opt_master_myport= $ENV{'MTR_BUILD_THREAD'} * 10 + 10000; # and 1
$opt_ndbcluster_port= $opt_master_myport + 24; $opt_slave_myport= $opt_master_myport + 2; # and 3 4
$opt_ndbcluster_port= $opt_master_myport + 5;
}
if ( $opt_master_myport < 5001 or $opt_master_myport + 10 >= 32767 )
{
mtr_error("MTR_BUILD_THREAD number results in a port",
"outside 5001 - 32767",
"($opt_master_myport - $opt_master_myport + 10)");
} }
# Read the command line # Read the command line
@@ -486,6 +514,7 @@ sub command_line_setup () {
'force' => \$opt_force, 'force' => \$opt_force,
'with-ndbcluster' => \$opt_with_ndbcluster, 'with-ndbcluster' => \$opt_with_ndbcluster,
'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster, 'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster,
'with-ndbcluster-only' => \$opt_with_ndbcluster_only,
'do-test=s' => \$opt_do_test, 'do-test=s' => \$opt_do_test,
'suite=s' => \$opt_suite, 'suite=s' => \$opt_suite,
'skip-rpl' => \$opt_skip_rpl, 'skip-rpl' => \$opt_skip_rpl,
@@ -526,6 +555,7 @@ sub command_line_setup () {
# Misc # Misc
'big-test' => \$opt_big_test, 'big-test' => \$opt_big_test,
'comment=s' => \$opt_comment,
'compress' => \$opt_compress, 'compress' => \$opt_compress,
'debug' => \$opt_debug, 'debug' => \$opt_debug,
'fast' => \$opt_fast, 'fast' => \$opt_fast,
@@ -561,6 +591,19 @@ sub command_line_setup () {
usage(""); usage("");
} }
if ( $opt_comment )
{
print "\n";
print '#' x 78, "\n";
print "# $opt_comment\n";
print '#' x 78, "\n\n";
}
if ( $opt_with_ndbcluster_only )
{
print "# Option '--with-ndbcluster-only' is ignored in this release.\n";
}
foreach my $arg ( @ARGV ) foreach my $arg ( @ARGV )
{ {
if ( $arg =~ /^--skip-/ ) if ( $arg =~ /^--skip-/ )
@@ -599,6 +642,7 @@ sub command_line_setup () {
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
$opt_tmpdir= "$opt_vardir/tmp" unless $opt_tmpdir; $opt_tmpdir= "$opt_vardir/tmp" unless $opt_tmpdir;
$opt_tmpdir =~ s,/+$,,; # Remove ending slash if any
# FIXME maybe not needed? # FIXME maybe not needed?
$path_manager_log= "$opt_vardir/log/manager.log" $path_manager_log= "$opt_vardir/log/manager.log"
unless $path_manager_log; unless $path_manager_log;
@@ -715,6 +759,7 @@ sub command_line_setup () {
# "somestring" option is name/path of valgrind executable # "somestring" option is name/path of valgrind executable
# Take executable path from any of them, if any # Take executable path from any of them, if any
$opt_valgrind_mysqld= $opt_valgrind;
$opt_valgrind= $opt_valgrind_mysqltest if $opt_valgrind_mysqltest; $opt_valgrind= $opt_valgrind_mysqltest if $opt_valgrind_mysqltest;
$opt_valgrind= $opt_valgrind_all if $opt_valgrind_all; $opt_valgrind= $opt_valgrind_all if $opt_valgrind_all;
@@ -824,6 +869,7 @@ sub command_line_setup () {
} }
$path_timefile= "$opt_vardir/log/mysqltest-time"; $path_timefile= "$opt_vardir/log/mysqltest-time";
$path_mysqltest_log= "$opt_vardir/log/mysqltest.log";
} }
@@ -843,7 +889,8 @@ sub executable_setup () {
"$glob_basedir/bin"); "$glob_basedir/bin");
$exe_mysqld= mtr_exe_exists ("$path_client_bindir/mysqld-nt", $exe_mysqld= mtr_exe_exists ("$path_client_bindir/mysqld-nt",
"$path_client_bindir/mysqld", "$path_client_bindir/mysqld",
"$path_client_bindir/mysqld-debug",); "$path_client_bindir/mysqld-debug",
"$path_client_bindir/mysqld-max");
$path_language= mtr_path_exists("$glob_basedir/share/english/"); $path_language= mtr_path_exists("$glob_basedir/share/english/");
$path_charsetsdir= mtr_path_exists("$glob_basedir/share/charsets"); $path_charsetsdir= mtr_path_exists("$glob_basedir/share/charsets");
} }
@@ -865,7 +912,19 @@ sub executable_setup () {
} }
else else
{ {
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest"); if ( $opt_valgrind_mysqltest )
{
# client/mysqltest might be a libtool .sh script, so look for real exe
# to avoid valgrinding bash ;)
$exe_mysqltest=
mtr_exe_exists("$path_client_bindir/.libs/lt-mysqltest",
"$path_client_bindir/.libs/mysqltest",
"$path_client_bindir/mysqltest");
}
else
{
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
}
$exe_mysql_client_test= $exe_mysql_client_test=
mtr_exe_exists("$glob_basedir/tests/mysql_client_test", mtr_exe_exists("$glob_basedir/tests/mysql_client_test",
"/usr/bin/false"); "/usr/bin/false");
@@ -975,15 +1034,20 @@ sub environment_setup () {
$ENV{'USE_RUNNING_SERVER'}= $glob_use_running_server; $ENV{'USE_RUNNING_SERVER'}= $glob_use_running_server;
$ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir; $ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir;
$ENV{'MYSQL_TEST_WINDIR'}= $glob_mysql_test_dir; $ENV{'MYSQL_TEST_WINDIR'}= $glob_mysql_test_dir;
$ENV{'MASTER_MYSOCK'}= $master->[0]->{'path_mysock'}; $ENV{'MYSQLTEST_VARDIR'}= $opt_vardir;
$ENV{'MASTER_WINMYSOCK'}= $master->[0]->{'path_mysock'}; $ENV{'MASTER_WINMYSOCK'}= $master->[0]->{'path_mysock'};
$ENV{'MASTER_MYSOCK'}= $master->[0]->{'path_mysock'};
$ENV{'MASTER_MYSOCK1'}= $master->[1]->{'path_mysock'}; $ENV{'MASTER_MYSOCK1'}= $master->[1]->{'path_mysock'};
$ENV{'MASTER_MYPORT'}= $master->[0]->{'path_myport'}; $ENV{'MASTER_MYPORT'}= $master->[0]->{'path_myport'};
$ENV{'MASTER_MYPORT1'}= $master->[1]->{'path_myport'}; $ENV{'MASTER_MYPORT1'}= $master->[1]->{'path_myport'};
$ENV{'SLAVE_MYPORT'}= $slave->[0]->{'path_myport'}; $ENV{'SLAVE_MYPORT'}= $slave->[0]->{'path_myport'};
$ENV{'SLAVE_MYPORT1'}= $slave->[1]->{'path_myport'};
$ENV{'SLAVE_MYPORT2'}= $slave->[2]->{'path_myport'};
# $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME # $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME
$ENV{'MYSQL_TCP_PORT'}= 3306; $ENV{'MYSQL_TCP_PORT'}= 3306;
$ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port;
if ( $glob_cygwin_perl ) if ( $glob_cygwin_perl )
{ {
foreach my $key ('MYSQL_TEST_WINDIR','MASTER_MYSOCK') foreach my $key ('MYSQL_TEST_WINDIR','MASTER_MYSOCK')
@@ -994,12 +1058,16 @@ sub environment_setup () {
} }
} }
$ENV{MTR_BUILD_THREAD}= 0 unless $ENV{MTR_BUILD_THREAD}; # Set if not set
# We are nice and report a bit about our settings # We are nice and report a bit about our settings
print "Using MTR_BUILD_THREAD = ",$ENV{MTR_BUILD_THREAD} || 0,"\n"; print "Using MTR_BUILD_THREAD = $ENV{MTR_BUILD_THREAD}\n";
print "Using MASTER_MYPORT = $ENV{MASTER_MYPORT}\n"; print "Using MASTER_MYPORT = $ENV{MASTER_MYPORT}\n";
print "Using MASTER_MYPORT1 = $ENV{MASTER_MYPORT1}\n"; print "Using MASTER_MYPORT1 = $ENV{MASTER_MYPORT1}\n";
print "Using SLAVE_MYPORT = $ENV{SLAVE_MYPORT}\n"; print "Using SLAVE_MYPORT = $ENV{SLAVE_MYPORT}\n";
print "Using NDBCLUSTER_PORT = $opt_ndbcluster_port\n"; print "Using SLAVE_MYPORT1 = $ENV{SLAVE_MYPORT1}\n";
print "Using SLAVE_MYPORT2 = $ENV{SLAVE_MYPORT2}\n";
print "Using NDBCLUSTER_PORT = $ENV{NDBCLUSTER_PORT}\n";
} }
@@ -1061,10 +1129,40 @@ sub kill_and_cleanup () {
mtr_report("Removing Stale Files"); mtr_report("Removing Stale Files");
rmtree("$opt_vardir/log"); if ( $opt_vardir eq "$glob_mysql_test_dir/var" )
rmtree("$opt_vardir/ndbcluster-$opt_ndbcluster_port"); {
rmtree("$opt_vardir/run"); #
rmtree("$opt_vardir/tmp"); # Running with "var" in mysql-test dir
#
if ( -l "$glob_mysql_test_dir/var" )
{
# Some users creates a soft link in mysql-test/var to another area
# - allow it
mtr_report("WARNING: Using the 'mysql-test/var' symlink");
rmtree("$opt_vardir/log");
rmtree("$opt_vardir/ndbcluster-$opt_ndbcluster_port");
rmtree("$opt_vardir/run");
rmtree("$opt_vardir/tmp");
}
else
{
# Remove the entire "var" dir
rmtree("$opt_vardir/");
}
}
else
{
#
# Running with "var" in some other place
#
# Remove the var/ dir in mysql-test dir if any
# this could be an old symlink that shouldn't be there
rmtree("$glob_mysql_test_dir/var");
# Remove the "var" dir
rmtree("$opt_vardir/");
}
mkpath("$opt_vardir/log"); mkpath("$opt_vardir/log");
mkpath("$opt_vardir/run"); mkpath("$opt_vardir/run");
@@ -1088,14 +1186,22 @@ sub kill_and_cleanup () {
mkpath("$data_dir/test"); mkpath("$data_dir/test");
} }
# To make some old test cases work, we create a soft # Make a link std_data_ln in var/ that points to std_data
# link from the old "var" location to the new one if ( ! $glob_win32 )
if ( ! $glob_win32 and $opt_vardir ne "$glob_mysql_test_dir/var" )
{ {
# FIXME why bother with the above, why not always remove all of var?! symlink("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data_ln");
rmtree("$glob_mysql_test_dir/var"); # Clean old var, FIXME or rename it?! }
symlink($opt_vardir, "$glob_mysql_test_dir/var"); else
{
# on windows, copy all files from std_data into var/std_data_ln
mkpath("$opt_vardir/std_data_ln");
opendir(DIR, "$glob_mysql_test_dir/std_data")
or mtr_error("Can't find the std_data directory: $!");
for my $elem ( readdir(DIR) ) {
next if -d "$glob_mysql_test_dir/std_data/$elem";
copy("$glob_mysql_test_dir/std_data/$elem", "$opt_vardir/std_data_ln/$elem");
}
closedir(DIR);
} }
} }
@@ -1454,11 +1560,33 @@ sub run_testcase ($) {
if ( ! $glob_use_running_server and ! $glob_use_embedded_server ) if ( ! $glob_use_running_server and ! $glob_use_embedded_server )
{ {
if ( $tinfo->{'master_restart'} or # We try to find out if we are to restart the server
$master->[0]->{'running_master_is_special'} ) my $do_restart= 0; # Assumes we don't have to
if ( $tinfo->{'master_sh'} )
{
$do_restart= 1; # Always restart if script to run
}
elsif ( $master->[0]->{'running_master_is_special'} and
$master->[0]->{'running_master_is_special'}->{'timezone'} eq
$tinfo->{'timezone'} and
mtr_same_opts($master->[0]->{'running_master_is_special'}->{'master_opt'},
$tinfo->{'master_opt'}) )
{
# If running master was started with special settings, but
# the current test requuires the same ones, we *don't* restart.
$do_restart= 0;
}
elsif ( $tinfo->{'master_restart'} or
$master->[0]->{'running_master_is_special'} )
{
$do_restart= 1;
}
if ( $do_restart )
{ {
stop_masters(); stop_masters();
$master->[0]->{'running_master_is_special'}= 0; # Forget why we stopped delete $master->[0]->{'running_master_is_special'}; # Forget history
} }
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
@@ -1527,6 +1655,7 @@ sub run_testcase ($) {
} }
if ( $opt_with_ndbcluster and ! $master->[1]->{'pid'} ) if ( $opt_with_ndbcluster and ! $master->[1]->{'pid'} )
{ {
# Test needs cluster, start an extra mysqld connected to cluster
$master->[1]->{'pid'}= $master->[1]->{'pid'}=
mysqld_start('master',1,$tinfo->{'master_opt'},[]); mysqld_start('master',1,$tinfo->{'master_opt'},[]);
if ( ! $master->[1]->{'pid'} ) if ( ! $master->[1]->{'pid'} )
@@ -1538,7 +1667,8 @@ sub run_testcase ($) {
if ( $tinfo->{'master_restart'} ) if ( $tinfo->{'master_restart'} )
{ {
$master->[0]->{'running_master_is_special'}= 1; # Save this test case information, so next can examine it
$master->[0]->{'running_master_is_special'}= $tinfo;
} }
} }
@@ -1771,7 +1901,7 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--language=%s", $prefix, $path_language); mtr_add_arg($args, "%s--language=%s", $prefix, $path_language);
mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix); mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
if ( defined $opt_valgrind ) if ( defined $opt_valgrind_mysqld )
{ {
mtr_add_arg($args, "%s--skip-safemalloc", $prefix); mtr_add_arg($args, "%s--skip-safemalloc", $prefix);
mtr_add_arg($args, "%s--skip-bdb", $prefix); mtr_add_arg($args, "%s--skip-bdb", $prefix);
@@ -1838,6 +1968,10 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--skip-innodb", $prefix); mtr_add_arg($args, "%s--skip-innodb", $prefix);
mtr_add_arg($args, "%s--skip-ndbcluster", $prefix); mtr_add_arg($args, "%s--skip-ndbcluster", $prefix);
mtr_add_arg($args, "%s--skip-slave-start", $prefix); mtr_add_arg($args, "%s--skip-slave-start", $prefix);
# Directory where slaves find the dumps generated by "load data"
# on the server. The path need to have constant length otherwise
# test results will vary, thus a relative path is used.
mtr_add_arg($args, "%s--slave-load-tmpdir=%s", $prefix, mtr_add_arg($args, "%s--slave-load-tmpdir=%s", $prefix,
$path_slave_load_tmpdir); $path_slave_load_tmpdir);
mtr_add_arg($args, "%s--socket=%s", $prefix, mtr_add_arg($args, "%s--socket=%s", $prefix,
@@ -1996,7 +2130,7 @@ sub mysqld_start ($$$$) {
mtr_init_args(\$args); mtr_init_args(\$args);
if ( defined $opt_valgrind ) if ( defined $opt_valgrind_mysqld )
{ {
valgrind_arguments($args, \$exe); valgrind_arguments($args, \$exe);
} }
@@ -2182,11 +2316,6 @@ sub run_mysqltest ($) {
mtr_init_args(\$args); mtr_init_args(\$args);
if ( defined $opt_valgrind_mysqltest )
{
valgrind_arguments($args, \$exe);
}
mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_mysock'}); mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_mysock'});
mtr_add_arg($args, "--database=test"); mtr_add_arg($args, "--database=test");
@@ -2264,6 +2393,17 @@ sub run_mysqltest ($) {
# Add arguments that should not go into the MYSQL_TEST env var # Add arguments that should not go into the MYSQL_TEST env var
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
if ( defined $opt_valgrind_mysqltest )
{
# Prefix the Valgrind options to the argument list.
# We do this here, since we do not want to Valgrind the nested invocations
# of mysqltest; that would mess up the stderr output causing test failure.
my @args_saved = @$args;
mtr_init_args(\$args);
valgrind_arguments($args, \$exe);
mtr_add_arg($args, "%s", $_) for @args_saved;
}
mtr_add_arg($args, "-R"); mtr_add_arg($args, "-R");
mtr_add_arg($args, $tinfo->{'result_file'}); mtr_add_arg($args, $tinfo->{'result_file'});
@@ -2382,6 +2522,7 @@ Misc options
verbose Verbose output from this script verbose Verbose output from this script
script-debug Debug this script itself script-debug Debug this script itself
comment=STR Write STR to the output
compress Use the compressed protocol between client and server compress Use the compressed protocol between client and server
timer Show test case execution time timer Show test case execution time
start-and-exit Only initiate and start the "mysqld" servers, use the startup start-and-exit Only initiate and start the "mysqld" servers, use the startup

View File

@@ -215,11 +215,16 @@ MYSQL_MANAGER_USER=root
# an environment variable can be used to control all ports. A small # an environment variable can be used to control all ports. A small
# number is to be used, 0 - 16 or similar. # number is to be used, 0 - 16 or similar.
# #
# Note the MASTER_MYPORT has to be set the same in all 4.x and 5.x
# versions of this script, else a 4.0 test run might conflict with a
# 5.1 test run, even if different MTR_BUILD_THREAD is used. This means
# all port numbers might not be used in this version of the script.
#
if [ -n "$MTR_BUILD_THREAD" ] ; then if [ -n "$MTR_BUILD_THREAD" ] ; then
MASTER_MYPORT=`expr $MTR_BUILD_THREAD '*' 5 + 10000` MASTER_MYPORT=`expr $MTR_BUILD_THREAD '*' 10 + 10000`
MYSQL_MANAGER_PORT=`expr $MASTER_MYPORT + 2` MYSQL_MANAGER_PORT=`expr $MASTER_MYPORT + 2`
SLAVE_MYPORT=`expr $MASTER_MYPORT + 3` SLAVE_MYPORT=`expr $MASTER_MYPORT + 3`
NDBCLUSTER_PORT=`expr $MASTER_MYPORT + 4` NDBCLUSTER_PORT=`expr $MASTER_MYPORT + 6`
echo "Using MTR_BUILD_THREAD = $MTR_BUILD_THREAD" echo "Using MTR_BUILD_THREAD = $MTR_BUILD_THREAD"
echo "Using MASTER_MYPORT = $MASTER_MYPORT" echo "Using MASTER_MYPORT = $MASTER_MYPORT"
@@ -238,6 +243,7 @@ EXTRA_MYSQLDUMP_OPT=""
EXTRA_MYSQLBINLOG_OPT="" EXTRA_MYSQLBINLOG_OPT=""
USE_RUNNING_SERVER="" USE_RUNNING_SERVER=""
USE_NDBCLUSTER=@USE_NDBCLUSTER@ USE_NDBCLUSTER=@USE_NDBCLUSTER@
USE_NDBCLUSTER_ONLY=0
USE_RUNNING_NDBCLUSTER="" USE_RUNNING_NDBCLUSTER=""
USE_PURIFY="" USE_PURIFY=""
PURIFY_LOGS="" PURIFY_LOGS=""
@@ -265,6 +271,8 @@ NDB_MGM_EXTRA_OPTS=
NDB_MGMD_EXTRA_OPTS= NDB_MGMD_EXTRA_OPTS=
NDBD_EXTRA_OPTS= NDBD_EXTRA_OPTS=
$ECHO "Logging: $0 $*" # To ensure we see all arguments in the output, for the test analysis tool
while test $# -gt 0; do while test $# -gt 0; do
case "$1" in case "$1" in
--embedded-server) --embedded-server)
@@ -290,6 +298,10 @@ while test $# -gt 0; do
--extern) USE_RUNNING_SERVER="1" ;; --extern) USE_RUNNING_SERVER="1" ;;
--with-ndbcluster) --with-ndbcluster)
USE_NDBCLUSTER="--ndbcluster" ;; USE_NDBCLUSTER="--ndbcluster" ;;
--with-ndbcluster-only)
USE_NDBCLUSTER="--ndbcluster"
USE_NDBCLUSTER_SLAVE="--ndbcluster"
USE_NDBCLUSTER_ONLY=1 ;;
--ndb-connectstring=*) --ndb-connectstring=*)
USE_NDBCLUSTER="--ndbcluster" ; USE_NDBCLUSTER="--ndbcluster" ;
USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndb-connectstring=;;"` ;; USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndb-connectstring=;;"` ;;
@@ -471,6 +483,13 @@ while test $# -gt 0; do
--fast) --fast)
FAST_START=1 FAST_START=1
;; ;;
--comment=*)
TMP=`$ECHO "$1" | $SED -e "s;--comment=;;"`
echo
echo '############################################'
echo "# $TMP"
echo '############################################'
;;
-- ) shift; break ;; -- ) shift; break ;;
--* ) $ECHO "Unrecognized option: $1"; exit 1 ;; --* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
* ) break ;; * ) break ;;
@@ -784,7 +803,7 @@ show_failed_diff ()
$DIFF -c $result_file $reject_file $DIFF -c $result_file $reject_file
echo "-------------------------------------------------------" echo "-------------------------------------------------------"
echo "Please follow the instructions outlined at" echo "Please follow the instructions outlined at"
echo "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html" echo "http://dev.mysql.com/doc/mysql/en/reporting-mysqltest-bugs.html"
echo "to find the reason to this problem and how to report this." echo "to find the reason to this problem and how to report this."
echo "" echo ""
fi fi
@@ -879,7 +898,7 @@ report_stats () {
$ECHO "The log files in $MY_LOG_DIR may give you some hint" $ECHO "The log files in $MY_LOG_DIR may give you some hint"
$ECHO "of what when wrong." $ECHO "of what when wrong."
$ECHO "If you want to report this error, please read first the documentation at" $ECHO "If you want to report this error, please read first the documentation at"
$ECHO "http://www.mysql.com/doc/en/MySQL_test_suite.html" $ECHO "http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html"
fi fi
if test -z "$USE_RUNNING_SERVER" if test -z "$USE_RUNNING_SERVER"
@@ -1512,6 +1531,11 @@ run_testcase ()
disable_test $tname "$comment" disable_test $tname "$comment"
return return
fi fi
NDBCLUSTER_TEST=`$EXPR \( $tname : '.*ndb.*' \) != 0`
if [ "x$USE_NDBCLUSTER_ONLY" = "x1" -a "x$NDBCLUSTER_TEST" != "x1" ] ; then
skip_test $tname
return
fi
if [ "$USE_MANAGER" = 1 ] ; then if [ "$USE_MANAGER" = 1 ] ; then
many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)` many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)`
fi fi

View File

@@ -267,3 +267,11 @@ Warning 1105 Cast to signed converted positive out-of-range integer to it's nega
select cast(1.0e+300 as signed int); select cast(1.0e+300 as signed int);
cast(1.0e+300 as signed int) cast(1.0e+300 as signed int)
9223372036854775807 9223372036854775807
CREATE TABLE t1 (f1 double);
INSERT INTO t1 SET f1 = -1.0e+30 ;
INSERT INTO t1 SET f1 = +1.0e+30 ;
SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1;
double_val cast_val
-1e+30 -9223372036854775808
1e+30 9223372036854775807
DROP TABLE t1;

View File

@@ -699,3 +699,5 @@ t2 CREATE TABLE `t2` (
`a2` int(11) default NULL `a2` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2; drop table t1, t2;
create table t1(a set("a,b","c,d") not null);
ERROR HY000: Illegal set 'a,b' value found during parsing

View File

@@ -189,3 +189,6 @@ select hex(a) from t1 where a = _big5 0xF9DC;
hex(a) hex(a)
E5ABBA E5ABBA
drop table t1; drop table t1;
select hex(convert(_big5 0xC84041 using ucs2));
hex(convert(_big5 0xC84041 using ucs2))
003F0041

View File

@@ -165,3 +165,6 @@ hex(a)
A1A1 A1A1
A3A0 A3A0
DROP TABLE t1; DROP TABLE t1;
select hex(convert(_gbk 0xA14041 using ucs2));
hex(convert(_gbk 0xA14041 using ucs2))
003F0041

View File

@@ -369,3 +369,25 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT '<27>a' as str; SELECT '<27>a' as str;
str str
<EFBFBD>a <EFBFBD>a
set @str= _latin1 'ABC <20><><EFBFBD>߲<EFBFBD><DFB2>~ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> @ abc';
SELECT convert(@str collate latin1_bin using utf8);
convert(@str collate latin1_bin using utf8)
ABC <20><><EFBFBD>߲<EFBFBD><DFB2>~ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> @ abc
SELECT convert(@str collate latin1_general_ci using utf8);
convert(@str collate latin1_general_ci using utf8)
ABC <20><><EFBFBD>߲<EFBFBD><DFB2>~ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> @ abc
SELECT convert(@str collate latin1_german1_ci using utf8);
convert(@str collate latin1_german1_ci using utf8)
ABC <20><><EFBFBD>߲<EFBFBD><DFB2>~ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> @ abc
SELECT convert(@str collate latin1_danish_ci using utf8);
convert(@str collate latin1_danish_ci using utf8)
ABC <20><><EFBFBD>߲<EFBFBD><DFB2>~ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> @ abc
SELECT convert(@str collate latin1_spanish_ci using utf8);
convert(@str collate latin1_spanish_ci using utf8)
ABC <20><><EFBFBD>߲<EFBFBD><DFB2>~ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> @ abc
SELECT convert(@str collate latin1_german2_ci using utf8);
convert(@str collate latin1_german2_ci using utf8)
ABC <20><><EFBFBD>߲<EFBFBD><DFB2>~ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> @ abc
SELECT convert(@str collate latin1_swedish_ci using utf8);
convert(@str collate latin1_swedish_ci using utf8)
ABC <20><><EFBFBD>߲<EFBFBD><DFB2>~ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> @ abc

View File

@@ -0,0 +1,30 @@
drop table if exists t1;
set names latin2;
select 'A' = 'a' collate latin2_czech_cs;
'A' = 'a' collate latin2_czech_cs
0
create table t1 (
id int(5) not null,
tt char(255) not null
) character set latin2 collate latin2_czech_cs;
insert into t1 values (1,'Aa');
insert into t1 values (2,'Aas');
alter table t1 add primary key aaa(tt);
select * from t1 where tt like 'Aa%';
id tt
1 Aa
2 Aas
select * from t1 ignore index (primary) where tt like 'Aa%';
id tt
1 Aa
2 Aas
select * from t1 where tt like '%Aa%';
id tt
1 Aa
2 Aas
select * from t1 where tt like 'AA%';
id tt
select * from t1 ignore index (primary) where tt like 'AA%';
id tt
select * from t1 where tt like '%AA%';
id tt

View File

@@ -0,0 +1,6 @@
show variables like "%character_set_ser%";
Variable_name Value
character_set_server ucs2
DROP TABLE IF EXISTS t1;
create table t1 (a int);
drop table t1;

View File

@@ -2307,3 +2307,9 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h c2h
ab_def ab_def
drop table t1; drop table t1;
select hex(convert(_ujis 0xA5FE41 using ucs2));
hex(convert(_ujis 0xA5FE41 using ucs2))
003F0041
select hex(convert(_ujis 0x8FABF841 using ucs2));
hex(convert(_ujis 0x8FABF841 using ucs2))
003F0041

View File

@@ -1078,3 +1078,49 @@ LENGTH(bug)
100 100
DROP TABLE t2; DROP TABLE t2;
DROP TABLE t1; DROP TABLE t1;
SET NAMES utf8;
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 't1'
CREATE TABLE t1(a VARCHAR(255), KEY(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
INSERT INTO t1 VALUES('uu');
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
INSERT INTO t1 VALUES('uU');
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
INSERT INTO t1 VALUES('uu');
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
INSERT INTO t1 VALUES('uuABC');
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
INSERT INTO t1 VALUES('UuABC');
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
INSERT INTO t1 VALUES('uuABC');
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
alter table t1 add b int;
INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1);
INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',2);
delete from t1 where b=1;
INSERT INTO t1 VALUES('UUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1);
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3);
INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',4);
delete from t1 where b=3;
INSERT INTO t1 VALUES('uUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3);
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;

View File

@@ -436,3 +436,14 @@ SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE);
a a
testword'' testword''
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a));
INSERT INTO t1 VALUES('test'),('test1'),('test');
PREPARE stmt from "SELECT a, MATCH(a) AGAINST('test1 test') FROM t1 WHERE MATCH(a) AGAINST('test1 test')";
EXECUTE stmt;
a MATCH(a) AGAINST('test1 test')
test1 0.68526661396027
EXECUTE stmt;
a MATCH(a) AGAINST('test1 test')
test1 0.68526661396027
DEALLOCATE PREPARE stmt;
DROP TABLE t1;

View File

@@ -589,3 +589,18 @@ GROUP_CONCAT(a ORDER BY a)
,x ,x
,z ,z
DROP TABLE t1; DROP TABLE t1;
create table t1(f1 int);
insert into t1 values(1),(2),(3);
select f1, group_concat(f1+1) from t1 group by f1 with rollup;
f1 group_concat(f1+1)
1 2
2 3
3 4
NULL 2,3,4
select count(distinct (f1+1)) from t1 group by f1 with rollup;
count(distinct (f1+1))
1
1
1
3
drop table t1;

View File

@@ -35,3 +35,14 @@ select -1 >> 0, -1 << 0;
select -1 >> 1, -1 << 1; select -1 >> 1, -1 << 1;
-1 >> 1 -1 << 1 -1 >> 1 -1 << 1
9223372036854775807 18446744073709551614 9223372036854775807 18446744073709551614
drop table if exists t1,t2;
create table t1(a int);
create table t2(a int, b int);
insert into t1 values (1), (2), (3);
insert into t2 values (1, 7), (3, 7);
select t1.a, t2.a, t2.b, bit_count(t2.b) from t1 left join t2 on t1.a=t2.a;
a a b bit_count(t2.b)
1 1 7 3
2 NULL NULL NULL
3 3 7 3
drop table t1, t2;

View File

@@ -473,3 +473,21 @@ GRANT USAGE ON *.* TO 'mysqltest_7'@'' IDENTIFIED BY PASSWORD '*2FB071A056F9BB74
drop user mysqltest_7@; drop user mysqltest_7@;
show grants for mysqltest_7@; show grants for mysqltest_7@;
ERROR 42000: There is no such grant defined for user 'mysqltest_7' on host '' ERROR 42000: There is no such grant defined for user 'mysqltest_7' on host ''
create database mysqltest;
use mysqltest;
create table t1(f1 int);
GRANT DELETE ON mysqltest.t1 TO mysqltest1@'%';
GRANT SELECT ON mysqltest.t1 TO mysqltest1@'192.%';
show grants for mysqltest1@'192.%';
Grants for mysqltest1@192.%
GRANT USAGE ON *.* TO 'mysqltest1'@'192.%'
GRANT SELECT ON `mysqltest`.`t1` TO 'mysqltest1'@'192.%'
show grants for mysqltest1@'%';
Grants for mysqltest1@%
GRANT USAGE ON *.* TO 'mysqltest1'@'%'
GRANT DELETE ON `mysqltest`.`t1` TO 'mysqltest1'@'%'
delete from mysql.user where user='mysqltest1';
delete from mysql.db where user='mysqltest1';
delete from mysql.tables_priv where user='mysqltest1';
flush privileges;
drop database mysqltest;

View File

@@ -0,0 +1,2 @@
Collation Charset Id Default Compiled Sortlen
latin2_czech_cs latin2 2 Yes 4

View File

@@ -182,7 +182,7 @@ SELECT * FROM t1 WHERE a=NULL;
a b a b
explain SELECT * FROM t1 WHERE a IS NULL; explain SELECT * FROM t1 WHERE a IS NULL;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 5 const 1 Using where 1 SIMPLE t1 ref a a 5 const 2 Using where
SELECT * FROM t1 WHERE a<=>NULL; SELECT * FROM t1 WHERE a<=>NULL;
a b a b
NULL 99 NULL 99
@@ -296,3 +296,13 @@ insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 1 ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 1
drop table t1; drop table t1;
CREATE TABLE t1 (a int, key(a)) engine=heap;
insert into t1 values (0);
delete from t1;
select * from t1;
a
insert into t1 values (0), (1);
select * from t1 where a = 0;
a
0
drop table t1;

View File

@@ -182,7 +182,7 @@ SELECT * FROM t1 WHERE a=NULL;
a b a b
explain SELECT * FROM t1 WHERE a IS NULL; explain SELECT * FROM t1 WHERE a IS NULL;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 5 const 1 Using where 1 SIMPLE t1 ref a a 5 const 2 Using where
SELECT * FROM t1 WHERE a<=>NULL; SELECT * FROM t1 WHERE a<=>NULL;
a b a b
NULL 99 NULL 99
@@ -220,16 +220,16 @@ insert into t1 values ('aaag', 'prefill-hash=3',0);
insert into t1 values ('aaah', 'prefill-hash=6',0); insert into t1 values ('aaah', 'prefill-hash=6',0);
explain select * from t1 where a='aaaa'; explain select * from t1 where a='aaaa';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 8 const 1 Using where 1 SIMPLE t1 ref a a 8 const 2 Using where
explain select * from t1 where a='aaab'; explain select * from t1 where a='aaab';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 8 const 1 Using where 1 SIMPLE t1 ref a a 8 const 2 Using where
explain select * from t1 where a='aaac'; explain select * from t1 where a='aaac';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 8 const 1 Using where 1 SIMPLE t1 ref a a 8 const 2 Using where
explain select * from t1 where a='aaad'; explain select * from t1 where a='aaad';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 8 const 1 Using where 1 SIMPLE t1 ref a a 8 const 2 Using where
insert into t1 select * from t1; insert into t1 select * from t1;
flush tables; flush tables;
explain select * from t1 where a='aaaa'; explain select * from t1 where a='aaaa';
@@ -291,25 +291,25 @@ insert into t1 (name) values ('Matt'), ('Lilu'), ('Corbin'), ('Carly'),
insert into t2 select * from t1; insert into t2 select * from t1;
explain select * from t1 where name='matt'; explain select * from t1 where name='matt';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where 1 SIMPLE t1 ref heap_idx,btree_idx btree_idx 20 const 1 Using where
explain select * from t2 where name='matt'; explain select * from t2 where name='matt';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where 1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where
explain select * from t1 where name='Lilu'; explain select * from t1 where name='Lilu';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where 1 SIMPLE t1 ref heap_idx,btree_idx btree_idx 20 const 1 Using where
explain select * from t2 where name='Lilu'; explain select * from t2 where name='Lilu';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where 1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where
explain select * from t1 where name='Phil'; explain select * from t1 where name='Phil';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where 1 SIMPLE t1 ref heap_idx,btree_idx btree_idx 20 const 1 Using where
explain select * from t2 where name='Phil'; explain select * from t2 where name='Phil';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where 1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where
explain select * from t1 where name='Lilu'; explain select * from t1 where name='Lilu';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where 1 SIMPLE t1 ref heap_idx,btree_idx btree_idx 20 const 1 Using where
explain select * from t2 where name='Lilu'; explain select * from t2 where name='Lilu';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where 1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where
@@ -364,5 +364,5 @@ a
3 3
explain select a from t1 where a in (1,3); explain select a from t1 where a in (1,3);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 2 Using where 1 SIMPLE t1 range a a 5 NULL 4 Using where
drop table t1; drop table t1;

View File

@@ -1794,3 +1794,16 @@ a hex(b)
7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2 7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
update t1 set b = 'three' where a = 6; update t1 set b = 'three' where a = 6;
drop table t1; drop table t1;
CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB;
CREATE TABLE t2(a INT) ENGINE=InnoDB;
ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a);
ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1;
ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a);
ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) default NULL,
KEY `t2_ibfk_0` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t2,t1;

View File

@@ -1,4 +1,4 @@
drop table if exists t1; drop table if exists t1, t2, t3;
create table t1 (kill_id int); create table t1 (kill_id int);
insert into t1 values(connection_id()); insert into t1 values(connection_id());
select ((@id := kill_id) - kill_id) from t1; select ((@id := kill_id) - kill_id) from t1;
@@ -17,3 +17,17 @@ select 4;
4 4
4 4
drop table t1; drop table t1;
kill (select count(*) from mysql.user);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select count(*) from mysql.user)' at line 1
create table t1 (id int primary key);
create table t2 (id int unsigned not null);
insert into t2 select id from t1;
create table t3 (kill_id int);
insert into t3 values(connection_id());
select id from t1 where id in (select distinct id from t2);
select ((@id := kill_id) - kill_id) from t3;
((@id := kill_id) - kill_id)
0
kill @id;
Got one of the listed errors
drop table t1, t2, t3;

View File

@@ -554,7 +554,7 @@ Warnings:
Note 1031 Table storage engine for 't1' doesn't have this option Note 1031 Table storage engine for 't1' doesn't have this option
show keys from t1; show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 a 1 a NULL 1000 NULL NULL YES HASH t1 1 a 1 a NULL 500 NULL NULL YES HASH
drop table t1,t2; drop table t1,t2;
create table t1 ( a tinytext, b char(1), index idx (a(1),b) ); create table t1 ( a tinytext, b char(1), index idx (a(1),b) );
insert into t1 values (null,''), (null,''); insert into t1 values (null,''), (null,'');
@@ -730,3 +730,21 @@ select * from t1 where bob is null and cip=1;
cip time score bob cip time score bob
1 00:01:00 0 NULL 1 00:01:00 0 NULL
drop table t1; drop table t1;
create table t1 (
id1 int not null auto_increment,
id2 int not null default '0',
t text not null,
primary key (id1),
key x (id2, t(32))
) engine=myisam;
insert into t1 (id2, t) values
(10, 'abc'), (10, 'abc'), (10, 'abc'),
(20, 'abc'), (20, 'abc'), (20, 'def'),
(10, 'abc'), (10, 'abc');
select count(*) from t1 where id2 = 10;
count(*)
5
select count(id1) from t1 where id2 = 10;
count(id1)
5
drop table t1;

View File

@@ -84,4 +84,21 @@ SET INSERT_ID=1;
use test; use test;
SET TIMESTAMP=1000000000; SET TIMESTAMP=1000000000;
insert into t1 values ("Alas"); insert into t1 values ("Alas");
drop table t1, t2; flush logs;
create table t3 (f text character set utf8);
create table t4 (f text character set cp932);
flush logs;
rename table t3 to t03, t4 to t04;
select HEX(f) from t03;
HEX(f)
E382BD
select HEX(f) from t3;
HEX(f)
E382BD
select HEX(f) from t04;
HEX(f)
835C
select HEX(f) from t4;
HEX(f)
835C
drop table t1, t2, t03, t04, t3, t4;

View File

@@ -280,7 +280,9 @@ here is the sourced script
In loop In loop
here is the sourced script here is the sourced script
mysqltest: At line 1: Missing argument to sleep mysqltest: At line 1: Missing argument to sleep
mysqltest: At line 1: Missing argument to real_sleep
mysqltest: At line 1: Invalid argument to sleep "abc" mysqltest: At line 1: Invalid argument to sleep "abc"
mysqltest: At line 1: Invalid argument to real_sleep "abc"
1 1
2 2
101 101

View File

@@ -671,3 +671,58 @@ CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;
select * from t1; select * from t1;
b b
drop table t1; drop table t1;
create table t1 (a int) engine=ndb;
create table t2 (a int) engine=ndb;
insert into t1 values (1);
insert into t2 values (1);
delete t1.* from t1, t2 where t1.a = t2.a;
select * from t1;
a
select * from t2;
a
1
drop table t1;
drop table t2;
CREATE TABLE t1 (
i INT,
j INT,
x INT,
y INT,
z INT
) engine=ndb;
CREATE TABLE t2 (
i INT,
k INT,
x INT,
y INT,
z INT
) engine=ndb;
CREATE TABLE t3 (
j INT,
k INT,
x INT,
y INT,
z INT
) engine=ndb;
INSERT INTO t1 VALUES ( 1, 2,13,14,15);
INSERT INTO t2 VALUES ( 1, 3,23,24,25);
INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
UPDATE t1 AS a
INNER JOIN t2 AS b
ON a.i = b.i
INNER JOIN t3 AS c
ON a.j = c.j AND b.k = c.k
SET a.x = b.x,
a.y = b.y,
a.z = (
SELECT sum(z)
FROM t3
WHERE y = 34
)
WHERE b.x = 23;
select * from t1;
i j x y z
1 2 23 24 71
drop table t1;
drop table t2;
drop table t3;

View File

@@ -428,6 +428,13 @@ delete from t1;
select * from t1; select * from t1;
a b a b
commit; commit;
replace t1 set a=2, b='y';
select * from t1;
a b
2 y
delete from t1;
select * from t1;
a b
drop table t1; drop table t1;
set autocommit=0; set autocommit=0;
create table t1 ( create table t1 (

View File

@@ -0,0 +1,80 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=NDB;
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1 ;
ERROR 23000: Can't write; duplicate key in table 't1'
DROP TABLE t1;
CREATE TABLE t1 (word CHAR(20) NOT NULL) ENGINE=NDB;
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1 ;
SELECT * FROM t1 ORDER BY word;
word
Aarhus
Aarhus
Aaron
Aaron
Ababa
Ababa
aback
aback
abaft
abaft
abandon
abandon
abandoned
abandoned
abandoning
abandoning
abandonment
abandonment
abandons
abandons
abase
abased
abasement
abasements
abases
abash
abashed
abashes
abashing
abasing
abate
abated
abatement
abatements
abater
abates
abating
Abba
abbe
abbey
abbeys
abbot
abbots
Abbott
abbreviate
abbreviated
abbreviates
abbreviating
abbreviation
abbreviations
Abby
abdomen
abdomens
abdominal
abduct
abducted
abduction
abductions
abductor
abductors
abducts
Abe
abed
Abel
Abelian
Abelson
Aberdeen
Abernathy
aberrant
aberration
DROP TABLE t1;

View File

@@ -107,6 +107,9 @@ set @fvar= 123.4567;
prepare stmt1 from @fvar; prepare stmt1 from @fvar;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '123.4567' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '123.4567' at line 1
drop table t1,t2; drop table t1,t2;
deallocate prepare stmt3;
deallocate prepare stmt4;
deallocate prepare stmt5;
PREPARE stmt1 FROM "select _utf8 'A' collate utf8_bin = ?"; PREPARE stmt1 FROM "select _utf8 'A' collate utf8_bin = ?";
set @var='A'; set @var='A';
EXECUTE stmt1 USING @var; EXECUTE stmt1 USING @var;
@@ -252,6 +255,7 @@ set names latin1;
execute `<60>`; execute `<60>`;
1234 1234
1234 1234
deallocate prepare `<60>`;
set names default; set names default;
create table t1 (a varchar(10)) charset=utf8; create table t1 (a varchar(10)) charset=utf8;
insert into t1 (a) values ('yahoo'); insert into t1 (a) values ('yahoo');
@@ -733,3 +737,141 @@ count(*)
5 5
deallocate prepare stmt; deallocate prepare stmt;
drop table t1; drop table t1;
prepare stmt from 'create table t1 (a varchar(10) character set utf8)';
execute stmt;
insert into t1 (a) values (repeat('a', 20));
select length(a) from t1;
length(a)
10
drop table t1;
execute stmt;
insert into t1 (a) values (repeat('a', 20));
select length(a) from t1;
length(a)
10
drop table t1;
deallocate prepare stmt;
create table t1 (col1 integer, col2 integer);
insert into t1 values(100,100),(101,101),(102,102),(103,103);
prepare stmt from 'select col1, col2 from t1 where (col1, col2) in ((?,?))';
set @a=100, @b=100;
execute stmt using @a,@b;
col1 col2
100 100
set @a=101, @b=101;
execute stmt using @a,@b;
col1 col2
101 101
set @a=102, @b=102;
execute stmt using @a,@b;
col1 col2
102 102
set @a=102, @b=103;
execute stmt using @a,@b;
col1 col2
deallocate prepare stmt;
drop table t1;
set @old_max_prepared_stmt_count= @@max_prepared_stmt_count;
show variables like 'max_prepared_stmt_count';
Variable_name Value
max_prepared_stmt_count 16382
show variables like 'prepared_stmt_count';
Variable_name Value
prepared_stmt_count 0
select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count @@prepared_stmt_count
16382 0
set global max_prepared_stmt_count=-1;
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
0
set global max_prepared_stmt_count=10000000000000000;
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
1048576
set global max_prepared_stmt_count=default;
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
16382
set @@max_prepared_stmt_count=1;
ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
set max_prepared_stmt_count=1;
ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
set local max_prepared_stmt_count=1;
ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
set local prepared_stmt_count=0;
ERROR HY000: Variable 'prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
set @@prepared_stmt_count=0;
ERROR HY000: Variable 'prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
set global prepared_stmt_count=1;
ERROR 42000: Incorrect argument type to variable 'prepared_stmt_count'
set global max_prepared_stmt_count=1;
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
1
set global max_prepared_stmt_count=0;
select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count @@prepared_stmt_count
0 0
prepare stmt from "select 1";
ERROR HY000: Unknown error
select @@prepared_stmt_count;
@@prepared_stmt_count
0
set global max_prepared_stmt_count=1;
prepare stmt from "select 1";
select @@prepared_stmt_count;
@@prepared_stmt_count
1
prepare stmt1 from "select 1";
ERROR HY000: Unknown error
select @@prepared_stmt_count;
@@prepared_stmt_count
1
deallocate prepare stmt;
select @@prepared_stmt_count;
@@prepared_stmt_count
0
prepare stmt from "select 1";
select @@prepared_stmt_count;
@@prepared_stmt_count
1
prepare stmt from "select 2";
select @@prepared_stmt_count;
@@prepared_stmt_count
1
select @@prepared_stmt_count, @@max_prepared_stmt_count;
@@prepared_stmt_count @@max_prepared_stmt_count
1 1
set global max_prepared_stmt_count=0;
prepare stmt from "select 1";
ERROR HY000: Unknown error
execute stmt;
ERROR HY000: Unknown prepared statement handler (stmt) given to EXECUTE
select @@prepared_stmt_count;
@@prepared_stmt_count
0
prepare stmt from "select 1";
ERROR HY000: Unknown error
select @@prepared_stmt_count;
@@prepared_stmt_count
0
set global max_prepared_stmt_count=3;
select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count @@prepared_stmt_count
3 0
prepare stmt from "select 1";
prepare stmt from "select 2";
prepare stmt1 from "select 3";
prepare stmt2 from "select 4";
ERROR HY000: Unknown error
prepare stmt2 from "select 4";
ERROR HY000: Unknown error
select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count @@prepared_stmt_count
3 3
deallocate prepare stmt;
select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count @@prepared_stmt_count
3 0
set global max_prepared_stmt_count= @old_max_prepared_stmt_count;

View File

@@ -0,0 +1,16 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
**** Test case for BUG#16487 ****
**** Master ****
CREATE TABLE test.t4 (a int);
CREATE TABLE test.t1 (a int);
UPDATE test.t4 NATURAL JOIN test.t1 SET t1.a=5;
**** Slave ****
SELECT * FROM t4;
a
DROP TABLE t1;
DROP TABLE t4;

View File

@@ -0,0 +1,25 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
drop database if exists d1;
drop database if exists d2;
drop database if exists d2;
create database d1;
create table d1.t0 (id int);
create database d2;
use d2;
create table t1 (id int);
create table t2 (id int);
insert into t1 values (1), (2), (3), (4), (5);
insert into t2 select id + 3 from t1;
update t1 join t2 using (id) set t1.id = 0;
insert into d1.t0 values (0);
use d1;
select * from t0 where id=0;
id
0
drop database d1;
drop database d2;

View File

@@ -0,0 +1,22 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create temporary table t1 (n int);
insert into t1 values(1);
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 1
delete from t1;
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 1
truncate t1;
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 1
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0

View File

@@ -1185,6 +1185,16 @@ select concat('value is: ', @val) union select 'some text';
concat('value is: ', @val) concat('value is: ', @val)
value is: 6 value is: 6
some text some text
select concat(_latin1'a', _ascii'b' collate ascii_bin);
concat(_latin1'a', _ascii'b' collate ascii_bin)
ab
create table t1 (foo varchar(100)) collate ascii_bin;
insert into t1 (foo) values ("foo");
select foo from t1 union select 'bar' as foo from dual;
foo
foo
bar
drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
a ENUM('<27>','<27>','<27>') character set utf8 not null default '<27>', a ENUM('<27>','<27>','<27>') character set utf8 not null default '<27>',
b ENUM("one", "two") character set utf8, b ENUM("one", "two") character set utf8,
@@ -1214,7 +1224,7 @@ Field Type Null Key Default Extra
a char(1) a char(1)
drop table t2; drop table t2;
create table t2 select a from t1 union select c from t1; create table t2 select a from t1 union select c from t1;
ERROR HY000: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation 'UNION' drop table t2;
create table t2 select a from t1 union select b from t1; create table t2 select a from t1 union select b from t1;
show columns from t2; show columns from t2;
Field Type Null Key Default Extra Field Type Null Key Default Extra

View File

@@ -358,3 +358,22 @@ update t2,t1 set f1=3,f2=3 where f1=f2 and f1=1;
affected rows: 3 affected rows: 3
info: Rows matched: 3 Changed: 3 Warnings: 0 info: Rows matched: 3 Changed: 3 Warnings: 0
drop table t1,t2; drop table t1,t2;
create table t1 (a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2 (a int, filler1 char(200), filler2 char(200), key(a));
insert into t2 select A.a + 10*B.a, 'filler','filler' from t1 A, t1 B;
flush status;
update t2 set a=3 where a=2;
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
Handler_read_next 1
Handler_read_prev 0
Handler_read_rnd 1
Handler_read_rnd_next 0
drop table t1, t2;
create table t1(f1 int, `*f2` int);
insert into t1 values (1,1);
update t1 set `*f2`=1;
drop table t1;

View File

@@ -152,4 +152,13 @@ select cast(repeat('1',20) as signed);
# #
select cast(1.0e+300 as signed int); select cast(1.0e+300 as signed int);
#
# Bugs: #15098: CAST(column double TO signed int), wrong result
#
CREATE TABLE t1 (f1 double);
INSERT INTO t1 SET f1 = -1.0e+30 ;
INSERT INTO t1 SET f1 = +1.0e+30 ;
SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1;
DROP TABLE t1;
# End of 4.1 tests # End of 4.1 tests

View File

@@ -603,4 +603,10 @@ show create table t2;
drop table t1, t2; drop table t1, t2;
#
# Bug #15316 SET value having comma not correctly handled
#
--error 1105
create table t1(a set("a,b","c,d") not null);
# End of 4.1 tests # End of 4.1 tests

View File

@@ -53,4 +53,14 @@ alter table t1 convert to character set utf8;
select hex(a) from t1 where a = _big5 0xF9DC; select hex(a) from t1 where a = _big5 0xF9DC;
drop table t1; drop table t1;
#
# Bugs#15375: Unassigned multibyte codes are broken
# into parts when converting to Unicode.
# This query should return 0x003F0041. I.e. it should
# scan unassigned double-byte character 0xC840, convert
# it as QUESTION MARK 0x003F and then scan the next
# character, which is a single byte character 0x41.
#
select hex(convert(_big5 0xC84041 using ucs2));
# End of 4.1 tests # End of 4.1 tests

View File

@@ -31,4 +31,14 @@ INSERT INTO t1 VALUES (0xA3A0),(0xA1A1);
SELECT hex(a) FROM t1 ORDER BY a; SELECT hex(a) FROM t1 ORDER BY a;
DROP TABLE t1; DROP TABLE t1;
#
# Bugs#15375: Unassigned multibyte codes are broken
# into parts when converting to Unicode.
# This query should return 0x003F0041. I.e. it should
# scan unassigned double-byte character 0xA140, convert
# it as QUESTION MARK 0x003F and then scan the next
# character, which is a single byte character 0x41.
#
select hex(convert(_gbk 0xA14041 using ucs2));
# End of 4.1 tests # End of 4.1 tests

View File

@@ -95,4 +95,18 @@ SET collation_connection='latin1_bin';
CREATE TABLE <20>a (a int); CREATE TABLE <20>a (a int);
SELECT '<27>a' as str; SELECT '<27>a' as str;
#
# Bug#18321: Can't store EuroSign with latin1_german1_ci and latin1_general_ci
# The problem was in latin1->utf8->latin1 round trip.
#
set @str= _latin1 'ABC <20><><EFBFBD>߲<EFBFBD><DFB2>~ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> @ abc';
SELECT convert(@str collate latin1_bin using utf8);
SELECT convert(@str collate latin1_general_ci using utf8);
SELECT convert(@str collate latin1_german1_ci using utf8);
SELECT convert(@str collate latin1_danish_ci using utf8);
SELECT convert(@str collate latin1_spanish_ci using utf8);
SELECT convert(@str collate latin1_german2_ci using utf8);
SELECT convert(@str collate latin1_swedish_ci using utf8);
# End of 4.1 tests # End of 4.1 tests

View File

@@ -0,0 +1,30 @@
-- source include/have_latin2_ch.inc
#
# Tests with latin2_czech_cs
#
--disable_warnings
drop table if exists t1;
--enable_warnings
#
# Bug#17374: select ... like 'A%' operator fails
# to find value on columuns with key
#
set names latin2;
select 'A' = 'a' collate latin2_czech_cs;
create table t1 (
id int(5) not null,
tt char(255) not null
) character set latin2 collate latin2_czech_cs;
insert into t1 values (1,'Aa');
insert into t1 values (2,'Aas');
alter table t1 add primary key aaa(tt);
select * from t1 where tt like 'Aa%';
select * from t1 ignore index (primary) where tt like 'Aa%';
select * from t1 where tt like '%Aa%';
select * from t1 where tt like 'AA%';
select * from t1 ignore index (primary) where tt like 'AA%';
select * from t1 where tt like '%AA%';
# End of 4.1 tests

View File

@@ -422,7 +422,9 @@ drop table t1;
# #
# Bug #14583 Bug on query using a LIKE on indexed field with ucs2_bin collation # Bug #14583 Bug on query using a LIKE on indexed field with ucs2_bin collation
# #
--disable_warnings
create table t1(f1 varchar(5) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL) engine=InnoDB; create table t1(f1 varchar(5) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL) engine=InnoDB;
--enable_warnings
insert into t1 values('a'); insert into t1 values('a');
create index t1f1 on t1(f1); create index t1f1 on t1(f1);
select f1 from t1 where f1 like 'a%'; select f1 from t1 where f1 like 'a%';

View File

@@ -0,0 +1 @@
--default-character-set=ucs2 --default-collation=ucs2_unicode_ci

View File

@@ -0,0 +1,9 @@
#
# Bug#18004 Connecting crashes server when default charset is UCS2
#
show variables like "%character_set_ser%";
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
create table t1 (a int);
drop table t1;

View File

@@ -1152,4 +1152,19 @@ SET collation_connection='ujis_bin';
-- source include/ctype_innodb_like.inc -- source include/ctype_innodb_like.inc
-- source include/ctype_like_escape.inc -- source include/ctype_like_escape.inc
#
# Bugs#15375: Unassigned multibyte codes are broken
# into parts when converting to Unicode.
# This query should return 0x003F0041. I.e. it should
# scan unassigned double-byte character 0xA5FE, convert
# it as QUESTION MARK 0x003F and then scan the next
# character, which is a single byte character 0x41.
#
select hex(convert(_ujis 0xA5FE41 using ucs2));
# This one should return 0x003F0041:
# scan unassigned three-byte character 0x8FABF8,
# convert it as QUESTION MARK 0x003F and then scan
# the next character, which is a single byte character 0x41.
select hex(convert(_ujis 0x8FABF841 using ucs2));
# End of 4.1 tests # End of 4.1 tests

View File

@@ -892,4 +892,38 @@ SELECT LENGTH(bug) FROM t2;
DROP TABLE t2; DROP TABLE t2;
DROP TABLE t1; DROP TABLE t1;
#
# Bug#17705: Corruption of compressed index when index length changes between
# 254 and 256
#
SET NAMES utf8;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a VARCHAR(255), KEY(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
INSERT INTO t1 VALUES('uu');
check table t1;
INSERT INTO t1 VALUES('uU');
check table t1;
INSERT INTO t1 VALUES('uu');
check table t1;
INSERT INTO t1 VALUES('uuABC');
check table t1;
INSERT INTO t1 VALUES('UuABC');
check table t1;
INSERT INTO t1 VALUES('uuABC');
check table t1;
alter table t1 add b int;
INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1);
INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',2);
delete from t1 where b=1;
INSERT INTO t1 VALUES('UUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1);
check table t1;
INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3);
INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',4);
delete from t1 where b=3;
INSERT INTO t1 VALUES('uUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3);
check table t1;
drop table t1;
# End of 4.1 tests # End of 4.1 tests

View File

@@ -13,4 +13,3 @@
rpl_relayrotate : Unstable test case, bug#12429 rpl_relayrotate : Unstable test case, bug#12429
rpl_until : Unstable test case, bug#12429 rpl_until : Unstable test case, bug#12429
rpl_deadlock : Unstable test case, bug#12429 rpl_deadlock : Unstable test case, bug#12429
kill : Unstable test case, bug#9712

View File

@@ -357,4 +357,16 @@ SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE); SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE);
DROP TABLE t1; DROP TABLE t1;
#
# BUG#14496: Crash or strange results with prepared statement,
# MATCH and FULLTEXT
#
CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a));
INSERT INTO t1 VALUES('test'),('test1'),('test');
PREPARE stmt from "SELECT a, MATCH(a) AGAINST('test1 test') FROM t1 WHERE MATCH(a) AGAINST('test1 test')";
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
# End of 4.1 tests # End of 4.1 tests

View File

@@ -382,4 +382,12 @@ SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY id;
DROP TABLE t1; DROP TABLE t1;
#
# Bug #15560: GROUP_CONCAT wasn't ready for WITH ROLLUP queries
#
create table t1(f1 int);
insert into t1 values(1),(2),(3);
select f1, group_concat(f1+1) from t1 group by f1 with rollup;
select count(distinct (f1+1)) from t1 group by f1 with rollup;
drop table t1;
# End of 4.1 tests # End of 4.1 tests

View File

@@ -17,4 +17,18 @@ select 0 | -1, 0 ^ -1, 0 & -1;
select -1 >> 0, -1 << 0; select -1 >> 0, -1 << 0;
select -1 >> 1, -1 << 1; select -1 >> 1, -1 << 1;
#
# Bug 13044: wrong bit_count() results
#
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
create table t1(a int);
create table t2(a int, b int);
insert into t1 values (1), (2), (3);
insert into t2 values (1, 7), (3, 7);
select t1.a, t2.a, t2.b, bit_count(t2.b) from t1 left join t2 on t1.a=t2.a;
drop table t1, t2;
# End of 4.1 tests # End of 4.1 tests

View File

@@ -433,4 +433,20 @@ drop user mysqltest_7@;
--error 1141 --error 1141
show grants for mysqltest_7@; show grants for mysqltest_7@;
#
# Bug#14385: GRANT and mapping to correct user account problems
#
create database mysqltest;
use mysqltest;
create table t1(f1 int);
GRANT DELETE ON mysqltest.t1 TO mysqltest1@'%';
GRANT SELECT ON mysqltest.t1 TO mysqltest1@'192.%';
show grants for mysqltest1@'192.%';
show grants for mysqltest1@'%';
delete from mysql.user where user='mysqltest1';
delete from mysql.db where user='mysqltest1';
delete from mysql.tables_priv where user='mysqltest1';
flush privileges;
drop database mysqltest;
# End of 4.1 tests # End of 4.1 tests

View File

@@ -234,4 +234,15 @@ insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
drop table t1; drop table t1;
#
# Bug 12796: Record doesn't show when selecting through index
#
CREATE TABLE t1 (a int, key(a)) engine=heap;
insert into t1 values (0);
delete from t1;
select * from t1;
insert into t1 values (0), (1);
select * from t1 where a = 0;
drop table t1;
# End of 4.1 tests # End of 4.1 tests

View File

@@ -1365,4 +1365,17 @@ insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
select a,hex(b) from t1 order by b; select a,hex(b) from t1 order by b;
update t1 set b = 'three' where a = 6; update t1 set b = 'three' where a = 6;
drop table t1; drop table t1;
# Ensure that <tablename>_ibfk_0 is not mistreated as a
# generated foreign key identifier. (Bug #16387)
CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB;
CREATE TABLE t2(a INT) ENGINE=InnoDB;
ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a);
ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1;
ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a);
ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0;
SHOW CREATE TABLE t2;
DROP TABLE t2,t1;
# End of 4.1 tests # End of 4.1 tests

View File

@@ -12,7 +12,7 @@ connect (con2, localhost, root,,);
#remember id of con1 #remember id of con1
connection con1; connection con1;
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1, t2, t3;
--enable_warnings --enable_warnings
create table t1 (kill_id int); create table t1 (kill_id int);
@@ -39,5 +39,55 @@ select @id != connection_id();
connection con2; connection con2;
select 4; select 4;
drop table t1; drop table t1;
connection default;
disconnect con2;
--error 1064
kill (select count(*) from mysql.user);
#
# BUG#14851: killing long running subquery processed via a temporary table.
#
create table t1 (id int primary key);
create table t2 (id int unsigned not null);
connect (conn1, localhost, root,,);
connection conn1;
-- disable_result_log
-- disable_query_log
let $1 = 4096;
while ($1)
{
eval insert into t1 values ($1);
dec $1;
}
-- enable_query_log
-- enable_result_log
insert into t2 select id from t1;
create table t3 (kill_id int);
insert into t3 values(connection_id());
-- disable_result_log
send select id from t1 where id in (select distinct id from t2);
-- enable_result_log
connect (conn2, localhost, root,,);
connection conn2;
select ((@id := kill_id) - kill_id) from t3;
-- sleep 1
kill @id;
connection conn1;
-- error 1053,2013
reap;
disconnect conn1;
disconnect conn2;
connection default;
drop table t1, t2, t3;
# End of 4.1 tests # End of 4.1 tests

View File

@@ -686,4 +686,23 @@ select * from t1 where bob is null and cip=1;
create index bug on t1 (bob(22), cip, time); create index bug on t1 (bob(22), cip, time);
select * from t1 where bob is null and cip=1; select * from t1 where bob is null and cip=1;
drop table t1; drop table t1;
#
# Bug#14980 - COUNT(*) incorrect on MyISAM table with certain INDEX
#
create table t1 (
id1 int not null auto_increment,
id2 int not null default '0',
t text not null,
primary key (id1),
key x (id2, t(32))
) engine=myisam;
insert into t1 (id2, t) values
(10, 'abc'), (10, 'abc'), (10, 'abc'),
(20, 'abc'), (20, 'abc'), (20, 'def'),
(10, 'abc'), (10, 'abc');
select count(*) from t1 where id2 = 10;
select count(id1) from t1 where id2 = 10;
drop table t1;
# End of 4.1 tests # End of 4.1 tests

View File

@@ -98,7 +98,24 @@ select "--- --position --" as "";
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --position=27 --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 --position=27 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
# Bug#16217 (mysql client did not know how not switch its internal charset)
flush logs;
create table t3 (f text character set utf8);
create table t4 (f text character set cp932);
--exec $MYSQL --default-character-set=utf8 test -e "insert into t3 values(_utf8'ソ')"
--exec $MYSQL --default-character-set=cp932 test -e "insert into t4 values(_cp932'<27>\');"
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
# original and recovered data must be equal
select HEX(f) from t03;
select HEX(f) from t3;
select HEX(f) from t04;
select HEX(f) from t4;
# clean up # clean up
drop table t1, t2; drop table t1, t2, t03, t04, t3, t4;
# End of 4.1 tests # End of 4.1 tests

View File

@@ -605,10 +605,14 @@ real_sleep 1;
# Missing parameter # Missing parameter
--error 1 --error 1
--exec echo "sleep ;" | $MYSQL_TEST 2>&1 --exec echo "sleep ;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "real_sleep ;" | $MYSQL_TEST 2>&1
# Illegal parameter # Illegal parameter
--error 1 --error 1
--exec echo "sleep abc;" | $MYSQL_TEST 2>&1 --exec echo "sleep abc;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "real_sleep abc;" | $MYSQL_TEST 2>&1
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Test inc # Test inc

View File

@@ -614,4 +614,70 @@ CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;
select * from t1; select * from t1;
drop table t1; drop table t1;
#
# Bug #17249 delete statement with join where clause fails
# when table do not have pk
#
create table t1 (a int) engine=ndb;
create table t2 (a int) engine=ndb;
insert into t1 values (1);
insert into t2 values (1);
delete t1.* from t1, t2 where t1.a = t2.a;
select * from t1;
select * from t2;
drop table t1;
drop table t2;
#
# Bug #17257 update fails for inner joins if tables
# do not have Primary Key
#
CREATE TABLE t1 (
i INT,
j INT,
x INT,
y INT,
z INT
) engine=ndb;
CREATE TABLE t2 (
i INT,
k INT,
x INT,
y INT,
z INT
) engine=ndb;
CREATE TABLE t3 (
j INT,
k INT,
x INT,
y INT,
z INT
) engine=ndb;
INSERT INTO t1 VALUES ( 1, 2,13,14,15);
INSERT INTO t2 VALUES ( 1, 3,23,24,25);
INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
UPDATE t1 AS a
INNER JOIN t2 AS b
ON a.i = b.i
INNER JOIN t3 AS c
ON a.j = c.j AND b.k = c.k
SET a.x = b.x,
a.y = b.y,
a.z = (
SELECT sum(z)
FROM t3
WHERE y = 34
)
WHERE b.x = 23;
select * from t1;
drop table t1;
drop table t2;
drop table t3;
# End of 4.1 tests # End of 4.1 tests

View File

@@ -338,7 +338,7 @@ select * from t1 order by a;
drop table t1; drop table t1;
drop database test2; drop database test2;
# -- bug-5252 tinytext crashes plus no-commit result -- # -- bug-5252 tinytext crashes + no-commit result + replace --
set autocommit=0; set autocommit=0;
create table t1 ( create table t1 (
@@ -352,6 +352,10 @@ select * from t1;
delete from t1; delete from t1;
select * from t1; select * from t1;
commit; commit;
replace t1 set a=2, b='y';
select * from t1;
delete from t1;
select * from t1;
drop table t1; drop table t1;
# -- bug-5013 insert empty string to text -- # -- bug-5013 insert empty string to text --

View File

@@ -0,0 +1,24 @@
-- source include/have_ndb.inc
-- source include/not_embedded.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
#
# Basic test for different types of loading data
#
# should give duplicate key
CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=NDB;
--error 1022
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1 ;
DROP TABLE t1;
# now without a primary key we should be ok
CREATE TABLE t1 (word CHAR(20) NOT NULL) ENGINE=NDB;
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1 ;
SELECT * FROM t1 ORDER BY word;
DROP TABLE t1;
# End of 4.1 tests

View File

@@ -111,6 +111,9 @@ set @fvar= 123.4567;
prepare stmt1 from @fvar; prepare stmt1 from @fvar;
drop table t1,t2; drop table t1,t2;
deallocate prepare stmt3;
deallocate prepare stmt4;
deallocate prepare stmt5;
# #
# Bug #4105: Server crash on attempt to prepare a statement with character # Bug #4105: Server crash on attempt to prepare a statement with character
@@ -254,6 +257,7 @@ prepare `ü` from 'select 1234';
execute `ü` ; execute `ü` ;
set names latin1; set names latin1;
execute `<60>`; execute `<60>`;
deallocate prepare `<60>`;
set names default; set names default;
@@ -763,5 +767,163 @@ execute stmt using @like;
deallocate prepare stmt; deallocate prepare stmt;
drop table t1; drop table t1;
# End of 4.1 tests
#
# Bug#13134 "Length of VARCHAR() utf8 column is increasing when table is
# recreated with PS/SP"
#
prepare stmt from 'create table t1 (a varchar(10) character set utf8)';
execute stmt;
--disable_warnings
insert into t1 (a) values (repeat('a', 20));
--enable_warnings
select length(a) from t1;
drop table t1;
execute stmt;
--disable_warnings
insert into t1 (a) values (repeat('a', 20));
--enable_warnings
# Check that the data is truncated to the same length
select length(a) from t1;
drop table t1;
deallocate prepare stmt;
#
# Bug#16248 "WHERE (col1,col2) IN ((?,?)) gives wrong results":
# check that ROW implementation is reexecution-friendly.
#
create table t1 (col1 integer, col2 integer);
insert into t1 values(100,100),(101,101),(102,102),(103,103);
prepare stmt from 'select col1, col2 from t1 where (col1, col2) in ((?,?))';
set @a=100, @b=100;
execute stmt using @a,@b;
set @a=101, @b=101;
execute stmt using @a,@b;
set @a=102, @b=102;
execute stmt using @a,@b;
set @a=102, @b=103;
execute stmt using @a,@b;
deallocate prepare stmt;
drop table t1;
#
# Bug#16365 Prepared Statements: DoS with too many open statements
# Check that the limit @@max_prpeared_stmt_count works.
#
# Save the old value
set @old_max_prepared_stmt_count= @@max_prepared_stmt_count;
#
# Disable prepared statement protocol: in this test we set
# @@max_prepared_stmt_count to 0 or 1 and would like to test the limit
# manually.
#
--disable_ps_protocol
#
# A. Check that the new variables are present in SHOW VARIABLES list.
#
show variables like 'max_prepared_stmt_count';
show variables like 'prepared_stmt_count';
#
# B. Check that the new variables are selectable.
#
select @@max_prepared_stmt_count, @@prepared_stmt_count;
#
# C. Check that max_prepared_stmt_count is settable (global only),
# whereas prepared_stmt_count is readonly.
#
set global max_prepared_stmt_count=-1;
select @@max_prepared_stmt_count;
set global max_prepared_stmt_count=10000000000000000;
select @@max_prepared_stmt_count;
set global max_prepared_stmt_count=default;
select @@max_prepared_stmt_count;
--error 1229 # ER_GLOBAL_VARIABLE
set @@max_prepared_stmt_count=1;
--error 1229 # ER_GLOBAL_VARIABLE
set max_prepared_stmt_count=1;
--error 1229 # ER_GLOBAL_VARIABLE
set local max_prepared_stmt_count=1;
--error 1229 # ER_GLOBAL_VARIABLE
set local prepared_stmt_count=0;
--error 1229 # ER_GLOBAL_VARIABLE
set @@prepared_stmt_count=0;
--error 1232 # ER_WRONG_TYPE_FOR_VAR
set global prepared_stmt_count=1;
# set to a reasonable limit works
set global max_prepared_stmt_count=1;
select @@max_prepared_stmt_count;
#
# D. Check that the variables actually work.
#
set global max_prepared_stmt_count=0;
select @@max_prepared_stmt_count, @@prepared_stmt_count;
--error 1105 # ER_UNKNOWN_ERROR
prepare stmt from "select 1";
select @@prepared_stmt_count;
set global max_prepared_stmt_count=1;
prepare stmt from "select 1";
select @@prepared_stmt_count;
--error 1105 # ER_UNKNOWN_ERROR
prepare stmt1 from "select 1";
select @@prepared_stmt_count;
deallocate prepare stmt;
select @@prepared_stmt_count;
#
# E. Check that we can prepare a statement with the same name
# successfully, without hitting the limit.
#
prepare stmt from "select 1";
select @@prepared_stmt_count;
prepare stmt from "select 2";
select @@prepared_stmt_count;
#
# F. We can set the max below the current count. In this case no new
# statements should be allowed to prepare.
#
select @@prepared_stmt_count, @@max_prepared_stmt_count;
set global max_prepared_stmt_count=0;
--error 1105 # ER_UNKNOWN_ERROR
prepare stmt from "select 1";
# Result: the old statement is deallocated, the new is not created.
--error 1243 # ER_UNKNOWN_STMT_HANDLER
execute stmt;
select @@prepared_stmt_count;
--error 1105 # ER_UNKNOWN_ERROR
prepare stmt from "select 1";
select @@prepared_stmt_count;
#
# G. Show that the variables are up to date even after a connection with all
# statements in it was terminated.
#
set global max_prepared_stmt_count=3;
select @@max_prepared_stmt_count, @@prepared_stmt_count;
prepare stmt from "select 1";
connect (con1,localhost,root,,);
connection con1;
prepare stmt from "select 2";
prepare stmt1 from "select 3";
--error 1105 # ER_UNKNOWN_ERROR
prepare stmt2 from "select 4";
connection default;
--error 1105 # ER_UNKNOWN_ERROR
prepare stmt2 from "select 4";
select @@max_prepared_stmt_count, @@prepared_stmt_count;
disconnect con1;
connection default;
# Wait for the connection to die: deal with a possible race
deallocate prepare stmt;
let $count= `select @@prepared_stmt_count`;
if ($count)
{
--sleep 2
let $count= `select @@prepared_stmt_count`;
}
select @@max_prepared_stmt_count, @@prepared_stmt_count;
#
# Restore the old value.
#
set global max_prepared_stmt_count= @old_max_prepared_stmt_count;
--enable_ps_protocol
# End of 4.1 tests

View File

@@ -0,0 +1 @@
--replicate-ignore-table=test.t1 --replicate-ignore-table=test.t2 --replicate-ignore-table=test.t3

View File

@@ -0,0 +1,28 @@
source include/master-slave.inc;
#
# BUG#16487
#
# Requirement:
# Multi-updates on ignored tables should not fail even if the slave does
# not have the ignored tables.
#
# Note table t1, t2, and t3 are ignored in the option file to this test.
#
--echo **** Test case for BUG#16487 ****
--echo **** Master ****
connection master;
CREATE TABLE test.t4 (a int);
CREATE TABLE test.t1 (a int);
# Expect: The row must *not* by updated on slave, since t1 is ignored
UPDATE test.t4 NATURAL JOIN test.t1 SET t1.a=5;
--echo **** Slave ****
sync_slave_with_master;
SELECT * FROM t4;
connection master;
DROP TABLE t1;
DROP TABLE t4;

View File

@@ -0,0 +1 @@
--replicate-wild-do-table=d1.%

View File

@@ -0,0 +1,44 @@
# Let's verify that multi-update is not always skipped by slave if
# some replicate-* rules exist.
# (BUG#15699)
source include/master-slave.inc;
### Clean-up
connection master;
--disable_warnings
drop database if exists d1;
drop database if exists d2;
connection slave;
drop database if exists d2;
--enable_warnings
### Test
connection master;
create database d1; # accepted by slave
create table d1.t0 (id int);
create database d2; # ignored by slave
use d2;
create table t1 (id int);
create table t2 (id int);
insert into t1 values (1), (2), (3), (4), (5);
insert into t2 select id + 3 from t1;
# a problematic query which must be filter out by slave
update t1 join t2 using (id) set t1.id = 0;
insert into d1.t0 values (0); # replication works
sync_slave_with_master;
use d1;
#connection slave;
select * from t0 where id=0; # must find
### Clean-up
connection master;
drop database d1;
drop database d2;
# End of test

Some files were not shown because too many files have changed in this diff Show More