diff options
1466 files changed, 34118 insertions, 18786 deletions
diff --git a/.bzrignore b/.bzrignore index a7166d4551f..d4bbf9a4ebf 100644 --- a/.bzrignore +++ b/.bzrignore @@ -748,6 +748,7 @@ mysql-test/.DS_Store mysql-test/funcs_1.log mysql-test/funcs_1.tar mysql-test/install_test_db +mysql-test/lib/My/SafeProcess/my_safe_process mysql-test/lib/init_db.sql mysql-test/linux_sys_vars.inc mysql-test/load_sysvars.inc @@ -1221,9 +1222,12 @@ sql/*.ds? sql/*.vcproj sql/.gdbinit sql/client.c +sql/Doxyfile sql/f.c sql/gen_lex_hash sql/handlerton.cc +sql/html +sql/latex sql/lex_hash.h sql/link_sources sql/max/* @@ -1897,3 +1901,4 @@ sql/share/slovak sql/share/spanish sql/share/swedish sql/share/ukrainian +libmysqld/examples/mysqltest.cc diff --git a/BUILD/compile-dist b/BUILD/compile-dist index bc907ed2bd0..e7bfb97be41 100755 --- a/BUILD/compile-dist +++ b/BUILD/compile-dist @@ -11,16 +11,33 @@ test -f Makefile && make maintainer-clean path=`dirname $0` . $path/autorun.sh +gmake= +for x in gmake gnumake make; do + if $x --version 2>/dev/null | grep GNU > /dev/null; then + gmake=$x + break; + fi +done + +if [ -z "$gmake" ]; then + # Our build may not depend on GNU make, but I wouldn't count on it + echo "Please install GNU make, and ensure it is in your path as gnumake, gmake, or make" >&2 + exit 2 +fi + # Default to gcc for CC and CXX if test -z "$CXX" ; then + export CXX CXX=gcc # Set some required compile options if test -z "$CXXFLAGS" ; then + export CXXFLAGS CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti" fi fi if test -z "$CC" ; then + export CC CC=gcc fi @@ -28,37 +45,23 @@ fi # Use ccache, if available if ccache -V > /dev/null 2>&1 then - if echo "$CC" | grep "ccache" > /dev/null + if echo "$CC" | grep -v ccache > /dev/null then - : - else + export CC CC="ccache $CC" fi - if echo "$CXX" | grep "ccache" > /dev/null + if echo "$CXX" | grep -v ccache > /dev/null then - : - else + export CXX CXX="ccache $CXX" fi fi -if test -z "$MAKE" -then - if gmake -v > /dev/null 2>&1 - then - MAKE="gmake" - else - MAKE="make" - fi -fi - -export CC CXX MAKE - # Make sure to enable all features that affect "make dist" # Remember that configure restricts the man pages to the configured features ! ./configure \ --with-maria-storage-engine \ --with-embedded-server \ --with-ndbcluster -$MAKE +$gmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 69fbf9f73b1..2c19f2b5059 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,6 +105,10 @@ IF(CYBOZU) ADD_DEFINITIONS(-DCYBOZU) ENDIF(CYBOZU) +IF(EXTRA_DEBUG) + ADD_DEFINITIONS(-D EXTRA_DEBUG) +ENDIF(EXTRA_DEBUG) + # in some places we use DBUG_OFF SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDBUG_OFF") SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DDBUG_OFF") @@ -269,3 +273,4 @@ IF(WITH_EMBEDDED_SERVER) ADD_SUBDIRECTORY(libmysqld) ADD_SUBDIRECTORY(libmysqld/examples) ENDIF(WITH_EMBEDDED_SERVER) +ADD_SUBDIRECTORY(mysql-test/lib/My/SafeProcess) diff --git a/Makefile.am b/Makefile.am index 9595f9b1fce..86071e2d934 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2000-2006 MySQL AB +# Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -124,6 +124,10 @@ test-reprepare: test: test-ns test-pr +smoke: + cd mysql-test ; \ + @PERL@ ./mysql-test-run.pl --do-test=s + test-full: test test-nr test-ps test-force: @@ -162,6 +166,8 @@ test-bt: @PERL@ ./mysql-test-run.pl --force --comment=partitions --suite=parts -cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --force --comment=stress --suite=stress + -cd mysql-test ; MTR_BUILD_THREAD=auto \ + @PERL@ ./mysql-test-run.pl --force --comment=jp --suite=jp -if [ -d mysql-test/suite/nist ] ; then \ cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --comment=nist --force --suite=nist ; \ @@ -178,15 +184,28 @@ test-bt: echo "no program found for 'embedded' tests - skipped testing" ; \ fi -# Re-enable the "jp" suite when bug#28563 is fixed -# -cd mysql-test ; MTR_BUILD_THREAD=auto \ -# @PERL@ ./mysql-test-run.pl --force --comment=jp --suite=jp +test-bt-fast: + -cd mysql-test ; MTR_BUILD_THREAD=auto \ + @PERL@ ./mysql-test-run.pl --comment=ps --force --timer \ + --skip-ndbcluster --ps-protocol --report-features + -if [ -e bin/ndbd -o -e storage/ndb/src/kernel/ndbd ] ; then \ + cd mysql-test ; \ + MTR_BUILD_THREAD=auto \ + @PERL@ ./mysql-test-run.pl --comment=ndb --force --timer \ + --with-ndbcluster-only ; \ + else \ + echo "no program found for 'ndbcluster' tests - skipped testing" ; \ + fi + -cd mysql-test ; MTR_BUILD_THREAD=auto \ + @PERL@ ./mysql-test-run.pl --force --comment=stress --suite=stress test-bt-debug: -cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --comment=debug --force --timer \ --skip-ndbcluster --skip-rpl --report-features +test-bt-debug-fast: + # Keep these for a while test-pl: test test-full-pl: test-full diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index cbd4a1f306b..e96437d40d0 100755 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -32,8 +32,8 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../mysys/my_conio.c) TARGET_LINK_LIBRARIES(mysql mysqlclient_notls wsock32) -ADD_EXECUTABLE(mysqltest mysqltest.c) -SET_SOURCE_FILES_PROPERTIES(mysqltest.c PROPERTIES COMPILE_FLAGS "-DTHREADS") +ADD_EXECUTABLE(mysqltest mysqltest.cc) +SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS") TARGET_LINK_LIBRARIES(mysqltest mysqlclient mysys regex wsock32 dbug) ADD_EXECUTABLE(mysqlcheck mysqlcheck.c) diff --git a/client/Makefile.am b/client/Makefile.am index c5c82ec0a42..94db565ba37 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -86,9 +86,9 @@ mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \ $(LIBMYSQLCLIENT_LA) \ $(top_builddir)/mysys/libmysys.a -mysqltest_SOURCES= mysqltest.c -mysqltest_CFLAGS= -DTHREAD -UUNDEF_THREADS_HACK -mysqltest_LDADD = $(CXXLDFLAGS) \ +mysqltest_SOURCES= mysqltest.cc +mysqltest_CXXFLAGS= -DTHREAD -UUNDEF_THREADS_HACK +mysqltest_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \ @CLIENT_EXTRA_LDFLAGS@ \ $(LIBMYSQLCLIENT_LA) \ $(top_builddir)/mysys/libmysys.a \ diff --git a/client/mysql.cc b/client/mysql.cc index 0b6f18a6a00..cfe1f16518d 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1539,7 +1539,7 @@ static void usage(int version) if (version) return; printf("\ -Copyright (C) 2000-2008 MySQL AB\n\ +Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.\n\ This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\ and you are welcome to modify and redistribute it under the GPL license\n"); printf("Usage: %s [OPTIONS] [database]\n", my_progname); @@ -2028,7 +2028,7 @@ static bool add_line(String &buffer,char *line,char *in_string, { if (!preserve_comments) { - // Skip spaces at the beggining of a statement + // Skip spaces at the beginning of a statement if (my_isspace(charset_info,inchar) && (out == line) && buffer.is_empty()) continue; @@ -2111,37 +2111,6 @@ static bool add_line(String &buffer,char *line,char *in_string, continue; } } - else if (!*ml_comment && !*in_string && - (end_of_line - pos) >= 10 && - !my_strnncoll(charset_info, (uchar*) pos, 10, - (const uchar*) "delimiter ", 10)) - { - // Flush previously accepted characters - if (out != line) - { - buffer.append(line, (uint32) (out - line)); - out= line; - } - - // Flush possible comments in the buffer - if (!buffer.is_empty()) - { - if (com_go(&buffer, 0) > 0) // < 0 is not fatal - DBUG_RETURN(1); - buffer.length(0); - } - - /* - Delimiter wants the get rest of the given line as argument to - allow one to change ';' to ';;' and back - */ - buffer.append(pos); - if (com_delimiter(&buffer, pos) > 0) - DBUG_RETURN(1); - - buffer.length(0); - break; - } else if (!*ml_comment && !*in_string && is_prefix(pos, delimiter)) { // Found a statement. Continue parsing after the delimiter @@ -2206,8 +2175,24 @@ static bool add_line(String &buffer,char *line,char *in_string, // comment to end of line if (preserve_comments) + { + bool started_with_nothing= !buffer.length(); + buffer.append(pos); + /* + A single-line comment by itself gets sent immediately so that + client commands (delimiter, status, etc) will be interpreted on + the next line. + */ + if (started_with_nothing) + { + if (com_go(&buffer, 0) > 0) // < 0 is not fatal + DBUG_RETURN(1); + buffer.length(0); + } + } + break; } else if (!*in_string && inchar == '/' && *(pos+1) == '*' && diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 4d2460dc4e7..190bb2383e9 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -620,6 +620,20 @@ static int run_mysqlcheck_upgrade(void) } +static int run_mysqlcheck_fixnames(void) +{ + verbose("Running 'mysqlcheck'..."); + return run_tool(mysqlcheck_path, + NULL, /* Send output from mysqlcheck directly to screen */ + "--no-defaults", + ds_args.str, + "--all-databases", + "--fix-db-names", + "--fix-table-names", + NULL); +} + + static const char *expected_errors[]= { "ERROR 1060", /* Duplicate column name */ @@ -782,7 +796,8 @@ int main(int argc, char **argv) /* Run "mysqlcheck" and "mysql_fix_privilege_tables.sql" */ - if (run_mysqlcheck_upgrade() || + if (run_mysqlcheck_fixnames() || + run_mysqlcheck_upgrade() || run_sql_fix_privilege_tables()) { /* diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 01329c550d6..f06bc6ee9ed 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -23,10 +23,6 @@ #include <sys/stat.h> #include <mysql.h> -#ifdef LATER_HAVE_NDBCLUSTER_DB -#include "../ndb/src/mgmclient/ndb_mgmclient.h" -#endif - #define ADMIN_VERSION "8.42" #define MAX_MYSQL_VAR 256 #define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */ @@ -46,10 +42,6 @@ static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations; static uint opt_count_iterations= 0, my_end_arg; static ulong opt_connect_timeout, opt_shutdown_timeout; static char * unix_port=0; -#ifdef LATER_HAVE_NDBCLUSTER_DB -static my_bool opt_ndbcluster=0; -static char *opt_ndb_connectstring=0; -#endif #ifdef HAVE_SMEM static char *shared_memory_base_name=0; @@ -105,9 +97,6 @@ enum commands { ADMIN_PING, ADMIN_EXTENDED_STATUS, ADMIN_FLUSH_STATUS, ADMIN_FLUSH_PRIVILEGES, ADMIN_START_SLAVE, ADMIN_STOP_SLAVE, ADMIN_FLUSH_THREADS, ADMIN_OLD_PASSWORD -#ifdef LATER_HAVE_NDBCLUSTER_DB - ,ADMIN_NDB_MGM -#endif }; static const char *command_names[]= { "create", "drop", "shutdown", @@ -118,9 +107,6 @@ static const char *command_names[]= { "ping", "extended-status", "flush-status", "flush-privileges", "start-slave", "stop-slave", "flush-threads","old-password", -#ifdef LATER_HAVE_NDBCLUSTER_DB - "ndb-mgm", -#endif NullS }; @@ -224,14 +210,6 @@ static struct my_option my_long_options[] = {"shutdown_timeout", OPT_SHUTDOWN_TIMEOUT, "", (uchar**) &opt_shutdown_timeout, (uchar**) &opt_shutdown_timeout, 0, GET_ULONG, REQUIRED_ARG, SHUTDOWN_DEF_TIMEOUT, 0, 3600*12, 0, 1, 0}, -#ifdef LATER_HAVE_NDBCLUSTER_DB - {"ndbcluster", OPT_NDBCLUSTER, "" - "", (uchar**) &opt_ndbcluster, - (uchar**) &opt_ndbcluster, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"ndb-connectstring", OPT_NDB_CONNECTSTRING, "" - "", (uchar**) &opt_ndb_connectstring, - (uchar**) &opt_ndb_connectstring, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#endif { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -634,7 +612,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) case ADMIN_VER: new_line=1; print_version(); - puts("Copyright (C) 2000-2006 MySQL AB"); + puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc."); puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); printf("Server version\t\t%s\n", mysql_get_server_info(mysql)); printf("Protocol version\t%d\n", mysql_get_proto_info(mysql)); @@ -984,24 +962,6 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) } mysql->reconnect=1; /* Automatic reconnect is default */ break; -#ifdef LATER_HAVE_NDBCLUSTER_DB - case ADMIN_NDB_MGM: - { - if (argc < 2) - { - my_printf_error(0, "Too few arguments to ndb-mgm", error_flags); - return 1; - } - { - Ndb_mgmclient_handle cmd= - ndb_mgmclient_handle_create(opt_ndb_connectstring); - ndb_mgmclient_execute(cmd, --argc, ++argv); - ndb_mgmclient_handle_destroy(cmd); - } - argc= 0; - } - break; -#endif default: my_printf_error(0, "Unknown command: '%-.60s'", error_flags, argv[0]); return 1; @@ -1023,7 +983,7 @@ static void print_version(void) static void usage(void) { print_version(); - puts("Copyright (C) 2000-2006 MySQL AB"); + puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc."); puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); puts("Administration program for the mysqld daemon."); printf("Usage: %s [OPTIONS] command command....\n", my_progname); diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 17ebca497e4..86e1b3352b4 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -40,15 +40,13 @@ static uint verbose = 0, opt_mysql_port=0; static int my_end_arg; static char * opt_mysql_unix_port = 0; static char *opt_password = 0, *current_user = 0, - *default_charset = (char *)MYSQL_DEFAULT_CHARSET_NAME, - *current_host = 0; + *default_charset= 0, *current_host= 0; static int first_error = 0; DYNAMIC_ARRAY tables4repair; #ifdef HAVE_SMEM static char *shared_memory_base_name=0; #endif static uint opt_protocol=0; -static CHARSET_INFO *charset_info= &my_charset_latin1; enum operations { DO_CHECK, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_UPGRADE }; @@ -282,12 +280,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; case OPT_FIX_DB_NAMES: what_to_do= DO_UPGRADE; - default_charset= (char*) "utf8"; opt_databases= 1; break; case OPT_FIX_TABLE_NAMES: what_to_do= DO_UPGRADE; - default_charset= (char*) "utf8"; break; case 'p': if (argument) @@ -367,11 +363,20 @@ static int get_options(int *argc, char ***argv) what_to_do = DO_CHECK; } - /* TODO: This variable is not yet used */ - if (strcmp(default_charset, charset_info->csname) && - !(charset_info= get_charset_by_csname(default_charset, - MY_CS_PRIMARY, MYF(MY_WME)))) - exit(1); + /* + If there's no --default-character-set option given with + --fix-table-name or --fix-db-name set the default character set to "utf8". + */ + if (!default_charset && (opt_fix_db_names || opt_fix_table_names)) + { + default_charset= (char*) "utf8"; + } + if (default_charset && !get_charset_by_csname(default_charset, MY_CS_PRIMARY, + MYF(MY_WME))) + { + printf("Unsupported character set: %s\n", default_charset); + return 1; + } if (*argc > 0 && opt_alldbs) { printf("You should give only options, no arguments at all, with option\n"); @@ -779,6 +784,8 @@ static int dbConnect(char *host, char *user, char *passwd) if (shared_memory_base_name) mysql_options(&mysql_connection,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); #endif + if (default_charset) + mysql_options(&mysql_connection, MYSQL_SET_CHARSET_NAME, default_charset); if (!(sock = mysql_real_connect(&mysql_connection, host, user, passwd, NULL, opt_mysql_port, opt_mysql_unix_port, 0))) { diff --git a/client/mysqldump.c b/client/mysqldump.c index c068b2ff16e..44c53a0e4c2 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/client/mysqlimport.c b/client/mysqlimport.c index ac3b0e8efba..09ba27b287a 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -193,7 +193,7 @@ static void print_version(void) static void usage(void) { print_version(); - puts("Copyright (C) 2000-2006 MySQL AB"); + puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc."); puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); printf("\ Loads tables from text files in various formats. The base name of the\n\ diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 167ff5c6198..0e696aed211 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -249,7 +249,7 @@ static void print_version(void) static void usage(void) { print_version(); - puts("Copyright (C) 2000-2006 MySQL AB"); + puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc."); puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); puts("Shows the structure of a mysql database (databases,tables and columns)\n"); printf("Usage: %s [OPTIONS] [database [table [column]]]\n",my_progname); diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 9904eeae9d0..a2de6a16af3 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -688,9 +688,7 @@ static void usage(void) { print_version(); puts("Copyright (C) 2005 MySQL AB"); - puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\ - \nand you are welcome to modify and redistribute it under the GPL \ - license\n"); + puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); puts("Run a query multiple times against the server\n"); printf("Usage: %s [OPTIONS]\n",my_progname); print_defaults("my",load_default_groups); diff --git a/client/mysqltest.c b/client/mysqltest.cc index 4f112e33bd2..9bf7237cc0d 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.cc @@ -173,7 +173,6 @@ static ulonglong timer_start; static void timer_output(void); static ulonglong timer_now(void); -static ulonglong progress_start= 0; static ulong connection_retry_sleep= 100000; /* Microseconds */ @@ -194,12 +193,12 @@ DYNAMIC_ARRAY q_lines; #include "sslopt-vars.h" -struct +struct Parser { int read_lines,current_line; } parser; -struct +struct MasterPos { char file[FN_REFLEN]; ulong pos; @@ -208,7 +207,7 @@ struct /* if set, all results are concated and compared against this file */ const char *result_file_name= 0; -typedef struct st_var +typedef struct { char *name; int name_len; @@ -286,8 +285,9 @@ enum enum_commands { Q_REPLACE_REGEX, Q_REMOVE_FILE, Q_FILE_EXIST, Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, Q_SKIP, Q_CHMOD_FILE, Q_APPEND_FILE, Q_CAT_FILE, Q_DIFF_FILES, - Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR, Q_LIST_FILES, - Q_LIST_FILES_WRITE_FILE, Q_LIST_FILES_APPEND_FILE, + Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR, + Q_LIST_FILES, Q_LIST_FILES_WRITE_FILE, Q_LIST_FILES_APPEND_FILE, + Q_SEND_SHUTDOWN, Q_SHUTDOWN_SERVER, Q_UNKNOWN, /* Unknown command. */ Q_COMMENT, /* Comments, ignored. */ @@ -382,6 +382,8 @@ const char *command_names[]= "list_files", "list_files_write_file", "list_files_append_file", + "send_shutdown", + "shutdown_server", 0 }; @@ -431,7 +433,7 @@ struct st_command TYPELIB command_typelib= {array_elements(command_names),"", command_names, 0}; -DYNAMIC_STRING ds_res, ds_progress, ds_warning_messages; +DYNAMIC_STRING ds_res; char builtin_echo[FN_REFLEN]; @@ -441,8 +443,6 @@ void abort_not_supported_test(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2); void verbose_msg(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2); -void warning_msg(const char *fmt, ...) - ATTRIBUTE_FORMAT(printf, 1, 2); void log_msg(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2); @@ -455,15 +455,15 @@ VAR* var_get(const char *var_name, const char** var_name_end, void eval_expr(VAR* v, const char *p, const char** p_end); my_bool match_delimiter(int c, const char *delim, uint length); void dump_result_to_reject_file(char *buf, int size); -void dump_result_to_log_file(char *buf, int size); void dump_warning_messages(); -void dump_progress(); void do_eval(DYNAMIC_STRING *query_eval, const char *query, const char *query_end, my_bool pass_through_escape_chars); void str_to_file(const char *fname, char *str, int size); void str_to_file2(const char *fname, char *str, int size, my_bool append); +void fix_win_paths(const char *val, int len); + #ifdef __WIN__ void free_tmp_sh_file(); void free_win_path_patterns(); @@ -492,6 +492,177 @@ void free_all_replace(){ } +class LogFile { + FILE* m_file; + char m_file_name[FN_REFLEN]; + size_t m_bytes_written; +public: + LogFile() : m_file(NULL), m_bytes_written(0) { + bzero(m_file_name, sizeof(m_file_name)); + } + + ~LogFile() { + close(); + } + + const char* file_name() const { return m_file_name; } + size_t bytes_written() const { return m_bytes_written; } + + void open(const char* dir, const char* name, const char* ext) + { + DBUG_ENTER("LogFile::open"); + DBUG_PRINT("enter", ("dir: '%s', name: '%s'", + dir, name)); + if (!name) + { + m_file= stdout; + DBUG_VOID_RETURN; + } + + fn_format(m_file_name, name, dir, ext, + *dir ? MY_REPLACE_DIR | MY_REPLACE_EXT : + MY_REPLACE_EXT); + + DBUG_PRINT("info", ("file_name: %s", m_file_name)); + + if ((m_file= fopen(m_file_name, "wb+")) == NULL) + die("Failed to open log file %s, errno: %d", m_file_name, errno); + + DBUG_VOID_RETURN; + } + + void close() + { + if (m_file) { + if (m_file != stdout) + fclose(m_file); + else + fflush(m_file); + } + m_file= NULL; + } + + void flush() + { + if (m_file && m_file != stdout) + { + if (fflush(m_file)) + die("Failed to flush '%s', errno: %d", m_file_name, errno); + } + } + + void write(DYNAMIC_STRING* ds) + { + DBUG_ENTER("LogFile::write"); + DBUG_ASSERT(m_file); + + if (ds->length == 0) + DBUG_VOID_RETURN; + DBUG_ASSERT(ds->str); + + if (fwrite(ds->str, 1, ds->length, m_file) != ds->length) + die("Failed to write %lu bytes to '%s', errno: %d", + (unsigned long)ds->length, m_file_name, errno); + m_bytes_written+= ds->length; + DBUG_VOID_RETURN; + } + + void show_tail(uint lines) { + DBUG_ENTER("LogFile::show_tail"); + + if (!m_file || m_file == stdout) + DBUG_VOID_RETURN; + + if (lines == 0) + DBUG_VOID_RETURN; + lines++; + + int show_offset= 0; + char buf[256]; + size_t bytes; + bool found_bof= false; + + /* Search backward in file until "lines" newline has been found */ + while (lines && !found_bof) + { + show_offset-= sizeof(buf); + while(fseek(m_file, show_offset, SEEK_END) != 0 && show_offset < 0) + { + found_bof= true; + // Seeking before start of file + show_offset++; + } + + if ((bytes= fread(buf, 1, sizeof(buf), m_file)) <= 0) + { + fprintf(stderr, "Failed to read from '%s', errno: %d\n", + m_file_name, errno); + DBUG_VOID_RETURN; + } + + DBUG_PRINT("info", ("Read %lu bytes from file, buf: %s", + (unsigned long)bytes, buf)); + + char* show_from= buf + bytes; + while(show_from > buf && lines > 0 ) + { + show_from--; + if (*show_from == '\n') + lines--; + } + if (show_from != buf) + { + // The last new line was found in this buf, adjust offset + show_offset+= (show_from - buf) + 1; + DBUG_PRINT("info", ("adjusted offset to %d", show_offset)); + } + DBUG_PRINT("info", ("show_offset: %d", show_offset)); + } + + fprintf(stderr, "\nThe result from queries just before the failure was:\n"); + + DBUG_PRINT("info", ("show_offset: %d", show_offset)); + if (!lines) + { + fprintf(stderr, "< snip >\n"); + + if (fseek(m_file, show_offset, SEEK_END) != 0) + { + fprintf(stderr, "Failed to seek to position %d in '%s', errno: %d", + show_offset, m_file_name, errno); + DBUG_VOID_RETURN; + } + + } + else { + DBUG_PRINT("info", ("Showing the whole file")); + if (fseek(m_file, 0L, SEEK_SET) != 0) + { + fprintf(stderr, "Failed to seek to pos 0 in '%s', errno: %d", + m_file_name, errno); + DBUG_VOID_RETURN; + } + } + + while ((bytes= fread(buf, 1, sizeof(buf), m_file)) > 0) + fwrite(buf, 1, bytes, stderr); + + if (!lines) + { + fprintf(stderr, + "\nMore results from queries before failure can be found in %s\n", + m_file_name); + } + fflush(stderr); + + DBUG_VOID_RETURN; + } +}; + +LogFile log_file; +LogFile progress_file; + + /* Disable functions that only exist in MySQL 4.0 */ #if MYSQL_VERSION_ID < 40000 void mysql_enable_rpl_parse(MYSQL* mysql __attribute__((unused))) {} @@ -631,12 +802,15 @@ void do_eval(DYNAMIC_STRING *query_eval, const char *query, break; } } +#ifdef __WIN__ + fix_win_paths(query_eval->str, query_eval->length); +#endif DBUG_VOID_RETURN; } /* - Run query and dump the result to stdout in vertical format + Run query and dump the result to stderr in vertical format NOTE! This function should be safe to call when an error has occured and thus any further errors will be ignored(although logged) @@ -968,8 +1142,6 @@ void free_used_memory() my_free(embedded_server_args[--embedded_server_arg_count],MYF(0)); delete_dynamic(&q_lines); dynstr_free(&ds_res); - dynstr_free(&ds_progress); - dynstr_free(&ds_warning_messages); free_all_replace(); my_free(opt_pass,MYF(MY_ALLOW_ZERO_PTR)); free_defaults(default_argv); @@ -1047,31 +1219,7 @@ void die(const char *fmt, ...) fprintf(stderr, "\n"); fflush(stderr); - /* Show results from queries just before failure */ - if (ds_res.length && opt_tail_lines) - { - int tail_lines= opt_tail_lines; - char* show_from= ds_res.str + ds_res.length - 1; - while(show_from > ds_res.str && tail_lines > 0 ) - { - show_from--; - if (*show_from == '\n') - tail_lines--; - } - fprintf(stderr, "\nThe result from queries just before the failure was:\n"); - if (show_from > ds_res.str) - fprintf(stderr, "< snip >"); - fprintf(stderr, "%s", show_from); - fflush(stderr); - } - - /* Dump the result that has been accumulated so far to .log file */ - if (result_file_name && ds_res.length) - dump_result_to_log_file(ds_res.str, ds_res.length); - - /* Dump warning messages */ - if (result_file_name && ds_warning_messages.length) - dump_warning_messages(); + log_file.show_tail(opt_tail_lines); /* Help debugging by displaying any warnings that might have @@ -1145,41 +1293,6 @@ void verbose_msg(const char *fmt, ...) } -void warning_msg(const char *fmt, ...) -{ - va_list args; - char buff[512]; - size_t len; - DBUG_ENTER("warning_msg"); - - va_start(args, fmt); - dynstr_append(&ds_warning_messages, "mysqltest: "); - if (start_lineno != 0) - { - dynstr_append(&ds_warning_messages, "Warning detected "); - if (cur_file && cur_file != file_stack) - { - len= my_snprintf(buff, sizeof(buff), "in included file %s ", - cur_file->file_name); - dynstr_append_mem(&ds_warning_messages, - buff, len); - } - len= my_snprintf(buff, sizeof(buff), "at line %d: ", - start_lineno); - dynstr_append_mem(&ds_warning_messages, - buff, len); - } - - len= my_vsnprintf(buff, sizeof(buff), fmt, args); - dynstr_append_mem(&ds_warning_messages, buff, len); - - dynstr_append(&ds_warning_messages, "\n"); - va_end(args); - - DBUG_VOID_RETURN; -} - - void log_msg(const char *fmt, ...) { va_list args; @@ -1337,6 +1450,36 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...) /* + Test if diff is present. This is needed on Windows systems + as the OS returns 1 whether diff is successful or if it is + not present. + + We run diff -v and look for output in stdout. + We don't redirect stderr to stdout to make for a simplified check + Windows will output '"diff"' is not recognized... to stderr if it is + not present. +*/ + +int diff_check() +{ + char buf[512]= {0}; + FILE *res_file; + const char *cmd = "diff -v"; + int have_diff = 0; + + if (!(res_file= popen(cmd, "r"))) + die("popen(\"%s\", \"r\") failed", cmd); + + /* if diff is not present, nothing will be in stdout to increment have_diff */ + if (fgets(buf, sizeof(buf), res_file)) + { + have_diff += 1; + } + pclose(res_file); + return have_diff; +} + +/* Show the diff of two files using the systems builtin diff command. If no such diff command exist, just dump the content of the two files and inform about how to get "diff" @@ -1352,43 +1495,72 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...) void show_diff(DYNAMIC_STRING* ds, const char* filename1, const char* filename2) { - DYNAMIC_STRING ds_tmp; + int have_diff = 0; if (init_dynamic_string(&ds_tmp, "", 256, 256)) die("Out of memory"); - /* First try with unified diff */ - if (run_tool("diff", - &ds_tmp, /* Get output from diff in ds_tmp */ - "-u", - filename1, - filename2, - "2>&1", - NULL) > 1) /* Most "diff" tools return >1 if error */ - { - dynstr_set(&ds_tmp, ""); + /* determine if we have diff on Windows + needs special processing due to return values + on that OS + */ +#ifdef __WIN__ + have_diff = diff_check(); +#else + have_diff = 1; +#endif - /* Fallback to context diff with "diff -c" */ + if (have_diff) + { + /* First try with unified diff */ if (run_tool("diff", &ds_tmp, /* Get output from diff in ds_tmp */ - "-c", + "-u", filename1, filename2, "2>&1", NULL) > 1) /* Most "diff" tools return >1 if error */ { - /* - Fallback to dump both files to result file and inform - about installing "diff" - */ dynstr_set(&ds_tmp, ""); - dynstr_append(&ds_tmp, + /* Fallback to context diff with "diff -c" */ + if (run_tool("diff", + &ds_tmp, /* Get output from diff in ds_tmp */ + "-c", + filename1, + filename2, + "2>&1", + NULL) > 1) /* Most "diff" tools return >1 if error */ + { + dynstr_set(&ds_tmp, ""); + + /* Fallback to simple diff with "diff" */ + if (run_tool("diff", + &ds_tmp, /* Get output from diff in ds_tmp */ + filename1, + filename2, + "2>&1", + NULL) > 1) /* Most "diff" tools return >1 if error */ + { + have_diff= 0; + } + } + } + } + + if (! have_diff) + { + /* + Fallback to dump both files to result file and inform + about installing "diff" + */ + dynstr_append(&ds_tmp, "\n"); + dynstr_append(&ds_tmp, "\n" "The two files differ but it was not possible to execute 'diff' in\n" -"order to show only the difference, tried both 'diff -u' or 'diff -c'.\n" -"Instead the whole content of the two files was shown for you to diff manually. ;)\n\n" +"order to show only the difference. Instead the whole content of the\n" +"two files was shown for you to diff manually.\n\n" "To get a better report you should install 'diff' on your system, which you\n" "for example can get from http://www.gnu.org/software/diffutils/diffutils.html\n" #ifdef __WIN__ @@ -1396,16 +1568,15 @@ void show_diff(DYNAMIC_STRING* ds, #endif "\n"); - dynstr_append(&ds_tmp, " --- "); - dynstr_append(&ds_tmp, filename1); - dynstr_append(&ds_tmp, " >>>\n"); - cat_file(&ds_tmp, filename1); - dynstr_append(&ds_tmp, "<<<\n --- "); - dynstr_append(&ds_tmp, filename1); - dynstr_append(&ds_tmp, " >>>\n"); - cat_file(&ds_tmp, filename2); - dynstr_append(&ds_tmp, "<<<<\n"); - } + dynstr_append(&ds_tmp, " --- "); + dynstr_append(&ds_tmp, filename1); + dynstr_append(&ds_tmp, " >>>\n"); + cat_file(&ds_tmp, filename1); + dynstr_append(&ds_tmp, "<<<\n --- "); + dynstr_append(&ds_tmp, filename1); + dynstr_append(&ds_tmp, " >>>\n"); + cat_file(&ds_tmp, filename2); + dynstr_append(&ds_tmp, "<<<<\n"); } if (ds) @@ -1444,49 +1615,69 @@ enum compare_files_result_enum { */ -int compare_files2(File fd, const char* filename2) +int compare_files2(File fd1, const char* filename2) { int error= RESULT_OK; File fd2; - uint len, len2; - char buff[512], buff2[512]; + my_off_t fd1_length, fd2_length; + DYNAMIC_STRING fd1_result, fd2_result; if ((fd2= my_open(filename2, O_RDONLY, MYF(0))) < 0) { - my_close(fd, MYF(0)); + my_close(fd1, MYF(0)); die("Failed to open second file: '%s'", filename2); } - while((len= my_read(fd, (uchar*)&buff, - sizeof(buff), MYF(0))) > 0) + + fd1_length= my_seek(fd1, 0, SEEK_END, MYF(0)); + fd2_length= my_seek(fd2, 0, SEEK_END, MYF(0)); + + if (init_dynamic_string(&fd1_result, 0, fd1_length, 0) || + init_dynamic_string(&fd2_result, 0, fd2_length, 0)) + die("Out of memory when allocating data for result"); + + fd1_result.length= fd1_length; + fd2_result.length= fd2_length; + + (void) my_seek(fd1, 0, SEEK_SET, MYF(0)); + (void) my_seek(fd2, 0, SEEK_SET, MYF(0)); + if (my_read(fd1, (uchar*) fd1_result.str, fd1_length, MYF(MY_WME | MY_NABP))) + die("Error when reading data from result file"); + if (my_read(fd2, (uchar*) fd2_result.str, fd2_length, MYF(MY_WME | MY_NABP))) + die("Error when reading data from result file"); + + if (global_subst && + (fd1_length != fd2_length || + memcmp(fd1_result.str, fd2_result.str, fd1_length))) { - if ((len2= my_read(fd2, (uchar*)&buff2, - sizeof(buff2), MYF(0))) < len) - { - /* File 2 was smaller */ - error= RESULT_LENGTH_MISMATCH; - break; - } - if (len2 > len) - { - /* File 1 was smaller */ - error= RESULT_LENGTH_MISMATCH; - break; - } - if ((memcmp(buff, buff2, len))) - { - /* Content of this part differed */ - error= RESULT_CONTENT_MISMATCH; - break; - } + /** + @todo MARIA_HACK + This serves for when a test is run with --default-storage-engine=X + where X is not MyISAM: tests using SHOW CREATE TABLE will always fail + because SHOW CREATE TABLE prints X instead of MyISAM. With + --global-subst=X,MyISAM , such trivial differences are eliminated and + test may be reported as passing. + --global-subst is only a quick way to run a lot of existing tests + with Maria and find bugs; it is not good enough for reaching the main + trees when Maria is merged into them. + --global-subst should be removed. + */ + uint global_subst_from_len= strlen(global_subst_from); + uint global_subst_to_len= strlen(global_subst_to); + while (replace(&fd1_result, + global_subst_from, global_subst_from_len, + global_subst_to, global_subst_to_len) == 0) + /* do nothing */ ; + /* let's compare again to see if it is ok now */ } - if (!error && my_read(fd2, (uchar*)&buff2, - sizeof(buff2), MYF(0)) > 0) - { - /* File 1 was smaller */ + + if (fd1_result.length != fd2_result.length) error= RESULT_LENGTH_MISMATCH; - } + else if ((memcmp(fd1_result.str, fd2_result.str, fd1_result.length))) + error= RESULT_CONTENT_MISMATCH; my_close(fd2, MYF(0)); + dynstr_free(&fd1_result); + dynstr_free(&fd2_result); return error; } @@ -1569,55 +1760,25 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname) /* - Check the content of ds against result file + Check the content of log against result file SYNOPSIS check_result - ds - content to be checked RETURN VALUES error - the function will not return */ -void check_result(DYNAMIC_STRING* ds) +void check_result() { - int res; const char* mess= "Result content mismatch\n"; DBUG_ENTER("check_result"); DBUG_ASSERT(result_file_name); DBUG_PRINT("enter", ("result_file_name: %s", result_file_name)); - if (access(result_file_name, F_OK) != 0) - die("The specified result file does not exist: '%s'", result_file_name); - - res= dyn_string_cmp(ds, result_file_name); - if (global_subst && res != RESULT_OK) - { - /** - @todo MARIA_HACK - This serves for when a test is run with --default-storage-engine=X - where X is not MyISAM: tests using SHOW CREATE TABLE will always fail - because SHOW CREATE TABLE prints X instead of MyISAM. With - --global-subst=X,MyISAM , such trivial differences are eliminated and - test may be reported as passing. - --global-subst is only a quick way to run a lot of existing tests - with Maria and find bugs; it is not good enough for reaching the main - trees when Maria is merged into them. - --global-subst should be removed. - */ - uint global_subst_from_len= strlen(global_subst_from); - uint global_subst_to_len= strlen(global_subst_to); - while (replace(ds, - global_subst_from, global_subst_from_len, - global_subst_to, global_subst_to_len) == 0) - /* do nothing */ ; - /* let's compare again to see if it is ok now */ - res= dyn_string_cmp(ds, result_file_name); - } - switch(res) - { + switch (compare_files(log_file.file_name(), result_file_name)) { case RESULT_OK: break; /* ok */ case RESULT_LENGTH_MISMATCH: @@ -1645,9 +1806,10 @@ void check_result(DYNAMIC_STRING* ds) fn_format(reject_file, result_file_name, opt_logdir, ".reject", MY_REPLACE_DIR | MY_REPLACE_EXT); } - str_to_file(reject_file, ds->str, ds->length); - dynstr_set(ds, NULL); /* Don't create a .log file */ + if (my_copy(log_file.file_name(), reject_file, MYF(0)) != 0) + die("Failed to copy '%s' to '%s', errno: %d", + log_file.file_name(), reject_file, errno); show_diff(NULL, result_file_name, reject_file); die(mess); @@ -1761,7 +1923,7 @@ VAR *var_init(VAR *v, const char *name, int name_len, const char *val, tmp_var->name = (name) ? (char*) tmp_var + sizeof(*tmp_var) : 0; tmp_var->alloced = (v == 0); - if (!(tmp_var->str_val = my_malloc(val_alloc_len+1, MYF(MY_WME)))) + if (!(tmp_var->str_val = (char*)my_malloc(val_alloc_len+1, MYF(MY_WME)))) die("Out of memory"); memcpy(tmp_var->name, name, name_len); @@ -1948,17 +2110,6 @@ void var_set_errno(int sql_errno) /* - Update $mysql_get_server_version variable with version - of the currently connected server -*/ - -void var_set_mysql_get_server_version(MYSQL* mysql) -{ - var_set_int("$mysql_get_server_version", mysql_get_server_version(mysql)); -} - - -/* Set variable from the result of a query SYNOPSIS @@ -2077,7 +2228,7 @@ void var_set_query_get_value(struct st_command *command, VAR *var) const struct command_arg query_get_value_args[] = { {"query", ARG_STRING, TRUE, &ds_query, "Query to run"}, {"column name", ARG_STRING, TRUE, &ds_col, "Name of column"}, - {"row number", ARG_STRING, TRUE, &ds_row, "Number for row"}, + {"row number", ARG_STRING, TRUE, &ds_row, "Number for row"} }; DBUG_ENTER("var_set_query_get_value"); @@ -2174,8 +2325,8 @@ void var_copy(VAR *dest, VAR *src) /* Alloc/realloc data for str_val in dest */ if (dest->alloced_len < src->alloced_len && !(dest->str_val= dest->str_val - ? my_realloc(dest->str_val, src->alloced_len, MYF(MY_WME)) - : my_malloc(src->alloced_len, MYF(MY_WME)))) + ? (char*)my_realloc(dest->str_val, src->alloced_len, MYF(MY_WME)) + : (char*)my_malloc(src->alloced_len, MYF(MY_WME)))) die("Out of memory"); else dest->alloced_len= src->alloced_len; @@ -2196,8 +2347,16 @@ void eval_expr(VAR *v, const char *p, const char **p_end) if (*p == '$') { VAR *vp; + const char* expected_end= *p_end; // Remember var end if ((vp= var_get(p, p_end, 0, 0))) var_copy(v, vp); + + /* Make sure there was just a $variable and nothing else */ + const char* end= *p_end + 1; + if (end < expected_end) + die("Found junk '%.*s' after $variable in expression", + (int)(expected_end - end - 1), end); + DBUG_VOID_RETURN; } @@ -2233,9 +2392,9 @@ void eval_expr(VAR *v, const char *p, const char **p_end) v->alloced_len = (new_val_len < MIN_VAR_ALLOC - 1) ? MIN_VAR_ALLOC : new_val_len + 1; if (!(v->str_val = - v->str_val ? my_realloc(v->str_val, v->alloced_len+1, - MYF(MY_WME)) : - my_malloc(v->alloced_len+1, MYF(MY_WME)))) + v->str_val ? + (char*)my_realloc(v->str_val, v->alloced_len+1, MYF(MY_WME)) : + (char*)my_malloc(v->alloced_len+1, MYF(MY_WME)))) die("Out of memory"); } v->str_val_len = new_val_len; @@ -2252,8 +2411,19 @@ void eval_expr(VAR *v, const char *p, const char **p_end) int open_file(const char *name) { char buff[FN_REFLEN]; + size_t length; DBUG_ENTER("open_file"); DBUG_PRINT("enter", ("name: %s", name)); + + /* Extract path from current file and try it as base first */ + if (dirname_part(buff, cur_file->file_name, &length)) + { + strxmov(buff, buff, name, NullS); + if (access(buff, F_OK) == 0){ + DBUG_PRINT("info", ("The file exists")); + name= buff; + } + } if (!test_if_hard_path(name)) { strxmov(buff, opt_basedir, name, NullS); @@ -2267,7 +2437,7 @@ int open_file(const char *name) if (!(cur_file->file = my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(0)))) { cur_file--; - die("Could not open '%s' for reading", buff); + die("Could not open '%s' for reading, errno: %d", buff, errno); } cur_file->file_name= my_strdup(buff, MYF(MY_FAE)); cur_file->lineno=1; @@ -2554,7 +2724,7 @@ enum enum_operator SYNOPSIS do_modify_var() query called command - operator operation to perform on the var + op operation to perform on the var DESCRIPTION dec $var_name @@ -2563,7 +2733,7 @@ enum enum_operator */ int do_modify_var(struct st_command *command, - enum enum_operator operator) + enum enum_operator op) { const char *p= command->first_argument; VAR* v; @@ -2573,7 +2743,7 @@ int do_modify_var(struct st_command *command, die("The argument to %.*s must be a variable (start with $)", command->first_word_len, command->query); v= var_get(p, &p, 1, 0); - switch (operator) { + switch (op) { case DO_DEC: v->int_val--; break; @@ -3228,6 +3398,14 @@ void do_diff_files(struct st_command *command) sizeof(diff_file_args)/sizeof(struct command_arg), ' '); + if (access(ds_filename.str, F_OK) != 0) + die("command \"diff_files\" failed, file '%s' does not exist", + ds_filename.str); + + if (access(ds_filename2.str, F_OK) != 0) + die("command \"diff_files\" failed, file '%s' does not exist", + ds_filename2.str); + if ((error= compare_files(ds_filename.str, ds_filename2.str))) { /* Compare of the two files failed, append them to output @@ -3513,24 +3691,19 @@ void do_wait_for_slave_to_stop(struct st_command *c __attribute__((unused))) } -void do_sync_with_master2(long offset) +void do_sync_with_master2(struct st_command *command, long offset) { MYSQL_RES *res; MYSQL_ROW row; MYSQL *mysql= &cur_con->mysql; char query_buf[FN_REFLEN+128]; - int tries= 0; - int rpl_parse; + int timeout= 300; /* seconds */ if (!master_pos.file[0]) die("Calling 'sync_with_master' without calling 'save_master_pos'"); - rpl_parse= mysql_rpl_parse_enabled(mysql); - mysql_disable_rpl_parse(mysql); - sprintf(query_buf, "select master_pos_wait('%s', %ld)", master_pos.file, - master_pos.pos + offset); - -wait_for_position: + sprintf(query_buf, "select master_pos_wait('%s', %ld, %d)", + master_pos.file, master_pos.pos + offset, timeout); if (mysql_query(mysql, query_buf)) die("failed in '%s': %d: %s", query_buf, mysql_errno(mysql), @@ -3543,30 +3716,48 @@ wait_for_position: mysql_free_result(res); die("empty result in %s", query_buf); } - if (!row[0]) + + int result= -99; + const char* result_str= row[0]; + if (result_str) + result= atoi(result_str); + + mysql_free_result(res); + + if (!result_str || result < 0) { - /* - It may be that the slave SQL thread has not started yet, though START - SLAVE has been issued ? - */ - mysql_free_result(res); - if (tries++ == 30) + /* master_pos_wait returned NULL or < 0 */ + show_query(mysql, "SHOW MASTER STATUS"); + show_query(mysql, "SHOW SLAVE STATUS"); + show_query(mysql, "SHOW PROCESSLIST"); + fprintf(stderr, "analyze: sync_with_master\n"); + + if (!result_str) { - show_query(mysql, "SHOW MASTER STATUS"); - show_query(mysql, "SHOW SLAVE STATUS"); - die("could not sync with master ('%s' returned NULL)", query_buf); + /* + master_pos_wait returned NULL. This indicates that + slave SQL thread is not started, the slave's master + information is not initialized, the arguments are + incorrect, or an error has occured + */ + die("%.*s failed: '%s' returned NULL "\ + "indicating slave SQL thread failure", + command->first_word_len, command->query, query_buf); + } - sleep(1); /* So at most we will wait 30 seconds and make 31 tries */ - goto wait_for_position; + + if (result == -1) + die("%.*s failed: '%s' returned -1 "\ + "indicating timeout after %d seconds", + command->first_word_len, command->query, query_buf, timeout); + else + die("%.*s failed: '%s' returned unknown result :%d", + command->first_word_len, command->query, query_buf, result); } - mysql_free_result(res); - if (rpl_parse) - mysql_enable_rpl_parse(mysql); return; } - void do_sync_with_master(struct st_command *command) { long offset= 0; @@ -3581,7 +3772,7 @@ void do_sync_with_master(struct st_command *command) die("Invalid integer argument \"%s\"", offset_start); command->last_argument= p; } - do_sync_with_master2(offset); + do_sync_with_master2(command, offset); return; } @@ -3931,6 +4122,145 @@ void do_set_charset(struct st_command *command) } +/* + Run query and return one field in the result set from the + first row and <column> +*/ + +int query_get_string(MYSQL* mysql, const char* query, + int column, DYNAMIC_STRING* ds) +{ + MYSQL_RES *res= NULL; + MYSQL_ROW row; + + if (mysql_query(mysql, query)) + die("'%s' failed: %d %s", query, + mysql_errno(mysql), mysql_error(mysql)); + if ((res= mysql_store_result(mysql)) == NULL) + die("Failed to store result: %d %s", + mysql_errno(mysql), mysql_error(mysql)); + + if ((row= mysql_fetch_row(res)) == NULL) + { + mysql_free_result(res); + ds= 0; + return 1; + } + init_dynamic_string(ds, (row[column] ? row[column] : "NULL"), ~0, 32); + mysql_free_result(res); + return 0; +} + + +static int my_kill(int pid, int sig) +{ +#ifdef __WIN__ + HANDLE proc; + if ((proc= OpenProcess(PROCESS_TERMINATE, FALSE, pid)) == NULL) + return -1; + if (sig == 0) + { + CloseHandle(proc); + return 0; + } + (void)TerminateProcess(proc, 201); + CloseHandle(proc); + return 1; +#else + return kill(pid, sig); +#endif +} + + + +/* + Shutdown the server of current connection and + make sure it goes away within <timeout> seconds + + NOTE! Currently only works with local server + + SYNOPSIS + do_shutdown_server() + command called command + + DESCRIPTION + shutdown [<timeout>] + +*/ + +void do_shutdown_server(struct st_command *command) +{ + int timeout=60, pid; + DYNAMIC_STRING ds_pidfile_name; + MYSQL* mysql = &cur_con->mysql; + static DYNAMIC_STRING ds_timeout; + const struct command_arg shutdown_args[] = { + {"timeout", ARG_STRING, FALSE, &ds_timeout, "Timeout before killing server"} + }; + DBUG_ENTER("do_shutdown_server"); + + check_command_args(command, command->first_argument, shutdown_args, + sizeof(shutdown_args)/sizeof(struct command_arg), + ' '); + + if (ds_timeout.length) + { + timeout= atoi(ds_timeout.str); + if (timeout == 0) + die("Illegal argument for timeout: '%s'", ds_timeout.str); + } + dynstr_free(&ds_timeout); + + /* Get the servers pid_file name and use it to read pid */ + if (query_get_string(mysql, "SHOW VARIABLES LIKE 'pid_file'", 1, + &ds_pidfile_name)) + die("Failed to get pid_file from server"); + + /* Read the pid from the file */ + { + int fd; + char buff[32]; + + if ((fd= my_open(ds_pidfile_name.str, O_RDONLY, MYF(0))) < 0) + die("Failed to open file '%s'", ds_pidfile_name.str); + dynstr_free(&ds_pidfile_name); + + if (my_read(fd, (uchar*)&buff, + sizeof(buff), MYF(0)) <= 0){ + my_close(fd, MYF(0)); + die("pid file was empty"); + } + my_close(fd, MYF(0)); + + pid= atoi(buff); + if (pid == 0) + die("Pidfile didn't contain a valid number"); + } + DBUG_PRINT("info", ("Got pid %d", pid)); + + /* Tell server to shutdown if timeout > 0*/ + if (timeout && mysql_shutdown(mysql, SHUTDOWN_DEFAULT)) + die("mysql_shutdown failed"); + + /* Check that server dies */ + while(timeout--){ + if (my_kill(pid, 0) < 0){ + DBUG_PRINT("info", ("Process %d does not exist anymore", pid)); + DBUG_VOID_RETURN; + } + DBUG_PRINT("info", ("Sleeping, timeout: %d", timeout)); + my_sleep(1000000L); + } + + /* Kill the server */ + DBUG_PRINT("info", ("Killing server, pid: %d", pid)); + (void)my_kill(pid, 9); + + DBUG_VOID_RETURN; + +} + + #if MYSQL_VERSION_ID >= 50000 /* List of error names to error codes, available from 5.0 */ typedef struct @@ -4194,59 +4524,73 @@ void set_reconnect(MYSQL* mysql, int val) } -int select_connection_name(const char *name) +/** + Change the current connection to the given st_connection, and update + $mysql_get_server_version and $CURRENT_CONNECTION accordingly. +*/ +void set_current_connection(struct st_connection *con) +{ + cur_con= con; + /* Update $mysql_get_server_version to that of current connection */ + var_set_int("$mysql_get_server_version", + mysql_get_server_version(&con->mysql)); + /* Update $CURRENT_CONNECTION to the name of the current connection */ + var_set_string("$CURRENT_CONNECTION", con->name); +} + + +void select_connection_name(const char *name) { DBUG_ENTER("select_connection_name"); DBUG_PRINT("enter",("name: '%s'", name)); + st_connection *con= find_connection_by_name(name); - if (!(cur_con= find_connection_by_name(name))) + if (!con) die("connection '%s' not found in connection pool", name); - /* Update $mysql_get_server_version to that of current connection */ - var_set_mysql_get_server_version(&cur_con->mysql); + set_current_connection(con); - DBUG_RETURN(0); + DBUG_VOID_RETURN; } -int select_connection(struct st_command *command) +void select_connection(struct st_command *command) { - char *name; - char *p= command->first_argument; DBUG_ENTER("select_connection"); + static DYNAMIC_STRING ds_connection; + const struct command_arg connection_args[] = { + { "connection_name", ARG_STRING, TRUE, &ds_connection, "Name of the connection that we switch to." } + }; + check_command_args(command, command->first_argument, connection_args, + sizeof(connection_args)/sizeof(struct command_arg), + ','); - if (!*p) - die("Missing connection name in connect"); - name= p; - while (*p && !my_isspace(charset_info,*p)) - p++; - if (*p) - *p++= 0; - command->last_argument= p; - DBUG_RETURN(select_connection_name(name)); + DBUG_PRINT("info", ("changing connection: %s", ds_connection.str)); + select_connection_name(ds_connection.str); + dynstr_free(&ds_connection); + DBUG_VOID_RETURN; } void do_close_connection(struct st_command *command) { - char *p= command->first_argument, *name; - struct st_connection *con; - DBUG_ENTER("close_connection"); - DBUG_PRINT("enter",("name: '%s'",p)); - if (!*p) - die("Missing connection name in disconnect"); - name= p; - while (*p && !my_isspace(charset_info,*p)) - p++; + struct st_connection *con; + static DYNAMIC_STRING ds_connection; + const struct command_arg close_connection_args[] = { + { "connection_name", ARG_STRING, TRUE, &ds_connection, + "Name of the connection to close." } + }; + check_command_args(command, command->first_argument, + close_connection_args, + sizeof(close_connection_args)/sizeof(struct command_arg), + ' '); - if (*p) - *p++= 0; - command->last_argument= p; + DBUG_PRINT("enter",("connection name: '%s'", ds_connection.str)); - if (!(con= find_connection_by_name(name))) - die("connection '%s' not found in connection pool", name); + if (!(con= find_connection_by_name(ds_connection.str))) + die("connection '%s' not found in connection pool", ds_connection.str); DBUG_PRINT("info", ("Closing connection %s", con->name)); #ifndef EMBEDDED_LIBRARY @@ -4285,6 +4629,13 @@ void do_close_connection(struct st_command *command) if (!(con->name = my_strdup("-closed_connection-", MYF(MY_WME)))) die("Out of memory"); + if (con == cur_con) + { + /* Current connection was closed */ + var_set_int("$mysql_get_server_version", 0xFFFFFFFF); + var_set_string("$CURRENT_CONNECTION", con->name); + } + DBUG_VOID_RETURN; } @@ -4631,15 +4982,12 @@ void do_connect(struct st_command *command) if (!(con_slot->name= my_strdup(ds_connection_name.str, MYF(MY_WME)))) die("Out of memory"); con_slot->name_len= strlen(con_slot->name); - cur_con= con_slot; - + set_current_connection(con_slot); + if (con_slot == next_con) next_con++; /* if we used the next_con slot, advance the pointer */ } - /* Update $mysql_get_server_version to that of current connection */ - var_set_mysql_get_server_version(&cur_con->mysql); - dynstr_free(&ds_connection_name); dynstr_free(&ds_host); dynstr_free(&ds_user); @@ -5090,55 +5438,6 @@ void convert_to_format_v1(char* query) /* - Check a command that is about to be sent (or should have been - sent if parsing was enabled) to mysql server for - suspicious things and generate warnings. -*/ - -void scan_command_for_warnings(struct st_command *command) -{ - const char *ptr= command->query; - DBUG_ENTER("scan_command_for_warnings"); - DBUG_PRINT("enter", ("query: %s", command->query)); - - while(*ptr) - { - /* - Look for query's that lines that start with a -- comment - and has a mysqltest command - */ - if (ptr[0] == '\n' && - ptr[1] && ptr[1] == '-' && - ptr[2] && ptr[2] == '-' && - ptr[3]) - { - uint type; - char save; - char *end, *start= (char*)ptr+3; - /* Skip leading spaces */ - while (*start && my_isspace(charset_info, *start)) - start++; - end= start; - /* Find end of command(next space) */ - while (*end && !my_isspace(charset_info, *end)) - end++; - save= *end; - *end= 0; - DBUG_PRINT("info", ("Checking '%s'", start)); - type= find_type(start, &command_typelib, 1+2); - if (type) - warning_msg("Embedded mysqltest command '--%s' detected in " - "query '%s' was this intentional? ", - start, command->query); - *end= save; - } - - ptr++; - } - DBUG_VOID_RETURN; -} - -/* Check for unexpected "junk" after the end of query This is normally caused by missing delimiters or when switching between different delimiters @@ -5195,6 +5494,19 @@ void check_eol_junk(const char *eol) } +bool is_delimiter(const char* p) +{ + uint match= 0; + char* delim= delimiter; + while (*p && *p == *delim++) + { + match++; + p++; + } + + return (match == delimiter_length); +} + /* Create a command from a set of lines @@ -5261,9 +5573,11 @@ int read_command(struct st_command** command_ptr) if (!(command->query_buf= command->query= my_strdup(p, MYF(MY_WME)))) die("Out of memory"); - /* Calculate first word length(the command), terminated by space or ( */ + /* + Calculate first word length(the command), terminated + by 'space' , '(' or 'delimiter' */ p= command->query; - while (*p && !my_isspace(charset_info, *p) && *p != '(') + while (*p && !my_isspace(charset_info, *p) && *p != '(' && !is_delimiter(p)) p++; command->first_word_len= (uint) (p - command->query); DBUG_PRINT("info", ("first_word: %.*s", @@ -5487,7 +5801,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), DBUG_ASSERT(cur_file == file_stack && cur_file->file == 0); if (!(cur_file->file= my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(0)))) - die("Could not open '%s' for reading: errno = %d", buff, errno); + die("Could not open '%s' for reading, errno: %d", buff, errno); cur_file->file_name= my_strdup(buff, MYF(MY_FAE)); cur_file->lineno= 1; break; @@ -5533,6 +5847,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), die("Can't use server argument"); } break; + case OPT_LOG_DIR: + /* Check that the file exists */ + if (access(opt_logdir, F_OK) != 0) + die("The specified log directory does not exist: '%s'", opt_logdir); + break; case 'F': read_embedded_server_arguments(argument); break; @@ -5584,6 +5903,13 @@ int parse_args(int argc, char **argv) memcpy(global_subst_to, comma+1, strlen(comma)); } + if (!record) + { + /* Check that the result file exists */ + if (result_file_name && access(result_file_name, F_OK) != 0) + die("The specified result file '%s' does not exist", result_file_name); + } + return 0; } @@ -5614,11 +5940,11 @@ void str_to_file2(const char *fname, char *str, int size, my_bool append) flags|= O_TRUNC; if ((fd= my_open(buff, flags, MYF(MY_WME | MY_FFNF))) < 0) - die("Could not open '%s' for writing: errno = %d", buff, errno); + die("Could not open '%s' for writing, errno: %d", buff, errno); if (append && my_seek(fd, 0, SEEK_END, MYF(0)) == MY_FILEPOS_ERROR) - die("Could not find end of file '%s': errno = %d", buff, errno); + die("Could not find end of file '%s', errno: %d", buff, errno); if (my_write(fd, (uchar*)str, size, MYF(MY_WME|MY_FNABP))) - die("write failed"); + die("write failed, errno: %d", errno); my_close(fd, MYF(0)); } @@ -5638,37 +5964,6 @@ void str_to_file(const char *fname, char *str, int size) } -void dump_result_to_log_file(char *buf, int size) -{ - char log_file[FN_REFLEN]; - str_to_file(fn_format(log_file, result_file_name, opt_logdir, ".log", - *opt_logdir ? MY_REPLACE_DIR | MY_REPLACE_EXT : - MY_REPLACE_EXT), - buf, size); - fprintf(stderr, "\nMore results from queries before failure can be found in %s\n", - log_file); -} - -void dump_progress(void) -{ - char progress_file[FN_REFLEN]; - str_to_file(fn_format(progress_file, result_file_name, - opt_logdir, ".progress", - *opt_logdir ? MY_REPLACE_DIR | MY_REPLACE_EXT : - MY_REPLACE_EXT), - ds_progress.str, ds_progress.length); -} - -void dump_warning_messages(void) -{ - char warn_file[FN_REFLEN]; - - str_to_file(fn_format(warn_file, result_file_name, opt_logdir, ".warnings", - *opt_logdir ? MY_REPLACE_DIR | MY_REPLACE_EXT : - MY_REPLACE_EXT), - ds_warning_messages.str, ds_warning_messages.length); -} - void check_regerr(my_regex_t* r, int err) { char err_buf[1024]; @@ -5780,7 +6075,7 @@ void fix_win_paths(const char *val, int len) DBUG_PRINT("info", ("pattern: %s", *pattern)); /* Search for the path in string */ - while ((p= strstr(val, *pattern))) + while ((p= strstr((char*)val, *pattern))) { DBUG_PRINT("info", ("Found %s in val p: %s", *pattern, p)); @@ -5913,7 +6208,7 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt, { uint max_length= fields[i].max_length + 1; my_bind[i].buffer_type= MYSQL_TYPE_STRING; - my_bind[i].buffer= (char *)my_malloc(max_length, MYF(MY_WME | MY_FAE)); + my_bind[i].buffer= my_malloc(max_length, MYF(MY_WME | MY_FAE)); my_bind[i].buffer_length= max_length; my_bind[i].is_null= &is_null[i]; my_bind[i].length= &length[i]; @@ -5929,7 +6224,7 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt, while (mysql_stmt_fetch(stmt) == 0) { for (i= 0; i < num_fields; i++) - append_field(ds, i, &fields[i], my_bind[i].buffer, + append_field(ds, i, &fields[i], (char*)my_bind[i].buffer, *my_bind[i].length, *my_bind[i].is_null); if (!display_result_vertically) dynstr_append_mem(ds, "\n", 1); @@ -6683,9 +6978,6 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) init_dynamic_string(&ds_warnings, NULL, 0, 256); - /* Scan for warning before sending to server */ - scan_command_for_warnings(command); - /* Evaluate query if this is an eval command */ @@ -7015,28 +7307,10 @@ void get_command_type(struct st_command* command) } else { - /* -- comment that didn't contain a mysqltest command */ - command->type= Q_COMMENT; - warning_msg("Suspicious command '--%s' detected, was this intentional? "\ - "Use # instead of -- to avoid this warning", - command->query); - - if (command->first_word_len && - strcmp(command->query + command->first_word_len - 1, delimiter) == 0) - { - /* - Detect comment with command using extra delimiter - Ex --disable_query_log; - ^ Extra delimiter causing the command - to be skipped - */ - save= command->query[command->first_word_len-1]; - command->query[command->first_word_len-1]= 0; - if (find_type(command->query, &command_typelib, 1+2) > 0) - die("Extra delimiter \";\" found"); - command->query[command->first_word_len-1]= save; - - } + /* -- "comment" that didn't contain a mysqltest command */ + die("Found line beginning with -- that didn't contain "\ + "a valid mysqltest command, check your syntax or "\ + "use # if you intended to write a comment"); } } @@ -7055,22 +7329,25 @@ void get_command_type(struct st_command* command) /* Record how many milliseconds it took to execute the test file - up until the current line and save it in the dynamic string ds_progress. - - The ds_progress will be dumped to <test_name>.progress when - test run completes + up until the current line and write it to .progress file */ void mark_progress(struct st_command* command __attribute__((unused)), int line) { + static ulonglong progress_start= 0; // < Beware + DYNAMIC_STRING ds_progress; + char buf[32], *end; ulonglong timer= timer_now(); if (!progress_start) progress_start= timer; timer-= progress_start; + if (init_dynamic_string(&ds_progress, "", 256, 256)) + die("Out of memory"); + /* Milliseconds since start */ end= longlong2str(timer, buf, 10); dynstr_append_mem(&ds_progress, buf, (int)(end-buf)); @@ -7092,6 +7369,10 @@ void mark_progress(struct st_command* command __attribute__((unused)), dynstr_append_mem(&ds_progress, "\n", 1); + progress_file.write(&ds_progress); + + dynstr_free(&ds_progress); + } #ifdef HAVE_STACKTRACE @@ -7126,6 +7407,13 @@ static sig_handler signal_handler(int sig) { fprintf(stderr, "mysqltest got " SIGNAL_FMT "\n", sig); dump_backtrace(); + + fprintf(stderr, "Writing a core file...\n"); + fflush(stderr); + my_write_core(sig); +#ifndef __WIN__ + exit(1); // Shouldn't get here but just in case +#endif } #ifdef __WIN__ @@ -7200,7 +7488,6 @@ int main(int argc, char **argv) my_bool q_send_flag= 0, abort_flag= 0; uint command_executed= 0, last_command_executed= 0; char save_file[FN_REFLEN]; - MY_STAT res_info; MY_INIT(argv[0]); save_file[0]= 0; @@ -7259,11 +7546,14 @@ int main(int argc, char **argv) init_win_path_patterns(); #endif - init_dynamic_string(&ds_res, "", 65536, 65536); - init_dynamic_string(&ds_progress, "", 0, 2048); - init_dynamic_string(&ds_warning_messages, "", 0, 2048); + init_dynamic_string(&ds_res, "", 2048, 2048); + parse_args(argc, argv); + log_file.open(opt_logdir, result_file_name, ".log"); + if (opt_mark_progress) + progress_file.open(opt_logdir, result_file_name, ".progress"); + var_set_int("$PS_PROTOCOL", ps_protocol); var_set_int("$SP_PROTOCOL", sp_protocol); var_set_int("$VIEW_PROTOCOL", view_protocol); @@ -7291,37 +7581,37 @@ int main(int argc, char **argv) if (cursor_protocol_enabled) ps_protocol_enabled= 1; - cur_con= connections; - if (!( mysql_init(&cur_con->mysql))) + st_connection *con= connections; + if (!( mysql_init(&con->mysql))) die("Failed in mysql_init()"); if (opt_compress) - mysql_options(&cur_con->mysql,MYSQL_OPT_COMPRESS,NullS); - mysql_options(&cur_con->mysql, MYSQL_OPT_LOCAL_INFILE, 0); - mysql_options(&cur_con->mysql, MYSQL_SET_CHARSET_NAME, + mysql_options(&con->mysql,MYSQL_OPT_COMPRESS,NullS); + mysql_options(&con->mysql, MYSQL_OPT_LOCAL_INFILE, 0); + mysql_options(&con->mysql, MYSQL_SET_CHARSET_NAME, charset_info->csname); if (opt_charsets_dir) - mysql_options(&cur_con->mysql, MYSQL_SET_CHARSET_DIR, + mysql_options(&con->mysql, MYSQL_SET_CHARSET_DIR, opt_charsets_dir); #ifdef HAVE_OPENSSL if (opt_use_ssl) { - mysql_ssl_set(&cur_con->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, + mysql_ssl_set(&con->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, opt_ssl_capath, opt_ssl_cipher); #if MYSQL_VERSION_ID >= 50000 /* Turn on ssl_verify_server_cert only if host is "localhost" */ opt_ssl_verify_server_cert= opt_host && !strcmp(opt_host, "localhost"); - mysql_options(&cur_con->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, + mysql_options(&con->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, &opt_ssl_verify_server_cert); #endif } #endif - if (!(cur_con->name = my_strdup("default", MYF(MY_WME)))) + if (!(con->name = my_strdup("default", MYF(MY_WME)))) die("Out of memory"); - safe_connect(&cur_con->mysql, cur_con->name, opt_host, opt_user, opt_pass, + safe_connect(&con->mysql, con->name, opt_host, opt_user, opt_pass, opt_db, opt_port, unix_sock); /* Use all time until exit if no explicit 'start_timer' */ @@ -7334,8 +7624,7 @@ int main(int argc, char **argv) */ var_set_errno(-1); - /* Update $mysql_get_server_version to that of current connection */ - var_set_mysql_get_server_version(&cur_con->mysql); + set_current_connection(con); if (opt_include) { @@ -7352,8 +7641,8 @@ int main(int argc, char **argv) command->type != Q_ENABLE_PARSING && command->type != Q_DISABLE_PARSING) { + /* Parsing is disabled, silently convert this line to a comment */ command->type= Q_COMMENT; - scan_command_for_warnings(command); } if (cur_block->ok) @@ -7524,15 +7813,23 @@ int main(int argc, char **argv) select_connection(command); else select_connection_name("slave"); - do_sync_with_master2(0); + do_sync_with_master2(command, 0); break; } case Q_COMMENT: /* Ignore row */ command->last_argument= command->end; break; case Q_PING: - (void) mysql_ping(&cur_con->mysql); - break; + handle_command_error(command, mysql_ping(&cur_con->mysql)); + break; + case Q_SEND_SHUTDOWN: + handle_command_error(command, + mysql_shutdown(&cur_con->mysql, + SHUTDOWN_DEFAULT)); + break; + case Q_SHUTDOWN_SERVER: + do_shutdown_server(command); + break; case Q_EXEC: do_exec(command); command_executed++; @@ -7641,8 +7938,15 @@ int main(int argc, char **argv) parser.current_line += current_line_inc; if ( opt_mark_progress ) mark_progress(command, parser.current_line); + + /* Write result from command to log file immediately */ + log_file.write(&ds_res); + log_file.flush(); + dynstr_set(&ds_res, 0); } + log_file.close(); + start_lineno= 0; if (parsing_disabled) @@ -7651,9 +7955,9 @@ int main(int argc, char **argv) /* The whole test has been executed _sucessfully_. Time to compare result or save it to record file. - The entire output from test is now kept in ds_res. + The entire output from test is in the log file */ - if (ds_res.length) + if (log_file.bytes_written()) { if (result_file_name) { @@ -7661,22 +7965,29 @@ int main(int argc, char **argv) if (record) { - /* Recording - dump the output from test to result file */ - str_to_file(result_file_name, ds_res.str, ds_res.length); + /* Recording */ + + /* save a copy of the log to result file */ + if (my_copy(log_file.file_name(), result_file_name, MYF(0)) != 0) + die("Failed to copy '%s' to '%s', errno: %d", + log_file.file_name(), result_file_name, errno); + } else { - /* Check that the output from test is equal to result file - - detect missing result file - - detect zero size result file - */ - check_result(&ds_res); + /* Check that the output from test is equal to result file */ + check_result(); } } else { - /* No result_file_name specified to compare with, print to stdout */ - printf("%s", ds_res.str); + /* + No result_file_name specified, the result + has been printed to stdout, exit with error + unless script has called "exit" to indicate success + */ + if (abort_flag == 0) + die("Exit with failure! Call 'exit' in script to return with sucess"); } } else @@ -7684,25 +7995,8 @@ int main(int argc, char **argv) die("The test didn't produce any output"); } - if (!command_executed && - result_file_name && my_stat(result_file_name, &res_info, 0)) - { - /* - 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. - 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 - no query output from the test file, e.g. regarded as no error. - */ + if (!command_executed && result_file_name) die("No queries executed but result file found!"); - } - - if ( opt_mark_progress && result_file_name ) - dump_progress(); - - /* Dump warning messages */ - if (result_file_name && ds_warning_messages.length) - dump_warning_messages(); timer_output(); /* Yes, if we got this far the test has suceeded! Sakila smiles */ @@ -7771,12 +8065,11 @@ void do_get_replace_column(struct st_command *command) die("Missing argument in %s", command->query); /* Allocate a buffer for results */ - start= buff= my_malloc(strlen(from)+1,MYF(MY_WME | MY_FAE)); + start= buff= (char*)my_malloc(strlen(from)+1,MYF(MY_WME | MY_FAE)); while (*from) { char *to; uint column_number; - to= get_string(&buff, &from, command); if (!(column_number= atoi(to)) || column_number > MAX_COLUMNS) die("Wrong column number to replace_column in '%s'", command->query); @@ -7854,7 +8147,7 @@ void do_get_replace(struct st_command *command) bzero((char*) &from_array,sizeof(from_array)); if (!*from) die("Missing argument in %s", command->query); - start= buff= my_malloc(strlen(from)+1,MYF(MY_WME | MY_FAE)); + start= buff= (char*)my_malloc(strlen(from)+1,MYF(MY_WME | MY_FAE)); while (*from) { char *to= buff; @@ -7862,6 +8155,9 @@ void do_get_replace(struct st_command *command) if (!*from) die("Wrong number of arguments to replace_result in '%s'", command->query); +#ifdef __WIN__ + fix_win_paths(to, from - to); +#endif insert_pointer_name(&from_array,to); to= get_string(&buff, &from, command); insert_pointer_name(&to_array,to); diff --git a/config/ac-macros/ha_ndbcluster.m4 b/config/ac-macros/ha_ndbcluster.m4 index 9df96a7750b..5ee136f2266 100644 --- a/config/ac-macros/ha_ndbcluster.m4 +++ b/config/ac-macros/ha_ndbcluster.m4 @@ -280,7 +280,7 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [ esac # libndbclient versioning when linked with GNU ld. - if $LD --version 2>/dev/null|grep -q GNU; then + if $LD --version 2>/dev/null|grep GNU >/dev/null 2>&1 ; then NDB_LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_builddir)/storage/ndb/src/libndb.ver" AC_CONFIG_FILES(storage/ndb/src/libndb.ver) fi diff --git a/configure.in b/configure.in index 3636398abc2..46d9fdc433a 100644 --- a/configure.in +++ b/configure.in @@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM # # When changing major version number please also check switch statement # in mysqlbinlog::check_master_version(). -AM_INIT_AUTOMAKE(mysql, 5.1.31-maria-alpha) +AM_INIT_AUTOMAKE(mysql, 5.1.32-maria-beta) AM_CONFIG_HEADER([include/config.h:config.h.in]) PROTOCOL_VERSION=10 @@ -375,7 +375,7 @@ fi MYSQL_PROG_AR # libmysqlclient versioning when linked with GNU ld. -if $LD --version 2>/dev/null|grep -q GNU; then +if $LD --version 2>/dev/null| grep GNU >/dev/null 2>&1; then LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_builddir)/libmysql/libmysql.ver" AC_CONFIG_FILES(libmysql/libmysql.ver) fi @@ -447,11 +447,11 @@ AC_SUBST(PERL5) # Enable the abi_check rule only if gcc is available -if expr "$CC" : ".*gcc.*" +if test "$GCC" != "yes" || expr "$CC" : ".*icc.*" then - ABI_CHECK="abi_check" -else ABI_CHECK="" +else + ABI_CHECK="abi_check" fi AC_SUBST(ABI_CHECK) @@ -2805,8 +2805,8 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl server-tools/Makefile server-tools/instance-manager/Makefile dnl cmd-line-utils/Makefile cmd-line-utils/libedit/Makefile dnl libmysqld/Makefile libmysqld/examples/Makefile dnl - mysql-test/Makefile dnl - mysql-test/ndb/Makefile netware/Makefile sql-bench/Makefile dnl + mysql-test/Makefile mysql-test/lib/My/SafeProcess/Makefile dnl + netware/Makefile sql-bench/Makefile dnl include/mysql_version.h plugin/Makefile win/Makefile) AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h) diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c index 5606c17ecf3..447d63890bd 100644 --- a/extra/resolve_stack_dump.c +++ b/extra/resolve_stack_dump.c @@ -290,7 +290,8 @@ static void do_resolve() char buf[1024], *p; while (fgets(buf, sizeof(buf), fp_dump)) { - p = buf; + /* skip bracket */ + p= (p= strchr(buf, '[')) ? p+1 : buf; /* skip space */ while (my_isspace(&my_charset_latin1,*p)) ++p; diff --git a/extra/yassl/include/openssl/ssl.h b/extra/yassl/include/openssl/ssl.h index de09f1ebe4b..05b34a0dc45 100644 --- a/extra/yassl/include/openssl/ssl.h +++ b/extra/yassl/include/openssl/ssl.h @@ -203,8 +203,8 @@ SSL_CTX* SSL_CTX_new(SSL_METHOD*); SSL* SSL_new(SSL_CTX*); int SSL_set_fd (SSL*, YASSL_SOCKET_T); YASSL_SOCKET_T SSL_get_fd(const SSL*); -int SSL_connect(SSL*); // if you get an error from connect - // see note at top of REAMDE +int SSL_connect(SSL*); /* if you get an error from connect + see note at top of REAMDE */ int SSL_write(SSL*, const void*, int); int SSL_read(SSL*, void*, int); int SSL_accept(SSL*); diff --git a/include/config-win.h b/include/config-win.h index aab401346da..fd50c705b7d 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -260,6 +260,15 @@ inline double ulonglong2double(ulonglong value) #define my_off_t2double(A) ulonglong2double(A) #endif /* _WIN64 */ +inline ulonglong double2ulonglong(double d) +{ + double t= d - (double) 0x8000000000000000ULL; + + if (t >= 0) + return ((ulonglong) t) + 0x8000000000000000ULL; + return (ulonglong) d; +} + #if SIZEOF_OFF_T > 4 #define lseek(A,B,C) _lseeki64((A),(longlong) (B),(C)) #define tell(A) _telli64(A) @@ -381,6 +390,9 @@ inline double ulonglong2double(ulonglong value) #define HAVE_OPENSSL 1 #define HAVE_YASSL 1 +#define COMMUNITY_SERVER 1 +#define ENABLED_PROFILING 1 + /* Define charsets you want */ /* #undef HAVE_CHARSET_armscii8 */ /* #undef HAVE_CHARSET_ascii */ diff --git a/include/hash.h b/include/hash.h index 1942e9974be..f649b39a3cb 100644 --- a/include/hash.h +++ b/include/hash.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/include/m_ctype.h b/include/m_ctype.h index b85894e94f5..04cf921dfee 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -472,6 +472,7 @@ my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, size_t len); uint my_string_repertoire(CHARSET_INFO *cs, const char *str, ulong len); my_bool my_charset_is_ascii_based(CHARSET_INFO *cs); my_bool my_charset_is_8bit_pure_ascii(CHARSET_INFO *cs); +uint my_charset_repertoire(CHARSET_INFO *cs); #define _MY_U 01 /* Upper case */ diff --git a/include/my_global.h b/include/my_global.h index 6712198e2f0..554b26a1602 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -798,6 +798,9 @@ typedef SOCKET_SIZE_TYPE size_socket; #define ulonglong2double(A) ((double) (ulonglong) (A)) #define my_off_t2double(A) ((double) (my_off_t) (A)) #endif +#ifndef double2ulonglong +#define double2ulonglong(A) ((ulonglong) (double) (A)) +#endif #endif #ifndef offsetof @@ -1138,6 +1141,9 @@ typedef char bool; /* Ordinary boolean values 0 1 */ #define dbug_volatile #endif +/* Some helper macros */ +#define YESNO(X) ((X) ? "yes" : "no") + /* Defines for time function */ #define SCALE_SEC 100 #define SCALE_USEC 10000 diff --git a/include/my_pthread.h b/include/my_pthread.h index 538457a523a..c479e6f72c6 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -679,6 +679,8 @@ extern const char *my_thread_name(void); extern my_thread_id my_thread_dbug_id(void); extern int pthread_no_free(void *); extern int pthread_dummy(int); +extern void my_mutex_init(); +extern void my_mutex_end(); /* All thread specific variables are in the following struct */ diff --git a/include/thr_lock.h b/include/thr_lock.h index cf27527cad4..261f596f911 100644 --- a/include/thr_lock.h +++ b/include/thr_lock.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt index 346278425a7..fa9711b54da 100644 --- a/libmysqld/examples/CMakeLists.txt +++ b/libmysqld/examples/CMakeLists.txt @@ -32,7 +32,7 @@ ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc TARGET_LINK_LIBRARIES(mysql_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32) ADD_DEPENDENCIES(mysql_embedded libmysqld) -ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.c) +ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.cc) TARGET_LINK_LIBRARIES(mysqltest_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32) ADD_DEPENDENCIES(mysqltest_embedded libmysqld) diff --git a/libmysqld/examples/Makefile.am b/libmysqld/examples/Makefile.am index 3425b48645f..109d33a85ae 100644 --- a/libmysqld/examples/Makefile.am +++ b/libmysqld/examples/Makefile.am @@ -41,7 +41,7 @@ LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @LIBDL@ $(CXXLDFLAGS) \ @NDB_SCI_LIBS@ mysqltest_embedded_LINK = $(CXXLINK) -nodist_mysqltest_embedded_SOURCES = mysqltest.c +nodist_mysqltest_embedded_SOURCES = mysqltest.cc mysqltest_embedded_LDADD = $(LDADD) $(top_builddir)/regex/libregex.a nodist_mysql_SOURCES = mysql.cc readline.cc completion_hash.cc \ diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index 4d321f53ffa..0db8ba825ca 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -17,132 +17,110 @@ ## Process this file with automake to create Makefile.in -SUBDIRS = ndb +testdir = $(prefix)/mysql-test -benchdir_root= $(prefix) -testdir = $(benchdir_root)/mysql-test -EXTRA_SCRIPTS = mysql-test-run-shell.sh install_test_db.sh \ - valgrind.supp $(PRESCRIPTS) -EXTRA_DIST = $(EXTRA_SCRIPTS) suite -GENSCRIPTS = mysql-test-run-shell install_test_db mtr mysql-test-run -PRESCRIPTS = mysql-test-run.pl mysql-stress-test.pl -test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS) -CLEANFILES = $(GENSCRIPTS) +test_SCRIPTS = mtr \ + mysql-test-run \ + mysql-test-run.pl \ + mysql-stress-test.pl -INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I.. +nobase_test_DATA = \ + lib/v1/mysql-test-run.pl \ + lib/v1/mtr_cases.pl \ + lib/v1/mtr_io.pl \ + lib/v1/mtr_report.pl \ + lib/v1/My/Config.pm \ + lib/v1/mtr_gcov.pl \ + lib/v1/mtr_match.pl \ + lib/v1/mtr_stress.pl \ + lib/v1/ndb_config_1_node.ini \ + lib/v1/ndb_config_2_node.ini \ + lib/v1/mtr_gprof.pl \ + lib/v1/mtr_misc.pl \ + lib/v1/mtr_timer.pl \ + lib/v1/mtr_im.pl \ + lib/v1/mtr_process.pl \ + lib/v1/mtr_unique.pl \ +\ + lib/mtr_cases.pm \ + lib/mtr_gcov.pl \ + lib/mtr_gprof.pl \ + lib/mtr_io.pl \ + lib/mtr_match.pm \ + lib/mtr_misc.pl \ + lib/mtr_process.pl \ + lib/mtr_report.pm \ + lib/mtr_stress.pl \ + lib/mtr_unique.pm \ + lib/My/ConfigFactory.pm \ + lib/My/Config.pm \ + lib/My/Find.pm \ + lib/My/Handles.pm \ + lib/My/Options.pm \ + lib/My/Test.pm \ + lib/My/Platform.pm \ + lib/My/SafeProcess.pm \ + lib/My/File/Path.pm \ + lib/My/SysInfo.pm \ + lib/My/CoreDump.pm \ + lib/My/SafeProcess/Base.pm \ + lib/My/SafeProcess/safe_process.pl +SUBDIRS = lib/My/SafeProcess + +EXTRA_DIST = README \ + valgrind.supp \ + $(test_SCRIPTS) \ + $(nobase_test_DATA) + +# List of directories containing test + result files and the +# related test data files that should be copied +TEST_DIRS = t r include std_data std_data/parts \ + std_data/ndb_backup50 std_data/ndb_backup51 \ + std_data/ndb_backup51_data_be std_data/ndb_backup51_data_le \ + extra/binlog_tests/ extra/rpl_tests \ + suite/binlog suite/binlog/t suite/binlog/r suite/binlog/std_data \ + suite/bugs/data suite/bugs/t suite/bugs/r \ + suite/federated \ + suite/funcs_1 suite/funcs_1/bitdata \ + suite/funcs_1/include suite/funcs_1/lib suite/funcs_1/r \ + suite/funcs_1/t suite/funcs_1/views suite/funcs_1/cursors \ + suite/funcs_1/datadict suite/funcs_1/storedproc suite/funcs_1/triggers \ + suite/funcs_2 suite/funcs_2/charset suite/funcs_2/data \ + suite/funcs_2/include suite/funcs_2/lib suite/funcs_2/r \ + suite/funcs_2/t \ + suite/jp suite/jp/t suite/jp/r suite/jp/std_data \ + suite/manual/t suite/manual/r \ + suite/ndb_team suite/ndb_team/t suite/ndb_team/r \ + suite/rpl suite/rpl/data suite/rpl/include suite/rpl/r \ + suite/rpl/t \ + suite/stress/include suite/stress/t suite/stress/r \ + suite/ndb suite/ndb/t suite/ndb/r \ + suite/rpl_ndb suite/rpl_ndb/t suite/rpl_ndb/r \ + suite/parts suite/parts/t suite/parts/r suite/parts/inc + +# Used by dist-hook and install-data-local to copy all +# test files into either dist or install directory +install_test_files: + @if test -z "$(INSTALL_TO_DIR)"; then \ + echo "Set INSTALL_TO_DIR!" && exit 1; \ + fi + @for dir in $(TEST_DIRS); do \ + from_dir="$(srcdir)/$$dir"; \ + to_dir="$(INSTALL_TO_DIR)/$$dir"; \ + $(mkinstalldirs) "$$to_dir"; \ + for f in `(cd $$from_dir && ls)`; do \ + if test -f "$$from_dir/$$f"; then \ + $(INSTALL_DATA) "$$from_dir/$$f" "$$to_dir/$$f" ; \ + fi; \ + done \ + done dist-hook: - mkdir -p \ - $(distdir)/t \ - $(distdir)/extra/binlog_tests \ - $(distdir)/extra/rpl_tests \ - $(distdir)/r \ - $(distdir)/include \ - $(distdir)/std_data \ - $(distdir)/std_data/ndb_backup50 \ - $(distdir)/std_data/ndb_backup51 \ - $(distdir)/std_data/ndb_backup51_data_be \ - $(distdir)/std_data/ndb_backup51_data_le \ - $(distdir)/std_data/parts \ - $(distdir)/lib \ - $(distdir)/std_data/funcs_1 \ - $(distdir)/lib/My - -$(INSTALL_DATA) $(srcdir)/t/*.def $(distdir)/t - $(INSTALL_DATA) $(srcdir)/t/*.test $(distdir)/t - -$(INSTALL_DATA) $(srcdir)/t/*.imtest $(distdir)/t - $(INSTALL_DATA) $(srcdir)/t/*.sql $(distdir)/t - -$(INSTALL_DATA) $(srcdir)/t/*.disabled $(distdir)/t - -$(INSTALL_DATA) $(srcdir)/t/*.opt $(srcdir)/t/*.slave-mi $(distdir)/t - -$(INSTALL_SCRIPT) $(srcdir)/t/*.sh $(distdir)/t - $(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.test $(distdir)/extra/binlog_tests - $(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.test $(distdir)/extra/rpl_tests - -$(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.opt $(distdir)/extra/binlog_tests - -$(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.opt $(distdir)/extra/rpl_tests - $(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include - $(INSTALL_DATA) $(srcdir)/include/*.sql $(distdir)/include - $(INSTALL_DATA) $(srcdir)/include/*.test $(distdir)/include - $(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r - $(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(distdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/Index.xml $(distdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.000001 $(distdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/*.frm $(distdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(distdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/*.txt $(distdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(distdir)/std_data/ndb_backup50 - $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(distdir)/std_data/ndb_backup51 - $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51_data_be/BACKUP* $(distdir)/std_data/ndb_backup51_data_be - $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51_data_le/BACKUP* $(distdir)/std_data/ndb_backup51_data_le - $(INSTALL_DATA) $(srcdir)/std_data/parts/part_* $(distdir)/std_data/parts - $(INSTALL_DATA) $(srcdir)/std_data/parts/*.MY* $(distdir)/std_data/parts - $(INSTALL_DATA) $(srcdir)/std_data/funcs_1/* $(distdir)/std_data/funcs_1 - $(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib - $(INSTALL_DATA) $(srcdir)/lib/My/*.pm $(distdir)/lib/My - -rm -rf `find $(distdir)/suite -type d -name SCCS` $(distdir)/suite/row_lock + $(MAKE) INSTALL_TO_DIR="$(distdir)" install_test_files install-data-local: - $(mkinstalldirs) \ - $(DESTDIR)$(testdir)/t \ - $(DESTDIR)$(testdir)/extra/binlog_tests \ - $(DESTDIR)$(testdir)/extra/rpl_tests \ - $(DESTDIR)$(testdir)/r \ - $(DESTDIR)$(testdir)/include \ - $(DESTDIR)$(testdir)/std_data \ - $(DESTDIR)$(testdir)/std_data/ndb_backup50 \ - $(DESTDIR)$(testdir)/std_data/ndb_backup51 \ - $(DESTDIR)$(testdir)/std_data/ndb_backup51_data_be \ - $(DESTDIR)$(testdir)/std_data/ndb_backup51_data_le \ - $(DESTDIR)$(testdir)/std_data/parts \ - $(DESTDIR)$(testdir)/lib \ - $(DESTDIR)$(testdir)/std_data/funcs_1 \ - $(DESTDIR)$(testdir)/lib/My - $(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(testdir) - -$(INSTALL_DATA) $(srcdir)/t/*.def $(DESTDIR)$(testdir)/t - $(INSTALL_DATA) $(srcdir)/t/*.test $(DESTDIR)$(testdir)/t - -$(INSTALL_DATA) $(srcdir)/t/*.imtest $(DESTDIR)$(testdir)/t - $(INSTALL_DATA) $(srcdir)/t/*.sql $(DESTDIR)$(testdir)/t - -$(INSTALL_DATA) $(srcdir)/t/*.disabled $(DESTDIR)$(testdir)/t - -$(INSTALL_DATA) $(srcdir)/t/*.opt $(DESTDIR)$(testdir)/t - -$(INSTALL_SCRIPT) $(srcdir)/t/*.sh $(DESTDIR)$(testdir)/t - -$(INSTALL_DATA) $(srcdir)/t/*.slave-mi $(DESTDIR)$(testdir)/t - $(INSTALL_DATA) $(srcdir)/r/*.result $(DESTDIR)$(testdir)/r - $(INSTALL_DATA) $(srcdir)/r/*.require $(DESTDIR)$(testdir)/r - $(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.test $(DESTDIR)$(testdir)/extra/binlog_tests - $(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.test $(DESTDIR)$(testdir)/extra/rpl_tests - -$(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.opt $(DESTDIR)$(testdir)/extra/binlog_tests - -$(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.opt $(DESTDIR)$(testdir)/extra/rpl_tests - $(INSTALL_DATA) $(srcdir)/include/*.inc $(DESTDIR)$(testdir)/include - $(INSTALL_DATA) $(srcdir)/include/*.sql $(DESTDIR)$(testdir)/include - $(INSTALL_DATA) $(srcdir)/include/*.test $(DESTDIR)$(testdir)/include - $(INSTALL_DATA) $(srcdir)/std_data/*.dat $(DESTDIR)$(testdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/*.*001 $(DESTDIR)$(testdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(DESTDIR)$(testdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/Index.xml $(DESTDIR)$(testdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/*.frm $(DESTDIR)$(testdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(DESTDIR)$(testdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/*.txt $(DESTDIR)$(testdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup50 - $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup51 - $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51_data_be/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup51_data_be - $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51_data_le/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup51_data_le - $(INSTALL_DATA) $(srcdir)/std_data/parts/part_* $(DESTDIR)$(testdir)/std_data/parts - $(INSTALL_DATA) $(srcdir)/std_data/parts/*.MY* $(DESTDIR)$(testdir)/std_data/parts - $(INSTALL_DATA) $(srcdir)/std_data/funcs_1/* $(DESTDIR)$(testdir)/std_data/funcs_1 - $(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib - $(INSTALL_DATA) $(srcdir)/lib/My/*.pm $(DESTDIR)$(testdir)/lib/My - for f in `(cd $(srcdir); find suite -type f | egrep -v 'SCCS|row_lock')`; \ - do \ - d=$(DESTDIR)$(testdir)/`dirname $$f`; \ - mkdir -p $$d ; \ - $(INSTALL_DATA) $(srcdir)/$$f $$d ; \ - done + $(MAKE) INSTALL_TO_DIR="$(DESTDIR)$(testdir)" install_test_files uninstall-local: @RM@ -f -r $(DESTDIR)$(testdir) @@ -157,31 +135,5 @@ mysql-test-run: $(RM) -f mysql-test-run $(LN_S) mysql-test-run.pl mysql-test-run -SUFFIXES = .sh - -.sh: - @RM@ -f $@ $@-t - @SED@ \ - -e 's!@''testdir''@!$(testdir)!g' \ - -e 's!@''bindir''@!$(bindir)!g' \ - -e 's!@''scriptdir''@!$(bindir)!g' \ - -e 's!@''prefix''@!$(prefix)!g' \ - -e 's!@''datadir''@!$(datadir)!g' \ - -e 's!@''localstatedir''@!$(localstatedir)!g' \ - -e 's!@''libexecdir''@!$(libexecdir)!g' \ - -e 's!@''PERL''@!@PERL@!' \ - -e 's!@''VERSION''@!@VERSION@!' \ - -e 's!@''MYSQL_TCP_PORT''@!@MYSQL_TCP_PORT@!' \ - -e 's!@''MYSQL_TCP_PORT_DEFAULT''@!@MYSQL_TCP_PORT_DEFAULT@!' \ - -e 's!@''MYSQL_BASE_VERSION''@!@MYSQL_BASE_VERSION@!' \ - -e 's!@''MYSQL_UNIX_ADDR''@!@MYSQL_UNIX_ADDR@!' \ - -e 's!@''MYSQL_TCP_PORT''@!@MYSQL_TCP_PORT@!' \ - -e 's!@''MYSQL_NO_DASH_VERSION''@!@MYSQL_NO_DASH_VERSION@!' \ - -e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \ - -e 's!@''USE_NDBCLUSTER''@!@TEST_NDBCLUSTER@!g' \ - $< > $@-t - @CHMOD@ +x $@-t - @MV@ $@-t $@ - # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/mysql-test/create-test-result b/mysql-test/create-test-result deleted file mode 100755 index ad19cdf08a1..00000000000 --- a/mysql-test/create-test-result +++ /dev/null @@ -1,65 +0,0 @@ -#! /bin/sh - -# This script is a hack for lazy developers who want to get a quick -# start on the result file. The code here is rather dirty, but it works -# If you have a spare moment feel free to improve it - the right way is -# to start mysqld yourself and run mysqltest -r - -RESULT_DIR=r -if [ -z "$EDITOR" ] ; then - EDITOR=vi -fi - -function die() -{ - echo $1 - exit 1 -} - -function usage() -{ - echo "Usage: $0 test_name" - exit 1 -} - -test_name=$1 - -[ -z "$test_name" ] && usage - -result_file=$RESULT_DIR/$test_name.result -reject_file=$RESULT_DIR/$test_name.reject - -[ -f $result_file ] && die "result file $result_file has already been created" - -touch $result_file -echo "Running the test case against empty file, will fail, but don't worry" -./mysql-test-run --local $test_name - -if [ -f $reject_file ] ; then - echo "Below are the contents of the reject file:" - echo "-----start---------------------" - cat $reject_file - echo "-----end-----------------------" - echo "Is this the output you expected from your test case?(y/n)[n]" - read yes_no - if [ x$yes_no = xy ] ; then - echo "Press any key to edit it in $EDITOR, or Ctrl-C to abort" - read junk - $EDITOR $reject_file - edited="edited" - fi - echo "Save $edited file as master result? (y/n)[y]" - read yes_no - if [ x$yes_no != xn ]; then - mv $reject_file $result_file - fi -else - echo "Your test failed so bad, it did not even produce a reject file" - echo "You need to fix your bugs in the test case, the code, or both" - exit 1 -fi - - - - - diff --git a/mysql-test/extra/binlog_tests/blackhole.test b/mysql-test/extra/binlog_tests/blackhole.test index e8671ed2da0..14c15a58e18 100644 --- a/mysql-test/extra/binlog_tests/blackhole.test +++ b/mysql-test/extra/binlog_tests/blackhole.test @@ -7,7 +7,7 @@ -- source include/have_log_bin.inc # The server need to be started in $MYSQLTEST_VARDIR since it -# uses ../std_data_ln/ +# uses ../../std_data/ -- source include/uses_vardir.inc --disable_warnings @@ -114,7 +114,7 @@ insert into t1 values(1); insert ignore into t1 values(1); replace into t1 values(100); create table t2 (a varchar(200)) engine=blackhole; -eval load data infile '../std_data_ln/words.dat' into table t2; +eval load data infile '../../std_data/words.dat' into table t2; alter table t1 add b int; alter table t1 drop b; create table t3 like t1; diff --git a/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test index fa374502997..b240109f6e6 100644 --- a/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test +++ b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test @@ -16,7 +16,8 @@ source include/show_binlog_events.inc; # escaped). flush logs; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001 +let $MYSQLD_DATADIR= `select @@datadir`; +--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 drop table t2; # End of 4.1 tests diff --git a/mysql-test/extra/binlog_tests/database.test b/mysql-test/extra/binlog_tests/database.test index 2e445f98adf..326ecedb60e 100644 --- a/mysql-test/extra/binlog_tests/database.test +++ b/mysql-test/extra/binlog_tests/database.test @@ -28,3 +28,5 @@ enable_warnings; insert into t1 values (1); drop table tt1, t1; source include/show_binlog_events.inc; + +FLUSH STATUS; diff --git a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test index 6879089a1b7..5db79e4f848 100644 --- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test +++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test @@ -317,17 +317,18 @@ connection con4; select get_lock("a",10); # wait for rollback to finish flush logs; +let $MYSQLD_DATADIR= `select @@datadir`; # we check that the error code of the "ROLLBACK" event is 0 and not # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction # and does not make slave to stop) if (`select @@binlog_format = 'ROW'`) { - --exec $MYSQL_BINLOG --start-position=524 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output + --exec $MYSQL_BINLOG --start-position=524 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output } if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`) { - --exec $MYSQL_BINLOG --start-position=555 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output + --exec $MYSQL_BINLOG --start-position=555 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output } --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR @@ -618,7 +619,7 @@ CREATE TABLE t5 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; # execute --error ER_DUP_ENTRY - load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2); + load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2); # check select * from t4; select count(*) from t1 /* must be 2 */; diff --git a/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test index 0a0bef4ca4d..26a70c4319e 100644 --- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test +++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test @@ -278,7 +278,7 @@ CREATE TABLE t5 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; # execute --error ER_DUP_ENTRY - load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2); + load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2); # check select * from t4; select count(*) from t1 /* must be 2 */; diff --git a/mysql-test/extra/rpl_tests/rpl_EE_err.test b/mysql-test/extra/rpl_tests/rpl_EE_err.test index b7b393c3d6f..205bbe79dac 100644 --- a/mysql-test/extra/rpl_tests/rpl_EE_err.test +++ b/mysql-test/extra/rpl_tests/rpl_EE_err.test @@ -20,7 +20,8 @@ eval create table t1 (a int) engine=$engine_type; flush tables; -remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI ; +let $MYSQLD_DATADIR= `select @@datadir`; +remove_file $MYSQLD_DATADIR/test/t1.MYI ; drop table if exists t1; save_master_pos; connection slave; diff --git a/mysql-test/extra/rpl_tests/rpl_auto_increment.test b/mysql-test/extra/rpl_tests/rpl_auto_increment.test index 1fa3cf034f6..24448a38408 100644 --- a/mysql-test/extra/rpl_tests/rpl_auto_increment.test +++ b/mysql-test/extra/rpl_tests/rpl_auto_increment.test @@ -145,6 +145,23 @@ select * from t3 order by a; connection master; drop table t1,t2,t3; +sync_slave_with_master; + +# +# BUG#41986 Replication slave does not pick up proper AUTO_INCREMENT value for Innodb tables +# +connection master; +set auto_increment_increment=1; +set auto_increment_offset=1; +CREATE TABLE t1 (id MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=innodb; +INSERT INTO t1 VALUES (NULL), (NULL), (NULL); +show create table t1; + +sync_slave_with_master; +show create table t1; + +connection master; +drop table t1; # End cleanup sync_slave_with_master; diff --git a/mysql-test/extra/rpl_tests/rpl_conflicts.test b/mysql-test/extra/rpl_tests/rpl_conflicts.test new file mode 100644 index 00000000000..8a98059b0ad --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_conflicts.test @@ -0,0 +1,168 @@ +# ==== Purpose ==== +# +# Test that slave behaves well in some conflict situations. The +# following are tested: +# +# - The slave SQL thread sees an 'INSERT' of a row with a key that +# already exists in the table; +# +# - The slave SQL thread sees a 'DELETE' of a row that does not +# exist in the table. +# +# In statement-logging mode, the first conflict type causes the slave +# to stop with an error and the second conflict is ignored. +# +# In row-logging mode, the slave behavior depends the value of +# @@slave_exec_mode on the slave: if @@slave_exec_mode is IDEMPOTENT, +# the slave should ignore the conflicting statement and continue +# normally. If @@slave_exec_mode is STRICT, the slave should stop +# with an error. +# +# This test was previously named rpl_stm_mystery22/rpl_row_mystery22. +# +# +# ==== Method ==== +# +# Create a table on master and slave, insert a row on slave, and +# insert the same row on master. +# +# Create a table on master and slave, insert a row on master with +# binlogging turned off, and remove the row on master with binlogging +# turned on. +# +# +# ==== Related bugs ==== +# +# BUG#31552: Replication breaks when deleting rows from out-of-sync table without PK +# BUG#31609: Not all RBR slave errors reported as errors +# +# Bug in this test case: +# BUG#37718: rpl.rpl_stm_mystery22 fails sporadically on pushbuild +# +# +# ==== Usage ==== +# +# This file assumes the following: +# +# - The test language variable $slave_is_idempotent is set to 1 if the +# slave is expected to stop on duplicate key errors (i.e., if the +# binlog is in statement mode or +# @@global.slave_exec_mode=STRICT). It is set to 0 otherwise. +# +# - Replication has been initialized by include/master-slave.inc +# +# - The test adds a suppression for the following warning: +# Slave: Can't find record in 't1' Error_code: 1032 + + +--echo ==== Initialize ==== + +--echo [on master] +connection master; +CREATE TABLE t1(a INT PRIMARY KEY); +--echo [on slave] +sync_slave_with_master; + + +--echo ==== Test: SQL thread sees 'INSERT' of existing key ==== + +--echo ---- Prepare slave so that it will get duplicate key error ---- +# This row will be in the way of the row inserted by master. +INSERT INTO t1 VALUES (1); + +--echo ---- Insert rows on master ---- +--echo [on master] +connection master; +# Insert the same row on master +INSERT INTO t1 VALUES (1); +save_master_pos; +SELECT * FROM t1; + +--echo [on slave] +connection slave; + +# If we are statement-logging or if slave_exec_mode=STRICT, we now +# expect to see an error on the slave. Otherwise (i.e., we are +# row-logging and slave_exec_mode=IDEMPOTENT), we expect that the +# duplicate row is ignored by the slave and replication continues. +if (`SELECT @@global.binlog_format != 'ROW' OR @@global.slave_exec_mode = 'STRICT'`) { + --echo ---- Wait until slave stops with an error ---- + # Wait until the slave tries to run the query, fails with duplicate + # key error, and stops the SQL thread. + let $slave_sql_errno= 1062; # ER_DUP_ENTRY + source include/wait_for_slave_sql_error.inc; + let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); + --echo Last_SQL_Error = $err (expected "duplicate key" error) + SELECT * FROM t1; + + --echo ---- Resolve the conflict on the slave and restart SQL thread ---- + DELETE FROM t1 WHERE a = 1; + START SLAVE SQL_THREAD; + source include/wait_for_slave_sql_to_start.inc; +} + +--echo ---- Sync slave and verify that there is no error ---- +sync_with_master; +let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); +--echo Last_SQL_Error = '$err' (expected no error) +SELECT * FROM t1; + + +--echo ==== Test: SQL thread sees 'DELETE' of non-existing row ==== + +--echo ---- On master, insert two rows, the second with binlogging off ---- +--echo [on master] +connection master; +DELETE FROM t1; +INSERT INTO t1 VALUES (1); + +--echo [on slave] +sync_slave_with_master; +DELETE FROM t1 WHERE a = 1; + +--echo ---- On master, remove the row that does not exist on slave ---- +--echo [on master] +connection master; +DELETE FROM t1 WHERE a = 1; +SELECT * FROM t1; +save_master_pos; + +--echo [on slave] +connection slave; + +# If we are row-logging and slave_exec_mode is STRICT, we now expect +# an error since the row to delete does not exist on slave. Otherwise +# (i.e., either we are statement-logging or slave_exec_mode is +# IDEMPOTENT), the absence of the row to delete is ignored and +# replication continues. +if (`SELECT @@global.binlog_format = 'ROW' AND @@global.slave_exec_mode = 'STRICT'`) { + --echo ---- Wait until slave stops with an error ---- + let $slave_sql_errno= 1032; # ER_KEY_NOT_FOUND + source include/wait_for_slave_sql_error.inc; + let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); + --echo Last_SQL_Error = $err (expected "can't find record" error) + SELECT * FROM t1; + + --echo ---- Resolve the conflict on the slave and restart SQL thread ---- + INSERT INTO t1 VALUES (1); + START SLAVE SQL_THREAD; + source include/wait_for_slave_sql_to_start.inc; +} + +--echo ---- Sync slave and verify that there is no error ---- +# The slave should sync ok, and SHOW SLAVE STATUS should give no +# error. +sync_with_master; +let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); +--echo Last_SQL_Error = $err (expected no error) +SELECT * FROM t1; + + +--echo ==== Clean up ==== + +--echo [on master] +connection master; +DROP TABLE t1; + +--echo [on slave] +sync_slave_with_master; diff --git a/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test b/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test index 5abd04b98ef..df0d6cf5045 100644 --- a/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test +++ b/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test @@ -497,7 +497,7 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT), --echo ******************************************** --echo connection slave; -wait_for_slave_to_stop; +source include/wait_for_slave_sql_to_stop.inc; --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # --query_vertical SHOW SLAVE STATUS @@ -554,7 +554,7 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT), --echo ******************************************** --echo connection slave; -wait_for_slave_to_stop; +source include/wait_for_slave_sql_to_stop.inc; --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # --query_vertical SHOW SLAVE STATUS @@ -697,7 +697,7 @@ SELECT c1,c3,hex(c4),c5,c6 FROM t14 ORDER BY c1; # Remove below once fixed #*************************** connection slave; -wait_for_slave_to_stop; +source include/wait_for_slave_sql_to_stop.inc; --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # --query_vertical SHOW SLAVE STATUS @@ -763,7 +763,7 @@ SELECT c1,hex(c4),c5,c6,c7,c2 FROM t15 ORDER BY c1; --echo ******************************************** --echo connection slave; -wait_for_slave_to_stop; +source include/wait_for_slave_sql_to_stop.inc; --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # --query_vertical SHOW SLAVE STATUS @@ -840,7 +840,7 @@ SELECT c1,hex(c4),c5,c6,c7 FROM t16 ORDER BY c1; --echo ***************** --echo connection slave; -wait_for_slave_to_stop; +source include/wait_for_slave_sql_to_stop.inc; --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # --query_vertical SHOW SLAVE STATUS diff --git a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test index 7e726828a1e..6890913b7d1 100644 --- a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test +++ b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test @@ -94,7 +94,7 @@ SELECT * FROM t2 ORDER BY a; --echo *** Start Slave *** connection slave; START SLAVE; -wait_for_slave_to_stop; +source include/wait_for_slave_sql_to_stop.inc; --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # --query_vertical SHOW SLAVE STATUS @@ -429,6 +429,7 @@ set @b1 = 'b1b1b1b1'; set @b1 = concat(@b1,@b1); INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); +connection slave; --source include/wait_for_slave_sql_to_stop.inc --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # diff --git a/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test index 209ef6189d1..5ed2f1ac2b8 100644 --- a/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test +++ b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test @@ -4,8 +4,7 @@ # Test of FLUSH NO_WRITE_TO_BINLOG by the way. # - --- source include/master-slave.inc +source include/master-slave.inc; let $SERVER_VERSION=`select version()`; @@ -34,26 +33,32 @@ flush tables; --replace_column 2 # 5 # --replace_regex /table_id: [0-9]+/table_id: #/ eval SHOW BINLOG EVENTS FROM $rename_event_pos ; -save_master_pos; -connection slave; -sync_with_master; + +sync_slave_with_master; # Check that the slave is not confused. select * from t3; # Note that all this confusion may cause warnings 'table xx is open on rename' # in the .err files; these are not fatal and are not reported by mysql-test-run. - stop slave; +source include/wait_for_slave_to_stop.inc; + connection master; drop table t1; + connection slave; flush tables with read lock; start slave; -sleep 1; +source include/wait_for_slave_to_start.inc; --error 1192 stop slave; +# Cleanup +unlock tables; + connection master; drop table t3, t4, t5; +sync_slave_with_master; + # End of 4.1 tests diff --git a/mysql-test/extra/rpl_tests/rpl_loaddata.test b/mysql-test/extra/rpl_tests/rpl_loaddata.test index 8f32ee674f8..26916642cae 100644 --- a/mysql-test/extra/rpl_tests/rpl_loaddata.test +++ b/mysql-test/extra/rpl_tests/rpl_loaddata.test @@ -23,12 +23,12 @@ connection master; select last_insert_id(); create table t1(a int not null auto_increment, b int, primary key(a) ); -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; +load data infile '../../std_data/rpl_loaddata.dat' into table t1; # verify that LAST_INSERT_ID() is set by LOAD DATA INFILE select last_insert_id(); create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60)); -load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines; +load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines; create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60)); insert into t3 select * from t2; @@ -56,7 +56,7 @@ sync_with_master; insert into t1 values(1,10); connection master; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; +load data infile '../../std_data/rpl_loaddata.dat' into table t1; save_master_pos; connection slave; @@ -80,7 +80,7 @@ connection master; set sql_log_bin=0; delete from t1; set sql_log_bin=1; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; +load data infile '../../std_data/rpl_loaddata.dat' into table t1; save_master_pos; connection slave; # The SQL slave thread should be stopped now. @@ -105,7 +105,7 @@ connection master; set sql_log_bin=0; delete from t1; set sql_log_bin=1; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; +load data infile '../../std_data/rpl_loaddata.dat' into table t1; save_master_pos; connection slave; # The SQL slave thread should be stopped now. @@ -125,7 +125,7 @@ reset master; eval create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60), unique(day)) engine=$engine_type; # no transactions --error ER_DUP_ENTRY -load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields +load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines; select * from t2; @@ -141,24 +141,21 @@ alter table t2 drop key day; connection master; delete from t2; --error ER_DUP_ENTRY -load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields +load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines; connection slave; --source include/wait_for_slave_sql_to_stop.inc -drop table t2; +drop table t1, t2; connection master; -drop table t2; -drop table t1; +drop table t1, t2; # BUG#17233 LOAD DATA INFILE: failure causes mysqld dbug_assert, binlog not flushed CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB; --error ER_DUP_ENTRY -LOAD DATA INFILE "../std_data_ln/words.dat" INTO TABLE t1; +LOAD DATA INFILE "../../std_data/words.dat" INTO TABLE t1; ---disable_warnings DROP TABLE IF EXISTS t1; ---enable_warnings # End of 4.1 tests diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test index 60ffab316cf..83b780394b9 100644 --- a/mysql-test/extra/rpl_tests/rpl_log.test +++ b/mysql-test/extra/rpl_tests/rpl_log.test @@ -9,10 +9,8 @@ # test the slave immediately writes DROP TEMPORARY TABLE this_old_table). # We wait for the slave to have written all he wants to the binlog # (otherwise RESET MASTER may come too early). -save_master_pos; -connection slave; -sync_with_master; -stop slave; +sync_slave_with_master; +source include/stop_slave.inc; --source include/wait_for_slave_to_stop.inc reset master; reset slave; @@ -25,8 +23,13 @@ connection master; eval create table t1(n int not null auto_increment primary key)ENGINE=$engine_type; insert into t1 values (NULL); drop table t1; +let $LOAD_FILE= ../../std_data/words.dat; +if (!`SELECT length(load_file('$LOAD_FILE'))`){ + let $LOAD_FILE= ../$LOAD_FILE; +} eval create table t1 (word char(20) not null)ENGINE=$engine_type; -load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines; +--replace_result $LOAD_FILE LOAD_FILE +eval load data infile '$LOAD_FILE' into table t1 ignore 1 lines; select count(*) from t1; --replace_result $VERSION VERSION --replace_column 2 # 5 # @@ -67,19 +70,12 @@ eval create table t3 (a int)ENGINE=$engine_type; connection master; select * from t1 order by 1 asc; -save_master_pos; -connection slave; -# Note that the above 'slave start' will cause a 3rd rotate event (a fake one) -# to go into the relay log (the master always sends a fake one when replication -# starts). -let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%'; ---source include/wait_slave_status.inc -sync_with_master; +sync_slave_with_master; #check t1 on slave to ensure whether it's identical with on master select * from t1 order by 1 asc; flush logs; -stop slave; ---source include/wait_for_slave_to_stop.inc +source include/stop_slave.inc; +source include/start_slave.inc; connection master; # Create some entries for second log @@ -93,11 +89,8 @@ source include/show_binlog_events.inc; --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ show binlog events in 'master-bin.000002'; show binary logs; -save_master_pos; -connection slave; -start slave; +sync_slave_with_master; --source include/wait_for_slave_to_start.inc -sync_with_master; show binary logs; --replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION --replace_column 2 # 5 # @@ -133,9 +126,13 @@ DROP TABLE t3; # Bug #6880: LAST_INSERT_ID() within a statement # +# Reset binlog so that show binlog events will not show the tests +# above. +source include/master-slave-reset.inc; +connection master; + create table t1(a int auto_increment primary key, b int); insert into t1 values (NULL, 1); -reset master; set insert_id=5; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id()); source include/show_binlog_events.inc; @@ -145,4 +142,3 @@ drop table t1; # End of 4.1 tests sync_slave_with_master; - diff --git a/mysql-test/extra/rpl_tests/rpl_row_001.test b/mysql-test/extra/rpl_tests/rpl_row_001.test index 6261659c4ce..8eb684e0dff 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_001.test +++ b/mysql-test/extra/rpl_tests/rpl_row_001.test @@ -1,7 +1,9 @@ +let $LOAD_FILE= $MYSQLTEST_VARDIR/std_data/words.dat; CREATE TABLE t1 (word CHAR(20) NOT NULL); -LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1; +--replace_result $LOAD_FILE LOAD_FILE +eval LOAD DATA INFILE '$LOAD_FILE' INTO TABLE t1; +--replace_result $LOAD_FILE LOAD_FILE +eval LOAD DATA INFILE '$LOAD_FILE' INTO TABLE t1; SELECT * FROM t1 ORDER BY word LIMIT 10; # diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp002.test b/mysql-test/extra/rpl_tests/rpl_row_sp002.test index 47afcce875b..5a2ab1912b8 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_sp002.test +++ b/mysql-test/extra/rpl_tests/rpl_row_sp002.test @@ -206,7 +206,7 @@ START TRANSACTION; -- disable_query_log -- disable_result_log let $n=50; -while ($n>3) +while ($n) { eval call test.p3($n); dec $n; diff --git a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test index 0e391cb0f37..3b03caee35c 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test +++ b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test @@ -122,7 +122,7 @@ INSERT INTO t1_nodef VALUES (1,2); connection slave; --source include/wait_for_slave_sql_to_stop.inc --replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 36 <Last_IO_Error> 38 <Last_SQL_Error> +--replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error> --query_vertical SHOW SLAVE STATUS SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -142,7 +142,7 @@ sync_slave_with_master; --echo **** On Slave **** SELECT * FROM t2; --replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 36 <Last_IO_Error> 38 <Last_SQL_Error> +--replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error> --query_vertical SHOW SLAVE STATUS connection master; @@ -154,7 +154,7 @@ INSERT INTO t4 VALUES (4); connection slave; --source include/wait_for_slave_sql_to_stop.inc --replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 36 <Last_IO_Error> 38 <Last_SQL_Error> +--replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error> --query_vertical SHOW SLAVE STATUS SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -168,7 +168,7 @@ INSERT INTO t5 VALUES (5,10,25); connection slave; --source include/wait_for_slave_sql_to_stop.inc --replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 36 <Last_IO_Error> 38 <Last_SQL_Error> +--replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error> --query_vertical SHOW SLAVE STATUS SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -182,7 +182,7 @@ INSERT INTO t6 VALUES (6,12,36); connection slave; --source include/wait_for_slave_sql_to_stop.inc --replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 36 <Last_IO_Error> 38 <Last_SQL_Error> +--replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error> --query_vertical SHOW SLAVE STATUS SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -191,7 +191,7 @@ connection master; INSERT INTO t9 VALUES (6); sync_slave_with_master; --replace_result $SLAVE_MYPORT SLAVE_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 36 <Last_IO_Error> 38 <Last_SQL_Error> +--replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error> --query_vertical SHOW SLAVE STATUS # Testing some tables extra field that can be null and cannot be null diff --git a/mysql-test/extra/rpl_tests/rpl_stm_000001.test b/mysql-test/extra/rpl_tests/rpl_stm_000001.test index d007e433ab6..1f5eb5786dd 100644 --- a/mysql-test/extra/rpl_tests/rpl_stm_000001.test +++ b/mysql-test/extra/rpl_tests/rpl_stm_000001.test @@ -2,7 +2,7 @@ -- source include/master-slave.inc create table t1 (word char(20) not null); -load data infile '../std_data_ln/words.dat' into table t1; +load data infile '../../std_data/words.dat' into table t1; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR eval load data local infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1; select * from t1 limit 10; diff --git a/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test b/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test index 3304a0ff46d..2c396c9a209 100644 --- a/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test +++ b/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test @@ -18,13 +18,18 @@ eval create table t1 (a int, unique(a)) engine=$engine_type; set sql_log_bin=0; insert into t1 values(2); set sql_log_bin=1; -save_master_pos; + --error ER_DUP_ENTRY insert into t1 values(1),(2); drop table t1; -save_master_pos; + connection slave; --source include/wait_for_slave_sql_to_stop.inc +let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1); +let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1); +--echo Error: "$error" (expected different error codes on master and slave) +--echo Errno: "$errno" (expected 0) +drop table t1; # End of 4.1 tests diff --git a/mysql-test/extra/rpl_tests/rpl_truncate_helper.test b/mysql-test/extra/rpl_tests/rpl_truncate_helper.test index 76db74acfa1..eb0729e4921 100644 --- a/mysql-test/extra/rpl_tests/rpl_truncate_helper.test +++ b/mysql-test/extra/rpl_tests/rpl_truncate_helper.test @@ -14,6 +14,9 @@ START SLAVE; --echo **** On Master **** connection master; +SET @old_session_binlog_format= @@session.binlog_format; +SET @old_global_binlog_format= @@global.binlog_format; + eval SET SESSION BINLOG_FORMAT=$format; eval SET GLOBAL BINLOG_FORMAT=$format; @@ -40,3 +43,5 @@ source include/show_binlog_events.inc; connection master; RESET MASTER; +SET @@session.binlog_format= @old_session_binlog_format; +SET @@global.binlog_format= @old_global_binlog_format; diff --git a/mysql-test/fix-result b/mysql-test/fix-result deleted file mode 100755 index bd380332ff5..00000000000 --- a/mysql-test/fix-result +++ /dev/null @@ -1,22 +0,0 @@ -#! /bin/sh - -# Sasha's hack to fix results generated with mysql-test-run --record -# to be version and test port independent. In some cases, further minor -# manual edititing may be required, but most of the time it should not -# happen - -#It is assumed we are running the script in mysql-test directory - -VERSION=4.0.1-alpha-debug-log -TEST_CASE=$1 - -if [ -z "$TEST_CASE" ] ; -then - echo "usage: $0 test_case_name" - exit 1 -fi - -../extra/replace $VERSION '$VERSION' 9306 '$MASTER_MYPORT' 9307 \ -'$SLAVE_MYPORT' \\ \\\\ -- r/$TEST_CASE.result - - diff --git a/mysql-test/include/analyze-sync_with_master.test b/mysql-test/include/analyze-sync_with_master.test new file mode 100644 index 00000000000..684c0dbbab7 --- /dev/null +++ b/mysql-test/include/analyze-sync_with_master.test @@ -0,0 +1,6 @@ +SHOW PROCESSLIST; + +let $binlog_name= query_get_value("SHOW MASTER STATUS", File, 1); +eval SHOW BINLOG EVENTS IN '$binlog_name'; + +exit;
\ No newline at end of file diff --git a/mysql-test/include/analyze-timeout.test b/mysql-test/include/analyze-timeout.test new file mode 100644 index 00000000000..179ad8f748a --- /dev/null +++ b/mysql-test/include/analyze-timeout.test @@ -0,0 +1,3 @@ +SHOW PROCESSLIST; + +exit; diff --git a/mysql-test/include/analyze_failure_sync_with_master.test b/mysql-test/include/analyze_failure_sync_with_master.test deleted file mode 100644 index e6fd32d2f46..00000000000 --- a/mysql-test/include/analyze_failure_sync_with_master.test +++ /dev/null @@ -1,15 +0,0 @@ -# Connect to both master and slave -connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); -connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); - -vertical_results; - -echo == MASTER ===========================================================; -connection master; -show master status; -show slave status; - -echo == SLAVE ===========================================================; -connection slave; -show master status; -show slave status; diff --git a/mysql-test/include/check-testcase.test b/mysql-test/include/check-testcase.test index bf70b66e5df..6dcb01c13cf 100644 --- a/mysql-test/include/check-testcase.test +++ b/mysql-test/include/check-testcase.test @@ -1,51 +1,15 @@ + # # This test is executed twice for each test case if mysql-test-run is passed -# the flag --check-testcase. -# Before every testcase it's run with mysqltest in record mode and will -# thus produce an output file -# that can be compared to output from after the tescase. -# In that way it's possible to check that a testcase does not have +# the flag --check-testcase. Before every testcase it is run with mysqltest +# in record mode and will thus produce an output file that can be compared +# to output from after the tescase. +# In that way its possible to check that a testcase does not have # any unwanted side affects. # - -# -# Dump all global variables -# -SHOW GLOBAL VARIABLES WHERE variable_name != 'timestamp'; - -# -# Dump all databases -# -SHOW DATABASES; - -# -# Dump the "test" database, all it's tables and their data -# ---exec $MYSQL_DUMP --skip-comments --skip-lock-tables test - -# -# Dump the "mysql" database and it's tables -# Select data separately to add "order by" -# ---exec $MYSQL_DUMP --skip-comments --skip-lock-tables --no-data mysql -use mysql; -SELECT * FROM columns_priv; -SELECT * FROM db ORDER BY host, db, user; -SELECT * FROM func; -SELECT * FROM help_category; -SELECT * FROM help_keyword; -SELECT * FROM help_relation; -SELECT * FROM help_relation; -SELECT * FROM host; -SELECT * FROM proc; -SELECT * FROM procs_priv; -SELECT * FROM tables_priv; -SELECT * FROM time_zone; -SELECT * FROM time_zone_leap_second; -SELECT * FROM time_zone_name; -SELECT * FROM time_zone_transition; -SELECT * FROM time_zone_transition_type; -SELECT * FROM user; +--disable_query_log +call mtr.check_testcase(); +--enable_query_log diff --git a/mysql-test/include/check-warnings.test b/mysql-test/include/check-warnings.test new file mode 100644 index 00000000000..2144957f742 --- /dev/null +++ b/mysql-test/include/check-warnings.test @@ -0,0 +1,61 @@ +# +# This test is executed once after each test to check the servers +# for unexpected warnings found in the servers error log +# +# NOTE! mysql-test-run.pl has already done a rough filtering +# of the file and written any suspicious lines +# to $error_log.warnings file +# +--disable_query_log + +# Don't write these queries to binlog +set SQL_LOG_BIN=0; + +# Turn off any debug crashes, allow the variable to be +# non existent in release builds +--error 0,1193 +set debug=""; + +use mtr; + +create temporary table error_log ( + row int auto_increment primary key, + suspicious int default 1, + file_name varchar(255), + line varchar(1024) default null +) engine=myisam; + +# Get the name of servers error log +let $log_error= query_get_value(show variables like 'log_error', Value, 1); +let $log_warning= $log_error.warnings; + +# Try tload the warnings into a temporary table, +# it might fail with error saying "The MySQL server is +# running with the --secure-file-priv" in which case +# an attempt to load the file using LOAD DATA LOCAL is made +--error 0,1290 +eval load data infile '$log_warning' into table error_log + fields terminated by 'xykls37' escaped by '' + ignore 1 lines + (line) + set file_name='$log_error'; + +if ($mysql_errno) +{ + # Try LOAD DATA LOCAL + eval load data local infile '$log_warning' into table error_log + fields terminated by 'xykls37' escaped by '' + ignore 1 lines + (line) + set file_name='$log_error'; +} + +# Call check_warnings to filter out any warning in +# the error_log table +call mtr.check_warnings(@result); +if (`select @result = 0`){ + skip OK; +} +--enable_query_log +echo ^ Found warnings!!; +exit; diff --git a/mysql-test/include/check_events_off.inc b/mysql-test/include/check_events_off.inc new file mode 100644 index 00000000000..599a4b9e504 --- /dev/null +++ b/mysql-test/include/check_events_off.inc @@ -0,0 +1,31 @@ +########## include/check_events_off.inc #################################### +# # +# Purpose: # +# Wait till we can expect that we have no event activity till the scheduler is # +# switched on again. # +# = There will be no modifications of user tables by existing events # +# except they use "INSERT DELAYED" or the server system variable # +# "concurrent_inserts" is not switched off. # +# Only some storage engines support concurrent_inserts" or "INSERT DELAYED". # +# # +# Creation: # +# 2008-12-19 mleich Implement this check needed for bug fixes in tests # +# # +################################################################################ + +# 1. Check that the server system variable shows the state needed +if (`SELECT @@global.event_scheduler <> 'OFF'`) +{ + --echo # Error: We expect here that the event scheduler is switched off. + SELECT @@global.event_scheduler; + --echo # Thinkable reasons: + --echo # 1. SET GLOBAL event_scheduler = OFF had not the expected effect. + --echo # 2. Use of the current routine (include/check_events_off.inc) + --echo # within the wrong situation + --die +} +# 2. Wait till we have no event_scheduler session within the processlist +--source include/no_running_event_scheduler.inc +# 3. Wait till we have no event executor sessions within the processlist +--source include/no_running_events.inc + diff --git a/mysql-test/include/circular_rpl_for_4_hosts_init.inc b/mysql-test/include/circular_rpl_for_4_hosts_init.inc new file mode 100644 index 00000000000..ac6654777db --- /dev/null +++ b/mysql-test/include/circular_rpl_for_4_hosts_init.inc @@ -0,0 +1,130 @@ +############################################################# +# +# Author: Serge Kozlov <skozlov@mysql.com> +# Date: 03/11/2008 +# Purpose: Set up circular replication based on schema +# A->B->C->D->A +# +# Notes: +# 1. --slave-num=3 must be added to *-master.opt file +# 2. Even the test uses new names for servers but file names +# of log files are still old: +# master_a -> master.[log|err] +# master_b -> slave.[log|err] +# master_c -> slave1.[log|err] +# master_d -> slave2.[log|err] +# +############################################################# +--source include/master-slave.inc + +# +# Set up circular ring by schema A->B->C->D->A +# + +--connection slave +STOP SLAVE; +RESET SLAVE; + +# master a +--connection master +--disconnect master +connect (master_a,127.0.0.1,root,,test,$MASTER_MYPORT,); +RESET MASTER; +--disable_warnings +STOP SLAVE; +--enable_warnings +RESET SLAVE; +SET auto_increment_increment = 4; +SET auto_increment_offset = 1; +let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); + +# master b +--connection slave +--disconnect slave +connect (master_b,127.0.0.1,root,,test,$SLAVE_MYPORT,); +RESET MASTER; +RESET SLAVE; +--replace_result $MASTER_MYPORT MASTER_A_PORT $_binlog_file MASTER_A_LOG_FILE +--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$MASTER_MYPORT,master_user='root',MASTER_LOG_FILE='$_binlog_file' +SET auto_increment_increment = 4; +SET auto_increment_offset = 2; +let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); + +# master c +--connection slave1 +--disconnect slave1 +connect (master_c,127.0.0.1,root,,test,$SLAVE_MYPORT1,); +RESET MASTER; +--disable_warnings +STOP SLAVE; +--enable_warnings +RESET SLAVE; +--replace_result $SLAVE_MYPORT MASTER_B_PORT $_binlog_file MASTER_B_LOG_FILE +--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT,master_user='root',MASTER_LOG_FILE='$_binlog_file' +SET auto_increment_increment = 4; +SET auto_increment_offset = 3; +let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); + +# master d +connect (master_d,127.0.0.1,root,,test,$SLAVE_MYPORT2,); +RESET MASTER; +--disable_warnings +STOP SLAVE; +--enable_warnings +RESET SLAVE; +--replace_result $SLAVE_MYPORT1 MASTER_C_PORT $_binlog_file MASTER_C_LOG_FILE +--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT1,master_user='root',MASTER_LOG_FILE='$_binlog_file' +SET auto_increment_increment = 4; +SET auto_increment_offset = 4; +let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); + +# master a +--connection master_a +--replace_result $SLAVE_MYPORT2 MASTER_D_PORT $_binlog_file MASTER_D_LOG_FILE +--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT2,master_user='root',MASTER_LOG_FILE='$_binlog_file' + + + +# Check server_ids: they should be different +--connection master_a +let $_id_a= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1); +SHOW VARIABLES LIKE 'auto_increment_%'; +--connection master_b +let $_id_b= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1); +SHOW VARIABLES LIKE 'auto_increment_%'; +--connection master_c +let $_id_c= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1); +SHOW VARIABLES LIKE 'auto_increment_%'; +--connection master_d +let $_id_d= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1); +SHOW VARIABLES LIKE 'auto_increment_%'; +--connection master_a +let $_compared_ids= (($_id_a <> $_id_b) AND ($_id_a <> $_id_c) AND ($_id_a <> $_id_d) AND ($_id_b <> $_id_c) AND ($_id_b <> $_id_d) AND ($_id_c <> $_id_d)) AS a; +let $_compared_ids_result= query_get_value(SELECT $_compared_ids, a, 1); +--echo $_compared_ids_result + +# Start ring +--connection master_a +connect(slave,127.0.0.1,root,,test,$MASTER_MYPORT); +START SLAVE; +--source include/wait_for_slave_to_start.inc +--disconnect slave + +--connection master_b +connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT1); +START SLAVE; +--source include/wait_for_slave_to_start.inc +--disconnect slave + +--connection master_c +connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT); +START SLAVE; +--source include/wait_for_slave_to_start.inc +--disconnect slave + +--connection master_d +connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT2); +START SLAVE; +--source include/wait_for_slave_to_start.inc +--disconnect slave + diff --git a/mysql-test/include/circular_rpl_for_4_hosts_sync.inc b/mysql-test/include/circular_rpl_for_4_hosts_sync.inc new file mode 100644 index 00000000000..68aede76913 --- /dev/null +++ b/mysql-test/include/circular_rpl_for_4_hosts_sync.inc @@ -0,0 +1,23 @@ +############################################################# +# +# Author: Serge Kozlov <skozlov@mysql.com> +# Date: 03/11/2008 +# Purpose: Sync all hosts for circular replication based on +# schema A->B->C->D->A +# +# Notes: see include/circular_rpl_for_4_hosts_init.inc +# +############################################################# + +# Make the full loop of sync +--connection master_a +--disable_query_log +--sync_slave_with_master master_b +--sync_slave_with_master master_c +--sync_slave_with_master master_d +--sync_slave_with_master master_a +--sync_slave_with_master master_b +--sync_slave_with_master master_c +--save_master_pos +--connection master_a +--enable_query_log diff --git a/mysql-test/include/cleanup_fake_relay_log.inc b/mysql-test/include/cleanup_fake_relay_log.inc new file mode 100644 index 00000000000..43aa46cb657 --- /dev/null +++ b/mysql-test/include/cleanup_fake_relay_log.inc @@ -0,0 +1,16 @@ +# ==== Purpose ==== +# +# Clean up files create by setup_fake_relay_log.inc. +# +# ==== Usage ==== +# +# See setup_fake_relay_log.inc + +--echo Cleaning up after setup_fake_relay_log.inc + +# Remove files. +remove_file $_fake_relay_log; +remove_file $_fake_relay_index; +--disable_query_log +eval SET @@global.relay_log_purge= $_fake_relay_log_purge; +--enable_query_log diff --git a/mysql-test/include/commit.inc b/mysql-test/include/commit.inc index 98f9c93b25a..a4e7d9ae601 100644 --- a/mysql-test/include/commit.inc +++ b/mysql-test/include/commit.inc @@ -267,7 +267,7 @@ select * from t2; insert into t2 (a) values (1026); --replace_result $MYSQLTEST_VARDIR .. --error ER_DUP_ENTRY -eval load data infile "../std_data_ln/words.dat" into table t1 (a) set a:=f2(26); +eval load data infile "../../std_data/words.dat" into table t1 (a) set a:=f2(26); select * from t2; rollback; @@ -617,10 +617,10 @@ call p_verify_status_increment(0, 0, 0, 0); --echo --echo # No test because of Bug#8729 "rename table fails on temporary table" ---echo # 24. DDL: TRUNCATE TEMPORARY TABLE, does not start a transaction +--echo # 24. DDL: TRUNCATE TEMPORARY TABLE --echo truncate table t2; -call p_verify_status_increment(2, 0, 2, 0); +call p_verify_status_increment(4, 0, 4, 0); commit; --echo # There is nothing left to commit call p_verify_status_increment(0, 0, 0, 0); @@ -671,8 +671,11 @@ call p_verify_status_increment(2, 2, 2, 2); savepoint a; call p_verify_status_increment(0, 0, 0, 0); insert t1 set a=4; ---echo # Sic: a bug. Binlog did not register itself this time. -call p_verify_status_increment(1, 0, 1, 0); +--echo # Binlog does not register itself this time for other than the 1st +--echo # statement of the transaction with MIXED/STATEMENT binlog_format. +--echo # It needs registering with the ROW format. Therefore 1,0,2,2 are +--echo # the correct arguments to this test after bug#40221 fixed. +call p_verify_status_increment(1, 0, 2, 2); release savepoint a; rollback; call p_verify_status_increment(0, 0, 0, 0); @@ -730,7 +733,7 @@ call p_verify_status_increment(1, 0, 1, 0); rename table t4 to t3; call p_verify_status_increment(1, 0, 1, 0); truncate table t3; -call p_verify_status_increment(2, 2, 2, 2); +call p_verify_status_increment(4, 4, 4, 4); create view v1 as select * from t2; call p_verify_status_increment(1, 0, 1, 0); check table t1; diff --git a/mysql-test/include/concurrent.inc b/mysql-test/include/concurrent.inc index febab1eceb4..26d18edd8ce 100644 --- a/mysql-test/include/concurrent.inc +++ b/mysql-test/include/concurrent.inc @@ -638,7 +638,7 @@ drop table t1; connection default; drop table t1; +DROP user mysqltest@localhost; disconnect thread1; disconnect thread2; - diff --git a/mysql-test/include/default_my.cnf b/mysql-test/include/default_my.cnf new file mode 100644 index 00000000000..d77fee0e200 --- /dev/null +++ b/mysql-test/include/default_my.cnf @@ -0,0 +1,25 @@ +# Use default setting for mysqld processes +!include default_mysqld.cnf + +[mysqld.1] + +# Run the master.sh script before starting this process +#!run-master-sh + +log-bin= master-bin + + +[mysqlbinlog] +disable-force-if-open + +# mysql_fix_privilege_tables.sh does not read from [client] so it +# need its own section +[mysql_fix_privilege_tables] +socket= @client.socket +port= @client.port +user= @client.user +password= @client.password + +[ENV] +MASTER_MYPORT= @mysqld.1.port +MASTER_MYSOCK= @mysqld.1.socket diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf new file mode 100644 index 00000000000..ad0090aaf36 --- /dev/null +++ b/mysql-test/include/default_mysqld.cnf @@ -0,0 +1,21 @@ +# Default values that applies to all MySQL Servers +[mysqld] +open-files-limit= 1024 +local-infile +default-character-set= latin1 + +# Increase default connect_timeout to avoid intermittent +# disconnects when test servers are put under load see BUG#28359 +connect-timeout= 60 + +log-bin-trust-function-creators=1 +key_buffer_size= 1M +sort_buffer= 256K +max_heap_table_size= 1M + +loose-innodb_data_file_path= ibdata1:10M:autoextend + +slave-net-timeout=120 + +log-bin=mysqld-bin + diff --git a/mysql-test/include/default_ndbd.cnf b/mysql-test/include/default_ndbd.cnf new file mode 100644 index 00000000000..9a88a5936aa --- /dev/null +++ b/mysql-test/include/default_ndbd.cnf @@ -0,0 +1,27 @@ + +[cluster_config] +MaxNoOfSavedMessages= 1000 +MaxNoOfConcurrentTransactions= 128 +MaxNoOfConcurrentOperations= 10000 +DataMemory= 20M +IndexMemory= 1M +Diskless= 0 +TimeBetweenWatchDogCheck= 30000 +MaxNoOfOrderedIndexes= 32 +MaxNoOfAttributes= 2048 +TimeBetweenGlobalCheckpoints= 500 +NoOfFragmentLogFiles= 4 +FragmentLogFileSize= 12M +DiskPageBufferMemory= 4M + +# O_DIRECT has issues on 2.4 whach have not been handled, Bug #29612 +#ODirect= 1 +# the following parametes just function as a small regression +# test that the parameter exists +InitialNoOfOpenFiles= 27 + +# Increase timeouts for slow test-machines +HeartbeatIntervalDbDb= 30000 +HeartbeatIntervalDbApi= 30000 + +#TransactionDeadlockDetectionTimeout= 7500 diff --git a/mysql-test/include/federated.inc b/mysql-test/include/federated.inc deleted file mode 100644 index 925ecdd9682..00000000000 --- a/mysql-test/include/federated.inc +++ /dev/null @@ -1,28 +0,0 @@ ---source include/have_log_bin.inc ---source include/not_embedded.inc ---source ./include/have_federated_db.inc - -source ./include/master-slave.inc; - -# remote table creation - -# We have to sync with master, to ensure slave had time to start properly -# before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the log. -connection master; -sync_slave_with_master; - -connection slave; -#--replicate-ignore-db=federated -stop slave; - ---disable_warnings -# at this point, we are connected to master -DROP DATABASE IF EXISTS federated; ---enable_warnings -CREATE DATABASE federated; - -connection master; ---disable_warnings -DROP DATABASE IF EXISTS federated; ---enable_warnings -CREATE DATABASE federated; diff --git a/mysql-test/include/have_32bit.inc b/mysql-test/include/have_32bit.inc index b09a813967d..66684fb5325 100644 --- a/mysql-test/include/have_32bit.inc +++ b/mysql-test/include/have_32bit.inc @@ -11,6 +11,6 @@ eval SET @@global.sort_buffer_size = $save; --enable_query_log if (!$mach32) { - skip Need a 32 bit machine; + skip Need a 32 bit machine/binary; } diff --git a/mysql-test/include/have_64bit.inc b/mysql-test/include/have_64bit.inc index 31529a0c9d4..cbba5e1d338 100644 --- a/mysql-test/include/have_64bit.inc +++ b/mysql-test/include/have_64bit.inc @@ -9,6 +9,6 @@ eval SET @@session.sort_buffer_size = $save; --enable_query_log if (!$mach64) { - skip Need a 64 bit machine; + skip Need a 64 binary ; } diff --git a/mysql-test/include/have_blackhole.inc b/mysql-test/include/have_blackhole.inc index 6c4da01d61d..146f5afb0d5 100644 --- a/mysql-test/include/have_blackhole.inc +++ b/mysql-test/include/have_blackhole.inc @@ -1,4 +1,5 @@ -disable_query_log; ---require r/true.require -select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'blackhole'; -enable_query_log; +if (!`SELECT count(*) FROM information_schema.engines WHERE + (support = 'YES' OR support = 'DEFAULT') AND + engine = 'blackhole'`){ + skip Need blackhole engine; +} diff --git a/mysql-test/include/have_bug25714.inc b/mysql-test/include/have_bug25714.inc deleted file mode 100644 index 1d957bec2ec..00000000000 --- a/mysql-test/include/have_bug25714.inc +++ /dev/null @@ -1,7 +0,0 @@ -# -# Check if the variable MYSQL_BUG25714 is set -# ---require r/have_bug25714.require -disable_query_log; -eval select LENGTH('$MYSQL_BUG25714') > 0 as 'have_bug25714_exe'; -enable_query_log; diff --git a/mysql-test/include/have_federated_db.inc b/mysql-test/include/have_federated_db.inc deleted file mode 100644 index 041a29f460b..00000000000 --- a/mysql-test/include/have_federated_db.inc +++ /dev/null @@ -1,4 +0,0 @@ -disable_query_log; ---require r/true.require -select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'federated'; -enable_query_log; diff --git a/mysql-test/include/have_log_bin.inc b/mysql-test/include/have_log_bin.inc index 5bcdb30b3e0..369af9b8e1d 100644 --- a/mysql-test/include/have_log_bin.inc +++ b/mysql-test/include/have_log_bin.inc @@ -1,3 +1,11 @@ +# ==== Purpose ==== +# +# Ensure that the server is running with binlogging on +# +# ==== Usage ==== +# +# source include/have_log_bin.inc; + -- require r/have_log_bin.require disable_query_log; show variables like 'log_bin'; diff --git a/mysql-test/include/have_ndbapi_examples.inc b/mysql-test/include/have_ndbapi_examples.inc index df7aa41ec5d..88499d555c0 100644 --- a/mysql-test/include/have_ndbapi_examples.inc +++ b/mysql-test/include/have_ndbapi_examples.inc @@ -1,4 +1,4 @@ --require r/have_ndbapi_examples.require disable_query_log; -eval select LENGTH('$MY_NDB_EXAMPLES_BINARY') > 0 as 'have_ndb_example'; +eval select LENGTH('$NDB_EXAMPLES_BINARY') > 0 as 'have_ndb_example'; enable_query_log; diff --git a/mysql-test/include/have_simple_parser.inc b/mysql-test/include/have_simple_parser.inc new file mode 100644 index 00000000000..c85786bd524 --- /dev/null +++ b/mysql-test/include/have_simple_parser.inc @@ -0,0 +1,16 @@ +# +# Check if server has support for loading udf's +# i.e it will support dlopen +# +--require r/have_dynamic_loading.require +disable_query_log; +show variables like 'have_dynamic_loading'; +enable_query_log; + +# +# Check if the variable SIMPLE_PARSER is set +# +--require r/have_simple_parser.require +disable_query_log; +eval select LENGTH('$SIMPLE_PARSER') > 0 as 'have_simple_parser'; +enable_query_log; diff --git a/mysql-test/include/index_merge1.inc b/mysql-test/include/index_merge1.inc index 023d582065e..5837df67a75 100644 --- a/mysql-test/include/index_merge1.inc +++ b/mysql-test/include/index_merge1.inc @@ -501,4 +501,30 @@ SELECT b,a from t1 WHERE (b!='c' AND b!='f' && b!='h') OR DROP TABLE t1; +--echo # +--echo # BUG#40974: Incorrect query results when using clause evaluated using range check +--echo # +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t1 (a int); +insert into t1 values (1),(2); +create table t2(a int, b int); +insert into t2 values (1,1), (2, 1000); +create table t3 (a int, b int, filler char(100), key(a), key(b)); + +insert into t3 select 1000, 1000,'filler' from t0 A, t0 B, t0 C; +insert into t3 values (1,1,'data'); +insert into t3 values (1,1,'data'); +-- echo The plan should be ALL/ALL/ALL(Range checked for each record (index map: 0x3) +explain select * from t1 +where exists (select 1 from t2, t3 + where t2.a=t1.a and (t3.a=t2.b or t3.b=t2.b or t3.b=t2.b+1)); + +select * from t1 +where exists (select 1 from t2, t3 + where t2.a=t1.a and (t3.a=t2.b or t3.b=t2.b or t3.b=t2.b+1)); + +drop table t0, t1, t2, t3; + --echo End of 5.0 tests diff --git a/mysql-test/include/linux_sys_vars.inc b/mysql-test/include/linux_sys_vars.inc index 4401a1e057a..85d7c6df7dc 100644 --- a/mysql-test/include/linux_sys_vars.inc +++ b/mysql-test/include/linux_sys_vars.inc @@ -9,7 +9,6 @@ SET @min_flush_time = 0; #SET @max_flush_time = 0; SET @default_key_buffer_size = 131072; -SET @min_key_buffer_size = 36; #SET @default_join_buffer_size = 131072; #SET @min_join_buffer_size = 8200; diff --git a/mysql-test/include/loaddata_autocom.inc b/mysql-test/include/loaddata_autocom.inc index cca56709331..bb286fb4169 100644 --- a/mysql-test/include/loaddata_autocom.inc +++ b/mysql-test/include/loaddata_autocom.inc @@ -7,16 +7,20 @@ eval SET SESSION STORAGE_ENGINE = $engine_type; drop table if exists t1; --enable_warnings +let $load_file= $MYSQLTEST_VARDIR/std_data/loaddata2.dat; + # NDB does not support the create option 'Binlog of table with BLOB attribute and no PK' # So use a dummy PK here. create table t1 (id int unsigned not null auto_increment primary key, a text, b text); start transaction; -load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b); +--replace_result $load_file LOAD_FILE +eval load data infile '$load_file' into table t1 fields terminated by ',' enclosed by '''' (a, b); commit; select count(*) from t1; truncate table t1; start transaction; -load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b); +--replace_result $load_file LOAD_FILE +eval load data infile '$load_file' into table t1 fields terminated by ',' enclosed by '''' (a, b); rollback; select count(*) from t1; diff --git a/mysql-test/include/maria_empty_logs.inc b/mysql-test/include/maria_empty_logs.inc index 0783020c443..6d80c4b134a 100644 --- a/mysql-test/include/maria_empty_logs.inc +++ b/mysql-test/include/maria_empty_logs.inc @@ -9,7 +9,7 @@ let $default_db=`select database()`; connection admin; -- echo * shut down mysqld, removed logs, restarted it -append_file $MYSQLTEST_VARDIR/tmp/master0.expect; +append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; wait-maria_empty_logs.inc EOF @@ -17,54 +17,54 @@ EOF if (!$mel_keep_control_file) { - remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log_control; + remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log_control; } -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000001; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000001; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000002; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000002; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000003; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000003; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000004; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000004; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000005; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000005; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000006; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000006; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000007; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000007; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000008; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000008; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000009; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000009; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000010; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000010; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000011; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000011; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000012; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000012; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000013; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000013; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000014; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000014; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000015; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000015; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000016; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000016; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000017; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000017; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000018; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000018; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000019; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000019; -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000020; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000020; # hope there are not more than these logs... -- error 0,1 -remove_file $MYSQLTEST_VARDIR/master-data/maria_recovery.trace; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/maria_recovery.trace; -append_file $MYSQLTEST_VARDIR/tmp/master0.expect; +append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; restart-maria_empty_logs.inc EOF diff --git a/mysql-test/include/maria_make_snapshot.inc b/mysql-test/include/maria_make_snapshot.inc index 679a65552c1..e7f1236f022 100644 --- a/mysql-test/include/maria_make_snapshot.inc +++ b/mysql-test/include/maria_make_snapshot.inc @@ -18,9 +18,9 @@ if ($mms_copy) { --echo * copied $mms_tname$mms_table_to_use for $mms_purpose - copy_file $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAD $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAD; - copy_file $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAI $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAI; - copy_file $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.frm $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.frm; + copy_file $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/$mms_tname$mms_table_to_use.MAD $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAD; + copy_file $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/$mms_tname$mms_table_to_use.MAI $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAI; + copy_file $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/$mms_tname$mms_table_to_use.frm $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.frm; } if ($mms_reverse_copy) @@ -28,11 +28,11 @@ if ($mms_reverse_copy) # do not call this without flushing target table first! --echo * copied $mms_tname$mms_table_to_use back for $mms_purpose -- error 0,1 - remove_file $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAD; - copy_file $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAD $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAD; + remove_file $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/$mms_tname$mms_table_to_use.MAD; + copy_file $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAD $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/$mms_tname$mms_table_to_use.MAD; -- error 0,1 - remove_file $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAI; - copy_file $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAI $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAI; + remove_file $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/$mms_tname$mms_table_to_use.MAI; + copy_file $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAI $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/$mms_tname$mms_table_to_use.MAI; } if ($mms_compare_physically) @@ -43,7 +43,7 @@ if ($mms_compare_physically) # If UNDO phase, we nevertheless compare checksums # (see maria_verify_recovery.inc). --echo * compared $mms_tname$mms_table_to_use to old version - diff_files $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAD $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAD; + diff_files $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/$mms_tname$mms_table_to_use.MAD $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAD; # index file not yet recovered -# diff_files $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAI $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAI; +# diff_files $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/$mms_tname$mms_table_to_use.MAI $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAI; } diff --git a/mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc b/mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc index 879aa3ef182..64777f9c9c8 100644 --- a/mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc +++ b/mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc @@ -32,6 +32,6 @@ let $mms_copy=0; -- error 0,1 remove_file $MYSQLTEST_VARDIR/tmp/mms_for_$mms_purpose.maria_log_control; -copy_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log_control $MYSQLTEST_VARDIR/tmp/mms_for_$mms_purpose.maria_log_control; +copy_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log_control $MYSQLTEST_VARDIR/tmp/mms_for_$mms_purpose.maria_log_control; connection default; diff --git a/mysql-test/include/maria_verify_recovery.inc b/mysql-test/include/maria_verify_recovery.inc index becdfb5df86..1ca19e59286 100644 --- a/mysql-test/include/maria_verify_recovery.inc +++ b/mysql-test/include/maria_verify_recovery.inc @@ -20,11 +20,11 @@ let $mms_compare_physically_save=$mms_compare_physically; let $mms_compare_physically=0; # warn mtr that mysqld is going to die and should not be restarted immediately -#append_file $MYSQLTEST_VARDIR/tmp/master0.expect; +#append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; #wait-maria_verify_recovery.inc #EOF # todo: remove this "system" and uncomment above when BUG#32296 is fixed -system echo wait-maria_verify_recovery.inc >> $MYSQLTEST_VARDIR/tmp/master0.expect; +system echo wait-maria_verify_recovery.inc >> $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; # flush page cache and log, only log, or nothing, and kill mysqld with # abort(). @@ -56,16 +56,16 @@ if ($mvr_restore_old_snapshot) # also copy back control file, to force recovery to start from an early # point, ignoring further checkpoints. -- error 0,1 - remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log_control; - copy_file $MYSQLTEST_VARDIR/tmp/mms_for_$mms_purpose.maria_log_control $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log_control; + remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log_control; + copy_file $MYSQLTEST_VARDIR/tmp/mms_for_$mms_purpose.maria_log_control $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log_control; } --echo * recovery happens # let mtr restart mysqld (and thus execute the maria log) -#append_file $MYSQLTEST_VARDIR/tmp/master0.expect; +#append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; #restart-maria_verify_recovery.inc #EOF -system echo restart-maria_verify_recovery.inc >> $MYSQLTEST_VARDIR/tmp/master0.expect; +system echo restart-maria_verify_recovery.inc >> $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; --source include/wait_until_connected_again.inc diff --git a/mysql-test/include/master-slave-reset.inc b/mysql-test/include/master-slave-reset.inc index 1363fab236a..938eb2c074a 100644 --- a/mysql-test/include/master-slave-reset.inc +++ b/mysql-test/include/master-slave-reset.inc @@ -1,6 +1,13 @@ +# Reset the master and the slave to start fresh. +# +# It is necessary to execute RESET MASTER and RESET SLAVE on both +# master and slave since the replication setup might be circular. +# +# Since we expect STOP SLAVE to produce a warning as the slave is +# stopped (the server was started with skip-slave-start), we disable +# warnings when doing STOP SLAVE. + connection slave; -#we expect STOP SLAVE to produce a warning as the slave is stopped -#(the server was started with skip-slave-start) --disable_warnings stop slave; source include/wait_for_slave_to_stop.inc; @@ -13,11 +20,17 @@ use test; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; --enable_warnings reset master; +--disable_query_log +reset slave; +--enable_query_log connection slave; reset slave; # Clean up old test tables --disable_warnings drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; --enable_warnings +--disable_query_log +reset master; +--enable_query_log start slave; source include/wait_for_slave_to_start.inc; diff --git a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc index d2332edd5dc..cc9183205be 100644 --- a/mysql-test/include/mix1.inc +++ b/mysql-test/include/mix1.inc @@ -623,7 +623,8 @@ DROP TABLE t1,t2,t3; # create table t1 (a int) engine=innodb; -copy_file $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/bug29807.frm; +let $MYSQLD_DATADIR= `select @@datadir`; +copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/bug29807.frm; --error 1146 select * from bug29807; drop table t1; diff --git a/mysql-test/include/mix2.inc b/mysql-test/include/mix2.inc index b4c4a9b8836..24e958e810f 100644 --- a/mysql-test/include/mix2.inc +++ b/mysql-test/include/mix2.inc @@ -1222,7 +1222,7 @@ drop table t2; # Clean up filename -- embedded server reports whole path without .frm, # regular server reports relative path with .frm (argh!) ---replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ / t2.frm t2 +--replace_result \\ / $MYSQL_TEST_DIR . /var/mysqld.1/data/ / t2.frm t2 --error 1005 eval create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = $engine_type; @@ -1467,7 +1467,7 @@ source include/varchar.inc; # Clean up filename -- embedded server reports whole path without .frm, # regular server reports relative path with .frm (argh!) ---replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ / t1.frm t1 +--replace_result \\ / $MYSQL_TEST_DIR . /var/mysqld.1/data/ / t1.frm t1 create table t1 (v varchar(65530), key(v)); drop table t1; create table t1 (v varchar(65536)); @@ -1778,7 +1778,7 @@ if ($test_foreign_keys) set foreign_key_checks=0; eval create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = $engine_type; ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' -- error 1005 eval create table t1(a char(10) primary key, b varchar(20)) engine = $engine_type; set foreign_key_checks=1; @@ -1789,7 +1789,7 @@ drop table t2; set foreign_key_checks=0; eval create table t1(a varchar(10) primary key) engine = $engine_type DEFAULT CHARSET=latin1; ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' -- error 1005 eval create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = $engine_type DEFAULT CHARSET=utf8; set foreign_key_checks=1; @@ -1819,7 +1819,7 @@ drop table t2,t1; set foreign_key_checks=0; eval create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = $engine_type DEFAULT CHARSET=latin1; eval create table t3(a varchar(10) primary key) engine = $engine_type DEFAULT CHARSET=utf8; ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' -- error 1025 rename table t3 to t1; set foreign_key_checks=1; diff --git a/mysql-test/include/mtr_check.sql b/mysql-test/include/mtr_check.sql new file mode 100644 index 00000000000..b54e21b6075 --- /dev/null +++ b/mysql-test/include/mtr_check.sql @@ -0,0 +1,59 @@ +delimiter ||; + +use mtr|| + +-- +-- Procedure used to check if server has been properly +-- restored after testcase has been run +-- +CREATE DEFINER=root@localhost PROCEDURE check_testcase() +BEGIN + + -- Dump all global variables except those + -- that are supposed to change + SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE variable_name != 'timestamp' and variable_name != "debug" order by variable_name; + + -- Dump all databases, there should be none + -- except those that was created during bootstrap + SELECT * FROM INFORMATION_SCHEMA.SCHEMATA; + + -- The test database should not contain any tables + SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES + WHERE table_schema='test'; + + -- Show "mysql" database, tables and columns + SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql + FROM INFORMATION_SCHEMA.TABLES + WHERE table_schema='mysql' AND table_name != 'ndb_apply_status' + ORDER BY tables_in_mysql; + SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, + column_name, ordinal_position, column_default, is_nullable, + data_type, character_maximum_length, character_octet_length, + numeric_precision, numeric_scale, character_set_name, + collation_name, column_type, column_key, extra, column_comment + FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_schema='mysql' AND table_name != 'ndb_apply_status' + ORDER BY columns_in_mysql; + + -- Checksum system tables to make sure they have been properly + -- restored after test + checksum table + mysql.columns_priv, + mysql.db, + mysql.func, + mysql.help_category, + mysql.help_keyword, + mysql.help_relation, + mysql.host, + mysql.proc, + mysql.procs_priv, + mysql.tables_priv, + mysql.time_zone, + mysql.time_zone_leap_second, + mysql.time_zone_name, + mysql.time_zone_transition, + mysql.time_zone_transition_type, + mysql.user; + +END|| diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql new file mode 100644 index 00000000000..bcf9fd4a4ff --- /dev/null +++ b/mysql-test/include/mtr_warnings.sql @@ -0,0 +1,248 @@ +delimiter ||; + +use mtr|| + +-- +-- Create table where testcases can insert patterns to +-- be suppressed +-- +CREATE TABLE test_suppressions ( + pattern VARCHAR(255) +) ENGINE=MyISAM|| + + +-- +-- Declare a trigger that makes sure +-- no invalid patterns can be inserted +-- into test_suppressions +-- +/*!50002 +CREATE DEFINER=root@localhost TRIGGER ts_insert +BEFORE INSERT ON test_suppressions +FOR EACH ROW BEGIN + DECLARE dummy INT; + SELECT "" REGEXP NEW.pattern INTO dummy; +END +*/|| + + +-- +-- Load table with patterns that will be suppressed globally(always) +-- +CREATE TABLE global_suppressions ( + pattern VARCHAR(255) +) ENGINE=MyISAM|| + + +-- Declare a trigger that makes sure +-- no invalid patterns can be inserted +-- into global_suppressions +-- +/*!50002 +CREATE DEFINER=root@localhost TRIGGER gs_insert +BEFORE INSERT ON global_suppressions +FOR EACH ROW BEGIN + DECLARE dummy INT; + SELECT "" REGEXP NEW.pattern INTO dummy; +END +*/|| + + + +-- +-- Insert patterns that should always be suppressed +-- +INSERT INTO global_suppressions VALUES + ("'SELECT UNIX_TIMESTAMP\\(\\)' failed on master"), + ("Aborted connection"), + ("Client requested master to start replication from impossible position"), + ("Could not find first log file name in binary log"), + ("Enabling keys got errno"), + ("Error reading master configuration"), + ("Error reading packet"), + ("Event Scheduler"), + ("Failed to open log"), + ("Failed to open the existing master info file"), + ("Forcing shutdown of [0-9]* plugins"), + ("Forcing close of thread"), + + /* + Due to timing issues, it might be that this warning + is printed when the server shuts down and the + computer is loaded. + */ + + ("Got error [0-9]* when reading table"), + ("Incorrect definition of table"), + ("Incorrect information in file"), + ("InnoDB: Warning: we did not need to do crash recovery"), + ("Invalid \\(old\\?\\) table or database name"), + ("Lock wait timeout exceeded"), + ("Log entry on master is longer than max_allowed_packet"), + ("unknown option '--loose-"), + ("unknown variable 'loose-"), + ("You have forced lower_case_table_names to 0 through a command-line option"), + ("Setting lower_case_table_names=2"), + ("NDB Binlog:"), + ("NDB: failed to setup table"), + ("NDB: only row based binary logging"), + ("Neither --relay-log nor --relay-log-index were used"), + ("Query partially completed"), + ("Slave I.O thread aborted while waiting for relay log"), + ("Slave SQL thread is stopped because UNTIL condition"), + ("Slave SQL thread retried transaction"), + ("Slave \\(additional info\\)"), + ("Slave: .*Duplicate column name"), + ("Slave: .*master may suffer from"), + ("Slave: According to the master's version"), + ("Slave: Column [0-9]* type mismatch"), + ("Slave: Error .* doesn't exist"), + ("Slave: Error .*Unknown table"), + ("Slave: Error in Write_rows event: "), + ("Slave: Field .* of table .* has no default value"), + ("Slave: Field .* doesn't have a default value"), + ("Slave: Query caused different errors on master and slave"), + ("Slave: Table .* doesn't exist"), + ("Slave: Table width mismatch"), + ("Slave: The incident LOST_EVENTS occured on the master"), + ("Slave: Unknown error.* 1105"), + ("Slave: Can't drop database.* database doesn't exist"), + ("Slave SQL:.*(Error_code: \[\[:digit:\]\]+|Query:.*)"), + ("Sort aborted"), + ("Time-out in NDB"), + ("Warning:\s+One can only use the --user.*root"), + ("Warning:\s+Setting lower_case_table_names=2"), + ("Warning:\s+Table:.* on (delete|rename)"), + ("You have an error in your SQL syntax"), + ("deprecated"), + ("description of time zone"), + ("equal MySQL server ids"), + ("error .*connecting to master"), + ("error reading log entry"), + ("lower_case_table_names is set"), + ("skip-name-resolve mode"), + ("slave SQL thread aborted"), + ("Slave: .*Duplicate entry"), + + /* + Special case, made as specific as possible, for: + Bug #28436: Incorrect position in SHOW BINLOG EVENTS causes + server coredump + */ + + ("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49"), + + ("Statement is not safe to log in statement format"), + + /* test case for Bug#bug29807 copies a stray frm into database */ + ("InnoDB: Error: table `test`.`bug29807` does not exist in the InnoDB internal"), + ("Cannot find or open table test\/bug29807 from"), + + /* innodb foreign key tests that fail in ALTER or RENAME produce this */ + ("InnoDB: Error: in ALTER TABLE `test`.`t[12]`"), + ("InnoDB: Error: in RENAME TABLE table `test`.`t1`"), + ("InnoDB: Error: table `test`.`t[12]` does not exist in the InnoDB internal"), + + /* Test case for Bug#14233 produces the following warnings: */ + ("Stored routine 'test'.'bug14233_1': invalid value in column mysql.proc"), + ("Stored routine 'test'.'bug14233_2': invalid value in column mysql.proc"), + ("Stored routine 'test'.'bug14233_3': invalid value in column mysql.proc"), + + /* + BUG#32080 - Excessive warnings on Solaris: setrlimit could not + change the size of core files + */ + ("setrlimit could not change the size of core files to 'infinity'"), + + /* + rpl_extrColmaster_*.test, the slave thread produces warnings + when it get updates to a table that has more columns on the + master + */ + ("Slave: Unknown column 'c7' in 't15' Error_code: 1054"), + ("Slave: Can't DROP 'c7'.* 1091"), + ("Slave: Key column 'c6'.* 1072"), + + /* Test case for Bug#31590 in order_by.test produces the following error */ + ("Out of sort memory; increase server sort buffer size"), + + /* Special case for Bug #26402 in show_check.test + - Question marks are not valid file name parts on Windows. Ignore + this error message. + */ + ("Can't find file: '.\\\\test\\\\\\?{8}.frm'"), + + /* maria-recovery.test has warning about missing log file */ + ("File '.*maria_log.000.*' not found \\(Errcode: 2\\)"), + /* and about marked-corrupted table */ + ("Table '..mysqltest.t_corrupted1' is crashed, skipping it. Please repair"), + /* maria-recover.test corrupts tables on purpose */ + ("Checking table: '..mysqltest.t_corrupted2'"), + ("Table '..mysqltest.t_corrupted2' is marked as crashed and should be"), + ("Incorrect key file for table '..mysqltest.t_corrupted2.MAI'"), + + + ("THE_LAST_SUPPRESSION")|| + + +-- +-- Procedure that uses the above created tables to check +-- the servers error log for warnings +-- +CREATE DEFINER=root@localhost PROCEDURE check_warnings(OUT result INT) +BEGIN + DECLARE `pos` bigint unsigned; + + -- Don't write these queries to binlog + SET SQL_LOG_BIN=0; + + -- + -- Remove mark from lines that are suppressed by global suppressions + -- + UPDATE error_log el, global_suppressions gs + SET suspicious=0 + WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; + + -- + -- Remove mark from lines that are suppressed by test specific suppressions + -- + UPDATE error_log el, test_suppressions ts + SET suspicious=0 + WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; + + -- + -- Get the number of marked lines and return result + -- + SELECT COUNT(*) INTO @num_warnings FROM error_log + WHERE suspicious=1; + + IF @num_warnings > 0 THEN + SELECT file_name, line + FROM error_log WHERE suspicious=1; + --SELECT * FROM test_suppressions; + -- Return 2 -> check failed + SELECT 2 INTO result; + ELSE + -- Return 0 -> OK + SELECT 0 INTO RESULT; + END IF; + + -- Cleanup for next test + TRUNCATE test_suppressions; + DROP TABLE error_log; + +END|| + +-- +-- Declare a procedure testcases can use to insert test +-- specific suppressions +-- +/*!50001 +CREATE DEFINER=root@localhost +PROCEDURE add_suppression(pattern VARCHAR(255)) +BEGIN + INSERT INTO test_suppressions (pattern) VALUES (pattern); +END +*/|| + + diff --git a/mysql-test/include/mysqlbinlog_row_engine.inc b/mysql-test/include/mysqlbinlog_row_engine.inc index 8211baea22c..95440ab04a0 100644 --- a/mysql-test/include/mysqlbinlog_row_engine.inc +++ b/mysql-test/include/mysqlbinlog_row_engine.inc @@ -1651,7 +1651,7 @@ FLUSH LOGS; let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9-]*[.][0-9]{1,3})[0-9e+-]*[^ ]*[ ]*(.*(FLOAT|DOUBLE).*[*].)/\1... \2/ ---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 --echo # --echo # Cleanup. @@ -1731,7 +1731,7 @@ FLUSH LOGS; let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9-]*[.][0-9]{1,3})[0-9e+-]*[^ ]*[ ]*(.*(FLOAT|DOUBLE).*[*].)/\1... \2/ ---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 --echo # --echo # Cleanup. @@ -1854,7 +1854,7 @@ FLUSH LOGS; let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9-]*[.][0-9]{1,3})[0-9e+-]*[^ ]*[ ]*(.*(FLOAT|DOUBLE).*[*].)/\1... \2/ ---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 --echo # --echo # Cleanup. @@ -1887,7 +1887,7 @@ eval CREATE TABLE t1 ( --echo # --echo # Load data. --echo # -LOAD DATA INFILE '../std_data_ln/loaddata5.dat' +LOAD DATA INFILE '../../std_data/loaddata5.dat' INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (c1,c2) SET c3 = 'Wow'; @@ -1912,7 +1912,7 @@ FLUSH LOGS; let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9-]*[.][0-9]{1,3})[0-9e+-]*[^ ]*[ ]*(.*(FLOAT|DOUBLE).*[*].)/\1... \2/ ---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 --echo # --echo # Cleanup. diff --git a/mysql-test/include/mysqltest-x.inc b/mysql-test/include/mysqltest-x.inc index dd1468aed07..797c5c39f3f 100644 --- a/mysql-test/include/mysqltest-x.inc +++ b/mysql-test/include/mysqltest-x.inc @@ -1,2 +1,3 @@ echo Output from mysqltest-x.inc; +exit; diff --git a/mysql-test/include/ndb_backup.inc b/mysql-test/include/ndb_backup.inc index f0a883d4e11..e6780788fe9 100644 --- a/mysql-test/include/ndb_backup.inc +++ b/mysql-test/include/ndb_backup.inc @@ -2,23 +2,21 @@ # By JBM 2006-02-16 So that the code is not repeated # # in test cases and can be reused. # ###################################################### ---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT +--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "start backup" >> $NDB_TOOLS_OUTPUT # there is no neat way to find the backupid, this is a hack to find it... +let $dump_file= $MYSQLTEST_VARDIR/tmp/tmp.dat; +--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="$NDB_CONNECTSTRING" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $dump_file ---exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat +CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +--replace_result $dump_file DUMP_FILE +eval LOAD DATA INFILE '$dump_file' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; -DELETE FROM test.backup_info; - -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; - ---replace_column 1 <the_backup_id> - -SELECT @the_backup_id:=backup_id FROM test.backup_info; +# Load backup id into environment variable +let the_backup_id=`SELECT backup_id from test.backup_info`; +DROP TABLE test.backup_info; -let the_backup_id=`select @the_backup_id`; +remove_file $dump_file; -DROP TABLE test.backup_info; diff --git a/mysql-test/include/ndb_master-slave_2ch.inc b/mysql-test/include/ndb_master-slave_2ch.inc new file mode 100644 index 00000000000..52a06c01d86 --- /dev/null +++ b/mysql-test/include/ndb_master-slave_2ch.inc @@ -0,0 +1,136 @@ +############################################################# +# Author: Serge Kozlov <skozlov@mysql.com> +# Date: 03/17/2008 +# Purpose: Set up circular cluster replication where each +# cluster has two mysqlds and replication directions are +# following: +# master ---> slave +# / \ +# cluster A cluster B +# \ / +# master1 <--- slave1 +############################################################# + +--source include/have_log_bin.inc + +# Make connections to mysqlds + +connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); +connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT1,); +connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); +connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT1,); + +# Check that all mysqld compiled with ndb support + +--connection master +--disable_query_log +--require r/true.require +SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster'; +--source include/ndb_not_readonly.inc +--enable_query_log + +--connection master1 +--disable_query_log +--require r/true.require +SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster'; +--source include/ndb_not_readonly.inc +--enable_query_log + +--connection slave +--disable_query_log +--require r/true.require +SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster'; +--source include/ndb_not_readonly.inc +--enable_query_log + +--connection slave1 +--disable_query_log +--require r/true.require +SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster'; +--source include/ndb_not_readonly.inc +--enable_query_log + +# Stop slaves + +--connection master +--disable_warnings +STOP SLAVE; +--wait_for_slave_to_stop +--enable_warnings + +--connection master1 +--disable_warnings +STOP SLAVE; +--wait_for_slave_to_stop +--enable_warnings + +--connection slave +--disable_warnings +STOP SLAVE; +--wait_for_slave_to_stop +--enable_warnings + +--connection slave1 +--disable_warnings +STOP SLAVE; +--wait_for_slave_to_stop +--enable_warnings + +# Reset masters + +--connection master +--disable_warnings +--disable_query_log +USE test; +--enable_query_log +DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; +--enable_warnings +RESET MASTER; + +--connection master1 +--disable_warnings +--disable_query_log +USE test; +--enable_query_log +DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; +--enable_warnings +RESET MASTER; + +--connection slave +--disable_warnings +--disable_query_log +USE test; +--enable_query_log +DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; +--enable_warnings +RESET MASTER; + +--connection slave1 +--disable_warnings +--disable_query_log +USE test; +--enable_query_log +DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; +--enable_warnings +RESET MASTER; + +# Start slaves + +--connection slave +RESET SLAVE; +--replace_result $MASTER_MYPORT MASTER_MYPORT +--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$MASTER_MYPORT,master_user='root' +START SLAVE; +--source include/wait_for_slave_to_start.inc + +--connection master1 +RESET SLAVE; +--replace_result $SLAVE_MYPORT1 SLAVE_MYPORT1 +--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT1,master_user='root' +START SLAVE; +--source include/wait_for_slave_to_start.inc + + +# Set the default connection to 'master' (cluster A) +connection master; + diff --git a/mysql-test/include/ndb_not_readonly.inc b/mysql-test/include/ndb_not_readonly.inc index a87ba66f1ef..f50ca0cab66 100644 --- a/mysql-test/include/ndb_not_readonly.inc +++ b/mysql-test/include/ndb_not_readonly.inc @@ -17,7 +17,7 @@ while ($mysql_errno) { if (!$counter) { - die("Failed while waiting for mysqld to come out of readonly mode"); + die Failed while waiting for mysqld to come out of readonly mode; } dec $counter; --sleep 0.1 diff --git a/mysql-test/include/ndb_restore_master.inc b/mysql-test/include/ndb_restore_master.inc index b01a0b58ee9..ae5f055b442 100644 --- a/mysql-test/include/ndb_restore_master.inc +++ b/mysql-test/include/ndb_restore_master.inc @@ -3,6 +3,6 @@ # in test cases and can be reused. # ###################################################### ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -p 8 -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -p 8 -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT diff --git a/mysql-test/include/ndb_restore_slave_eoption.inc b/mysql-test/include/ndb_restore_slave_eoption.inc index f1f6cf96881..a8657f68c8d 100644 --- a/mysql-test/include/ndb_restore_slave_eoption.inc +++ b/mysql-test/include/ndb_restore_slave_eoption.inc @@ -3,9 +3,9 @@ # in test cases and can be reused. # ###################################################### ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT diff --git a/mysql-test/include/no_running_event_scheduler.inc b/mysql-test/include/no_running_event_scheduler.inc new file mode 100644 index 00000000000..92813df9f96 --- /dev/null +++ b/mysql-test/include/no_running_event_scheduler.inc @@ -0,0 +1,23 @@ +########## include/no_running_event_scheduler.inc ########################## +# # +# Wait till the event scheduler disappeared from processlist. # +# # +# The characteristics of the event_scheduler entry within the processlist is # +# user = 'event_scheduler' and command = 'Daemon'. I am not 100% sure if # +# ther is no short phase with command <> 'Daemon'. # +# A query with WHERE user = 'event_scheduler' only will also catch events in # +# startup phase. This is no problem since this phase is very short. # +# # +# A wait_timeout of >= 3 seconds was within experiments sufficient even on a # +# testing box with heavy parallel load. Therefore 5 seconds should be enough. # +# # +# Creation: # +# 2008-12-19 mleich Implement this check needed for test bug fixes # +# # +################################################################################ + +let $wait_timeout= 5; +let $wait_condition= + SELECT COUNT(*) = 0 FROM information_schema.processlist + WHERE user = 'event_scheduler'; +--source include/wait_condition.inc diff --git a/mysql-test/include/no_running_events.inc b/mysql-test/include/no_running_events.inc new file mode 100644 index 00000000000..8090b2706b8 --- /dev/null +++ b/mysql-test/include/no_running_events.inc @@ -0,0 +1,25 @@ +########## include/no_running_events.inc ################################### +# # +# Wait till all event executors have finished their work. # +# # +# Different event executors share the characteristics that their entry within # +# processlist contains command = 'Connect'. # +# Of course the corresponding query will also catch other connections being # +# within the connect phase. This is no problem since the connect phase is # +# usually very short. # +# # +# A wait_timeout of >= 3 seconds was during experiments in case of "simple" # +# SQL commands sufficient even on a testing box with heavy parallel load. # +# "simple" = no sleeps, no long running commands, no waiting for lock ... # +# We use here the default of 30 seconds because this wastes some time only in # +# case of unexpected situations. # +# # +# Creation: # +# 2008-12-19 mleich Implement this check needed for test bug fixes # +# # +################################################################################ + +let $wait_condition= + SELECT COUNT(*) = 0 FROM information_schema.processlist + WHERE command = 'Connect'; +--source include/wait_condition.inc diff --git a/mysql-test/include/not_as_root.inc b/mysql-test/include/not_as_root.inc index e0277ea593e..6c88051d632 100644 --- a/mysql-test/include/not_as_root.inc +++ b/mysql-test/include/not_as_root.inc @@ -1,4 +1,3 @@ --- require r/not_as_root.require -disable_query_log; -eval select "$MYSQL_TEST_ROOT" as running_as_root; -enable_query_log; +if ($MYSQL_TEST_ROOT){ + skip Not as root; +} diff --git a/mysql-test/include/query_cache.inc b/mysql-test/include/query_cache.inc index fdd6bc50eae..77ea0021a5d 100644 --- a/mysql-test/include/query_cache.inc +++ b/mysql-test/include/query_cache.inc @@ -176,6 +176,7 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; # Final cleanup +eval set GLOBAL query_cache_size=$save_query_cache_size; connection default; drop table t2; disconnect connection1; diff --git a/mysql-test/include/report-features.test b/mysql-test/include/report-features.test index df395f6e3f0..1e4ab232490 100644 --- a/mysql-test/include/report-features.test +++ b/mysql-test/include/report-features.test @@ -9,3 +9,4 @@ show engines; show variables; --echo ===== STOP ===== --enable_query_log +exit;
\ No newline at end of file diff --git a/mysql-test/include/reset_master_and_slave.inc b/mysql-test/include/reset_master_and_slave.inc index c2d4120ddc9..30ba1f07a40 100644 --- a/mysql-test/include/reset_master_and_slave.inc +++ b/mysql-test/include/reset_master_and_slave.inc @@ -1,10 +1,8 @@ --echo **** Resetting master and slave **** connection slave; -STOP SLAVE; -source include/wait_for_slave_to_stop.inc; +source include/stop_slave.inc; RESET SLAVE; connection master; RESET MASTER; connection slave; -START SLAVE; -source include/wait_for_slave_to_start.inc; +source include/start_slave.inc; diff --git a/mysql-test/include/restart_mysqld.inc b/mysql-test/include/restart_mysqld.inc new file mode 100644 index 00000000000..0f363ff1ee3 --- /dev/null +++ b/mysql-test/include/restart_mysqld.inc @@ -0,0 +1,25 @@ + +# Write file to make mysql-test-run.pl expect the "crash", but don't start +# it until it's told to +--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +wait +EOF + +# Send shutdown to the connected server and give +# it 10 seconds to die before zapping it +shutdown_server 10; + +# Write file to make mysql-test-run.pl start up the server again +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +restart +EOF + +# Turn on reconnect +--enable_reconnect + +# Call script that will poll the server waiting for it to be back online again +--source include/wait_until_connected_again.inc + +# Turn off reconnect again +--disable_reconnect + diff --git a/mysql-test/include/rpl_events.inc b/mysql-test/include/rpl_events.inc index 34ceba81a38..0effa8c4e5c 100644 --- a/mysql-test/include/rpl_events.inc +++ b/mysql-test/include/rpl_events.inc @@ -62,7 +62,9 @@ SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name DROP EVENT IF EXISTS test.slave_once; --enable_warnings -CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO +# Create an event on slave and check its state. An event shouldn't be executed +# so set start time in 1 hour. +CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once'); --echo "Checking event status on the slave for originator value = slave's server_id" @@ -81,8 +83,11 @@ connection master; DROP EVENT IF EXISTS test.justonce; --enable_warnings +# Create an event on master and check its state on slave. An event shouldn't be executed +# so set start time in 1 hour. Check that changes of event statement replicated to slave + --echo "Creating event test.er on the master" -CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO +CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er'); --echo "Checking event status on the master" @@ -95,7 +100,7 @@ SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND connection master; --echo "Altering event test.er on the master" -ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO +ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er'); --echo "Checking event status on the master" @@ -123,8 +128,11 @@ SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; # test the DISABLE ON SLAVE for setting event SLAVESIDE_DISABLED as status # on CREATE EVENT +# Create an event on slave and check its status. An event shouldn't be executed +# so set start time in 1 hour. + --echo "Creating event test.slave_terminate on the slave" -CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DO +CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate'); --echo "Checking event status on the slave" diff --git a/mysql-test/include/rpl_multi_engine.inc b/mysql-test/include/rpl_multi_engine.inc index f2c837ef90b..b2d1a9c1cef 100644 --- a/mysql-test/include/rpl_multi_engine.inc +++ b/mysql-test/include/rpl_multi_engine.inc @@ -9,7 +9,7 @@ select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; sync_slave_with_master; select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; connection master; -DELETE FROM mysqltest1.t1 WHERE id = 42; +DELETE FROM t1 WHERE id = 42; select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; sync_slave_with_master; select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; diff --git a/mysql-test/include/running_event_scheduler.inc b/mysql-test/include/running_event_scheduler.inc new file mode 100644 index 00000000000..296bf842e82 --- /dev/null +++ b/mysql-test/include/running_event_scheduler.inc @@ -0,0 +1,30 @@ +############# include/running_event_scheduler.inc ########################## +# # +# Wait till the event scheduler reached its final state within the processlist.# +# # +# The characteristics of the event_scheduler entry within the processlist is # +# user = 'event_scheduler' and command = 'Daemon'. I am not 100% sure if # +# ther is no short phase with command <> 'Daemon'. # +# A query with WHERE user = 'event_scheduler' only will also catch events in # +# startup phase. # +# # +# Creation: # +# 2008-12-19 mleich Implement this check needed for test bug fixes # +# # +################################################################################ + +# 1. Check that the server system variable shows the state needed +if (`SELECT @@global.event_scheduler <> 'ON'`) +{ + --echo # Error: We expect here that the event scheduler is switched on. + SELECT @@global.event_scheduler; + --echo # Thinkable reasons: + --echo # 1. SET GLOBAL event_scheduler = ON had not the expected effect. + --echo # 2. Use of the current routine (include/running_event_scheduler.inc) + --echo # within the wrong situation + --die +} +let $wait_condition= + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE user = 'event_scheduler' AND command = 'Daemon'; +--source include/wait_condition.inc diff --git a/mysql-test/include/setup_fake_relay_log.inc b/mysql-test/include/setup_fake_relay_log.inc new file mode 100644 index 00000000000..8113ed6dc10 --- /dev/null +++ b/mysql-test/include/setup_fake_relay_log.inc @@ -0,0 +1,78 @@ +# ==== Purpose ==== +# +# Setup replication from an existing relay log in the current +# connection. +# +# ==== Usage ==== +# +# Make sure the slave is not running and issue: +# +# let $fake_relay_log= /path/to/fake-relay-log-file.000001 +# source include/setup_fake_relay_log.inc; +# START SLAVE SQL_THREAD; # setup_fake_relay_log doesn't start slave +# ... +# source include/cleanup_fake_relay_log.inc +# +# You must run the server with --relay-log=FILE. You probably want to +# run with --replicate-same-server-id too. +# +# ==== Implementation ==== +# +# First makes a sanity check, ensuring that the slave threads are not +# running. Then copies the $fake_relay_log to RELAY_BIN-fake.000001, +# where RELAY_BIN is the basename of the relay log, and updates +# RELAY_BIN.index. Finally issues CHANGE MASTER so that it uses the +# given files. +# +# ==== Side effects ==== +# +# Creates a binlog file and a binlog index file, and sets +# @@global.relay_log_purge=1. All this is restored when you call +# cleanup_fake_relay_log.inc. +# +# Enables the query log. + + +--disable_query_log + +# Print message. +let $_fake_relay_log_printable= `SELECT REPLACE('$fake_relay_log', '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')`; +--echo Setting up fake replication from $_fake_relay_log_printable + +# Sanity check. +let $_sql_running= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1); +let $_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1); +if (`SELECT "$_sql_running" = "Yes" OR "$_io_running" = "Yes"`) { + --echo Error: Slave was running when test case sourced + --echo include/setup_fake_replication.inc + --echo Slave_IO_Running = $_io_running; Slave_SQL_Running = $_sql_running + --echo Printing some debug info: + SHOW SLAVE STATUS; + SHOW MASTER STATUS; + SHOW BINLOG EVENTS; + SHOW PROCESSLIST; +} + +# Read server variables. +let $MYSQLD_DATADIR= `SELECT @@datadir`; +let $_fake_filename= query_get_value(SHOW VARIABLES LIKE 'relay_log', Value, 1); +if (`SELECT '$_fake_filename' = ''`) { + --echo Badly written test case: relay_log variable is empty. Please use the + --echo server option --relay-log=FILE. +} +let $_fake_relay_log= $MYSQLD_DATADIR/$_fake_filename-fake.000001; +let $_fake_relay_index= $MYSQLD_DATADIR/$_fake_filename.index; +# Need to restore relay_log_purge in cleanup_fake_relay_log.inc, since +# CHANGE MASTER modifies it (see the manual for CHANGE MASTER). +let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`; + +# Create relay log file. +copy_file $fake_relay_log $_fake_relay_log; + +# Create relay log index. +eval SELECT '$_fake_relay_log' INTO OUTFILE '$_fake_relay_index'; + +# Setup replication from existing relay log. +eval CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_relay_log', RELAY_LOG_POS=4; + +--enable_query_log diff --git a/mysql-test/include/show_rpl_debug_info.inc b/mysql-test/include/show_rpl_debug_info.inc new file mode 100644 index 00000000000..252d63f1bf4 --- /dev/null +++ b/mysql-test/include/show_rpl_debug_info.inc @@ -0,0 +1,87 @@ +# ==== Purpose ==== +# +# Print status information for replication, typically used to debug +# test failures. +# +# First, the following is printed on slave: +# +# SHOW SLAVE STATUS +# SHOW PROCESSLIST +# SHOW BINLOG EVENTS IN <binlog_name> +# +# Where <binlog_name> is the currently active binlog. +# +# Then, the following is printed on master: +# +# SHOW MASTER STATUS +# SHOW PROCESSLIST +# SHOW BINLOG EVENTS IN <sql_binlog_name> +# SHOW BINLOG EVENTS IN <io_binlog_name> +# +# Where <sql_binlog_name> is the binlog name that the slave sql thread +# is currently reading from and <io_binlog_name> is the binlog that +# the slave IO thread is currently reading from. +# +# ==== Usage ==== +# +# [let $master_connection= <connection>;] +# source include/show_rpl_debug_info.inc; +# +# If $master_connection is set, debug info will be retrieved from the +# connection named $master_connection. Otherwise, it will be +# retrieved from the 'master' connection if the current connection is +# 'slave'. + +let $_con= $CURRENT_CONNECTION; +--echo +--echo [on $_con] +--echo +--echo **** SHOW SLAVE STATUS on $_con **** +query_vertical SHOW SLAVE STATUS; +--echo +--echo **** SHOW PROCESSLIST on $_con **** +SHOW PROCESSLIST; +--echo +--echo **** SHOW BINLOG EVENTS on $_con **** +let $binlog_name= query_get_value("SHOW MASTER STATUS", File, 1); +eval SHOW BINLOG EVENTS IN '$binlog_name'; + +let $_master_con= $master_connection; +if (`SELECT '$_master_con' = ''`) +{ + if (`SELECT '$_con' = 'slave'`) + { + let $_master_con= master; + } + if (`SELECT '$_master_con' = ''`) + { + --echo Unable to determine master connection. No debug info printed for master. + --echo Please fix the test case by setting $master_connection before sourcing + --echo show_rpl_debug_info.inc. + } +} + +if (`SELECT '$_master_con' != ''`) +{ + + let $master_binlog_name_io= query_get_value("SHOW SLAVE STATUS", Master_Log_File, 1); + let $master_binlog_name_sql= query_get_value("SHOW SLAVE STATUS", Relay_Master_Log_File, 1); + --echo + --echo [on $_master_con] + connection $_master_con; + --echo + --echo **** SHOW MASTER STATUS on $_master_con **** + query_vertical SHOW MASTER STATUS; + --echo + --echo **** SHOW PROCESSLIST on $_master_con **** + SHOW PROCESSLIST; + --echo + --echo **** SHOW BINLOG EVENTS on $_master_con **** + eval SHOW BINLOG EVENTS IN '$master_binlog_name_sql'; + if (`SELECT '$master_binlog_name_io' != '$master_binlog_name_sql'`) + { + eval SHOW BINLOG EVENTS IN '$master_binlog_name_io'; + } + + connection $_con; +} diff --git a/mysql-test/include/start_slave.inc b/mysql-test/include/start_slave.inc new file mode 100644 index 00000000000..78a02736de8 --- /dev/null +++ b/mysql-test/include/start_slave.inc @@ -0,0 +1,21 @@ +# ==== Purpose ==== +# +# Issues START SLAVE on the current connection. Then waits until both +# the IO and SQL threads have started, or until a timeout is reached. +# +# Please use this instead of 'START SLAVE', to reduce the risk of test +# case bugs. +# +# ==== Usage ==== +# +# source include/wait_for_slave_to_start.inc; +# +# Parameters to this macro are $slave_timeout and +# $master_connection. See wait_for_slave_param.inc for +# descriptions. + +--disable_query_log +START SLAVE; +--enable_query_log +--echo include/start_slave.inc +source include/wait_for_slave_to_start.inc; diff --git a/mysql-test/include/stop_slave.inc b/mysql-test/include/stop_slave.inc new file mode 100644 index 00000000000..7161e6fe739 --- /dev/null +++ b/mysql-test/include/stop_slave.inc @@ -0,0 +1,21 @@ +# ==== Purpose ==== +# +# Issues STOP SLAVE on the current connection. Then waits until both +# the IO and SQL threads have stopped, or until a timeout is reached. +# +# Please use this instead of 'STOP SLAVE', to reduce the risk of test +# case bugs. +# +# ==== Usage ==== +# +# source include/wait_for_slave_to_start.inc; +# +# Parameters to this macro are $slave_timeout and +# $master_connection. See wait_for_slave_param.inc for +# descriptions. + +--disable_query_log +STOP SLAVE; +--enable_query_log +--echo include/stop_slave.inc +source include/wait_for_slave_to_stop.inc; diff --git a/mysql-test/include/sync_slave_io_with_master.inc b/mysql-test/include/sync_slave_io_with_master.inc new file mode 100644 index 00000000000..f7dd563039c --- /dev/null +++ b/mysql-test/include/sync_slave_io_with_master.inc @@ -0,0 +1,36 @@ +# ==== Purpose ==== +# +# Waits until the slave IO thread has been synced, i.e., all events +# have been copied over to slave. Does not care if the SQL thread is +# in sync. +# +# +# ==== Usage ==== +# +# source include/sync_slave_io_with_master.inc; +# +# Syncs to the current position on master, as found by SHOW MASTER +# STATUS. +# +# Must be called on the master. Will change connection to the slave. +# +# Parameters to this macro are $slave_timeout and +# $master_connection. See wait_for_slave_param.inc for +# descriptions. + +let $_master_file= query_get_value("SHOW MASTER STATUS", File, 1); +let $_master_pos= query_get_value("SHOW MASTER STATUS", Position, 1); + +connection slave; + +let $slave_error_message= Failed while waiting for slave IO thread to sync; + +let $slave_param= Master_Log_File; +let $slave_param_value= $_master_file; +source include/wait_for_slave_param.inc; + +let $slave_param= Read_Master_Log_Pos; +let $slave_param_value= $_master_pos; +source include/wait_for_slave_param.inc; + +let $slave_error_message= ; diff --git a/mysql-test/include/testdb_only.inc b/mysql-test/include/testdb_only.inc index ddc3f123d45..528e2f3eb9d 100644 --- a/mysql-test/include/testdb_only.inc +++ b/mysql-test/include/testdb_only.inc @@ -19,12 +19,6 @@ # # ################################################################### ---disable_query_log -eval set @USE_RUNNING_SERVER= '$USE_RUNNING_SERVER'; ---require r/testdb_only.require -SELECT 'use extern server' - AS "Variable_name ", - IF(@USE_RUNNING_SERVER= '1','YES', - IF(@USE_RUNNING_SERVER= '0','NO','UNEXPECTED')) - AS "Value" ; ---enable_query_log +if ($USE_RUNNING_SERVER){ + skip Not with extern server; +} diff --git a/mysql-test/include/wait_condition_sp.inc b/mysql-test/include/wait_condition_sp.inc new file mode 100644 index 00000000000..66301da557c --- /dev/null +++ b/mysql-test/include/wait_condition_sp.inc @@ -0,0 +1,62 @@ +# include/wait_condition.inc +# +# SUMMARY +# +# Waits until the passed statement returns true, or the operation +# times out. +# +# USAGE +# +# let $wait_condition= +# SELECT c = 3 FROM t; +# --source include/wait_condition.inc +# +# OR +# +# let $wait_timeout= 60; # Override default 30 seconds with 60. +# let $wait_condition= +# SELECT c = 3 FROM t; +# --source include/wait_condition.inc +# --echo Executed the test condition $wait_condition_reps times +# +# EXAMPLE +# events_bugs.test, events_time_zone.test +# + +--disable_query_log + +let $wait_counter= 300; +if ($wait_timeout) +{ + let $wait_counter= `SELECT $wait_timeout * 10`; +} +# Reset $wait_timeout so that its value won't be used on subsequent +# calls, and default will be used instead. +let $wait_timeout= 0; + +# Keep track of how many times the wait condition is tested +# This is used by some tests (e.g., main.status) +let $wait_condition_reps= 0; +while ($wait_counter) +{ + let $success= `$wait_condition`; + inc $wait_condition_reps; + if ($success) + { + let $wait_counter= 0; + } + if (!$success) + { + real_sleep 0.1; + dec $wait_counter; + } +} +if (!$success) +{ + echo Timeout in wait_condition.inc for $wait_condition; + show master status; + show slave status; +} + +--enable_query_log + diff --git a/mysql-test/include/wait_for_slave_io_to_start.inc b/mysql-test/include/wait_for_slave_io_to_start.inc new file mode 100644 index 00000000000..abdc8339290 --- /dev/null +++ b/mysql-test/include/wait_for_slave_io_to_start.inc @@ -0,0 +1,19 @@ +# ==== Purpose ==== +# +# Waits until the IO thread of the current connection has started and +# connected to the master (i.e., until SHOW SLAVE STATUS returns Yes +# in the Slave_IO_Running field), or until a timeout is reached. +# +# ==== Usage ==== +# +# source include/wait_for_slave_io_to_start.inc; +# +# Parameters to this macro are $slave_timeout and +# $master_connection. See wait_for_slave_param.inc for +# descriptions. + +let $slave_param= Slave_IO_Running; +let $slave_param_value= Yes; +let $slave_error_message= Failed while waiting for slave IO thread to start; +source include/wait_for_slave_param.inc; +let $slave_error_message= ; diff --git a/mysql-test/include/wait_for_slave_io_to_stop.inc b/mysql-test/include/wait_for_slave_io_to_stop.inc index 6e66d4e7521..f61b0db1ed7 100644 --- a/mysql-test/include/wait_for_slave_io_to_stop.inc +++ b/mysql-test/include/wait_for_slave_io_to_stop.inc @@ -1,33 +1,24 @@ -################################################### -#Author: Jeb -#Date: 2007-06-11 -#Purpose: used for io errors on the slave. If Slave gets an io -# error, the io trhead should stop -#Details: -# 1) Fill in and setup variables -# 2) loop through looking for -# sql threads to stop -# 3) If loops too long die. -#################################################### -connection slave; -let $my_show= SHOW SLAVE STATUS; -let $sql_running= Slave_IO_Running; -let $row_number= 1; -let $run= 1; -let $counter= 300; +# ==== Purpose ==== +# +# Waits until the IO thread of the current connection has stopped, or +# until a timeout is reached. +# +# ==== Usage ==== +# +# source include/wait_for_slave_io_to_stop.inc; +# +# Parameters to this macro are $slave_timeout and +# $master_connection. See wait_for_slave_param.inc for +# descriptions. -while ($run) +# if server has not used CHANGE MASTER to initiate slave, SHOW SLAVE +# STATUS will return an empty set. +let $_slave_io_running= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1); +if (`SELECT '$_slave_io_running' != 'No such row'`) { - let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number); - if (`SELECT '$io_result' = 'No'`){ - let $run= 0; - } - sleep 0.1; - if (!$counter){ - --echo "Failed while waiting for slave IO thread to stop" - query_vertical SHOW SLAVE STATUS; - exit; - } - dec $counter; + let $slave_param= Slave_IO_Running; + let $slave_param_value= No; + let $slave_error_message= Failed while waiting for slave IO thread to stop; + source include/wait_for_slave_param.inc; + let $slave_error_message= ; } - diff --git a/mysql-test/include/wait_for_slave_param.inc b/mysql-test/include/wait_for_slave_param.inc index fed97195aba..82e57922913 100644 --- a/mysql-test/include/wait_for_slave_param.inc +++ b/mysql-test/include/wait_for_slave_param.inc @@ -1,26 +1,82 @@ -# include/wait_for_slave_param.inc +# ==== Purpose ==== # -# SUMMARY +# Waits until SHOW SLAVE STATUS has returned a specified value, or +# until a timeout is reached. # -# Waits until SHOW SLAVE STATUS has returned a spicified value. +# ==== Usage ==== # -# USAGE +# let $slave_param= Slave_SQL_Running; +# let $slave_param_value= No; +# source include/slave_wait_param.inc; # -# let $slave_param= Slave_SQL_Running; -# let $slave_param_value= No; -# --source include/slave_wait_param.inc +# Parameters: +# +# $slave_param, $slave_param_value +# This macro will wait until the column of the output of SHOW SLAVE +# STATUS named $slave_param gets the value $slave_param_value. See +# the example above. +# +# $slave_param_comparison +# By default, this file waits until $slave_param becomes equal to +# $slave_param_value. If you want to wait until $slave_param +# becomes *unequal* to $slave_param_value, set this parameter to the +# string '!=', like this: +# let $slave_param_comparison= !=; +# +# $slave_timeout +# The default timeout is 5 minutes. You can change the timeout by +# setting $slave_timeout. The unit is tenths of seconds. +# +# $master_connection +# If the timeout is reached, debug info is given by calling SHOW +# SLAVE STATUS, SHOW PROCESSLIST, and SHOW BINLOG EVENTS. Then, a +# 'connection master' is then issued, and more debug info is given +# by calling SHOW MASTER STATUS, SHOW PROCESSLIST, and SHOW BINLOG +# EVENTS. If $master_connection is set, the latter three commands +# will be issued on $master_connection instead of on the host named +# 'master'. See also show_rpl_debug_info.inc +# +# $slave_error_message +# If set, this is printed when a timeout occurs. This is primarily +# intended to be used by other wait_for_slave_* macros, to indicate +# what the purpose of the wait was. (A very similar error message is +# given by default, but the wait_for_slave_* macros use this to give +# an error message identical to that in previous versions, so that +# errors are easier searchable in the pushbuild history.) + +let $_slave_timeout_counter= $slave_timeout; +if (!$_slave_timeout_counter) +{ + let $_slave_timeout_counter= 3000; +} + +let $_slave_param_comparison= $slave_param_comparison; +if (`SELECT '$_slave_param_comparison' = ''`) +{ + let $_slave_param_comparison= =; +} + +let $_show_slave_status_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1); +while (`SELECT NOT('$_show_slave_status_value' $_slave_param_comparison '$slave_param_value') AND $_slave_timeout_counter > 0`) +{ + dec $_slave_timeout_counter; + if ($_slave_timeout_counter) + { + sleep 0.1; + let $_show_slave_status_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1); + } +} -let $slave_wait_param_counter= 300; -let $slave_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1); -while (`select "$slave_value" != "$slave_param_value"`) +# This has to be outside the loop until BUG#41913 has been fixed +if (!$_slave_timeout_counter) { - dec $slave_wait_param_counter; - if (!$slave_wait_param_counter) + --echo **** ERROR: timeout after $slave_timeout seconds while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value **** + if (`SELECT '$slave_error_message' != ''`) { - --echo ERROR: failed while waiting for slave parameter $slave_param: $slave_param_value - query_vertical show slave status; - exit; + --echo Message: $slave_error_message } - sleep 0.1; - let $slave_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1); + --echo Current connection is '$CURRENT_CONNECTION' + echo Note: the following output may have changed since the failure was detected; + source include/show_rpl_debug_info.inc; + exit; } diff --git a/mysql-test/include/wait_for_slave_sql_error.inc b/mysql-test/include/wait_for_slave_sql_error.inc index 6780edbe2f0..ad1d7a9e639 100644 --- a/mysql-test/include/wait_for_slave_sql_error.inc +++ b/mysql-test/include/wait_for_slave_sql_error.inc @@ -1,33 +1,39 @@ -################################################### -#Author: Sven -#Date: 2007-10-09 -#Purpose: Wait until the slave has an error in the -# sql thread, as indicated by -# "SHOW SLAVE STATUS", or at most 30 -# seconds. -#Details: -# 1) Fill in and setup variables -# 2) loop, looking for sql error on slave -# 3) If it loops too long, die. -#################################################### -connection slave; -let $row_number= 1; -let $run= 1; -let $counter= 300; +# ==== Purpose ==== +# +# Waits until the SQL thread of the current connection has got an +# error, or until a timeout is reached. Also waits until the SQL +# thread has completely stopped. +# +# ==== Usage ==== +# +# source include/wait_for_slave_sql_error.inc; +# +# Parameters: +# +# $slave_sql_errno +# The expected SQL error number. This is required. +# (After BUG#41956 has been fixed, this will be required to be a +# symbolic name instead of a number.) +# +# $slave_timeout +# See wait_for_slave_param.inc for description. +# +# $master_connection +# See wait_for_slave_param.inc for description. -while ($run) -{ - let $sql_result= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, $row_number); - let $run= `SELECT '$sql_result' = '0'`; - if ($run) { - real_sleep 0.1; - if (!$counter){ - --echo "Failed while waiting for slave to produce an error in its sql thread" - --replace_result $MASTER_MYPORT MASTER_PORT - --replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # - query_vertical SHOW SLAVE STATUS; - exit; - } - dec $counter; - } +if (`SELECT '$slave_sql_errno' = ''`) { + --echo !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_fro_slave_sql_error.inc + exit; +} + +let $slave_param= Slave_SQL_Running; +let $slave_param_value= No; +let $slave_error_message= Failed while waiting for slave to stop the SQL thread (expecting error in the SQL thread); +source include/wait_for_slave_param.inc; + +let $_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1); +if (`SELECT '$_error' != '$slave_sql_errno'`) { + --echo Slave stopped with wrong error code: $_error (expected $slave_sql_errno) + source include/show_rpl_debug_info.inc; + exit; } diff --git a/mysql-test/include/wait_for_slave_sql_error_and_skip.inc b/mysql-test/include/wait_for_slave_sql_error_and_skip.inc index 4b4776d2923..247de3a41a1 100644 --- a/mysql-test/include/wait_for_slave_sql_error_and_skip.inc +++ b/mysql-test/include/wait_for_slave_sql_error_and_skip.inc @@ -5,8 +5,23 @@ # # ==== Usage ==== # -# let show_sql_error=0|1; +# let $slave_sql_error= <ERRNO>; # source include/wait_for_slave_sql_error_and_skip.inc; +# +# Parameters: +# +# $slave_sql_errno +# The error number to wait for. This is required. (See +# wait_for_slave_sql_error.inc) +# +# $show_sql_error +# If set, will print the error to the query log. +# +# $slave_timeout +# See wait_for_slave_param.inc for description. +# +# $master_connection +# See wait_for_slave_param.inc for description. echo --source include/wait_for_slave_sql_error_and_skip.inc; connection slave; @@ -17,11 +32,7 @@ if ($show_sql_error) echo Last_SQL_Error = $error; } -# wait for SQL thread to stop after the error -source include/wait_for_slave_sql_to_stop.inc; - # skip the erroneous statement set global sql_slave_skip_counter=1; -start slave; -source include/wait_for_slave_to_start.inc; +source include/start_slave.inc; connection master; diff --git a/mysql-test/include/wait_for_slave_sql_to_start.inc b/mysql-test/include/wait_for_slave_sql_to_start.inc index 14134725da4..48744f5dd13 100644 --- a/mysql-test/include/wait_for_slave_sql_to_start.inc +++ b/mysql-test/include/wait_for_slave_sql_to_start.inc @@ -1,31 +1,17 @@ -################################################### -#Author: Mats (based on file written by Jeb) -#Date: 2008-05-06 -#Purpose: To wait for slave SQL thread to start -#Details: -# 1) Fill in and setup variables -# 2) loop through looking for both -# io and sql threads to start -# 3) If loops too long die. -#################################################### -connection slave; -let $row_number= 1; -let $run= 1; -let $counter= 300; - -while ($run) -{ - let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number); - if (`SELECT '$sql_result' = 'Yes'`){ - let $run= 0; - } - sleep 0.1; - if (!$counter){ - --echo "Failed while waiting for slave SQL to start" - query_vertical SHOW SLAVE STATUS; - exit; - } - dec $counter; -} - +# ==== Purpose ==== +# +# Waits the SQL thread of the current connection has started, or until +# a timeout is reached. +# +# ==== Usage ==== +# +# source include/wait_for_slave_sql_to_start.inc; +# +# Parameters to this macro are $slave_timeout and +# $master_connection. See wait_for_slave_param.inc for +# descriptions. +let $slave_param= Slave_SQL_Running; +let $slave_param_value= Yes; +let $slave_error_message= Failed while waiting for slave SQL to start; +source include/wait_for_slave_param.inc; diff --git a/mysql-test/include/wait_for_slave_sql_to_stop.inc b/mysql-test/include/wait_for_slave_sql_to_stop.inc index cb5c437a586..6992613b646 100644 --- a/mysql-test/include/wait_for_slave_sql_to_stop.inc +++ b/mysql-test/include/wait_for_slave_sql_to_stop.inc @@ -1,33 +1,24 @@ -################################################### -#Author: Jeb -#Date: 2007-06-11 -#Purpose: used for SQL errors on the slave. If Slave gets a sql -# error, the SQL trhead should stop -#Details: -# 1) Fill in and setup variables -# 2) loop through looking for -# sql threads to stop -# 3) If loops too long die. -#################################################### -if (!$keep_connection) -{ - connection slave; -} -let $row_number= 1; -let $run= 1; -let $counter= 300; +# ==== Purpose ==== +# +# Waits the SQL thread of the current connection has stopped, or until +# a timeout is reached. +# +# ==== Usage ==== +# +# source include/wait_for_slave_sql_to_stop.inc; +# +# Parameters to this macro are $slave_timeout and +# $master_connection. See wait_for_slave_param.inc for +# descriptions. -while ($run) +# if server has not used CHANGE MASTER to initiate slave, SHOW SLAVE +# STATUS will return an empty set. +let $_slave_io_running= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1); +if (`SELECT '$_slave_io_running' != 'No such row'`) { - let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number); - if (`SELECT '$sql_result' = 'No'`){ - let $run= 0; - } - sleep 0.1; - if (!$counter){ - --echo "Failed while waiting for slave SQL thread to stop" - query_vertical SHOW SLAVE STATUS; - exit; - } - dec $counter; + let $slave_param= Slave_SQL_Running; + let $slave_param_value= No; + let $slave_error_message= Failed while waiting for slave SQL thread to stop; + source include/wait_for_slave_param.inc; + let $slave_error_message= ; } diff --git a/mysql-test/include/wait_for_slave_to_start.inc b/mysql-test/include/wait_for_slave_to_start.inc index 29d87b58a3c..567950cc6d7 100644 --- a/mysql-test/include/wait_for_slave_to_start.inc +++ b/mysql-test/include/wait_for_slave_to_start.inc @@ -1,35 +1,24 @@ -################################################### -#Author: Jeb -#Date: 2007-06-11 -#Purpose: To wait a brief time for slave to start -#Details: -# 1) Fill in and setup variables -# 2) loop through looking for both -# io and sql threads to start -# 3) If loops too long die. -#################################################### -connection slave; -let $row_number= 1; -let $run= 1; -let $counter= 300; +# ==== Purpose ==== +# +# Waits until both the IO and SQL threads of the current connection +# have started, or until a timeout is reached. +# +# ==== Usage ==== +# +# source include/wait_for_slave_to_start.inc; +# +# Parameters to this macro are $slave_timeout and +# $master_connection. See wait_for_slave_param.inc for +# descriptions. -while ($run) -{ - let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number); - if (`SELECT '$io_result' = 'Yes'`){ +let $slave_error_message= Failed while waiting for slave to start; - let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number); - if (`SELECT '$sql_result' = 'Yes'`){ - let $run= 0; - } - } - sleep 0.1; - if (!$counter){ - --echo "Failed while waiting for slave to start" - query_vertical SHOW SLAVE STATUS; - exit; - } - dec $counter; -} +let $slave_param= Slave_IO_Running; +let $slave_param_value= Yes; +source include/wait_for_slave_param.inc; +let $slave_param= Slave_SQL_Running; +let $slave_param_value= Yes; +source include/wait_for_slave_param.inc; +let $slave_error_message= ; diff --git a/mysql-test/include/wait_for_slave_to_stop.inc b/mysql-test/include/wait_for_slave_to_stop.inc index 5bd2d0338f8..56d0e7b0c91 100644 --- a/mysql-test/include/wait_for_slave_to_stop.inc +++ b/mysql-test/include/wait_for_slave_to_stop.inc @@ -1,39 +1,30 @@ -################################################### -#Author: Jeb -#Date: 2007-06-11 -#Purpose: To replace the mysqltest.c executable -# wait_for_slave_to_stop function and -# return this to the test language. -#Details: -# 1) Fill in and setup variables -# 2) loop through looking for both -# io and sql threads to stop -# 3) If loops too long die. -#################################################### -connection slave; -let $row_number= 1; -let $run= 1; -let $counter= 300; +# ==== Purpose ==== +# +# Waits until both the IO and SQL threads of the current connection +# have stopped, or until a timeout is reached. +# +# ==== Usage ==== +# +# source include/wait_for_slave_to_stop.inc; +# +# Parameters to this macro are $slave_timeout and +# $master_connection. See wait_for_slave_param.inc for +# descriptions. -while ($run) +# if server has not used CHANGE MASTER to initiate slave, SHOW SLAVE +# STATUS will return an empty set. +let $_slave_io_running= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1); +if (`SELECT '$_slave_io_running' != 'No such row'`) { - let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number); - if (`SELECT '$io_result' = 'No'`){ + let $slave_error_message= Failed while waiting for slave to stop; - let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number); - if (`SELECT '$sql_result' = 'No'`){ - let $run= 0; - } - } - sleep 0.1; - if (!$counter){ - --echo "Failed while waiting for slave to stop" - --replace_result $MASTER_MYPORT MASTER_PORT - --replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # - query_vertical SHOW SLAVE STATUS; - exit; - } - dec $counter; -} + let $slave_param= Slave_IO_Running; + let $slave_param_value= No; + source include/wait_for_slave_param.inc; + let $slave_param= Slave_SQL_Running; + let $slave_param_value= No; + source include/wait_for_slave_param.inc; + let $slave_error_message= ; +} diff --git a/mysql-test/include/wait_show_pattern.inc b/mysql-test/include/wait_show_pattern.inc deleted file mode 100644 index c9f84ce7f08..00000000000 --- a/mysql-test/include/wait_show_pattern.inc +++ /dev/null @@ -1,51 +0,0 @@ -# include/wait_show_pattern.inc -# -# SUMMARY -# -# Waits until output produced by SHOW statement which particular type is -# specified as parameter matches certain pattern or maximum time reached. -# -# NOTES -# -# Only the first row produced by the parameter statement is checked. -# -# USAGE -# -# let $show_type= <Tail of SHOW statement>; -# let $show_pattern= 'Pattern to be used for LIKE matching'; -# --source wait_show_pattern.inc -# -# EXAMPLES -# -# alter_table-big.test, wait_slave_status.inc -# -# SEE ALSO -# -# wait_slave_status.inc, wait_condition.inc (>=5.1) -# -############################################################################### - ---disable_query_log - -# We accept to wait maximum 30 seconds (0.2 sec/loop). -let $wait_counter= 150; -while ($wait_counter) -{ - let $result= `SHOW $show_type`; - let $success= `SELECT '$result' LIKE $show_pattern`; - if ($success) - { - let $wait_counter= 0; - } - if (!$success) - { - real_sleep 0.2; - dec $wait_counter; - } -} -if (!$success) -{ - echo Timeout in wait_show_pattern.inc \$show_type= $show_type \$show_pattern= $show_pattern (\$result= '$result'); -} - ---enable_query_log diff --git a/mysql-test/include/wait_slave_status.inc b/mysql-test/include/wait_slave_status.inc deleted file mode 100644 index d8d048527cf..00000000000 --- a/mysql-test/include/wait_slave_status.inc +++ /dev/null @@ -1,129 +0,0 @@ -# include/wait_slave_status.inc -# -# Created by Matthias Leich -# -# SUMMARY -# -# Waits until slave has reached certain state or maximum time reached. -# -# (This script will not work, when the SHOW command delivers more than one -# result record, because only the first record will be caught.) -# -# USAGE -# -# Set $result_pattern in test file and source this file: -# -# let $result_pattern= <pattern used for LIKE on the result of -# SHOW STATUS SLAVE> -# --include wait_slave_status.inc -# -# EXAMPLE -# -# The script rpl_until.test: -# ... -# --replace_result $MASTER_MYPORT MASTER_MYPORT -# --replace_column 1 # 9 # 23 # 33 # -# --vertical_results show slave status; -# -# outputs -# show slave status; -# Slave_IO_State # -# Master_Host 127.0.0.1 -# Master_User root -# Master_Port MASTER_MYPORT -# Connect_Retry 1 -# Master_Log_File master-bin.000001 -# Read_Master_Log_Pos 776 -# Relay_Log_File slave-relay-bin.000004 -# Relay_Log_Pos # -# Relay_Master_Log_File master-bin.000001 -# Slave_IO_Running Yes -# Slave_SQL_Running No -# Replicate_Do_DB -# Replicate_Ignore_DB -# Replicate_Do_Table -# Replicate_Ignore_Table -# Replicate_Wild_Do_Table -# Replicate_Wild_Ignore_Table -# Last_Errno 0 -# Last_Error -# Skip_Counter 0 -# Exec_Master_Log_Pos 319 -# Relay_Log_Space # -# Until_Condition Master -# Until_Log_File master-bin.000001 -# Until_Log_Pos 319 -# Master_SSL_Allowed No -# Master_SSL_CA_File -# Master_SSL_CA_Path -# Master_SSL_Cert -# Master_SSL_Cipher -# Master_SSL_Key -# Seconds_Behind_Master # -# -# The main problem with the "show slave status;" in rpl_until is, that -# depending on the total test engine power and the current load caused by -# other processes, the expected slave status might be not reached though -# it will happen in maybe some seconds. -# -# The typical problem with rpl_until is that Slave_IO_Running is "No" -# instead of "Yes". -# -# The expected result follows the LIKE pattern: -# -# let $result_pattern= '%127.0.0.1%root%1%master-bin.000001%776%slave-relay-bin.000004%master-bin.000001%Yes%No%0%0%319%Master%master-bin.000001%319%No%'; -# -# The Slave_IO_Running value is the "Yes" just after the "master-bin.000001". -# -# How to get this pattern ? -# -# Any lines "--replace_result ..." and "--replace_colum ..." just before -# the SHOW TABLE STATUS and of course the expected result itself -# show us columns where the content must be unified, because it is non -# deterministic or it depends on the current test environment. -# -# Unfortunately "--replace_result ..." and "--replace_colum ..." do not -# affect the result of our assignment let $my_val= `SHOW SLAVE STATUS`; -# Therefore such content must be covered by '%'. -# -# Please be careful. A more simple pattern might be dangerous, because we -# might get "wrong" matches. Example: There might be several "Yes" and "No" -# within one result row. -# -############################################################################### - -# We do not want to print the auxiliary commands, because they are not of -# interest and their amount will vary depending how fast we get the -# desired state. ---disable_query_log - -# The protocol should show -# - the setting of $result_pattern and -# - that this file is sourced , -# because this increases the chance to use the protocol as replay script. -eval SELECT "let \$result_pattern= $result_pattern ;" AS ""; -SELECT '--source include/wait_slave_status.inc' AS ""; - -let $show_type= SLAVE STATUS; -let $show_pattern= $result_pattern; ---enable_query_log - ---source include/wait_show_pattern.inc - -if (!$success) -{ -let $message= ! Attention: Timeout in wait_slave_status.inc. - | Possible reasons with decreasing probability: - | - The LIKE pattern is wrong, because the - | testcase was altered or the layout of the - | SHOW SLAVE STATUS result set changed. - | - There is a new bug within the replication. - | - We met an extreme testing environment and timeout is - | too small.; ---source include/show_msg80.inc ---echo DEBUG INFO START (wait_slave_status.inc): ---echo $result_pattern ---vertical_results -show slave status; ---echo DEBUG INFO END -} diff --git a/mysql-test/include/wait_until_connected_again.inc b/mysql-test/include/wait_until_connected_again.inc index 4379f4d3145..08c206befcd 100644 --- a/mysql-test/include/wait_until_connected_again.inc +++ b/mysql-test/include/wait_until_connected_again.inc @@ -11,7 +11,10 @@ let $counter= 5000; let $mysql_errno= 1; while ($mysql_errno) { - --error 0,2002,2003,2006,1053 + # Strangely enough, the server might return "Too many connections" + # while being shutdown, thus 1040 is an "allowed" error + # See BUG#36228 + --error 0,1040,1053,2002,2003,2006,2013 show status; dec $counter; diff --git a/mysql-test/include/wait_until_disconnected.inc b/mysql-test/include/wait_until_disconnected.inc index cf4a574573f..4f7d5c49460 100644 --- a/mysql-test/include/wait_until_disconnected.inc +++ b/mysql-test/include/wait_until_disconnected.inc @@ -1,4 +1,3 @@ -# # Include this script after a shutdown to wait until the connection # to the server has been lost or timeout occurs. # When you change this file you may have to chance its cousin @@ -6,7 +5,7 @@ --disable_result_log --disable_query_log -let $counter= 5000; +let $counter= 500; let $mysql_errno= 0; while (!$mysql_errno) { @@ -16,7 +15,7 @@ while (!$mysql_errno) dec $counter; if (!$counter) { - --die Server failed to disconnect me + --die Server failed to dissapear } --sleep 0.1 } diff --git a/mysql-test/include/windows_sys_vars.inc b/mysql-test/include/windows_sys_vars.inc index 90ff86fefd1..1d51ddb52f9 100644 --- a/mysql-test/include/windows_sys_vars.inc +++ b/mysql-test/include/windows_sys_vars.inc @@ -9,7 +9,6 @@ SET @min_flush_time = 0; #SET @max_flush_time = 0; SET @default_key_buffer_size= 131072; -SET @min_key_buffer_size= 8; #SET @default_join_buffer_size = 131072; #SET @min_join_buffer_size = 8200; diff --git a/mysql-test/install_test_db.sh b/mysql-test/install_test_db.sh deleted file mode 100644 index 855ec4351e3..00000000000 --- a/mysql-test/install_test_db.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/sh -# Copyright (C) 1997-2006 MySQL AB -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -# This scripts creates the privilege tables db, host, user, tables_priv, -# columns_priv in the mysql database, as well as the func table. - -if [ x$1 = x"--bin" ]; then - shift 1 - BINARY_DIST=1 - - bindir=../bin - scriptdir=bin - libexecdir=../libexec - - # Check if it's a binary distribution or a 'make install' - if test -x ../libexec/mysqld - then - execdir=../libexec - elif test -x ../../sbin/mysqld # RPM installation - then - execdir=../../sbin - bindir=../../bin - scriptdir=../bin - libexecdir=../../libexec - else - execdir=../bin - fi - fix_bin=mysql-test -else - execdir=../sql - bindir=../client - fix_bin=. - scriptdir=scripts - libexecdir=../libexec -fi - -vardir=var -logdir=$vardir/log -if [ x$1 = x"-slave" ] -then - shift 1 - data=var/slave-data -else - if [ x$1 = x"-1" ] - then - data=var/master-data1 - else - data=var/master-data - fi -fi -ldata=$fix_bin/$data - -mdata=$data/mysql -EXTRA_ARG="" - -mysqld= -if test -x $execdir/mysqld -then - mysqld=$execdir/mysqld -else - if test ! -x $libexecdir/mysqld - then - echo "mysqld is missing - looked in $execdir and in $libexecdir" - exit 1 - else - mysqld=$libexecdir/mysqld - fi -fi - -# On IRIX hostname is in /usr/bsd so add this to the path -PATH=$PATH:/usr/bsd -hostname=`hostname` # Install this too in the user table -hostname="$hostname%" # Fix if not fully qualified hostname - - -#create the directories -[ -d $vardir ] || mkdir $vardir -[ -d $logdir ] || mkdir $logdir - -# Create database directories mysql & test -if [ -d $data ] ; then rm -rf $data ; fi -mkdir $data $data/mysql $data/test - -#for error messages -if [ x$BINARY_DIST = x1 ] ; then -basedir=.. -else -basedir=. -EXTRA_ARG="--windows" -fi - -INSTALL_CMD="$scriptdir/mysql_install_db --no-defaults $EXTRA_ARG --datadir=mysql-test/$ldata --srcdir=." -echo "running $INSTALL_CMD" - -cd .. -if $INSTALL_CMD -then - exit 0 -else - echo "Error executing mysqld --bootstrap" - exit 1 -fi diff --git a/mysql-test/lib/My/Config.pm b/mysql-test/lib/My/Config.pm index 5491e341ddc..f8416e3df3a 100644 --- a/mysql-test/lib/My/Config.pm +++ b/mysql-test/lib/My/Config.pm @@ -4,6 +4,7 @@ package My::Config::Option; use strict; use warnings; +use Carp; sub new { @@ -26,12 +27,22 @@ sub value { return $self->{value}; } +sub option { + my ($self)= @_; + my $name= $self->{name}; + my $value= $self->{value}; + + my $opt= $name; + $opt= "$name=$value" if ($value); + $opt= "--$opt" unless ($opt =~ /^--/); + return $opt; +} package My::Config::Group; use strict; use warnings; - +use Carp; sub new { my ($class, $group_name)= @_; @@ -68,7 +79,7 @@ sub remove { return undef unless defined $option; # Remove from the hash - delete($self->{options_by_name}->{$option_name}) or die; + delete($self->{options_by_name}->{$option_name}) or croak; # Remove from the array @{$self->{options}}= grep { $_->name ne $option_name } @{$self->{options}}; @@ -88,6 +99,33 @@ sub name { return $self->{name}; } +sub suffix { + my ($self)= @_; + # Everything in name from the last . + my @parts= split(/\./, $self->{name}); + my $suffix= pop(@parts); + return ".$suffix"; +} + +sub after { + my ($self, $prefix)= @_; + die unless defined $prefix; + + # everything after $prefix + my $name= $self->{name}; + if ($name =~ /^\Q$prefix\E(.*)$/) + { + return $1; + } + die "Failed to extract the value after '$prefix' in $name"; +} + + +sub split { + my ($self)= @_; + # Return an array with name parts + return split(/\./, $self->{name}); +} # # Return a specific option in the group @@ -100,23 +138,37 @@ sub option { # -# Return a specific value for an option in the group +# Return value for an option in the group, fail if it does not exist # sub value { my ($self, $option_name)= @_; my $option= $self->option($option_name); - die "No option named '$option_name' in this group" + croak "No option named '$option_name' in group '$self->{name}'" if ! defined($option); return $option->value(); } +# +# Return value for an option if it exist +# +sub if_exist { + my ($self, $option_name)= @_; + my $option= $self->option($option_name); + + return undef if ! defined($option); + + return $option->value(); +} + + package My::Config; use strict; use warnings; +use Carp; use IO::File; use File::Basename; @@ -132,13 +184,13 @@ sub new { my $self= bless { groups => [] }, $class; my $F= IO::File->new($path, "<") - or die "Could not open '$path': $!"; + or croak "Could not open '$path': $!"; while ( my $line= <$F> ) { chomp($line); # [group] - if ( $line =~ /\[(.*)\]/ ) { + if ( $line =~ /^\[(.*)\]/ ) { # New group found $group_name= $1; #print "group: $group_name\n"; @@ -149,7 +201,7 @@ sub new { # Magic #! comments elsif ( $line =~ /^#\!/) { my $magic= $line; - die "Found magic comment '$magic' outside of group" + croak "Found magic comment '$magic' outside of group" unless $group_name; #print "$magic\n"; @@ -171,8 +223,13 @@ sub new { # !include <filename> elsif ( $line =~ /^\!include\s*(.*?)\s*$/ ) { my $include_file_name= dirname($path)."/".$1; - # Check that the file exists - die "The include file '$include_file_name' does not exist" + + # Check that the file exists relative to path of first config file + if (! -f $include_file_name){ + # Try to include file relativ to current dir + $include_file_name= $1; + } + croak "The include file '$include_file_name' does not exist" unless -f $include_file_name; $self->append(My::Config->new($include_file_name)); @@ -182,7 +239,7 @@ sub new { elsif ( $line =~ /^([\@\w-]+)\s*$/ ) { my $option= $1; - die "Found option '$option' outside of group" + croak "Found option '$option' outside of group" unless $group_name; #print "$option\n"; @@ -194,13 +251,13 @@ sub new { my $option= $1; my $value= $2; - die "Found option '$option=$value' outside of group" + croak "Found option '$option=$value' outside of group" unless $group_name; #print "$option=$value\n"; $self->insert($group_name, $option, $value); } else { - die "Unexpected line '$line' found in '$path'"; + croak "Unexpected line '$line' found in '$path'"; } } @@ -231,6 +288,7 @@ sub insert { # Add the option to the group $group->insert($option, $value, $if_not_exist); } + return $group; } # @@ -240,11 +298,11 @@ sub remove { my ($self, $group_name, $option_name)= @_; my $group= $self->group($group_name); - die "group '$group_name' does not exist" + croak "group '$group_name' does not exist" unless defined($group); $group->remove($option_name) or - die "option '$option_name' does not exist"; + croak "option '$option_name' does not exist"; } @@ -267,10 +325,10 @@ sub group_exists { # sub _group_insert { my ($self, $group_name)= @_; - caller eq __PACKAGE__ or die; + caller eq __PACKAGE__ or croak; # Check that group does not already exist - die "Group already exists" if $self->group_exists($group_name); + croak "Group already exists" if $self->group_exists($group_name); my $group= My::Config::Group->new($group_name); push(@{$self->{groups}}, $group); @@ -354,11 +412,11 @@ sub value { my ($self, $group_name, $option_name)= @_; my $group= $self->group($group_name); - die "group '$group_name' does not exist" + croak "group '$group_name' does not exist" unless defined($group); my $option= $group->option($option_name); - die "option '$option_name' does not exist" + croak "option '$option_name' does not exist" unless defined($option); return $option->value(); @@ -372,7 +430,7 @@ sub exists { my ($self, $group_name, $option_name)= @_; my $group= $self->group($group_name); - die "group '$group_name' does not exist" + croak "group '$group_name' does not exist" unless defined($group); my $option= $group->option($option_name); @@ -412,11 +470,11 @@ sub stringify { # Save the config to named file # sub save { - my ($self, $path)= @_; - my $F= IO::File->new($path, ">") - or die "Could not open '$path': $!"; - print $F $self; - undef $F; # Close the file + my ($self, $path)= @_; + my $F= IO::File->new($path, ">") + or croak "Could not open '$path': $!"; + print $F $self; + undef $F; # Close the file } 1; diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm new file mode 100644 index 00000000000..b86243d3705 --- /dev/null +++ b/mysql-test/lib/My/ConfigFactory.pm @@ -0,0 +1,657 @@ +# -*- cperl -*- +package My::ConfigFactory; + +use strict; +use warnings; +use Carp; + +use My::Config; +use My::Find; + +use File::Basename; + + +# +# Rules to run first of all +# +my @pre_rules= +( +); + + +my @share_locations= ("share/mysql", "sql/share", "share"); + + +sub get_basedir { + my ($self, $group)= @_; + my $basedir= $group->if_exist('basedir') || + $self->{ARGS}->{basedir}; + return $basedir; +} + + +sub fix_charset_dir { + my ($self, $config, $group_name, $group)= @_; + return my_find_dir($self->get_basedir($group), + \@share_locations, "charsets"); +} + +sub fix_language { + my ($self, $config, $group_name, $group)= @_; + return my_find_dir($self->get_basedir($group), + \@share_locations, "english"); +} + +sub fix_datadir { + my ($self, $config, $group_name)= @_; + my $vardir= $self->{ARGS}->{vardir}; + return "$vardir/$group_name/data"; +} + +sub fix_pidfile { + my ($self, $config, $group_name, $group)= @_; + my $vardir= $self->{ARGS}->{vardir}; + return "$vardir/run/$group_name.pid"; +} + +sub fix_port { + my ($self, $config, $group_name, $group)= @_; + my $hostname= $group->value('#host'); + return $self->{HOSTS}->{$hostname}++; +} + +sub fix_host { + my ($self)= @_; + # Get next host from HOSTS array + my @hosts= keys(%{$self->{HOSTS}});; + my $host_no= $self->{NEXT_HOST}++ % @hosts; + return $hosts[$host_no]; +} + +sub is_unique { + my ($config, $name, $value)= @_; + + foreach my $group ( $config->groups() ) { + if ($group->option($name)) { + if ($group->value($name) eq $value){ + return 0; + } + } + } + return 1; +} + +sub fix_server_id { + my ($self, $config, $group_name, $group)= @_; +#define in the order that mysqlds are listed in my.cnf + + my $server_id= $group->if_exist('server-id'); + if (defined $server_id){ + if (!is_unique($config, 'server-id', $server_id)) { + croak "The server-id($server_id) for '$group_name' is not unique"; + } + return $server_id; + } + + do { + $server_id= $self->{SERVER_ID}++; + } while(!is_unique($config, 'server-id', $server_id)); + + #print "$group_name: server_id: $server_id\n"; + return $server_id; +} + +sub fix_socket { + my ($self, $config, $group_name, $group)= @_; + # Put socket file in tmpdir + my $dir= $self->{ARGS}->{tmpdir}; + return "$dir/$group_name.sock"; +} + +sub fix_tmpdir { + my ($self, $config, $group_name, $group)= @_; + my $dir= $self->{ARGS}->{tmpdir}; + return "$dir/$group_name"; +} + +sub fix_log_error { + my ($self, $config, $group_name, $group)= @_; + my $dir= dirname($group->value('datadir')); + return "$dir/mysqld.err"; +} + +sub fix_log { + my ($self, $config, $group_name, $group)= @_; + my $dir= dirname($group->value('datadir')); + return "$dir/mysqld.log"; +} + +sub fix_log_slow_queries { + my ($self, $config, $group_name, $group)= @_; + my $dir= dirname($group->value('datadir')); + return "$dir/mysqld-slow.log"; +} + +sub fix_secure_file_priv { + my ($self)= @_; + my $vardir= $self->{ARGS}->{vardir}; + # By default, prevent the started mysqld to access files outside of vardir + return $vardir; +} + +sub fix_std_data { + my ($self, $config, $group_name, $group)= @_; + my $basedir= $self->get_basedir($group); + return "$basedir/mysql-test/std_data"; +} + +sub ssl_supported { + my ($self)= @_; + return $self->{ARGS}->{ssl}; +} + +sub fix_skip_ssl { + return if !ssl_supported(@_); + # Add skip-ssl if ssl is supported to avoid + # that mysqltest connects with SSL by default + return 1; +} + +sub fix_ssl_ca { + return if !ssl_supported(@_); + my $std_data= fix_std_data(@_); + return "$std_data/cacert.pem" +} + +sub fix_ssl_server_cert { + return if !ssl_supported(@_); + my $std_data= fix_std_data(@_); + return "$std_data/server-cert.pem" +} + +sub fix_ssl_client_cert { + return if !ssl_supported(@_); + my $std_data= fix_std_data(@_); + return "$std_data/client-cert.pem" +} + +sub fix_ssl_server_key { + return if !ssl_supported(@_); + my $std_data= fix_std_data(@_); + return "$std_data/server-key.pem" +} + +sub fix_ssl_client_key { + return if !ssl_supported(@_); + my $std_data= fix_std_data(@_); + return "$std_data/client-key.pem" +} + + +# +# Rules to run for each mysqld in the config +# - will be run in order listed here +# +my @mysqld_rules= + ( + { 'basedir' => sub { return shift->{ARGS}->{basedir}; } }, + { 'tmpdir' => \&fix_tmpdir }, + { 'character-sets-dir' => \&fix_charset_dir }, + { 'language' => \&fix_language }, + { 'datadir' => \&fix_datadir }, + { 'pid-file' => \&fix_pidfile }, + { '#host' => \&fix_host }, + { 'port' => \&fix_port }, + { 'socket' => \&fix_socket }, + { 'log-error' => \&fix_log_error }, + { 'general-log' => sub { return 1; } }, + { 'general-log-file' => \&fix_log }, + { 'slow-query-log-file' => \&fix_log_slow_queries }, + { 'slow-query-log' => sub { return 1; } }, + { '#user' => sub { return shift->{ARGS}->{user} || ""; } }, + { '#password' => sub { return shift->{ARGS}->{password} || ""; } }, + { 'server-id' => \&fix_server_id, }, + # By default, prevent the started mysqld to access files outside of vardir + { 'secure-file-priv' => sub { return shift->{ARGS}->{vardir}; } }, + { 'ssl-ca' => \&fix_ssl_ca }, + { 'ssl-cert' => \&fix_ssl_server_cert }, + { 'ssl-key' => \&fix_ssl_server_key }, + ); + + +sub fix_ndb_mgmd_port { + my ($self, $config, $group_name, $group)= @_; + my $hostname= $group->value('HostName'); + return $self->{HOSTS}->{$hostname}++; +} + + +sub fix_cluster_dir { + my ($self, $config, $group_name, $group)= @_; + my $vardir= $self->{ARGS}->{vardir}; + my (undef, $process_type, $idx, $suffix)= split(/\./, $group_name); + return "$vardir/mysql_cluster.$suffix/$process_type.$idx"; +} + + +sub fix_cluster_backup_dir { + my ($self, $config, $group_name, $group)= @_; + my $vardir= $self->{ARGS}->{vardir}; + my (undef, $process_type, $idx, $suffix)= split(/\./, $group_name); + return "$vardir/mysql_cluster.$suffix/"; +} + + +# +# Rules to run for each ndb_mgmd in the config +# - will be run in order listed here +# +my @ndb_mgmd_rules= +( + { 'PortNumber' => \&fix_ndb_mgmd_port }, + { 'DataDir' => \&fix_cluster_dir }, +); + + +# +# Rules to run for each ndbd in the config +# - will be run in order listed here +# +my @ndbd_rules= +( + { 'HostName' => \&fix_host }, + { 'DataDir' => \&fix_cluster_dir }, + { 'BackupDataDir' => \&fix_cluster_backup_dir }, +); + + +# +# Rules to run for each cluster_config section +# - will be run in order listed here +# +my @cluster_config_rules= +( + { 'ndb_mgmd' => \&fix_host }, + { 'ndbd' => \&fix_host }, + { 'mysqld' => \&fix_host }, + { 'ndbapi' => \&fix_host }, +); + + +# +# Rules to run for [client] section +# - will be run in order listed here +# +my @client_rules= +( +); + + +# +# Rules to run for [mysqltest] section +# - will be run in order listed here +# +my @mysqltest_rules= +( + { 'ssl-ca' => \&fix_ssl_ca }, + { 'ssl-cert' => \&fix_ssl_client_cert }, + { 'ssl-key' => \&fix_ssl_client_key }, + { 'skip-ssl' => \&fix_skip_ssl }, +); + + +# +# Rules to run for [mysqlbinlog] section +# - will be run in order listed here +# +my @mysqlbinlog_rules= +( + { 'character-sets-dir' => \&fix_charset_dir }, +); + + +# +# Rules to run for [mysql_upgrade] section +# - will be run in order listed here +# +my @mysql_upgrade_rules= +( + { 'tmpdir' => sub { return shift->{ARGS}->{tmpdir}; } }, +); + + +# +# Generate a [client.<suffix>] group to be +# used for connecting to [mysqld.<suffix>] +# +sub post_check_client_group { + my ($self, $config, $client_group_name, $mysqld_group_name)= @_; + + # Settings needed for client, copied from its "mysqld" + my %client_needs= + ( + port => 'port', + socket => 'socket', + host => '#host', + user => '#user', + password => '#password', + ); + + my $group_to_copy_from= $config->group($mysqld_group_name); + while (my ($name_to, $name_from)= each( %client_needs )) { + my $option= $group_to_copy_from->option($name_from); + + if (! defined $option){ + #print $config; + croak "Could not get value for '$name_from'"; + } + $config->insert($client_group_name, $name_to, $option->value()) + } +} + + +sub post_check_client_groups { + my ($self, $config)= @_; + + my $first_mysqld= $config->first_like('mysqld.'); + + return unless $first_mysqld; + + # Always generate [client] pointing to the first + # [mysqld.<suffix>] + $self->post_check_client_group($config, + 'client', + $first_mysqld->name()); + + # Then generate [client.<suffix>] for each [mysqld.<suffix>] + foreach my $mysqld ( $config->like('mysqld.') ) { + $self->post_check_client_group($config, + 'client'.$mysqld->after('mysqld'), + $mysqld->name()) + } + +} + + +# +# Generate [embedded] by copying the values +# needed from the default [mysqld] section +# and from first [mysqld.<suffix>] +# +sub post_check_embedded_group { + my ($self, $config)= @_; + + return unless $self->{ARGS}->{embedded}; + + my $mysqld= $config->group('mysqld') or + croak "Can't run with embedded, config has no default mysqld section"; + + my $first_mysqld= $config->first_like('mysqld.') or + croak "Can't run with embedded, config has no mysqld"; + + my @no_copy = + ( + 'log-error', # Embedded server writes stderr to mysqltest's log file + 'slave-net-timeout', # Embedded server are not build with replication + ); + + foreach my $option ( $mysqld->options(), $first_mysqld->options() ) { + # Don't copy options whose name is in "no_copy" list + next if grep ( $option->name() eq $_, @no_copy); + + $config->insert('embedded', $option->name(), $option->value()) + } + +} + + +sub resolve_at_variable { + my ($self, $config, $group, $option)= @_; + + # Split the options value on last . + my @parts= split(/\./, $option->value()); + my $option_name= pop(@parts); + my $group_name= join('.', @parts); + + $group_name =~ s/^\@//; # Remove at + + my $from_group= $config->group($group_name) + or croak "There is no group named '$group_name' that ", + "can be used to resolve '$option_name'"; + + my $from= $from_group->value($option_name); + $config->insert($group->name(), $option->name(), $from) +} + + +sub post_fix_resolve_at_variables { + my ($self, $config)= @_; + + foreach my $group ( $config->groups() ) { + foreach my $option ( $group->options()) { + next unless defined $option->value(); + + $self->resolve_at_variable($config, $group, $option) + if ($option->value() =~ /^\@/); + } + } +} + +sub post_fix_mysql_cluster_section { + my ($self, $config)= @_; + + # Add a [mysl_cluster.<suffix>] section for each + # defined [cluster_config.<suffix>] section + foreach my $group ( $config->like('cluster_config\.\w*$') ) + { + my @urls; + # Generate ndb_connectstring for this cluster + foreach my $ndb_mgmd ( $config->like('cluster_config.ndb_mgmd.')) { + if ($ndb_mgmd->suffix() eq $group->suffix()) { + my $host= $ndb_mgmd->value('HostName'); + my $port= $ndb_mgmd->value('PortNumber'); + push(@urls, "$host:$port"); + } + } + croak "Could not generate valid ndb_connectstring for '$group'" + unless @urls > 0; + my $ndb_connectstring= join(";", @urls); + + # Add ndb_connectstring to [mysql_cluster.<suffix>] + $config->insert('mysql_cluster'.$group->suffix(), + 'ndb_connectstring', $ndb_connectstring); + + # Add ndb_connectstring to each mysqld connected to this + # cluster + foreach my $mysqld ( $config->like('cluster_config.mysqld.')) { + if ($mysqld->suffix() eq $group->suffix()) { + my $after= $mysqld->after('cluster_config.mysqld'); + $config->insert("mysqld$after", + 'ndb_connectstring', $ndb_connectstring); + } + } + } +} + +# +# Rules to run last of all +# +my @post_rules= +( + \&post_check_client_groups, + \&post_fix_mysql_cluster_section, + \&post_fix_resolve_at_variables, + \&post_check_embedded_group, +); + + +sub run_rules_for_group { + my ($self, $config, $group, @rules)= @_; + foreach my $hash ( @rules ) { + while (my ($option, $rule)= each( %{$hash} )) { + # Only run this rule if the value is not already defined + if (!$config->exists($group->name(), $option)) { + my $value; + if (ref $rule eq "CODE") { + # Call the rule function + $value= &$rule($self, $config, $group->name(), + $config->group($group->name())); + } else { + $value= $rule; + } + if (defined $value) { + $config->insert($group->name(), $option, $value, 1); + } + } + } + } +} + + +sub run_section_rules { + my ($self, $config, $name, @rules)= @_; + + foreach my $group ( $config->like($name) ) { + $self->run_rules_for_group($config, $group, @rules); + } +} + + +sub run_generate_sections_from_cluster_config { + my ($self, $config)= @_; + + my @options= ('ndb_mgmd', 'ndbd', + 'mysqld', 'ndbapi'); + + foreach my $group ( $config->like('cluster_config\.\w*$') ) { + + # Keep track of current index per process type + my %idxes; + map { $idxes{$_}= 1; } @options; + + foreach my $option_name ( @options ) { + my $value= $group->value($option_name); + my @hosts= split(/,/, $value, -1); # -1 => return also empty strings + + # Add at least one host + push(@hosts, undef) unless scalar(@hosts); + + # Assign hosts unless already fixed + @hosts= map { $self->fix_host() unless $_; } @hosts; + + # Write the hosts value back + $group->insert($option_name, join(",", @hosts)); + + # Generate sections for each host + foreach my $host ( @hosts ){ + my $idx= $idxes{$option_name}++; + + my $suffix= $group->suffix(); + # Generate a section for ndb_mgmd to read + $config->insert("cluster_config.$option_name.$idx$suffix", + "HostName", $host); + + if ($option_name eq 'mysqld'){ + my $datadir= + $self->fix_cluster_dir($config, + "cluster_config.mysqld.$idx$suffix", + $group); + $config->insert("mysqld.$idx$suffix", + 'datadir', "$datadir/data"); + } + } + } + } +} + + +sub new_config { + my ($class, $args)= @_; + + my @required_args= ('basedir', 'baseport', 'vardir', 'template_path'); + + foreach my $required ( @required_args ) { + croak "you must pass '$required'" unless defined $args->{$required}; + } + + # Fill in hosts/port hash + my $hosts= {}; + my $baseport= $args->{baseport}; + $args->{hosts}= [ 'localhost' ] unless exists($args->{hosts}); + foreach my $host ( @{$args->{hosts}} ) { + $hosts->{$host}= $baseport; + } + + # Open the config template + my $config= My::Config->new($args->{'template_path'}); + my $extra_template_path= $args->{'extra_template_path'}; + if ($extra_template_path){ + $config->append(My::Config->new($extra_template_path)); + } + my $self= bless { + CONFIG => $config, + ARGS => $args, + HOSTS => $hosts, + NEXT_HOST => 0, + SERVER_ID => 1, + }, $class; + + + { + # Run pre rules + foreach my $rule ( @pre_rules ) { + &$rule($self, $config); + } + } + + + $self->run_section_rules($config, + 'cluster_config\.\w*$', + @cluster_config_rules); + $self->run_generate_sections_from_cluster_config($config); + + $self->run_section_rules($config, + 'cluster_config.ndb_mgmd.', + @ndb_mgmd_rules); + $self->run_section_rules($config, + 'cluster_config.ndbd', + @ndbd_rules); + + $self->run_section_rules($config, + 'mysqld.', + @mysqld_rules); + + # [mysqlbinlog] need additional settings + $self->run_rules_for_group($config, + $config->insert('mysqlbinlog'), + @mysqlbinlog_rules); + + # [mysql_upgrade] need additional settings + $self->run_rules_for_group($config, + $config->insert('mysql_upgrade'), + @mysql_upgrade_rules); + + # Additional rules required for [client] + $self->run_rules_for_group($config, + $config->insert('client'), + @client_rules); + + + # Additional rules required for [mysqltest] + $self->run_rules_for_group($config, + $config->insert('mysqltest'), + @mysqltest_rules); + + { + # Run post rules + foreach my $rule ( @post_rules ) { + &$rule($self, $config); + } + } + + return $config; +} + + +1; + diff --git a/mysql-test/lib/My/CoreDump.pm b/mysql-test/lib/My/CoreDump.pm new file mode 100644 index 00000000000..599f9ccbfca --- /dev/null +++ b/mysql-test/lib/My/CoreDump.pm @@ -0,0 +1,131 @@ +# -*- cperl -*- +# Copyright (C) 2004-2006 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +package My::CoreDump; + +use strict; +use Carp; +use My::Platform; + +use File::Temp qw/ tempfile tempdir /; + +sub _gdb { + my ($core_name)= @_; + + print "\nTrying 'gdb' to get a backtrace\n"; + + return unless -f $core_name; + + # Find out name of binary that generated core + `gdb -c '$core_name' --batch 2>&1` =~ + /Core was generated by `([^\s\'\`]+)/; + my $binary= $1 or return; + print "Core generated by '$binary'\n"; + + # Create tempfile containing gdb commands + my ($tmp, $tmp_name) = tempfile(); + print $tmp + "bt\n", + "thread apply all bt\n", + "quit\n"; + close $tmp or die "Error closing $tmp_name: $!"; + + # Run gdb + my $gdb_output= + `gdb '$binary' -c '$core_name' -x '$tmp_name' --batch 2>&1`; + + unlink $tmp_name or die "Error removing $tmp_name: $!"; + + return if $? >> 8; + return unless $gdb_output; + + print <<EOF, $gdb_output, "\n"; +Output from gdb follows. The first stack trace is from the failing thread. +The following stack traces are from all threads (so the failing one is +duplicated). +-------------------------- +EOF + return 1; +} + + +sub _dbx { + my ($core_name)= @_; + + print "\nTrying 'dbx' to get a backtrace\n"; + + return unless -f $core_name; + + # Find out name of binary that generated core + `echo | dbx - '$core_name' 2>&1` =~ + /Corefile specified executable: "([^"]+)"/; + my $binary= $1 or return; + print "Core generated by '$binary'\n"; + + # Find all threads + my @thr_ids = `echo threads | dbx '$binary' '$core_name' 2>&1` =~ /t@\d+/g; + + # Create tempfile containing dbx commands + my ($tmp, $tmp_name) = tempfile(); + foreach my $thread (@thr_ids) { + print $tmp "where $thread\n"; + } + print $tmp "exit\n"; + close $tmp or die "Error closing $tmp_name: $!"; + + # Run dbx + my $dbx_output= + `cat '$tmp_name' | dbx '$binary' '$core_name' 2>&1`; + + unlink $tmp_name or die "Error removing $tmp_name: $!"; + + return if $? >> 8; + return unless $dbx_output; + + print <<EOF, $dbx_output, "\n"; +Output from dbx follows. Stack trace is printed for all threads in order, +above this you should see info about which thread was the failing one. +---------------------------- +EOF + return 1; +} + + +sub show { + my ($class, $core_name)= @_; + + # We try dbx first; gdb itself may coredump if run on a Sun Studio + # compiled binary on Solaris. + + my @debuggers = + ( + \&_dbx, + \&_gdb, + # TODO... + ); + + # Try debuggers until one succeeds + + foreach my $debugger (@debuggers){ + if ($debugger->($core_name)){ + return; + } + } + return; +} + + +1; diff --git a/mysql-test/lib/My/File/Path.pm b/mysql-test/lib/My/File/Path.pm new file mode 100644 index 00000000000..99edeecdaf7 --- /dev/null +++ b/mysql-test/lib/My/File/Path.pm @@ -0,0 +1,177 @@ +# -*- cperl -*- +package My::File::Path; +use strict; + + +# +# File::Path::rmtree has a problem with deleting files +# and directories where it hasn't got read permission +# +# Patch this by installing a 'rmtree' function in local +# scope that first chmod all files to 0777 before calling +# the original rmtree function. +# +# This is almost gone in version 1.08 of File::Path - +# but unfortunately some hosts still suffers +# from this also in 1.08 +# + +use Exporter; +use base "Exporter"; +our @EXPORT= qw / rmtree mkpath copytree /; + +use File::Find; +use File::Copy; +use File::Spec; +use Carp; +use My::Handles; +use My::Platform; + +sub rmtree { + my ($dir)= @_; + find( { + bydepth => 1, + no_chdir => 1, + wanted => sub { + my $name= $_; + if (!-l $name && -d _){ + return if (rmdir($name) == 1); + + chmod(0777, $name) or carp("couldn't chmod(0777, $name): $!"); + + return if (rmdir($name) == 1); + + # Failed to remove the directory, analyze + carp("Couldn't remove directory '$name': $!"); + My::Handles::show_handles($name); + } else { + return if (unlink($name) == 1); + + chmod(0777, $name) or carp("couldn't chmod(0777, $name): $!"); + + return if (unlink($name) == 1); + + carp("Couldn't delete file '$name': $!"); + My::Handles::show_handles($name); + } + } + }, $dir ); +}; + + +use File::Basename; +sub _mkpath_debug { + my ($message, $path, $dir, $err)= @_; + + print "=" x 40, "\n"; + print $message, "\n"; + print "err: '$err'\n"; + print "path: '$path'\n"; + print "dir: '$dir'\n"; + + print "-" x 40, "\n"; + my $dirname= dirname($path); + print "ls -l $dirname\n"; + print `ls -l $dirname`, "\n"; + print "-" x 40, "\n"; + print "dir $dirname\n"; + print `dir $dirname`, "\n"; + print "-" x 40, "\n"; + my $dirname2= dirname($dirname); + print "ls -l $dirname2\n"; + print `ls -l $dirname2`, "\n"; + print "-" x 40, "\n"; + print "dir $dirname2\n"; + print `dir $dirname2`, "\n"; + print "-" x 40, "\n"; + print "file exists\n" if (-e $path); + print "file is a plain file\n" if (-f $path); + print "file is a directory\n" if (-d $path); + print "-" x 40, "\n"; + print "showing handles for $path\n"; + My::Handles::show_handles($path); + + print "=" x 40, "\n"; + +} + + +sub mkpath { + my $path; + + die "Usage: mkpath(<path>)" unless @_ == 1; + + foreach my $dir ( File::Spec->splitdir( @_ ) ) { + #print "dir: $dir\n"; + if ($dir =~ /^[a-z]:/i){ + # Found volume ie. C: + $path= $dir; + next; + } + + $path= File::Spec->catdir($path, $dir); + #print "path: $path\n"; + + next if -d $path; # Path already exists and is a directory + croak("File already exists but is not a directory: '$path'") if -e $path; + next if mkdir($path); + _mkpath_debug("mkdir failed", $path, $dir, $!); + + # mkdir failed, try one more time + next if mkdir($path); + _mkpath_debug("mkdir failed, second time", $path, $dir, $!); + + # mkdir failed again, try two more time after sleep(s) + sleep(1); + next if mkdir($path); + _mkpath_debug("mkdir failed, third time", $path, $dir, $!); + + sleep(1); + next if mkdir($path); + _mkpath_debug("mkdir failed, fourth time", $path, $dir, $!); + + # Report failure and die + croak("Couldn't create directory '$path' ", + " after 4 attempts and 2 sleep(1): $!"); + } +}; + + +sub copytree { + my ($from_dir, $to_dir, $use_umask) = @_; + + die "Usage: copytree(<fromdir>, <todir>, [<umask>])" + unless @_ == 2 or @_ == 3; + + my $orig_umask; + if ($use_umask){ + # Set new umask and remember the original + $orig_umask= umask(oct($use_umask)); + } + + mkpath("$to_dir"); + opendir(DIR, "$from_dir") + or croak("Can't find $from_dir$!"); + for(readdir(DIR)) { + + next if "$_" eq "." or "$_" eq ".."; + + # Skip SCCS/ directories + next if "$_" eq "SCCS"; + + if ( -d "$from_dir/$_" ) + { + copytree("$from_dir/$_", "$to_dir/$_"); + next; + } + copy("$from_dir/$_", "$to_dir/$_"); + } + closedir(DIR); + + if ($orig_umask){ + # Set the original umask + umask($orig_umask); + } +} + +1; diff --git a/mysql-test/lib/My/Find.pm b/mysql-test/lib/My/Find.pm new file mode 100644 index 00000000000..8557584bbc8 --- /dev/null +++ b/mysql-test/lib/My/Find.pm @@ -0,0 +1,245 @@ +# -*- cperl -*- +# Copyright (C) 2004-2006 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +package My::Find; + +# +# Utility functions to find files in a MySQL source or bindist +# + +use strict; +use Carp; +use My::Platform; + +use base qw(Exporter); +our @EXPORT= qw(my_find_bin my_find_dir my_find_file NOT_REQUIRED); + +our $vs_config_dir; + +my $bin_extension= ".exe" if IS_WINDOWS; + +# Helper function to be used for fourth parameter to find functions +sub NOT_REQUIRED { return 0; } + +# +# my_find_bin - find an executable with "name_1...name_n" in +# paths "path_1...path_n" and return the full path +# +# Example: +# my $mysqld_exe= my_find_bin($basedir. +# ["sql", "bin"], +# ["mysqld", "mysqld-debug"]); +# my $mysql_exe= my_find_bin($basedir, +# ["client", "bin"], +# "mysql"); +# +# +# To check if something exists, use the required parameter +# set to 0, the function will return an empty string if the +# binary is not found +# my $mysql_exe= my_find_bin($basedir, +# ["client", "bin"], +# "mysql", NOT_REQUIRED); +# +# NOTE: The function honours MTR_VS_CONFIG environment variable +# +# +sub my_find_bin { + my ($base, $paths, $names, $required)= @_; + croak "usage: my_find_bin(<base>, <paths>, <names>, [<required>])" + unless @_ == 4 or @_ == 3; + + # ------------------------------------------------------- + # Find and return the first executable + # ------------------------------------------------------- + foreach my $path (my_find_paths($base, $paths, $names, $bin_extension)) { + return $path if ( -x $path or (IS_WINDOWS and -f $path) ); + } + if (defined $required and $required == NOT_REQUIRED){ + # Return empty string to indicate not found + return ""; + } + find_error($base, $paths, $names); +} + + +# +# my_find_file - find a file with "name_1...name_n" in +# paths "path_1...path_n" and return the full path +# +# Example: +# my $mysqld_exe= my_find_file($basedir. +# ["sql", "bin"], +# "filename"); +# +# +# Also supports NOT_REQUIRED flag +# +# NOTE: The function honours MTR_VS_CONFIG environment variable +# +# +sub my_find_file { + my ($base, $paths, $names, $required)= @_; + croak "usage: my_find_file(<base>, <paths>, <names>, [<required>])" + unless @_ == 4 or @_ == 3; + + # ------------------------------------------------------- + # Find and return the first executable + # ------------------------------------------------------- + foreach my $path (my_find_paths($base, $paths, $names, $bin_extension)) { + return $path if ( -f $path ); + } + if (defined $required and $required == NOT_REQUIRED){ + # Return empty string to indicate not found + return ""; + } + find_error($base, $paths, $names); +} + + +# +# my_find_dir - find the first existing directory in one of +# the given paths +# +# Example: +# my $charset_set= my_find_dir($basedir, +# ["mysql/share","sql/share", "share"], +# ["charset"]); +# or +# my $charset_set= my_find_dir($basedir, +# ['client_release', 'client_debug', +# 'client', 'bin']); +# +# NOTE: The function honours MTR_VS_CONFIG environment variable +# +# +sub my_find_dir { + my ($base, $paths, $dirs, $required)= @_; + croak "usage: my_find_dir(<base>, <paths>[, <dirs>])" + unless (@_ == 3 or @_ == 2); + + # ------------------------------------------------------- + # Find and return the first directory + # ------------------------------------------------------- + foreach my $path (my_find_paths($base, $paths, $dirs)) { + return $path if ( -d $path ); + } + find_error($base, $paths, $dirs); +} + + +sub my_find_paths { + my ($base, $paths, $names, $extension)= @_; + + # Convert the arguments into two normal arrays to ease + # further mappings + my (@names, @paths); + push(@names, ref $names eq "ARRAY" ? @$names : $names); + push(@paths, ref $paths eq "ARRAY" ? @$paths : $paths); + + #print "base: $base\n"; + #print "names: @names\n"; + #print "paths: @paths\n"; + + # User can select to look in a special build dir + # which is a subdirectory of any of the paths + my @extra_dirs; + my $build_dir= $vs_config_dir || $ENV{MTR_VS_CONFIG} || $ENV{MTR_BUILD_DIR}; + push(@extra_dirs, $build_dir) if defined $build_dir; + + if (defined $extension){ + # Append extension to names, if name does not already have extension + map { $_.=$extension unless /\.(.*)+$/ } @names; + } + + # ------------------------------------------------------- + # Windows specific + # ------------------------------------------------------- + if (IS_WINDOWS) { + # Add the default extra build dirs unless a specific one has + # already been selected + push(@extra_dirs, + ("release", + "relwithdebinfo", + "debug")) if @extra_dirs == 0; + } + + #print "extra_build_dir: @extra_dirs\n"; + + # ------------------------------------------------------- + # Build cross product of "paths * extra_build_dirs" + # ------------------------------------------------------- + push(@paths, map { my $path= $_; + map { "$path/$_" } @extra_dirs + } @paths); + #print "paths: @paths\n"; + + # ------------------------------------------------------- + # Build cross product of "paths * names" + # ------------------------------------------------------- + @paths= map { my $path= $_; + map { "$path/$_" } @names + } @paths; + #print "paths: @paths\n"; + + # ------------------------------------------------------- + # Prepend base to all paths + # ------------------------------------------------------- + @paths= map { "$base/$_" } @paths; + #print "paths: @paths\n"; + + # ------------------------------------------------------- + # Glob all paths to expand wildcards + # ------------------------------------------------------- + @paths= map { glob("$_") } @paths; + #print "paths: @paths\n"; + + # ------------------------------------------------------- + # Return the list of paths + # ------------------------------------------------------- + return @paths; +} + + +sub commify { + return + (@_ == 0) ? '' : + (@_ == 1) ? $_[0] : + (@_ == 2) ? join(" or ", @_) : + join(", ", @_[0..($#_-1)], "or $_[-1]"); + +} + + +sub fnuttify { + return map('\''.$_.'\'', @_); +} + + +sub find_error { + my ($base, $paths, $names)= @_; + + my (@names, @paths); + push(@names, ref $names eq "ARRAY" ? @$names : $names); + push(@paths, ref $paths eq "ARRAY" ? @$paths : $paths); + + croak "** ERROR: Could not find ", + commify(fnuttify(@names)), " in ", + commify(fnuttify(my_find_paths($base, $paths, $names))), "\n"; +} + +1; diff --git a/mysql-test/lib/My/Handles.pm b/mysql-test/lib/My/Handles.pm new file mode 100755 index 00000000000..66ee22b403f --- /dev/null +++ b/mysql-test/lib/My/Handles.pm @@ -0,0 +1,69 @@ +# -*- cperl -*- +# Copyright (C) 2008 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +package My::Handles; + + +use strict; +use Carp; + +use My::Platform; + +my $handle_exe; + + +if (IS_WINDOWS){ + # Check if handle.exe is available + # Pass switch to accept the EULA to avoid hanging + # if the program hasn't been run before. + my $list= `handle.exe -? -accepteula 2>&1`; + foreach my $line (split('\n', $list)) + { + $handle_exe= "$1.$2" + if ($line =~ /Handle v([0-9]*)\.([0-9]*)/); + } + if ($handle_exe){ + print "Found handle.exe version $handle_exe\n"; + } +} + + +sub show_handles +{ + my ($dir)= @_; + return unless $handle_exe; + return unless $dir; + + $dir= native_path($dir); + + # Get a list of open handles in a particular directory + my $list= `handle.exe "$dir" 2>&1` or return; + + foreach my $line (split('\n', $list)) + { + return if ($line =~ /No matching handles found/); + } + + print "\n"; + print "=" x 50, "\n"; + print "Open handles in '$dir':\n"; + print "$list\n"; + print "=" x 50, "\n\n"; + + return; +} + +1; diff --git a/mysql-test/lib/My/Options.pm b/mysql-test/lib/My/Options.pm new file mode 100644 index 00000000000..40f05c41d1c --- /dev/null +++ b/mysql-test/lib/My/Options.pm @@ -0,0 +1,199 @@ +# -*- cperl -*- +# Copyright (C) 2004-2006 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +package My::Options; + +# +# Utility functions to work with list of options +# + +use strict; + + +sub same($$) { + my $l1= shift; + my $l2= shift; + return compare($l1,$l2) == 0; +} + + +sub compare ($$) { + 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 +} + + +sub _split_option { + my ($option)= @_; + if ($option=~ /^--(.*)=(.*)$/){ + return ($1, $2); + } + elsif ($option=~ /^--(.*)$/){ + return ($1, undef) + } + elsif ($option=~ /^\$(.*)$/){ # $VAR + return ($1, undef) + } + elsif ($option=~ /^(.*)=(.*)$/){ + return ($1, $2) + } + elsif ($option=~ /^-O$/){ + return (undef, undef); + } + die "Unknown option format '$option'"; +} + + +sub _build_option { + my ($name, $value)= @_; + if ($name =~ /^O, /){ + return "-".$name."=".$value; + } + elsif ($value){ + return "--".$name."=".$value; + } + return "--".$name; +} + + +# +# Compare two list of options and return what would need +# to be done to get the server running with the new settings +# +sub diff { + my ($from_opts, $to_opts)= @_; + + my %from; + foreach my $from (@$from_opts) + { + my ($opt, $value)= _split_option($from); + next unless defined($opt); + $from{$opt}= $value; + } + + #print "from: ", %from, "\n"; + + my %to; + foreach my $to (@$to_opts) + { + my ($opt, $value)= _split_option($to); + next unless defined($opt); + $to{$opt}= $value; + } + + #print "to: ", %to, "\n"; + + # Remove the ones that are in both lists + foreach my $name (keys %from){ + if (exists $to{$name} and $to{$name} eq $from{$name}){ + #print "removing '$name' from both lists\n"; + delete $to{$name}; + delete $from{$name}; + } + } + + #print "from: ", %from, "\n"; + #print "to: ", %to, "\n"; + + # Add all keys in "to" to result + my @result; + foreach my $name (keys %to){ + push(@result, _build_option($name, $to{$name})); + } + + # Add all keys in "from" that are not in "to" + # to result as "set to default" + foreach my $name (keys %from){ + if (not exists $to{$name}) { + push(@result, _build_option($name, "default")); + } + } + + return @result; +} + + +sub is_set { + my ($opts, $set_opts)= @_; + + foreach my $opt (@$opts){ + + my ($opt_name1, $value1)= _split_option($opt); + + foreach my $set_opt (@$set_opts){ + my ($opt_name2, $value2)= _split_option($set_opt); + + if ($opt_name1 eq $opt_name2){ + # Option already set + return 1; + } + } + } + + return 0; +} + + +sub toSQL { + my (@options)= @_; + my @sql; + + foreach my $option (@options) { + my ($name, $value)= _split_option($option); + #print "name: $name\n"; + #print "value: $value\n"; + if ($name =~ /^O, (.*)/){ + push(@sql, "SET GLOBAL $1=$value"); + } + elsif ($name =~ /^set-variable=(.*)/){ + push(@sql, "SET GLOBAL $1=$value"); + } + else { + my $sql_name= $name; + $sql_name=~ s/-/_/g; + push(@sql, "SET GLOBAL $sql_name=$value"); + } + } + return join("; ", @sql); +} + + +sub toStr { + my $name= shift; + return "$name: ", + "['", join("', '", @_), "']\n"; +} + + +1; + diff --git a/mysql-test/lib/My/Platform.pm b/mysql-test/lib/My/Platform.pm new file mode 100644 index 00000000000..3dd5c552b10 --- /dev/null +++ b/mysql-test/lib/My/Platform.pm @@ -0,0 +1,156 @@ +# -*- cperl -*- +# Copyright (C) 2004-2006 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +package My::Platform; + +use strict; +use File::Basename; +use File::Path; + +use base qw(Exporter); +our @EXPORT= qw(IS_CYGWIN IS_WINDOWS IS_WIN32PERL + native_path posix_path mixed_path + check_socket_path_length process_alive); + +BEGIN { + if ($^O eq "cygwin") { + # Make sure cygpath works + if ((system("cygpath > /dev/null 2>&1") >> 8) != 1){ + die "Could not execute 'cygpath': $!"; + } + eval 'sub IS_CYGWIN { 1 }'; + } + else { + eval 'sub IS_CYGWIN { 0 }'; + } + if ($^O eq "MSWin32") { + eval 'sub IS_WIN32PERL { 1 }'; + } + else { + eval 'sub IS_WIN32PERL { 0 }'; + } +} + +BEGIN { + if (IS_CYGWIN or IS_WIN32PERL) { + eval 'sub IS_WINDOWS { 1 }'; + } + else { + eval 'sub IS_WINDOWS { 0 }'; + } +} + + +# +# native_path +# Convert from path format used by perl to the underlying +# operating systems format +# +# NOTE +# Used when running windows binaries (that expect windows paths) +# in cygwin perl (that uses unix paths) +# + +use Memoize; +if (!IS_WIN32PERL){ + memoize('mixed_path'); + memoize('native_path'); + memoize('posix_path'); +} + +sub mixed_path { + my ($path)= @_; + if (IS_CYGWIN){ + return unless defined $path; + my $cmd= "cygpath -m $path"; + $path= `$cmd` or + print "Failed to run: '$cmd', $!\n"; + chomp $path; + } + return $path; +} + +sub native_path { + my ($path)= @_; + $path=~ s/\//\\/g + if (IS_CYGWIN or IS_WIN32PERL); + return $path; +} + +sub posix_path { + my ($path)= @_; + if (IS_CYGWIN){ + return unless defined $path; + $path= `cygpath $path`; + chomp $path; + } + return $path; +} + +use File::Temp qw /tempdir/; + +sub check_socket_path_length { + my ($path)= @_; + + return 0 if IS_WINDOWS; + + require IO::Socket::UNIX; + + my $truncated= 1; # Be negative + + # Create a tempfile name with same length as "path" + my $tmpdir = tempdir( CLEANUP => 0); + my $len = length($path) - length($tmpdir); + my $testfile = $tmpdir . "x" x ($len > 0 ? $len : 1); + my $sock; + eval { + $sock= new IO::Socket::UNIX + ( + Local => $testfile, + Listen => 1, + ); + + die "Could not create UNIX domain socket: $!" + unless defined $sock; + + die "UNIX domain socket patch was truncated" + unless ($testfile eq $sock->hostpath()); + + $truncated= 0; # Yes, it worked! + + }; + #print "check_socket_path_length, failed: ", $@, '\n' if ($@); + + $sock= undef; # Close socket + unlink($testfile); # Remove the physical file + rmdir($tmpdir); # Remove the tempdir + return $truncated; +} + + +sub process_alive { + my ($pid)= @_; + die "usage: process_alive(pid)" unless $pid; + + return kill(0, $pid) unless IS_WINDOWS; + + my @list= split(/,/, `tasklist /FI "PID eq $pid" /NH /FO CSV`); + my $ret_pid= eval($list[1]); + return ($ret_pid == $pid); +} + + +1; diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm new file mode 100644 index 00000000000..0e3aa968052 --- /dev/null +++ b/mysql-test/lib/My/SafeProcess.pm @@ -0,0 +1,580 @@ +# -*- cperl -*- +# Copyright (C) 2004-2006 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +package My::SafeProcess; + +# +# Class that encapsulates process creation, monitoring and cleanup +# +# Spawns a monitor process which spawns a new process locally or +# remote using subclasses My::Process::Local or My::Process::Remote etc. +# +# The monitor process runs a simple event loop more or less just +# waiting for a reason to zap the process it monitors. Thus the user +# of this class does not need to care about process cleanup, it's +# handled automatically. +# +# The monitor process wait for: +# - the parent process to close the pipe, in that case it +# will zap the "monitored process" and exit +# - the "monitored process" to exit, in which case it will exit +# itself with same exit code as the "monitored process" +# - the parent process to send the "shutdown" signal in wich case +# monitor will kill the "monitored process" hard and exit +# +# +# When used it will look something like this: +# $> ps +# [script.pl] +# - [monitor for `mysqld`] +# - [mysqld] +# - [monitor for `mysqld`] +# - [mysqld] +# - [monitor for `mysqld`] +# - [mysqld] +# +# + +use strict; +use Carp; +use POSIX qw(WNOHANG); + +use My::SafeProcess::Base; +use base 'My::SafeProcess::Base'; + +use My::Find; +use My::Platform; + +my %running; +my $_verbose= 0; + +END { + # Kill any children still running + for my $proc (values %running){ + if ( $proc->is_child($$) ){ + #print "Killing: $proc\n"; + if ($proc->wait_one(0)){ + $proc->kill(); + } + } + } +} + + +sub is_child { + my ($self, $parent_pid)= @_; + croak "usage: \$safe_proc->is_child()" unless (@_ == 2 and ref $self); + return ($self->{PARENT} == $parent_pid); +} + + +# Find the safe process binary or script +my @safe_process_cmd; +my $safe_kill; +if (IS_WIN32PERL or IS_CYGWIN){ + # Use my_safe_process.exe + my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"], + "my_safe_process"); + push(@safe_process_cmd, $exe); + + # Use my_safe_kill.exe + $safe_kill= my_find_bin(".", "lib/My/SafeProcess", "my_safe_kill"); +} +else +{ + # Use my_safe_process + my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"], + "my_safe_process"); + push(@safe_process_cmd, $exe); +} + + +sub new { + my $class= shift; + + my %opts= + ( + verbose => 0, + @_ + ); + + my $path = delete($opts{'path'}) or croak "path required @_"; + my $args = delete($opts{'args'}) or croak "args required @_"; + my $input = delete($opts{'input'}); + my $output = delete($opts{'output'}); + my $error = delete($opts{'error'}); + my $verbose = delete($opts{'verbose'}); + my $host = delete($opts{'host'}); + my $shutdown = delete($opts{'shutdown'}); + my $user_data= delete($opts{'user_data'}); + +# if (defined $host) { +# $safe_script= "lib/My/SafeProcess/safe_process_cpcd.pl"; +# } + + if (IS_CYGWIN){ + $path= mixed_path($path); + $input= mixed_path($input); + $output= mixed_path($output); + $error= mixed_path($error); + } + + my @safe_args; + my ($safe_path, $safe_script)= @safe_process_cmd; + push(@safe_args, $safe_script) if defined $safe_script; + + push(@safe_args, "--verbose") if $verbose > 0; + + # Point the safe_process at the right parent if running on cygwin + push(@safe_args, "--parent-pid=".Cygwin::pid_to_winpid($$)) if IS_CYGWIN; + + push(@safe_args, "--"); + push(@safe_args, $path); # The program safe_process should execute + push(@safe_args, @$$args); + + print "### safe_path: ", $safe_path, " ", join(" ", @safe_args), "\n" + if $verbose > 1; + + my $pid= create_process( + path => $safe_path, + input => $input, + output => $output, + error => $error, + append => $opts{append}, + args => \@safe_args, + ); + + my $name = delete($opts{'name'}) || "SafeProcess$pid"; + my $proc= bless + ({ + SAFE_PID => $pid, + SAFE_WINPID => $pid, # Inidicates this is always a real process + SAFE_NAME => $name, + SAFE_SHUTDOWN => $shutdown, + PARENT => $$, + SAFE_USER_DATA => $user_data, + }, $class); + + # Put the new process in list of running + $running{$pid}= $proc; + return $proc; + +} + + +sub run { + my $proc= new(@_); + $proc->wait_one(); + return $proc->exit_status(); +} + +# +# Start a process that returns after "duration" seconds +# or when it's parent process does not exist anymore +# +sub timer { + my $class= shift; + my $duration= shift or croak "duration required"; + my $parent_pid= $$; + + my $pid= My::SafeProcess::Base::_safe_fork(); + if ($pid){ + # Parent + my $proc= bless + ({ + SAFE_PID => $pid, + SAFE_NAME => "timer", + PARENT => $$, + }, $class); + + # Put the new process in list of running + $running{$pid}= $proc; + return $proc; + } + + # Child, install signal handlers and sleep for "duration" + $SIG{INT}= 'IGNORE'; + + $SIG{TERM}= sub { + #print STDERR "timer $$: woken up, exiting!\n"; + exit(0); + }; + + $0= "safe_timer($duration)"; + + if (IS_WIN32PERL){ + # Just a thread in same process + sleep($duration); + print STDERR "timer $$: expired after $duration seconds\n"; + exit(0); + } + + my $count_down= $duration; + while($count_down--){ + + # Check that parent is still alive + if (kill(0, $parent_pid) == 0){ + #print STDERR "timer $$: parent gone, exiting!\n"; + exit(0); + } + + sleep(1); + } + print STDERR "timer $$: expired after $duration seconds\n"; + exit(0); +} + + +# +# Shutdown process nicely, and wait for shutdown_timeout seconds +# If processes hasn't shutdown, kill them hard and wait for return +# +sub shutdown { + my $shutdown_timeout= shift; + my @processes= @_; + _verbose("shutdown, timeout: $shutdown_timeout, @processes"); + + return if (@processes == 0); + + # Call shutdown function if process has one, else + # use kill + foreach my $proc (@processes){ + _verbose(" proc: $proc"); + my $shutdown= $proc->{SAFE_SHUTDOWN}; + if ($shutdown_timeout > 0 and defined $shutdown){ + $shutdown->(); + $proc->{WAS_SHUTDOWN}= 1; + } + else { + $proc->start_kill(); + } + } + + my @kill_processes= (); + + # Wait max shutdown_timeout seconds for those process + # that has been shutdown + foreach my $proc (@processes){ + next unless $proc->{WAS_SHUTDOWN}; + my $ret= $proc->wait_one($shutdown_timeout); + if ($ret != 0) { + push(@kill_processes, $proc); + } + # Only wait for the first process with shutdown timeout + $shutdown_timeout= 0; + } + + # Wait infinitely for those process + # that has been killed + foreach my $proc (@processes){ + next if $proc->{WAS_SHUTDOWN}; + my $ret= $proc->wait_one(undef); + if ($ret != 0) { + warn "Wait for killed process failed!"; + push(@kill_processes, $proc); + # Try one more time, best option... + } + } + + # Return if all servers has exited + return if (@kill_processes == 0); + + foreach my $proc (@kill_processes){ + $proc->start_kill(); + } + + foreach my $proc (@kill_processes){ + $proc->wait_one(undef); + } + + return; +} + + +sub _winpid ($) { + my ($pid)= @_; + + # In win32 perl, the pid is already the winpid + return $pid unless IS_CYGWIN; + + # In cygwin, the pid is the pseudo process -> + # get the real winpid of my_safe_process + return Cygwin::pid_to_winpid($pid); +} + + +# +# Tell the process to die as fast as possible +# +sub start_kill { + my ($self)= @_; + croak "usage: \$safe_proc->start_kill()" unless (@_ == 1 and ref $self); + _verbose("start_kill: $self"); + my $ret= 1; + + my $pid= $self->{SAFE_PID}; + die "INTERNAL ERROR: no pid" unless defined $pid; + + if (IS_WINDOWS and defined $self->{SAFE_WINPID}) + { + die "INTERNAL ERROR: no safe_kill" unless defined $safe_kill; + + my $winpid= _winpid($pid); + $ret= system($safe_kill, $winpid) >> 8; + + if ($ret == 3){ + print "Couldn't open the winpid: $winpid ", + "for pid: $pid, try one more time\n"; + sleep(1); + $winpid= _winpid($pid); + $ret= system($safe_kill, $winpid) >> 8; + print "Couldn't open the winpid: $winpid ", + "for pid: $pid, continue and see what happens...\n"; + } + } + else + { + $pid= $self->{SAFE_PID}; + die "Can't kill not started process" unless defined $pid; + $ret= kill("TERM", $pid); + } + + return $ret; +} + + +sub dump_core { + my ($self)= @_; + return if IS_WINDOWS; + my $pid= $self->{SAFE_PID}; + die "Can't cet core from not started process" unless defined $pid; + _verbose("Sending ABRT to $self"); + kill ("ABRT", $pid); + return 1; +} + + +# +# Kill the process as fast as possible +# and wait for it to return +# +sub kill { + my ($self)= @_; + croak "usage: \$safe_proc->kill()" unless (@_ == 1 and ref $self); + + $self->start_kill(); + $self->wait_one(); + return 1; +} + + +sub _collect { + my ($self)= @_; + + $self->{EXIT_STATUS}= $?; + _verbose("_collect: $self"); + + # Take the process out of running list + my $pid= $self->{SAFE_PID}; + die unless delete($running{$pid}); +} + + +# Wait for process to exit +# optionally with a timeout +# +# timeout +# undef -> wait blocking infinitely +# 0 -> just poll with WNOHANG +# >0 -> wait blocking for max timeout seconds +# +# RETURN VALUES +# 0 Not running +# 1 Still running +# +sub wait_one { + my ($self, $timeout)= @_; + croak "usage: \$safe_proc->wait_one([timeout])" unless ref $self; + + _verbose("wait_one $self, $timeout"); + + if ( ! defined($self->{SAFE_PID}) ) { + # No pid => not running + _verbose("No pid => not running"); + return 0; + } + + if ( defined $self->{EXIT_STATUS} ) { + # Exit status already set => not running + _verbose("Exit status already set => not running"); + return 0; + } + + my $pid= $self->{SAFE_PID}; + + my $use_alarm; + my $blocking; + if (defined $timeout) + { + if ($timeout == 0) + { + # 0 -> just poll with WNOHANG + $blocking= 0; + $use_alarm= 0; + } + else + { + # >0 -> wait blocking for max timeout seconds + $blocking= 1; + $use_alarm= 1; + } + } + else + { + # undef -> wait blocking infinitely + $blocking= 1; + $use_alarm= 0; + } + #_verbose("blocking: $blocking, use_alarm: $use_alarm"); + + my $retpid; + eval + { + # alarm should break the wait + local $SIG{ALRM}= sub { die "waitpid timeout"; }; + + alarm($timeout) if $use_alarm; + + $retpid= waitpid($pid, $blocking ? 0 : &WNOHANG); + + alarm(0) if $use_alarm; + }; + + if ($@) + { + die "Got unexpected: $@" if ($@ !~ /waitpid timeout/); + if (!defined $retpid) { + # Got timeout + _verbose("Got timeout"); + return 1; + } + # Got pid _and_ alarm, continue + _verbose("Got pid and alarm, continue"); + } + + if ( $retpid == 0 ) { + # 0 => still running + _verbose("0 => still running"); + return 1; + } + + if ( not $blocking and $retpid == -1 ) { + # still running + _verbose("still running"); + return 1; + } + + #warn "wait_one: expected pid $pid but got $retpid" + # unless( $retpid == $pid ); + + $self->_collect(); + return 0; +} + + +# +# Wait for any process to exit +# +# Returns a reference to the SafeProcess that +# exited or undefined +# +sub wait_any { + my $ret_pid; + if (IS_WIN32PERL) { + # Can't wait for -1 => use a polling loop + do { + Win32::Sleep(10); # 10 milli seconds + foreach my $pid (keys %running){ + $ret_pid= waitpid($pid, &WNOHANG); + last if $pid == $ret_pid; + } + } while ($ret_pid == 0); + } + else + { + $ret_pid= waitpid(-1, 0); + if ($ret_pid <= 0){ + # No more processes to wait for + print STDERR "wait_any, got invalid pid: $ret_pid\n"; + return undef; + } + } + + # Look it up in "running" table + my $proc= $running{$ret_pid}; + unless (defined $proc){ + print STDERR "Could not find pid: $ret_pid in running list\n"; + print STDERR "running: ". join(", ", keys(%running)). "\n"; + return undef; + } + $proc->_collect; + return $proc; +} + +# +# Overload string operator +# and fallback to default functions if no +# overloaded function is found +# +use overload + '""' => \&self2str, + fallback => 1; + + +# +# Return the process as a nicely formatted string +# +sub self2str { + my ($self)= @_; + my $pid= $self->{SAFE_PID}; + my $winpid= $self->{SAFE_WINPID}; + my $name= $self->{SAFE_NAME}; + my $exit_status= $self->{EXIT_STATUS}; + + my $str= "[$name - pid: $pid"; + $str.= ", winpid: $winpid" if defined $winpid; + $str.= ", exit: $exit_status" if defined $exit_status; + $str.= "]"; +} + +sub _verbose { + return unless $_verbose; + print STDERR " ## ", @_, "\n"; +} + + +sub pid { + my ($self)= @_; + return $self->{SAFE_PID}; +} + +sub user_data { + my ($self)= @_; + return $self->{SAFE_USER_DATA}; +} + + +1; diff --git a/mysql-test/lib/My/SafeProcess/Base.pm b/mysql-test/lib/My/SafeProcess/Base.pm new file mode 100644 index 00000000000..3fc1b1be017 --- /dev/null +++ b/mysql-test/lib/My/SafeProcess/Base.pm @@ -0,0 +1,212 @@ +# -*- cperl -*- +# Copyright (C) 2004-2006 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +# This is a library file used by the Perl version of mysql-test-run, +# and is part of the translation of the Bourne shell script with the +# same name. + +use strict; + +package My::SafeProcess::Base; + +# +# Utility functions for Process management +# + +use Carp; +use IO::Pipe; + +use base qw(Exporter); +our @EXPORT= qw(create_process); + + + +# +# safe_fork +# Retry a couple of times if fork returns EAGAIN +# +sub _safe_fork { + my $retries= 5; + my $pid; + + FORK: + { + $pid= fork; + if ( not defined($pid)) { + + croak("fork failed after: $!") if (!$retries--); + + warn("fork failed sleep 1 second and redo: $!"); + sleep(1); + redo FORK; + } + } + + return $pid; +}; + + +# +# Decode exit status +# +sub exit_status { + my $self= shift; + my $raw= $self->{EXIT_STATUS}; + + croak("Can't call exit_status before process has died") + unless defined $raw; + + if ($raw & 127) + { + # Killed by signal + my $signal_num= $raw & 127; + my $dumped_core= $raw & 128; + return 1; # Return error code + } + else + { + # Normal process exit + return $raw >> 8; + }; +} + + +# +# Create a new process +# Return pid of the new process +# +sub create_process { + my %opts= + ( + @_ + ); + + my $path = delete($opts{'path'}) or die "path required"; + my $args = delete($opts{'args'}) or die "args required"; + my $input = delete($opts{'input'}); + my $output = delete($opts{'output'}); + my $error = delete($opts{'error'}); + + my $open_mode= $opts{append} ? ">>" : ">"; + + if ($^O eq "MSWin32"){ + + #printf STDERR "stdin %d, stdout %d, stderr %d\n", + # fileno STDIN, fileno STDOUT, fileno STDERR; + + # input output redirect + my ($oldin, $oldout, $olderr); + open $oldin, '<&', \*STDIN or die "Failed to save old stdin: $!"; + open $oldout, '>&', \*STDOUT or die "Failed to save old stdout: $!"; + open $olderr, '>&', \*STDERR or die "Failed to save old stderr: $!"; + + if ( $input ) { + if ( ! open(STDIN, "<", $input) ) { + croak("can't redirect STDIN to '$input': $!"); + } + } + + if ( $output ) { + if ( ! open(STDOUT, $open_mode, $output) ) { + croak("can't redirect STDOUT to '$output': $!"); + } + } + + if ( $error ) { + if ( $output eq $error ) { + if ( ! open(STDERR, ">&STDOUT") ) { + croak("can't dup STDOUT: $!"); + } + } + elsif ( ! open(STDERR, $open_mode, $error) ) { + croak("can't redirect STDERR to '$error': $!"); + } + } + + + # Magic use of 'system(1, @args)' to spawn a process + # and get a proper Win32 pid + unshift (@$args, $path); + my $pid= system(1, @$args); + if ( $pid == 0 ){ + print $olderr "create_process failed: $^E\n"; + die "create_process failed: $^E"; + } + + # Retore IO redirects + open STDERR, '>&', $olderr + or croak("unable to reestablish STDERR"); + open STDOUT, '>&', $oldout + or croak("unable to reestablish STDOUT"); + open STDIN, '<&', $oldin + or croak("unable to reestablish STDIN"); + #printf STDERR "stdin %d, stdout %d, stderr %d\n", + # fileno STDIN, fileno STDOUT, fileno STDERR; + return $pid; + + } + + local $SIG{PIPE}= sub { print STDERR "Got signal $@\n"; }; + my $pipe= IO::Pipe->new(); + my $pid= _safe_fork(); + if ($pid){ + # Parent + $pipe->reader(); + my $line= <$pipe>; # Wait for child to say it's ready + return $pid; + } + + $SIG{INT}= 'DEFAULT'; + + # Make this process it's own process group to be able to kill + # it and any childs(that hasn't changed group themself) + setpgrp(0,0) if $opts{setpgrp}; + + if ( $output and !open(STDOUT, $open_mode, $output) ) { + croak("can't redirect STDOUT to '$output': $!"); + } + + if ( $error ) { + if ( defined $output and $output eq $error ) { + if ( ! open(STDERR, ">&STDOUT") ) { + croak("can't dup STDOUT: $!"); + } + } + elsif ( ! open(STDERR, $open_mode, $error) ) { + croak("can't redirect STDERR to '$error': $!"); + } + } + + if ( $input ) { + if ( ! open(STDIN, "<", $input) ) { + croak("can't redirect STDIN to '$input': $!"); + } + } + + # Tell parent to continue + $pipe->writer(); + print $pipe "ready\n"; + + if ( !exec($path, @$args) ){ + croak("Failed to exec '$path': $!"); + } + + croak("Should never come here"); + +} + +1; + diff --git a/mysql-test/lib/My/SafeProcess/CMakeLists.txt b/mysql-test/lib/My/SafeProcess/CMakeLists.txt new file mode 100644 index 00000000000..97fab820f95 --- /dev/null +++ b/mysql-test/lib/My/SafeProcess/CMakeLists.txt @@ -0,0 +1,17 @@ +# Copyright (C) 2006 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +ADD_EXECUTABLE(my_safe_process safe_process_win.cc) +ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc) diff --git a/mysql-test/lib/My/SafeProcess/Makefile.am b/mysql-test/lib/My/SafeProcess/Makefile.am new file mode 100644 index 00000000000..623c0e9a87a --- /dev/null +++ b/mysql-test/lib/My/SafeProcess/Makefile.am @@ -0,0 +1,28 @@ +# Copyright (C) 2000-2006 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +safedir = $(prefix)/mysql-test/lib/My/SafeProcess +#nobase_bin_PROGRAMS = ... +safe_PROGRAMS = my_safe_process + +my_safe_process_SOURCES = safe_process.cc + +EXTRA_DIST = safe_kill_win.cc \ + safe_process_win.cc \ + CMakeLists.txt + + +# Don't update the files from bitkeeper +%::SCCS/s.% diff --git a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc new file mode 100755 index 00000000000..c6256fd92e1 --- /dev/null +++ b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc @@ -0,0 +1,85 @@ +/* Copyright (C) 2004 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +/* + Utility program used to signal a safe_process it's time to shutdown + + Usage: + safe_kill <pid> +*/ + +#include <windows.h> +#include <stdio.h> +#include <signal.h> + +int main(int argc, const char** argv ) +{ + DWORD pid= -1; + HANDLE shutdown_event; + char safe_process_name[32]= {0}; + int retry_open_event= 100; + /* Ignore any signals */ + signal(SIGINT, SIG_IGN); + signal(SIGBREAK, SIG_IGN); + signal(SIGTERM, SIG_IGN); + + if (argc != 2) { + fprintf(stderr, "safe_kill <pid>\n"); + exit(2); + } + pid= atoi(argv[1]); + + _snprintf(safe_process_name, sizeof(safe_process_name), + "safe_process[%d]", pid); + + /* Open the event to signal */ + while ((shutdown_event= + OpenEvent(EVENT_MODIFY_STATE, FALSE, safe_process_name)) == NULL) + { + /* + Check if the process is alive, otherwise there is really + no idea to retry the open of the event + */ + HANDLE process; + if ((process= OpenProcess(SYNCHRONIZE, FALSE, pid)) == NULL) + { + fprintf(stderr, "Could not open event or process %d, error: %d\n", + pid, GetLastError()); + exit(3); + } + CloseHandle(process); + + if (retry_open_event--) + Sleep(100); + else + { + fprintf(stderr, "Failed to open shutdown_event '%s', error: %d\n", + safe_process_name, GetLastError()); + exit(3); + } + } + + if(SetEvent(shutdown_event) == 0) + { + fprintf(stderr, "Failed to signal shutdown_event '%s', error: %d\n", + safe_process_name, GetLastError()); + CloseHandle(shutdown_event); + exit(4); + } + CloseHandle(shutdown_event); + exit(0); +} + diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc new file mode 100644 index 00000000000..7932f3fd2d6 --- /dev/null +++ b/mysql-test/lib/My/SafeProcess/safe_process.cc @@ -0,0 +1,277 @@ +/* Copyright (C) 2008 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +/* + Utility program that encapsulates process creation, monitoring + and bulletproof process cleanup + + Usage: + safe_process [options to safe_process] -- progname arg1 ... argn + + To safeguard mysqld you would invoke safe_process with a few options + for safe_process itself followed by a double dash to indicate start + of the command line for the program you really want to start + + $> safe_process --output=output.log -- mysqld --datadir=var/data1 ... + + This would redirect output to output.log and then start mysqld, + once it has done that it will continue to monitor the child as well + as the parent. + + The safe_process then checks the follwing things: + 1. Child exits, propagate the childs return code to the parent + by exiting with the same return code as the child. + + 2. Parent dies, immediately kill the child and exit, thus the + parent does not need to properly cleanup any child, it is handled + automatically. + + 3. Signal's recieced by the process will trigger same action as 2) + +*/ + +#include <sys/types.h> +#include <sys/wait.h> +#include <unistd.h> +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <signal.h> +#include <string.h> +#include <errno.h> + +int verbose= 0; +int terminated= 0; +pid_t child_pid= -1; +char safe_process_name[32]= {0}; + + +static void message(const char* fmt, ...) +{ + if (!verbose) + return; + va_list args; + fprintf(stderr, "%s: ", safe_process_name); + va_start(args, fmt); + vfprintf(stderr, fmt, args); + fprintf(stderr, "\n"); + va_end(args); + fflush(stderr); +} + + +static void die(const char* fmt, ...) +{ + va_list args; + fprintf(stderr, "%s: FATAL ERROR, ", safe_process_name); + va_start(args, fmt); + vfprintf(stderr, fmt, args); + fprintf(stderr, "\n"); + va_end(args); + if (int last_err= errno) + fprintf(stderr, "error: %d, %s\n", last_err, strerror(last_err)); + exit(1); +} + + +static void kill_child (void) +{ + int status= 0; + + message("Killing child: %d", child_pid); + // Terminate whole process group + kill(-child_pid, SIGKILL); + + pid_t ret_pid= waitpid(child_pid, &status, 0); + if (ret_pid == child_pid) + { + int exit_code= 1; + if (WIFEXITED(status)) + { + // Process has exited, collect return status + exit_code= WEXITSTATUS(status); + message("Child exit: %d", exit_code); + // Exit with exit status of the child + exit(exit_code); + } + + if (WIFSIGNALED(status)) + message("Child killed by signal: %d", WTERMSIG(status)); + + exit(exit_code); + } + exit(1); +} + + +static void handle_abort (int sig) +{ + message("Got signal %d, child_pid: %d, sending ABRT", sig, child_pid); + + if (child_pid > 0) { + kill (-child_pid, SIGABRT); // Don't wait for it to terminate + } +} + + +static void handle_signal (int sig) +{ + message("Got signal %d, child_pid: %d", sig, child_pid); + terminated= 1; + + if (child_pid > 0) + kill_child(); + + // Ignore further signals + signal(SIGTERM, SIG_IGN); + signal(SIGINT, SIG_IGN); + + // Continune execution, allow the child to be started and + // finally terminated by monitor loop +} + + +int main(int argc, char* const argv[] ) +{ + char* const* child_argv= 0; + pid_t own_pid= getpid(); + pid_t parent_pid= getppid(); + + /* Install signal handlers */ + signal(SIGTERM, handle_signal); + signal(SIGINT, handle_signal); + signal(SIGCHLD, handle_signal); + signal(SIGABRT, handle_abort); + + sprintf(safe_process_name, "safe_process[%d]", own_pid); + + message("Started"); + + /* Parse arguments */ + for (int i= 1; i < argc; i++) { + const char* arg= argv[i]; + if (strcmp(arg, "--") == 0 && strlen(arg) == 2) { + /* Got the "--" delimiter */ + if (i >= argc) + die("No real args -> nothing to do"); + child_argv= &argv[i+1]; + break; + } else { + if ( strcmp(arg, "--verbose") == 0 ) + verbose++; + else if ( strncmp(arg, "--parent-pid", 10) == 0 ) + { + /* Override parent_pid with a value provided by user */ + const char* start; + if ((start= strstr(arg, "=")) == NULL) + die("Could not find start of option value in '%s'", arg); + start++; /* Step past = */ + if ((parent_pid= atoi(start)) == 0) + die("Invalid value '%s' passed to --parent-id", start); + } + else + die("Unknown option: %s", arg); + } + } + if (!child_argv || *child_argv == 0) + die("nothing to do"); + + message("parent_pid: %d", parent_pid); + if (parent_pid == own_pid) + die("parent_pid is equal to own pid!"); + + char buf; + int pfd[2]; + if (pipe(pfd) == -1) + die("Failed to create pipe"); + + /* Create the child process */ + while((child_pid= fork()) == -1) + { + message("fork failed"); + sleep(1); + } + + if (child_pid == 0) + { + close(pfd[0]); // Close unused read end + + // Use default signal handlers in child + signal(SIGTERM, SIG_DFL); + signal(SIGINT, SIG_DFL); + signal(SIGCHLD, SIG_DFL); + + // Make this process it's own process group to be able to kill + // it and any childs(that hasn't changed group themself) + setpgid(0, 0); + + // Signal that child is ready + buf= 37; + write(pfd[1], &buf, 1); + // Close write end + close(pfd[1]); + + if (execvp(child_argv[0], child_argv) < 0) + die("Failed to exec child"); + } + + close(pfd[1]); // Close unused write end + + // Wait for child to signal it's ready + read(pfd[0], &buf, 1); + if(buf != 37) + die("Didn't get 37 from pipe"); + close(pfd[0]); // Close read end + + /* Monitor loop */ + message("Started child %d, terminated: %d", child_pid, terminated); + + while(!terminated) + { + // Check if parent is still alive + if (kill(parent_pid, 0) != 0){ + message("Parent is not alive anymore"); + break; + } + + // Check if child has exited, normally this will be + // detected immediately with SIGCHLD handler + int status= 0; + pid_t ret_pid= waitpid(child_pid, &status, WNOHANG); + if (ret_pid == child_pid) + { + int ret_code= 2; + if (WIFEXITED(status)) + { + // Process has exited, collect return status + int ret_code= WEXITSTATUS(status); + message("Child exit: %d", ret_code); + // Exit with exit status of the child + exit(ret_code); + } + + if (WIFSIGNALED(status)) + message("Child killed by signal: %d", WTERMSIG(status)); + + exit(ret_code); + } + sleep(1); + } + kill_child(); + + exit(1); +} + diff --git a/mysql-test/lib/My/SafeProcess/safe_process.pl b/mysql-test/lib/My/SafeProcess/safe_process.pl new file mode 100644 index 00000000000..e3114a749d3 --- /dev/null +++ b/mysql-test/lib/My/SafeProcess/safe_process.pl @@ -0,0 +1,151 @@ +#!/usr/bin/perl +# -*- cperl -*- + +use strict; +use warnings; + +use lib 'lib'; +use My::SafeProcess::Base; +use POSIX qw(WNOHANG); + +########################################################################### +# Util functions +########################################################################### + +# +#Print message to stderr +# +my $verbose= 0; +sub message { + if ($verbose > 0){ + use Time::localtime; + my $tm= localtime(); + my $timestamp= sprintf("%02d%02d%02d %2d:%02d:%02d", + $tm->year % 100, $tm->mon+1, $tm->mday, + $tm->hour, $tm->min, $tm->sec); + print STDERR $timestamp, " monitor[$$]: ", @_, "\n"; + } +} + + +########################################################################### +# Main program +########################################################################### + +my $terminated= 0; + +# Protect against being killed in the middle +# of child creation, just set the terminated flag +# to make sure the child will be killed off +# when program is ready to do that +$SIG{TERM}= sub { message("!Got signal @_"); $terminated= 1; }; +$SIG{INT}= sub { message("!Got signal @_"); $terminated= 1; }; + +my $parent_pid= getppid(); + +my $found_double_dash= 0; +while (my $arg= shift(@ARGV)){ + + if ($arg =~ /^--$/){ + $found_double_dash= 1; + last; + } + elsif ($arg =~ /^--verbose$/){ + $verbose= 1; + } + else { + die "Unknown option: $arg"; + } +} + +my $path= shift(@ARGV); # Executable + +die "usage:\n" . + " safe_process.pl [opts] -- <path> [<args> [...<args_n>]]" + unless defined $path || $found_double_dash; + + +message("started"); +#message("path: '$path'"); +message("parent: $parent_pid"); + +# Start process to monitor +my $child_pid= + create_process( + path => $path, + args => \@ARGV, + setpgrp => 1, + ); +message("Started child $child_pid"); + +eval { + sub handle_signal { + $terminated= 1; + message("Got signal @_"); + + # Ignore all signals + foreach my $name (keys %SIG){ + $SIG{$name}= 'IGNORE'; + } + + die "signaled\n"; + }; + local $SIG{TERM}= \&handle_signal; + local $SIG{INT}= \&handle_signal; + local $SIG{CHLD}= sub { + message("Got signal @_"); + kill(9, -$child_pid); + my $ret= waitpid($child_pid, 0); + if ($? & 127){ + exit(65); # Killed by signal + } + exit($? >> 8); + }; + + # Monitoring loop + while(!$terminated) { + + # Check if parent is still alive + if (kill(0, $parent_pid) < 1){ + message("Parent is not alive anymore"); + last; + } + + # Wait for child to terminate but wakeup every + # second to also check that parent is still alive + my $ret_pid; + $ret_pid= waitpid($child_pid, &WNOHANG); + if ($ret_pid == $child_pid) { + # Process has exited, collect return status + my $ret_code= $? >> 8; + message("Child exit: $ret_code"); + # Exit with exit status of the child + exit ($ret_code); + } + sleep(1); + } +}; +if ( $@ ) { + # The monitoring loop should have been + # broken by handle_signal + warn "Unexpected: $@" unless ( $@ =~ /signaled/ ); +} + +# Use negative pid in order to kill the whole +# process group +# +my $ret= kill(9, -$child_pid); +message("Killed child: $child_pid, ret: $ret"); +if ($ret > 0) { + message("Killed child: $child_pid"); + # Wait blocking for the child to return + my $ret_pid= waitpid($child_pid, 0); + if ($ret_pid != $child_pid){ + message("unexpected pid $ret_pid returned from waitpid($child_pid)"); + } +} + +message("DONE!"); +exit (1); + + diff --git a/mysql-test/lib/My/SafeProcess/safe_process_win.cc b/mysql-test/lib/My/SafeProcess/safe_process_win.cc new file mode 100755 index 00000000000..8aa603a8793 --- /dev/null +++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc @@ -0,0 +1,316 @@ +/* Copyright (C) 2004 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +/* + Utility program that encapsulates process creation, monitoring + and bulletproof process cleanup + + Usage: + safe_process [options to safe_process] -- progname arg1 ... argn + + To safeguard mysqld you would invoke safe_process with a few options + for safe_process itself followed by a double dash to indicate start + of the command line for the program you really want to start + + $> safe_process --output=output.log -- mysqld --datadir=var/data1 ... + + This would redirect output to output.log and then start mysqld, + once it has done that it will continue to monitor the child as well + as the parent. + + The safe_process then checks the follwing things: + 1. Child exits, propagate the childs return code to the parent + by exiting with the same return code as the child. + + 2. Parent dies, immediately kill the child and exit, thus the + parent does not need to properly cleanup any child, it is handled + automatically. + + 3. Signal's recieced by the process will trigger same action as 2) + + 4. The named event "safe_process[pid]" can be signaled and will + trigger same action as 2) + + WARNING! Be careful when using ProcessExplorer, since it will open + a handle to each process(and maybe also the Job), the process + spawned by safe_process will not be closed off when safe_process + is killed. +*/ + +/* Requires Windows 2000 or higher */ +#define _WIN32_WINNT 0x0500 + +#include <windows.h> +#include <stdio.h> +#include <tlhelp32.h> +#include <signal.h> + +static int verbose= 0; +static char safe_process_name[32]= {0}; + +static void message(const char* fmt, ...) +{ + if (!verbose) + return; + va_list args; + fprintf(stderr, "%s: ", safe_process_name); + va_start(args, fmt); + vfprintf(stderr, fmt, args); + fprintf(stderr, "\n"); + va_end(args); + fflush(stderr); +} + + +static void die(const char* fmt, ...) +{ + va_list args; + fprintf(stderr, "%s: FATAL ERROR, ", safe_process_name); + va_start(args, fmt); + vfprintf(stderr, fmt, args); + fprintf(stderr, "\n"); + va_end(args); + if (int last_err= GetLastError()) + fprintf(stderr, "error: %d, %s\n", last_err, strerror(last_err)); + fflush(stderr); + exit(1); +} + + +DWORD get_parent_pid(DWORD pid) +{ + HANDLE snapshot; + DWORD parent_pid= -1; + PROCESSENTRY32 pe32; + pe32.dwSize= sizeof(PROCESSENTRY32); + + snapshot= CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (snapshot == INVALID_HANDLE_VALUE) + die("CreateToolhelp32Snapshot failed"); + + if (!Process32First(snapshot, &pe32)) + { + CloseHandle(snapshot); + die("Process32First failed"); + } + + do + { + if (pe32.th32ProcessID == pid) + parent_pid= pe32.th32ParentProcessID; + } while(Process32Next( snapshot, &pe32)); + CloseHandle(snapshot); + + if (parent_pid == -1) + die("Could not find parent pid"); + + return parent_pid; +} + + +enum { + PARENT, + CHILD, + EVENT, + NUM_HANDLES +}; + + +HANDLE shutdown_event; +void handle_signal (int signal) +{ + message("Got signal: %d", signal); + if(SetEvent(shutdown_event) == 0) { + /* exit safe_process and (hopefully) kill off the child */ + die("Failed to SetEvent"); + } +} + + +int main(int argc, const char** argv ) +{ + char child_args[4096]= {0}; + DWORD pid= GetCurrentProcessId(); + DWORD parent_pid= get_parent_pid(pid); + HANDLE job_handle; + HANDLE wait_handles[NUM_HANDLES]= {0}; + PROCESS_INFORMATION process_info= {0}; + + sprintf(safe_process_name, "safe_process[%d]", pid); + + /* Create an event for the signal handler */ + if ((shutdown_event= + CreateEvent(NULL, TRUE, FALSE, safe_process_name)) == NULL) + die("Failed to create shutdown_event"); + wait_handles[EVENT]= shutdown_event; + + signal(SIGINT, handle_signal); + signal(SIGBREAK, handle_signal); + signal(SIGTERM, handle_signal); + + message("Started"); + + /* Parse arguments */ + for (int i= 1; i < argc; i++) { + const char* arg= argv[i]; + char* to= child_args; + if (strcmp(arg, "--") == 0 && strlen(arg) == 2) { + /* Got the "--" delimiter */ + if (i >= argc) + die("No real args -> nothing to do"); + /* Copy the remaining args to child_arg */ + for (int j= i+1; j < argc; j++) { + to+= _snprintf(to, child_args + sizeof(child_args) - to, "%s ", argv[j]); + } + break; + } else { + if ( strcmp(arg, "--verbose") == 0 ) + verbose++; + else if ( strncmp(arg, "--parent-pid", 10) == 0 ) + { + /* Override parent_pid with a value provided by user */ + const char* start; + if ((start= strstr(arg, "=")) == NULL) + die("Could not find start of option value in '%s'", arg); + start++; /* Step past = */ + if ((parent_pid= atoi(start)) == 0) + die("Invalid value '%s' passed to --parent-id", start); + } + else + die("Unknown option: %s", arg); + } + } + if (*child_args == '\0') + die("nothing to do"); + + /* Open a handle to the parent process */ + message("parent_pid: %d", parent_pid); + if (parent_pid == pid) + die("parent_pid is equal to own pid!"); + + if ((wait_handles[PARENT]= + OpenProcess(SYNCHRONIZE, FALSE, parent_pid)) == NULL) + die("Failed to open parent process with pid: %d", parent_pid); + + /* Create the child process in a job */ + JOBOBJECT_EXTENDED_LIMIT_INFORMATION jeli = { 0 }; + STARTUPINFO si = { 0 }; + si.cb = sizeof(si); + + /* + Create the job object to make it possible to kill the process + and all of it's children in one go + */ + if ((job_handle= CreateJobObject(NULL, NULL)) == NULL) + die("CreateJobObject failed"); + + /* + Make all processes associated with the job terminate when the + last handle to the job is closed. + */ + jeli.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; + if (SetInformationJobObject(job_handle, JobObjectExtendedLimitInformation, + &jeli, sizeof(jeli)) == 0) + message("SetInformationJobObject failed, continue anyway..."); + +#if 0 + /* Setup stdin, stdout and stderr redirect */ + si.dwFlags= STARTF_USESTDHANDLES; + si.hStdInput= GetStdHandle(STD_INPUT_HANDLE); + si.hStdOutput= GetStdHandle(STD_OUTPUT_HANDLE); + si.hStdError= GetStdHandle(STD_ERROR_HANDLE); +#endif + + /* + Create the process suspended to make sure it's assigned to the + Job before it creates any process of it's own + */ + if (CreateProcess(NULL, (LPSTR)child_args, + NULL, + NULL, + TRUE, /* inherit handles */ + CREATE_SUSPENDED, + NULL, + NULL, + &si, + &process_info) == 0) + die("CreateProcess failed"); + + if (AssignProcessToJobObject(job_handle, process_info.hProcess) == 0) + { + TerminateProcess(process_info.hProcess, 200); + die("AssignProcessToJobObject failed"); + } + ResumeThread(process_info.hThread); + CloseHandle(process_info.hThread); + + wait_handles[CHILD]= process_info.hProcess; + + message("Started child %d", process_info.dwProcessId); + + /* Monitor loop */ + DWORD child_exit_code= 1; + DWORD wait_res= WaitForMultipleObjects(NUM_HANDLES, wait_handles, + FALSE, INFINITE); + switch (wait_res) + { + case WAIT_OBJECT_0 + PARENT: + message("Parent exit"); + break; + case WAIT_OBJECT_0 + CHILD: + if (GetExitCodeProcess(wait_handles[CHILD], &child_exit_code) == 0) + message("Child exit: could not get exit_code"); + else + message("Child exit: exit_code: %d", child_exit_code); + break; + case WAIT_OBJECT_0 + EVENT: + message("Wake up from shutdown_event"); + break; + + default: + message("Unexpected result %d from WaitForMultipleObjects", wait_res); + break; + } + message("Exiting, child: %d", process_info.dwProcessId); + + if (TerminateJobObject(job_handle, 201) == 0) + message("TerminateJobObject failed"); + CloseHandle(job_handle); + message("Job terminated and closed"); + if (wait_res != WAIT_OBJECT_0 + CHILD) + { + /* The child has not yet returned, wait for it */ + message("waiting for child to exit"); + if ((wait_res= WaitForSingleObject(wait_handles[CHILD], INFINITE)) + != WAIT_OBJECT_0) + { + message("child wait failed: %d", wait_res); + } + else + { + message("child wait succeeded"); + } + /* Child's exit code should now be 201, no need to get it */ + } + + message("Closing handles"); + for (int i= 0; i < NUM_HANDLES; i++) + CloseHandle(wait_handles[i]); + + message("Exiting, exit_code: %d", child_exit_code); + exit(child_exit_code); +} + diff --git a/mysql-test/lib/My/SysInfo.pm b/mysql-test/lib/My/SysInfo.pm new file mode 100644 index 00000000000..f1ba5fb610f --- /dev/null +++ b/mysql-test/lib/My/SysInfo.pm @@ -0,0 +1,211 @@ +# -*- cperl -*- +# Copyright (C) 2004-2006 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +package My::SysInfo; + +use strict; +use Carp; +use My::Platform; + +use constant DEFAULT_BOGO_MIPS => 2000; + +sub _cpuinfo { + my ($self)= @_; + + my $info_file= "/proc/cpuinfo"; + if ( !( -e $info_file and -f $info_file) ) { + return undef; + } + + my $F= IO::File->new($info_file) or return undef; + + # Set input separator to blank line + local $/ = ''; + + while ( my $cpu_chunk= <$F>) { + chomp($cpu_chunk); + + my $cpuinfo = {}; + + foreach my $cpuline ( split(/\n/, $cpu_chunk) ) { + my ( $attribute, $value ) = split(/\s*:\s*/, $cpuline); + + $attribute =~ s/\s+/_/; + $attribute = lc($attribute); + + if ( $value =~ /^(no|not available|yes)$/ ) { + $value = $value eq 'yes' ? 1 : 0; + } + + if ( $attribute eq 'flags' ) { + @{ $cpuinfo->{flags} } = split / /, $value; + } else { + $cpuinfo->{$attribute} = $value; + } + } + + # Make sure bogomips is set to some value + $cpuinfo->{bogomips} |= DEFAULT_BOGO_MIPS; + + # Cpus reported once, but with 'cpu_count' set to the actual number + my $cpu_count= $cpuinfo->{cpu_count} || 1; + for(1..$cpu_count){ + push(@{$self->{cpus}}, $cpuinfo); + } + } + $F= undef; # Close file + return $self; +} + + +sub _kstat { + my ($self)= @_; + while (1){ + my $instance_num= $self->{cpus} ? @{$self->{cpus}} : 0; + my $list= `kstat -p -m cpu_info -i $instance_num 2> /dev/null`; + my @lines= split('\n', $list) or last; # Break loop + + my $cpuinfo= {}; + foreach my $line (@lines) + { + my ($module, $instance, $name, $statistic, $value)= + $line=~ /(\w*):(\w*):(\w*):(\w*)\t(.*)/; + + $cpuinfo->{$statistic}= $value; + } + + # Default value, the actual cpu values can be used to decrease this + # on slower cpus + $cpuinfo->{bogomips}= DEFAULT_BOGO_MIPS; + + push(@{$self->{cpus}}, $cpuinfo); + } + + # At least one cpu should have been found + # if this method worked + if ( $self->{cpus} ) { + return $self; + } + return undef; +} + + +sub _unamex { + my ($self)= @_; + # TODO + return undef; +} + + +sub new { + my ($class)= @_; + + + my $self= bless { + cpus => (), + }, $class; + + my @info_methods = + ( + \&_cpuinfo, + \&_kstat, + \&_unamex, + ); + + # Detect virtual machines + my $isvm= 0; + + if (IS_WINDOWS) { + # Detect vmware service + $isvm= `tasklist` =~ /vmwareservice/i; + } + $self->{isvm}= $isvm; + + foreach my $method (@info_methods){ + if ($method->($self)){ + return $self; + } + } + + # Push a dummy cpu + push(@{$self->{cpus}}, + { + bogomips => DEFAULT_BOGO_MIPS, + model_name => "unknown", + }); + + return $self; +} + + +# Return the list of cpus found +sub cpus { + my ($self)= @_; + return @{$self->{cpus}} or + confess "INTERNAL ERROR: No cpus in list"; +} + + +# Return the number of cpus found +sub num_cpus { + my ($self)= @_; + return int(@{$self->{cpus}}) or + confess "INTERNAL ERROR: No cpus in list"; +} + + +# Return the smallest bogomips value amongst the processors +sub min_bogomips { + my ($self)= @_; + + my $bogomips; + + foreach my $cpu (@{$self->{cpus}}) { + if (!defined $bogomips or $bogomips > $cpu->{bogomips}) { + $bogomips= $cpu->{bogomips}; + } + } + + return $bogomips; +} + +sub isvm { + my ($self)= @_; + + return $self->{isvm}; +} + + +# Prit the cpuinfo +sub print_info { + my ($self)= @_; + + foreach my $cpu (@{$self->{cpus}}) { + while ((my ($key, $value)) = each(%$cpu)) { + print " ", $key, "= "; + if (ref $value eq "ARRAY") { + print "[", join(", ", @$value), "]"; + } else { + print $value; + } + print "\n"; + } + print "\n"; + } +} + +1; diff --git a/mysql-test/lib/My/Test.pm b/mysql-test/lib/My/Test.pm new file mode 100644 index 00000000000..68b100f91af --- /dev/null +++ b/mysql-test/lib/My/Test.pm @@ -0,0 +1,123 @@ +# -*- cperl -*- + + +# +# One test +# +package My::Test; + +use strict; +use warnings; +use Carp; + + +sub new { + my $class= shift; + my $self= bless { + @_, + }, $class; + return $self; +} + + +# +# Return a unique key that can be used to +# identify this test in a hash +# +sub key { + my ($self)= @_; + return $self->{key}; +} + + +sub _encode { + my ($value)= @_; + $value =~ s/([|\\\x{0a}\x{0d}])/sprintf('\%02X', ord($1))/eg; + return $value; +} + +sub _decode { + my ($value)= @_; + $value =~ s/\\([0-9a-fA-F]{2})/chr(hex($1))/ge; + return $value; +} + +sub is_failed { + my ($self)= @_; + my $result= $self->{result}; + croak "'is_failed' can't be called until test has been run!" + unless defined $result; + + return ($result eq 'MTR_RES_FAILED'); +} + + +sub write_test { + my ($test, $sock, $header)= @_; + + # Give the test a unique key before serializing it + $test->{key}= "$test" unless defined $test->{key}; + + print $sock $header, "\n"; + while ((my ($key, $value)) = each(%$test)) { + print $sock $key, "= "; + if (ref $value eq "ARRAY") { + print $sock "[", _encode(join(", ", @$value)), "]"; + } else { + print $sock _encode($value); + } + print $sock "\n"; + } + print $sock "\n"; +} + + +sub read_test { + my ($sock)= @_; + my $test= My::Test->new(); + # Read the : separated key value pairs until a + # single newline on it's own line + my $line; + while (defined($line= <$sock>)) { + # List is terminated by newline on it's own + if ($line eq "\n") { + # Correctly terminated reply + # print "Got newline\n"; + last; + } + chomp($line); + + # Split key/value on the first "=" + my ($key, $value)= split("= ", $line, 2); + + if ($value =~ /^\[(.*)\]/){ + my @values= split(", ", _decode($1)); + push(@{$test->{$key}}, @values); + } + else + { + $test->{$key}= _decode($value); + } + } + return $test; +} + + +sub print_test { + my ($self)= @_; + + print "[", $self->{name}, "]", "\n"; + while ((my ($key, $value)) = each(%$self)) { + print " ", $key, "= "; + if (ref $value eq "ARRAY") { + print "[", join(", ", @$value), "]"; + } else { + print $value; + } + print "\n"; + } + print "\n"; +} + + +1; diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm new file mode 100644 index 00000000000..2150969fe2a --- /dev/null +++ b/mysql-test/lib/mtr_cases.pm @@ -0,0 +1,1140 @@ +# -*- cperl -*- +# Copyright (C) 2005-2006 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +# This is a library file used by the Perl version of mysql-test-run, +# and is part of the translation of the Bourne shell script with the +# same name. + +package mtr_cases; +use strict; + +use base qw(Exporter); +our @EXPORT= qw(collect_option collect_test_cases); + +use mtr_report; +use mtr_match; + +# Options used for the collect phase +our $start_from; +our $print_testcases; +our $skip_rpl; +our $do_test; +our $skip_test; +our $opt_skip_combination; +our $binlog_format; +our $enable_disabled; +our $default_storage_engine; +our $opt_with_ndbcluster_only; +our $defaults_file; +our $defaults_extra_file; +our $reorder= 1; + +sub collect_option { + my ($opt, $value)= @_; + + # Evaluate $opt as string to use "Getopt::Long::Callback legacy API" + my $opt_name = "$opt"; + + # Convert - to _ in option name + $opt_name =~ s/-/_/g; + no strict 'refs'; + ${$opt_name}= $value; +} + +use File::Basename; +use File::Spec::Functions qw / splitdir /; +use IO::File(); +use My::Config; +use My::Platform; +use My::Test; +use My::Find; + +require "mtr_misc.pl"; + +# Precompiled regex's for tests to do or skip +my $do_test_reg; +my $skip_test_reg; + +sub init_pattern { + my ($from, $what)= @_; + return undef unless defined $from; + if ( $from =~ /^[a-z0-9\.]*$/ ) { + # Does not contain any regex (except . that we allow as + # separator betwen suite and testname), make the pattern match + # beginning of string + $from= "^$from"; + mtr_verbose("$what='$from'"); + } + # Check that pattern is a valid regex + eval { "" =~/$from/; 1 } or + mtr_error("Invalid regex '$from' passed to $what\nPerl says: $@"); + return $from; +} + + +############################################################################## +# +# Collect information about test cases to be run +# +############################################################################## + +sub collect_test_cases ($$) { + my $suites= shift; # Semicolon separated list of test suites + my $opt_cases= shift; + my $cases= []; # Array of hash(one hash for each testcase) + + $do_test_reg= init_pattern($do_test, "--do-test"); + $skip_test_reg= init_pattern($skip_test, "--skip-test"); + + foreach my $suite (split(",", $suites)) + { + push(@$cases, collect_one_suite($suite, $opt_cases)); + } + + if ( @$opt_cases ) + { + # A list of tests was specified on the command line + # Check that the tests specified was found + # in at least one suite + foreach my $test_name_spec ( @$opt_cases ) + { + my $found= 0; + my ($sname, $tname, $extension)= split_testname($test_name_spec); + foreach my $test ( @$cases ) + { + # test->{name} is always in suite.name format + if ( $test->{name} =~ /.*\.$tname/ ) + { + $found= 1; + } + } + if ( not $found ) + { + mtr_error("Could not find '$tname' in '$suites' suite(s)"); + } + } + } + + if ( $reorder ) + { + # Reorder the test cases in an order that will make them faster to run + my %sort_criteria; + + # Make a mapping of test name to a string that represents how that test + # should be sorted among the other tests. Put the most important criterion + # first, then a sub-criterion, then sub-sub-criterion, etc. + foreach my $tinfo (@$cases) + { + my @criteria = (); + + # + # Append the criteria for sorting, in order of importance. + # + push(@criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "A" : "B")); + # Group test with equal options together. + # Ending with "~" makes empty sort later than filled + my $opts= $tinfo->{'master_opt'} ? $tinfo->{'master_opt'} : []; + push(@criteria, join("!", sort @{$opts}) . "~"); + + $sort_criteria{$tinfo->{name}} = join(" ", @criteria); + } + + @$cases = sort { + $sort_criteria{$a->{'name'}} . $a->{'name'} cmp + $sort_criteria{$b->{'name'}} . $b->{'name'}; } @$cases; + + # For debugging the sort-order + # foreach my $tinfo (@$cases) + # { + # print("$sort_criteria{$tinfo->{'name'}} -> \t$tinfo->{'name'}\n"); + # } + + } + + if (defined $print_testcases){ + print_testcases(@$cases); + exit(1); + } + + return $cases; + +} + + +# Returns (suitename, testname, extension) +sub split_testname { + my ($test_name)= @_; + + # Get rid of directory part and split name on .'s + my @parts= split(/\./, basename($test_name)); + + if (@parts == 1){ + # Only testname given, ex: alias + return (undef , $parts[0], undef); + } elsif (@parts == 2) { + # Either testname.test or suite.testname given + # Ex. main.alias or alias.test + + if ($parts[1] eq "test") + { + return (undef , $parts[0], $parts[1]); + } + else + { + return ($parts[0], $parts[1], undef); + } + + } elsif (@parts == 3) { + # Fully specified suitename.testname.test + # ex main.alias.test + return ( $parts[0], $parts[1], $parts[2]); + } + + mtr_error("Illegal format of test name: $test_name"); +} + + +sub collect_one_suite($) +{ + my $suite= shift; # Test suite name + my $opt_cases= shift; + my @cases; # Array of hash + + mtr_verbose("Collecting: $suite"); + + my $suitedir= "$::glob_mysql_test_dir"; # Default + if ( $suite ne "main" ) + { + # Allow suite to be path to "some dir" if $suite has at least + # one directory part + if ( -d $suite and splitdir($suite) > 1 ){ + $suitedir= $suite; + mtr_report(" - from '$suitedir'"); + + } + else + { + $suitedir= my_find_dir($::basedir, + ["mysql-test/suite", + "mysql-test", + # Look in storage engine specific suite dirs + "storage/*/mysql-test-suites" + ], + [$suite]); + } + mtr_verbose("suitedir: $suitedir"); + } + + my $testdir= "$suitedir/t"; + my $resdir= "$suitedir/r"; + + # Check if t/ exists + if (-d $testdir){ + # t/ exists + + if ( -d $resdir ) + { + # r/exists + } + else + { + # No r/, use t/ as result dir + $resdir= $testdir; + } + + } + else { + # No t/ dir => there can' be any r/ dir + mtr_error("Can't have r/ dir without t/") if -d $resdir; + + # No t/ or r/ => use suitedir + $resdir= $testdir= $suitedir; + } + + mtr_verbose("testdir: $testdir"); + mtr_verbose("resdir: $resdir"); + + # ---------------------------------------------------------------------- + # Build a hash of disabled testcases for this suite + # ---------------------------------------------------------------------- + my %disabled; + if ( open(DISABLED, "$testdir/disabled.def" ) ) + { + while ( <DISABLED> ) + { + chomp; + if ( /^\s*(\S+)\s*:\s*(.*?)\s*$/ ) + { + $disabled{$1}= $2; + } + } + close DISABLED; + } + + # Read suite.opt file + my $suite_opt_file= "$testdir/suite.opt"; + my $suite_opts= []; + if ( -f $suite_opt_file ) + { + $suite_opts= opts_from_file($suite_opt_file); + } + + if ( @$opt_cases ) + { + # Collect in specified order + foreach my $test_name_spec ( @$opt_cases ) + { + my ($sname, $tname, $extension)= split_testname($test_name_spec); + + # The test name parts have now been defined + #print " suite_name: $sname\n"; + #print " tname: $tname\n"; + #print " extension: $extension\n"; + + # Check cirrect suite if suitename is defined + next if (defined $sname and $suite ne $sname); + + if ( defined $extension ) + { + my $full_name= "$testdir/$tname.$extension"; + # Extension was specified, check if the test exists + if ( ! -f $full_name) + { + # This is only an error if suite was specified, otherwise it + # could exist in another suite + mtr_error("Test '$full_name' was not found in suite '$sname'") + if $sname; + + next; + } + } + else + { + # No extension was specified, use default + $extension= "test"; + my $full_name= "$testdir/$tname.$extension"; + + # Test not found here, could exist in other suite + next if ( ! -f $full_name ); + } + + push(@cases, + collect_one_test_case($suitedir, + $testdir, + $resdir, + $suite, + $tname, + "$tname.$extension", + \%disabled, + $suite_opts)); + } + } + else + { + opendir(TESTDIR, $testdir) or mtr_error("Can't open dir \"$testdir\": $!"); + + foreach my $elem ( sort readdir(TESTDIR) ) + { + my $tname= mtr_match_extension($elem, 'test'); + + next unless defined $tname; + + # Skip tests that does not match the --do-test= filter + next if ($do_test_reg and not $tname =~ /$do_test_reg/o); + + push(@cases, + collect_one_test_case($suitedir, + $testdir, + $resdir, + $suite, + $tname, + $elem, + \%disabled, + $suite_opts)); + } + closedir TESTDIR; + } + + # Return empty list if no testcases found + return if (@cases == 0); + + # ---------------------------------------------------------------------- + # Read combinations for this suite and build testcases x combinations + # if any combinations exists + # ---------------------------------------------------------------------- + if ( ! $opt_skip_combination ) + { + my @combinations; + my $combination_file= "$suitedir/combinations"; + #print "combination_file: $combination_file\n"; + if (@::opt_combinations) + { + # take the combination from command-line + mtr_verbose("Take the combination from command line"); + foreach my $combination (@::opt_combinations) { + my $comb= {}; + $comb->{name}= $combination; + push(@{$comb->{comb_opt}}, $combination); + push(@combinations, $comb); + } + } + elsif (-f $combination_file ) + { + # Read combinations file in my.cnf format + mtr_verbose("Read combinations file"); + my $config= My::Config->new($combination_file); + foreach my $group ($config->groups()) { + my $comb= {}; + $comb->{name}= $group->name(); + foreach my $option ( $group->options() ) { + push(@{$comb->{comb_opt}}, $option->option()); + } + push(@combinations, $comb); + } + } + + if (@combinations) + { + print " - adding combinations for $suite\n"; + #print_testcases(@cases); + + my @new_cases; + foreach my $comb (@combinations) + { + foreach my $test (@cases) + { + + next if ( $test->{'skip'} ); + + # Skip this combination if the values it provides + # already are set in master_opt or slave_opt + if (My::Options::is_set($test->{master_opt}, $comb->{comb_opt}) && + My::Options::is_set($test->{slave_opt}, $comb->{comb_opt}) ){ + next; + } + + # Copy test options + my $new_test= My::Test->new(); + while (my ($key, $value) = each(%$test)) { + if (ref $value eq "ARRAY") { + push(@{$new_test->{$key}}, @$value); + } else { + $new_test->{$key}= $value; + } + } + + # Append the combination options to master_opt and slave_opt + push(@{$new_test->{master_opt}}, @{$comb->{comb_opt}}); + push(@{$new_test->{slave_opt}}, @{$comb->{comb_opt}}); + + # Add combination name short name + $new_test->{combination}= $comb->{name}; + + # Add the new test to new test cases list + push(@new_cases, $new_test); + } + } + + # Add the plain test if it was not already added + # as part of a combination + my %added; + foreach my $new_test (@new_cases){ + $added{$new_test->{name}}= 1; + } + foreach my $test (@cases){ + push(@new_cases, $test) unless $added{$test->{name}}; + } + + + #print_testcases(@new_cases); + @cases= @new_cases; + #print_testcases(@cases); + } + } + optimize_cases(\@cases); + #print_testcases(@cases); + + return @cases; +} + + + +# +# Loop through all test cases +# - optimize which test to run by skipping unnecessary ones +# - update settings if necessary +# +sub optimize_cases { + my ($cases)= @_; + + foreach my $tinfo ( @$cases ) + { + # Skip processing if already marked as skipped + next if $tinfo->{skip}; + + # ======================================================= + # If a special binlog format was selected with + # --mysqld=--binlog-format=x, skip all test that does not + # support it + # ======================================================= + #print "binlog_format: $binlog_format\n"; + if (defined $binlog_format ) + { + # ======================================================= + # Fixed --binlog-format=x specified on command line + # ======================================================= + if ( defined $tinfo->{'binlog_formats'} ) + { + #print "binlog_formats: ". join(", ", @{$tinfo->{binlog_formats}})."\n"; + + # The test supports different binlog formats + # check if the selected one is ok + my $supported= + grep { $_ eq $binlog_format } @{$tinfo->{'binlog_formats'}}; + if ( !$supported ) + { + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= + "Doesn't support --binlog-format='$binlog_format'"; + } + } + } + else + { + # ======================================================= + # Use dynamic switching of binlog format + # ======================================================= + + # Get binlog-format used by this test from master_opt + my $test_binlog_format; + foreach my $opt ( @{$tinfo->{master_opt}} ) { + $test_binlog_format= + mtr_match_prefix($opt, "--binlog-format=") || $test_binlog_format; + } + + if (defined $test_binlog_format and + defined $tinfo->{binlog_formats} ) + { + my $supported= + grep { $_ eq $test_binlog_format } @{$tinfo->{'binlog_formats'}}; + if ( !$supported ) + { + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= + "Doesn't support --binlog-format='$test_binlog_format'"; + next; + } + } + } + + # ======================================================= + # Check that engine selected by + # --default-storage-engine=<engine> is supported + # ======================================================= + my %builtin_engines = ('myisam' => 1, 'memory' => 1); + + foreach my $opt ( @{$tinfo->{master_opt}} ) { + my $default_engine= + mtr_match_prefix($opt, "--default-storage-engine="); + + if (defined $default_engine){ + + #print " $tinfo->{name}\n"; + #print " - The test asked to use '$default_engine'\n"; + + #my $engine_value= $::mysqld_variables{$default_engine}; + #print " - The mysqld_variables says '$engine_value'\n"; + + if ( ! exists $::mysqld_variables{$default_engine} and + ! exists $builtin_engines{$default_engine} ) + { + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= + "'$default_engine' not supported"; + } + + $tinfo->{'ndb_test'}= 1 + if ( $default_engine =~ /^ndb/i ); + $tinfo->{'innodb_test'}= 1 + if ( $default_engine =~ /^innodb/i ); + } + } + } +} + + +# +# Read options from the given opt file and append them as an array +# to $tinfo->{$opt_name} +# +sub process_opts_file { + my ($tinfo, $opt_file, $opt_name)= @_; + + if ( -f $opt_file ) + { + my $opts= opts_from_file($opt_file); + + foreach my $opt ( @$opts ) + { + my $value; + + # The opt file is used both to send special options to the mysqld + # as well as pass special test case specific options to this + # script + + $value= mtr_match_prefix($opt, "--timezone="); + if ( defined $value ) + { + $tinfo->{'timezone'}= $value; + next; + } + + $value= mtr_match_prefix($opt, "--result-file="); + if ( defined $value ) + { + # Specifies the file mysqltest should compare + # output against + $tinfo->{'result_file'}= "r/$value.result"; + next; + } + + $value= mtr_match_prefix($opt, "--config-file-template="); + if ( defined $value) + { + # Specifies the configuration file to use for this test + $tinfo->{'template_path'}= dirname($tinfo->{path})."/$value"; + next; + } + + # If we set default time zone, remove the one we have + $value= mtr_match_prefix($opt, "--default-time-zone="); + if ( defined $value ) + { + # Set timezone for this test case to something different + $tinfo->{'timezone'}= "GMT-8"; + # Fallthrough, add the --default-time-zone option + } + + # The --restart option forces a restart even if no special + # option is set. If the options are the same as next testcase + # there is no need to restart after the testcase + # has completed + if ( $opt eq "--force-restart" ) + { + $tinfo->{'force_restart'}= 1; + next; + } + + # Ok, this was a real option, add it + push(@{$tinfo->{$opt_name}}, $opt); + } + } +} + +############################################################################## +# +# Collect information about a single test case +# +############################################################################## + +sub collect_one_test_case { + my $suitedir= shift; + my $testdir= shift; + my $resdir= shift; + my $suitename= shift; + my $tname= shift; + my $filename= shift; + my $disabled= shift; + my $suite_opts= shift; + + #print "collect_one_test_case\n"; + #print " suitedir: $suitedir\n"; + #print " testdir: $testdir\n"; + #print " resdir: $resdir\n"; + #print " suitename: $suitename\n"; + #print " tname: $tname\n"; + #print " filename: $filename\n"; + + # ---------------------------------------------------------------------- + # Check --start-from + # ---------------------------------------------------------------------- + if ( $start_from && 0) + { + # start_from can be specified as [suite.].testname_prefix + my ($suite, $test, $ext)= split_testname($start_from); + + if ( $suite and $suitename lt $suite){ + return; # Skip silently + } + if ((!$suite || $suitename == $suite) && $tname lt $test ){ + return; # Skip silently + } + } + + # ---------------------------------------------------------------------- + # Set defaults + # ---------------------------------------------------------------------- + my $tinfo= My::Test->new + ( + name => "$suitename.$tname", + shortname => $tname, + path => "$testdir/$filename", + + ); + + my $result_file= "$resdir/$tname.result"; + if (-f $result_file) { + # Allow nonexistsing result file + # in that case .test must issue "exit" otherwise test + # should fail by default + $tinfo->{result_file}= $result_file; + } + else { + # No .result file exist + # Remember the path where it should be + # saved in case of --record + $tinfo->{record_file}= $result_file; + } + + # ---------------------------------------------------------------------- + # Skip some tests but include in list, just mark them as skipped + # ---------------------------------------------------------------------- + my $name= basename($suitename) . ".$tname"; + if ( $skip_test_reg and ($tname =~ /$skip_test_reg/o || + $name =~ /$skip_test/o)) + { + $tinfo->{'skip'}= 1; + return $tinfo; + } + + # ---------------------------------------------------------------------- + # Check for disabled tests + # ---------------------------------------------------------------------- + my $marked_as_disabled= 0; + if ( $disabled->{$tname} ) + { + # Test was marked as disabled in suites disabled.def file + $marked_as_disabled= 1; + $tinfo->{'comment'}= $disabled->{$tname}; + } + + my $disabled_file= "$testdir/$tname.disabled"; + if ( -f $disabled_file ) + { + $marked_as_disabled= 1; + $tinfo->{'comment'}= mtr_fromfile($disabled_file); + } + + if ( $marked_as_disabled ) + { + if ( $enable_disabled ) + { + # User has selected to run all disabled tests + mtr_report(" - $tinfo->{name} wil be run although it's been disabled\n", + " due to '$tinfo->{comment}'"); + } + else + { + $tinfo->{'skip'}= 1; + $tinfo->{'disable'}= 1; # Sub type of 'skip' + return $tinfo; + } + } + + # ---------------------------------------------------------------------- + # Append suite extra options to both master and slave + # ---------------------------------------------------------------------- + push(@{$tinfo->{'master_opt'}}, @$suite_opts); + push(@{$tinfo->{'slave_opt'}}, @$suite_opts); + + #----------------------------------------------------------------------- + # Check for test specific config file + #----------------------------------------------------------------------- + my $test_cnf_file= "$testdir/$tname.cnf"; + if ( -f $test_cnf_file) { + # Specifies the configuration file to use for this test + $tinfo->{'template_path'}= $test_cnf_file; + } + + # ---------------------------------------------------------------------- + # Check for test specific config file + # ---------------------------------------------------------------------- + my $test_cnf_file= "$testdir/$tname.cnf"; + if ( -f $test_cnf_file ) { + # Specifies the configuration file to use for this test + $tinfo->{'template_path'}= $test_cnf_file; + } + + # ---------------------------------------------------------------------- + # master sh + # ---------------------------------------------------------------------- + my $master_sh= "$testdir/$tname-master.sh"; + if ( -f $master_sh ) + { + if ( IS_WIN32PERL ) + { + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= "No tests with sh scripts on Windows"; + return $tinfo; + } + else + { + $tinfo->{'master_sh'}= $master_sh; + } + } + + # ---------------------------------------------------------------------- + # slave sh + # ---------------------------------------------------------------------- + my $slave_sh= "$testdir/$tname-slave.sh"; + if ( -f $slave_sh ) + { + if ( IS_WIN32PERL ) + { + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= "No tests with sh scripts on Windows"; + return $tinfo; + } + else + { + $tinfo->{'slave_sh'}= $slave_sh; + } + } + + # ---------------------------------------------------------------------- + # <tname>.slave-mi + # ---------------------------------------------------------------------- + mtr_error("$tname: slave-mi not supported anymore") + if ( -f "$testdir/$tname.slave-mi"); + + + tags_from_test_file($tinfo,"$testdir/${tname}.test"); + + if ( defined $default_storage_engine ) + { + # Different default engine is used + # tag test to require that engine + $tinfo->{'ndb_test'}= 1 + if ( $default_storage_engine =~ /^ndb/i ); + + $tinfo->{'innodb_test'}= 1 + if ( $default_storage_engine =~ /^innodb/i ); + + } + + if ( $tinfo->{'big_test'} and ! $::opt_big_test ) + { + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= "Test need 'big-test' option"; + return $tinfo + } + + if ( $tinfo->{'need_debug'} && ! $::debug_compiled_binaries ) + { + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= "Test need debug binaries"; + return $tinfo + } + + if ( $tinfo->{'ndb_test'} ) + { + # This is a NDB test + if ( $::opt_skip_ndbcluster == 2 ) + { + # Ndb is not supported, skip it + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= "No ndbcluster support"; + return $tinfo; + } + elsif ( $::opt_skip_ndbcluster ) + { + # All ndb test's should be skipped + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= "No ndbcluster tests(--skip-ndbcluster)"; + return $tinfo; + } + } + else + { + # This is not a ndb test + if ( $opt_with_ndbcluster_only ) + { + # Only the ndb test should be run, all other should be skipped + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= "Only ndbcluster tests"; + return $tinfo; + } + } + + if ($tinfo->{'federated_test'}) + { + # This is a test that need federated, enable it + push(@{$tinfo->{'master_opt'}}, "--loose-federated"); + push(@{$tinfo->{'slave_opt'}}, "--loose-federated"); + } + + if ( $tinfo->{'innodb_test'} ) + { + # This is a test that need innodb + if ( $::mysqld_variables{'innodb'} ne "TRUE" ) + { + # innodb is not supported, skip it + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= "No innodb support"; + return $tinfo; + } + } + else + { + push(@{$tinfo->{'master_opt'}}, "--loose-skip-innodb"); + push(@{$tinfo->{'slave_opt'}}, "--loose-skip-innodb"); + } + + if ( $tinfo->{'need_binlog'} ) + { + if (grep(/^--skip-log-bin/, @::opt_extra_mysqld_opt) ) + { + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= "Test need binlog"; + return $tinfo; + } + } + else + { + # Test does not need binlog, add --skip-binlog to + # the options used when starting + push(@{$tinfo->{'master_opt'}}, "--loose-skip-log-bin"); + push(@{$tinfo->{'slave_opt'}}, "--loose-skip-log-bin"); + } + + if ( $tinfo->{'rpl_test'} ) + { + if ( $skip_rpl ) + { + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= "No replication tests(--skip-rpl)"; + return $tinfo; + } + } + + if ( $::opt_embedded_server ) + { + if ( $tinfo->{'not_embedded'} ) + { + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= "Not run for embedded server"; + return $tinfo; + } + } + + # ---------------------------------------------------------------------- + # Find config file to use if not already selected in <testname>.opt file + # ---------------------------------------------------------------------- + if (defined $defaults_file) { + # Using same config file for all tests + $tinfo->{template_path}= $defaults_file; + } + elsif (! $tinfo->{template_path} ) + { + my $config= "$suitedir/my.cnf"; + if (! -f $config ) + { + # assume default.cnf will be used + $config= "include/default_my.cnf"; + + # Suite has no config, autodetect which one to use + if ( $tinfo->{rpl_test} ){ + $config= "suite/rpl/my.cnf"; + if ( $tinfo->{ndb_test} ){ + $config= "suite/rpl_ndb/my.cnf"; + } + } + elsif ( $tinfo->{ndb_test} ){ + $config= "suite/ndb/my.cnf"; + } + } + $tinfo->{template_path}= $config; + } + + # Set extra config file to use + if (defined $defaults_extra_file) { + $tinfo->{extra_template_path}= $defaults_extra_file; + } + + # ---------------------------------------------------------------------- + # Append mysqld extra options to both master and slave + # ---------------------------------------------------------------------- + push(@{$tinfo->{'master_opt'}}, @::opt_extra_mysqld_opt); + push(@{$tinfo->{'slave_opt'}}, @::opt_extra_mysqld_opt); + + # ---------------------------------------------------------------------- + # Add master opts, extra options only for master + # ---------------------------------------------------------------------- + process_opts_file($tinfo, "$testdir/$tname-master.opt", 'master_opt'); + + # ---------------------------------------------------------------------- + # Add slave opts, list of extra option only for slave + # ---------------------------------------------------------------------- + process_opts_file($tinfo, "$testdir/$tname-slave.opt", 'slave_opt'); + + return $tinfo; +} + + +# List of tags in the .test files that if found should set +# the specified value in "tinfo" +my @tags= +( + ["include/have_binlog_format_row.inc", "binlog_formats", ["row"]], + ["include/have_binlog_format_statement.inc", "binlog_formats", ["statement"]], + ["include/have_binlog_format_mixed.inc", "binlog_formats", ["mixed"]], + ["include/have_binlog_format_mixed_or_row.inc", + "binlog_formats", ["mixed", "row"]], + ["include/have_binlog_format_mixed_or_statement.inc", + "binlog_formats", ["mixed", "statement"]], + ["include/have_binlog_format_row_or_statement.inc", + "binlog_formats", ["row", "statement"]], + + ["include/have_log_bin.inc", "need_binlog", 1], + + ["include/have_innodb.inc", "innodb_test", 1], + ["include/big_test.inc", "big_test", 1], + ["include/have_debug.inc", "need_debug", 1], + ["include/have_ndb.inc", "ndb_test", 1], + ["include/have_multi_ndb.inc", "ndb_test", 1], + ["include/master-slave.inc", "rpl_test", 1], + ["include/ndb_master-slave.inc", "rpl_test", 1], + ["include/ndb_master-slave.inc", "ndb_test", 1], + ["federated.inc", "federated_test", 1], + ["include/not_embedded.inc", "not_embedded", 1], +); + + +sub tags_from_test_file { + my $tinfo= shift; + my $file= shift; + #mtr_verbose("$file"); + my $F= IO::File->new($file) or mtr_error("can't open file \"$file\": $!"); + + while ( my $line= <$F> ) + { + + # Skip line if it start's with # + next if ( $line =~ /^#/ ); + + # Match this line against tag in "tags" array + foreach my $tag (@tags) + { + if ( index($line, $tag->[0]) >= 0 ) + { + # Tag matched, assign value to "tinfo" + $tinfo->{"$tag->[1]"}= $tag->[2]; + } + } + + # If test sources another file, open it as well + if ( $line =~ /^\-\-([[:space:]]*)source(.*)$/ or + $line =~ /^([[:space:]]*)source(.*);$/ ) + { + my $value= $2; + $value =~ s/^\s+//; # Remove leading space + $value =~ s/[[:space:]]+$//; # Remove ending space + + # Sourced file may exist relative to test or + # in global location + foreach my $sourced_file (dirname($file). "/$value", + "$::glob_mysql_test_dir/$value") + { + if ( -f $sourced_file ) + { + # Only source the file if it exists, we may get + # false positives in the regexes above if someone + # writes "source nnnn;" in a test case(such as mysqltest.test) + tags_from_test_file($tinfo, $sourced_file); + last; + } + } + } + + } +} + +sub unspace { + my $string= shift; + my $quote= shift; + $string =~ s/[ \t]/\x11/g; + return "$quote$string$quote"; +} + + +sub opts_from_file ($) { + my $file= shift; + + open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!"); + my @args; + while ( <FILE> ) + { + chomp; + + # --set-variable=init_connect=set @a='a\\0c' + s/^\s+//; # Remove leading space + s/\s+$//; # Remove ending space + + # This is strange, but we need to fill whitespace inside + # quotes with something, to remove later. We do this to + # be able to split on space. Else, we have trouble with + # options like + # + # --someopt="--insideopt1 --insideopt2" + # + # But still with this, we are not 100% sure it is right, + # we need a shell to do it right. + + s/\'([^\'\"]*)\'/unspace($1,"\x0a")/ge; + s/\"([^\'\"]*)\"/unspace($1,"\x0b")/ge; + s/\'([^\'\"]*)\'/unspace($1,"\x0a")/ge; + s/\"([^\'\"]*)\"/unspace($1,"\x0b")/ge; + + foreach my $arg (split(/[ \t]+/)) + { + $arg =~ tr/\x11\x0a\x0b/ \'\"/; # Put back real chars + # The outermost quotes has to go + $arg =~ s/^([^\'\"]*)\'(.*)\'([^\'\"]*)$/$1$2$3/ + or $arg =~ s/^([^\'\"]*)\"(.*)\"([^\'\"]*)$/$1$2$3/; + $arg =~ s/\\\\/\\/g; + + # Do not pass empty string since my_getopt is not capable to handle it. + if (length($arg)) { + push(@args, $arg); + } + } + } + close FILE; + return \@args; +} + +sub print_testcases { + my (@cases)= @_; + + print "=" x 60, "\n"; + foreach my $test (@cases){ + $test->print_test(); + } + print "=" x 60, "\n"; +} + + +1; diff --git a/mysql-test/lib/mtr_diff.pl b/mysql-test/lib/mtr_diff.pl deleted file mode 100644 index 26e556de5e8..00000000000 --- a/mysql-test/lib/mtr_diff.pl +++ /dev/null @@ -1,297 +0,0 @@ -# -*- cperl -*- -# Copyright (C) 2005 MySQL AB -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -# This is a library file used by the Perl version of mysql-test-run, -# and is part of the translation of the Bourne shell script with the -# same name. - -#use Data::Dumper; -use strict; - -# $Data::Dumper::Indent= 1; - -sub mtr_diff($$); - -############################################################################## -# -# This is a simplified unified diff, with some special handling -# of unsorted result sets -# -############################################################################## - -# FIXME replace die with mtr_error - -#require "mtr_report.pl"; -#mtr_diff("a.txt","b.txt"); - -sub mtr_diff ($$) { - my $file1 = shift; - my $file2 = shift; - - # ---------------------------------------------------------------------- - # We read in all of the files at once - # ---------------------------------------------------------------------- - - unless ( open(FILE1, $file1) ) - { - mtr_warning("can't open \"$file1\": $!"); - return; - } - - unless ( open(FILE2, $file2) ) - { - mtr_warning("can't open \"$file2\": $!"); - return; - } - - my $lines1= collect_lines(<FILE1>); - my $lines2= collect_lines(<FILE2>); - close FILE1; - close FILE2; - -# print Dumper($lines1); -# print Dumper($lines2); - - # ---------------------------------------------------------------------- - # We compare line by line, but don't shift off elements until we know - # what to do. This way we use the "restart" method, do simple change - # and restart by entering the diff loop from the beginning again. - # ---------------------------------------------------------------------- - - my @context; - my @info; # Collect information, and output later - my $lno1= 1; - my $lno2= 1; - - while ( @$lines1 or @$lines2 ) - { - unless ( @$lines1 ) - { - push(@info, map {['+',$lno1,$lno2++,$_]} @$lines2); - last; - } - unless ( @$lines2 ) - { - push(@info, map {['-',$lno1++,$lno2,$_]} @$lines1); - last; - } - - # ---------------------------------------------------------------------- - # We know both have lines - # ---------------------------------------------------------------------- - - if ( $lines1->[0] eq $lines2->[0] ) - { - # Simple case, first line match and all is well - push(@info, ['',$lno1++,$lno2++,$lines1->[0]]); - shift @$lines1; - shift @$lines2; - next; - } - - # ---------------------------------------------------------------------- - # Now, we know they differ - # ---------------------------------------------------------------------- - - # How far in the other one, is there a match? - - my $idx2= find_next_match($lines1->[0], $lines2); - my $idx1= find_next_match($lines2->[0], $lines1); - - # Here we could test "if ( !defined $idx2 or !defined $idx1 )" and - # use a more complicated diff algorithm in the case both contains - # each others lines, just dislocated. But for this application, there - # should be no need. - - if ( !defined $idx2 ) - { - push(@info, ['-',$lno1++,$lno2,$lines1->[0]]); - shift @$lines1; - } - else - { - push(@info, ['+',$lno1,$lno2++,$lines2->[0]]); - shift @$lines2; - } - } - - # ---------------------------------------------------------------------- - # Try to output nicely - # ---------------------------------------------------------------------- - -# print Dumper(\@info); - - # We divide into "chunks" to output - # We want at least three lines of context - - my @chunks; - my @chunk; - my $state= 'pre'; # 'pre', 'in' and 'post' difference - my $post_count= 0; - - foreach my $info ( @info ) - { - if ( $info->[0] eq '' and $state eq 'pre' ) - { - # Collect no more than three lines of context before diff - push(@chunk, $info); - shift(@chunk) if @chunk > 3; - next; - } - - if ( $info->[0] =~ /(\+|\-)/ and $state =~ /(pre|in)/ ) - { - # Start/continue collecting diff - $state= 'in'; - push(@chunk, $info); - next; - } - - if ( $info->[0] eq '' and $state eq 'in' ) - { - # Stop collecting diff, and collect context after diff - $state= 'post'; - $post_count= 1; - push(@chunk, $info); - next; - } - - if ( $info->[0] eq '' and $state eq 'post' and $post_count < 6 ) - { - # We might find a new diff sequence soon, continue to collect - # non diffs but five up on 6. - $post_count++; - push(@chunk, $info); - next; - } - - if ( $info->[0] eq '' and $state eq 'post' ) - { - # We put an end to this, giving three non diff lines to - # the old chunk, and three to the new one. - my @left= splice(@chunk, -3, 3); - push(@chunks, [@chunk]); - $state= 'pre'; - $post_count= 0; - @chunk= @left; - next; - } - - if ( $info->[0] =~ /(\+|\-)/ and $state eq 'post' ) - { - # We didn't split, continue collect diff - $state= 'in'; - push(@chunk, $info); - next; - } - - } - - if ( $post_count > 3 ) - { - $post_count -= 3; - splice(@chunk, -$post_count, $post_count); - } - push(@chunks, [@chunk]) if @chunk and $state ne 'pre'; - - foreach my $chunk ( @chunks ) - { - my $from_file_start= $chunk->[0]->[1]; - my $to_file_start= $chunk->[0]->[2]; - my $from_file_offset= $chunk->[$#$chunk]->[1] - $from_file_start; - my $to_file_offset= $chunk->[$#$chunk]->[2] - $to_file_start; - print "\@\@ -$from_file_start,$from_file_offset ", - "+$to_file_start,$to_file_offset \@\@\n"; - - foreach my $info ( @$chunk ) - { - if ( $info->[0] eq '' ) - { - print " $info->[3]\n"; - } - elsif ( $info->[0] eq '-' ) - { - print "- $info->[3]\n"; - } - elsif ( $info->[0] eq '+' ) - { - print "+ $info->[3]\n"; - } - } - } - -# print Dumper(\@chunks); - -} - - -############################################################################## -# Find if the string is found in the array, return the index if found, -# if not found, return "undef" -############################################################################## - -sub find_next_match { - my $line= shift; - my $lines= shift; - - for ( my $idx= 0; $idx < @$lines; $idx++ ) - { - return $idx if $lines->[$idx] eq $line; - } - - return undef; # No match found -} - - -############################################################################## -# Just read the lines, but handle "sets" of lines that are unordered -############################################################################## - -sub collect_lines { - - my @recordset; - my @lines; - - while (@_) - { - my $line= shift @_; - chomp($line); - - if ( $line =~ /^\Q%unordered%\E\t/ ) - { - push(@recordset, $line); - } - elsif ( @recordset ) - { - push(@lines, sort @recordset); - @recordset= (); # Clear it - } - else - { - push(@lines, $line); - } - } - - if ( @recordset ) - { - push(@lines, sort @recordset); - @recordset= (); # Clear it - } - - return \@lines; -} - -1; diff --git a/mysql-test/lib/mtr_gcov.pl b/mysql-test/lib/mtr_gcov.pl index a2de1fcbdff..5049fdd6063 100644 --- a/mysql-test/lib/mtr_gcov.pl +++ b/mysql-test/lib/mtr_gcov.pl @@ -20,25 +20,14 @@ use strict; -# These are not to be prefixed with "mtr_" +sub gcov_prepare ($) { + my ($dir)= @_; -sub gcov_prepare (); -sub gcov_collect (); - -############################################################################## -# -# -# -############################################################################## - -sub gcov_prepare () { - - `find $::glob_basedir -name \*.gcov \ + `find $dir -name \*.gcov \ -or -name \*.da | xargs rm`; } -# Used by gcov -our @mysqld_src_dirs= +my @mysqld_src_dirs= ( "strings", "mysys", @@ -53,21 +42,24 @@ our @mysqld_src_dirs= "sql", ); -sub gcov_collect () { +sub gcov_collect ($$$) { + my ($dir, $gcov, $gcov_msg, $gcov_err)= @_; + + my $start_dir= cwd(); print "Collecting source coverage info...\n"; - -f $::opt_gcov_msg and unlink($::opt_gcov_msg); - -f $::opt_gcov_err and unlink($::opt_gcov_err); + -f $gcov_msg and unlink($gcov_msg); + -f $gcov_err and unlink($gcov_err); foreach my $d ( @mysqld_src_dirs ) { - chdir("$::glob_basedir/$d"); + chdir("$dir/$d"); foreach my $f ( (glob("*.h"), glob("*.cc"), glob("*.c")) ) { - `$::opt_gcov $f 2>>$::opt_gcov_err >>$::opt_gcov_msg`; + `$gcov $f 2>>$gcov_err >>$gcov_msg`; } - chdir($::glob_mysql_test_dir); + chdir($start_dir); } - print "gcov info in $::opt_gcov_msg, errors in $::opt_gcov_err\n"; + print "gcov info in $gcov_msg, errors in $gcov_err\n"; } diff --git a/mysql-test/lib/mtr_io.pl b/mysql-test/lib/mtr_io.pl index aa671c0f4f7..21581798ddc 100644 --- a/mysql-test/lib/mtr_io.pl +++ b/mysql-test/lib/mtr_io.pl @@ -19,135 +19,15 @@ # same name. use strict; +use Carp; -sub mtr_get_pid_from_file ($); -sub mtr_get_opts_from_file ($); sub mtr_fromfile ($); sub mtr_tofile ($@); sub mtr_tonewfile($@); -sub mtr_lastlinefromfile($); sub mtr_appendfile_to_file ($$); sub mtr_grab_file($); - - -############################################################################## -# -# -# -############################################################################## - -sub mtr_get_pid_from_file ($) { - my $pid_file_path= shift; - my $TOTAL_ATTEMPTS= 30; - my $timeout= 1; - - # We should read from the file until we get correct pid. As it is - # stated in BUG#21884, pid file can be empty at some moment. So, we should - # read it until we get valid data. - - for (my $cur_attempt= 1; $cur_attempt <= $TOTAL_ATTEMPTS; ++$cur_attempt) - { - mtr_debug("Reading pid file '$pid_file_path' " . - "($cur_attempt of $TOTAL_ATTEMPTS)..."); - - open(FILE, '<', $pid_file_path) - or mtr_error("can't open file \"$pid_file_path\": $!"); - - # Read pid number from file - my $pid= <FILE>; - chomp $pid; - close FILE; - - return $pid if $pid=~ /^(\d+)/; - - mtr_debug("Pid file '$pid_file_path' does not yet contain pid number.\n" . - "Sleeping $timeout second(s) more..."); - - sleep($timeout); - } - - mtr_error("Pid file '$pid_file_path' is corrupted. " . - "Can not retrieve PID in " . - ($timeout * $TOTAL_ATTEMPTS) . " seconds."); -} - -sub mtr_get_opts_from_file ($) { - my $file= shift; - - open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!"); - my @args; - while ( <FILE> ) - { - chomp; - - # --set-variable=init_connect=set @a='a\\0c' - s/^\s+//; # Remove leading space - s/\s+$//; # Remove ending space - - # This is strange, but we need to fill whitespace inside - # quotes with something, to remove later. We do this to - # be able to split on space. Else, we have trouble with - # options like - # - # --someopt="--insideopt1 --insideopt2" - # - # But still with this, we are not 100% sure it is right, - # we need a shell to do it right. - -# print STDERR "\n"; -# print STDERR "AAA: $_\n"; - - s/\'([^\'\"]*)\'/unspace($1,"\x0a")/ge; - s/\"([^\'\"]*)\"/unspace($1,"\x0b")/ge; - s/\'([^\'\"]*)\'/unspace($1,"\x0a")/ge; - s/\"([^\'\"]*)\"/unspace($1,"\x0b")/ge; - -# print STDERR "BBB: $_\n"; - -# foreach my $arg (/(--?\w.*?)(?=\s+--?\w|$)/) - - # FIXME ENV vars should be expanded!!!! - - foreach my $arg (split(/[ \t]+/)) - { - $arg =~ tr/\x11\x0a\x0b/ \'\"/; # Put back real chars - # The outermost quotes has to go - $arg =~ s/^([^\'\"]*)\'(.*)\'([^\'\"]*)$/$1$2$3/ - or $arg =~ s/^([^\'\"]*)\"(.*)\"([^\'\"]*)$/$1$2$3/; - $arg =~ s/\\\\/\\/g; - - $arg =~ s/\$\{(\w+)\}/envsubst($1)/ge; - $arg =~ s/\$(\w+)/envsubst($1)/ge; - -# print STDERR "ARG: $arg\n"; - # Do not pass empty string since my_getopt is not capable to handle it. - if (length($arg)) - { - push(@args, $arg) - } - } - } - close FILE; - return \@args; -} - -sub envsubst { - my $string= shift; - - if ( ! defined $ENV{$string} ) - { - mtr_error("opt file referense \$$string that is unknown"); - } - - return $ENV{$string}; -} - -sub unspace { - my $string= shift; - my $quote= shift; - $string =~ s/[ \t]/\x11/g; - return "$quote$string$quote"; -} +sub mtr_printfile($); +sub mtr_lastlinesfromfile ($$); # Read a whole file, stripping leading and trailing whitespace. sub mtr_fromfile ($) { @@ -161,19 +41,6 @@ sub mtr_fromfile ($) { return $text; } -sub mtr_lastlinefromfile ($) { - my $file= shift; - my $text; - - open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!"); - while (my $line= <FILE>) - { - $text= $line; - } - close FILE; - return $text; -} - sub mtr_tofile ($@) { my $file= shift; @@ -183,6 +50,7 @@ sub mtr_tofile ($@) { close FILE; } + sub mtr_tonewfile ($@) { my $file= shift; @@ -191,6 +59,7 @@ sub mtr_tonewfile ($@) { close FILE; } + sub mtr_appendfile_to_file ($$) { my $from_file= shift; my $to_file= shift; @@ -203,6 +72,7 @@ sub mtr_appendfile_to_file ($$) { close TOFILE; } + # Read a whole file verbatim. sub mtr_grab_file($) { my $file= shift; @@ -215,4 +85,26 @@ sub mtr_grab_file($) { } +# Print the file to STDOUT +sub mtr_printfile($) { + my $file= shift; + open(FILE, '<', $file) + or warn $!; + print while(<FILE>); + close FILE; + return; +} + +sub mtr_lastlinesfromfile ($$) { + croak "usage: mtr_lastlinesfromfile(file,numlines)" unless (@_ == 2); + my ($file, $num_lines)= @_; + my $text; + open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!"); + my @lines= reverse <FILE>; + close FILE; + my $size= scalar(@lines); + $num_lines= $size unless ($size >= $num_lines); + return join("", reverse(splice(@lines, 0, $num_lines))); +} + 1; diff --git a/mysql-test/lib/mtr_match.pm b/mysql-test/lib/mtr_match.pm new file mode 100644 index 00000000000..40afd4e0336 --- /dev/null +++ b/mysql-test/lib/mtr_match.pm @@ -0,0 +1,97 @@ +# -*- cperl -*- +# Copyright (C) 2004-2006 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +# This is a library file used by the Perl version of mysql-test-run, +# and is part of the translation of the Bourne shell script with the +# same name. + +package mtr_match; +use strict; + +use base qw(Exporter); +our @EXPORT= qw(mtr_match_prefix + mtr_match_extension + mtr_match_substring); + +# +# Match a prefix and return what is after the prefix +# +sub mtr_match_prefix ($$) { + my $string= shift; + my $prefix= shift; + + if ( $string =~ /^\Q$prefix\E(.*)$/ ) # strncmp + { + return $1; + } + else + { + return undef; # NULL + } +} + + +# +# Match extension and return the name without extension +# +sub mtr_match_extension ($$) { + my $file= shift; + my $ext= shift; + + if ( $file =~ /^(.*)\.\Q$ext\E$/ ) # strchr+strcmp or something + { + return $1; + } + else + { + return undef; # NULL + } +} + + +# +# Match a substring anywere in a string +# +sub mtr_match_substring ($$) { + my $string= shift; + my $substring= shift; + + if ( $string =~ /(.*)\Q$substring\E(.*)$/ ) # strncmp + { + return $1; + } + else + { + return undef; # NULL + } +} + + +sub mtr_match_any_exact ($$) { + my $string= shift; + my $mlist= shift; + + foreach my $m (@$mlist) + { + if ( $string eq $m ) + { + return 1; + } + } + return 0; +} + +1; diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl index 0173e8b8572..658eb270535 100644 --- a/mysql-test/lib/mtr_misc.pl +++ b/mysql-test/lib/mtr_misc.pl @@ -19,45 +19,25 @@ # same name. use strict; -use File::Find; -sub mtr_native_path($); +use My::Platform; + sub mtr_init_args ($); sub mtr_add_arg ($$@); +sub mtr_args2str($@); sub mtr_path_exists(@); sub mtr_script_exists(@); sub mtr_file_exists(@); sub mtr_exe_exists(@); sub mtr_exe_maybe_exists(@); -sub mtr_copy_dir($$); -sub mtr_rmtree($); -sub mtr_same_opts($$); -sub mtr_cmp_opts($$); + ############################################################################## # -# Misc +# Args # ############################################################################## -# Convert path to OS native format -sub mtr_native_path($) -{ - my $path= shift; - - # MySQL version before 5.0 still use cygwin, no need - # to convert path - return $path - if ($::mysql_version_id < 50000); - - $path=~ s/\//\\/g - if ($::glob_win32); - return $path; -} - - -# FIXME move to own lib - sub mtr_init_args ($) { my $args = shift; $$args = []; # Empty list @@ -68,9 +48,18 @@ sub mtr_add_arg ($$@) { my $format= shift; my @fargs = @_; + # Quote args if args contain space + $format= "\"$format\"" + if (IS_WINDOWS and grep(/\s/, @fargs)); + push(@$args, sprintf($format, @fargs)); } +sub mtr_args2str($@) { + my $exe= shift or die; + return join(" ", native_path($exe), @_); +} + ############################################################################## # @@ -100,7 +89,7 @@ sub mtr_path_exists (@) { sub mtr_script_exists (@) { foreach my $path ( @_ ) { - if($::glob_win32) + if(IS_WINDOWS) { return $path if -f $path; } @@ -140,11 +129,10 @@ sub mtr_file_exists (@) { sub mtr_exe_maybe_exists (@) { my @path= @_; - map {$_.= ".exe"} @path if $::glob_win32; - map {$_.= ".nlm"} @path if $::glob_netware; + map {$_.= ".exe"} @path if IS_WINDOWS; foreach my $path ( @path ) { - if($::glob_win32) + if(IS_WINDOWS) { return $path if -f $path; } @@ -179,134 +167,11 @@ sub mtr_exe_exists (@) { } -sub mtr_copy_dir($$) { - my $from_dir= shift; - my $to_dir= shift; - - # mtr_verbose("Copying from $from_dir to $to_dir"); - - mkpath("$to_dir"); - opendir(DIR, "$from_dir") - or mtr_error("Can't find $from_dir$!"); - for(readdir(DIR)) { - next if "$_" eq "." or "$_" eq ".."; - if ( -d "$from_dir/$_" ) - { - mtr_copy_dir("$from_dir/$_", "$to_dir/$_"); - next; - } - copy("$from_dir/$_", "$to_dir/$_"); - } - closedir(DIR); - -} - - -sub mtr_rmtree($) { - my ($dir)= @_; - mtr_verbose("mtr_rmtree: $dir"); - - # Try to use File::Path::rmtree. Recent versions - # handles removal of directories and files that don't - # have full permissions, while older versions - # may have a problem with that and we use our own version - - eval { rmtree($dir); }; - if ( $@ ) { - mtr_warning("rmtree($dir) failed, trying with File::Find..."); - - my $errors= 0; - - # chmod - find( { - no_chdir => 1, - wanted => sub { - chmod(0777, $_) - or mtr_warning("couldn't chmod(0777, $_): $!") and $errors++; - } - }, - $dir - ); - - # rm - finddepth( { - no_chdir => 1, - wanted => sub { - my $file= $_; - # Use special underscore (_) filehandle, caches stat info - if (!-l $file and -d _ ) { - rmdir($file) or - mtr_warning("couldn't rmdir($file): $!") and $errors++; - } else { - unlink($file) - or mtr_warning("couldn't unlink($file): $!") and $errors++; - } - } - }, - $dir - ); +sub mtr_milli_sleep { + die "usage: mtr_milli_sleep(milliseconds)" unless @_ == 1; + my ($millis)= @_; - mtr_error("Failed to remove '$dir'") if $errors; - - mtr_report("OK, that worked!"); - } -} - - -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 -} - -# -# Compare two arrays and put all unequal elements into a new one -# -sub mtr_diff_opts ($$) { - my $l1= shift; - my $l2= shift; - my $f; - my $l= []; - foreach my $e1 (@$l1) - { - $f= undef; - foreach my $e2 (@$l2) - { - $f= 1 unless ($e1 ne $e2); - } - push(@$l, $e1) unless (defined $f); - } - foreach my $e2 (@$l2) - { - $f= undef; - foreach my $e1 (@$l1) - { - $f= 1 unless ($e1 ne $e2); - } - push(@$l, $e2) unless (defined $f); - } - return $l; + select(undef, undef, undef, ($millis/1000)); } 1; diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index 566ccfe0778..a99119a199d 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -18,997 +18,13 @@ # and is part of the translation of the Bourne shell script with the # same name. +use strict; use Socket; use Errno; -use strict; - -use POSIX qw(WNOHANG SIGHUP); -sub mtr_run ($$$$$$;$); -sub mtr_spawn ($$$$$$;$); -sub mtr_check_stop_servers ($); -sub mtr_kill_leftovers (); -sub mtr_wait_blocking ($); -sub mtr_record_dead_children (); -sub mtr_ndbmgm_start($$); -sub mtr_mysqladmin_start($$$); -sub mtr_exit ($); sub sleep_until_file_created ($$$); -sub mtr_kill_processes ($); -sub mtr_ping_with_timeout($); sub mtr_ping_port ($); -# Local function -sub spawn_impl ($$$$$$$); - -############################################################################## -# -# Execute an external command -# -############################################################################## - -sub mtr_run ($$$$$$;$) { - my $path= shift; - my $arg_list_t= shift; - my $input= shift; - my $output= shift; - my $error= shift; - my $pid_file= shift; # Not used - my $spawn_opts= shift; - - return spawn_impl($path,$arg_list_t,'run',$input,$output,$error, - $spawn_opts); -} - -sub mtr_run_test ($$$$$$;$) { - my $path= shift; - my $arg_list_t= shift; - my $input= shift; - my $output= shift; - my $error= shift; - my $pid_file= shift; # Not used - my $spawn_opts= shift; - - return spawn_impl($path,$arg_list_t,'test',$input,$output,$error, - $spawn_opts); -} - -sub mtr_spawn ($$$$$$;$) { - my $path= shift; - my $arg_list_t= shift; - my $input= shift; - my $output= shift; - my $error= shift; - my $pid_file= shift; # Not used - my $spawn_opts= shift; - - return spawn_impl($path,$arg_list_t,'spawn',$input,$output,$error, - $spawn_opts); -} - - - -sub spawn_impl ($$$$$$$) { - my $path= shift; - my $arg_list_t= shift; - my $mode= shift; - my $input= shift; - my $output= shift; - my $error= shift; - my $spawn_opts= shift; - - if ( $::opt_script_debug ) - { - mtr_report(""); - mtr_debug("-" x 73); - mtr_debug("STDIN $input") if $input; - mtr_debug("STDOUT $output") if $output; - mtr_debug("STDERR $error") if $error; - mtr_debug("$mode: $path ", join(" ",@$arg_list_t)); - mtr_debug("spawn options:"); - if ($spawn_opts) - { - foreach my $key (sort keys %{$spawn_opts}) - { - mtr_debug(" - $key: $spawn_opts->{$key}"); - } - } - else - { - mtr_debug(" none"); - } - mtr_debug("-" x 73); - mtr_report(""); - } - - mtr_error("Can't spawn with empty \"path\"") unless defined $path; - - - FORK: - { - my $pid= fork(); - - if ( ! defined $pid ) - { - if ( $! == $!{EAGAIN} ) # See "perldoc Errno" - { - mtr_warning("Got EAGAIN from fork(), sleep 1 second and redo"); - sleep(1); - redo FORK; - } - - mtr_error("$path ($pid) can't be forked, error: $!"); - - } - - if ( $pid ) - { - select(STDOUT) if $::glob_win32_perl; - return spawn_parent_impl($pid,$mode,$path); - } - else - { - # Child, redirect output and exec - - $SIG{INT}= 'DEFAULT'; # Parent do some stuff, we don't - - my $log_file_open_mode = '>'; - - if ($spawn_opts and $spawn_opts->{'append_log_file'}) - { - $log_file_open_mode = '>>'; - } - - if ( $output ) - { - if ( $::glob_win32_perl ) - { - # Don't redirect stdout on ActiveState perl since this is - # just another thread in the same process. - } - elsif ( ! open(STDOUT,$log_file_open_mode,$output) ) - { - mtr_child_error("can't redirect STDOUT to \"$output\": $!"); - } - } - - if ( $error ) - { - if ( !$::glob_win32_perl and $output eq $error ) - { - if ( ! open(STDERR,">&STDOUT") ) - { - mtr_child_error("can't dup STDOUT: $!"); - } - } - else - { - if ( ! open(STDERR,$log_file_open_mode,$error) ) - { - mtr_child_error("can't redirect STDERR to \"$error\": $!"); - } - } - } - - if ( $input ) - { - if ( ! open(STDIN,"<",$input) ) - { - mtr_child_error("can't redirect STDIN to \"$input\": $!"); - } - } - - if ( ! exec($path,@$arg_list_t) ) - { - mtr_child_error("failed to execute \"$path\": $!"); - } - mtr_error("Should never come here 1!"); - } - mtr_error("Should never come here 2!"); - } - mtr_error("Should never come here 3!"); -} - - -sub spawn_parent_impl { - my $pid= shift; - my $mode= shift; - my $path= shift; - - if ( $mode eq 'run' or $mode eq 'test' ) - { - if ( $mode eq 'run' ) - { - # Simple run of command, wait blocking for it to return - my $ret_pid= waitpid($pid,0); - if ( $ret_pid != $pid ) - { - # The "simple" waitpid has failed, print debug info - # and try to handle the error - mtr_warning("waitpid($pid, 0) returned $ret_pid " . - "when waiting for '$path', error: '$!'"); - if ( $ret_pid == -1 ) - { - # waitpid returned -1, that would indicate the process - # no longer exist and waitpid couldn't wait for it. - return 1; - } - mtr_error("Error handling failed"); - } - - return mtr_process_exit_status($?); - } - else - { - # We run mysqltest and wait for it to return. But we try to - # catch dying mysqld processes as well. - # - # We do blocking waitpid() until we get the return from the - # "mysqltest" call. But if a mysqld process dies that we - # started, we take this as an error, and kill mysqltest. - - - my $exit_value= -1; - my $saved_exit_value; - my $ret_pid; # What waitpid() returns - - while ( ($ret_pid= waitpid(-1,0)) != -1 ) - { - # Someone terminated, don't know who. Collect - # status info first before $? is lost, - # but not $exit_value, this is flagged from - - my $timer_name= mtr_timer_timeout($::glob_timers, $ret_pid); - if ( $timer_name ) - { - if ( $timer_name eq "suite" ) - { - # We give up here - # FIXME we should only give up the suite, not all of the run? - print STDERR "\n"; - mtr_error("Test suite timeout"); - } - elsif ( $timer_name eq "testcase" ) - { - $saved_exit_value= 63; # Mark as timeout - kill(9, $pid); # Kill mysqltest - next; # Go on and catch the termination - } - } - - if ( $ret_pid == $pid ) - { - # We got termination of mysqltest, we are done - $exit_value= mtr_process_exit_status($?); - last; - } - - # One of the child processes died, unless this was expected - # mysqltest should be killed and test aborted - - check_expected_crash_and_restart($ret_pid); - } - - if ( $ret_pid != $pid ) - { - # We terminated the waiting because a "mysqld" process died. - # Kill the mysqltest process. - mtr_verbose("Kill mysqltest because another process died"); - kill(9,$pid); - - $ret_pid= waitpid($pid,0); - - if ( $ret_pid != $pid ) - { - mtr_error("$path ($pid) got lost somehow"); - } - } - - return $saved_exit_value || $exit_value; - } - } - else - { - # We spawned a process we don't wait for - return $pid; - } -} - - -# ---------------------------------------------------------------------- -# We try to emulate how an Unix shell calculates the exit code -# ---------------------------------------------------------------------- - -sub mtr_process_exit_status { - my $raw_status= shift; - - if ( $raw_status & 127 ) - { - return ($raw_status & 127) + 128; # Signal num + 128 - } - else - { - return $raw_status >> 8; # Exit code - } -} - - -############################################################################## -# -# Kill processes left from previous runs -# -############################################################################## - - -# Kill all processes(mysqld, ndbd, ndb_mgmd and im) that would conflict with -# this run -# Make sure to remove the PID file, if any. -# kill IM manager first, else it will restart the servers -sub mtr_kill_leftovers () { - - mtr_report("Killing Possible Leftover Processes"); - mtr_debug("mtr_kill_leftovers(): started."); - - my @kill_pids; - my %admin_pids; - - foreach my $srv (@{$::master}, @{$::slave}) - { - mtr_debug(" - mysqld " . - "(pid: $srv->{pid}; " . - "pid file: '$srv->{path_pid}'; " . - "socket: '$srv->{path_sock}'; ". - "port: $srv->{port})"); - - my $pid= mtr_mysqladmin_start($srv, "shutdown", 20); - - # Save the pid of the mysqladmin process - $admin_pids{$pid}= 1; - - push(@kill_pids,{ - pid => $srv->{'pid'}, - pidfile => $srv->{'path_pid'}, - sockfile => $srv->{'path_sock'}, - port => $srv->{'port'}, - }); - $srv->{'pid'}= 0; # Assume we are done with it - } - - if ( ! $::opt_skip_ndbcluster ) - { - - foreach my $cluster (@{$::clusters}) - { - - # Don't shut down a "running" cluster - next if $cluster->{'use_running'}; - - mtr_debug(" - cluster " . - "(pid: $cluster->{pid}; " . - "pid file: '$cluster->{path_pid})"); - - my $pid= mtr_ndbmgm_start($cluster, "shutdown"); - - # Save the pid of the ndb_mgm process - $admin_pids{$pid}= 1; - - push(@kill_pids,{ - pid => $cluster->{'pid'}, - pidfile => $cluster->{'path_pid'} - }); - - $cluster->{'pid'}= 0; # Assume we are done with it - - foreach my $ndbd (@{$cluster->{'ndbds'}}) - { - mtr_debug(" - ndbd " . - "(pid: $ndbd->{pid}; " . - "pid file: '$ndbd->{path_pid})"); - - push(@kill_pids,{ - pid => $ndbd->{'pid'}, - pidfile => $ndbd->{'path_pid'}, - }); - $ndbd->{'pid'}= 0; # Assume we are done with it - } - } - } - - # Wait for all the admin processes to complete - mtr_wait_blocking(\%admin_pids); - - # If we trusted "mysqladmin --shutdown_timeout= ..." we could just - # terminate now, but we don't (FIXME should be debugged). - # So we try again to ping and at least wait the same amount of time - # mysqladmin would for all to die. - - mtr_ping_with_timeout(\@kill_pids); - - # We now have tried to terminate nice. We have waited for the listen - # port to be free, but can't really tell if the mysqld process died - # or not. We now try to find the process PID from the PID file, and - # send a kill to that process. Note that Perl let kill(0,@pids) be - # a way to just return the numer of processes the kernel can send - # signals to. So this can be used (except on Cygwin) to determine - # if there are processes left running that we cound out might exists. - # - # But still after all this work, all we know is that we have - # the ports free. - - # We scan the "var/run/" directory for other process id's to kill - - my $rundir= "$::opt_vardir/run"; - - mtr_debug("Processing PID files in directory '$rundir'..."); - - if ( -d $rundir ) - { - opendir(RUNDIR, $rundir) - or mtr_error("can't open directory \"$rundir\": $!"); - - my @pids; - - while ( my $elem= readdir(RUNDIR) ) - { - # Only read pid from files that end with .pid - if ( $elem =~ /.*[.]pid$/) - { - my $pidfile= "$rundir/$elem"; - - if ( -f $pidfile ) - { - mtr_debug("Processing PID file: '$pidfile'..."); - - my $pid= mtr_get_pid_from_file($pidfile); - - mtr_debug("Got pid: $pid from file '$pidfile'"); - - if ( $::glob_cygwin_perl or kill(0, $pid) ) - { - mtr_debug("There is process with pid $pid -- scheduling for kill."); - push(@pids, $pid); # We know (cygwin guess) it exists - } - else - { - mtr_debug("There is no process with pid $pid -- skipping."); - } - } - } - } - closedir(RUNDIR); - - if ( @pids ) - { - mtr_debug("Killing the following processes with PID files: " . - join(' ', @pids) . "..."); - - start_reap_all(); - - if ( $::glob_cygwin_perl ) - { - # We have no (easy) way of knowing the Cygwin controlling - # process, in the PID file we only have the Windows process id. - system("kill -f " . join(" ",@pids)); # Hope for the best.... - mtr_debug("Sleep 5 seconds waiting for processes to die"); - sleep(5); - } - else - { - my $retries= 10; # 10 seconds - do - { - mtr_debug("Sending SIGKILL to pids: " . join(' ', @pids)); - kill(9, @pids); - mtr_report("Sleep 1 second waiting for processes to die"); - sleep(1) # Wait one second - } while ( $retries-- and kill(0, @pids) ); - - if ( kill(0, @pids) ) # Check if some left - { - mtr_warning("can't kill process(es) " . join(" ", @pids)); - } - } - - stop_reap_all(); - } - } - else - { - mtr_debug("Directory for PID files ($rundir) does not exist."); - } - - # We may have failed everything, but we now check again if we have - # the listen ports free to use, and if they are free, just go for it. - - mtr_debug("Checking known mysqld servers..."); - - foreach my $srv ( @kill_pids ) - { - if ( defined $srv->{'port'} and mtr_ping_port($srv->{'port'}) ) - { - mtr_warning("can't kill old process holding port $srv->{'port'}"); - } - } - - mtr_debug("mtr_kill_leftovers(): finished."); -} - - -# -# Check that all processes in "spec" are shutdown gracefully -# else kill them off hard -# -sub mtr_check_stop_servers ($) { - my $spec= shift; - - # Return if no processes are defined - return if ! @$spec; - - mtr_verbose("mtr_check_stop_servers"); - - # ---------------------------------------------------------------------- - # Wait until servers in "spec" has stopped listening - # to their ports or timeout occurs - # ---------------------------------------------------------------------- - mtr_ping_with_timeout(\@$spec); - - # ---------------------------------------------------------------------- - # Use waitpid() nonblocking for a little while, to see how - # many process's will exit sucessfully. - # This is the normal case. - # ---------------------------------------------------------------------- - my $wait_counter= 50; # Max number of times to redo the loop - foreach my $srv ( @$spec ) - { - my $pid= $srv->{'pid'}; - my $ret_pid; - if ( $pid ) - { - $ret_pid= waitpid($pid,&WNOHANG); - if ($ret_pid == $pid) - { - mtr_verbose("Caught exit of process $ret_pid"); - $srv->{'pid'}= 0; - } - elsif ($ret_pid == 0) - { - mtr_verbose("Process $pid is still alive"); - if ($wait_counter-- > 0) - { - # Give the processes more time to exit - select(undef, undef, undef, (0.1)); - redo; - } - } - else - { - mtr_warning("caught exit of unknown child $ret_pid"); - } - } - } - - # ---------------------------------------------------------------------- - # The processes that haven't yet exited need to - # be killed hard, put them in "kill_pids" hash - # ---------------------------------------------------------------------- - my %kill_pids; - foreach my $srv ( @$spec ) - { - my $pid= $srv->{'pid'}; - if ( $pid ) - { - # Server is still alive, put it in list to be hard killed - if ($::glob_win32_perl) - { - # Kill the real process if it's known - $pid= $srv->{'real_pid'} if ($srv->{'real_pid'}); - } - $kill_pids{$pid}= 1; - - # Write a message to the process's error log (if it has one) - # that it's being killed hard. - if ( defined $srv->{'errfile'} ) - { - mtr_tofile($srv->{'errfile'}, "Note: Forcing kill of process $pid\n"); - } - mtr_warning("Forcing kill of process $pid"); - - } - else - { - # Server is dead, remove the pidfile if it exists - # - # Race, could have been removed between test with -f - # and the unlink() below, so better check again with -f - if ( -f $srv->{'pidfile'} and ! unlink($srv->{'pidfile'}) and - -f $srv->{'pidfile'} ) - { - mtr_error("can't remove $srv->{'pidfile'}"); - } - } - } - - if ( ! keys %kill_pids ) - { - # All processes has exited gracefully - return; - } - - mtr_kill_processes(\%kill_pids); - - # ---------------------------------------------------------------------- - # All processes are killed, cleanup leftover files - # ---------------------------------------------------------------------- - { - my $errors= 0; - foreach my $srv ( @$spec ) - { - if ( $srv->{'pid'} ) - { - # Server has been hard killed, clean it's resources - foreach my $file ($srv->{'pidfile'}, $srv->{'sockfile'}) - { - # Know it is dead so should be no race, careful anyway - if ( defined $file and -f $file and ! unlink($file) and -f $file ) - { - $errors++; - mtr_warning("couldn't delete $file"); - } - } - - if ($::glob_win32_perl and $srv->{'real_pid'}) - { - # Wait for the pseudo pid - if the real_pid was known - # the pseudo pid has not been waited for yet, wai blocking - # since it's "such a simple program" - mtr_verbose("Wait for pseudo process $srv->{'pid'}"); - my $ret_pid= waitpid($srv->{'pid'}, 0); - mtr_verbose("Pseudo process $ret_pid died"); - } - - $srv->{'pid'}= 0; - } - } - if ( $errors ) - { - # There where errors killing processes - # do one last attempt to ping the servers - # and if they can't be pinged, assume they are dead - if ( ! mtr_ping_with_timeout( \@$spec ) ) - { - mtr_error("we could not kill or clean up all processes"); - } - else - { - mtr_verbose("All ports were free, continuing"); - } - } - } -} - - -# Wait for all the process in the list to terminate -sub mtr_wait_blocking($) { - my $admin_pids= shift; - - - # Return if no processes defined - return if ! %$admin_pids; - - mtr_verbose("mtr_wait_blocking"); - - # Wait for all the started processes to exit - # As mysqladmin is such a simple program, we trust it to terminate itself. - # I.e. we wait blocking, and wait for them all before we go on. - foreach my $pid (keys %{$admin_pids}) - { - my $ret_pid= waitpid($pid,0); - - } -} - -# Start "mysqladmin <command>" for a specific mysqld -sub mtr_mysqladmin_start($$$) { - my $srv= shift; - my $command= shift; - my $adm_shutdown_tmo= shift; - - my $args; - mtr_init_args(\$args); - - mtr_add_arg($args, "--no-defaults"); - mtr_add_arg($args, "--user=%s", $::opt_user); - mtr_add_arg($args, "--password="); - mtr_add_arg($args, "--silent"); - if ( -e $srv->{'path_sock'} ) - { - mtr_add_arg($args, "--socket=%s", $srv->{'path_sock'}); - } - if ( $srv->{'port'} ) - { - mtr_add_arg($args, "--port=%s", $srv->{'port'}); - } - if ( $srv->{'port'} and ! -e $srv->{'path_sock'} ) - { - mtr_add_arg($args, "--protocol=tcp"); # Needed if no --socket - } - mtr_add_arg($args, "--connect_timeout=5"); - - # Shutdown time must be high as slave may be in reconnect - mtr_add_arg($args, "--shutdown_timeout=$adm_shutdown_tmo"); - mtr_add_arg($args, "$command"); - my $pid= mtr_spawn($::exe_mysqladmin, $args, - "", "", "", "", - { append_log_file => 1 }); - mtr_verbose("mtr_mysqladmin_start, pid: $pid"); - return $pid; - -} - -# Start "ndb_mgm shutdown" for a specific cluster, it will -# shutdown all data nodes and leave the ndb_mgmd running -sub mtr_ndbmgm_start($$) { - my $cluster= shift; - my $command= shift; - - my $args; - - mtr_init_args(\$args); - - mtr_add_arg($args, "--no-defaults"); - mtr_add_arg($args, "--core"); - mtr_add_arg($args, "--try-reconnect=1"); - mtr_add_arg($args, "--ndb_connectstring=%s", $cluster->{'connect_string'}); - mtr_add_arg($args, "-e"); - mtr_add_arg($args, "$command"); - - my $pid= mtr_spawn($::exe_ndb_mgm, $args, - "", "/dev/null", "/dev/null", "", - {}); - mtr_verbose("mtr_ndbmgm_start, pid: $pid"); - return $pid; - -} - - -# Ping all servers in list, exit when none of them answers -# or when timeout has passed -sub mtr_ping_with_timeout($) { - my $spec= shift; - my $timeout= 200; # 20 seconds max - my $res= 1; # If we just fall through, we are done - # in the sense that the servers don't - # listen to their ports any longer - - mtr_debug("Waiting for mysqld servers to stop..."); - - TIME: - while ( $timeout-- ) - { - foreach my $srv ( @$spec ) - { - $res= 1; # We are optimistic - if ( $srv->{'pid'} and defined $srv->{'port'} ) - { - if ( mtr_ping_port($srv->{'port'}) ) - { - mtr_verbose("waiting for process $srv->{'pid'} to stop ". - "using port $srv->{'port'}"); - - # Millisceond sleep emulated with select - select(undef, undef, undef, (0.1)); - $res= 0; - next TIME; - } - else - { - # Process was not using port - } - } - } - last; # If we got here, we are done - } - - if ($res) - { - mtr_debug("mtr_ping_with_timeout(): All mysqld instances are down."); - } - else - { - mtr_report("mtr_ping_with_timeout(): At least one server is alive."); - } - - return $res; -} - - -# -# Loop through our list of processes and look for and entry -# with the provided pid -# Set the pid of that process to 0 if found -# -sub mark_process_dead($) -{ - my $ret_pid= shift; - - foreach my $mysqld (@{$::master}, @{$::slave}) - { - if ( $mysqld->{'pid'} eq $ret_pid ) - { - mtr_verbose("$mysqld->{'type'} $mysqld->{'idx'} exited, pid: $ret_pid"); - $mysqld->{'pid'}= 0; - return; - } - } - - foreach my $cluster (@{$::clusters}) - { - if ( $cluster->{'pid'} eq $ret_pid ) - { - mtr_verbose("$cluster->{'name'} cluster ndb_mgmd exited, pid: $ret_pid"); - $cluster->{'pid'}= 0; - return; - } - - foreach my $ndbd (@{$cluster->{'ndbds'}}) - { - if ( $ndbd->{'pid'} eq $ret_pid ) - { - mtr_verbose("$cluster->{'name'} cluster ndbd exited, pid: $ret_pid"); - $ndbd->{'pid'}= 0; - return; - } - } - } - mtr_warning("mark_process_dead couldn't find an entry for pid: $ret_pid"); - -} - -# -# Loop through our list of processes and look for and entry -# with the provided pid, if found check for the file indicating -# expected crash and restart it. -# -sub check_expected_crash_and_restart($) -{ - my $ret_pid= shift; - - foreach my $mysqld (@{$::master}, @{$::slave}) - { - if ( $mysqld->{'pid'} eq $ret_pid ) - { - mtr_verbose("$mysqld->{'type'} $mysqld->{'idx'} exited, pid: $ret_pid"); - $mysqld->{'pid'}= 0; - - # Check if crash expected, and restart if it was - my $expect_file= "$::opt_vardir/tmp/" . "$mysqld->{'type'}" . - "$mysqld->{'idx'}" . ".expect"; - while ( 1 ) - { - if ( -f $expect_file ) - { - mtr_verbose("Crash was expected, file $expect_file exists"); - my $expect_file_handler; - open($expect_file_handler, "<$expect_file") or die; - my @expect_lines= <$expect_file_handler>; - close $expect_file_handler; - # look at most recent order by the test - my $expect_content= pop @expect_lines; - chomp $expect_content; - if ( $expect_content =~ /^wait/ ) - { - mtr_verbose("Test asks that we wait before restart"); - # Millisceond sleep emulated with select - select(undef, undef, undef, (0.1)); - next; - } - unlink($expect_file); - mysqld_start($mysqld, $mysqld->{'start_opts'}, - $mysqld->{'start_slave_master_info'}); - } - last; - } - - return; - } - } - - foreach my $cluster (@{$::clusters}) - { - if ( $cluster->{'pid'} eq $ret_pid ) - { - mtr_verbose("$cluster->{'name'} cluster ndb_mgmd exited, pid: $ret_pid"); - $cluster->{'pid'}= 0; - - # Check if crash expected and restart if it was - my $expect_file= "$::opt_vardir/tmp/ndb_mgmd_" . "$cluster->{'type'}" . - ".expect"; - if ( -f $expect_file ) - { - mtr_verbose("Crash was expected, file $expect_file exists"); - unlink($expect_file); - ndbmgmd_start($cluster); - } - return; - } - - foreach my $ndbd (@{$cluster->{'ndbds'}}) - { - if ( $ndbd->{'pid'} eq $ret_pid ) - { - mtr_verbose("$cluster->{'name'} cluster ndbd exited, pid: $ret_pid"); - $ndbd->{'pid'}= 0; - - # Check if crash expected and restart if it was - my $expect_file= "$::opt_vardir/tmp/ndbd_" . "$cluster->{'type'}" . - "$ndbd->{'idx'}" . ".expect"; - if ( -f $expect_file ) - { - mtr_verbose("Crash was expected, file $expect_file exists"); - unlink($expect_file); - ndbd_start($cluster, $ndbd->{'idx'}, - $ndbd->{'start_extra_args'}); - } - return; - } - } - } - - if ($::instance_manager->{'spawner_pid'} eq $ret_pid) - { - return; - } - - mtr_warning("check_expected_crash_and_restart couldn't find an entry for pid: $ret_pid"); - -} - -############################################################################## -# -# The operating system will keep information about dead children, -# we read this information here, and if we have records the process -# is alive, we mark it as dead. -# -############################################################################## - -sub mtr_record_dead_children () { - - my $process_died= 0; - my $ret_pid; - - # Wait without blockinng to see if any processes had died - # -1 or 0 means there are no more procesess to wait for - while ( ($ret_pid= waitpid(-1,&WNOHANG)) != 0 and $ret_pid != -1) - { - mtr_warning("mtr_record_dead_children: $ret_pid"); - mark_process_dead($ret_pid); - $process_died= 1; - } - return $process_died; -} - -sub start_reap_all { - # 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. - my $pid; - while(($pid= waitpid(-1, &WNOHANG)) != 0 and $pid != -1) - { - mtr_warning("start_reap_all pid: $pid"); - mark_process_dead($pid); - }; -} - -sub stop_reap_all { - $SIG{CHLD}= 'DEFAULT'; -} - - sub mtr_ping_port ($) { my $port= shift; @@ -1053,7 +69,7 @@ sub mtr_ping_port ($) { sub sleep_until_file_created ($$$) { my $pidfile= shift; my $timeout= shift; - my $pid= shift; + my $proc= shift; my $sleeptime= 100; # Milliseconds my $loops= ($timeout * 1000) / $sleeptime; @@ -1065,9 +81,9 @@ sub sleep_until_file_created ($$$) { } # Check if it died after the fork() was successful - if ( $pid != 0 && waitpid($pid,&WNOHANG) == $pid ) + if ( defined $proc and ! $proc->wait_one(0) ) { - mtr_warning("Process $pid died"); + mtr_warning("Process $proc died"); return 0; } @@ -1082,73 +98,12 @@ sub sleep_until_file_created ($$$) { "still waiting for $left seconds..."); } - # Millisceond sleep emulated with select - select(undef, undef, undef, ($sleeptime/1000)); - } - - return 0; -} - + mtr_milli_sleep($sleeptime); -sub mtr_kill_processes ($) { - my $pids = shift; - - mtr_verbose("mtr_kill_processes (" . join(" ", keys %{$pids}) . ")"); - - foreach my $pid (keys %{$pids}) - { - - if ($pid <= 0) - { - mtr_warning("Trying to kill illegal pid: $pid"); - next; - } - - my $signaled_procs= kill(9, $pid); - if ($signaled_procs == 0) - { - # No such process existed, assume it's killed - mtr_verbose("killed $pid(no such process)"); - } - else - { - my $ret_pid= waitpid($pid,0); - if ($ret_pid == $pid) - { - mtr_verbose("killed $pid(got the pid)"); - } - elsif ($ret_pid == -1) - { - mtr_verbose("killed $pid(got -1)"); - } - } } - mtr_verbose("done killing processes"); -} - - -############################################################################## -# -# When we exit, we kill off all children -# -############################################################################## -sub mtr_exit ($) { - my $code= shift; - mtr_timer_stop_all($::glob_timers); - local $SIG{HUP} = 'IGNORE'; - # ToDo: Signalling -$$ will only work if we are the process group - # leader (in fact on QNX it will signal our session group leader, - # which might be Do-compile or Pushbuild, causing tests to be - # aborted). So we only do it if we are the group leader. We might - # set ourselves as the group leader at startup (with - # POSIX::setpgrp(0,0)), but then care must be needed to always do - # proper child process cleanup. - POSIX::kill(SIGHUP, -$$) if !$::glob_win32_perl and $$ == getpgrp(); - - exit($code); + return 0; } -########################################################################### 1; diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm new file mode 100644 index 00000000000..39d4f0a582a --- /dev/null +++ b/mysql-test/lib/mtr_report.pm @@ -0,0 +1,471 @@ +# -*- cperl -*- +# Copyright 2004-2008 MySQL AB, 2008 Sun Microsystems, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +# This is a library file used by the Perl version of mysql-test-run, +# and is part of the translation of the Bourne shell script with the +# same name. + +package mtr_report; +use strict; + +use base qw(Exporter); +our @EXPORT= qw(report_option mtr_print_line mtr_print_thick_line + mtr_print_header mtr_report mtr_report_stats + mtr_warning mtr_error mtr_debug mtr_verbose + mtr_verbose_restart mtr_report_test_passed + mtr_report_test_skipped mtr_print + mtr_report_test); + +use mtr_match; +require "mtr_io.pl"; + +my $tot_real_time= 0; + +our $timestamp= 0; +our $timediff= 0; +our $name; +our $verbose; +our $verbose_restart= 0; +our $timer= 1; + +sub report_option { + my ($opt, $value)= @_; + + # Evaluate $opt as string to use "Getopt::Long::Callback legacy API" + my $opt_name = "$opt"; + + # Convert - to _ in option name + $opt_name =~ s/-/_/g; + no strict 'refs'; + ${$opt_name}= $value; +} + +sub _name { + return $name ? $name." " : undef; +} + +sub _mtr_report_test_name ($) { + my $tinfo= shift; + my $tname= $tinfo->{name}; + + return unless defined $verbose; + + # Add combination name if any + $tname.= " '$tinfo->{combination}'" + if defined $tinfo->{combination}; + + print _name(), _timestamp(); + printf "%-40s ", $tname; +} + + +sub mtr_report_test_skipped ($) { + my ($tinfo)= @_; + $tinfo->{'result'}= 'MTR_RES_SKIPPED'; + + mtr_report_test($tinfo); +} + + +sub mtr_report_test_passed ($) { + my ($tinfo)= @_; + + # Save the timer value + my $timer_str= ""; + if ( $timer and -f "$::opt_vardir/log/timer" ) + { + $timer_str= mtr_fromfile("$::opt_vardir/log/timer"); + $tinfo->{timer}= $timer_str; + } + + # Big warning if status already set + if ( $tinfo->{'result'} ){ + mtr_warning("mtr_report_test_passed: Test result", + "already set to '", $tinfo->{'result'}, ","); + } + + $tinfo->{'result'}= 'MTR_RES_PASSED'; + + mtr_report_test($tinfo); +} + + +sub mtr_report_test ($) { + my ($tinfo)= @_; + _mtr_report_test_name($tinfo); + + my $comment= $tinfo->{'comment'}; + my $logfile= $tinfo->{'logfile'}; + my $warnings= $tinfo->{'warnings'}; + my $result= $tinfo->{'result'}; + + if ($result eq 'MTR_RES_FAILED'){ + + my $timest = format_time(); + + if ( $warnings ) + { + mtr_report("[ fail ] Found warnings/errors in server log file!"); + mtr_report(" Test ended at $timest"); + mtr_report($warnings); + return; + } + my $timeout= $tinfo->{'timeout'}; + if ( $timeout ) + { + mtr_report("[ fail ] timeout after $timeout seconds"); + mtr_report(" Test ended at $timest"); + mtr_report("\n$tinfo->{'comment'}"); + return; + } + else + { + mtr_report("[ fail ]\n Test ended at $timest"); + } + + if ( $logfile ) + { + # Test failure was detected by test tool and its report + # about what failed has been saved to file. Display the report. + mtr_report("\n$logfile\n"); + } + if ( $comment ) + { + # The test failure has been detected by mysql-test-run.pl + # when starting the servers or due to other error, the reason for + # failing the test is saved in "comment" + mtr_report("\n$comment\n"); + } + + if ( !$logfile and !$comment ) + { + # Neither this script or the test tool has recorded info + # about why the test has failed. Should be debugged. + mtr_report("\nUnknown result, neither 'comment' or 'logfile' set"); + } + } + elsif ($result eq 'MTR_RES_SKIPPED') + { + if ( $tinfo->{'disable'} ) + { + mtr_report("[ disabled ] $comment"); + } + elsif ( $comment ) + { + if ( $tinfo->{skip_detected_by_test} ) + { + mtr_report("[ skip ]. $comment"); + } + else + { + mtr_report("[ skip ] $comment"); + } + } + else + { + mtr_report("[ skip ]"); + } + } + elsif ($result eq 'MTR_RES_PASSED') + { + my $timer_str= $tinfo->{timer} || ""; + $tot_real_time += ($timer_str/1000); + mtr_report("[ pass ] ", sprintf("%5s", $timer_str)); + + # Show any problems check-testcase found + if ( defined $tinfo->{'check'} ) + { + mtr_report($tinfo->{'check'}); + } + } +} + + +sub mtr_report_stats ($) { + my $tests= shift; + + # ---------------------------------------------------------------------- + # Find out how we where doing + # ---------------------------------------------------------------------- + + my $tot_skiped= 0; + my $tot_passed= 0; + my $tot_failed= 0; + my $tot_tests= 0; + my $tot_restarts= 0; + my $found_problems= 0; + + foreach my $tinfo (@$tests) + { + if ( $tinfo->{failures} ) + { + # Test has failed at least one time + $tot_tests++; + $tot_failed++; + } + elsif ( $tinfo->{'result'} eq 'MTR_RES_SKIPPED' ) + { + # Test was skipped + $tot_skiped++; + } + elsif ( $tinfo->{'result'} eq 'MTR_RES_PASSED' ) + { + # Test passed + $tot_tests++; + $tot_passed++; + } + + if ( $tinfo->{'restarted'} ) + { + # Servers was restarted + $tot_restarts++; + } + + # Look for warnings produced by mysqltest + my $base_file= mtr_match_extension($tinfo->{'result_file'}, + "result"); # Trim extension + my $warning_file= "$base_file.warnings"; + if ( -f $warning_file ) + { + $found_problems= 1; + mtr_warning("Check myqltest warnings in '$warning_file'"); + } + } + + # ---------------------------------------------------------------------- + # Print out a summary report to screen + # ---------------------------------------------------------------------- + print "The servers were restarted $tot_restarts times\n"; + + if ( $timer ) + { + use English; + + mtr_report("Spent", sprintf("%.3f", $tot_real_time),"of", + time - $BASETIME, "seconds executing testcases"); + } + + my $warnlog= "$::opt_vardir/log/warnings"; + if ( ! $::glob_use_running_server && !$::opt_extern && -f $warnlog) + { + mtr_warning("Got errors/warnings while running tests, please examine", + "'$warnlog' for details."); + } + + print "\n"; + + # Print a list of check_testcases that failed(if any) + if ( $::opt_check_testcases ) + { + my %check_testcases; + + foreach my $tinfo (@$tests) + { + if ( defined $tinfo->{'check_testcase_failed'} ) + { + $check_testcases{$tinfo->{'name'}}= 1; + } + } + + if ( keys %check_testcases ) + { + print "Check of testcase failed for: "; + print join(" ", keys %check_testcases); + print "\n\n"; + } + } + + # Print a list of testcases that failed + if ( $tot_failed != 0 ) + { + + # Print each failed test, again + #foreach my $test ( @$tests ){ + # if ( $test->{failures} ) { + # mtr_report_test($test); + # } + #} + + my $ratio= $tot_passed * 100 / $tot_tests; + print "Failed $tot_failed/$tot_tests tests, "; + printf("%.2f", $ratio); + print "\% were successful.\n\n"; + + # Print the list of test that failed in a format + # that can be copy pasted to rerun only failing tests + print "Failing test(s):"; + + my %seen= (); + foreach my $tinfo (@$tests) + { + my $tname= $tinfo->{'name'}; + if ( $tinfo->{failures} and ! $seen{$tname}) + { + print " $tname"; + $seen{$tname}= 1; + } + } + print "\n\n"; + + # Print info about reporting the error + print + "The log files in var/log may give you some hint of what went wrong.\n\n", + "If you want to report this error, please read first ", + "the documentation\n", + "at http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html\n\n"; + + } + else + { + print "All $tot_tests tests were successful.\n\n"; + } + + if ( $tot_failed != 0 || $found_problems) + { + mtr_error("there were failing test cases"); + } +} + + +############################################################################## +# +# Text formatting +# +############################################################################## + +sub mtr_print_line () { + print '-' x 60, "\n"; +} + + +sub mtr_print_thick_line { + my $char= shift || '='; + print $char x 60, "\n"; +} + + +sub mtr_print_header () { + print "\n"; + printf "TEST"; + print " " x 38; + print "RESULT "; + print "TIME (ms)" if $timer; + print "\n"; + mtr_print_line(); + print "\n"; +} + + +############################################################################## +# +# Log and reporting functions +# +############################################################################## + +use Time::localtime; + +use Time::HiRes qw(gettimeofday); + +sub format_time { + my $tm= localtime(); + return sprintf("%4d-%02d-%02d %02d:%02d:%02d", + $tm->year + 1900, $tm->mon+1, $tm->mday, + $tm->hour, $tm->min, $tm->sec); +} + +my $t0= gettimeofday(); + +sub _timestamp { + return "" unless $timestamp; + + my $diff; + if ($timediff){ + my $t1= gettimeofday(); + my $elapsed= $t1 - $t0; + + $diff= sprintf(" +%02.3f", $elapsed); + + # Save current time for next lap + $t0= $t1; + + } + + my $tm= localtime(); + return sprintf("%02d%02d%02d %2d:%02d:%02d%s ", + $tm->year % 100, $tm->mon+1, $tm->mday, + $tm->hour, $tm->min, $tm->sec, $diff); +} + +# Always print message to screen +sub mtr_print (@) { + print _name(), join(" ", @_), "\n"; +} + + +# Print message to screen if verbose is defined +sub mtr_report (@) { + if (defined $verbose) + { + print _name(), join(" ", @_), "\n"; + } +} + + +# Print warning to screen +sub mtr_warning (@) { + print STDERR _name(), _timestamp(), + "mysql-test-run: WARNING: ", join(" ", @_), "\n"; +} + + +# Print error to screen and then exit +sub mtr_error (@) { + print STDERR _name(), _timestamp(), + "mysql-test-run: *** ERROR: ", join(" ", @_), "\n"; + exit(1); +} + + +sub mtr_debug (@) { + if ( $verbose > 2 ) + { + print STDERR _name(), + _timestamp(), "####: ", join(" ", @_), "\n"; + } +} + + +sub mtr_verbose (@) { + if ( $verbose ) + { + print STDERR _name(), _timestamp(), + "> ",join(" ", @_),"\n"; + } +} + + +sub mtr_verbose_restart (@) { + my ($server, @args)= @_; + my $proc= $server->{proc}; + if ( $verbose_restart ) + { + print STDERR _name(),_timestamp(), + "> Restart $proc - ",join(" ", @args),"\n"; + } +} + + +1; diff --git a/mysql-test/lib/mtr_stress.pl b/mysql-test/lib/mtr_stress.pl index 93b06b32c5f..cd5c7b0dbb7 100644 --- a/mysql-test/lib/mtr_stress.pl +++ b/mysql-test/lib/mtr_stress.pl @@ -135,7 +135,7 @@ sub run_stress_test () } mtr_init_args(\$args); - + mtr_add_args($args, "$::glob_mysql_test_dir/mysql-stress-test.pl"); mtr_add_arg($args, "--server-socket=%s", $::master->[0]->{'path_sock'}); mtr_add_arg($args, "--server-user=%s", $::opt_user); mtr_add_arg($args, "--server-database=%s", "test"); @@ -181,7 +181,13 @@ sub run_stress_test () } #Run stress test - mtr_run("$::glob_mysql_test_dir/mysql-stress-test.pl", $args, "", "", "", ""); + My::SafeProcess->run + ( + name => "stress test", + path => $^X, + args => \$args, + ); + if ( ! $::glob_use_embedded_server ) { stop_all_servers(); diff --git a/mysql-test/lib/mtr_unique.pm b/mysql-test/lib/mtr_unique.pm new file mode 100644 index 00000000000..b4093ab1dce --- /dev/null +++ b/mysql-test/lib/mtr_unique.pm @@ -0,0 +1,185 @@ +# -*- cperl -*- +# Copyright (C) 2006 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +package mtr_unique; + +use strict; +use Fcntl ':flock'; + +use base qw(Exporter); +our @EXPORT= qw(mtr_get_unique_id mtr_release_unique_id); + +use My::Platform; + +sub msg { + # print "### unique($$) - ", join(" ", @_), "\n"; +} + +my $file= "/tmp/mysql-test-ports"; + +my %mtr_unique_ids; + +END { + my $allocated_id= $mtr_unique_ids{$$}; + if (defined $allocated_id) + { + mtr_release_unique_id($allocated_id); + } + delete $mtr_unique_ids{$$}; +} + +# +# Get a unique, numerical ID, given a file name (where all +# requested IDs are stored), a minimum and a maximum value. +# +# If no unique ID within the specified parameters can be +# obtained, return undef. +# +sub mtr_get_unique_id($$) { + my ($min, $max)= @_;; + + msg("get, '$file', $min-$max"); + + die "Can only get one unique id per process!" if $mtr_unique_ids{$$}; + + my $ret = undef; + my $changed = 0; + + if(eval("readlink '$file'") || eval("readlink '$file.sem'")) { + die 'lock file is a symbolic link'; + } + + chmod 0777, "$file.sem"; + open SEM, ">", "$file.sem" or die "can't write to $file.sem"; + flock SEM, LOCK_EX or die "can't lock $file.sem"; + if(! -e $file) { + open FILE, ">", $file or die "can't create $file"; + close FILE; + } + + msg("HAVE THE LOCK"); + + if(eval("readlink '$file'") || eval("readlink '$file.sem'")) { + die 'lock file is a symbolic link'; + } + + chmod 0777, $file; + open FILE, "+<", $file or die "can't open $file"; + #select undef,undef,undef,0.2; + seek FILE, 0, 0; + my %taken = (); + while(<FILE>) { + chomp; + my ($id, $pid) = split / /; + $taken{$id} = $pid; + msg("taken: $id, $pid"); + # Check if process with given pid is alive + if(!process_alive($pid)) { + print "Removing slot $id used by missing process $pid\n"; + msg("Removing slot $id used by missing process $pid"); + delete $taken{$id}; + $changed++; + } + } + for(my $i=$min; $i<=$max; ++$i) { + if(! exists $taken{$i}) { + $ret = $i; + $taken{$i} = $$; + $changed++; + # Remember the id this process got + $mtr_unique_ids{$$}= $i; + msg(" got $i"); + last; + } + } + if($changed) { + seek FILE, 0, 0; + truncate FILE, 0 or die "can't truncate $file"; + for my $k (keys %taken) { + print FILE $k . ' ' . $taken{$k} . "\n"; + } + } + close FILE; + + msg("RELEASING THE LOCK"); + flock SEM, LOCK_UN or warn "can't unlock $file.sem"; + close SEM; + + return $ret; +} + + +# +# Release a unique ID. +# +sub mtr_release_unique_id($) { + my ($myid)= @_; + + msg("release, $myid"); + + + if(eval("readlink '$file'") || eval("readlink '$file.sem'")) { + die 'lock file is a symbolic link'; + } + + open SEM, ">", "$file.sem" or die "can't write to $file.sem"; + flock SEM, LOCK_EX or die "can't lock $file.sem"; + + msg("HAVE THE LOCK"); + + if(eval("readlink '$file'") || eval("readlink '$file.sem'")) { + die 'lock file is a symbolic link'; + } + + if(! -e $file) { + open FILE, ">", $file or die "can't create $file"; + close FILE; + } + open FILE, "+<", $file or die "can't open $file"; + #select undef,undef,undef,0.2; + seek FILE, 0, 0; + my %taken = (); + while(<FILE>) { + chomp; + my ($id, $pid) = split / /; + msg(" taken, $id $pid"); + $taken{$id} = $pid; + } + + if ($taken{$myid} != $$) + { + msg(" The unique id for this process does not match pid"); + } + + + msg(" removing $myid"); + delete $taken{$myid}; + seek FILE, 0, 0; + truncate FILE, 0 or die "can't truncate $file"; + for my $k (keys %taken) { + print FILE $k . ' ' . $taken{$k} . "\n"; + } + close FILE; + + msg("RELEASE THE LOCK"); + + flock SEM, LOCK_UN or warn "can't unlock $file.sem"; + close SEM; +} + + +1; + diff --git a/mysql-test/lib/t/Base.t b/mysql-test/lib/t/Base.t new file mode 100644 index 00000000000..6ca7657d421 --- /dev/null +++ b/mysql-test/lib/t/Base.t @@ -0,0 +1,27 @@ +# -*- cperl -*- +use Test::More qw(no_plan); +use strict; + +use_ok ("My::SafeProcess::Base"); + + +my $count= 0; +for (1..100){ + my $pid= My::SafeProcess::Base::_safe_fork(); + exit unless $pid; + (waitpid($pid, 0) == $pid) and $count++; +} +ok($count == 100, "safe_fork"); + +# A nice little forkbomb +SKIP: { + skip("forkbomb", 1); + eval { + while(1){ + my $pid= My::SafeProcess::Base::_safe_fork(); + exit unless $pid; + } + }; + ok($@, "forkbomb"); +} + diff --git a/mysql-test/lib/t/Find.t b/mysql-test/lib/t/Find.t new file mode 100644 index 00000000000..90489ba06dd --- /dev/null +++ b/mysql-test/lib/t/Find.t @@ -0,0 +1,33 @@ +# -*- cperl -*- +use Test::More qw(no_plan); +use strict; + +use_ok ("My::Find"); +my $basedir= "../.."; + +print "=" x 40, "\n"; +my $mysqld_exe= my_find_bin($basedir, + ["sql", "bin"], + ["mysqld", "mysqld-debug"]); +print "mysqld_exe: $mysqld_exe\n"; +print "=" x 40, "\n"; +my $mysql_exe= my_find_bin($basedir, + ["client", "bin"], + "mysql"); +print "mysql_exe: $mysql_exe\n"; +print "=" x 40, "\n"; + +my $mtr_build_dir= $ENV{MTR_BUILD_DIR}; +$ENV{MTR_BUILD_DIR}= "debug"; +my $mysql_exe= my_find_bin($basedir, + ["client", "bin"], + "mysql"); +print "mysql_exe: $mysql_exe\n"; +$ENV{MTR_BUILD_DIR}= $mtr_build_dir; +print "=" x 40, "\n"; + +my $charset_dir= my_find_dir($basedir, + ["share/mysql", "sql/share", "share"], + "charsets"); +print "charset_dir: $charset_dir\n"; +print "=" x 40, "\n"; diff --git a/mysql-test/lib/t/Options.t b/mysql-test/lib/t/Options.t new file mode 100644 index 00000000000..7012f3da8de --- /dev/null +++ b/mysql-test/lib/t/Options.t @@ -0,0 +1,127 @@ + +# -*- cperl -*- +use Test::More qw(no_plan); +use strict; + +use_ok("My::Options"); + +my @tests= +( + [ + ['--binlog-format=row', '--loose-skip-innodb', '--binlog-format=ms'], + ['--binlog-format=row', '--loose-skip-innodb', '--binlog-format=statement'], + ['--binlog-format=statement'] + ], + + [ + ['--binlog-format=row', '--loose-skip-innodb', '--binlog-format=statement'], + ['--binlog-format=row', '--loose-skip-innodb', '--binlog-format=mixed'], + ['--binlog-format=mixed'] + ], + + [ + ['--binlog-format=row', '--loose-skip-innodb', '--binlog-format=mixed'], + ['--binlog-format=row', '--loose-skip-innodb', '--binlog-format=statement'], + ['--binlog-format=statement'] + ], + + [ + ['--binlog-format=mixed', '--loose-skip-innodb', '--binlog-format=row'], + ['--binlog-format=statement', '--loose-skip-innodb', '--binlog-format=row'], + [ ] + ], + + [ + ['--binlog-format=row'], + [ ], + ['--binlog-format=default'] + ], + + [ + [ ], + ['--binlog-format=row'], + ['--binlog-format=row'] + ], + + [ + [ ], + ['-O', 'max_binlog_size=1' ], + ['--max_binlog_size=1' ] + ], + + [ + ['-O', 'max_binlog_size=1' ], + ['-O', 'max_binlog_size=1' ], + [ ], + ], + + [ + ['-O', 'max_binlog_size=1' ], + [ ], + ['--max_binlog_size=default' ] + ], + + [ + [ ], + ['-O', 'max_binlog_size=1', '--binlog-format=row' ], + ['--max_binlog_size=1', '--binlog-format=row' ] + ], + [ + ['--binlog-format=statement' ], + ['-O', 'max_binlog_size=1', '--binlog-format=row' ], + ['--max_binlog_size=1', '--binlog-format=row'] + ], + + [ + [ '--binlog-format=statement' ], + ['-O', 'max_binlog_size=1', '--binlog-format=statement' ], + ['--max_binlog_size=1' ] + ], + + [ + [ '--binlog-format=statement' ], + ['-O', 'max_binlog_size=1', '--binlog-format=statement' ], + ['--max_binlog_size=1' ] + ], + + [ + [ '--binlog-format=statement' ], + ['--relay-log=/path/to/a/relay-log', '--binlog-format=row'], + ['--relay-log=/path/to/a/relay-log', '--binlog-format=row' ] + ], + + + [ + [ '--binlog-format=statement' ], + ['--relay-log=/path/to/a/relay-log', '-O', 'max_binlog_size=1'], + ['--max_binlog_size=1', '--relay-log=/path/to/a/relay-log', '--binlog-format=default' ] + ], + + [ + [ '--slow-query-log=0' ], + [ '--slow-query-log' ], + [ '--slow-query-log' ] + ], + + +); + + +my $test_no= 0; +foreach my $test (@tests){ + print "test", $test_no++, "\n"; + foreach my $opts (@$test){ + print My::Options::toStr("", @$opts); + } + my $from= $test->[0]; + my $to= $test->[1]; + my @result= My::Options::diff($from, $to); + ok(My::Options::same(\@result, $test->[2])); + if (!My::Options::same(\@result, $test->[2])){ + print "failed\n"; + print My::Options::toStr("result", @result); + print My::Options::toStr("expect", @{$test->[2]}); + } + print My::Options::toSQL(@result), "\n"; + print "\n"; +} diff --git a/mysql-test/lib/t/Platform.t b/mysql-test/lib/t/Platform.t new file mode 100644 index 00000000000..a8cb7751925 --- /dev/null +++ b/mysql-test/lib/t/Platform.t @@ -0,0 +1,18 @@ +# -*- cperl -*- +use Test::More qw(no_plan); +use strict; + +use_ok ("My::Platform"); +use My::Platform; + +use File::Temp qw / tempdir /; +my $dir = tempdir( CLEANUP => 1 ); + +print "Running on Windows\n" if (IS_WINDOWS); +print "Using ActiveState perl\n" if (IS_WIN32PERL); +print "Using cygwin perl\n" if (IS_CYGWIN); + +print "dir: '$dir'\n"; +print "native: '".native_path($dir)."'\n"; +print "mixed: '".mixed_path($dir)."'\n"; +print "posix: '".posix_path($dir)."'\n"; diff --git a/mysql-test/lib/t/SafeProcess.t b/mysql-test/lib/t/SafeProcess.t new file mode 100644 index 00000000000..d4a62ff8cca --- /dev/null +++ b/mysql-test/lib/t/SafeProcess.t @@ -0,0 +1,102 @@ +# -*- cperl -*- + +use strict; +use FindBin; +use IO::File; + +use Test::More qw(no_plan); +use_ok ("My::SafeProcess"); + + +my $perl_path= $^X; + +{ + # Test exit codes + my $count= 32; + my $ok_count= 0; + for my $code (0..$count-1) { + + my $args= [ "$FindBin::Bin/test_child.pl", "--exit-code=$code" ]; + my $proc= My::SafeProcess->new + ( + path => $perl_path, + args => \$args, + output => "/dev/null", + error => "/dev/null", + ); + # Wait max 10 seconds for the process to finish + $ok_count++ if ($proc->wait_one(10) == 0 and + $proc->exit_status() == $code); + } + ok($count == $ok_count, "check exit_status, $ok_count"); +} + + +{ + # spawn a number of concurrent processes + my $count= 16; + my $ok_count= 0; + my %procs; + for my $code (0..$count-1) { + + my $args= [ "$FindBin::Bin/test_child.pl", "--exit-code=$code" ]; + $procs{$code}= My::SafeProcess->new + ( + path => $perl_path, + args => \$args, + output => "/dev/null", + error => "/dev/null", + ); + } + + for my $code (0..$count-1) { + $ok_count++ if ($procs{$code}->wait_one(10) == 0 and + $procs{$code}->exit_status() == $code); + } + ok($count == $ok_count, "concurrent, $ok_count"); +} + + +# +# Test stdout, stderr +# +{ + use File::Temp qw / tempdir /; + my $dir = tempdir( CLEANUP => 1 ); + + my $args= [ "$FindBin::Bin/test_child.pl" ]; + my $proc= My::SafeProcess->new + ( + path => $perl_path, + args => \$args, + output => "$dir/output.txt", + error => "$dir/error.txt", + ); + + $proc->wait_one(2); # Wait max 2 seconds for the process to finish + + my $fh= IO::File->new("$dir/output.txt"); + my @text= <$fh>; + ok(grep(/Hello stdout/, @text), "check stdout"); + $fh= IO::File->new("$dir/error.txt"); + my @text= <$fh>; + ok(grep(/Hello stderr/, @text), "check stderr"); + + # To same file + $proc= My::SafeProcess->new + ( + path => $perl_path, + args => \$args, + output => "$dir/output.txt", + error => "$dir/output.txt", + debug => 1, + ); + + $proc->wait_one(2); # Wait max 2 seconds for the process to finish + + my $fh= IO::File->new("$dir/output.txt"); + my @text= <$fh>; + ok((grep(/Hello stdout/, @text) and grep(/Hello stderr/, @text)), + "check stdout and stderr"); + +} diff --git a/mysql-test/lib/t/SafeProcessStress.pl b/mysql-test/lib/t/SafeProcessStress.pl new file mode 100755 index 00000000000..0f7a59d67f0 --- /dev/null +++ b/mysql-test/lib/t/SafeProcessStress.pl @@ -0,0 +1,149 @@ +#!/usr/bin/perl +# -*- cperl -*- + +use strict; +use FindBin; +use My::SafeProcess; + +# +# Test longterm running of SafeProcess +# + +my $perl_path= $^X; +my $verbose= 0; +my $loops= 100; + +print "kill one and wait for one\n"; +for (1...$loops){ + use File::Temp qw / tempdir /; + my $dir = tempdir( CLEANUP => 1 ); + + my @procs; + for (1..10){ + + my $args= [ "$FindBin::Bin/dummyd.pl", "--vardir=$dir" ]; + my $proc= My::SafeProcess->new + ( + path => $perl_path, + args => \$args, + verbose => $verbose, + ); + push(@procs, $proc); + } + + foreach my $proc (@procs) { + $proc->kill(); + # dummyd will always be killed and thus + # exit_status should have been set to 1 + die "oops, exit_status: ", $proc->exit_status() + unless $proc->exit_status() == 1; + } + + print "=" x 60, "\n"; +} + + +print "With 1 second sleep in dummyd\n"; +for (1...$loops){ + use File::Temp qw / tempdir /; + my $dir = tempdir( CLEANUP => 1 ); + + my @procs; + for (1..10){ + + my $args= [ "$FindBin::Bin/dummyd.pl", + "--vardir=$dir", + "--sleep=1" ]; + my $proc= My::SafeProcess->new + ( + path => $perl_path, + args => \$args, + verbose => $verbose, + ); + push(@procs, $proc); + } + + foreach my $proc (@procs) { + $proc->kill(); + } + + print "=" x 60, "\n"; +} + +print "kill all and wait for one\n"; +for (1...$loops){ + use File::Temp qw / tempdir /; + my $dir = tempdir( CLEANUP => 1 ); + + my @procs; + for (1..10){ + + my $args= [ "$FindBin::Bin/dummyd.pl", "--vardir=$dir" ]; + my $proc= My::SafeProcess->new + ( + path => $perl_path, + args => \$args, + verbose => $verbose, + ); + push(@procs, $proc); + } + + foreach my $proc (@procs) { + $proc->start_kill(); + } + + foreach my $proc (@procs) { + $proc->wait_one(); + } + + print "=" x 60, "\n"; +} + +print "kill all using shutdown without callback\n"; +for (1...$loops){ + use File::Temp qw / tempdir /; + my $dir = tempdir( CLEANUP => 1 ); + + my @procs; + for (1..10){ + + my $args= [ "$FindBin::Bin/dummyd.pl", "--vardir=$dir" ]; + my $proc= My::SafeProcess->new + ( + path => $perl_path, + args => \$args, + verbose => $verbose, + ); + push(@procs, $proc); + } + + My::SafeProcess::shutdown(2, @procs); + + print "=" x 60, "\n"; +} + +print "kill all using shutdown\n"; +for (1...$loops){ + use File::Temp qw / tempdir /; + my $dir = tempdir( CLEANUP => 1 ); + + my @procs; + for (1..10){ + + my $args= [ "$FindBin::Bin/dummyd.pl", "--vardir=$dir" ]; + my $proc= My::SafeProcess->new + ( + path => $perl_path, + args => \$args, + verbose => $verbose, + shutdown => sub { }, # Does nothing + ); + push(@procs, $proc); + } + + My::SafeProcess::shutdown(2, @procs); + + print "=" x 60, "\n"; +} + +exit(0); diff --git a/mysql-test/lib/t/copytree.t b/mysql-test/lib/t/copytree.t new file mode 100644 index 00000000000..15e4d1a7b1b --- /dev/null +++ b/mysql-test/lib/t/copytree.t @@ -0,0 +1,34 @@ +#!/usr/bin/perl +# -*- cperl -*- + +use strict; + +use My::File::Path; + +use Test::Simple tests => 7; +use File::Temp qw / tempdir /; +my $dir = tempdir( CLEANUP => 1 ); +my $testdir="$dir/test"; +my $test_todir="$dir/to"; + +my $subdir= "$testdir/test1/test2/test3"; + +# +# 1. Create, copy and remove a directory structure +# +mkpath($subdir); +ok( -d $subdir, "Check '$subdir' is created"); + +copytree($testdir, $test_todir); +ok( -d $test_todir, "Check '$test_todir' is created"); +ok( -d "$test_todir/test1", "Check 'test1' is created"); +ok( -d "$test_todir/test1/test2", "Check 'test2' is created"); +ok( -d "$test_todir/test1/test2/test3", "Check 'test3' is created"); + + +rmtree($testdir); +ok( ! -d $testdir, "Check '$testdir' is gone"); + +rmtree($test_todir); +ok( ! -d $test_todir, "Check '$test_todir' is gone"); + diff --git a/mysql-test/lib/t/dummyd.pl b/mysql-test/lib/t/dummyd.pl new file mode 100644 index 00000000000..07336e3c2d2 --- /dev/null +++ b/mysql-test/lib/t/dummyd.pl @@ -0,0 +1,38 @@ +#!/usr/bin/perl +# -*- cperl -*- + +use strict; +use Getopt::Long; +use IO::File; + +my $vardir; +my $randie= 0; +my $sleep= 0; +GetOptions + ( + # Directory where to write files + 'vardir=s' => \$vardir, + 'die-randomly' => \$randie, + 'sleep=i' => \$sleep, + ); + +die("invalid vardir ") unless defined $vardir and -d $vardir; + +my $pid= $$; +while(1){ + for my $i (1..64){ + # Write to file + my $name= "$vardir/$pid.$i.tmp"; + my $F= IO::File->new($name, "w") + or warn "$$, Could not open $name: $!" and next; + print $F rand($.) for (1..1000); + $F->close(); + sleep($sleep); + die "ooops!" if $randie and rand() < 0.0001 + } +} + + +exit (0); + + diff --git a/mysql-test/lib/t/rmtree.t b/mysql-test/lib/t/rmtree.t new file mode 100644 index 00000000000..08c9077d001 --- /dev/null +++ b/mysql-test/lib/t/rmtree.t @@ -0,0 +1,52 @@ +#!/usr/bin/perl +# -*- cperl -*- + +use strict; + +use My::File::Path; + +use Test::Simple tests => 8; +use File::Temp qw / tempdir /; +my $dir = tempdir( CLEANUP => 1 ); +my $testdir="$dir/test"; + +my $subdir= "$testdir/test1/test2/test3"; + +# +# 1. Create and remove a directory structure +# +mkpath($subdir); +ok( -d $subdir, "Check '$subdir' is created"); + +rmtree($testdir); +ok( ! -d $testdir, "Check '$testdir' is gone"); + +# +# 2. Create and remove a directory structure +# where one directory is chmod to 0000 +# +mkpath($subdir); +ok( -d $subdir, "Check '$subdir' is created"); + +ok( chmod(0000, $subdir) == 1 , "Check one dir was chmoded"); + +rmtree($testdir); +ok( ! -d $testdir, "Check '$testdir' is gone"); + +# +# 3. Create and remove a directory structure +# where one file is chmod to 0000 +# +mkpath($subdir); +ok( -d $subdir, "Check '$subdir' is created"); + +my $testfile= "$subdir/test.file"; +open(F, ">", $testfile) or die; +print F "hello\n"; +close(F); + +ok( chmod(0000, $testfile) == 1 , "Check one file was chmoded"); + +rmtree($testdir); +ok( ! -d $testdir, "Check '$testdir' is gone"); + diff --git a/mysql-test/lib/t/testMyConfig.t b/mysql-test/lib/t/testMyConfig.t new file mode 100755 index 00000000000..da08cb8b4d1 --- /dev/null +++ b/mysql-test/lib/t/testMyConfig.t @@ -0,0 +1,131 @@ +#!/usr/bin/perl +# -*- cperl -*- + +use strict; +use warnings; +use File::Temp qw / tempdir /; +my $dir = tempdir( CLEANUP => 1 ); + +use Test::More qw(no_plan); + +BEGIN { use_ok ( "My::Config" ) }; + +my $test_cnf= "$dir/test.cnf"; + +# Write test config file +open(OUT, ">", $test_cnf) or die; +print $test_cnf, "\n"; + +print OUT <<EOF +[mysqld] +# Comment +option1=values2 +option2= value4 +option4 +basedir=thebasedir +[mysqld_1] +[mysqld_2] +[mysqld.9] +[client] +socket =\tasocketpath +EOF +; +close OUT; + +my $config= My::Config->new($test_cnf); +isa_ok( $config, "My::Config" ); + +print $config; + +ok ( $config->group("mysqld_2"), "group mysqld_2 exists"); +ok ( $config->group("mysqld_1"), "group mysqld_1 exists"); +ok ( $config->group("mysqld.9"), "group mysqld.9 exists"); +ok ( $config->group("mysqld.9")->suffix() eq ".9", "group mysqld.9 has suffix .9"); + +ok ( $config->group("mysqld"), "group mysqld exists"); +ok ( $config->group("client"), "group client exists"); +ok ( !$config->group("mysqld_3"), "group mysqld_3 does not exist"); + +ok ( $config->options_in_group("mysqld") == 4, "options in [mysqld] is 4"); +ok ( $config->options_in_group("nonexist") == 0, "options in [nonexist] is 0"); + +{ + my @groups= $config->groups(); + ok(@groups == 5, "5 groups"); + my $idx= 0; + foreach my $name ('mysqld', 'mysqld_1', 'mysqld_2', 'mysqld.9', 'client') { + is($groups[$idx++]->name(), $name, "checking groups $idx"); + } +} + +{ + my @groups= $config->like("mysqld"); + ok(@groups == 4, "4 groups like mysqld"); + my $idx= 0; + foreach my $name ('mysqld', 'mysqld_1', 'mysqld_2', 'mysqld.9') { + is($groups[$idx++]->name(), $name, "checking like(\"mysqld\") $idx"); + } +} + +{ + my @groups= $config->like("not"); + ok(@groups == 0, "checking like(\"not\")"); +} + +is($config->first_like("mysqld_")->name(), "mysqld_1", "first_like"); + +is( $config->value('mysqld', 'option4'), undef, + "mysqld_option4 exists, does not have a value"); + +ok( $config->exists('mysqld', 'option4'), + "mysqld_option4 exists"); +ok( $config->exists('mysqld', 'option2'), + "mysqld_option2 exists"); +ok( !$config->exists('mysqld', 'option5'), + "mysqld_option5 does not exists"); + +# Save the config to file +my $test2_cnf= "$dir/test2.cnf"; +$config->save($test2_cnf); + +# read it back and check it's the same +my $config2= My::Config->new($test2_cnf); +isa_ok( $config2, "My::Config" ); +is_deeply( \$config, \$config2, "test.cnf is equal to test2.cnf"); + + +my $test_include_cnf= "$dir/test_include.cnf"; +# Write test config file that includes test.cnf +open(OUT, ">", $test_include_cnf) or die; + +print OUT <<EOF +[mysqld] +!include test.cnf +# Comment +option1=values3 +basedir=anotherbasedir +EOF +; +close OUT; + +# Read the config file +my $config3= My::Config->new($test_include_cnf); +isa_ok( $config3, "My::Config" ); +print $config3; +is( $config3->value('mysqld', 'basedir'), 'anotherbasedir', + "mysqld_basedir has been overriden by value in test_include.cnf"); + +is( $config3->value('mysqld', 'option1'), 'values3', + "mysqld_option1 has been overriden by value in test_include.cnf"); + +is( $config3->value('mysqld', 'option2'), 'value4', + "mysqld_option2 is from included file"); + +is( $config3->value('client', 'socket'), 'asocketpath', + "client.socket is from included file"); + +is( $config3->value('mysqld', 'option4'), undef, + "mysqld_option4 exists, does not have a value"); + +print "$config3\n"; + diff --git a/mysql-test/lib/t/testMyConfigFactory.t b/mysql-test/lib/t/testMyConfigFactory.t new file mode 100755 index 00000000000..16fdd9db539 --- /dev/null +++ b/mysql-test/lib/t/testMyConfigFactory.t @@ -0,0 +1,98 @@ +#!/usr/bin/perl +# -*- cperl -*- + +use strict; +use warnings; + +use File::Temp qw / tempdir /; +my $dir = tempdir( CLEANUP => 1 ); + +use Test::More qw(no_plan); + +BEGIN { use_ok ( "My::ConfigFactory" ) }; + +my $gen1_cnf= "$dir/gen1.cnf"; +open(OUT, ">", $gen1_cnf) or die; + +print OUT <<EOF +[mysqld.master] +# Comment +option1=value1 +basedir=abasedir + +[mysqld.1] +# Comment +option1=value1 +option2=value2 + +[ENV] +MASTER_MY_PORT=\@mysqld.master.port + +EOF +; +close OUT; + +my $basedir= "../.."; + +my $config= My::ConfigFactory->new_config +( + { + basedir => $basedir, + template_path => $gen1_cnf, + vardir => "/path/to/var", + baseport => 10987, + #hosts => [ 'host1', 'host2' ], + } +); + +print $config; + +ok ( $config->group("mysqld.master"), "group mysqld.master exists"); +ok ( $config->group("mysqld.1"), "group mysqld.1 exists"); +ok ( $config->group("client"), "group client exists"); +ok ( !$config->group("mysqld.3"), "group mysqld.3 does not exist"); + +ok ( $config->first_like("mysqld"), "group like 'mysqld' exists"); + +is( $config->value('mysqld.1', '#host'), 'localhost', + "mysqld.1.#host has been generated"); + +is( $config->value('client', 'host'), 'localhost', + "client.host has been generated"); + +is( $config->value('client', 'host'), + $config->value('mysqld.master', '#host'), + "client.host is same as mysqld.master.host"); + +ok ( $config->value("mysqld.1", 'character-sets-dir') =~ /$basedir.*charsets$/, + "'character-sets-dir' generated"); + +ok ( $config->value("mysqld.1", 'language') =~ /$basedir.*english$/, + "'language' generated"); + +ok ( $config->value("ENV", 'MASTER_MY_PORT') =~ /\d/, + "'language' generated"); + +my $gen2_cnf= "$dir/gen2.cnf"; +open(OUT, ">", $gen2_cnf) or die; + +print OUT <<EOF +[mysqld.master] +EOF +; +close OUT; + +my $config2= My::ConfigFactory->new_config +( + { + basedir => $basedir, + template_path => $gen2_cnf, + vardir => "/path/to/var", + baseport => 10987, + #hosts => [ 'host1', 'host2' ], + } +); + +print $config2; + +ok ( $config2->first_like("mysqld"), "group like 'mysqld' exists"); diff --git a/mysql-test/lib/t/test_child.pl b/mysql-test/lib/t/test_child.pl new file mode 100755 index 00000000000..99f4e68003d --- /dev/null +++ b/mysql-test/lib/t/test_child.pl @@ -0,0 +1,21 @@ +#!/usr/bin/perl +# -*- cperl -*- + +use strict; +use Getopt::Long; + +my $opt_exit_code= 0; + +GetOptions + ( + # Exit with the specified exit code + 'exit-code=i' => \$opt_exit_code + ); + + +print "Hello stdout\n"; +print STDERR "Hello stderr\n"; + +exit ($opt_exit_code); + + diff --git a/mysql-test/lib/v1/My/Config.pm b/mysql-test/lib/v1/My/Config.pm new file mode 100644 index 00000000000..5491e341ddc --- /dev/null +++ b/mysql-test/lib/v1/My/Config.pm @@ -0,0 +1,422 @@ +# -*- cperl -*- + +package My::Config::Option; + +use strict; +use warnings; + + +sub new { + my ($class, $option_name, $option_value)= @_; + my $self= bless { name => $option_name, + value => $option_value + }, $class; + return $self; +} + + +sub name { + my ($self)= @_; + return $self->{name}; +} + + +sub value { + my ($self)= @_; + return $self->{value}; +} + + +package My::Config::Group; + +use strict; +use warnings; + + +sub new { + my ($class, $group_name)= @_; + my $self= bless { name => $group_name, + options => [], + options_by_name => {}, + }, $class; + return $self; +} + + +sub insert { + my ($self, $option_name, $value, $if_not_exist)= @_; + my $option= $self->option($option_name); + if (defined($option) and !$if_not_exist) { + $option->{value}= $value; + } + else { + my $option= My::Config::Option->new($option_name, $value); + # Insert option in list + push(@{$self->{options}}, $option); + # Insert option in hash + $self->{options_by_name}->{$option_name}= $option; + } + return $option; +} + +sub remove { + my ($self, $option_name)= @_; + + # Check that option exists + my $option= $self->option($option_name); + + return undef unless defined $option; + + # Remove from the hash + delete($self->{options_by_name}->{$option_name}) or die; + + # Remove from the array + @{$self->{options}}= grep { $_->name ne $option_name } @{$self->{options}}; + + return $option; +} + + +sub options { + my ($self)= @_; + return @{$self->{options}}; +} + + +sub name { + my ($self)= @_; + return $self->{name}; +} + + +# +# Return a specific option in the group +# +sub option { + my ($self, $option_name)= @_; + + return $self->{options_by_name}->{$option_name}; +} + + +# +# Return a specific value for an option in the group +# +sub value { + my ($self, $option_name)= @_; + my $option= $self->option($option_name); + + die "No option named '$option_name' in this group" + if ! defined($option); + + return $option->value(); +} + + +package My::Config; + +use strict; +use warnings; +use IO::File; +use File::Basename; + +# +# Constructor for My::Config +# - represents a my.cnf config file +# +# Array of arrays +# +sub new { + my ($class, $path)= @_; + my $group_name= undef; + + my $self= bless { groups => [] }, $class; + my $F= IO::File->new($path, "<") + or die "Could not open '$path': $!"; + + while ( my $line= <$F> ) { + chomp($line); + + # [group] + if ( $line =~ /\[(.*)\]/ ) { + # New group found + $group_name= $1; + #print "group: $group_name\n"; + + $self->insert($group_name, undef, undef); + } + + # Magic #! comments + elsif ( $line =~ /^#\!/) { + my $magic= $line; + die "Found magic comment '$magic' outside of group" + unless $group_name; + + #print "$magic\n"; + $self->insert($group_name, $magic, undef); + } + + # Comments + elsif ( $line =~ /^#/ || $line =~ /^;/) { + # Skip comment + next; + } + + # Empty lines + elsif ( $line =~ /^$/ ) { + # Skip empty lines + next; + } + + # !include <filename> + elsif ( $line =~ /^\!include\s*(.*?)\s*$/ ) { + my $include_file_name= dirname($path)."/".$1; + # Check that the file exists + die "The include file '$include_file_name' does not exist" + unless -f $include_file_name; + + $self->append(My::Config->new($include_file_name)); + } + + # <option> + elsif ( $line =~ /^([\@\w-]+)\s*$/ ) { + my $option= $1; + + die "Found option '$option' outside of group" + unless $group_name; + + #print "$option\n"; + $self->insert($group_name, $option, undef); + } + + # <option>=<value> + elsif ( $line =~ /^([\@\w-]+)\s*=\s*(.*?)\s*$/ ) { + my $option= $1; + my $value= $2; + + die "Found option '$option=$value' outside of group" + unless $group_name; + + #print "$option=$value\n"; + $self->insert($group_name, $option, $value); + } else { + die "Unexpected line '$line' found in '$path'"; + } + + } + undef $F; # Close the file + + return $self; +} + +# +# Insert a new group if it does not already exist +# and add option if defined +# +sub insert { + my ($self, $group_name, $option, $value, $if_not_exist)= @_; + my $group; + + # Create empty array for the group if it doesn't exist + if ( !$self->group_exists($group_name) ) { + $group= $self->_group_insert($group_name); + } + else { + $group= $self->group($group_name); + } + + if ( defined $option ) { + #print "option: $option, value: $value\n"; + + # Add the option to the group + $group->insert($option, $value, $if_not_exist); + } +} + +# +# Remove a option, given group and option name +# +sub remove { + my ($self, $group_name, $option_name)= @_; + my $group= $self->group($group_name); + + die "group '$group_name' does not exist" + unless defined($group); + + $group->remove($option_name) or + die "option '$option_name' does not exist"; +} + + + +# +# Check if group with given name exists in config +# +sub group_exists { + my ($self, $group_name)= @_; + + foreach my $group ($self->groups()) { + return 1 if $group->{name} eq $group_name; + } + return 0; +} + + +# +# Insert a new group into config +# +sub _group_insert { + my ($self, $group_name)= @_; + caller eq __PACKAGE__ or die; + + # Check that group does not already exist + die "Group already exists" if $self->group_exists($group_name); + + my $group= My::Config::Group->new($group_name); + push(@{$self->{groups}}, $group); + return $group; +} + + +# +# Append a configuration to current config +# +sub append { + my ($self, $from)= @_; + + foreach my $group ($from->groups()) { + foreach my $option ($group->options()) { + $self->insert($group->name(), $option->name(), $option->value()); + } + + } +} + + +# +# Return a list with all the groups in config +# +sub groups { + my ($self)= @_; + return ( @{$self->{groups}} ); +} + + +# +# Return a list of all the groups in config +# starting with the given string +# +sub like { + my ($self, $prefix)= @_; + return ( grep ( $_->{name} =~ /^$prefix/, $self->groups()) ); +} + + +# +# Return the first group in config +# starting with the given string +# +sub first_like { + my ($self, $prefix)= @_; + return ($self->like($prefix))[0]; +} + + +# +# Return a specific group in the config +# +sub group { + my ($self, $group_name)= @_; + + foreach my $group ( $self->groups() ) { + return $group if $group->{name} eq $group_name; + } + return undef; +} + + +# +# Return a list of all options in a specific group in the config +# +sub options_in_group { + my ($self, $group_name)= @_; + + my $group= $self->group($group_name); + return () unless defined $group; + return $group->options(); +} + + +# +# Return a value given group and option name +# +sub value { + my ($self, $group_name, $option_name)= @_; + my $group= $self->group($group_name); + + die "group '$group_name' does not exist" + unless defined($group); + + my $option= $group->option($option_name); + die "option '$option_name' does not exist" + unless defined($option); + + return $option->value(); +} + + +# +# Check if an option exists +# +sub exists { + my ($self, $group_name, $option_name)= @_; + my $group= $self->group($group_name); + + die "group '$group_name' does not exist" + unless defined($group); + + my $option= $group->option($option_name); + return defined($option); +} + + +# Overload "to string"-operator with 'stringify' +use overload + '""' => \&stringify; + +# +# Return the config as a string in my.cnf file format +# +sub stringify { + my ($self)= @_; + my $res; + + foreach my $group ($self->groups()) { + $res .= "[$group->{name}]\n"; + + foreach my $option ($group->options()) { + $res .= $option->name(); + my $value= $option->value(); + if (defined $value) { + $res .= "=$value"; + } + $res .= "\n"; + } + $res .= "\n"; + } + return $res; +} + + +# +# Save the config to named file +# +sub save { + my ($self, $path)= @_; + my $F= IO::File->new($path, ">") + or die "Could not open '$path': $!"; + print $F $self; + undef $F; # Close the file +} + +1; diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/v1/mtr_cases.pl index 1bb793fba49..4d7b1f4ec70 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/v1/mtr_cases.pl @@ -369,7 +369,7 @@ sub collect_one_suite($) my $comb= {}; $comb->{name}= $group->name(); foreach my $option ( $group->options() ) { - push(@{$comb->{comb_opt}}, $option->name()."=".$option->value()); + push(@{$comb->{comb_opt}}, "--".$option->name()."=".$option->value()); } push(@combinations, $comb); } @@ -511,10 +511,19 @@ sub collect_one_test_case($$$$$$$$$) { my $suite_opts= shift; my $path= "$testdir/$elem"; - my $name= basename($suite) . ".$tname"; + + # ---------------------------------------------------------------------- + # Skip some tests silently + # ---------------------------------------------------------------------- + + if ( $::opt_start_from and $tname lt $::opt_start_from ) + { + return; + } + my $tinfo= {}; - $tinfo->{'name'}= $name; + $tinfo->{'name'}= basename($suite) . ".$tname"; $tinfo->{'result_file'}= "$resdir/$tname.result"; $tinfo->{'component_id'} = $component_id; push(@$cases, $tinfo); @@ -523,7 +532,7 @@ sub collect_one_test_case($$$$$$$$$) { # Skip some tests but include in list, just mark them to skip # ---------------------------------------------------------------------- - if ( $skip_test and ($tname =~ /$skip_test/o || $name =~ /$skip_test/o)) + if ( $skip_test and $tname =~ /$skip_test/o ) { $tinfo->{'skip'}= 1; return; diff --git a/mysql-test/lib/v1/mtr_gcov.pl b/mysql-test/lib/v1/mtr_gcov.pl new file mode 100644 index 00000000000..a2de1fcbdff --- /dev/null +++ b/mysql-test/lib/v1/mtr_gcov.pl @@ -0,0 +1,74 @@ +# -*- cperl -*- +# Copyright (C) 2004, 2006 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +# This is a library file used by the Perl version of mysql-test-run, +# and is part of the translation of the Bourne shell script with the +# same name. + +use strict; + +# These are not to be prefixed with "mtr_" + +sub gcov_prepare (); +sub gcov_collect (); + +############################################################################## +# +# +# +############################################################################## + +sub gcov_prepare () { + + `find $::glob_basedir -name \*.gcov \ + -or -name \*.da | xargs rm`; +} + +# Used by gcov +our @mysqld_src_dirs= + ( + "strings", + "mysys", + "include", + "extra", + "regex", + "isam", + "merge", + "myisam", + "myisammrg", + "heap", + "sql", + ); + +sub gcov_collect () { + + print "Collecting source coverage info...\n"; + -f $::opt_gcov_msg and unlink($::opt_gcov_msg); + -f $::opt_gcov_err and unlink($::opt_gcov_err); + foreach my $d ( @mysqld_src_dirs ) + { + chdir("$::glob_basedir/$d"); + foreach my $f ( (glob("*.h"), glob("*.cc"), glob("*.c")) ) + { + `$::opt_gcov $f 2>>$::opt_gcov_err >>$::opt_gcov_msg`; + } + chdir($::glob_mysql_test_dir); + } + print "gcov info in $::opt_gcov_msg, errors in $::opt_gcov_err\n"; +} + + +1; diff --git a/mysql-test/lib/v1/mtr_gprof.pl b/mysql-test/lib/v1/mtr_gprof.pl new file mode 100644 index 00000000000..f6615301dd7 --- /dev/null +++ b/mysql-test/lib/v1/mtr_gprof.pl @@ -0,0 +1,64 @@ +# -*- cperl -*- +# Copyright (C) 2004 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +# This is a library file used by the Perl version of mysql-test-run, +# and is part of the translation of the Bourne shell script with the +# same name. + +use strict; + +# These are not to be prefixed with "mtr_" + +sub gprof_prepare (); +sub gprof_collect (); + +############################################################################## +# +# +# +############################################################################## + +sub gprof_prepare () { + + rmtree($::opt_gprof_dir); + mkdir($::opt_gprof_dir); +} + +# FIXME what about master1 and slave1?! +sub gprof_collect () { + + if ( -f "$::master->[0]->{'path_myddir'}/gmon.out" ) + { + # FIXME check result code?! + mtr_run("gprof", + [$::exe_master_mysqld, + "$::master->[0]->{'path_myddir'}/gmon.out"], + $::opt_gprof_master, "", "", ""); + print "Master execution profile has been saved in $::opt_gprof_master\n"; + } + if ( -f "$::slave->[0]->{'path_myddir'}/gmon.out" ) + { + # FIXME check result code?! + mtr_run("gprof", + [$::exe_slave_mysqld, + "$::slave->[0]->{'path_myddir'}/gmon.out"], + $::opt_gprof_slave, "", "", ""); + print "Slave execution profile has been saved in $::opt_gprof_slave\n"; + } +} + + +1; diff --git a/mysql-test/lib/mtr_im.pl b/mysql-test/lib/v1/mtr_im.pl index c8e332498d7..c8e332498d7 100644 --- a/mysql-test/lib/mtr_im.pl +++ b/mysql-test/lib/v1/mtr_im.pl diff --git a/mysql-test/lib/v1/mtr_io.pl b/mysql-test/lib/v1/mtr_io.pl new file mode 100644 index 00000000000..aa671c0f4f7 --- /dev/null +++ b/mysql-test/lib/v1/mtr_io.pl @@ -0,0 +1,218 @@ +# -*- cperl -*- +# Copyright (C) 2004-2006 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +# This is a library file used by the Perl version of mysql-test-run, +# and is part of the translation of the Bourne shell script with the +# same name. + +use strict; + +sub mtr_get_pid_from_file ($); +sub mtr_get_opts_from_file ($); +sub mtr_fromfile ($); +sub mtr_tofile ($@); +sub mtr_tonewfile($@); +sub mtr_lastlinefromfile($); +sub mtr_appendfile_to_file ($$); +sub mtr_grab_file($); + + +############################################################################## +# +# +# +############################################################################## + +sub mtr_get_pid_from_file ($) { + my $pid_file_path= shift; + my $TOTAL_ATTEMPTS= 30; + my $timeout= 1; + + # We should read from the file until we get correct pid. As it is + # stated in BUG#21884, pid file can be empty at some moment. So, we should + # read it until we get valid data. + + for (my $cur_attempt= 1; $cur_attempt <= $TOTAL_ATTEMPTS; ++$cur_attempt) + { + mtr_debug("Reading pid file '$pid_file_path' " . + "($cur_attempt of $TOTAL_ATTEMPTS)..."); + + open(FILE, '<', $pid_file_path) + or mtr_error("can't open file \"$pid_file_path\": $!"); + + # Read pid number from file + my $pid= <FILE>; + chomp $pid; + close FILE; + + return $pid if $pid=~ /^(\d+)/; + + mtr_debug("Pid file '$pid_file_path' does not yet contain pid number.\n" . + "Sleeping $timeout second(s) more..."); + + sleep($timeout); + } + + mtr_error("Pid file '$pid_file_path' is corrupted. " . + "Can not retrieve PID in " . + ($timeout * $TOTAL_ATTEMPTS) . " seconds."); +} + +sub mtr_get_opts_from_file ($) { + my $file= shift; + + open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!"); + my @args; + while ( <FILE> ) + { + chomp; + + # --set-variable=init_connect=set @a='a\\0c' + s/^\s+//; # Remove leading space + s/\s+$//; # Remove ending space + + # This is strange, but we need to fill whitespace inside + # quotes with something, to remove later. We do this to + # be able to split on space. Else, we have trouble with + # options like + # + # --someopt="--insideopt1 --insideopt2" + # + # But still with this, we are not 100% sure it is right, + # we need a shell to do it right. + +# print STDERR "\n"; +# print STDERR "AAA: $_\n"; + + s/\'([^\'\"]*)\'/unspace($1,"\x0a")/ge; + s/\"([^\'\"]*)\"/unspace($1,"\x0b")/ge; + s/\'([^\'\"]*)\'/unspace($1,"\x0a")/ge; + s/\"([^\'\"]*)\"/unspace($1,"\x0b")/ge; + +# print STDERR "BBB: $_\n"; + +# foreach my $arg (/(--?\w.*?)(?=\s+--?\w|$)/) + + # FIXME ENV vars should be expanded!!!! + + foreach my $arg (split(/[ \t]+/)) + { + $arg =~ tr/\x11\x0a\x0b/ \'\"/; # Put back real chars + # The outermost quotes has to go + $arg =~ s/^([^\'\"]*)\'(.*)\'([^\'\"]*)$/$1$2$3/ + or $arg =~ s/^([^\'\"]*)\"(.*)\"([^\'\"]*)$/$1$2$3/; + $arg =~ s/\\\\/\\/g; + + $arg =~ s/\$\{(\w+)\}/envsubst($1)/ge; + $arg =~ s/\$(\w+)/envsubst($1)/ge; + +# print STDERR "ARG: $arg\n"; + # Do not pass empty string since my_getopt is not capable to handle it. + if (length($arg)) + { + push(@args, $arg) + } + } + } + close FILE; + return \@args; +} + +sub envsubst { + my $string= shift; + + if ( ! defined $ENV{$string} ) + { + mtr_error("opt file referense \$$string that is unknown"); + } + + return $ENV{$string}; +} + +sub unspace { + my $string= shift; + my $quote= shift; + $string =~ s/[ \t]/\x11/g; + return "$quote$string$quote"; +} + +# Read a whole file, stripping leading and trailing whitespace. +sub mtr_fromfile ($) { + my $file= shift; + + open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!"); + my $text= join('', <FILE>); + close FILE; + $text =~ s/^\s+//; # Remove starting space, incl newlines + $text =~ s/\s+$//; # Remove ending space, incl newlines + return $text; +} + +sub mtr_lastlinefromfile ($) { + my $file= shift; + my $text; + + open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!"); + while (my $line= <FILE>) + { + $text= $line; + } + close FILE; + return $text; +} + + +sub mtr_tofile ($@) { + my $file= shift; + + open(FILE,">>",$file) or mtr_error("can't open file \"$file\": $!"); + print FILE join("", @_); + close FILE; +} + +sub mtr_tonewfile ($@) { + my $file= shift; + + open(FILE,">",$file) or mtr_error("can't open file \"$file\": $!"); + print FILE join("", @_); + close FILE; +} + +sub mtr_appendfile_to_file ($$) { + my $from_file= shift; + my $to_file= shift; + + open(TOFILE,">>",$to_file) or mtr_error("can't open file \"$to_file\": $!"); + open(FROMFILE,"<",$from_file) + or mtr_error("can't open file \"$from_file\": $!"); + print TOFILE while (<FROMFILE>); + close FROMFILE; + close TOFILE; +} + +# Read a whole file verbatim. +sub mtr_grab_file($) { + my $file= shift; + open(FILE, '<', $file) + or return undef; + local $/= undef; + my $data= scalar(<FILE>); + close FILE; + return $data; +} + + +1; diff --git a/mysql-test/lib/mtr_match.pl b/mysql-test/lib/v1/mtr_match.pl index 96aa43f4fa2..96aa43f4fa2 100644 --- a/mysql-test/lib/mtr_match.pl +++ b/mysql-test/lib/v1/mtr_match.pl diff --git a/mysql-test/lib/v1/mtr_misc.pl b/mysql-test/lib/v1/mtr_misc.pl new file mode 100644 index 00000000000..0173e8b8572 --- /dev/null +++ b/mysql-test/lib/v1/mtr_misc.pl @@ -0,0 +1,312 @@ +# -*- cperl -*- +# Copyright (C) 2004-2006 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +# This is a library file used by the Perl version of mysql-test-run, +# and is part of the translation of the Bourne shell script with the +# same name. + +use strict; +use File::Find; + +sub mtr_native_path($); +sub mtr_init_args ($); +sub mtr_add_arg ($$@); +sub mtr_path_exists(@); +sub mtr_script_exists(@); +sub mtr_file_exists(@); +sub mtr_exe_exists(@); +sub mtr_exe_maybe_exists(@); +sub mtr_copy_dir($$); +sub mtr_rmtree($); +sub mtr_same_opts($$); +sub mtr_cmp_opts($$); + +############################################################################## +# +# Misc +# +############################################################################## + +# Convert path to OS native format +sub mtr_native_path($) +{ + my $path= shift; + + # MySQL version before 5.0 still use cygwin, no need + # to convert path + return $path + if ($::mysql_version_id < 50000); + + $path=~ s/\//\\/g + if ($::glob_win32); + return $path; +} + + +# FIXME move to own lib + +sub mtr_init_args ($) { + my $args = shift; + $$args = []; # Empty list +} + +sub mtr_add_arg ($$@) { + my $args= shift; + my $format= shift; + my @fargs = @_; + + push(@$args, sprintf($format, @fargs)); +} + +############################################################################## + +# +# NOTE! More specific paths should be given before less specific. +# For example /client/debug should be listed before /client +# +sub mtr_path_exists (@) { + foreach my $path ( @_ ) + { + return $path if -e $path; + } + if ( @_ == 1 ) + { + mtr_error("Could not find $_[0]"); + } + else + { + mtr_error("Could not find any of " . join(" ", @_)); + } +} + + +# +# NOTE! More specific paths should be given before less specific. +# For example /client/debug should be listed before /client +# +sub mtr_script_exists (@) { + foreach my $path ( @_ ) + { + if($::glob_win32) + { + return $path if -f $path; + } + else + { + return $path if -x $path; + } + } + if ( @_ == 1 ) + { + mtr_error("Could not find $_[0]"); + } + else + { + mtr_error("Could not find any of " . join(" ", @_)); + } +} + + +# +# NOTE! More specific paths should be given before less specific. +# For example /client/debug should be listed before /client +# +sub mtr_file_exists (@) { + foreach my $path ( @_ ) + { + return $path if -e $path; + } + return ""; +} + + +# +# NOTE! More specific paths should be given before less specific. +# For example /client/debug should be listed before /client +# +sub mtr_exe_maybe_exists (@) { + my @path= @_; + + map {$_.= ".exe"} @path if $::glob_win32; + map {$_.= ".nlm"} @path if $::glob_netware; + foreach my $path ( @path ) + { + if($::glob_win32) + { + return $path if -f $path; + } + else + { + return $path if -x $path; + } + } + return ""; +} + + +# +# NOTE! More specific paths should be given before less specific. +# For example /client/debug should be listed before /client +# +sub mtr_exe_exists (@) { + my @path= @_; + if (my $path= mtr_exe_maybe_exists(@path)) + { + return $path; + } + # Could not find exe, show error + if ( @path == 1 ) + { + mtr_error("Could not find $path[0]"); + } + else + { + mtr_error("Could not find any of " . join(" ", @path)); + } +} + + +sub mtr_copy_dir($$) { + my $from_dir= shift; + my $to_dir= shift; + + # mtr_verbose("Copying from $from_dir to $to_dir"); + + mkpath("$to_dir"); + opendir(DIR, "$from_dir") + or mtr_error("Can't find $from_dir$!"); + for(readdir(DIR)) { + next if "$_" eq "." or "$_" eq ".."; + if ( -d "$from_dir/$_" ) + { + mtr_copy_dir("$from_dir/$_", "$to_dir/$_"); + next; + } + copy("$from_dir/$_", "$to_dir/$_"); + } + closedir(DIR); + +} + + +sub mtr_rmtree($) { + my ($dir)= @_; + mtr_verbose("mtr_rmtree: $dir"); + + # Try to use File::Path::rmtree. Recent versions + # handles removal of directories and files that don't + # have full permissions, while older versions + # may have a problem with that and we use our own version + + eval { rmtree($dir); }; + if ( $@ ) { + mtr_warning("rmtree($dir) failed, trying with File::Find..."); + + my $errors= 0; + + # chmod + find( { + no_chdir => 1, + wanted => sub { + chmod(0777, $_) + or mtr_warning("couldn't chmod(0777, $_): $!") and $errors++; + } + }, + $dir + ); + + # rm + finddepth( { + no_chdir => 1, + wanted => sub { + my $file= $_; + # Use special underscore (_) filehandle, caches stat info + if (!-l $file and -d _ ) { + rmdir($file) or + mtr_warning("couldn't rmdir($file): $!") and $errors++; + } else { + unlink($file) + or mtr_warning("couldn't unlink($file): $!") and $errors++; + } + } + }, + $dir + ); + + mtr_error("Failed to remove '$dir'") if $errors; + + mtr_report("OK, that worked!"); + } +} + + +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 +} + +# +# Compare two arrays and put all unequal elements into a new one +# +sub mtr_diff_opts ($$) { + my $l1= shift; + my $l2= shift; + my $f; + my $l= []; + foreach my $e1 (@$l1) + { + $f= undef; + foreach my $e2 (@$l2) + { + $f= 1 unless ($e1 ne $e2); + } + push(@$l, $e1) unless (defined $f); + } + foreach my $e2 (@$l2) + { + $f= undef; + foreach my $e1 (@$l1) + { + $f= 1 unless ($e1 ne $e2); + } + push(@$l, $e2) unless (defined $f); + } + return $l; +} + +1; diff --git a/mysql-test/lib/v1/mtr_process.pl b/mysql-test/lib/v1/mtr_process.pl new file mode 100644 index 00000000000..566ccfe0778 --- /dev/null +++ b/mysql-test/lib/v1/mtr_process.pl @@ -0,0 +1,1154 @@ +# -*- cperl -*- +# Copyright (C) 2004-2006 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +# This is a library file used by the Perl version of mysql-test-run, +# and is part of the translation of the Bourne shell script with the +# same name. + +use Socket; +use Errno; +use strict; + +use POSIX qw(WNOHANG SIGHUP); + +sub mtr_run ($$$$$$;$); +sub mtr_spawn ($$$$$$;$); +sub mtr_check_stop_servers ($); +sub mtr_kill_leftovers (); +sub mtr_wait_blocking ($); +sub mtr_record_dead_children (); +sub mtr_ndbmgm_start($$); +sub mtr_mysqladmin_start($$$); +sub mtr_exit ($); +sub sleep_until_file_created ($$$); +sub mtr_kill_processes ($); +sub mtr_ping_with_timeout($); +sub mtr_ping_port ($); + +# Local function +sub spawn_impl ($$$$$$$); + +############################################################################## +# +# Execute an external command +# +############################################################################## + +sub mtr_run ($$$$$$;$) { + my $path= shift; + my $arg_list_t= shift; + my $input= shift; + my $output= shift; + my $error= shift; + my $pid_file= shift; # Not used + my $spawn_opts= shift; + + return spawn_impl($path,$arg_list_t,'run',$input,$output,$error, + $spawn_opts); +} + +sub mtr_run_test ($$$$$$;$) { + my $path= shift; + my $arg_list_t= shift; + my $input= shift; + my $output= shift; + my $error= shift; + my $pid_file= shift; # Not used + my $spawn_opts= shift; + + return spawn_impl($path,$arg_list_t,'test',$input,$output,$error, + $spawn_opts); +} + +sub mtr_spawn ($$$$$$;$) { + my $path= shift; + my $arg_list_t= shift; + my $input= shift; + my $output= shift; + my $error= shift; + my $pid_file= shift; # Not used + my $spawn_opts= shift; + + return spawn_impl($path,$arg_list_t,'spawn',$input,$output,$error, + $spawn_opts); +} + + + +sub spawn_impl ($$$$$$$) { + my $path= shift; + my $arg_list_t= shift; + my $mode= shift; + my $input= shift; + my $output= shift; + my $error= shift; + my $spawn_opts= shift; + + if ( $::opt_script_debug ) + { + mtr_report(""); + mtr_debug("-" x 73); + mtr_debug("STDIN $input") if $input; + mtr_debug("STDOUT $output") if $output; + mtr_debug("STDERR $error") if $error; + mtr_debug("$mode: $path ", join(" ",@$arg_list_t)); + mtr_debug("spawn options:"); + if ($spawn_opts) + { + foreach my $key (sort keys %{$spawn_opts}) + { + mtr_debug(" - $key: $spawn_opts->{$key}"); + } + } + else + { + mtr_debug(" none"); + } + mtr_debug("-" x 73); + mtr_report(""); + } + + mtr_error("Can't spawn with empty \"path\"") unless defined $path; + + + FORK: + { + my $pid= fork(); + + if ( ! defined $pid ) + { + if ( $! == $!{EAGAIN} ) # See "perldoc Errno" + { + mtr_warning("Got EAGAIN from fork(), sleep 1 second and redo"); + sleep(1); + redo FORK; + } + + mtr_error("$path ($pid) can't be forked, error: $!"); + + } + + if ( $pid ) + { + select(STDOUT) if $::glob_win32_perl; + return spawn_parent_impl($pid,$mode,$path); + } + else + { + # Child, redirect output and exec + + $SIG{INT}= 'DEFAULT'; # Parent do some stuff, we don't + + my $log_file_open_mode = '>'; + + if ($spawn_opts and $spawn_opts->{'append_log_file'}) + { + $log_file_open_mode = '>>'; + } + + if ( $output ) + { + if ( $::glob_win32_perl ) + { + # Don't redirect stdout on ActiveState perl since this is + # just another thread in the same process. + } + elsif ( ! open(STDOUT,$log_file_open_mode,$output) ) + { + mtr_child_error("can't redirect STDOUT to \"$output\": $!"); + } + } + + if ( $error ) + { + if ( !$::glob_win32_perl and $output eq $error ) + { + if ( ! open(STDERR,">&STDOUT") ) + { + mtr_child_error("can't dup STDOUT: $!"); + } + } + else + { + if ( ! open(STDERR,$log_file_open_mode,$error) ) + { + mtr_child_error("can't redirect STDERR to \"$error\": $!"); + } + } + } + + if ( $input ) + { + if ( ! open(STDIN,"<",$input) ) + { + mtr_child_error("can't redirect STDIN to \"$input\": $!"); + } + } + + if ( ! exec($path,@$arg_list_t) ) + { + mtr_child_error("failed to execute \"$path\": $!"); + } + mtr_error("Should never come here 1!"); + } + mtr_error("Should never come here 2!"); + } + mtr_error("Should never come here 3!"); +} + + +sub spawn_parent_impl { + my $pid= shift; + my $mode= shift; + my $path= shift; + + if ( $mode eq 'run' or $mode eq 'test' ) + { + if ( $mode eq 'run' ) + { + # Simple run of command, wait blocking for it to return + my $ret_pid= waitpid($pid,0); + if ( $ret_pid != $pid ) + { + # The "simple" waitpid has failed, print debug info + # and try to handle the error + mtr_warning("waitpid($pid, 0) returned $ret_pid " . + "when waiting for '$path', error: '$!'"); + if ( $ret_pid == -1 ) + { + # waitpid returned -1, that would indicate the process + # no longer exist and waitpid couldn't wait for it. + return 1; + } + mtr_error("Error handling failed"); + } + + return mtr_process_exit_status($?); + } + else + { + # We run mysqltest and wait for it to return. But we try to + # catch dying mysqld processes as well. + # + # We do blocking waitpid() until we get the return from the + # "mysqltest" call. But if a mysqld process dies that we + # started, we take this as an error, and kill mysqltest. + + + my $exit_value= -1; + my $saved_exit_value; + my $ret_pid; # What waitpid() returns + + while ( ($ret_pid= waitpid(-1,0)) != -1 ) + { + # Someone terminated, don't know who. Collect + # status info first before $? is lost, + # but not $exit_value, this is flagged from + + my $timer_name= mtr_timer_timeout($::glob_timers, $ret_pid); + if ( $timer_name ) + { + if ( $timer_name eq "suite" ) + { + # We give up here + # FIXME we should only give up the suite, not all of the run? + print STDERR "\n"; + mtr_error("Test suite timeout"); + } + elsif ( $timer_name eq "testcase" ) + { + $saved_exit_value= 63; # Mark as timeout + kill(9, $pid); # Kill mysqltest + next; # Go on and catch the termination + } + } + + if ( $ret_pid == $pid ) + { + # We got termination of mysqltest, we are done + $exit_value= mtr_process_exit_status($?); + last; + } + + # One of the child processes died, unless this was expected + # mysqltest should be killed and test aborted + + check_expected_crash_and_restart($ret_pid); + } + + if ( $ret_pid != $pid ) + { + # We terminated the waiting because a "mysqld" process died. + # Kill the mysqltest process. + mtr_verbose("Kill mysqltest because another process died"); + kill(9,$pid); + + $ret_pid= waitpid($pid,0); + + if ( $ret_pid != $pid ) + { + mtr_error("$path ($pid) got lost somehow"); + } + } + + return $saved_exit_value || $exit_value; + } + } + else + { + # We spawned a process we don't wait for + return $pid; + } +} + + +# ---------------------------------------------------------------------- +# We try to emulate how an Unix shell calculates the exit code +# ---------------------------------------------------------------------- + +sub mtr_process_exit_status { + my $raw_status= shift; + + if ( $raw_status & 127 ) + { + return ($raw_status & 127) + 128; # Signal num + 128 + } + else + { + return $raw_status >> 8; # Exit code + } +} + + +############################################################################## +# +# Kill processes left from previous runs +# +############################################################################## + + +# Kill all processes(mysqld, ndbd, ndb_mgmd and im) that would conflict with +# this run +# Make sure to remove the PID file, if any. +# kill IM manager first, else it will restart the servers +sub mtr_kill_leftovers () { + + mtr_report("Killing Possible Leftover Processes"); + mtr_debug("mtr_kill_leftovers(): started."); + + my @kill_pids; + my %admin_pids; + + foreach my $srv (@{$::master}, @{$::slave}) + { + mtr_debug(" - mysqld " . + "(pid: $srv->{pid}; " . + "pid file: '$srv->{path_pid}'; " . + "socket: '$srv->{path_sock}'; ". + "port: $srv->{port})"); + + my $pid= mtr_mysqladmin_start($srv, "shutdown", 20); + + # Save the pid of the mysqladmin process + $admin_pids{$pid}= 1; + + push(@kill_pids,{ + pid => $srv->{'pid'}, + pidfile => $srv->{'path_pid'}, + sockfile => $srv->{'path_sock'}, + port => $srv->{'port'}, + }); + $srv->{'pid'}= 0; # Assume we are done with it + } + + if ( ! $::opt_skip_ndbcluster ) + { + + foreach my $cluster (@{$::clusters}) + { + + # Don't shut down a "running" cluster + next if $cluster->{'use_running'}; + + mtr_debug(" - cluster " . + "(pid: $cluster->{pid}; " . + "pid file: '$cluster->{path_pid})"); + + my $pid= mtr_ndbmgm_start($cluster, "shutdown"); + + # Save the pid of the ndb_mgm process + $admin_pids{$pid}= 1; + + push(@kill_pids,{ + pid => $cluster->{'pid'}, + pidfile => $cluster->{'path_pid'} + }); + + $cluster->{'pid'}= 0; # Assume we are done with it + + foreach my $ndbd (@{$cluster->{'ndbds'}}) + { + mtr_debug(" - ndbd " . + "(pid: $ndbd->{pid}; " . + "pid file: '$ndbd->{path_pid})"); + + push(@kill_pids,{ + pid => $ndbd->{'pid'}, + pidfile => $ndbd->{'path_pid'}, + }); + $ndbd->{'pid'}= 0; # Assume we are done with it + } + } + } + + # Wait for all the admin processes to complete + mtr_wait_blocking(\%admin_pids); + + # If we trusted "mysqladmin --shutdown_timeout= ..." we could just + # terminate now, but we don't (FIXME should be debugged). + # So we try again to ping and at least wait the same amount of time + # mysqladmin would for all to die. + + mtr_ping_with_timeout(\@kill_pids); + + # We now have tried to terminate nice. We have waited for the listen + # port to be free, but can't really tell if the mysqld process died + # or not. We now try to find the process PID from the PID file, and + # send a kill to that process. Note that Perl let kill(0,@pids) be + # a way to just return the numer of processes the kernel can send + # signals to. So this can be used (except on Cygwin) to determine + # if there are processes left running that we cound out might exists. + # + # But still after all this work, all we know is that we have + # the ports free. + + # We scan the "var/run/" directory for other process id's to kill + + my $rundir= "$::opt_vardir/run"; + + mtr_debug("Processing PID files in directory '$rundir'..."); + + if ( -d $rundir ) + { + opendir(RUNDIR, $rundir) + or mtr_error("can't open directory \"$rundir\": $!"); + + my @pids; + + while ( my $elem= readdir(RUNDIR) ) + { + # Only read pid from files that end with .pid + if ( $elem =~ /.*[.]pid$/) + { + my $pidfile= "$rundir/$elem"; + + if ( -f $pidfile ) + { + mtr_debug("Processing PID file: '$pidfile'..."); + + my $pid= mtr_get_pid_from_file($pidfile); + + mtr_debug("Got pid: $pid from file '$pidfile'"); + + if ( $::glob_cygwin_perl or kill(0, $pid) ) + { + mtr_debug("There is process with pid $pid -- scheduling for kill."); + push(@pids, $pid); # We know (cygwin guess) it exists + } + else + { + mtr_debug("There is no process with pid $pid -- skipping."); + } + } + } + } + closedir(RUNDIR); + + if ( @pids ) + { + mtr_debug("Killing the following processes with PID files: " . + join(' ', @pids) . "..."); + + start_reap_all(); + + if ( $::glob_cygwin_perl ) + { + # We have no (easy) way of knowing the Cygwin controlling + # process, in the PID file we only have the Windows process id. + system("kill -f " . join(" ",@pids)); # Hope for the best.... + mtr_debug("Sleep 5 seconds waiting for processes to die"); + sleep(5); + } + else + { + my $retries= 10; # 10 seconds + do + { + mtr_debug("Sending SIGKILL to pids: " . join(' ', @pids)); + kill(9, @pids); + mtr_report("Sleep 1 second waiting for processes to die"); + sleep(1) # Wait one second + } while ( $retries-- and kill(0, @pids) ); + + if ( kill(0, @pids) ) # Check if some left + { + mtr_warning("can't kill process(es) " . join(" ", @pids)); + } + } + + stop_reap_all(); + } + } + else + { + mtr_debug("Directory for PID files ($rundir) does not exist."); + } + + # We may have failed everything, but we now check again if we have + # the listen ports free to use, and if they are free, just go for it. + + mtr_debug("Checking known mysqld servers..."); + + foreach my $srv ( @kill_pids ) + { + if ( defined $srv->{'port'} and mtr_ping_port($srv->{'port'}) ) + { + mtr_warning("can't kill old process holding port $srv->{'port'}"); + } + } + + mtr_debug("mtr_kill_leftovers(): finished."); +} + + +# +# Check that all processes in "spec" are shutdown gracefully +# else kill them off hard +# +sub mtr_check_stop_servers ($) { + my $spec= shift; + + # Return if no processes are defined + return if ! @$spec; + + mtr_verbose("mtr_check_stop_servers"); + + # ---------------------------------------------------------------------- + # Wait until servers in "spec" has stopped listening + # to their ports or timeout occurs + # ---------------------------------------------------------------------- + mtr_ping_with_timeout(\@$spec); + + # ---------------------------------------------------------------------- + # Use waitpid() nonblocking for a little while, to see how + # many process's will exit sucessfully. + # This is the normal case. + # ---------------------------------------------------------------------- + my $wait_counter= 50; # Max number of times to redo the loop + foreach my $srv ( @$spec ) + { + my $pid= $srv->{'pid'}; + my $ret_pid; + if ( $pid ) + { + $ret_pid= waitpid($pid,&WNOHANG); + if ($ret_pid == $pid) + { + mtr_verbose("Caught exit of process $ret_pid"); + $srv->{'pid'}= 0; + } + elsif ($ret_pid == 0) + { + mtr_verbose("Process $pid is still alive"); + if ($wait_counter-- > 0) + { + # Give the processes more time to exit + select(undef, undef, undef, (0.1)); + redo; + } + } + else + { + mtr_warning("caught exit of unknown child $ret_pid"); + } + } + } + + # ---------------------------------------------------------------------- + # The processes that haven't yet exited need to + # be killed hard, put them in "kill_pids" hash + # ---------------------------------------------------------------------- + my %kill_pids; + foreach my $srv ( @$spec ) + { + my $pid= $srv->{'pid'}; + if ( $pid ) + { + # Server is still alive, put it in list to be hard killed + if ($::glob_win32_perl) + { + # Kill the real process if it's known + $pid= $srv->{'real_pid'} if ($srv->{'real_pid'}); + } + $kill_pids{$pid}= 1; + + # Write a message to the process's error log (if it has one) + # that it's being killed hard. + if ( defined $srv->{'errfile'} ) + { + mtr_tofile($srv->{'errfile'}, "Note: Forcing kill of process $pid\n"); + } + mtr_warning("Forcing kill of process $pid"); + + } + else + { + # Server is dead, remove the pidfile if it exists + # + # Race, could have been removed between test with -f + # and the unlink() below, so better check again with -f + if ( -f $srv->{'pidfile'} and ! unlink($srv->{'pidfile'}) and + -f $srv->{'pidfile'} ) + { + mtr_error("can't remove $srv->{'pidfile'}"); + } + } + } + + if ( ! keys %kill_pids ) + { + # All processes has exited gracefully + return; + } + + mtr_kill_processes(\%kill_pids); + + # ---------------------------------------------------------------------- + # All processes are killed, cleanup leftover files + # ---------------------------------------------------------------------- + { + my $errors= 0; + foreach my $srv ( @$spec ) + { + if ( $srv->{'pid'} ) + { + # Server has been hard killed, clean it's resources + foreach my $file ($srv->{'pidfile'}, $srv->{'sockfile'}) + { + # Know it is dead so should be no race, careful anyway + if ( defined $file and -f $file and ! unlink($file) and -f $file ) + { + $errors++; + mtr_warning("couldn't delete $file"); + } + } + + if ($::glob_win32_perl and $srv->{'real_pid'}) + { + # Wait for the pseudo pid - if the real_pid was known + # the pseudo pid has not been waited for yet, wai blocking + # since it's "such a simple program" + mtr_verbose("Wait for pseudo process $srv->{'pid'}"); + my $ret_pid= waitpid($srv->{'pid'}, 0); + mtr_verbose("Pseudo process $ret_pid died"); + } + + $srv->{'pid'}= 0; + } + } + if ( $errors ) + { + # There where errors killing processes + # do one last attempt to ping the servers + # and if they can't be pinged, assume they are dead + if ( ! mtr_ping_with_timeout( \@$spec ) ) + { + mtr_error("we could not kill or clean up all processes"); + } + else + { + mtr_verbose("All ports were free, continuing"); + } + } + } +} + + +# Wait for all the process in the list to terminate +sub mtr_wait_blocking($) { + my $admin_pids= shift; + + + # Return if no processes defined + return if ! %$admin_pids; + + mtr_verbose("mtr_wait_blocking"); + + # Wait for all the started processes to exit + # As mysqladmin is such a simple program, we trust it to terminate itself. + # I.e. we wait blocking, and wait for them all before we go on. + foreach my $pid (keys %{$admin_pids}) + { + my $ret_pid= waitpid($pid,0); + + } +} + +# Start "mysqladmin <command>" for a specific mysqld +sub mtr_mysqladmin_start($$$) { + my $srv= shift; + my $command= shift; + my $adm_shutdown_tmo= shift; + + my $args; + mtr_init_args(\$args); + + mtr_add_arg($args, "--no-defaults"); + mtr_add_arg($args, "--user=%s", $::opt_user); + mtr_add_arg($args, "--password="); + mtr_add_arg($args, "--silent"); + if ( -e $srv->{'path_sock'} ) + { + mtr_add_arg($args, "--socket=%s", $srv->{'path_sock'}); + } + if ( $srv->{'port'} ) + { + mtr_add_arg($args, "--port=%s", $srv->{'port'}); + } + if ( $srv->{'port'} and ! -e $srv->{'path_sock'} ) + { + mtr_add_arg($args, "--protocol=tcp"); # Needed if no --socket + } + mtr_add_arg($args, "--connect_timeout=5"); + + # Shutdown time must be high as slave may be in reconnect + mtr_add_arg($args, "--shutdown_timeout=$adm_shutdown_tmo"); + mtr_add_arg($args, "$command"); + my $pid= mtr_spawn($::exe_mysqladmin, $args, + "", "", "", "", + { append_log_file => 1 }); + mtr_verbose("mtr_mysqladmin_start, pid: $pid"); + return $pid; + +} + +# Start "ndb_mgm shutdown" for a specific cluster, it will +# shutdown all data nodes and leave the ndb_mgmd running +sub mtr_ndbmgm_start($$) { + my $cluster= shift; + my $command= shift; + + my $args; + + mtr_init_args(\$args); + + mtr_add_arg($args, "--no-defaults"); + mtr_add_arg($args, "--core"); + mtr_add_arg($args, "--try-reconnect=1"); + mtr_add_arg($args, "--ndb_connectstring=%s", $cluster->{'connect_string'}); + mtr_add_arg($args, "-e"); + mtr_add_arg($args, "$command"); + + my $pid= mtr_spawn($::exe_ndb_mgm, $args, + "", "/dev/null", "/dev/null", "", + {}); + mtr_verbose("mtr_ndbmgm_start, pid: $pid"); + return $pid; + +} + + +# Ping all servers in list, exit when none of them answers +# or when timeout has passed +sub mtr_ping_with_timeout($) { + my $spec= shift; + my $timeout= 200; # 20 seconds max + my $res= 1; # If we just fall through, we are done + # in the sense that the servers don't + # listen to their ports any longer + + mtr_debug("Waiting for mysqld servers to stop..."); + + TIME: + while ( $timeout-- ) + { + foreach my $srv ( @$spec ) + { + $res= 1; # We are optimistic + if ( $srv->{'pid'} and defined $srv->{'port'} ) + { + if ( mtr_ping_port($srv->{'port'}) ) + { + mtr_verbose("waiting for process $srv->{'pid'} to stop ". + "using port $srv->{'port'}"); + + # Millisceond sleep emulated with select + select(undef, undef, undef, (0.1)); + $res= 0; + next TIME; + } + else + { + # Process was not using port + } + } + } + last; # If we got here, we are done + } + + if ($res) + { + mtr_debug("mtr_ping_with_timeout(): All mysqld instances are down."); + } + else + { + mtr_report("mtr_ping_with_timeout(): At least one server is alive."); + } + + return $res; +} + + +# +# Loop through our list of processes and look for and entry +# with the provided pid +# Set the pid of that process to 0 if found +# +sub mark_process_dead($) +{ + my $ret_pid= shift; + + foreach my $mysqld (@{$::master}, @{$::slave}) + { + if ( $mysqld->{'pid'} eq $ret_pid ) + { + mtr_verbose("$mysqld->{'type'} $mysqld->{'idx'} exited, pid: $ret_pid"); + $mysqld->{'pid'}= 0; + return; + } + } + + foreach my $cluster (@{$::clusters}) + { + if ( $cluster->{'pid'} eq $ret_pid ) + { + mtr_verbose("$cluster->{'name'} cluster ndb_mgmd exited, pid: $ret_pid"); + $cluster->{'pid'}= 0; + return; + } + + foreach my $ndbd (@{$cluster->{'ndbds'}}) + { + if ( $ndbd->{'pid'} eq $ret_pid ) + { + mtr_verbose("$cluster->{'name'} cluster ndbd exited, pid: $ret_pid"); + $ndbd->{'pid'}= 0; + return; + } + } + } + mtr_warning("mark_process_dead couldn't find an entry for pid: $ret_pid"); + +} + +# +# Loop through our list of processes and look for and entry +# with the provided pid, if found check for the file indicating +# expected crash and restart it. +# +sub check_expected_crash_and_restart($) +{ + my $ret_pid= shift; + + foreach my $mysqld (@{$::master}, @{$::slave}) + { + if ( $mysqld->{'pid'} eq $ret_pid ) + { + mtr_verbose("$mysqld->{'type'} $mysqld->{'idx'} exited, pid: $ret_pid"); + $mysqld->{'pid'}= 0; + + # Check if crash expected, and restart if it was + my $expect_file= "$::opt_vardir/tmp/" . "$mysqld->{'type'}" . + "$mysqld->{'idx'}" . ".expect"; + while ( 1 ) + { + if ( -f $expect_file ) + { + mtr_verbose("Crash was expected, file $expect_file exists"); + my $expect_file_handler; + open($expect_file_handler, "<$expect_file") or die; + my @expect_lines= <$expect_file_handler>; + close $expect_file_handler; + # look at most recent order by the test + my $expect_content= pop @expect_lines; + chomp $expect_content; + if ( $expect_content =~ /^wait/ ) + { + mtr_verbose("Test asks that we wait before restart"); + # Millisceond sleep emulated with select + select(undef, undef, undef, (0.1)); + next; + } + unlink($expect_file); + mysqld_start($mysqld, $mysqld->{'start_opts'}, + $mysqld->{'start_slave_master_info'}); + } + last; + } + + return; + } + } + + foreach my $cluster (@{$::clusters}) + { + if ( $cluster->{'pid'} eq $ret_pid ) + { + mtr_verbose("$cluster->{'name'} cluster ndb_mgmd exited, pid: $ret_pid"); + $cluster->{'pid'}= 0; + + # Check if crash expected and restart if it was + my $expect_file= "$::opt_vardir/tmp/ndb_mgmd_" . "$cluster->{'type'}" . + ".expect"; + if ( -f $expect_file ) + { + mtr_verbose("Crash was expected, file $expect_file exists"); + unlink($expect_file); + ndbmgmd_start($cluster); + } + return; + } + + foreach my $ndbd (@{$cluster->{'ndbds'}}) + { + if ( $ndbd->{'pid'} eq $ret_pid ) + { + mtr_verbose("$cluster->{'name'} cluster ndbd exited, pid: $ret_pid"); + $ndbd->{'pid'}= 0; + + # Check if crash expected and restart if it was + my $expect_file= "$::opt_vardir/tmp/ndbd_" . "$cluster->{'type'}" . + "$ndbd->{'idx'}" . ".expect"; + if ( -f $expect_file ) + { + mtr_verbose("Crash was expected, file $expect_file exists"); + unlink($expect_file); + ndbd_start($cluster, $ndbd->{'idx'}, + $ndbd->{'start_extra_args'}); + } + return; + } + } + } + + if ($::instance_manager->{'spawner_pid'} eq $ret_pid) + { + return; + } + + mtr_warning("check_expected_crash_and_restart couldn't find an entry for pid: $ret_pid"); + +} + +############################################################################## +# +# The operating system will keep information about dead children, +# we read this information here, and if we have records the process +# is alive, we mark it as dead. +# +############################################################################## + +sub mtr_record_dead_children () { + + my $process_died= 0; + my $ret_pid; + + # Wait without blockinng to see if any processes had died + # -1 or 0 means there are no more procesess to wait for + while ( ($ret_pid= waitpid(-1,&WNOHANG)) != 0 and $ret_pid != -1) + { + mtr_warning("mtr_record_dead_children: $ret_pid"); + mark_process_dead($ret_pid); + $process_died= 1; + } + return $process_died; +} + +sub start_reap_all { + # 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. + my $pid; + while(($pid= waitpid(-1, &WNOHANG)) != 0 and $pid != -1) + { + mtr_warning("start_reap_all pid: $pid"); + mark_process_dead($pid); + }; +} + +sub stop_reap_all { + $SIG{CHLD}= 'DEFAULT'; +} + + +sub mtr_ping_port ($) { + my $port= shift; + + mtr_verbose("mtr_ping_port: $port"); + + my $remote= "localhost"; + my $iaddr= inet_aton($remote); + if ( ! $iaddr ) + { + mtr_error("can't find IP number for $remote"); + } + my $paddr= sockaddr_in($port, $iaddr); + my $proto= getprotobyname('tcp'); + if ( ! socket(SOCK, PF_INET, SOCK_STREAM, $proto) ) + { + mtr_error("can't create socket: $!"); + } + + mtr_debug("Pinging server (port: $port)..."); + + if ( connect(SOCK, $paddr) ) + { + close(SOCK); # FIXME check error? + mtr_verbose("USED"); + return 1; + } + else + { + mtr_verbose("FREE"); + return 0; + } +} + +############################################################################## +# +# Wait for a file to be created +# +############################################################################## + +# FIXME check that the pidfile contains the expected pid! + +sub sleep_until_file_created ($$$) { + my $pidfile= shift; + my $timeout= shift; + my $pid= shift; + my $sleeptime= 100; # Milliseconds + my $loops= ($timeout * 1000) / $sleeptime; + + for ( my $loop= 1; $loop <= $loops; $loop++ ) + { + if ( -r $pidfile ) + { + return 1; + } + + # Check if it died after the fork() was successful + if ( $pid != 0 && waitpid($pid,&WNOHANG) == $pid ) + { + mtr_warning("Process $pid died"); + return 0; + } + + mtr_debug("Sleep $sleeptime milliseconds waiting for $pidfile"); + + # Print extra message every 60 seconds + my $seconds= ($loop * $sleeptime) / 1000; + if ( $seconds > 1 and int($seconds * 10) % 600 == 0 ) + { + my $left= $timeout - $seconds; + mtr_warning("Waited $seconds seconds for $pidfile to be created, " . + "still waiting for $left seconds..."); + } + + # Millisceond sleep emulated with select + select(undef, undef, undef, ($sleeptime/1000)); + } + + return 0; +} + + +sub mtr_kill_processes ($) { + my $pids = shift; + + mtr_verbose("mtr_kill_processes (" . join(" ", keys %{$pids}) . ")"); + + foreach my $pid (keys %{$pids}) + { + + if ($pid <= 0) + { + mtr_warning("Trying to kill illegal pid: $pid"); + next; + } + + my $signaled_procs= kill(9, $pid); + if ($signaled_procs == 0) + { + # No such process existed, assume it's killed + mtr_verbose("killed $pid(no such process)"); + } + else + { + my $ret_pid= waitpid($pid,0); + if ($ret_pid == $pid) + { + mtr_verbose("killed $pid(got the pid)"); + } + elsif ($ret_pid == -1) + { + mtr_verbose("killed $pid(got -1)"); + } + } + } + mtr_verbose("done killing processes"); +} + + +############################################################################## +# +# When we exit, we kill off all children +# +############################################################################## + +sub mtr_exit ($) { + my $code= shift; + mtr_timer_stop_all($::glob_timers); + local $SIG{HUP} = 'IGNORE'; + # ToDo: Signalling -$$ will only work if we are the process group + # leader (in fact on QNX it will signal our session group leader, + # which might be Do-compile or Pushbuild, causing tests to be + # aborted). So we only do it if we are the group leader. We might + # set ourselves as the group leader at startup (with + # POSIX::setpgrp(0,0)), but then care must be needed to always do + # proper child process cleanup. + POSIX::kill(SIGHUP, -$$) if !$::glob_win32_perl and $$ == getpgrp(); + + exit($code); +} + +########################################################################### + +1; diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/v1/mtr_report.pl index 7daf6743b03..7daf6743b03 100644 --- a/mysql-test/lib/mtr_report.pl +++ b/mysql-test/lib/v1/mtr_report.pl diff --git a/mysql-test/lib/v1/mtr_stress.pl b/mysql-test/lib/v1/mtr_stress.pl new file mode 100644 index 00000000000..93b06b32c5f --- /dev/null +++ b/mysql-test/lib/v1/mtr_stress.pl @@ -0,0 +1,191 @@ +# -*- cperl -*- +# Copyright (C) 2006 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +# This is a library file used by the Perl version of mysql-test-run, +# and is part of the translation of the Bourne shell script with the +# same name. + +use strict; +use File::Spec; + +# These are not to be prefixed with "mtr_" + +sub run_stress_test (); + +############################################################################## +# +# Run tests in the stress mode +# +############################################################################## + +sub run_stress_test () +{ + + my $args; + my $stress_suitedir; + + mtr_report("Starting stress testing\n"); + + if ( ! $::glob_use_embedded_server ) + { + if ( ! mysqld_start($::master->[0],[],[]) ) + { + mtr_error("Can't start the mysqld server"); + } + } + + my $stress_basedir=File::Spec->catdir($::opt_vardir, "stress"); + + #Clean up stress dir + if ( -d $stress_basedir ) + { + rmtree($stress_basedir); + } + mkpath($stress_basedir); + + if ($::opt_stress_suite ne 'main' && $::opt_stress_suite ne 'default' ) + { + $stress_suitedir=File::Spec->catdir($::glob_mysql_test_dir, "suite", + $::opt_stress_suite); + } + else + { + $stress_suitedir=$::glob_mysql_test_dir; + } + + if ( -d $stress_suitedir ) + { + #$stress_suite_t_dir=File::Spec->catdir($stress_suitedir, "t"); + #$stress_suite_r_dir=File::Spec->catdir($stress_suitedir, "r"); + #FIXME: check dirs above for existence to ensure that test suite + # contains tests and results dirs + } + else + { + mtr_error("Specified test suite $::opt_stress_suite doesn't exist"); + } + + if ( @::opt_cases ) + { + $::opt_stress_test_file=File::Spec->catfile($stress_basedir, "stress_tests.txt"); + open(STRESS_FILE, ">$::opt_stress_test_file"); + print STRESS_FILE join("\n",@::opt_cases),"\n"; + close(STRESS_FILE); + } + elsif ( $::opt_stress_test_file ) + { + $::opt_stress_test_file=File::Spec->catfile($stress_suitedir, + $::opt_stress_test_file); + if ( ! -f $::opt_stress_test_file ) + { + mtr_error("Specified file $::opt_stress_test_file with list of tests does not exist\n", + "Please ensure that file exists and has proper permissions"); + } + } + else + { + $::opt_stress_test_file=File::Spec->catfile($stress_suitedir, + "stress_tests.txt"); + if ( ! -f $::opt_stress_test_file ) + { + mtr_error("Default file $::opt_stress_test_file with list of tests does not exist\n", + "Please use --stress-test-file option to specify custom one or you can\n", + "just specify name of test for testing as last argument in command line"); + + } + } + + if ( $::opt_stress_init_file ) + { + $::opt_stress_init_file=File::Spec->catfile($stress_suitedir, + $::opt_stress_init_file); + if ( ! -f $::opt_stress_init_file ) + { + mtr_error("Specified file $::opt_stress_init_file with list of tests does not exist\n", + "Please ensure that file exists and has proper permissions"); + } + } + else + { + $::opt_stress_init_file=File::Spec->catfile($stress_suitedir, + "stress_init.txt"); + if ( ! -f $::opt_stress_init_file ) + { + $::opt_stress_init_file=''; + } + } + + if ( $::opt_stress_mode ne 'random' && $::opt_stress_mode ne 'seq' ) + { + mtr_error("You specified wrong mode $::opt_stress_mode for stress test\n", + "Correct values are 'random' or 'seq'"); + } + + mtr_init_args(\$args); + + mtr_add_arg($args, "--server-socket=%s", $::master->[0]->{'path_sock'}); + mtr_add_arg($args, "--server-user=%s", $::opt_user); + mtr_add_arg($args, "--server-database=%s", "test"); + mtr_add_arg($args, "--stress-suite-basedir=%s", $::glob_mysql_test_dir); + mtr_add_arg($args, "--suite=%s", $::opt_stress_suite); + mtr_add_arg($args, "--stress-tests-file=%s", $::opt_stress_test_file); + mtr_add_arg($args, "--stress-basedir=%s", $stress_basedir); + mtr_add_arg($args, "--server-logs-dir=%s", $stress_basedir); + mtr_add_arg($args, "--stress-mode=%s", $::opt_stress_mode); + mtr_add_arg($args, "--mysqltest=%s", $::exe_mysqltest); + mtr_add_arg($args, "--threads=%s", $::opt_stress_threads); + mtr_add_arg($args, "--verbose"); + mtr_add_arg($args, "--cleanup"); + mtr_add_arg($args, "--log-error-details"); + mtr_add_arg($args, "--abort-on-error"); + + if ( $::opt_stress_init_file ) + { + mtr_add_arg($args, "--stress-init-file=%s", $::opt_stress_init_file); + } + + if ( !$::opt_stress_loop_count && !$::opt_stress_test_count && + !$::opt_stress_test_duration ) + { + #Limit stress testing with 20 loops in case when any limit parameter + #was specified + $::opt_stress_test_count=20; + } + + if ( $::opt_stress_loop_count ) + { + mtr_add_arg($args, "--loop-count=%s", $::opt_stress_loop_count); + } + + if ( $::opt_stress_test_count ) + { + mtr_add_arg($args, "--test-count=%s", $::opt_stress_test_count); + } + + if ( $::opt_stress_test_duration ) + { + mtr_add_arg($args, "--test-duration=%s", $::opt_stress_test_duration); + } + + #Run stress test + mtr_run("$::glob_mysql_test_dir/mysql-stress-test.pl", $args, "", "", "", ""); + if ( ! $::glob_use_embedded_server ) + { + stop_all_servers(); + } +} + +1; diff --git a/mysql-test/lib/mtr_timer.pl b/mysql-test/lib/v1/mtr_timer.pl index 326fbea74ec..326fbea74ec 100644 --- a/mysql-test/lib/mtr_timer.pl +++ b/mysql-test/lib/v1/mtr_timer.pl diff --git a/mysql-test/lib/mtr_unique.pl b/mysql-test/lib/v1/mtr_unique.pl index a668fc097c7..a668fc097c7 100644 --- a/mysql-test/lib/mtr_unique.pl +++ b/mysql-test/lib/v1/mtr_unique.pl diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl new file mode 100755 index 00000000000..a691003abcb --- /dev/null +++ b/mysql-test/lib/v1/mysql-test-run.pl @@ -0,0 +1,5486 @@ +#!/usr/bin/perl +# -*- cperl -*- + +# +############################################################################## +# +# mysql-test-run.pl +# +# Tool used for executing a suite of .test file +# +# See the "MySQL Test framework manual" for more information +# http://dev.mysql.com/doc/mysqltest/en/index.html +# +# Please keep the test framework tools identical in all versions! +# +############################################################################## +# +# Coding style directions for this perl script +# +# - To make this Perl script easy to alter even for those that not +# code Perl that often, keeep the coding style as close as possible to +# the C/C++ MySQL coding standard. +# +# - All lists of arguments to send to commands are Perl lists/arrays, +# not strings we append args to. Within reason, most string +# concatenation for arguments should be avoided. +# +# - Functions defined in the main program are not to be prefixed, +# functions in "library files" are to be prefixed with "mtr_" (for +# Mysql-Test-Run). There are some exceptions, code that fits best in +# the main program, but are put into separate files to avoid +# clutter, may be without prefix. +# +# - All stat/opendir/-f/ is to be kept in collect_test_cases(). It +# will create a struct that the rest of the program can use to get +# the information. This separates the "find information" from the +# "do the work" and makes the program more easy to maintain. +# +# - The rule when it comes to the logic of this program is +# +# command_line_setup() - is to handle the logic between flags +# collect_test_cases() - is to do its best to select what tests +# to run, dig out options, if needs restart etc. +# run_testcase() - is to run a single testcase, and follow the +# logic set in both above. No, or rare file +# system operations. If a test seems complex, +# it should probably not be here. +# +# A nice way to trace the execution of this script while debugging +# is to use the Devel::Trace package found at +# "http://www.plover.com/~mjd/perl/Trace/" and run this script like +# "perl -d:Trace mysql-test-run.pl" +# + + +use lib "lib/v1/"; + +$Devel::Trace::TRACE= 0; # Don't trace boring init stuff + +#require 5.6.1; +use File::Path; +use File::Basename; +use File::Copy; +use File::Temp qw /tempdir/; +use File::Spec::Functions qw /splitdir/; +use Cwd; +use Getopt::Long; +use IO::Socket; +use IO::Socket::INET; +use strict; +use warnings; + +select(STDOUT); +$| = 1; # Automatically flush STDOUT + +our $glob_win32_perl= ($^O eq "MSWin32"); # ActiveState Win32 Perl +our $glob_cygwin_perl= ($^O eq "cygwin"); # Cygwin Perl +our $glob_win32= ($glob_win32_perl or $glob_cygwin_perl); +our $glob_netware= ($^O eq "NetWare"); # NetWare + +require "lib/v1/mtr_cases.pl"; +require "lib/v1/mtr_im.pl"; +require "lib/v1/mtr_process.pl"; +require "lib/v1/mtr_timer.pl"; +require "lib/v1/mtr_io.pl"; +require "lib/v1/mtr_gcov.pl"; +require "lib/v1/mtr_gprof.pl"; +require "lib/v1/mtr_report.pl"; +require "lib/v1/mtr_match.pl"; +require "lib/v1/mtr_misc.pl"; +require "lib/v1/mtr_stress.pl"; +require "lib/v1/mtr_unique.pl"; + +$Devel::Trace::TRACE= 1; + +############################################################################## +# +# Default settings +# +############################################################################## + +# Misc global variables +our $mysql_version_id; +our $glob_mysql_test_dir= undef; +our $glob_mysql_bench_dir= undef; +our $glob_scriptname= undef; +our $glob_timers= undef; +our $glob_use_embedded_server= 0; +our @glob_test_mode; + +our $glob_basedir; + +our $path_charsetsdir; +our $path_client_bindir; +our $path_client_libdir; +our $path_share; +our $path_language; +our $path_timefile; +our $path_snapshot; +our $path_mysqltest_log; +our $path_current_test_log; +our $path_my_basedir; + +our $opt_vardir; # A path but set directly on cmd line +our $path_vardir_trace; # unix formatted opt_vardir for trace files +our $opt_tmpdir; # A path but set directly on cmd line + +# Visual Studio produces executables in different sub-directories based on the +# configuration used to build them. To make life easier, an environment +# variable or command-line option may be specified to control which set of +# executables will be used by the test suite. +our $opt_vs_config = $ENV{'MTR_VS_CONFIG'}; + +our $default_vardir; + +our $opt_usage; +our $opt_list_options; +our $opt_suites; +our $opt_suites_default= "main,binlog,rpl,rpl_ndb,ndb,maria"; # Default suites to run +our $opt_script_debug= 0; # Script debugging, enable with --script-debug +our $opt_verbose= 0; # Verbose output, enable with --verbose + +our $exe_master_mysqld; +our $exe_mysql; +our $exe_mysqladmin; +our $exe_mysql_upgrade; +our $exe_mysqlbinlog; +our $exe_mysql_client_test; +our $exe_bug25714; +our $exe_mysqld; +our $exe_mysqlcheck; +our $exe_mysqldump; +our $exe_mysqlslap; +our $exe_mysqlimport; +our $exe_mysqlshow; +our $exe_mysql_fix_system_tables; +our $file_mysql_fix_privilege_tables; +our $exe_mysqltest; +our $exe_ndbd; +our $exe_ndb_mgmd; +our $exe_slave_mysqld; +our $exe_im; +our $exe_my_print_defaults; +our $exe_perror; +our $lib_udf_example; +our $lib_example_plugin; +our $exe_libtool; + +our $opt_bench= 0; +our $opt_small_bench= 0; +our $opt_big_test= 0; + +our @opt_combinations; +our $opt_skip_combination; + +our @opt_extra_mysqld_opt; +our @opt_extra_mysqltest_opt; + +our $opt_compress; +our $opt_ssl; +our $opt_ssl_supported; +our $opt_ps_protocol; +our $opt_sp_protocol; +our $opt_cursor_protocol; +our $opt_view_protocol; + +our $opt_debug; +our $opt_do_test; +our @opt_cases; # The test cases names in argv +our $opt_embedded_server; + +our $opt_extern= 0; +our $opt_socket; + +our $opt_fast; +our $opt_force; +our $opt_reorder= 0; +our $opt_enable_disabled; +our $opt_mem= $ENV{'MTR_MEM'}; + +our $opt_gcov; +our $opt_gcov_err; +our $opt_gcov_msg; + +our $glob_debugger= 0; +our $opt_gdb; +our $opt_client_gdb; +our $opt_ddd; +our $opt_client_ddd; +our $opt_manual_gdb; +our $opt_manual_ddd; +our $opt_manual_debug; +our $opt_mtr_build_thread=0; +our $opt_debugger; +our $opt_client_debugger; + +our $opt_gprof; +our $opt_gprof_dir; +our $opt_gprof_master; +our $opt_gprof_slave; + +our $master; +our $slave; +our $clusters; + +our $instance_manager; + +our $opt_master_myport; +our $opt_slave_myport; +our $im_port; +our $im_mysqld1_port; +our $im_mysqld2_port; +our $opt_ndbcluster_port; +our $opt_ndbconnectstring; +our $opt_ndbcluster_port_slave; +our $opt_ndbconnectstring_slave; + +our $opt_record; +my $opt_report_features; +our $opt_check_testcases; +our $opt_mark_progress; + +our $opt_skip_rpl; +our $max_slave_num= 0; +our $max_master_num= 1; +our $use_innodb; +our $opt_skip_test; +our $opt_skip_im; + +our $opt_sleep; + +our $opt_testcase_timeout; +our $opt_suite_timeout; +my $default_testcase_timeout= 15; # 15 min max +my $default_suite_timeout= 300; # 5 hours max + +our $opt_start_and_exit; +our $opt_start_dirty; +our $opt_start_from; + +our $opt_strace_client; + +our $opt_timer= 1; + +our $opt_user; + +my $opt_valgrind= 0; +my $opt_valgrind_mysqld= 0; +my $opt_valgrind_mysqltest= 0; +my @default_valgrind_args= ("--show-reachable=yes"); +my @valgrind_args; +my $opt_valgrind_path; +my $opt_callgrind; + +our $opt_stress= ""; +our $opt_stress_suite= "main"; +our $opt_stress_mode= "random"; +our $opt_stress_threads= 5; +our $opt_stress_test_count= 0; +our $opt_stress_loop_count= 0; +our $opt_stress_test_duration= 0; +our $opt_stress_init_file= ""; +our $opt_stress_test_file= ""; + +our $opt_warnings; + +our $opt_skip_ndbcluster= 0; +our $opt_skip_ndbcluster_slave= 0; +our $opt_with_ndbcluster= 0; +our $opt_with_ndbcluster_only= 0; +our $glob_ndbcluster_supported= 0; +our $opt_ndb_extra_test= 0; +our $opt_skip_master_binlog= 0; +our $opt_skip_slave_binlog= 0; + +our $exe_ndb_mgm; +our $exe_ndb_waiter; +our $path_ndb_tools_dir; +our $path_ndb_examples_dir; +our $exe_ndb_example; +our $path_ndb_testrun_log; + +our $path_sql_dir; + +our @data_dir_lst; + +our $used_binlog_format; +our $used_default_engine; +our $debug_compiled_binaries; + +our %mysqld_variables; + +my $source_dist= 0; + +our $opt_max_save_core= 5; +my $num_saved_cores= 0; # Number of core files saved in vardir/log/ so far. + +###################################################################### +# +# Function declarations +# +###################################################################### + +sub main (); +sub initial_setup (); +sub command_line_setup (); +sub set_mtr_build_thread_ports($); +sub datadir_list_setup (); +sub executable_setup (); +sub environment_setup (); +sub kill_running_servers (); +sub remove_stale_vardir (); +sub setup_vardir (); +sub check_ssl_support ($); +sub check_running_as_root(); +sub check_ndbcluster_support ($); +sub rm_ndbcluster_tables ($); +sub ndbcluster_start_install ($); +sub ndbcluster_start ($$); +sub ndbcluster_wait_started ($$); +sub mysqld_wait_started($); +sub run_benchmarks ($); +sub initialize_servers (); +sub mysql_install_db (); +sub install_db ($$); +sub copy_install_db ($$); +sub run_testcase ($); +sub run_testcase_stop_servers ($$$); +sub run_testcase_start_servers ($); +sub run_testcase_check_skip_test($); +sub report_failure_and_restart ($); +sub do_before_start_master ($); +sub do_before_start_slave ($); +sub ndbd_start ($$$); +sub ndb_mgmd_start ($); +sub mysqld_start ($$$); +sub mysqld_arguments ($$$$); +sub stop_all_servers (); +sub run_mysqltest ($); +sub usage ($); + + +###################################################################### +# +# Main program +# +###################################################################### + +main(); + +sub main () { + + command_line_setup(); + + check_ndbcluster_support(\%mysqld_variables); + check_ssl_support(\%mysqld_variables); + check_debug_support(\%mysqld_variables); + + executable_setup(); + + environment_setup(); + signal_setup(); + + if ( $opt_gcov ) + { + gcov_prepare(); + } + + if ( $opt_gprof ) + { + gprof_prepare(); + } + + if ( $opt_bench ) + { + initialize_servers(); + run_benchmarks(shift); # Shift what? Extra arguments?! + } + elsif ( $opt_stress ) + { + initialize_servers(); + run_stress_test() + } + else + { + # Figure out which tests we are going to run + if (!$opt_suites) + { + $opt_suites= $opt_suites_default; + + # Check for any extra suites to enable based on the path name + my %extra_suites= + ( + "mysql-5.1-new-ndb" => "ndb_team", + "mysql-5.1-new-ndb-merge" => "ndb_team", + "mysql-5.1-telco-6.2" => "ndb_team", + "mysql-5.1-telco-6.2-merge" => "ndb_team", + "mysql-5.1-telco-6.3" => "ndb_team", + "mysql-6.0-ndb" => "ndb_team", + ); + + foreach my $dir ( reverse splitdir($glob_basedir) ) + { + my $extra_suite= $extra_suites{$dir}; + if (defined $extra_suite){ + mtr_report("Found extra suite: $extra_suite"); + $opt_suites= "$extra_suite,$opt_suites"; + last; + } + } + } + + my $tests= collect_test_cases($opt_suites); + + # Turn off NDB and other similar options if no tests use it + my ($need_ndbcluster,$need_im, $need_debug); + foreach my $test (@$tests) + { + next if $test->{skip}; + + if (!$opt_extern) + { + $need_ndbcluster||= $test->{ndb_test}; + $need_debug||=$test->{need_debug}; + $need_im||= $test->{component_id} eq 'im'; + + # Count max number of slaves used by a test case + if ( $test->{slave_num} > $max_slave_num) { + $max_slave_num= $test->{slave_num}; + mtr_error("Too many slaves") if $max_slave_num > 3; + } + + # Count max number of masters used by a test case + if ( $test->{master_num} > $max_master_num) { + $max_master_num= $test->{master_num}; + mtr_error("Too many masters") if $max_master_num > 2; + mtr_error("Too few masters") if $max_master_num < 1; + } + } + $use_innodb||= $test->{'innodb_test'}; + } + + # Check if cluster can be skipped + if ( !$need_ndbcluster ) + { + $opt_skip_ndbcluster= 1; + $opt_skip_ndbcluster_slave= 1; + } + + if ( !$need_debug && !$opt_debug) + { + $opt_debug=0; + } + + # Check if slave cluster can be skipped + if ($max_slave_num == 0) + { + $opt_skip_ndbcluster_slave= 1; + } + + # Check if im can be skipped + if ( ! $need_im ) + { + $opt_skip_im= 1; + } + + initialize_servers(); + + if ( $opt_report_features ) { + run_report_features(); + } + + run_tests($tests); + } + + mtr_exit(0); +} + +############################################################################## +# +# Default settings +# +############################################################################## + +# +# When an option is no longer used by this program, it must be explicitly +# ignored or else it will be passed through to mysqld. GetOptions will call +# this subroutine once for each such option on the command line. See +# Getopt::Long documentation. +# + +sub warn_about_removed_option { + my ($option, $value, $hash_value) = @_; + + warn "WARNING: This option is no longer used, and is ignored: --$option\n"; +} + +sub command_line_setup () { + + # These are defaults for things that are set on the command line + + my $opt_comment; + + # Magic number -69.4 results in traditional test ports starting from 9306. + set_mtr_build_thread_ports(-69.4); + + # If so requested, we try to avail ourselves of a unique build thread number. + if ( $ENV{'MTR_BUILD_THREAD'} ) { + if ( lc($ENV{'MTR_BUILD_THREAD'}) eq 'auto' ) { + print "Requesting build thread... "; + $ENV{'MTR_BUILD_THREAD'} = mtr_require_unique_id_and_wait("/tmp/mysql-test-ports", 200, 299); + print "got ".$ENV{'MTR_BUILD_THREAD'}."\n"; + } + } + + if ( $ENV{'MTR_BUILD_THREAD'} ) + { + set_mtr_build_thread_ports($ENV{'MTR_BUILD_THREAD'}); + } + + # This is needed for test log evaluation in "gen-build-status-page" + # in all cases where the calling tool does not log the commands + # directly before it executes them, like "make test-force-pl" in RPM builds. + print "Logging: $0 ", join(" ", @ARGV), "\n"; + + # Read the command line + # Note: Keep list, and the order, in sync with usage at end of this file + + # Options that are no longer used must still be processed, because all + # unprocessed options are passed directly to mysqld. The user will be + # warned that the option is being ignored. + # + # Put the complete option string here. For example, to remove the --suite + # option, remove it from GetOptions() below and put 'suite|suites=s' here. + my @removed_options = ( + ); + + Getopt::Long::Configure("pass_through"); + my %options=( + # Control what engine/variation to run + 'embedded-server' => \$opt_embedded_server, + 'ps-protocol' => \$opt_ps_protocol, + 'sp-protocol' => \$opt_sp_protocol, + 'view-protocol' => \$opt_view_protocol, + 'cursor-protocol' => \$opt_cursor_protocol, + 'ssl|with-openssl' => \$opt_ssl, + 'skip-ssl' => \$opt_skip_ssl, + 'compress' => \$opt_compress, + 'bench' => \$opt_bench, + 'small-bench' => \$opt_small_bench, + 'with-ndbcluster|ndb' => \$opt_with_ndbcluster, + 'vs-config' => \$opt_vs_config, + + # Control what test suites or cases to run + 'force' => \$opt_force, + 'with-ndbcluster-only' => \$opt_with_ndbcluster_only, + 'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster, + 'skip-ndbcluster-slave|skip-ndb-slave' + => \$opt_skip_ndbcluster_slave, + 'ndb-extra-test' => \$opt_ndb_extra_test, + 'skip-master-binlog' => \$opt_skip_master_binlog, + 'skip-slave-binlog' => \$opt_skip_slave_binlog, + 'do-test=s' => \$opt_do_test, + 'start-from=s' => \$opt_start_from, + 'suite|suites=s' => \$opt_suites, + 'skip-rpl' => \$opt_skip_rpl, + 'skip-im' => \$opt_skip_im, + 'skip-test=s' => \$opt_skip_test, + 'big-test' => \$opt_big_test, + 'combination=s' => \@opt_combinations, + 'skip-combination' => \$opt_skip_combination, + + # Specify ports + 'master_port=i' => \$opt_master_myport, + 'slave_port=i' => \$opt_slave_myport, + 'ndbcluster-port|ndbcluster_port=i' => \$opt_ndbcluster_port, + 'ndbcluster-port-slave=i' => \$opt_ndbcluster_port_slave, + 'im-port=i' => \$im_port, # Instance Manager port. + 'im-mysqld1-port=i' => \$im_mysqld1_port, # Port of mysqld, controlled by IM + 'im-mysqld2-port=i' => \$im_mysqld2_port, # Port of mysqld, controlled by IM + 'mtr-build-thread=i' => \$opt_mtr_build_thread, + + # Test case authoring + 'record' => \$opt_record, + 'check-testcases' => \$opt_check_testcases, + 'mark-progress' => \$opt_mark_progress, + + # Extra options used when starting mysqld + 'mysqld=s' => \@opt_extra_mysqld_opt, + + # Extra options used when starting mysqld + 'mysqltest=s' => \@opt_extra_mysqltest_opt, + + # Run test on running server + 'extern' => \$opt_extern, + 'ndb-connectstring=s' => \$opt_ndbconnectstring, + 'ndb-connectstring-slave=s' => \$opt_ndbconnectstring_slave, + + # Debugging + 'gdb' => \$opt_gdb, + 'client-gdb' => \$opt_client_gdb, + 'manual-gdb' => \$opt_manual_gdb, + 'manual-debug' => \$opt_manual_debug, + 'ddd' => \$opt_ddd, + 'client-ddd' => \$opt_client_ddd, + 'manual-ddd' => \$opt_manual_ddd, + 'debugger=s' => \$opt_debugger, + 'client-debugger=s' => \$opt_client_debugger, + 'strace-client' => \$opt_strace_client, + 'master-binary=s' => \$exe_master_mysqld, + 'slave-binary=s' => \$exe_slave_mysqld, + 'max-save-core=i' => \$opt_max_save_core, + + # Coverage, profiling etc + 'gcov' => \$opt_gcov, + 'gprof' => \$opt_gprof, + 'valgrind|valgrind-all' => \$opt_valgrind, + 'valgrind-mysqltest' => \$opt_valgrind_mysqltest, + 'valgrind-mysqld' => \$opt_valgrind_mysqld, + 'valgrind-options=s' => sub { + my ($opt, $value)= @_; + # Deprecated option unless it's what we know pushbuild uses + if ($value eq "--gen-suppressions=all --show-reachable=yes") { + push(@valgrind_args, $_) for (split(' ', $value)); + return; + } + die("--valgrind-options=s is deprecated. Use ", + "--valgrind-option=s, to be specified several", + " times if necessary"); + }, + 'valgrind-option=s' => \@valgrind_args, + 'valgrind-path=s' => \$opt_valgrind_path, + 'callgrind' => \$opt_callgrind, + + # Stress testing + 'stress' => \$opt_stress, + 'stress-suite=s' => \$opt_stress_suite, + 'stress-threads=i' => \$opt_stress_threads, + 'stress-test-file=s' => \$opt_stress_test_file, + 'stress-init-file=s' => \$opt_stress_init_file, + 'stress-mode=s' => \$opt_stress_mode, + 'stress-loop-count=i' => \$opt_stress_loop_count, + 'stress-test-count=i' => \$opt_stress_test_count, + 'stress-test-duration=i' => \$opt_stress_test_duration, + + # Directories + 'tmpdir=s' => \$opt_tmpdir, + 'vardir=s' => \$opt_vardir, + 'benchdir=s' => \$glob_mysql_bench_dir, + 'mem' => \$opt_mem, + 'client-bindir=s' => \$path_client_bindir, + 'client-libdir=s' => \$path_client_libdir, + + # Misc + 'report-features' => \$opt_report_features, + 'comment=s' => \$opt_comment, + 'debug' => \$opt_debug, + 'fast' => \$opt_fast, + 'reorder' => \$opt_reorder, + 'enable-disabled' => \$opt_enable_disabled, + 'script-debug' => \$opt_script_debug, + 'verbose' => \$opt_verbose, + 'sleep=i' => \$opt_sleep, + 'socket=s' => \$opt_socket, + 'start-dirty' => \$opt_start_dirty, + 'start-and-exit' => \$opt_start_and_exit, + 'timer!' => \$opt_timer, + 'user=s' => \$opt_user, + 'testcase-timeout=i' => \$opt_testcase_timeout, + 'suite-timeout=i' => \$opt_suite_timeout, + 'warnings|log-warnings' => \$opt_warnings, + + # Options which are no longer used + (map { $_ => \&warn_about_removed_option } @removed_options), + + 'help|h' => \$opt_usage, + 'list-options' => \$opt_list_options, + ); + + GetOptions(%options) or usage("Can't read options"); + + usage("") if $opt_usage; + list_options(\%options) if $opt_list_options; + + $glob_scriptname= basename($0); + + if ($opt_mtr_build_thread != 0) + { + set_mtr_build_thread_ports($opt_mtr_build_thread) + } + elsif ($ENV{'MTR_BUILD_THREAD'}) + { + $opt_mtr_build_thread= $ENV{'MTR_BUILD_THREAD'}; + } + + # We require that we are in the "mysql-test" directory + # to run mysql-test-run + if (! -f $glob_scriptname) + { + mtr_error("Can't find the location for the mysql-test-run script\n" . + "Go to to the mysql-test directory and execute the script " . + "as follows:\n./$glob_scriptname"); + } + + if ( -d "../sql" ) + { + $source_dist= 1; + } + + # Find the absolute path to the test directory + $glob_mysql_test_dir= cwd(); + if ( $glob_cygwin_perl ) + { + # Windows programs like 'mysqld' needs Windows paths + $glob_mysql_test_dir= `cygpath -m "$glob_mysql_test_dir"`; + chomp($glob_mysql_test_dir); + } + $default_vardir= "$glob_mysql_test_dir/var"; + + # In most cases, the base directory we find everything relative to, + # is the parent directory of the "mysql-test" directory. For source + # distributions, TAR binary distributions and some other packages. + $glob_basedir= dirname($glob_mysql_test_dir); + + # In the RPM case, binaries and libraries are installed in the + # default system locations, instead of having our own private base + # directory. And we install "/usr/share/mysql-test". Moving up one + # more directory relative to "mysql-test" gives us a usable base + # directory for RPM installs. + if ( ! $source_dist and ! -d "$glob_basedir/bin" ) + { + $glob_basedir= dirname($glob_basedir); + } + + # Expect mysql-bench to be located adjacent to the source tree, by default + $glob_mysql_bench_dir= "$glob_basedir/../mysql-bench" + unless defined $glob_mysql_bench_dir; + $glob_mysql_bench_dir= undef + unless -d $glob_mysql_bench_dir; + + $path_my_basedir= + $source_dist ? $glob_mysql_test_dir : $glob_basedir; + + $glob_timers= mtr_init_timers(); + + # -------------------------------------------------------------------------- + # Embedded server flag + # -------------------------------------------------------------------------- + if ( $opt_embedded_server ) + { + $glob_use_embedded_server= 1; + # Add the location for libmysqld.dll to the path. + if ( $glob_win32 ) + { + my $lib_mysqld= + mtr_path_exists(vs_config_dirs('libmysqld','')); + $lib_mysqld= $glob_cygwin_perl ? ":".`cygpath "$lib_mysqld"` + : ";".$lib_mysqld; + chomp($lib_mysqld); + $ENV{'PATH'}="$ENV{'PATH'}".$lib_mysqld; + } + + push(@glob_test_mode, "embedded"); + $opt_skip_rpl= 1; # We never run replication with embedded + $opt_skip_ndbcluster= 1; # Turn off use of NDB cluster + $opt_skip_ssl= 1; # Turn off use of SSL + + # Turn off use of bin log + push(@opt_extra_mysqld_opt, "--skip-log-bin"); + + if ( $opt_extern ) + { + mtr_error("Can't use --extern with --embedded-server"); + } + } + + # + # Find the mysqld executable to be able to find the mysqld version + # number as early as possible + # + + # Look for the client binaries directory + if ($path_client_bindir) + { + # --client-bindir=path set on command line, check that the path exists + $path_client_bindir= mtr_path_exists($path_client_bindir); + } + else + { + $path_client_bindir= mtr_path_exists("$glob_basedir/client_release", + "$glob_basedir/client_debug", + vs_config_dirs('client', ''), + "$glob_basedir/client", + "$glob_basedir/bin"); + } + + # Look for language files and charsetsdir, use same share + $path_share= mtr_path_exists("$glob_basedir/share/mysql", + "$glob_basedir/sql/share", + "$glob_basedir/share"); + + $path_language= mtr_path_exists("$path_share/english"); + $path_charsetsdir= mtr_path_exists("$path_share/charsets"); + + + if (!$opt_extern) + { + $exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'), + vs_config_dirs('sql', 'mysqld-debug'), + "$glob_basedir/sql/mysqld", + "$path_client_bindir/mysqld-max-nt", + "$path_client_bindir/mysqld-max", + "$path_client_bindir/mysqld-nt", + "$path_client_bindir/mysqld", + "$path_client_bindir/mysqld-debug", + "$path_client_bindir/mysqld-max", + "$glob_basedir/libexec/mysqld", + "$glob_basedir/bin/mysqld", + "$glob_basedir/sbin/mysqld"); + + # Use the mysqld found above to find out what features are available + collect_mysqld_features(); + } + else + { + $mysqld_variables{'port'}= 3306; + $mysqld_variables{'master-port'}= 3306; + } + + if ( $opt_comment ) + { + print "\n"; + print '#' x 78, "\n"; + print "# $opt_comment\n"; + print '#' x 78, "\n\n"; + } + + foreach my $arg ( @ARGV ) + { + if ( $arg =~ /^--skip-/ ) + { + push(@opt_extra_mysqld_opt, $arg); + } + elsif ( $arg =~ /^--$/ ) + { + # It is an effect of setting 'pass_through' in option processing + # that the lone '--' separating options from arguments survives, + # simply ignore it. + } + elsif ( $arg =~ /^-/ ) + { + usage("Invalid option \"$arg\""); + } + else + { + push(@opt_cases, $arg); + } + } + + # -------------------------------------------------------------------------- + # Find out type of logging that are being used + # -------------------------------------------------------------------------- + if (!$opt_extern && $mysql_version_id >= 50100 ) + { + foreach my $arg ( @opt_extra_mysqld_opt ) + { + if ( $arg =~ /binlog[-_]format=(\S+)/ ) + { + $used_binlog_format= $1; + } + } + if (defined $used_binlog_format) + { + mtr_report("Using binlog format '$used_binlog_format'"); + } + else + { + mtr_report("Using dynamic switching of binlog format"); + } + } + + + # -------------------------------------------------------------------------- + # Find out default storage engine being used(if any) + # -------------------------------------------------------------------------- + if ( $opt_with_ndbcluster ) + { + # --ndb or --with-ndbcluster turns on --default-storage-engine=ndbcluster + push(@opt_extra_mysqld_opt, "--default-storage-engine=ndbcluster"); + } + + foreach my $arg ( @opt_extra_mysqld_opt ) + { + if ( $arg =~ /default-storage-engine=(\S+)/ ) + { + $used_default_engine= $1; + } + } + mtr_report("Using default engine '$used_default_engine'") + if defined $used_default_engine; + + # -------------------------------------------------------------------------- + # Check if we should speed up tests by trying to run on tmpfs + # -------------------------------------------------------------------------- + if ( defined $opt_mem ) + { + mtr_error("Can't use --mem and --vardir at the same time ") + if $opt_vardir; + mtr_error("Can't use --mem and --tmpdir at the same time ") + if $opt_tmpdir; + + # Search through list of locations that are known + # to be "fast disks" to list to find a suitable location + # Use --mem=<dir> as first location to look. + my @tmpfs_locations= ($opt_mem, "/dev/shm", "/tmp"); + + foreach my $fs (@tmpfs_locations) + { + if ( -d $fs ) + { + mtr_report("Using tmpfs in $fs"); + $opt_mem= "$fs/var"; + $opt_mem .= $opt_mtr_build_thread if $opt_mtr_build_thread; + last; + } + } + } + + # -------------------------------------------------------------------------- + # Set the "var/" directory, as it is the base for everything else + # -------------------------------------------------------------------------- + if ( ! $opt_vardir ) + { + $opt_vardir= $default_vardir; + } + elsif ( $mysql_version_id < 50000 and + $opt_vardir ne $default_vardir) + { + # Version 4.1 and --vardir was specified + # Only supported as a symlink from var/ + # by setting up $opt_mem that symlink will be created + if ( ! $glob_win32 ) + { + # Only platforms that have native symlinks can use the vardir trick + $opt_mem= $opt_vardir; + mtr_report("Using 4.1 vardir trick"); + } + + $opt_vardir= $default_vardir; + } + + $path_vardir_trace= $opt_vardir; + # Chop off any "c:", DBUG likes a unix path ex: c:/src/... => /src/... + $path_vardir_trace=~ s/^\w://; + + # We make the path absolute, as the server will do a chdir() before usage + unless ( $opt_vardir =~ m,^/, or + ($glob_win32 and $opt_vardir =~ m,^[a-z]:/,i) ) + { + # Make absolute path, relative test dir + $opt_vardir= "$glob_mysql_test_dir/$opt_vardir"; + } + + # -------------------------------------------------------------------------- + # Set tmpdir + # -------------------------------------------------------------------------- + $opt_tmpdir= "$opt_vardir/tmp" unless $opt_tmpdir; + $opt_tmpdir =~ s,/+$,,; # Remove ending slash if any + + # -------------------------------------------------------------------------- + # Check im suport + # -------------------------------------------------------------------------- + if ($opt_extern) + { + # mtr_report("Disable instance manager when running with extern mysqld"); + $opt_skip_im= 1; + } + elsif ( $mysql_version_id < 50000 ) + { + # Instance manager is not supported until 5.0 + $opt_skip_im= 1; + } + elsif ( $glob_win32 ) + { + mtr_report("Disable Instance manager - testing not supported on Windows"); + $opt_skip_im= 1; + } + + # -------------------------------------------------------------------------- + # Record flag + # -------------------------------------------------------------------------- + if ( $opt_record and ! @opt_cases ) + { + mtr_error("Will not run in record mode without a specific test case"); + } + + if ( $opt_record ) + { + $opt_skip_combination = 1; + } + + # -------------------------------------------------------------------------- + # ps protcol flag + # -------------------------------------------------------------------------- + if ( $opt_ps_protocol ) + { + push(@glob_test_mode, "ps-protocol"); + } + + # -------------------------------------------------------------------------- + # Bench flags + # -------------------------------------------------------------------------- + if ( $opt_small_bench ) + { + $opt_bench= 1; + } + + # -------------------------------------------------------------------------- + # Big test flags + # -------------------------------------------------------------------------- + if ( $opt_big_test ) + { + $ENV{'BIG_TEST'}= 1; + } + + # -------------------------------------------------------------------------- + # Gcov flag + # -------------------------------------------------------------------------- + if ( $opt_gcov and ! $source_dist ) + { + mtr_error("Coverage test needs the source - please use source dist"); + } + + # -------------------------------------------------------------------------- + # Check debug related options + # -------------------------------------------------------------------------- + if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd || + $opt_manual_gdb || $opt_manual_ddd || $opt_manual_debug || + $opt_debugger || $opt_client_debugger ) + { + # Indicate that we are using debugger + $glob_debugger= 1; + if ( $opt_extern ) + { + mtr_error("Can't use --extern when using debugger"); + } + } + + # -------------------------------------------------------------------------- + # Check if special exe was selected for master or slave + # -------------------------------------------------------------------------- + $exe_master_mysqld= $exe_master_mysqld || $exe_mysqld; + $exe_slave_mysqld= $exe_slave_mysqld || $exe_mysqld; + + # -------------------------------------------------------------------------- + # Check valgrind arguments + # -------------------------------------------------------------------------- + if ( $opt_valgrind or $opt_valgrind_path or @valgrind_args) + { + mtr_report("Turning on valgrind for all executables"); + $opt_valgrind= 1; + $opt_valgrind_mysqld= 1; + $opt_valgrind_mysqltest= 1; + } + elsif ( $opt_valgrind_mysqld ) + { + mtr_report("Turning on valgrind for mysqld(s) only"); + $opt_valgrind= 1; + } + elsif ( $opt_valgrind_mysqltest ) + { + mtr_report("Turning on valgrind for mysqltest and mysql_client_test only"); + $opt_valgrind= 1; + } + + if ( $opt_callgrind ) + { + mtr_report("Turning on valgrind with callgrind for mysqld(s)"); + $opt_valgrind= 1; + $opt_valgrind_mysqld= 1; + + # Set special valgrind options unless options passed on command line + push(@valgrind_args, "--trace-children=yes") + unless @valgrind_args; + } + + if ( $opt_valgrind ) + { + # Set valgrind_options to default unless already defined + push(@valgrind_args, @default_valgrind_args) + unless @valgrind_args; + + mtr_report("Running valgrind with options \"", + join(" ", @valgrind_args), "\""); + } + + if ( ! $opt_testcase_timeout ) + { + $opt_testcase_timeout= $default_testcase_timeout; + $opt_testcase_timeout*= 10 if $opt_valgrind; + $opt_testcase_timeout*= 10 if ($opt_debug and $glob_win32); + } + + if ( ! $opt_suite_timeout ) + { + $opt_suite_timeout= $default_suite_timeout; + $opt_suite_timeout*= 6 if $opt_valgrind; + $opt_suite_timeout*= 6 if ($opt_debug and $glob_win32); + } + + if ( ! $opt_user ) + { + if ( $opt_extern ) + { + $opt_user= "test"; + } + else + { + $opt_user= "root"; # We want to do FLUSH xxx commands + } + } + + # On QNX, /tmp/dir/master.sock and /tmp/dir//master.sock seem to be + # considered different, so avoid the extra slash (/) in the socket + # paths. + my $sockdir = $opt_tmpdir; + $sockdir =~ s|/+$||; + + # On some operating systems, there is a limit to the length of a + # UNIX domain socket's path far below PATH_MAX, so try to avoid long + # socket path names. + $sockdir = tempdir(CLEANUP => 0) if ( length($sockdir) >= 70 ); + + $master->[0]= + { + pid => 0, + type => "master", + idx => 0, + path_myddir => "$opt_vardir/master-data", + path_myerr => "$opt_vardir/log/master.err", + path_pid => "$opt_vardir/run/master.pid", + path_sock => "$sockdir/master.sock", + port => $opt_master_myport, + start_timeout => 400, # enough time create innodb tables + cluster => 0, # index in clusters list + start_opts => [], + }; + + $master->[1]= + { + pid => 0, + type => "master", + idx => 1, + path_myddir => "$opt_vardir/master1-data", + path_myerr => "$opt_vardir/log/master1.err", + path_pid => "$opt_vardir/run/master1.pid", + path_sock => "$sockdir/master1.sock", + port => $opt_master_myport + 1, + start_timeout => 400, # enough time create innodb tables + cluster => 0, # index in clusters list + start_opts => [], + }; + + $slave->[0]= + { + pid => 0, + type => "slave", + idx => 0, + path_myddir => "$opt_vardir/slave-data", + path_myerr => "$opt_vardir/log/slave.err", + path_pid => "$opt_vardir/run/slave.pid", + path_sock => "$sockdir/slave.sock", + port => $opt_slave_myport, + start_timeout => 400, + + cluster => 1, # index in clusters list + start_opts => [], + }; + + $slave->[1]= + { + pid => 0, + type => "slave", + idx => 1, + path_myddir => "$opt_vardir/slave1-data", + path_myerr => "$opt_vardir/log/slave1.err", + path_pid => "$opt_vardir/run/slave1.pid", + path_sock => "$sockdir/slave1.sock", + port => $opt_slave_myport + 1, + start_timeout => 300, + cluster => -1, # index in clusters list + start_opts => [], + }; + + $slave->[2]= + { + pid => 0, + type => "slave", + idx => 2, + path_myddir => "$opt_vardir/slave2-data", + path_myerr => "$opt_vardir/log/slave2.err", + path_pid => "$opt_vardir/run/slave2.pid", + path_sock => "$sockdir/slave2.sock", + port => $opt_slave_myport + 2, + start_timeout => 300, + cluster => -1, # index in clusters list + start_opts => [], + }; + + $instance_manager= + { + path_err => "$opt_vardir/log/im.err", + path_log => "$opt_vardir/log/im.log", + path_pid => "$opt_vardir/run/im.pid", + path_angel_pid => "$opt_vardir/run/im.angel.pid", + path_sock => "$sockdir/im.sock", + port => $im_port, + start_timeout => $master->[0]->{'start_timeout'}, + admin_login => 'im_admin', + admin_password => 'im_admin_secret', + admin_sha1 => '*598D51AD2DFF7792045D6DF3DDF9AA1AF737B295', + password_file => "$opt_vardir/im.passwd", + defaults_file => "$opt_vardir/im.cnf", + }; + + $instance_manager->{'instances'}->[0]= + { + server_id => 1, + port => $im_mysqld1_port, + path_datadir => "$opt_vardir/im_mysqld_1.data", + path_sock => "$sockdir/mysqld_1.sock", + path_pid => "$opt_vardir/run/mysqld_1.pid", + start_timeout => 400, # enough time create innodb tables + old_log_format => 1 + }; + + $instance_manager->{'instances'}->[1]= + { + server_id => 2, + port => $im_mysqld2_port, + path_datadir => "$opt_vardir/im_mysqld_2.data", + path_sock => "$sockdir/mysqld_2.sock", + path_pid => "$opt_vardir/run/mysqld_2.pid", + nonguarded => 1, + start_timeout => 400, # enough time create innodb tables + old_log_format => 1 + }; + + my $data_dir= "$opt_vardir/ndbcluster-$opt_ndbcluster_port"; + $clusters->[0]= + { + name => "Master", + nodes => 2, + port => "$opt_ndbcluster_port", + data_dir => "$data_dir", + connect_string => "host=localhost:$opt_ndbcluster_port", + path_pid => "$data_dir/ndb_3.pid", # Nodes + 1 + pid => 0, # pid of ndb_mgmd + installed_ok => 0, + }; + + $data_dir= "$opt_vardir/ndbcluster-$opt_ndbcluster_port_slave"; + $clusters->[1]= + { + name => "Slave", + nodes => 1, + port => "$opt_ndbcluster_port_slave", + data_dir => "$data_dir", + connect_string => "host=localhost:$opt_ndbcluster_port_slave", + path_pid => "$data_dir/ndb_2.pid", # Nodes + 1 + pid => 0, # pid of ndb_mgmd + installed_ok => 0, + }; + + # Init pids of ndbd's + foreach my $cluster ( @{$clusters} ) + { + for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ ) + { + my $nodeid= $idx+1; + $cluster->{'ndbds'}->[$idx]= + { + pid => 0, + nodeid => $nodeid, + path_pid => "$cluster->{'data_dir'}/ndb_${nodeid}.pid", + path_fs => "$cluster->{'data_dir'}/ndb_${nodeid}_fs", + }; + } + } + + # -------------------------------------------------------------------------- + # extern + # -------------------------------------------------------------------------- + if ( $opt_extern ) + { + # Turn off features not supported when running with extern server + $opt_skip_rpl= 1; + $opt_skip_ndbcluster= 1; + + # Setup master->[0] with the settings for the extern server + $master->[0]->{'path_sock'}= $opt_socket ? $opt_socket : "/tmp/mysql.sock"; + mtr_report("Using extern server at '$master->[0]->{path_sock}'"); + } + else + { + mtr_error("--socket can only be used in combination with --extern") + if $opt_socket; + } + + + # -------------------------------------------------------------------------- + # ndbconnectstring and ndbconnectstring_slave + # -------------------------------------------------------------------------- + if ( $opt_ndbconnectstring ) + { + # ndbconnectstring was supplied by user, the tests shoudl be run + # against an already started cluster, change settings + my $cluster= $clusters->[0]; # Master cluster + $cluster->{'connect_string'}= $opt_ndbconnectstring; + $cluster->{'use_running'}= 1; + + mtr_error("Can't specify --ndb-connectstring and --skip-ndbcluster") + if $opt_skip_ndbcluster; + } + $ENV{'NDB_CONNECTSTRING'}= $clusters->[0]->{'connect_string'}; + + + if ( $opt_ndbconnectstring_slave ) + { + # ndbconnectstring-slave was supplied by user, the tests should be run + # agains an already started slave cluster, change settings + my $cluster= $clusters->[1]; # Slave cluster + $cluster->{'connect_string'}= $opt_ndbconnectstring_slave; + $cluster->{'use_running'}= 1; + + mtr_error("Can't specify ndb-connectstring_slave and " . + "--skip-ndbcluster-slave") + if $opt_skip_ndbcluster_slave; + } + + + $path_timefile= "$opt_vardir/log/mysqltest-time"; + $path_mysqltest_log= "$opt_vardir/log/mysqltest.log"; + $path_current_test_log= "$opt_vardir/log/current_test"; + $path_ndb_testrun_log= "$opt_vardir/log/ndb_testrun.log"; + + $path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/"; +} + +# +# 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 limitation 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 +# + +sub set_mtr_build_thread_ports($) { + my $mtr_build_thread= shift; + + if ( lc($mtr_build_thread) eq 'auto' ) { + print "Requesting build thread... "; + $ENV{'MTR_BUILD_THREAD'} = $mtr_build_thread = mtr_require_unique_id_and_wait("/tmp/mysql-test-ports", 200, 299); + print "got ".$mtr_build_thread."\n"; + } + + # Up to two masters, up to three slaves + # A magic value in command_line_setup depends on these equations. + $opt_master_myport= $mtr_build_thread * 10 + 10000; # and 1 + $opt_slave_myport= $opt_master_myport + 2; # and 3 4 + $opt_ndbcluster_port= $opt_master_myport + 5; + $opt_ndbcluster_port_slave= $opt_master_myport + 6; + $im_port= $opt_master_myport + 7; + $im_mysqld1_port= $opt_master_myport + 8; + $im_mysqld2_port= $opt_master_myport + 9; + + 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)"); + } +} + + +sub datadir_list_setup () { + + # Make a list of all data_dirs + for (my $idx= 0; $idx < $max_master_num; $idx++) + { + push(@data_dir_lst, $master->[$idx]->{'path_myddir'}); + } + + for (my $idx= 0; $idx < $max_slave_num; $idx++) + { + push(@data_dir_lst, $slave->[$idx]->{'path_myddir'}); + } + + unless ($opt_skip_im) + { + foreach my $instance (@{$instance_manager->{'instances'}}) + { + push(@data_dir_lst, $instance->{'path_datadir'}); + } + } +} + + +############################################################################## +# +# Set paths to various executable programs +# +############################################################################## + + +sub collect_mysqld_features () { + my $found_variable_list_start= 0; + my $tmpdir; + if ( $opt_tmpdir ) { + # Use the requested tmpdir + mkpath($opt_tmpdir) if (! -d $opt_tmpdir); + $tmpdir= $opt_tmpdir; + } + else { + $tmpdir= tempdir(CLEANUP => 0); # Directory removed by this function + } + + # + # Execute "mysqld --help --verbose" to get a list + # list of all features and settings + # + # --no-defaults and --skip-grant-tables are to avoid loading + # system-wide configs and plugins + # + # --datadir must exist, mysqld will chdir into it + # + my $list= `$exe_mysqld --no-defaults --datadir=$tmpdir --language=$path_language --skip-grant-tables --verbose --help`; + + foreach my $line (split('\n', $list)) + { + # First look for version + if ( !$mysql_version_id ) + { + # Look for version + my $exe_name= basename($exe_mysqld); + mtr_verbose("exe_name: $exe_name"); + if ( $line =~ /^\S*$exe_name\s\sVer\s([0-9]*)\.([0-9]*)\.([0-9]*)/ ) + { + #print "Major: $1 Minor: $2 Build: $3\n"; + $mysql_version_id= $1*10000 + $2*100 + $3; + #print "mysql_version_id: $mysql_version_id\n"; + mtr_report("MySQL Version $1.$2.$3"); + } + } + else + { + if (!$found_variable_list_start) + { + # Look for start of variables list + if ( $line =~ /[\-]+\s[\-]+/ ) + { + $found_variable_list_start= 1; + } + } + else + { + # Put variables into hash + if ( $line =~ /^([\S]+)[ \t]+(.*?)\r?$/ ) + { + # print "$1=\"$2\"\n"; + $mysqld_variables{$1}= $2; + } + else + { + # The variable list is ended with a blank line + if ( $line =~ /^[\s]*$/ ) + { + last; + } + else + { + # Send out a warning, we should fix the variables that has no + # space between variable name and it's value + # or should it be fixed width column parsing? It does not + # look like that in function my_print_variables in my_getopt.c + mtr_warning("Could not parse variable list line : $line"); + } + } + } + } + } + rmtree($tmpdir) if (!$opt_tmpdir); + mtr_error("Could not find version of MySQL") unless $mysql_version_id; + mtr_error("Could not find variabes list") unless $found_variable_list_start; + +} + + +sub run_query($$) { + my ($mysqld, $query)= @_; + + my $args; + mtr_init_args(\$args); + + mtr_add_arg($args, "--no-defaults"); + mtr_add_arg($args, "--user=%s", $opt_user); + mtr_add_arg($args, "--port=%d", $mysqld->{'port'}); + mtr_add_arg($args, "--socket=%s", $mysqld->{'path_sock'}); + mtr_add_arg($args, "--silent"); # Tab separated output + mtr_add_arg($args, "-e '%s'", $query); + + my $cmd= "$exe_mysql " . join(' ', @$args); + mtr_verbose("cmd: $cmd"); + return `$cmd`; +} + + +sub collect_mysqld_features_from_running_server () +{ + my $list= run_query($master->[0], "use mysql; SHOW VARIABLES"); + + foreach my $line (split('\n', $list)) + { + # Put variables into hash + if ( $line =~ /^([\S]+)[ \t]+(.*?)\r?$/ ) + { + print "$1=\"$2\"\n"; + $mysqld_variables{$1}= $2; + } + } +} + +sub executable_setup_im () { + + # Look for instance manager binary - mysqlmanager + $exe_im= + mtr_exe_maybe_exists( + "$glob_basedir/server-tools/instance-manager/mysqlmanager", + "$glob_basedir/libexec/mysqlmanager", + "$glob_basedir/bin/mysqlmanager", + "$glob_basedir/sbin/mysqlmanager"); + + return ($exe_im eq ""); +} + +sub executable_setup_ndb () { + + # Look for ndb tols and binaries + my $ndb_path= mtr_file_exists("$glob_basedir/ndb", + "$glob_basedir/storage/ndb", + "$glob_basedir/bin"); + + $exe_ndbd= + mtr_exe_maybe_exists("$ndb_path/src/kernel/ndbd", + "$ndb_path/ndbd", + "$glob_basedir/libexec/ndbd"); + $exe_ndb_mgm= + mtr_exe_maybe_exists("$ndb_path/src/mgmclient/ndb_mgm", + "$ndb_path/ndb_mgm"); + $exe_ndb_mgmd= + mtr_exe_maybe_exists("$ndb_path/src/mgmsrv/ndb_mgmd", + "$ndb_path/ndb_mgmd", + "$glob_basedir/libexec/ndb_mgmd"); + $exe_ndb_waiter= + mtr_exe_maybe_exists("$ndb_path/tools/ndb_waiter", + "$ndb_path/ndb_waiter"); + + # May not exist + $path_ndb_tools_dir= mtr_file_exists("$ndb_path/tools", + "$ndb_path"); + # May not exist + $path_ndb_examples_dir= + mtr_file_exists("$ndb_path/ndbapi-examples", + "$ndb_path/examples"); + # May not exist + $exe_ndb_example= + mtr_file_exists("$path_ndb_examples_dir/ndbapi_simple/ndbapi_simple"); + + return ( $exe_ndbd eq "" or + $exe_ndb_mgm eq "" or + $exe_ndb_mgmd eq "" or + $exe_ndb_waiter eq ""); +} + +sub executable_setup () { + + # + # Check if libtool is available in this distribution/clone + # we need it when valgrinding or debugging non installed binary + # Otherwise valgrind will valgrind the libtool wrapper or bash + # and gdb will not find the real executable to debug + # + if ( -x "../libtool") + { + $exe_libtool= "../libtool"; + if ($opt_valgrind or $glob_debugger) + { + mtr_report("Using \"$exe_libtool\" when running valgrind or debugger"); + } + } + + # Look for my_print_defaults + $exe_my_print_defaults= + mtr_exe_exists(vs_config_dirs('extra', 'my_print_defaults'), + "$path_client_bindir/my_print_defaults", + "$glob_basedir/extra/my_print_defaults"); + + # Look for perror + $exe_perror= mtr_exe_exists(vs_config_dirs('extra', 'perror'), + "$glob_basedir/extra/perror", + "$path_client_bindir/perror"); + + # Look for the client binaries + $exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck"); + $exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump"); + $exe_mysqlimport= mtr_exe_exists("$path_client_bindir/mysqlimport"); + $exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow"); + $exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog"); + $exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin"); + $exe_mysql= mtr_exe_exists("$path_client_bindir/mysql"); + + if (!$opt_extern) + { + # Look for SQL scripts directory + if ( mtr_file_exists("$path_share/mysql_system_tables.sql") ne "") + { + # The SQL scripts are in path_share + $path_sql_dir= $path_share; + } + else + { + $path_sql_dir= mtr_path_exists("$glob_basedir/share", + "$glob_basedir/scripts"); + } + + if ( $mysql_version_id >= 50100 ) + { + $exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap"); + } + if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server ) + { + $exe_mysql_upgrade= mtr_exe_exists("$path_client_bindir/mysql_upgrade") + } + else + { + $exe_mysql_upgrade= ""; + } + + if ( ! $glob_win32 ) + { + # Look for mysql_fix_system_table script + $exe_mysql_fix_system_tables= + mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables", + "$path_client_bindir/mysql_fix_privilege_tables"); + } + + # Look for mysql_fix_privilege_tables.sql script + $file_mysql_fix_privilege_tables= + mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql", + "$glob_basedir/share/mysql_fix_privilege_tables.sql", + "$glob_basedir/share/mysql/mysql_fix_privilege_tables.sql"); + + if ( ! $opt_skip_ndbcluster and executable_setup_ndb()) + { + mtr_warning("Could not find all required ndb binaries, " . + "all ndb tests will fail, use --skip-ndbcluster to " . + "skip testing it."); + + foreach my $cluster (@{$clusters}) + { + $cluster->{"executable_setup_failed"}= 1; + } + } + + if ( ! $opt_skip_im and executable_setup_im()) + { + mtr_warning("Could not find all required instance manager binaries, " . + "all im tests will fail, use --skip-im to " . + "continue without instance manager"); + $instance_manager->{"executable_setup_failed"}= 1; + } + + # Look for the udf_example library + $lib_udf_example= + mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'), + "$glob_basedir/sql/.libs/udf_example.so",); + + # Look for the ha_example library + $lib_example_plugin= + mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'), + "$glob_basedir/storage/example/.libs/ha_example.so",); + + } + + # Look for mysqltest executable + if ( $glob_use_embedded_server ) + { + $exe_mysqltest= + mtr_exe_exists(vs_config_dirs('libmysqld/examples','mysqltest_embedded'), + "$glob_basedir/libmysqld/examples/mysqltest_embedded", + "$path_client_bindir/mysqltest_embedded"); + } + else + { + $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest"); + } + + # Look for mysql_client_test executable which may _not_ exist in + # some versions, test using it should be skipped + if ( $glob_use_embedded_server ) + { + $exe_mysql_client_test= + mtr_exe_maybe_exists( + vs_config_dirs('libmysqld/examples', 'mysql_client_test_embedded'), + "$glob_basedir/libmysqld/examples/mysql_client_test_embedded"); + } + else + { + $exe_mysql_client_test= + mtr_exe_maybe_exists(vs_config_dirs('tests', 'mysql_client_test'), + "$glob_basedir/tests/mysql_client_test", + "$glob_basedir/bin/mysql_client_test"); + } + + # Look for bug25714 executable which may _not_ exist in + # some versions, test using it should be skipped + $exe_bug25714= + mtr_exe_maybe_exists(vs_config_dirs('tests', 'bug25714'), + "$glob_basedir/tests/bug25714"); +} + + +sub generate_cmdline_mysqldump ($) { + my($mysqld) = @_; + return + mtr_native_path($exe_mysqldump) . + " --no-defaults -uroot --debug-check " . + "--port=$mysqld->{'port'} " . + "--socket=$mysqld->{'path_sock'} --password="; +} + + +############################################################################## +# +# Set environment to be used by childs of this process for +# things that are constant duting the whole lifetime of mysql-test-run.pl +# +############################################################################## + +sub mysql_client_test_arguments() +{ + my $exe= $exe_mysql_client_test; + + my $args; + mtr_init_args(\$args); + if ( $opt_valgrind_mysqltest ) + { + valgrind_arguments($args, \$exe); + } + + mtr_add_arg($args, "--no-defaults"); + mtr_add_arg($args, "--testcase"); + mtr_add_arg($args, "--user=root"); + mtr_add_arg($args, "--port=$master->[0]->{'port'}"); + mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}"); + + if ( $opt_extern || $mysql_version_id >= 50000 ) + { + mtr_add_arg($args, "--vardir=$opt_vardir") + } + + if ( $opt_debug ) + { + mtr_add_arg($args, + "--debug=d:t:A,$path_vardir_trace/log/mysql_client_test.trace"); + } + + if ( $glob_use_embedded_server ) + { + mtr_add_arg($args, + " -A --language=$path_language"); + mtr_add_arg($args, + " -A --datadir=$slave->[0]->{'path_myddir'}"); + mtr_add_arg($args, + " -A --character-sets-dir=$path_charsetsdir"); + } + + return join(" ", $exe, @$args); +} + +sub mysql_upgrade_arguments() +{ + my $exe= $exe_mysql_upgrade; + + my $args; + mtr_init_args(\$args); +# if ( $opt_valgrind_mysql_ugrade ) +# { +# valgrind_arguments($args, \$exe); +# } + + mtr_add_arg($args, "--no-defaults"); + mtr_add_arg($args, "--user=root"); + mtr_add_arg($args, "--port=$master->[0]->{'port'}"); + mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}"); + mtr_add_arg($args, "--datadir=$master->[0]->{'path_myddir'}"); + mtr_add_arg($args, "--basedir=$glob_basedir"); + mtr_add_arg($args, "--tmpdir=$opt_tmpdir"); + + if ( $opt_debug ) + { + mtr_add_arg($args, + "--debug=d:t:A,$path_vardir_trace/log/mysql_upgrade.trace"); + } + + return join(" ", $exe, @$args); +} + +# Note that some env is setup in spawn/run, in "mtr_process.pl" + +sub environment_setup () { + + umask(022); + + my @ld_library_paths; + + if ($path_client_libdir) + { + # Use the --client-libdir passed on commandline + push(@ld_library_paths, "$path_client_libdir"); + } + else + { + # Setup LD_LIBRARY_PATH so the libraries from this distro/clone + # are used in favor of the system installed ones + if ( $source_dist ) + { + push(@ld_library_paths, "$glob_basedir/libmysql/.libs/", + "$glob_basedir/libmysql_r/.libs/", + "$glob_basedir/zlib.libs/"); + } + else + { + push(@ld_library_paths, "$glob_basedir/lib"); + } + } + + # -------------------------------------------------------------------------- + # Add the path where libndbclient can be found + # -------------------------------------------------------------------------- + if ( $glob_ndbcluster_supported ) + { + push(@ld_library_paths, "$glob_basedir/storage/ndb/src/.libs"); + } + + # -------------------------------------------------------------------------- + # Valgrind need to be run with debug libraries otherwise it's almost + # impossible to add correct supressions, that means if "/usr/lib/debug" + # is available, it should be added to + # LD_LIBRARY_PATH + # + # But pthread is broken in libc6-dbg on Debian <= 3.1 (see Debian + # bug 399035, http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=399035), + # so don't change LD_LIBRARY_PATH on that platform. + # -------------------------------------------------------------------------- + my $debug_libraries_path= "/usr/lib/debug"; + my $deb_version; + if ( $opt_valgrind and -d $debug_libraries_path and + (! -e '/etc/debian_version' or + ($deb_version= mtr_grab_file('/etc/debian_version')) !~ /^[0-9]+\.[0-9]$/ or + $deb_version > 3.1 ) ) + { + push(@ld_library_paths, $debug_libraries_path); + } + + $ENV{'LD_LIBRARY_PATH'}= join(":", @ld_library_paths, + $ENV{'LD_LIBRARY_PATH'} ? + split(':', $ENV{'LD_LIBRARY_PATH'}) : ()); + mtr_debug("LD_LIBRARY_PATH: $ENV{'LD_LIBRARY_PATH'}"); + + $ENV{'DYLD_LIBRARY_PATH'}= join(":", @ld_library_paths, + $ENV{'DYLD_LIBRARY_PATH'} ? + split(':', $ENV{'DYLD_LIBRARY_PATH'}) : ()); + mtr_debug("DYLD_LIBRARY_PATH: $ENV{'DYLD_LIBRARY_PATH'}"); + + # The environment variable used for shared libs on AIX + $ENV{'SHLIB_PATH'}= join(":", @ld_library_paths, + $ENV{'SHLIB_PATH'} ? + split(':', $ENV{'SHLIB_PATH'}) : ()); + mtr_debug("SHLIB_PATH: $ENV{'SHLIB_PATH'}"); + + # The environment variable used for shared libs on hp-ux + $ENV{'LIBPATH'}= join(":", @ld_library_paths, + $ENV{'LIBPATH'} ? + split(':', $ENV{'LIBPATH'}) : ()); + mtr_debug("LIBPATH: $ENV{'LIBPATH'}"); + + # -------------------------------------------------------------------------- + # Also command lines in .opt files may contain env vars + # -------------------------------------------------------------------------- + + $ENV{'CHARSETSDIR'}= $path_charsetsdir; + $ENV{'UMASK'}= "0660"; # The octal *string* + $ENV{'UMASK_DIR'}= "0770"; # The octal *string* + + # + # MySQL tests can produce output in various character sets + # (especially, ctype_xxx.test). To avoid confusing Perl + # with output which is incompatible with the current locale + # settings, we reset the current values of LC_ALL and LC_CTYPE to "C". + # For details, please see + # Bug#27636 tests fails if LC_* variables set to *_*.UTF-8 + # + $ENV{'LC_ALL'}= "C"; + $ENV{'LC_CTYPE'}= "C"; + + $ENV{'LC_COLLATE'}= "C"; + $ENV{'USE_RUNNING_SERVER'}= $opt_extern; + $ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir; + $ENV{'MYSQLTEST_VARDIR'}= $opt_vardir; + $ENV{'MYSQL_TMP_DIR'}= $opt_tmpdir; + $ENV{'MASTER_MYSOCK'}= $master->[0]->{'path_sock'}; + $ENV{'MASTER_MYSOCK1'}= $master->[1]->{'path_sock'}; + $ENV{'MASTER_MYPORT'}= $master->[0]->{'port'}; + $ENV{'MASTER_MYPORT1'}= $master->[1]->{'port'}; + $ENV{'SLAVE_MYSOCK'}= $slave->[0]->{'path_sock'}; + $ENV{'SLAVE_MYPORT'}= $slave->[0]->{'port'}; + $ENV{'SLAVE_MYPORT1'}= $slave->[1]->{'port'}; + $ENV{'SLAVE_MYPORT2'}= $slave->[2]->{'port'}; + $ENV{'MYSQL_TCP_PORT'}= $mysqld_variables{'port'}; + $ENV{'DEFAULT_MASTER_PORT'}= $mysqld_variables{'master-port'}; + + $ENV{'IM_PATH_SOCK'}= $instance_manager->{path_sock}; + $ENV{'IM_USERNAME'}= $instance_manager->{admin_login}; + $ENV{'IM_PASSWORD'}= $instance_manager->{admin_password}; + $ENV{MTR_BUILD_THREAD}= $opt_mtr_build_thread; + + $ENV{'EXE_MYSQL'}= $exe_mysql; + + + # ---------------------------------------------------- + # Setup env for NDB + # ---------------------------------------------------- + if ( ! $opt_skip_ndbcluster ) + { + $ENV{'NDB_MGM'}= $exe_ndb_mgm; + + $ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port; + $ENV{'NDBCLUSTER_PORT_SLAVE'}= $opt_ndbcluster_port_slave; + + $ENV{'NDB_EXTRA_TEST'}= $opt_ndb_extra_test; + + $ENV{'NDB_BACKUP_DIR'}= $clusters->[0]->{'data_dir'}; + $ENV{'NDB_DATA_DIR'}= $clusters->[0]->{'data_dir'}; + $ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir; + $ENV{'NDB_TOOLS_OUTPUT'}= $path_ndb_testrun_log; + + if ( $mysql_version_id >= 50000 ) + { + $ENV{'NDB_EXAMPLES_DIR'}= $path_ndb_examples_dir; + $ENV{'MY_NDB_EXAMPLES_BINARY'}= $exe_ndb_example; + } + $ENV{'NDB_EXAMPLES_OUTPUT'}= $path_ndb_testrun_log; + } + + # ---------------------------------------------------- + # Setup env for IM + # ---------------------------------------------------- + if ( ! $opt_skip_im ) + { + $ENV{'IM_EXE'}= $exe_im; + $ENV{'IM_PATH_PID'}= $instance_manager->{path_pid}; + $ENV{'IM_PATH_ANGEL_PID'}= $instance_manager->{path_angel_pid}; + $ENV{'IM_PORT'}= $instance_manager->{port}; + $ENV{'IM_DEFAULTS_PATH'}= $instance_manager->{defaults_file}; + $ENV{'IM_PASSWORD_PATH'}= $instance_manager->{password_file}; + + $ENV{'IM_MYSQLD1_SOCK'}= + $instance_manager->{instances}->[0]->{path_sock}; + $ENV{'IM_MYSQLD1_PORT'}= + $instance_manager->{instances}->[0]->{port}; + $ENV{'IM_MYSQLD1_PATH_PID'}= + $instance_manager->{instances}->[0]->{path_pid}; + $ENV{'IM_MYSQLD2_SOCK'}= + $instance_manager->{instances}->[1]->{path_sock}; + $ENV{'IM_MYSQLD2_PORT'}= + $instance_manager->{instances}->[1]->{port}; + $ENV{'IM_MYSQLD2_PATH_PID'}= + $instance_manager->{instances}->[1]->{path_pid}; + } + + # ---------------------------------------------------- + # Setup env so childs can execute mysqlcheck + # ---------------------------------------------------- + my $cmdline_mysqlcheck= + mtr_native_path($exe_mysqlcheck) . + " --no-defaults --debug-check -uroot " . + "--port=$master->[0]->{'port'} " . + "--socket=$master->[0]->{'path_sock'} --password="; + + if ( $opt_debug ) + { + $cmdline_mysqlcheck .= + " --debug=d:t:A,$path_vardir_trace/log/mysqlcheck.trace"; + } + $ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck; + + # ---------------------------------------------------- + # Setup env to childs can execute myqldump + # ---------------------------------------------------- + my $cmdline_mysqldump= generate_cmdline_mysqldump($master->[0]); + my $cmdline_mysqldumpslave= generate_cmdline_mysqldump($slave->[0]); + + if ( $opt_debug ) + { + $cmdline_mysqldump .= + " --debug=d:t:A,$path_vardir_trace/log/mysqldump-master.trace"; + $cmdline_mysqldumpslave .= + " --debug=d:t:A,$path_vardir_trace/log/mysqldump-slave.trace"; + } + $ENV{'MYSQL_DUMP'}= $cmdline_mysqldump; + $ENV{'MYSQL_DUMP_SLAVE'}= $cmdline_mysqldumpslave; + + + # ---------------------------------------------------- + # Setup env so childs can execute mysqlslap + # ---------------------------------------------------- + if ( $exe_mysqlslap ) + { + my $cmdline_mysqlslap= + mtr_native_path($exe_mysqlslap) . + " -uroot " . + "--port=$master->[0]->{'port'} " . + "--socket=$master->[0]->{'path_sock'} --password= "; + + if ( $opt_debug ) + { + $cmdline_mysqlslap .= + " --debug=d:t:A,$path_vardir_trace/log/mysqlslap.trace"; + } + $ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap; + } + + # ---------------------------------------------------- + # Setup env so childs can execute mysqlimport + # ---------------------------------------------------- + my $cmdline_mysqlimport= + mtr_native_path($exe_mysqlimport) . + " -uroot --debug-check " . + "--port=$master->[0]->{'port'} " . + "--socket=$master->[0]->{'path_sock'} --password="; + + if ( $opt_debug ) + { + $cmdline_mysqlimport .= + " --debug=d:t:A,$path_vardir_trace/log/mysqlimport.trace"; + } + $ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport; + + + # ---------------------------------------------------- + # Setup env so childs can execute mysqlshow + # ---------------------------------------------------- + my $cmdline_mysqlshow= + mtr_native_path($exe_mysqlshow) . + " -uroot --debug-check " . + "--port=$master->[0]->{'port'} " . + "--socket=$master->[0]->{'path_sock'} --password="; + + if ( $opt_debug ) + { + $cmdline_mysqlshow .= + " --debug=d:t:A,$path_vardir_trace/log/mysqlshow.trace"; + } + $ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow; + + # ---------------------------------------------------- + # Setup env so childs can execute mysqlbinlog + # ---------------------------------------------------- + my $cmdline_mysqlbinlog= + mtr_native_path($exe_mysqlbinlog) . + " --no-defaults --disable-force-if-open --debug-check"; + if ( !$opt_extern && $mysql_version_id >= 50000 ) + { + $cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir"; + } + # Always use the given tmpdir for the LOAD files created + # by mysqlbinlog + $cmdline_mysqlbinlog .=" --local-load=$opt_tmpdir"; + + if ( $opt_debug ) + { + $cmdline_mysqlbinlog .= + " --debug=d:t:A,$path_vardir_trace/log/mysqlbinlog.trace"; + } + $ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog; + + # ---------------------------------------------------- + # Setup env so childs can execute mysql + # ---------------------------------------------------- + my $cmdline_mysql= + mtr_native_path($exe_mysql) . + " --no-defaults --debug-check --host=localhost --user=root --password= " . + "--port=$master->[0]->{'port'} " . + "--socket=$master->[0]->{'path_sock'} ". + "--character-sets-dir=$path_charsetsdir"; + + $ENV{'MYSQL'}= $cmdline_mysql; + + # ---------------------------------------------------- + # Setup env so childs can execute bug25714 + # ---------------------------------------------------- + $ENV{'MYSQL_BUG25714'}= $exe_bug25714; + + # ---------------------------------------------------- + # Setup env so childs can execute mysql_client_test + # ---------------------------------------------------- + $ENV{'MYSQL_CLIENT_TEST'}= mysql_client_test_arguments(); + + # ---------------------------------------------------- + # Setup env so childs can execute mysql_upgrade + # ---------------------------------------------------- + if ( !$opt_extern && $mysql_version_id >= 50000 ) + { + $ENV{'MYSQL_UPGRADE'}= mysql_upgrade_arguments(); + } + + # ---------------------------------------------------- + # Setup env so childs can execute mysql_fix_system_tables + # ---------------------------------------------------- + if ( !$opt_extern && ! $glob_win32 ) + { + my $cmdline_mysql_fix_system_tables= + "$exe_mysql_fix_system_tables --no-defaults --host=localhost " . + "--user=root --password= " . + "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " . + "--port=$master->[0]->{'port'} " . + "--socket=$master->[0]->{'path_sock'}"; + $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables; + + } + if ( !$opt_extern ) + { + $ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables; + } + + # ---------------------------------------------------- + # Setup env so childs can execute my_print_defaults + # ---------------------------------------------------- + $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= mtr_native_path($exe_my_print_defaults); + + # ---------------------------------------------------- + # Setup env so childs can execute mysqladmin + # ---------------------------------------------------- + $ENV{'MYSQLADMIN'}= mtr_native_path($exe_mysqladmin); + + # ---------------------------------------------------- + # Setup env so childs can execute perror + # ---------------------------------------------------- + $ENV{'MY_PERROR'}= mtr_native_path($exe_perror); + + # ---------------------------------------------------- + # Add the path where mysqld will find udf_example.so + # ---------------------------------------------------- + $ENV{'UDF_EXAMPLE_LIB'}= + ($lib_udf_example ? basename($lib_udf_example) : ""); + $ENV{'UDF_EXAMPLE_LIB_OPT'}= + ($lib_udf_example ? "--plugin_dir=" . dirname($lib_udf_example) : ""); + + # ---------------------------------------------------- + # Add the path where mysqld will find ha_example.so + # ---------------------------------------------------- + $ENV{'EXAMPLE_PLUGIN'}= + ($lib_example_plugin ? basename($lib_example_plugin) : ""); + $ENV{'EXAMPLE_PLUGIN_OPT'}= + ($lib_example_plugin ? "--plugin_dir=" . dirname($lib_example_plugin) : ""); + + # ---------------------------------------------------- + # Setup env so childs can execute myisampack and myisamchk + # ---------------------------------------------------- + $ENV{'MYISAMCHK'}= mtr_native_path(mtr_exe_exists( + vs_config_dirs('storage/myisam', 'myisamchk'), + vs_config_dirs('myisam', 'myisamchk'), + "$path_client_bindir/myisamchk", + "$glob_basedir/storage/myisam/myisamchk", + "$glob_basedir/myisam/myisamchk")); + $ENV{'MYISAMPACK'}= mtr_native_path(mtr_exe_exists( + vs_config_dirs('storage/myisam', 'myisampack'), + vs_config_dirs('myisam', 'myisampack'), + "$path_client_bindir/myisampack", + "$glob_basedir/storage/myisam/myisampack", + "$glob_basedir/myisam/myisampack")); + + # ---------------------------------------------------- + # Setup env so childs can execute maria_pack and maria_chk + # ---------------------------------------------------- + $ENV{'MARIA_CHK'}= mtr_native_path(mtr_exe_maybe_exists( + vs_config_dirs('storage/maria', 'maria_chk'), + vs_config_dirs('maria', 'maria_chk'), + "$path_client_bindir/maria_chk", + "$glob_basedir/storage/maria/maria_chk", + "$glob_basedir/maria/maria_chk")); + $ENV{'MARIA_PACK'}= mtr_native_path(mtr_exe_maybe_exists( + vs_config_dirs('storage/maria', 'maria_pack'), + vs_config_dirs('maria', 'maria_pack'), + "$path_client_bindir/maria_pack", + "$glob_basedir/storage/maria/maria_pack", + "$glob_basedir/maria/maria_pack")); + + # ---------------------------------------------------- + # We are nice and report a bit about our settings + # ---------------------------------------------------- + if (!$opt_extern) + { + print "Using MTR_BUILD_THREAD = $ENV{MTR_BUILD_THREAD}\n"; + print "Using MASTER_MYPORT = $ENV{MASTER_MYPORT}\n"; + print "Using MASTER_MYPORT1 = $ENV{MASTER_MYPORT1}\n"; + print "Using SLAVE_MYPORT = $ENV{SLAVE_MYPORT}\n"; + print "Using SLAVE_MYPORT1 = $ENV{SLAVE_MYPORT1}\n"; + print "Using SLAVE_MYPORT2 = $ENV{SLAVE_MYPORT2}\n"; + if ( ! $opt_skip_ndbcluster ) + { + print "Using NDBCLUSTER_PORT = $ENV{NDBCLUSTER_PORT}\n"; + if ( ! $opt_skip_ndbcluster_slave ) + { + print "Using NDBCLUSTER_PORT_SLAVE = $ENV{NDBCLUSTER_PORT_SLAVE}\n"; + } + } + if ( ! $opt_skip_im ) + { + print "Using IM_PORT = $ENV{IM_PORT}\n"; + print "Using IM_MYSQLD1_PORT = $ENV{IM_MYSQLD1_PORT}\n"; + print "Using IM_MYSQLD2_PORT = $ENV{IM_MYSQLD2_PORT}\n"; + } + } + + # Create an environment variable to make it possible + # to detect that valgrind is being used from test cases + $ENV{'VALGRIND_TEST'}= $opt_valgrind; + +} + + +############################################################################## +# +# If we get a ^C, we try to clean up before termination +# +############################################################################## +# FIXME check restrictions what to do in a signal handler + +sub signal_setup () { + $SIG{INT}= \&handle_int_signal; +} + + +sub handle_int_signal () { + $SIG{INT}= 'DEFAULT'; # If we get a ^C again, we die... + mtr_warning("got INT signal, cleaning up....."); + stop_all_servers(); + mtr_error("We die from ^C signal from user"); +} + + +############################################################################## +# +# Handle left overs from previous runs +# +############################################################################## + +sub kill_running_servers () { + + if ( $opt_fast or $glob_use_embedded_server ) + { + # FIXME is embedded server really using PID files?! + unlink($master->[0]->{'path_pid'}); + unlink($master->[1]->{'path_pid'}); + unlink($slave->[0]->{'path_pid'}); + unlink($slave->[1]->{'path_pid'}); + unlink($slave->[2]->{'path_pid'}); + } + else + { + # Ensure that no old mysqld test servers are running + # This is different from terminating processes we have + # started from this run of the script, this is terminating + # leftovers from previous runs. + mtr_kill_leftovers(); + } +} + +# +# Remove var and any directories in var/ created by previous +# tests +# +sub remove_stale_vardir () { + + mtr_report("Removing Stale Files"); + + # Safety! + mtr_error("No, don't remove the vardir when running with --extern") + if $opt_extern; + + mtr_verbose("opt_vardir: $opt_vardir"); + if ( $opt_vardir eq $default_vardir ) + { + # + # Running with "var" in mysql-test dir + # + if ( -l $opt_vardir) + { + # var is a symlink + + if ( $opt_mem and readlink($opt_vardir) eq $opt_mem ) + { + # Remove the directory which the link points at + mtr_verbose("Removing " . readlink($opt_vardir)); + mtr_rmtree(readlink($opt_vardir)); + + # Remove the "var" symlink + mtr_verbose("unlink($opt_vardir)"); + unlink($opt_vardir); + } + elsif ( $opt_mem ) + { + # Just remove the "var" symlink + mtr_report("WARNING: Removing '$opt_vardir' symlink it's wrong"); + + mtr_verbose("unlink($opt_vardir)"); + unlink($opt_vardir); + } + else + { + # Some users creates a soft link in mysql-test/var to another area + # - allow it, but remove all files in it + + mtr_report("WARNING: Using the 'mysql-test/var' symlink"); + + # Make sure the directory where it points exist + mtr_error("The destination for symlink $opt_vardir does not exist") + if ! -d readlink($opt_vardir); + + foreach my $bin ( glob("$opt_vardir/*") ) + { + mtr_verbose("Removing bin $bin"); + mtr_rmtree($bin); + } + } + } + else + { + # Remove the entire "var" dir + mtr_verbose("Removing $opt_vardir/"); + mtr_rmtree("$opt_vardir/"); + } + + if ( $opt_mem ) + { + # A symlink from var/ to $opt_mem will be set up + # remove the $opt_mem dir to assure the symlink + # won't point at an old directory + mtr_verbose("Removing $opt_mem"); + mtr_rmtree($opt_mem); + } + + } + 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 + mtr_verbose("Removing $default_vardir"); + mtr_rmtree($default_vardir); + + # Remove the "var" dir + mtr_verbose("Removing $opt_vardir/"); + mtr_rmtree("$opt_vardir/"); + } +} + +# +# Create var and the directories needed in var +# +sub setup_vardir() { + mtr_report("Creating Directories"); + + if ( $opt_vardir eq $default_vardir ) + { + # + # Running with "var" in mysql-test dir + # + if ( -l $opt_vardir ) + { + # it's a symlink + + # Make sure the directory where it points exist + mtr_error("The destination for symlink $opt_vardir does not exist") + if ! -d readlink($opt_vardir); + } + elsif ( $opt_mem ) + { + # Runinng with "var" as a link to some "memory" location, normally tmpfs + mtr_verbose("Creating $opt_mem"); + mkpath($opt_mem); + + mtr_report("Symlinking 'var' to '$opt_mem'"); + symlink($opt_mem, $opt_vardir); + } + } + + if ( ! -d $opt_vardir ) + { + mtr_verbose("Creating $opt_vardir"); + mkpath($opt_vardir); + } + + # Ensure a proper error message if vardir couldn't be created + unless ( -d $opt_vardir and -w $opt_vardir ) + { + mtr_error("Writable 'var' directory is needed, use the " . + "'--vardir=<path>' option"); + } + + mkpath("$opt_vardir/log"); + mkpath("$opt_vardir/run"); + mkpath("$opt_vardir/tmp"); + mkpath($opt_tmpdir) if $opt_tmpdir ne "$opt_vardir/tmp"; + + # Create new data dirs + foreach my $data_dir (@data_dir_lst) + { + mkpath("$data_dir/mysql"); + mkpath("$data_dir/test"); + } + + # Make a link std_data_ln in var/ that points to std_data + if ( ! $glob_win32 ) + { + symlink("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data_ln"); + } + else + { + # on windows, copy all files from std_data into var/std_data_ln + mkpath("$opt_vardir/std_data_ln"); + mtr_copy_dir("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data_ln"); + } + + # Remove old log files + foreach my $name (glob("r/*.progress r/*.log r/*.warnings")) + { + unlink($name); + } + if ( $opt_valgrind and $opt_debug ) + { + # When both --valgrind and --debug is selected, send + # all output to the trace file, making it possible to + # see the exact location where valgrind complains + foreach my $mysqld (@{$master}, @{$slave}) + { + my $sidx= $mysqld->{idx} ? "$mysqld->{idx}" : ""; + my $trace_name= "$opt_vardir/log/" . $mysqld->{type} . "$sidx.trace"; + open(LOG, ">$mysqld->{path_myerr}") or die "Can't create $mysqld->{path_myerr}\n"; + print LOG " +NOTE: When running with --valgrind --debug the output from the .err file is +stored together with the trace file to make it easier to find the exact +position for valgrind errors. +See trace file $trace_name.\n"; + close(LOG); + $mysqld->{path_myerr}= $trace_name; + } + } +} + + +sub check_running_as_root () { + # Check if running as root + # i.e a file can be read regardless what mode we set it to + my $test_file= "$opt_vardir/test_running_as_root.txt"; + mtr_tofile($test_file, "MySQL"); + chmod(oct("0000"), $test_file); + + my $result=""; + if (open(FILE,"<",$test_file)) + { + $result= join('', <FILE>); + close FILE; + } + + # Some filesystems( for example CIFS) allows reading a file + # although mode was set to 0000, but in that case a stat on + # the file will not return 0000 + my $file_mode= (stat($test_file))[2] & 07777; + + $ENV{'MYSQL_TEST_ROOT'}= "NO"; + mtr_verbose("result: $result, file_mode: $file_mode"); + if ($result eq "MySQL" && $file_mode == 0) + { + mtr_warning("running this script as _root_ will cause some " . + "tests to be skipped"); + $ENV{'MYSQL_TEST_ROOT'}= "YES"; + } + + chmod(oct("0755"), $test_file); + unlink($test_file); + +} + + +sub check_ssl_support ($) { + my $mysqld_variables= shift; + + if ($opt_skip_ssl || $opt_extern) + { + if (!$opt_extern) + { + mtr_report("Skipping SSL"); + } + $opt_ssl_supported= 0; + $opt_ssl= 0; + return; + } + + if ( ! $mysqld_variables->{'ssl'} ) + { + if ( $opt_ssl) + { + mtr_error("Couldn't find support for SSL"); + return; + } + mtr_report("Skipping SSL, mysqld not compiled with SSL"); + $opt_ssl_supported= 0; + $opt_ssl= 0; + return; + } + mtr_report("Setting mysqld to support SSL connections"); + $opt_ssl_supported= 1; +} + + +sub check_debug_support ($) { + my $mysqld_variables= shift; + + if ( ! $mysqld_variables->{'debug'} ) + { + #mtr_report("Binaries are not debug compiled"); + $debug_compiled_binaries= 0; + + if ( $opt_debug ) + { + mtr_error("Can't use --debug, binaries does not support it"); + } + return; + } + mtr_report("Binaries are debug compiled"); + $debug_compiled_binaries= 1; +} + +############################################################################## +# +# Helper function to handle configuration-based subdirectories which Visual +# Studio uses for storing binaries. If opt_vs_config is set, this returns +# a path based on that setting; if not, it returns paths for the default +# /release/ and /debug/ subdirectories. +# +# $exe can be undefined, if the directory itself will be used +# +############################################################################### + +sub vs_config_dirs ($$) { + my ($path_part, $exe) = @_; + + $exe = "" if not defined $exe; + + if ($opt_vs_config) + { + return ("$glob_basedir/$path_part/$opt_vs_config/$exe"); + } + + return ("$glob_basedir/$path_part/release/$exe", + "$glob_basedir/$path_part/relwithdebinfo/$exe", + "$glob_basedir/$path_part/debug/$exe"); +} + +############################################################################## +# +# Start the ndb cluster +# +############################################################################## + +sub check_ndbcluster_support ($) { + my $mysqld_variables= shift; + + if ($opt_skip_ndbcluster || $opt_extern) + { + if (!$opt_extern) + { + mtr_report("Skipping ndbcluster"); + } + $opt_skip_ndbcluster_slave= 1; + return; + } + + if ( ! $mysqld_variables->{'ndb-connectstring'} ) + { + mtr_report("Skipping ndbcluster, mysqld not compiled with ndbcluster"); + $opt_skip_ndbcluster= 1; + $opt_skip_ndbcluster_slave= 1; + return; + } + $glob_ndbcluster_supported= 1; + mtr_report("Using ndbcluster when necessary, mysqld supports it"); + + if ( $mysql_version_id < 50100 ) + { + # Slave cluster is not supported until 5.1 + $opt_skip_ndbcluster_slave= 1; + + } + + return; +} + + +sub ndbcluster_start_install ($) { + my $cluster= shift; + + mtr_report("Installing $cluster->{'name'} Cluster"); + + mkdir($cluster->{'data_dir'}); + + # Create a config file from template + my $ndb_no_ord=512; + my $ndb_no_attr=2048; + my $ndb_con_op=105000; + my $ndb_dmem="80M"; + my $ndb_imem="24M"; + my $ndb_pbmem="32M"; + my $nodes= $cluster->{'nodes'}; + my $ndb_host= "localhost"; + my $ndb_diskless= 0; + + if (!$opt_bench) + { + # Use a smaller configuration + if ( $mysql_version_id < 50100 ) + { + # 4.1 and 5.0 is using a "larger" --small configuration + $ndb_no_ord=128; + $ndb_con_op=10000; + $ndb_dmem="40M"; + $ndb_imem="12M"; + } + else + { + $ndb_no_ord=32; + $ndb_con_op=10000; + $ndb_dmem="20M"; + $ndb_imem="1M"; + $ndb_pbmem="4M"; + } + } + + my $config_file_template= "lib/v1/ndb_config_${nodes}_node.ini"; + my $config_file= "$cluster->{'data_dir'}/config.ini"; + + open(IN, $config_file_template) + or mtr_error("Can't open $config_file_template: $!"); + open(OUT, ">", $config_file) + or mtr_error("Can't write to $config_file: $!"); + while (<IN>) + { + chomp; + + s/CHOOSE_MaxNoOfAttributes/$ndb_no_attr/; + s/CHOOSE_MaxNoOfOrderedIndexes/$ndb_no_ord/; + s/CHOOSE_MaxNoOfConcurrentOperations/$ndb_con_op/; + s/CHOOSE_DataMemory/$ndb_dmem/; + s/CHOOSE_IndexMemory/$ndb_imem/; + s/CHOOSE_Diskless/$ndb_diskless/; + s/CHOOSE_HOSTNAME_.*/$ndb_host/; + s/CHOOSE_FILESYSTEM/$cluster->{'data_dir'}/; + s/CHOOSE_PORT_MGM/$cluster->{'port'}/; + if ( $mysql_version_id < 50000 ) + { + my $base_port= $cluster->{'port'} + 1; + s/CHOOSE_PORT_TRANSPORTER/$base_port/; + } + s/CHOOSE_DiskPageBufferMemory/$ndb_pbmem/; + + print OUT "$_ \n"; + } + close OUT; + close IN; + + + # Start cluster with "--initial" + + ndbcluster_start($cluster, "--initial"); + + return 0; +} + + +sub ndbcluster_wait_started($$){ + my $cluster= shift; + my $ndb_waiter_extra_opt= shift; + my $path_waiter_log= "$cluster->{'data_dir'}/ndb_waiter.log"; + my $args; + + mtr_init_args(\$args); + + mtr_add_arg($args, "--no-defaults"); + mtr_add_arg($args, "--core"); + mtr_add_arg($args, "--ndb-connectstring=%s", $cluster->{'connect_string'}); + mtr_add_arg($args, "--timeout=60"); + + if ($ndb_waiter_extra_opt) + { + mtr_add_arg($args, "$ndb_waiter_extra_opt"); + } + + # Start the ndb_waiter which will connect to the ndb_mgmd + # and poll it for state of the ndbd's, will return when + # all nodes in the cluster is started + my $res= mtr_run($exe_ndb_waiter, $args, + "", $path_waiter_log, $path_waiter_log, ""); + mtr_verbose("ndbcluster_wait_started, returns: $res") if $res; + return $res; +} + + + +sub mysqld_wait_started($){ + my $mysqld= shift; + + if (sleep_until_file_created($mysqld->{'path_pid'}, + $mysqld->{'start_timeout'}, + $mysqld->{'pid'}) == 0) + { + # Failed to wait for pid file + return 1; + } + + # Get the "real pid" of the process, it will be used for killing + # the process in ActiveState's perl on windows + $mysqld->{'real_pid'}= mtr_get_pid_from_file($mysqld->{'path_pid'}); + + return 0; +} + + +sub ndb_mgmd_wait_started($) { + my ($cluster)= @_; + + my $retries= 100; + while (ndbcluster_wait_started($cluster, "--no-contact") and + $retries) + { + # Millisceond sleep emulated with select + select(undef, undef, undef, (0.1)); + + $retries--; + } + + return $retries == 0; + +} + +sub ndb_mgmd_start ($) { + my $cluster= shift; + + my $args; # Arg vector + my $pid= -1; + + mtr_init_args(\$args); + mtr_add_arg($args, "--no-defaults"); + mtr_add_arg($args, "--core"); + mtr_add_arg($args, "--nodaemon"); + mtr_add_arg($args, "--config-file=%s", "$cluster->{'data_dir'}/config.ini"); + + + my $path_ndb_mgmd_log= "$cluster->{'data_dir'}/\l$cluster->{'name'}_ndb_mgmd.log"; + $pid= mtr_spawn($exe_ndb_mgmd, $args, "", + $path_ndb_mgmd_log, + $path_ndb_mgmd_log, + "", + { append_log_file => 1 }); + + # FIXME Should not be needed + # Unfortunately the cluster nodes will fail to start + # if ndb_mgmd has not started properly + if (ndb_mgmd_wait_started($cluster)) + { + mtr_error("Failed to wait for start of ndb_mgmd"); + } + + # Remember pid of ndb_mgmd + $cluster->{'pid'}= $pid; + + mtr_verbose("ndb_mgmd_start, pid: $pid"); + + return $pid; +} + + +sub ndbd_start ($$$) { + my $cluster= shift; + my $idx= shift; + my $extra_args= shift; + + my $args; # Arg vector + my $pid= -1; + + mtr_init_args(\$args); + mtr_add_arg($args, "--no-defaults"); + mtr_add_arg($args, "--core"); + mtr_add_arg($args, "--ndb-connectstring=%s", "$cluster->{'connect_string'}"); + if ( $mysql_version_id >= 50000) + { + mtr_add_arg($args, "--character-sets-dir=%s", "$path_charsetsdir"); + } + mtr_add_arg($args, "--nodaemon"); + mtr_add_arg($args, "$extra_args"); + + my $nodeid= $cluster->{'ndbds'}->[$idx]->{'nodeid'}; + my $path_ndbd_log= "$cluster->{'data_dir'}/ndb_${nodeid}.log"; + $pid= mtr_spawn($exe_ndbd, $args, "", + $path_ndbd_log, + $path_ndbd_log, + "", + { append_log_file => 1 }); + + # Add pid to list of pids for this cluster + $cluster->{'ndbds'}->[$idx]->{'pid'}= $pid; + + # Rememeber options used when starting + $cluster->{'ndbds'}->[$idx]->{'start_extra_args'}= $extra_args; + $cluster->{'ndbds'}->[$idx]->{'idx'}= $idx; + + mtr_verbose("ndbd_start, pid: $pid"); + + return $pid; +} + + +sub ndbcluster_start ($$) { + my $cluster= shift; + my $extra_args= shift; + + mtr_verbose("ndbcluster_start '$cluster->{'name'}'"); + + if ( $cluster->{'use_running'} ) + { + return 0; + } + + if ( $cluster->{'pid'} ) + { + mtr_error("Cluster '$cluster->{'name'}' already started"); + } + + ndb_mgmd_start($cluster); + + for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ ) + { + ndbd_start($cluster, $idx, $extra_args); + } + + return 0; +} + + +sub rm_ndbcluster_tables ($) { + my $dir= shift; + foreach my $bin ( glob("$dir/mysql/ndb_apply_status*"), + glob("$dir/mysql/ndb_schema*")) + { + unlink($bin); + } +} + + +############################################################################## +# +# Run the benchmark suite +# +############################################################################## + +sub run_benchmarks ($) { + my $benchmark= shift; + + my $args; + + if ( ! $glob_use_embedded_server ) + { + mysqld_start($master->[0],[],[]); + if ( ! $master->[0]->{'pid'} ) + { + mtr_error("Can't start the mysqld server"); + } + } + + mtr_init_args(\$args); + + mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'}); + mtr_add_arg($args, "--user=%s", $opt_user); + + if ( $opt_small_bench ) + { + mtr_add_arg($args, "--small-test"); + mtr_add_arg($args, "--small-tables"); + } + + if ( $opt_with_ndbcluster ) + { + mtr_add_arg($args, "--create-options=TYPE=ndb"); + } + + chdir($glob_mysql_bench_dir) + or mtr_error("Couldn't chdir to '$glob_mysql_bench_dir': $!"); + + if ( ! $benchmark ) + { + mtr_add_arg($args, "--log"); + mtr_run("$glob_mysql_bench_dir/run-all-tests", $args, "", "", "", ""); + # FIXME check result code?! + } + elsif ( -x $benchmark ) + { + mtr_run("$glob_mysql_bench_dir/$benchmark", $args, "", "", "", ""); + # FIXME check result code?! + } + else + { + mtr_error("Benchmark $benchmark not found"); + } + + chdir($glob_mysql_test_dir); # Go back + + if ( ! $glob_use_embedded_server ) + { + stop_masters(); + } +} + + +############################################################################## +# +# Run the tests +# +############################################################################## + +sub run_tests () { + my ($tests)= @_; + + mtr_print_thick_line(); + + mtr_timer_start($glob_timers,"suite", 60 * $opt_suite_timeout); + + mtr_report_tests_not_skipped_though_disabled($tests); + + mtr_print_header(); + + foreach my $tinfo ( @$tests ) + { + if (run_testcase_check_skip_test($tinfo)) + { + next; + } + + mtr_timer_start($glob_timers,"testcase", 60 * $opt_testcase_timeout); + run_testcase($tinfo); + mtr_timer_stop($glob_timers,"testcase"); + } + + mtr_print_line(); + + if ( ! $glob_debugger and + ! $opt_extern and + ! $glob_use_embedded_server ) + { + stop_all_servers(); + } + + if ( $opt_gcov ) + { + gcov_collect(); # collect coverage information + } + if ( $opt_gprof ) + { + gprof_collect(); # collect coverage information + } + + mtr_report_stats($tests); + + mtr_timer_stop($glob_timers,"suite"); +} + + +############################################################################## +# +# Initiate the test databases +# +############################################################################## + +sub initialize_servers () { + + datadir_list_setup(); + + if ( $opt_extern ) + { + # Running against an already started server, if the specified + # vardir does not already exist it should be created + if ( ! -d $opt_vardir ) + { + mtr_report("Creating '$opt_vardir'"); + setup_vardir(); + } + else + { + mtr_verbose("No need to create '$opt_vardir' it already exists"); + } + } + else + { + kill_running_servers(); + + if ( ! $opt_start_dirty ) + { + remove_stale_vardir(); + setup_vardir(); + + mysql_install_db(); + if ( $opt_force ) + { + # Save a snapshot of the freshly installed db + # to make it possible to restore to a known point in time + save_installed_db(); + } + } + } + check_running_as_root(); + + mtr_log_init("$opt_vardir/log/mysql-test-run.log"); + +} + +sub mysql_install_db () { + + install_db('master', $master->[0]->{'path_myddir'}); + + if ($max_master_num > 1) + { + copy_install_db('master', $master->[1]->{'path_myddir'}); + } + + # Install the number of slave databses needed + for (my $idx= 0; $idx < $max_slave_num; $idx++) + { + copy_install_db("slave".($idx+1), $slave->[$idx]->{'path_myddir'}); + } + + if ( ! $opt_skip_im ) + { + im_prepare_env($instance_manager); + } + + my $cluster_started_ok= 1; # Assume it can be started + + my $cluster= $clusters->[0]; # Master cluster + if ($opt_skip_ndbcluster || + $cluster->{'use_running'} || + $cluster->{executable_setup_failed}) + { + # Don't install master cluster + } + elsif (ndbcluster_start_install($cluster)) + { + mtr_warning("Failed to start install of $cluster->{name}"); + $cluster_started_ok= 0; + } + + $cluster= $clusters->[1]; # Slave cluster + if ($max_slave_num == 0 || + $opt_skip_ndbcluster_slave || + $cluster->{'use_running'} || + $cluster->{executable_setup_failed}) + { + # Don't install slave cluster + } + elsif (ndbcluster_start_install($cluster)) + { + mtr_warning("Failed to start install of $cluster->{name}"); + $cluster_started_ok= 0; + } + + foreach $cluster (@{$clusters}) + { + + next if !$cluster->{'pid'}; + + $cluster->{'installed_ok'}= 1; # Assume install suceeds + + if (ndbcluster_wait_started($cluster, "")) + { + # failed to install, disable usage and flag that its no ok + mtr_report("ndbcluster_install of $cluster->{'name'} failed"); + $cluster->{"installed_ok"}= 0; + + $cluster_started_ok= 0; + } + } + + if ( ! $cluster_started_ok ) + { + if ( $opt_force) + { + # Continue without cluster + } + else + { + mtr_error("To continue, re-run with '--force'."); + } + } + + return 0; +} + + +sub copy_install_db ($$) { + my $type= shift; + my $data_dir= shift; + + mtr_report("Installing \u$type Database"); + + # Just copy the installed db from first master + mtr_copy_dir($master->[0]->{'path_myddir'}, $data_dir); + +} + + +sub install_db ($$) { + my $type= shift; + my $data_dir= shift; + + mtr_report("Installing \u$type Database"); + + my $args; + my $cmd_args; + mtr_init_args(\$args); + mtr_add_arg($args, "--no-defaults"); + mtr_add_arg($args, "--bootstrap"); + mtr_add_arg($args, "--basedir=%s", $path_my_basedir); + mtr_add_arg($args, "--datadir=%s", $data_dir); + mtr_add_arg($args, "--loose-skip-innodb"); + mtr_add_arg($args, "--loose-skip-ndbcluster"); + mtr_add_arg($args, "--loose-skip-maria"); + mtr_add_arg($args, "--disable-sync-frm"); + mtr_add_arg($args, "--loose-disable-debug"); + mtr_add_arg($args, "--tmpdir=."); + mtr_add_arg($args, "--core-file"); + + # + # Setup args for bootstrap.test + # + mtr_init_args(\$cmd_args); + mtr_add_arg($cmd_args, "--loose-skip-maria"); + + if ( $opt_debug ) + { + mtr_add_arg($args, "--debug=d:t:i:A,%s/log/bootstrap_%s.trace", + $path_vardir_trace, $type); + } + + if ( ! $glob_netware ) + { + mtr_add_arg($args, "--language=%s", $path_language); + mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); + } + + # If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g., + # configure --disable-grant-options), mysqld will not recognize the + # --bootstrap or --skip-grant-tables options. The user can set + # MYSQLD_BOOTSTRAP to the full path to a mysqld which does accept + # --bootstrap, to accommodate this. + my $exe_mysqld_bootstrap = $ENV{'MYSQLD_BOOTSTRAP'} || $exe_mysqld; + + # ---------------------------------------------------------------------- + # export MYSQLD_BOOTSTRAP_CMD variable containing <path>/mysqld <args> + # ---------------------------------------------------------------------- + $ENV{'MYSQLD_BOOTSTRAP_CMD'}= "$exe_mysqld_bootstrap " . join(" ", @$args) . + " " . join(" ", @$cmd_args); + + # ---------------------------------------------------------------------- + # Create the bootstrap.sql file + # ---------------------------------------------------------------------- + my $bootstrap_sql_file= "$opt_vardir/tmp/bootstrap.sql"; + + # Use the mysql database for system tables + mtr_tofile($bootstrap_sql_file, "use mysql"); + + # Add the offical mysql system tables + # for a production system + mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables.sql", + $bootstrap_sql_file); + + # Add the mysql system tables initial data + # for a production system + mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables_data.sql", + $bootstrap_sql_file); + + # Add test data for timezone - this is just a subset, on a real + # system these tables will be populated either by mysql_tzinfo_to_sql + # or by downloading the timezone table package from our website + mtr_appendfile_to_file("$path_sql_dir/mysql_test_data_timezone.sql", + $bootstrap_sql_file); + + # Fill help tables, just an empty file when running from bk repo + # but will be replaced by a real fill_help_tables.sql when + # building the source dist + mtr_appendfile_to_file("$path_sql_dir/fill_help_tables.sql", + $bootstrap_sql_file); + + # Remove anonymous users + mtr_tofile($bootstrap_sql_file, + "DELETE FROM mysql.user where user= '';"); + + # Log bootstrap command + my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log"; + mtr_tofile($path_bootstrap_log, + "$exe_mysqld_bootstrap " . join(" ", @$args) . "\n"); + + + if ( mtr_run($exe_mysqld_bootstrap, $args, $bootstrap_sql_file, + $path_bootstrap_log, $path_bootstrap_log, + "", { append_log_file => 1 }) != 0 ) + + { + mtr_error("Error executing mysqld --bootstrap\n" . + "Could not install system database from $bootstrap_sql_file\n" . + "see $path_bootstrap_log for errors"); + } +} + + +sub im_prepare_env($) { + my $instance_manager = shift; + + im_create_passwd_file($instance_manager); + im_prepare_data_dir($instance_manager); +} + + +sub im_create_passwd_file($) { + my $instance_manager = shift; + + my $pwd_file_path = $instance_manager->{'password_file'}; + + mtr_report("Creating IM password file ($pwd_file_path)"); + + open(OUT, ">", $pwd_file_path) + or mtr_error("Can't write to $pwd_file_path: $!"); + + print OUT $instance_manager->{'admin_login'}, ":", + $instance_manager->{'admin_sha1'}, "\n"; + + close(OUT); +} + + +sub im_create_defaults_file($) { + my $instance_manager = shift; + + my $defaults_file = $instance_manager->{'defaults_file'}; + + open(OUT, ">", $defaults_file) + or mtr_error("Can't write to $defaults_file: $!"); + + print OUT <<EOF +[mysql] + +[manager] +pid-file = $instance_manager->{path_pid} +angel-pid-file = $instance_manager->{path_angel_pid} +socket = $instance_manager->{path_sock} +port = $instance_manager->{port} +password-file = $instance_manager->{password_file} +default-mysqld-path = $exe_mysqld + +EOF +; + + foreach my $instance (@{$instance_manager->{'instances'}}) + { + my $server_id = $instance->{'server_id'}; + + print OUT <<EOF +[mysqld$server_id] +socket = $instance->{path_sock} +pid-file = $instance->{path_pid} +port = $instance->{port} +datadir = $instance->{path_datadir} +general-log-file = $instance->{path_datadir}/mysqld$server_id.log +general-log = 1 +log-error = $instance->{path_datadir}/mysqld$server_id.err.log +slow-query-log-file = $instance->{path_datadir}/mysqld$server_id.slow.log +slow-query-log = 1 +language = $path_language +character-sets-dir = $path_charsetsdir +basedir = $path_my_basedir +server_id = $server_id +shutdown-delay = 10 +skip-stack-trace +loose-skip-innodb +loose-skip-ndbcluster +EOF +; + if ( $mysql_version_id < 50100 ) + { + print OUT "skip-bdb\n"; + } + print OUT "nonguarded\n" if $instance->{'nonguarded'}; + if ( $mysql_version_id >= 50100 ) + { + print OUT "log-output=FILE\n" if $instance->{'old_log_format'}; + } + print OUT "\n"; + } + + close(OUT); +} + + +sub im_prepare_data_dir($) { + my $instance_manager = shift; + + foreach my $instance (@{$instance_manager->{'instances'}}) + { + copy_install_db( + 'im_mysqld_' . $instance->{'server_id'}, + $instance->{'path_datadir'}); + } +} + + + +# +# Restore snapshot of the installed slave databases +# if the snapshot exists +# +sub restore_slave_databases ($) { + my ($num_slaves)= @_; + + if ( -d $path_snapshot) + { + for (my $idx= 0; $idx < $num_slaves; $idx++) + { + my $data_dir= $slave->[$idx]->{'path_myddir'}; + my $name= basename($data_dir); + mtr_rmtree($data_dir); + mtr_copy_dir("$path_snapshot/$name", $data_dir); + } + } +} + + +sub run_testcase_check_skip_test($) +{ + my ($tinfo)= @_; + + # ---------------------------------------------------------------------- + # Skip some tests silently + # ---------------------------------------------------------------------- + + if ( $::opt_start_from ) + { + if ($tinfo->{'name'} eq $::opt_start_from ) + { + ## Found parting test. Run this test and all tests after this one + $::opt_start_from= ""; + } + else + { + $tinfo->{'result'}= 'MTR_RES_SKIPPED'; + return 1; + } + } + + # ---------------------------------------------------------------------- + # If marked to skip, just print out and return. + # Note that a test case not marked as 'skip' can still be + # skipped later, because of the test case itself in cooperation + # with the mysqltest program tells us so. + # ---------------------------------------------------------------------- + + if ( $tinfo->{'skip'} ) + { + mtr_report_test_name($tinfo); + mtr_report_test_skipped($tinfo); + return 1; + } + + if ($tinfo->{'ndb_test'}) + { + foreach my $cluster (@{$clusters}) + { + # Slave cluster is skipped and thus not + # installed, no need to perform checks + last if ($opt_skip_ndbcluster_slave and + $cluster->{'name'} eq 'Slave'); + + # Using running cluster - no need + # to check if test should be skipped + # will be done by test itself + last if ($cluster->{'use_running'}); + + # If test needs this cluster, check binaries was found ok + if ( $cluster->{'executable_setup_failed'} ) + { + mtr_report_test_name($tinfo); + $tinfo->{comment}= + "Failed to find cluster binaries"; + mtr_report_test_failed($tinfo); + return 1; + } + + # If test needs this cluster, check it was installed ok + if ( !$cluster->{'installed_ok'} ) + { + mtr_report_test_name($tinfo); + $tinfo->{comment}= + "Cluster $cluster->{'name'} was not installed ok"; + mtr_report_test_failed($tinfo); + return 1; + } + + } + } + + if ( $tinfo->{'component_id'} eq 'im' ) + { + # If test needs im, check binaries was found ok + if ( $instance_manager->{'executable_setup_failed'} ) + { + mtr_report_test_name($tinfo); + $tinfo->{comment}= + "Failed to find MySQL manager binaries"; + mtr_report_test_failed($tinfo); + return 1; + } + } + + return 0; +} + + +sub do_before_run_mysqltest($) +{ + my $tinfo= shift; + my $args; + + # Remove old files produced by mysqltest + my $base_file= mtr_match_extension($tinfo->{'result_file'}, + "result"); # Trim extension + unlink("$base_file.reject"); + unlink("$base_file.progress"); + unlink("$base_file.log"); + unlink("$base_file.warnings"); + + if (!$opt_extern) + { + if ( $mysql_version_id < 50000 ) { + # Set environment variable NDB_STATUS_OK to 1 + # if script decided to run mysqltest cluster _is_ installed ok + $ENV{'NDB_STATUS_OK'} = "1"; + } elsif ( $mysql_version_id < 50100 ) { + # Set environment variable NDB_STATUS_OK to YES + # if script decided to run mysqltest cluster _is_ installed ok + $ENV{'NDB_STATUS_OK'} = "YES"; + } + if (defined $tinfo->{binlog_format} and $mysql_version_id > 50100 ) + { + # Dynamically switch binlog format of + # master, slave is always restarted + foreach my $server ( @$master ) + { + next unless ($server->{'pid'}); + + mtr_init_args(\$args); + mtr_add_arg($args, "--no-defaults"); + mtr_add_arg($args, "--user=root"); + mtr_add_arg($args, "--port=$server->{'port'}"); + mtr_add_arg($args, "--socket=$server->{'path_sock'}"); + + my $sql= "include/set_binlog_format_".$tinfo->{binlog_format}.".sql"; + mtr_verbose("Setting binlog format:", $tinfo->{binlog_format}); + if (mtr_run($exe_mysql, $args, $sql, "", "", "") != 0) + { + mtr_error("Failed to switch binlog format"); + } + } + } + } +} + +sub do_after_run_mysqltest($) +{ + my $tinfo= shift; + + # Save info from this testcase run to mysqltest.log + mtr_appendfile_to_file($path_current_test_log, $path_mysqltest_log) + if -f $path_current_test_log; + mtr_appendfile_to_file($path_timefile, $path_mysqltest_log) + if -f $path_timefile; +} + + +sub run_testcase_mark_logs($$) +{ + my ($tinfo, $log_msg)= @_; + + # Write a marker to all log files + + # The file indicating current test name + mtr_tonewfile($path_current_test_log, $log_msg); + + # each mysqld's .err file + foreach my $mysqld (@{$master}, @{$slave}) + { + mtr_tofile($mysqld->{path_myerr}, $log_msg); + } + + if ( $tinfo->{'component_id'} eq 'im') + { + mtr_tofile($instance_manager->{path_err}, $log_msg); + mtr_tofile($instance_manager->{path_log}, $log_msg); + } + + # ndbcluster log file + mtr_tofile($path_ndb_testrun_log, $log_msg); + +} + +sub find_testcase_skipped_reason($) +{ + my ($tinfo)= @_; + + # Set default message + $tinfo->{'comment'}= "Detected by testcase(no log file)"; + + # Open mysqltest-time(the mysqltest log file) + my $F= IO::File->new($path_timefile) + or return; + my $reason; + + while ( my $line= <$F> ) + { + # Look for "reason: <reason for skipping test>" + if ( $line =~ /reason: (.*)/ ) + { + $reason= $1; + } + } + + if ( ! $reason ) + { + mtr_warning("Could not find reason for skipping test in $path_timefile"); + $reason= "Detected by testcase(reason unknown) "; + } + $tinfo->{'comment'}= $reason; +} + + +############################################################################## +# +# Run a single test case +# +############################################################################## + +# When we get here, we have already filtered out test cases that doesn't +# apply to the current setup, for example if we use a running server, test +# cases that restart the server are dropped. So this function should mostly +# be about doing things, not a lot of logic. + +# We don't start and kill the servers for each testcase. But some +# testcases needs a restart, because they specify options to start +# mysqld with. After that testcase, we need to restart again, to set +# back the normal options. + +sub run_testcase ($) { + my $tinfo= shift; + + # ------------------------------------------------------- + # Init variables that can change between each test case + # ------------------------------------------------------- + + $ENV{'TZ'}= $tinfo->{'timezone'}; + mtr_verbose("Setting timezone: $tinfo->{'timezone'}"); + + my $master_restart= run_testcase_need_master_restart($tinfo); + my $slave_restart= run_testcase_need_slave_restart($tinfo); + + if ($master_restart or $slave_restart) + { + # Can't restart a running server that may be in use + if ( $opt_extern ) + { + mtr_report_test_name($tinfo); + $tinfo->{comment}= "Can't restart a running server"; + mtr_report_test_skipped($tinfo); + return; + } + + run_testcase_stop_servers($tinfo, $master_restart, $slave_restart); + } + + # Write to all log files to indicate start of testcase + run_testcase_mark_logs($tinfo, "CURRENT_TEST: $tinfo->{name}\n"); + + my $died= mtr_record_dead_children(); + if ($died or $master_restart or $slave_restart) + { + if (run_testcase_start_servers($tinfo)) + { + mtr_report_test_name($tinfo); + report_failure_and_restart($tinfo); + return 1; + } + } + elsif ($glob_use_embedded_server) + { + run_master_init_script($tinfo); + } + + # ---------------------------------------------------------------------- + # If --start-and-exit or --start-dirty given, stop here to let user manually + # run tests + # ---------------------------------------------------------------------- + if ( $opt_start_and_exit or $opt_start_dirty ) + { + mtr_timer_stop_all($glob_timers); + mtr_report("\nServers started, exiting"); + if ($glob_win32_perl)
+ { + #ActiveState perl hangs when using normal exit, use POSIX::_exit instead + use POSIX qw[ _exit ]; + POSIX::_exit(0); + } + else + { + exit(0); + } + } + + { + do_before_run_mysqltest($tinfo); + + my $res= run_mysqltest($tinfo); + mtr_report_test_name($tinfo); + + do_after_run_mysqltest($tinfo); + + if ( $res == 0 ) + { + mtr_report_test_passed($tinfo); + } + elsif ( $res == 62 ) + { + # Testcase itself tell us to skip this one + + # Try to get reason from mysqltest.log + find_testcase_skipped_reason($tinfo); + mtr_report_test_skipped($tinfo); + } + elsif ( $res == 63 ) + { + $tinfo->{'timeout'}= 1; # Mark as timeout + report_failure_and_restart($tinfo); + } + elsif ( $res == 1 ) + { + # Test case failure reported by mysqltest + report_failure_and_restart($tinfo); + } + else + { + # mysqltest failed, probably crashed + $tinfo->{comment}= + "mysqltest returned unexpected code $res, it has probably crashed"; + report_failure_and_restart($tinfo); + } + } + + # Remove the file that mysqltest writes info to + unlink($path_timefile); + + # ---------------------------------------------------------------------- + # Stop Instance Manager if we are processing an IM-test case. + # ---------------------------------------------------------------------- + if ( $tinfo->{'component_id'} eq 'im' and + !mtr_im_stop($instance_manager, $tinfo->{'name'})) + { + mtr_error("Failed to stop Instance Manager.") + } +} + + +# +# Save a snapshot of the installed test db(s) +# I.e take a snapshot of the var/ dir +# +sub save_installed_db () { + + mtr_report("Saving snapshot of installed databases"); + mtr_rmtree($path_snapshot); + + foreach my $data_dir (@data_dir_lst) + { + my $name= basename($data_dir); + mtr_copy_dir("$data_dir", "$path_snapshot/$name"); + } +} + + +# +# Save any interesting files in the data_dir +# before the data dir is removed. +# +sub save_files_before_restore($$) { + my $test_name= shift; + my $data_dir= shift; + my $save_name= "$opt_vardir/log/$test_name"; + + # Look for core files + foreach my $core_file ( glob("$data_dir/core*") ) + { + last if $opt_max_save_core > 0 && $num_saved_cores >= $opt_max_save_core; + my $core_name= basename($core_file); + mtr_report("Saving $core_name"); + mkdir($save_name) if ! -d $save_name; + rename("$core_file", "$save_name/$core_name"); + ++$num_saved_cores; + } +} + + +# +# Restore snapshot of the installed test db(s) +# if the snapshot exists +# +sub restore_installed_db ($) { + my $test_name= shift; + + if ( -d $path_snapshot) + { + mtr_report("Restoring snapshot of databases"); + + foreach my $data_dir (@data_dir_lst) + { + my $name= basename($data_dir); + save_files_before_restore($test_name, $data_dir); + mtr_rmtree("$data_dir"); + mtr_copy_dir("$path_snapshot/$name", "$data_dir"); + } + + # Remove the ndb_*_fs dirs for all ndbd nodes + # forcing a clean start of ndb + foreach my $cluster (@{$clusters}) + { + foreach my $ndbd (@{$cluster->{'ndbds'}}) + { + mtr_rmtree("$ndbd->{'path_fs'}" ); + } + } + } + else + { + # No snapshot existed + mtr_error("No snapshot existed"); + } +} + +sub report_failure_and_restart ($) { + my $tinfo= shift; + + mtr_report_test_failed($tinfo); + print "\n"; + if ( $opt_force ) + { + # Stop all servers that are known to be running + stop_all_servers(); + + # Restore the snapshot of the installed test db + restore_installed_db($tinfo->{'name'}); + mtr_report("Resuming Tests\n"); + return; + } + + my $test_mode= join(" ", @::glob_test_mode) || "default"; + mtr_report("Aborting: $tinfo->{'name'} failed in $test_mode mode. "); + mtr_report("To continue, re-run with '--force'."); + if ( ! $glob_debugger and + ! $opt_extern and + ! $glob_use_embedded_server ) + { + stop_all_servers(); + } + mtr_exit(1); + +} + + +sub run_master_init_script ($) { + my ($tinfo)= @_; + my $init_script= $tinfo->{'master_sh'}; + + # Run master initialization shell script if one exists + if ( $init_script ) + { + my $ret= mtr_run("/bin/sh", [$init_script], "", "", "", ""); + if ( $ret != 0 ) + { + # FIXME rewrite those scripts to return 0 if successful + # mtr_warning("$init_script exited with code $ret"); + } + } +} + + +############################################################################## +# +# Start and stop servers +# +############################################################################## + + +sub do_before_start_master ($) { + my ($tinfo)= @_; + + my $tname= $tinfo->{'name'}; + + # FIXME what about second master..... + + # Don't delete anything if starting dirty + return if ($opt_start_dirty); + + foreach my $bin ( glob("$opt_vardir/log/master*-bin*") ) + { + unlink($bin); + } + + # FIXME only remove the ones that are tied to this master + # Remove old master.info and relay-log.info files + unlink("$master->[0]->{'path_myddir'}/master.info"); + unlink("$master->[0]->{'path_myddir'}/relay-log.info"); + unlink("$master->[1]->{'path_myddir'}/master.info"); + unlink("$master->[1]->{'path_myddir'}/relay-log.info"); + + run_master_init_script($tinfo); +} + + +sub do_before_start_slave ($) { + my ($tinfo)= @_; + + my $tname= $tinfo->{'name'}; + my $init_script= $tinfo->{'master_sh'}; + + # Don't delete anything if starting dirty + return if ($opt_start_dirty); + + foreach my $bin ( glob("$opt_vardir/log/slave*-bin*") ) + { + unlink($bin); + } + + unlink("$slave->[0]->{'path_myddir'}/master.info"); + unlink("$slave->[0]->{'path_myddir'}/relay-log.info"); + + # Run slave initialization shell script if one exists + if ( $init_script ) + { + my $ret= mtr_run("/bin/sh", [$init_script], "", "", "", ""); + if ( $ret != 0 ) + { + # FIXME rewrite those scripts to return 0 if successful + # mtr_warning("$init_script exited with code $ret"); + } + } + + foreach my $bin ( glob("$slave->[0]->{'path_myddir'}/log.*") ) + { + unlink($bin); + } +} + + +sub mysqld_arguments ($$$$) { + my $args= shift; + my $mysqld= shift; + my $extra_opt= shift; + my $slave_master_info= shift; + + my $idx= $mysqld->{'idx'}; + my $sidx= ""; # Index as string, 0 is empty string + if ( $idx> 0 ) + { + $sidx= $idx; + } + + my $prefix= ""; # If mysqltest server arg + if ( $glob_use_embedded_server ) + { + $prefix= "--server-arg="; + } + + mtr_add_arg($args, "%s--no-defaults", $prefix); + + mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir); + mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir); + + if (!$opt_extern) + { + if ( $mysql_version_id >= 50036) + { + # Prevent the started mysqld to access files outside of vardir + mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $opt_vardir); + } + + if ( $mysql_version_id >= 50000 ) { + mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix); + } + } + + mtr_add_arg($args, "%s--default-character-set=latin1", $prefix); + mtr_add_arg($args, "%s--language=%s", $prefix, $path_language); + mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix); + + # Increase default connect_timeout to avoid intermittent + # disconnects when test servers are put under load + # see BUG#28359 + mtr_add_arg($args, "%s--connect-timeout=60", $prefix); + + + # When mysqld is run by a root user(euid is 0), it will fail + # to start unless we specify what user to run as, see BUG#30630 + my $euid= $>; + if (!$glob_win32 and $euid == 0 and + grep(/^--user/, @$extra_opt, @opt_extra_mysqld_opt) == 0) { + mtr_add_arg($args, "%s--user=root", $prefix); + } + + if ( $opt_valgrind_mysqld ) + { + mtr_add_arg($args, "%s--skip-safemalloc", $prefix); + + if ( $mysql_version_id < 50100 ) + { + mtr_add_arg($args, "%s--skip-bdb", $prefix); + } + } + + mtr_add_arg($args, "%s--pid-file=%s", $prefix, + $mysqld->{'path_pid'}); + + mtr_add_arg($args, "%s--port=%d", $prefix, + $mysqld->{'port'}); + + mtr_add_arg($args, "%s--socket=%s", $prefix, + $mysqld->{'path_sock'}); + + mtr_add_arg($args, "%s--datadir=%s", $prefix, + $mysqld->{'path_myddir'}); + + mtr_add_arg($args, "%s--disable-sync-frm", $prefix); # Faster test + + if (!$opt_extern and $mysql_version_id >= 50106 ) + { + # Turn on logging to bothe tables and file + mtr_add_arg($args, "%s--log-output=table,file", $prefix); + } + + my $log_base_path= "$opt_vardir/log/$mysqld->{'type'}$sidx"; + mtr_add_arg($args, "%s--general-log-file=%s.log", + $prefix, $log_base_path); + mtr_add_arg($args, "%s--general-log", $prefix); + mtr_add_arg($args, + "%s--slow-query-log-file=%s-slow.log", + $prefix, $log_base_path); + mtr_add_arg($args, "%s--slow-query-log", $prefix); + + # Check if "extra_opt" contains --skip-log-bin + my $skip_binlog= grep(/^--skip-log-bin/, @$extra_opt, @opt_extra_mysqld_opt); + if ( $mysqld->{'type'} eq 'master' ) + { + if (! ($opt_skip_master_binlog || $skip_binlog) ) + { + mtr_add_arg($args, "%s--log-bin=%s/log/master-bin%s", $prefix, + $opt_vardir, $sidx); + } + + mtr_add_arg($args, "%s--server-id=%d", $prefix, + $idx > 0 ? $idx + 101 : 1); + + mtr_add_arg($args, "%s--loose-innodb_data_file_path=ibdata1:10M:autoextend", + $prefix); + + mtr_add_arg($args, "%s--local-infile", $prefix); + + if ( $idx > 0 or !$use_innodb) + { + mtr_add_arg($args, "%s--loose-skip-innodb", $prefix); + } + + my $cluster= $clusters->[$mysqld->{'cluster'}]; + if ( $cluster->{'pid'} || # Cluster is started + $cluster->{'use_running'} ) # Using running cluster + { + mtr_add_arg($args, "%s--ndbcluster", $prefix); + mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix, + $cluster->{'connect_string'}); + if ( $mysql_version_id >= 50100 ) + { + mtr_add_arg($args, "%s--ndb-extra-logging", $prefix); + } + } + else + { + mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix); + } + } + else + { + mtr_error("unknown mysqld type") + unless $mysqld->{'type'} eq 'slave'; + + mtr_add_arg($args, "%s--init-rpl-role=slave", $prefix); + if (! ( $opt_skip_slave_binlog || $skip_binlog )) + { + mtr_add_arg($args, "%s--log-bin=%s/log/slave%s-bin", $prefix, + $opt_vardir, $sidx); # FIXME use own dir for binlogs + mtr_add_arg($args, "%s--log-slave-updates", $prefix); + } + + mtr_add_arg($args, "%s--master-retry-count=10", $prefix); + + mtr_add_arg($args, "%s--relay-log=%s/log/slave%s-relay-bin", $prefix, + $opt_vardir, $sidx); + mtr_add_arg($args, "%s--report-host=127.0.0.1", $prefix); + mtr_add_arg($args, "%s--report-port=%d", $prefix, + $mysqld->{'port'}); + mtr_add_arg($args, "%s--report-user=root", $prefix); + mtr_add_arg($args, "%s--loose-skip-innodb", $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. + my $slave_load_path= "../tmp"; + mtr_add_arg($args, "%s--slave-load-tmpdir=%s", $prefix, + $slave_load_path); + mtr_add_arg($args, "%s--set-variable=slave_net_timeout=120", $prefix); + + if ( @$slave_master_info ) + { + foreach my $arg ( @$slave_master_info ) + { + mtr_add_arg($args, "%s%s", $prefix, $arg); + } + } + else + { + if ($mysql_version_id < 50200) + { + mtr_add_arg($args, "%s--master-user=root", $prefix); + mtr_add_arg($args, "%s--master-connect-retry=1", $prefix); + mtr_add_arg($args, "%s--master-host=127.0.0.1", $prefix); + mtr_add_arg($args, "%s--master-password=", $prefix); + mtr_add_arg($args, "%s--master-port=%d", $prefix, + $master->[0]->{'port'}); # First master + } + my $slave_server_id= 2 + $idx; + my $slave_rpl_rank= $slave_server_id; + mtr_add_arg($args, "%s--server-id=%d", $prefix, $slave_server_id); + mtr_add_arg($args, "%s--rpl-recovery-rank=%d", $prefix, $slave_rpl_rank); + } + + my $cluster= $clusters->[$mysqld->{'cluster'}]; + if ( $cluster->{'pid'} || # Slave cluster is started + $cluster->{'use_running'} ) # Using running slave cluster + { + mtr_add_arg($args, "%s--ndbcluster", $prefix); + mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix, + $cluster->{'connect_string'}); + + if ( $mysql_version_id >= 50100 ) + { + mtr_add_arg($args, "%s--ndb-extra-logging", $prefix); + } + } + else + { + mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix); + } + + } # end slave + + if ( $debug_compiled_binaries && defined $opt_debug ) + { + if ( $opt_debug ) + { + mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/%s%s.trace", + $prefix, $path_vardir_trace, $mysqld->{'type'}, $sidx); + } + else + { + mtr_add_arg($args, "--disable-debug"); + } + } + + mtr_add_arg($args, "%s--key_buffer_size=1M", $prefix); + mtr_add_arg($args, "%s--sort_buffer=256K", $prefix); + mtr_add_arg($args, "%s--max_heap_table_size=1M", $prefix); + + if ( $opt_ssl_supported ) + { + mtr_add_arg($args, "%s--ssl-ca=%s/std_data/cacert.pem", $prefix, + $glob_mysql_test_dir); + mtr_add_arg($args, "%s--ssl-cert=%s/std_data/server-cert.pem", $prefix, + $glob_mysql_test_dir); + mtr_add_arg($args, "%s--ssl-key=%s/std_data/server-key.pem", $prefix, + $glob_mysql_test_dir); + } + + if ( $opt_warnings ) + { + mtr_add_arg($args, "%s--log-warnings", $prefix); + } + + # Indicate to "mysqld" it will be debugged in debugger + if ( $glob_debugger ) + { + mtr_add_arg($args, "%s--gdb", $prefix); + } + + my $found_skip_core= 0; + foreach my $arg ( @opt_extra_mysqld_opt, @$extra_opt ) + { + # Allow --skip-core-file to be set in <testname>-[master|slave].opt file + if ($arg eq "--skip-core-file") + { + $found_skip_core= 1; + } + elsif ($skip_binlog and mtr_match_prefix($arg, "--binlog-format")) + { + ; # Dont add --binlog-format when running without binlog + } + else + { + mtr_add_arg($args, "%s%s", $prefix, $arg); + } + } + if ( !$found_skip_core ) + { + mtr_add_arg($args, "%s%s", $prefix, "--core-file"); + } + + if ( $opt_bench ) + { + mtr_add_arg($args, "%s--rpl-recovery-rank=1", $prefix); + mtr_add_arg($args, "%s--init-rpl-role=master", $prefix); + } + elsif ( $mysqld->{'type'} eq 'master' ) + { + mtr_add_arg($args, "%s--open-files-limit=1024", $prefix); + } + + return $args; +} + + +############################################################################## +# +# Start mysqld and return the PID +# +############################################################################## + +sub mysqld_start ($$$) { + my $mysqld= shift; + my $extra_opt= shift; + my $slave_master_info= shift; + + my $args; # Arg vector + my $exe; + my $pid= -1; + my $wait_for_pid_file= 1; + + my $type= $mysqld->{'type'}; + my $idx= $mysqld->{'idx'}; + + mtr_error("Internal error: mysqld should never be started for embedded") + if $glob_use_embedded_server; + + if ( $type eq 'master' ) + { + $exe= $exe_master_mysqld; + } + elsif ( $type eq 'slave' ) + { + $exe= $exe_slave_mysqld; + } + else + { + mtr_error("Unknown 'type' \"$type\" passed to mysqld_start"); + } + + mtr_init_args(\$args); + + if ( $opt_valgrind_mysqld ) + { + valgrind_arguments($args, \$exe); + } + + mysqld_arguments($args,$mysqld,$extra_opt,$slave_master_info); + + if ( $opt_gdb || $opt_manual_gdb) + { + gdb_arguments(\$args, \$exe, "$type"."_$idx"); + } + elsif ( $opt_ddd || $opt_manual_ddd ) + { + ddd_arguments(\$args, \$exe, "$type"."_$idx"); + } + elsif ( $opt_debugger ) + { + debugger_arguments(\$args, \$exe, "$type"."_$idx"); + } + elsif ( $opt_manual_debug ) + { + print "\nStart $type in your debugger\n" . + "dir: $glob_mysql_test_dir\n" . + "exe: $exe\n" . + "args: " . join(" ", @$args) . "\n\n" . + "Waiting ....\n"; + + # Indicate the exe should not be started + $exe= undef; + } + else + { + # Default to not wait until pid file has been created + $wait_for_pid_file= 0; + } + + # Remove the pidfile + unlink($mysqld->{'path_pid'}); + + if ( defined $exe ) + { + $pid= mtr_spawn($exe, $args, "", + $mysqld->{'path_myerr'}, + $mysqld->{'path_myerr'}, + "", + { append_log_file => 1 }); + } + + + if ( $wait_for_pid_file && !sleep_until_file_created($mysqld->{'path_pid'}, + $mysqld->{'start_timeout'}, + $pid)) + { + + mtr_error("Failed to start mysqld $mysqld->{'type'}"); + } + + + # Remember pid of the started process + $mysqld->{'pid'}= $pid; + + # Remember options used when starting + $mysqld->{'start_opts'}= $extra_opt; + $mysqld->{'start_slave_master_info'}= $slave_master_info; + + mtr_verbose("mysqld pid: $pid"); + return $pid; +} + + +sub stop_all_servers () { + + mtr_report("Stopping All Servers"); + + if ( ! $opt_skip_im ) + { + mtr_report("Shutting-down Instance Manager"); + unless (mtr_im_stop($instance_manager, "stop_all_servers")) + { + mtr_error("Failed to stop Instance Manager.") + } + } + + my %admin_pids; # hash of admin processes that requests shutdown + my @kill_pids; # list of processes to shutdown/kill + my $pid; + + # Start shutdown of all started masters + foreach my $mysqld (@{$slave}, @{$master}) + { + if ( $mysqld->{'pid'} ) + { + $pid= mtr_mysqladmin_start($mysqld, "shutdown", 70); + $admin_pids{$pid}= 1; + + push(@kill_pids,{ + pid => $mysqld->{'pid'}, + real_pid => $mysqld->{'real_pid'}, + pidfile => $mysqld->{'path_pid'}, + sockfile => $mysqld->{'path_sock'}, + port => $mysqld->{'port'}, + errfile => $mysqld->{'path_myerr'}, + }); + + $mysqld->{'pid'}= 0; # Assume we are done with it + } + } + + # Start shutdown of clusters + foreach my $cluster (@{$clusters}) + { + if ( $cluster->{'pid'} ) + { + $pid= mtr_ndbmgm_start($cluster, "shutdown"); + $admin_pids{$pid}= 1; + + push(@kill_pids,{ + pid => $cluster->{'pid'}, + pidfile => $cluster->{'path_pid'} + }); + + $cluster->{'pid'}= 0; # Assume we are done with it + + foreach my $ndbd (@{$cluster->{'ndbds'}}) + { + if ( $ndbd->{'pid'} ) + { + push(@kill_pids,{ + pid => $ndbd->{'pid'}, + pidfile => $ndbd->{'path_pid'}, + }); + $ndbd->{'pid'}= 0; + } + } + } + } + + # Wait blocking until all shutdown processes has completed + mtr_wait_blocking(\%admin_pids); + + # Make sure that process has shutdown else try to kill them + mtr_check_stop_servers(\@kill_pids); + + foreach my $mysqld (@{$master}, @{$slave}) + { + rm_ndbcluster_tables($mysqld->{'path_myddir'}); + } +} + + +sub run_testcase_need_master_restart($) +{ + my ($tinfo)= @_; + + # We try to find out if we are to restart the master(s) + my $do_restart= 0; # Assumes we don't have to + + if ( $glob_use_embedded_server ) + { + mtr_verbose("Never start or restart for embedded server"); + return $do_restart; + } + elsif ( $tinfo->{'master_sh'} ) + { + $do_restart= 1; # Always restart if script to run + mtr_verbose("Restart master: Always restart if script to run"); + } + if ( $tinfo->{'force_restart'} ) + { + $do_restart= 1; # Always restart if --force-restart in -opt file + mtr_verbose("Restart master: Restart forced with --force-restart"); + } + elsif ( ! $opt_skip_ndbcluster and + !$tinfo->{'ndb_test'} and + $clusters->[0]->{'pid'} != 0 ) + { + $do_restart= 1; # Restart without cluster + mtr_verbose("Restart master: Test does not need cluster"); + } + elsif ( ! $opt_skip_ndbcluster and + $tinfo->{'ndb_test'} and + $clusters->[0]->{'pid'} == 0 ) + { + $do_restart= 1; # Restart with cluster + mtr_verbose("Restart master: Test need cluster"); + } + elsif( $tinfo->{'component_id'} eq 'im' ) + { + $do_restart= 1; + mtr_verbose("Restart master: Always restart for im tests"); + } + elsif ( $master->[0]->{'running_master_options'} and + $master->[0]->{'running_master_options'}->{'timezone'} ne + $tinfo->{'timezone'}) + { + $do_restart= 1; + mtr_verbose("Restart master: Different timezone"); + } + # Check that running master was started with same options + # as the current test requires + elsif (! mtr_same_opts($master->[0]->{'start_opts'}, + $tinfo->{'master_opt'}) ) + { + $do_restart= 1; + mtr_verbose("Restart master: running with different options '" . + join(" ", @{$tinfo->{'master_opt'}}) . "' != '" . + join(" ", @{$master->[0]->{'start_opts'}}) . "'" ); + } + elsif( ! $master->[0]->{'pid'} ) + { + if ( $opt_extern ) + { + $do_restart= 0; + mtr_verbose("No restart: using extern master"); + } + else + { + $do_restart= 1; + mtr_verbose("Restart master: master is not started"); + } + } + return $do_restart; +} + +sub run_testcase_need_slave_restart($) +{ + my ($tinfo)= @_; + + # We try to find out if we are to restart the slaves + my $do_slave_restart= 0; # Assumes we don't have to + + if ( $glob_use_embedded_server ) + { + mtr_verbose("Never start or restart for embedded server"); + return $do_slave_restart; + } + elsif ( $max_slave_num == 0) + { + mtr_verbose("Skip slave restart: No testcase use slaves"); + } + else + { + + # Check if any slave is currently started + my $any_slave_started= 0; + foreach my $mysqld (@{$slave}) + { + if ( $mysqld->{'pid'} ) + { + $any_slave_started= 1; + last; + } + } + + if ($any_slave_started) + { + mtr_verbose("Restart slave: Slave is started, always restart"); + $do_slave_restart= 1; + } + elsif ( $tinfo->{'slave_num'} ) + { + mtr_verbose("Restart slave: Test need slave"); + $do_slave_restart= 1; + } + } + + return $do_slave_restart; + +} + +# ---------------------------------------------------------------------- +# If not using a running servers we may need to stop and restart. +# We restart in the case we have initiation scripts, server options +# etc to run. But we also restart again after the test first restart +# and test is run, to get back to normal server settings. +# +# To make the code a bit more clean, we actually only stop servers +# here, and mark this to be done. Then a generic "start" part will +# start up the needed servers again. +# ---------------------------------------------------------------------- + +sub run_testcase_stop_servers($$$) { + my ($tinfo, $do_restart, $do_slave_restart)= @_; + my $pid; + my %admin_pids; # hash of admin processes that requests shutdown + my @kill_pids; # list of processes to shutdown/kill + + # Remember if we restarted for this test case (count restarts) + $tinfo->{'restarted'}= $do_restart; + + if ( $do_restart ) + { + delete $master->[0]->{'running_master_options'}; # Forget history + + # Start shutdown of all started masters + foreach my $mysqld (@{$master}) + { + if ( $mysqld->{'pid'} ) + { + $pid= mtr_mysqladmin_start($mysqld, "shutdown", 20); + + $admin_pids{$pid}= 1; + + push(@kill_pids,{ + pid => $mysqld->{'pid'}, + real_pid => $mysqld->{'real_pid'}, + pidfile => $mysqld->{'path_pid'}, + sockfile => $mysqld->{'path_sock'}, + port => $mysqld->{'port'}, + errfile => $mysqld->{'path_myerr'}, + }); + + $mysqld->{'pid'}= 0; # Assume we are done with it + } + } + + # Start shutdown of master cluster + my $cluster= $clusters->[0]; + if ( $cluster->{'pid'} ) + { + $pid= mtr_ndbmgm_start($cluster, "shutdown"); + $admin_pids{$pid}= 1; + + push(@kill_pids,{ + pid => $cluster->{'pid'}, + pidfile => $cluster->{'path_pid'} + }); + + $cluster->{'pid'}= 0; # Assume we are done with it + + foreach my $ndbd (@{$cluster->{'ndbds'}}) + { + push(@kill_pids,{ + pid => $ndbd->{'pid'}, + pidfile => $ndbd->{'path_pid'}, + }); + $ndbd->{'pid'}= 0; # Assume we are done with it + } + } + } + + if ( $do_restart || $do_slave_restart ) + { + + delete $slave->[0]->{'running_slave_options'}; # Forget history + + # Start shutdown of all started slaves + foreach my $mysqld (@{$slave}) + { + if ( $mysqld->{'pid'} ) + { + $pid= mtr_mysqladmin_start($mysqld, "shutdown", 20); + + $admin_pids{$pid}= 1; + + push(@kill_pids,{ + pid => $mysqld->{'pid'}, + real_pid => $mysqld->{'real_pid'}, + pidfile => $mysqld->{'path_pid'}, + sockfile => $mysqld->{'path_sock'}, + port => $mysqld->{'port'}, + errfile => $mysqld->{'path_myerr'}, + }); + + + $mysqld->{'pid'}= 0; # Assume we are done with it + } + } + + # Start shutdown of slave cluster + my $cluster= $clusters->[1]; + if ( $cluster->{'pid'} ) + { + $pid= mtr_ndbmgm_start($cluster, "shutdown"); + + $admin_pids{$pid}= 1; + + push(@kill_pids,{ + pid => $cluster->{'pid'}, + pidfile => $cluster->{'path_pid'} + }); + + $cluster->{'pid'}= 0; # Assume we are done with it + + foreach my $ndbd (@{$cluster->{'ndbds'}} ) + { + push(@kill_pids,{ + pid => $ndbd->{'pid'}, + pidfile => $ndbd->{'path_pid'}, + }); + $ndbd->{'pid'}= 0; # Assume we are done with it + } + } + } + + # ---------------------------------------------------------------------- + # Shutdown has now been started and lists for the shutdown processes + # and the processes to be killed has been created + # ---------------------------------------------------------------------- + + # Wait blocking until all shutdown processes has completed + mtr_wait_blocking(\%admin_pids); + + + # Make sure that process has shutdown else try to kill them + mtr_check_stop_servers(\@kill_pids); + + foreach my $mysqld (@{$master}, @{$slave}) + { + if ( ! $mysqld->{'pid'} ) + { + # Remove ndbcluster tables if server is stopped + rm_ndbcluster_tables($mysqld->{'path_myddir'}); + } + } +} + + +# +# run_testcase_start_servers +# +# Start the servers needed by this test case +# +# RETURN +# 0 OK +# 1 Start failed +# + +sub run_testcase_start_servers($) { + my $tinfo= shift; + my $tname= $tinfo->{'name'}; + + if ( $tinfo->{'component_id'} eq 'mysqld' ) + { + if ( ! $opt_skip_ndbcluster and + !$clusters->[0]->{'pid'} and + $tinfo->{'ndb_test'} ) + { + # Test need cluster, cluster is not started, start it + ndbcluster_start($clusters->[0], ""); + } + + if ( !$master->[0]->{'pid'} ) + { + # Master mysqld is not started + do_before_start_master($tinfo); + + mysqld_start($master->[0],$tinfo->{'master_opt'},[]); + + } + + if ( $clusters->[0]->{'pid'} || $clusters->[0]->{'use_running'} + and ! $master->[1]->{'pid'} and + $tinfo->{'master_num'} > 1 ) + { + # Test needs cluster, start an extra mysqld connected to cluster + + if ( $mysql_version_id >= 50100 ) + { + # First wait for first mysql server to have created ndb system + # tables ok FIXME This is a workaround so that only one mysqld + # create the tables + if ( ! sleep_until_file_created( + "$master->[0]->{'path_myddir'}/mysql/ndb_apply_status.ndb", + $master->[0]->{'start_timeout'}, + $master->[0]->{'pid'})) + { + + $tinfo->{'comment'}= "Failed to create 'mysql/ndb_apply_status' table"; + return 1; + } + } + mysqld_start($master->[1],$tinfo->{'master_opt'},[]); + } + + # Save this test case information, so next can examine it + $master->[0]->{'running_master_options'}= $tinfo; + } + elsif ( ! $opt_skip_im and $tinfo->{'component_id'} eq 'im' ) + { + # We have to create defaults file every time, in order to ensure that it + # will be the same for each test. The problem is that test can change the + # file (by SET/UNSET commands), so w/o recreating the file, execution of + # one test can affect the other. + + im_create_defaults_file($instance_manager); + + if ( ! mtr_im_start($instance_manager, $tinfo->{im_opts}) ) + { + $tinfo->{'comment'}= "Failed to start Instance Manager. "; + return 1; + } + } + + # ---------------------------------------------------------------------- + # Start slaves - if needed + # ---------------------------------------------------------------------- + if ( $tinfo->{'slave_num'} ) + { + restore_slave_databases($tinfo->{'slave_num'}); + + do_before_start_slave($tinfo); + + if ( ! $opt_skip_ndbcluster_slave and + !$clusters->[1]->{'pid'} and + $tinfo->{'ndb_test'} ) + { + # Test need slave cluster, cluster is not started, start it + ndbcluster_start($clusters->[1], ""); + } + + for ( my $idx= 0; $idx < $tinfo->{'slave_num'}; $idx++ ) + { + if ( ! $slave->[$idx]->{'pid'} ) + { + mysqld_start($slave->[$idx],$tinfo->{'slave_opt'}, + $tinfo->{'slave_mi'}); + + } + } + + # Save this test case information, so next can examine it + $slave->[0]->{'running_slave_options'}= $tinfo; + } + + # Wait for clusters to start + foreach my $cluster (@{$clusters}) + { + + next if !$cluster->{'pid'}; + + if (ndbcluster_wait_started($cluster, "")) + { + # failed to start + $tinfo->{'comment'}= "Start of $cluster->{'name'} cluster failed"; + return 1; + } + } + + # Wait for mysqld's to start + foreach my $mysqld (@{$master},@{$slave}) + { + + next if !$mysqld->{'pid'}; + + if (mysqld_wait_started($mysqld)) + { + # failed to start + $tinfo->{'comment'}= + "Failed to start $mysqld->{'type'} mysqld $mysqld->{'idx'}"; + return 1; + } + } + return 0; +} + +# +# Run include/check-testcase.test +# Before a testcase, run in record mode, save result file to var +# After testcase, run and compare with the recorded file, they should be equal! +# +# RETURN VALUE +# 0 OK +# 1 Check failed +# +sub run_check_testcase ($$) { + + my $mode= shift; + my $mysqld= shift; + + my $name= "check-" . $mysqld->{'type'} . $mysqld->{'idx'}; + + my $args; + mtr_init_args(\$args); + + mtr_add_arg($args, "--no-defaults"); + mtr_add_arg($args, "--silent"); + mtr_add_arg($args, "--skip-safemalloc"); + mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir); + mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); + + mtr_add_arg($args, "--socket=%s", $mysqld->{'path_sock'}); + mtr_add_arg($args, "--port=%d", $mysqld->{'port'}); + mtr_add_arg($args, "--database=test"); + mtr_add_arg($args, "--user=%s", $opt_user); + mtr_add_arg($args, "--password="); + + mtr_add_arg($args, "-R"); + mtr_add_arg($args, "$opt_vardir/tmp/$name.result"); + + if ( $mode eq "before" ) + { + mtr_add_arg($args, "--record"); + } + + my $res = mtr_run_test($exe_mysqltest,$args, + "include/check-testcase.test", "", "", ""); + + if ( $res == 1 and $mode eq "after") + { + mtr_run("diff",["-u", + "$opt_vardir/tmp/$name.result", + "$opt_vardir/tmp/$name.reject"], + "", "", "", ""); + } + elsif ( $res ) + { + mtr_error("Could not execute 'check-testcase' $mode testcase"); + } + return $res; +} + +############################################################################## +# +# Report the features that were compiled in +# +############################################################################## + +sub run_report_features () { + my $args; + + if ( ! $glob_use_embedded_server ) + { + mysqld_start($master->[0],[],[]); + if ( ! $master->[0]->{'pid'} ) + { + mtr_error("Can't start the mysqld server"); + } + mysqld_wait_started($master->[0]); + } + + my $tinfo = {}; + $tinfo->{'name'} = 'report features'; + $tinfo->{'result_file'} = undef; + $tinfo->{'component_id'} = 'mysqld'; + $tinfo->{'path'} = 'include/report-features.test'; + $tinfo->{'timezone'}= "GMT-3"; + $tinfo->{'slave_num'} = 0; + $tinfo->{'master_opt'} = []; + $tinfo->{'slave_opt'} = []; + $tinfo->{'slave_mi'} = []; + $tinfo->{'comment'} = 'report server features'; + run_mysqltest($tinfo); + + if ( ! $glob_use_embedded_server ) + { + stop_all_servers(); + } +} + + +sub run_mysqltest ($) { + my ($tinfo)= @_; + my $exe= $exe_mysqltest; + my $args; + + mtr_init_args(\$args); + + mtr_add_arg($args, "--no-defaults"); + mtr_add_arg($args, "--silent"); + mtr_add_arg($args, "--skip-safemalloc"); + mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir); + mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); + mtr_add_arg($args, "--logdir=%s/log", $opt_vardir); + + # Log line number and time for each line in .test file + mtr_add_arg($args, "--mark-progress") + if $opt_mark_progress; + + if ($tinfo->{'component_id'} eq 'im') + { + mtr_add_arg($args, "--socket=%s", $instance_manager->{'path_sock'}); + mtr_add_arg($args, "--port=%d", $instance_manager->{'port'}); + mtr_add_arg($args, "--user=%s", $instance_manager->{'admin_login'}); + mtr_add_arg($args, "--password=%s", $instance_manager->{'admin_password'}); + } + else # component_id == mysqld + { + mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'}); + mtr_add_arg($args, "--port=%d", $master->[0]->{'port'}); + mtr_add_arg($args, "--database=test"); + mtr_add_arg($args, "--user=%s", $opt_user); + mtr_add_arg($args, "--password="); + } + + if ( $opt_ps_protocol ) + { + mtr_add_arg($args, "--ps-protocol"); + } + + if ( $opt_sp_protocol ) + { + mtr_add_arg($args, "--sp-protocol"); + } + + if ( $opt_view_protocol ) + { + mtr_add_arg($args, "--view-protocol"); + } + + if ( $opt_cursor_protocol ) + { + mtr_add_arg($args, "--cursor-protocol"); + } + + if ( $opt_strace_client ) + { + $exe= "strace"; # FIXME there are ktrace, .... + mtr_add_arg($args, "-o"); + mtr_add_arg($args, "%s/log/mysqltest.strace", $opt_vardir); + mtr_add_arg($args, "$exe_mysqltest"); + } + + if ( $opt_timer ) + { + mtr_add_arg($args, "--timer-file=%s/log/timer", $opt_vardir); + } + + if ( $opt_compress ) + { + mtr_add_arg($args, "--compress"); + } + + if ( $opt_sleep ) + { + mtr_add_arg($args, "--sleep=%d", $opt_sleep); + } + + if ( $opt_debug ) + { + mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace", + $path_vardir_trace); + } + + if ( $opt_ssl_supported ) + { + mtr_add_arg($args, "--ssl-ca=%s/std_data/cacert.pem", + $glob_mysql_test_dir); + mtr_add_arg($args, "--ssl-cert=%s/std_data/client-cert.pem", + $glob_mysql_test_dir); + mtr_add_arg($args, "--ssl-key=%s/std_data/client-key.pem", + $glob_mysql_test_dir); + } + + if ( $opt_ssl ) + { + # Turn on SSL for _all_ test cases if option --ssl was used + mtr_add_arg($args, "--ssl"); + } + elsif ( $opt_ssl_supported ) + { + mtr_add_arg($args, "--skip-ssl"); + } + + foreach my $arg ( @opt_extra_mysqltest_opt ) + { + mtr_add_arg($args, "%s", $arg); + } + + # ---------------------------------------------------------------------- + # If embedded server, we create server args to give mysqltest to pass on + # ---------------------------------------------------------------------- + + if ( $glob_use_embedded_server ) + { + mysqld_arguments($args,$master->[0],$tinfo->{'master_opt'},[]); + } + + # ---------------------------------------------------------------------- + # export MYSQL_TEST variable containing <path>/mysqltest <args> + # ---------------------------------------------------------------------- + $ENV{'MYSQL_TEST'}= + mtr_native_path($exe_mysqltest) . " " . join(" ", @$args); + + # ---------------------------------------------------------------------- + # Add arguments that should not go into the MYSQL_TEST env var + # ---------------------------------------------------------------------- + + if ( $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, "--test-file=%s", $tinfo->{'path'}); + + # Number of lines of resut to include in failure report + mtr_add_arg($args, "--tail-lines=20"); + + if ( defined $tinfo->{'result_file'} ) { + mtr_add_arg($args, "--result-file=%s", $tinfo->{'result_file'}); + } + + if ( $opt_record ) + { + mtr_add_arg($args, "--record"); + } + + if ( $opt_client_gdb ) + { + gdb_arguments(\$args, \$exe, "client"); + } + elsif ( $opt_client_ddd ) + { + ddd_arguments(\$args, \$exe, "client"); + } + elsif ( $opt_client_debugger ) + { + debugger_arguments(\$args, \$exe, "client"); + } + + if ( $opt_check_testcases ) + { + foreach my $mysqld (@{$master}, @{$slave}) + { + if ($mysqld->{'pid'}) + { + run_check_testcase("before", $mysqld); + } + } + } + + my $res = mtr_run_test($exe,$args,"","",$path_timefile,""); + + if ( $opt_check_testcases ) + { + foreach my $mysqld (@{$master}, @{$slave}) + { + if ($mysqld->{'pid'}) + { + if (run_check_testcase("after", $mysqld)) + { + # Check failed, mark the test case with that info + $tinfo->{'check_testcase_failed'}= 1; + } + } + } + } + + return $res; + +} + + +# +# Modify the exe and args so that program is run in gdb in xterm +# +sub gdb_arguments { + my $args= shift; + my $exe= shift; + my $type= shift; + + # Write $args to gdb init file + my $str= join(" ", @$$args); + my $gdb_init_file= "$opt_tmpdir/gdbinit.$type"; + + # Remove the old gdbinit file + unlink($gdb_init_file); + + if ( $type eq "client" ) + { + # write init file for client + mtr_tofile($gdb_init_file, + "set args $str\n" . + "break main\n"); + } + else + { + # write init file for mysqld + mtr_tofile($gdb_init_file, <<EOGDB ); +set args $str +EOGDB + } + + if ( $opt_manual_gdb ) + { + print "\nTo start gdb for $type, type in another window:\n"; + print "gdb -cd $glob_mysql_test_dir -x $gdb_init_file $$exe\n"; + + # Indicate the exe should not be started + $$exe= undef; + return; + } + + $$args= []; + mtr_add_arg($$args, "-title"); + mtr_add_arg($$args, "$type"); + mtr_add_arg($$args, "-e"); + + if ( $exe_libtool ) + { + mtr_add_arg($$args, $exe_libtool); + mtr_add_arg($$args, "--mode=execute"); + } + + mtr_add_arg($$args, "gdb"); + mtr_add_arg($$args, "-x"); + mtr_add_arg($$args, "$gdb_init_file"); + mtr_add_arg($$args, "$$exe"); + + $$exe= "xterm"; +} + + +# +# Modify the exe and args so that program is run in ddd +# +sub ddd_arguments { + my $args= shift; + my $exe= shift; + my $type= shift; + + # Write $args to ddd init file + my $str= join(" ", @$$args); + my $gdb_init_file= "$opt_tmpdir/gdbinit.$type"; + + # Remove the old gdbinit file + unlink($gdb_init_file); + + if ( $type eq "client" ) + { + # write init file for client + mtr_tofile($gdb_init_file, + "set args $str\n" . + "break main\n"); + } + else + { + # write init file for mysqld + mtr_tofile($gdb_init_file, + "file $$exe\n" . + "set args $str\n"); + } + + if ( $opt_manual_ddd ) + { + print "\nTo start ddd for $type, type in another window:\n"; + print "ddd -cd $glob_mysql_test_dir -x $gdb_init_file $$exe\n"; + + # Indicate the exe should not be started + $$exe= undef; + return; + } + + my $save_exe= $$exe; + $$args= []; + if ( $exe_libtool ) + { + $$exe= $exe_libtool; + mtr_add_arg($$args, "--mode=execute"); + mtr_add_arg($$args, "ddd"); + } + else + { + $$exe= "ddd"; + } + mtr_add_arg($$args, "--command=$gdb_init_file"); + mtr_add_arg($$args, "$save_exe"); +} + + +# +# Modify the exe and args so that program is run in the selected debugger +# +sub debugger_arguments { + my $args= shift; + my $exe= shift; + my $debugger= $opt_debugger || $opt_client_debugger; + + if ( $debugger =~ /vcexpress|vc|devenv/ ) + { + # vc[express] /debugexe exe arg1 .. argn + + # Add /debugexe and name of the exe before args + unshift(@$$args, "/debugexe"); + unshift(@$$args, "$$exe"); + + # Set exe to debuggername + $$exe= $debugger; + + } + elsif ( $debugger =~ /windbg/ ) + { + # windbg exe arg1 .. argn + + # Add name of the exe before args + unshift(@$$args, "$$exe"); + + # Set exe to debuggername + $$exe= $debugger; + + } + elsif ( $debugger eq "dbx" ) + { + # xterm -e dbx -r exe arg1 .. argn + + unshift(@$$args, $$exe); + unshift(@$$args, "-r"); + unshift(@$$args, $debugger); + unshift(@$$args, "-e"); + + $$exe= "xterm"; + + } + else + { + mtr_error("Unknown argument \"$debugger\" passed to --debugger"); + } +} + + +# +# Modify the exe and args so that program is run in valgrind +# +sub valgrind_arguments { + my $args= shift; + my $exe= shift; + + if ( $opt_callgrind) + { + mtr_add_arg($args, "--tool=callgrind"); + mtr_add_arg($args, "--base=$opt_vardir/log"); + } + else + { + mtr_add_arg($args, "--tool=memcheck"); # From >= 2.1.2 needs this option + mtr_add_arg($args, "--alignment=8"); + mtr_add_arg($args, "--leak-check=yes"); + mtr_add_arg($args, "--num-callers=16"); + mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir) + if -f "$glob_mysql_test_dir/valgrind.supp"; + } + + # Add valgrind options, can be overriden by user + mtr_add_arg($args, '%s', $_) for (@valgrind_args); + + mtr_add_arg($args, $$exe); + + $$exe= $opt_valgrind_path || "valgrind"; + + if ($exe_libtool) + { + # Add "libtool --mode-execute" before the test to execute + # if running in valgrind(to avoid valgrinding bash) + unshift(@$args, "--mode=execute", $$exe); + $$exe= $exe_libtool; + } +} + + +############################################################################## +# +# Usage +# +############################################################################## + +sub usage ($) { + my $message= shift; + + if ( $message ) + { + print STDERR "$message\n"; + } + + print <<HERE; + +$0 [ OPTIONS ] [ TESTCASE ] + +Options to control what engine/variation to run + + embedded-server Use the embedded server, i.e. no mysqld daemons + ps-protocol Use the binary protocol between client and server + cursor-protocol Use the cursor protocol between client and server + (implies --ps-protocol) + view-protocol Create a view to execute all non updating queries + sp-protocol Create a stored procedure to execute all queries + compress Use the compressed protocol between client and server + ssl Use ssl protocol between client and server + skip-ssl Dont start server with support for ssl connections + bench Run the benchmark suite + small-bench Run the benchmarks with --small-tests --small-tables + ndb|with-ndbcluster Use cluster as default table type + vs-config Visual Studio configuration used to create executables + (default: MTR_VS_CONFIG environment variable) + +Options to control directories to use + benchdir=DIR The directory where the benchmark suite is stored + (default: ../../mysql-bench) + tmpdir=DIR The directory where temporary files are stored + (default: ./var/tmp). + vardir=DIR The directory where files generated from the test run + is stored (default: ./var). Specifying a ramdisk or + tmpfs will speed up tests. + mem Run testsuite in "memory" using tmpfs or ramdisk + Attempts to find a suitable location + using a builtin list of standard locations + for tmpfs (/dev/shm) + The option can also be set using environment + variable MTR_MEM=[DIR] + +Options to control what test suites or cases to run + + force Continue to run the suite after failure + with-ndbcluster-only Run only tests that include "ndb" in the filename + skip-ndb[cluster] Skip all tests that need cluster + skip-ndb[cluster]-slave Skip all tests that need a slave cluster + ndb-extra Run extra tests from ndb directory + do-test=PREFIX or REGEX + Run test cases which name are prefixed with PREFIX + or fulfills REGEX + skip-test=PREFIX or REGEX + Skip test cases which name are prefixed with PREFIX + or fulfills REGEX + start-from=PREFIX Run test cases starting from test prefixed with PREFIX + suite[s]=NAME1,..,NAMEN Collect tests in suites from the comma separated + list of suite names. + The default is: "$opt_suites_default" + skip-rpl Skip the replication test cases. + skip-im Don't start IM, and skip the IM test cases + big-test Set the environment variable BIG_TEST, which can be + checked from test cases. + combination="ARG1 .. ARG2" Specify a set of "mysqld" arguments for one + combination. + skip-combination Skip any combination options and combinations files + +Options that specify ports + + master_port=PORT Specify the port number used by the first master + slave_port=PORT Specify the port number used by the first slave + ndbcluster-port=PORT Specify the port number used by cluster + ndbcluster-port-slave=PORT Specify the port number used by slave cluster + mtr-build-thread=# Specify unique collection of ports. Can also be set by + setting the environment variable MTR_BUILD_THREAD. + +Options for test case authoring + + record TESTNAME (Re)genereate the result file for TESTNAME + check-testcases Check testcases for sideeffects + mark-progress Log line number and elapsed time to <testname>.progress + +Options that pass on options + + mysqld=ARGS Specify additional arguments to "mysqld" + +Options to run test on running server + + extern Use running server for tests + ndb-connectstring=STR Use running cluster, and connect using STR + ndb-connectstring-slave=STR Use running slave cluster, and connect using STR + user=USER User for connection to extern server + socket=PATH Socket for connection to extern server + +Options for debugging the product + + client-ddd Start mysqltest client in ddd + client-debugger=NAME Start mysqltest in the selected debugger + client-gdb Start mysqltest client in gdb + ddd Start mysqld in ddd + debug Dump trace output for all servers and client programs + debugger=NAME Start mysqld in the selected debugger + gdb Start the mysqld(s) in gdb + manual-debug Let user manually start mysqld in debugger, before + running test(s) + manual-gdb Let user manually start mysqld in gdb, before running + test(s) + manual-ddd Let user manually start mysqld in ddd, before running + test(s) + master-binary=PATH Specify the master "mysqld" to use + slave-binary=PATH Specify the slave "mysqld" to use + strace-client Create strace output for mysqltest client + max-save-core Limit the number of core files saved (to avoid filling + up disks for heavily crashing server). Defaults to + $opt_max_save_core, set to 0 for no limit. + +Options for coverage, profiling etc + + gcov FIXME + gprof FIXME + valgrind Run the "mysqltest" and "mysqld" executables using + valgrind with default options + valgrind-all Synonym for --valgrind + valgrind-mysqltest Run the "mysqltest" and "mysql_client_test" executable + with valgrind + valgrind-mysqld Run the "mysqld" executable with valgrind + valgrind-options=ARGS Deprecated, use --valgrind-option + valgrind-option=ARGS Option to give valgrind, replaces default option(s), + can be specified more then once + valgrind-path=[EXE] Path to the valgrind executable + callgrind Instruct valgrind to use callgrind + +Misc options + + comment=STR Write STR to the output + notimer Don't show test case execution time + script-debug Debug this script itself + verbose More verbose output + start-and-exit Only initialize and start the servers, using the + startup settings for the specified test case (if any) + start-dirty Only start the servers (without initialization) for + the specified test case (if any) + fast Don't try to clean up from earlier runs + reorder Reorder tests to get fewer server restarts + help Get this help text + + testcase-timeout=MINUTES Max test case run time (default $default_testcase_timeout) + suite-timeout=MINUTES Max test suite run time (default $default_suite_timeout) + warnings | log-warnings Pass --log-warnings to mysqld + + sleep=SECONDS Passed to mysqltest, will be used as fixed sleep time + client-bindir=PATH Path to the directory where client binaries are located + client-libdir=PATH Path to the directory where client libraries are located + +Deprecated options + with-openssl Deprecated option for ssl + + +HERE + mtr_exit(1); + +} + +sub list_options ($) { + my $hash= shift; + + for (keys %$hash) { + s/(=.*|!)$//; + s/\|/\n--/g; + print "--$_\n"; + } + + mtr_exit(1); +} + diff --git a/mysql-test/ndb/ndb_config_1_node.ini b/mysql-test/lib/v1/ndb_config_1_node.ini index 4e0be7796dc..4e0be7796dc 100644 --- a/mysql-test/ndb/ndb_config_1_node.ini +++ b/mysql-test/lib/v1/ndb_config_1_node.ini diff --git a/mysql-test/ndb/ndb_config_2_node.ini b/mysql-test/lib/v1/ndb_config_2_node.ini index 57e4d049ad6..57e4d049ad6 100644 --- a/mysql-test/ndb/ndb_config_2_node.ini +++ b/mysql-test/lib/v1/ndb_config_2_node.ini diff --git a/mysql-test/misc/kill_master.sh b/mysql-test/misc/kill_master.sh deleted file mode 100644 index 7938c9d3ac2..00000000000 --- a/mysql-test/misc/kill_master.sh +++ /dev/null @@ -1,4 +0,0 @@ -kill -9 `cat var/run/master.pid` -# The kill may fail if process has already gone away, -# so don't use the exit code of the kill. Use 0. -exit 0 diff --git a/mysql-test/misc/mysql-test_V1.9.pl b/mysql-test/misc/mysql-test_V1.9.pl deleted file mode 100644 index 129ec41b4d5..00000000000 --- a/mysql-test/misc/mysql-test_V1.9.pl +++ /dev/null @@ -1,1121 +0,0 @@ -#!/usr/bin/perl -# -# Tests MySQL. Output is given to the stderr. Use -# diff to check the possible differencies. -# - -use DBI; -use Getopt::Long; - -$VER = "1.9"; -$| = 1; - -$opt_db = "test"; -$opt_user = $opt_password = $opt_without = ""; -$opt_host = "localhost"; -$opt_port = "3306"; -$opt_socket = "/tmp/mysql.sock"; -$opt_help = 0; - -$NO_ERR = 0; # No error -$EXP_ERR = 1; # Expect error -$MAY_ERR = 2; # Maybe error -$HS = 0; # Horizontal style of output -$VS = 1; # Vertical style of output -$VERBOSE = 0; # Print the results -$SILENT = 1; # No output - -@test_packages = ("FUNC", "PROC", "SHOW"); - -#### -#### main program -#### - -main(); - -sub main() -{ - GetOptions("help", "db=s", "port=i", "host=s", "password=s", "user=s", "socket=s", - "without=s") || usage(); - - usage() if ($opt_help); - - $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host:port=$opt_port:mysql_socket=$opt_socket", $opt_user, $opt_password, { PrintError => 0 }) - || die $DBI::errstr; - -## QQ ###################################### - -$sth = $dbh->prepare("show felds from t2") -|| die "Couldn't prepare query: $DBI::errstr\n"; -if (!$sth->execute) -{ - print "Couldn't execute query: $DBI::errstr\n"; - $sth->finish; - die; -} -while (($row = $sth->fetchrow_arrayref)) -{ - print "$row->[1]\n"; -} - - -exit(0); - -## QQ ###################################### - - printf("####\n#### THIS IS mysql-test script RUNNING\n"); - printf("#### mysql-test version $VER\n####\n"); - - test_mysql_functions() if (&chk_package($opt_without, $test_packages[0])); - test_mysql_procedures() if (&chk_package($opt_without, $test_packages[1])); - test_mysql_show() if (&chk_package($opt_without, $test_packages[2])); - - print "\n"; - return; -} - -#### -#### test show -command of MySQL -#### - -sub test_mysql_show -{ - my ($query, $i); - - $query = create_show_tables(); - &exec_query(["drop table my_t"], $MAY_ERR, $SILENT); - for ($i = 0; $query[$i]; $i++) - { - &exec_query([$query[$i]], $NO_ERR, $VERBOSE, $HS); - &exec_query(["show fields from my_t"], $NO_ERR, $VERBOSE, $HS); - &exec_query(["show keys from my_t"], $NO_ERR, $VERBOSE, $HS); - &exec_query(["drop table my_t"], $NO_ERR, $SILENT); - } -} - -sub create_show_tables -{ - my ($query, $i); - - $query[0] = <<EOF; -create table my_t (i int, f float, s char(64), b blob, t text) -EOF - $query[1] = <<EOF; -create table my_t (i int, f float, s char(64), b blob, t text, primary key (i)) -EOF - $query[2] = <<EOF; -create table my_t (i int, f float, s char(64), b blob, t text, unique (i), unique(s)) -EOF - for ($i = 0; $query[$i]; $i++) { chop($query[$i]); } - return $query; -} - -#### -#### test procedures, currently only procedure analyze() -#### - -sub test_mysql_procedures -{ - test_analyze(); -} - -sub test_analyze -{ - my ($query, $i, $j); - - if ($opt_help) - { - usage(); - } - # invalid queries - &exec_query(["select * from mails procedure analyse(-1)"], - $EXP_ERR, $VERBOSE, $HS); - &exec_query(["select * from mails procedure analyse(10, -1)"], - $EXP_ERR, $VERBOSE, $HS); - &exec_query(["select * from mails procedure analyse(1, 2, 3)"], - $EXP_ERR, $VERBOSE, $HS); - &exec_query(["select * from mails procedure analyse(-10, 10)"], - $EXP_ERR, $VERBOSE, $HS); - &exec_query(["select * from mails procedure analyse('a', 'a')"], - $EXP_ERR, $VERBOSE, $HS); - # valid queries -# &exec_query(["select * from mails procedure analyse(10)"], 0, 0); -# &exec_query(["select * from mails procedure analyse(10, 10)"], 0, 0); -# &exec_query(["select hash from mails procedure analyse()"], 0, 0); - &exec_query(["use mysql_test"], $NO_ERR, $VERBOSE, $HS); -# &exec_query(["select timestamp from w32_user procedure analyse(0)"], 0, 0); - $query = create_test_tables(); - &exec_query(["drop table my_t"], $MAY_ERR, $SILENT); - for ($i = 0; $query[$i][0]; $i++) - { - &exec_query([$query[$i][0]], $NO_ERR, $SILENT); # create table - for ($j = 1; $query[$i][$j]; $j++) - { - &exec_query([$query[$i][$j]], $NO_ERR, $SILENT); # do inserts - } - &exec_query(["select * from my_t procedure analyse(0,0)"], - $NO_ERR, $VERBOSE, $HS); - &exec_query(["select * from my_t procedure analyse()"], - $NO_ERR, $VERBOSE, $HS); - &exec_query(["drop table my_t"], $NO_ERR, $SILENT); - } -} - -#### -#### if $opt is found as a part from the '--without=...' option string -#### return 0, else 1. if zero is returned, then that part of MySQL -#### won't be tested -#### - -sub chk_package -{ - my ($opt_str, $opt) = @_; - - $sub_opt_str = ''; - for ($i = 0, $ptr = substr($opt_str, $i, 1); $ptr || $ptr eq '0'; - $i++, $ptr = substr($opt_str, $i, 1)) - { - $sub_opt_str .= $ptr; - if ($sub_opt_str eq $opt) - { - $next_chr = substr($opt_str, ($i + 1), 1); - if ($next_chr eq ',' || (!$next_chr && $next_chr ne '0')) - { - return 0; - } - } - if ($ptr eq ',') - { - # next word on the opt_str - $sub_opt_str = ''; - } - } - return 1; -} - -#### -#### Tests given function(s) with given value(s) $count rounds -#### If function doesn't have an arg, test it once and continue. -#### ulargs (number of unlimited args) is the number of arguments -#### to be placed in place of '.' . '.' means that any number -#### of the last argument type is possible to the function. -#### If force is given, never mind about errors -#### args: $func: list of functions to be tested -#### $value: list of values to be used with functions -#### $count: number of times one function should be tested -#### $ulargs: number of unlimited args to be used when possible -#### $table_info: information about the table to be used, contains: -#### table name, info about the fields in the table, for example: -#### [mysql_test1, "Zi", "Rd"], where mysql_test1 is the name of the -#### table, "Zi" tells, that the first field name is 'i' and it is -#### type 'Z' (integer), see test_mysql_functions, 'Rd' tells that -#### the second field name is 'd' and the type is 'R' (real number) -#### $force: if given, never mind about errors -#### $mix: if 0, use the same argument at a time in a -#### function that has two or more same type arguments -#### if 1, use different values -#### - -sub test_func() -{ - my ($func, $value, $count, $ulargs, $table_info, $force, $mix) = @_; - my ($query, $i, $j, $k, $no_arg, $row, $ulimit, $tbinfo, $tbused, $arg); - - if (!$func->[0][0]) - { - printf("No function found!\n"); - if (!$force) { die; } - } - - for ($i = 0; $func->[$i][0]; $i++) - { - $tbused = 0; - $no_arg = 0; - for ($j = 0; $j < $count && !$no_arg; $j++) - { - if ($tbused || $no_arg) { next; } - $query = "select $func->[$i][0]("; - #search the values for the args - for ($k = 0; $k < length($func->[$i][1]) && !$no_arg; $k++) - { - if ($mix) - { - $arg = $j + 1 + $k; - } - else - { - $arg = $j + 1; - } - if (substr($func->[$i][1], $k, 1) eq 'E') - { - $no_arg = 1; - next; - } - if ($k) { $query .= ','; } - - if (substr($func->[$i][1], $k, 1) eq 'S') - { - $query .= &find_value(\@value, 'S', $arg); - } - elsif (substr($func->[$i][1], $k, 1) eq 'N') - { - $query .= &find_value(\@value, 'N', $arg); - } - elsif (substr($func->[$i][1], $k, 1) eq 'Z') - { - $query .= &find_value(\@value, 'Z', $arg); - } - elsif ((substr($func->[$i][1], $k, 1) eq 'R')) - { - $query .= &find_value(\@value, 'R', $arg); - } - elsif (substr($func->[$i][1], $k, 1) eq 'T') - { - $query .= &find_value(\@value, 'T', $arg); - } - elsif (substr($func->[$i][1], $k, 1) eq 'D') - { - $query .= &find_value(\@value, 'D', $arg); - } - elsif (substr($func->[$i][1], $k, 1) eq 'B') - { - $query .= &find_value(\@value, 'B', $arg); - } - elsif (substr($func->[$i][1], $k, 1) eq 'C') - { - $query .= &find_value(\@value, 'C', $arg); - } - elsif (substr($func->[$i][1], $k, 1) eq 'F') - { - $query .= &find_value(\@value, 'F', $arg); - } - elsif (substr($func->[$i][1], $k, 1) eq '.') - { - chop($query); - for ($ulimit = 0; $ulimit < $ulargs; $ulimit++) - { - $query .= ','; - $query .= &find_value(\@value, - substr($func->[$i][1], $k - 1, 1), - $j + $ulimit + 2); - } - } - elsif (substr($func->[$i][1], $k, 1) eq 'A') - { - for ($tbinfo = 1; substr($table_info->[$tbinfo], 0, 1) ne - substr($func->[$i][1], $k + 1, 1); $tbinfo++) - { - if (!defined($table_info->[$tbinfo])) - { - printf("Illegal function structure!\n"); - printf("A table was needed, but no type specified!\n"); - printf("Unready query was: $query\n"); - if (!$force) { die; } - else { next; } - } - } - if ($k) { $query .= ","; } - $query .= substr($table_info->[$tbinfo], 1, - length($table_info->[$tbinfo]) - 1); - $k++; - $tbused = 1; - } - else - { - printf("Not a valid type: \n"); - printf(substr($func->[$i][1], $k, 1)); - printf("\nAttempted to be used with unready query: \n"); - printf("$query\n"); - } - } - $query .= ")"; - if ($tbused) - { - $query .= " from "; - $query .= $table_info->[0]; - } - if (!($sth = $dbh->prepare($query))) - { - printf("Couldn't prepare: $query\n"); - if (!$force) { die; } - } - if (!$sth->execute) - { - printf("Execution failed: $DBI::errstr\n"); - printf("Attempted query was:\n$query\n"); - $sth->finish; - if (!$force) { die; } - } - else - { - printf("mysql> $query;\n"); - display($sth, 1); - printf("Query OK\n\n"); - } - } - } -} - -#### -#### mk_str returns a string where the first arg is repeated second arg times -#### if repeat is 1, return the original str -#### - -sub mk_str() -{ - my ($str, $repeat) = @_; - my ($res_str); - - if ($repeat <= 0) - { - die "Invalid repeat times!\n"; - } - - for ($repeat--, $res_str = $str; $repeat > 0; $repeat--) - { - $res_str .= $str; - } - return $res_str; -} - -#### -#### find_value: returns a value from list of values -#### args: $values: list of values -#### $type: type of argument (S = string, N = integer etc.) -#### $ordinal: the ordinal number of an argument in the list -#### - -sub find_value() -{ - my ($values, $type, $ordinal) = @_; - my ($total, $i, $j, $tmp, $val); - - $total = -1; # The first one is the type - - for ($i = 0; $values[$i][0]; $i++) - { - if ($values[$i][0] eq $type) - { - $tmp = $values[$i]; - foreach $val (@$tmp) { $total++; } - for ( ;$total < $ordinal; ) - { - $ordinal -= $total; - } - return $values[$i][$ordinal]; - } - } - printf("No type '$type' found in values\n"); - die; -} - -#### -#### exec_query: execute a query, print information if wanted and exit -#### args: $queries: list of queries to be executed -#### $expect_error: if 0, error is not expected. In this case if an -#### error occurs, inform about it and quit -#### if 1, error is expected. In this case if sql server -#### doesn't give an error message, inform about it -#### and quit -#### if 2, error may happen or not, don't care -#### $silent: if true, reduce output -#### $style: type of output, 0 == horizontal, 1 == vertical -#### - -sub exec_query() -{ - my ($queries, $expect_error, $silent, $style) = @_; - my ($query); - - foreach $query (@$queries) - { - if (!($sth = $dbh->prepare($query))) - { - printf("Couldn't prepare: $query\n"); - die; - } - if (!$sth->execute) - { - if ($expect_error == 1) - { - printf("An invalid instruction was purposely made,\n"); - printf("server failed succesfully:\n"); - printf("$DBI::errstr\n"); - printf("Everything OK, continuing...\n"); - return; - } - if ($expect_error != 2) - { - printf("Execution failed: $DBI::errstr\n"); - printf("Attempted query was:\n$query\n"); - die; - } - } - if ($expect_error == 1) - { - printf("An invalid instruction was purposely made,\n"); - printf("server didn't note, ALARM!\n"); - printf("The query made was: $query\n"); - printf("The output from the server:\n"); - } - if ($expect_error == 2) { return; } - if (!$silent) { printf("mysql> $query;\n"); } - display($sth, $style); - if (!$silent) { printf("Query OK\n\n"); } - if ($expect_error) { die; } - } - return; -} - -#### -#### Display to stderr -#### Args: 1: ($sth) statememt handler -#### 2: ($style) 0 == horizontal style, 1 == vertical style -#### - -sub display() -{ - my ($sth, $style) = @_; - my (@data, @max_length, $row, $nr_rows, $nr_cols, $i, $j, $tmp, $mxl); - - # Store the field names and values in @data. - # Store the max field lengths in @max_length - for ($i = 0; ($row = $sth->fetchrow_arrayref); $i++) - { - if (!$i) - { - $nr_cols = $#$row; - for ($j = 0; $j <= $#$row; $j++) - { - $data[$i][$j] = $sth->{NAME}->[$j]; - $max_length[$j] = length($data[$i][$j]); - } - $i++; - } - for ($j = 0; $j <= $#$row; $j++) - { - $data[$i][$j] = $row->[$j]; - $max_length[$j] = $tmp if ($max_length[$j] < - ($tmp = length($data[$i][$j]))); - } - } - if (!($nr_rows = $i)) - { - return; - } - # Display data - if ($style == 0) - { - for ($i = 0; $i < $nr_rows; $i++) - { - if (!$i) - { - for ($j = 0; $j <= $nr_cols; $j++) - { - print "+"; print "-" x ($max_length[$j] + 2); - } - print "+\n"; - } - print "|"; - for ($j = 0; $j <= $nr_cols; $j++) - { - print " "; - if (defined($data[$i][$j])) - { - print $data[$i][$j]; - $tmp = length($data[$i][$j]); - } - else - { - print "NULL"; - $tmp = 4; - } - print " " x ($max_length[$j] - $tmp); - print " |"; - } - print "\n"; - if (!$i) - { - for ($j = 0; $j <= $nr_cols; $j++) - { - print "+"; print "-" x ($max_length[$j] + 2); - } - print "+\n"; - } - } - for ($j = 0; $j <= $nr_cols; $j++) - { - print "+"; print "-" x ($max_length[$j] + 2); - } - print "+\n"; - return; - } - if ($style == 1) - { - for ($i = 0; $max_length[$i]; $i++) - { - $mxl = $max_length[$i] if ($mxl < $max_length[$i]); - } - - for ($i = 1; $i < $nr_rows; $i++) - { - print "*" x 27; - print " " . $i . ". row "; - print "*" x 27; - print "\n"; - for ($j = 0; $j <= $nr_cols; $j++) - { - print " " x ($mxl - length($data[0][$j])); - print "$data[0][$j]: "; - if (defined($data[$i][$j])) - { - print "$data[$i][$j] \n"; - } - else - { - print "NULL\n"; - } - } - } - return; - } -} - -#### -#### usage -#### - -sub usage -{ - print <<EOF; -mysql-test $VER by Jani Tolonen - -Usage: mysql-test [options] - -Options: ---help Show this help ---db= Database to use (Default: $opt_db) ---port= TCP/IP port to use for connection (Default: $opt_port) ---socket= UNIX socket to use for connection (Default: $opt_socket) ---host= Connect to host (Default: $opt_host) ---user= User for login if not current user ---password Password to use when connecting to server - ---without=PART_NAME1,PART_NAME2,... - test without a certain part of MySQL, optional parts listed below - -Optional parts: - -FUNC Ignore MySQL basic functions -PROC Ignore MySQL procedure functions -EOF - exit(0); -} - - -sub test_mysql_functions -{ - - #### - #### MySQL functions - #### - #### Types: S = string (or real number) , N = unsigned integer, Z = integer, - #### R = real number, T = time_stamp, E = no argument, D = date, - #### B = boolean, C = character - #### F = format (usually used with the date-types) - #### . = any number of the last argument type possible - #### A = require table for test, the following argument - #### is the argument for the function - - # Muista get_lock,group_unique_users, - # position, unique_users - - # ks. kaikki date function, kerää yhteen, testaa erikseen - # adddate, date_add, subdate, date_sub, between, benchmark, count - - # decode, encode, get_lock, make_set, position - - @functions = (["abs","R"],["acos","R"],["ascii","C"],["asin","R"], - ["atan","R"],["atan2","R"],["avg","AR"],["bin","Z"], - ["bit_count","Z"],["bit_or","AZ"],["bit_and","AZ"], - ["ceiling","R"],["char","N."],["char_length","S"], - ["concat","SS."],["conv","ZZZ"], - ["cos","R"],["cot","R"],["curdate","E"], - ["curtime","E"],["database","E"],["date_format","DF"], - ["dayofmonth","D"],["dayofyear","D"],["dayname","D"], - ["degrees","R"],["elt","NS."],["encode","SS"], - ["encrypt","S"],["encrypt","SS"],["exp","R"],["field","SS."], - ["find_in_set","SS"],["floor","R"],["format","RN"], - ["from_days","N"],["from_unixtime","N"], - ["from_unixtime","NF"],["greatest","RR."],["hex","Z"], - ["hour","D"],["if","ZSS"],["ifnull","SS"],["insert","SNNS"], - ["instr","SS"],["interval","RR."],["isnull","S"], - ["last_insert_id","E"],["lcase","S"],["least","RR."], - ["left","SN"],["length","S"],["locate","SS"], - ["log","R"],["log10","R"],["lpad","SNS"],["ltrim","S"], - ["max","AR"],["mid","SNN"],["min","AR"],["minute","D"], - ["mod","ZZ"],["monthname","D"], - ["month","D"],["now","E"],["oct","Z"], - ["octet_length","S"],["password","S"],["period_add","DD"], - ["period_diff","DD"],["pi","E"], - ["pow","RR"],["quarter","D"],["radians","R"], - ["rand","E"],["rand","R"],["release_lock","S"], - ["repeat","SN"],["replace","SSS"],["reverse","S"], - ["right","SN"],["round","R"],["round","RN"], - ["rpad","SNS"],["rtrim","S"],["sec_to_time","N"], - ["second","T"],["sign","R"],["sin","R"], - ["space","N"],["soundex","S"],["sqrt","R"],["std","AR"], - ["strcmp","SS"],["substring","SN"],["substring","SNN"], - ["substring_index","SSZ"],["sum","AR"], - ["tan","R"],["time_format","TF"],["time_to_sec","T"], - ["to_days","D"],["trim","S"], - ["truncate","RN"],["ucase","S"], - ["unix_timestamp","E"],["unix_timestamp","D"],["user","E"], - ["version","E"],["week","D"],["weekday","D"],["year","D"]); - - #### - #### Various tests for the functions above - #### - - &exec_query(["drop table mysql_test1"], $MAY_ERR, $SILENT); - - $query .= <<EOF; -create table mysql_test1 ( - i int, - d double -) -EOF - chop($query); - &exec_query([$query], $NO_ERR, $SILENT); - - #### - #### Basic tests - #### - - printf("####\n#### BASIC TESTS FOR FUNCTIONS\n####\n\n"); - - @bunch = ("insert into mysql_test1 values(-20,-10.5),(20,10.5),(50,100.00)", - "insert into mysql_test1 values(100,500.333)"); - &exec_query(\@bunch, $NO_ERR, $SILENT); - - printf("\n####\n#### First basic test part\n####\n\n"); - - @values = (["S", "'a'", "'abc'", "'abc def'", "'abcd'", "'QWERTY'", - "'\\\\'", "'*.!\"#¤%&/()'", "'" . &mk_str('a',1024) . "'", - "?", "<>", "#__#"], - ["N", -1000, -500, -100, -1, 0, 1, 40, 50, 70, 90, - 100, 500, 1000], - ["Z", -100, -50, 200, 1000], - ["R", -500.5, -10.333, 100.667, 400.0], - ["T", 19980728154204, 19980728154205, 19980728154206, - 19980728154207], - ["D", "'1997-12-06'", "'1997-12-07'", "'1997-12-08'", - "'1997-12-09'"], - ["B", 1, 0, 0, 1], - ["C", "'a'", "'e'", "'r'", "'q'"], - ["F", "'%a'", "'%b'", "'%d'", "'%H'"]); - &test_func(\@functions, \@values, 4, 5, ["mysql_test1","Zi","Rd"]); - - printf("\n####\n#### Second basic test part\n####\n\n"); - - @values = (["S", "'a'", "'BC'", "'def'", "'HIJK'", "'lmnop'", "'QRSTUV'"], - ["N", 0, 1, 2, 3, 4, 5], - ["Z", 0, 1, 2, 3, 4, 5], - ["R", 0, 1, 2, 3, 4, 5], - ["T", 19990608234530, 20000709014631, 20010810024732, - 20020911034833, 20031012044934, 20041113055035], - ["D", "'1999-06-08'", "'2000-07-09'", "'2001-08-10'", - "'2002-09-11'", "'2003-10-12'", "'2004-11-13'"], - ["B", 0, 1, 0, 1, 0, 1], - ["C", "'a'", "'BC'", "'def'", "'HIJK'", "'lmnop'", "'QRSTUV'"], - ["F", "'%a'", "'%b'", "'%d'", "'%h'", "'%H'", "'%i'"]); - &test_func(\@functions, \@values, 6, 6, ["mysql_test1","Zi","Rd"], 0, 1); - - printf("\n####\n#### Third basic test part\n####\n\n"); - - @values = (["S", "'Monty'", "'Jani'", "'MySQL'", "''"], - ["N", 10, 54, -70, -499], - ["Z", 11.03, "'Abo'", 54.333, "''"], - ["R", 12, "'gnome'", -34.211, "''"], - ["T", 3, "'Redhat'", -19984021774433, "''"], - ["D", "'1990-01-31'", "'-3333-10-23'", -5631_23_12, "''"], - ["B", 0, "'asb'", -4, "''"], - ["C", "'a'", 503, -45353453, "''"], - ["F", "'%a'", -231, "'Mitsubishi'", "''"]); - &test_func(\@functions, \@values, 3, 3, ["mysql_test1","Zi","Rd"], 0, 1); - - &exec_query(["delete from mysql_test1"], $NO_ERR, $SILENT); - - #### - #### Null tests - #### - - printf("\n\n####\n#### NULL TESTS FOR FUNCTIONS\n####\n\n\n"); - - &exec_query(["insert into mysql_test1 values(null,null)"], $NO_ERR, - $SILENT); - @values = (["S", "NULL"], - ["N", "NULL"], - ["Z", "NULL"], - ["R", "NULL"], - ["T", "NULL"], - ["D", "NULL"], - ["B", "NULL"], - ["C", "NULL"], - ["F", "NULL"]); - &test_func(\@functions, \@values, 1, 5, ["mysql_test1","Zi","Rd"], 1); - &exec_query(["delete from mysql_test1"], $NO_ERR, $SILENT); - - #### - #### Tests to fulfill the main part of function tests above - #### - - printf("\n\n####\n#### FULFILL TESTS \n####\n\n\n"); - - &exec_query(["drop table my_t"], $MAY_ERR, $SILENT); - &exec_query(["create table my_t (s1 char(64), s2 char(64))"], - $NO_ERR, $VERBOSE, $HS); - $query = <<EOF; -insert into my_t values('aaa','aaa'),('aaa|qqq','qqq'),('gheis','^[^a-dXYZ]+\$'),('aab','^aa?b'),('Baaan','^Ba*n'),('aaa','qqq|aaa'),('qqq','qqq|aaa'),('bbb','qqq|aaa'),('bbb','qqq'),('aaa','aba'),(null,'abc'),('def',null),(null,null),('ghi','ghi[') -EOF - chop($query); - &exec_query([$query], $NO_ERR, $VERBOSE, $HS); - &exec_query(["select s1 regexp s2 from my_t"], - $NO_ERR, $VERBOSE, $HS); - - - #### - #### ["position","SS"], - #### - -} - -sub create_test_tables -{ - $query[0][0] = <<EOF; - CREATE TABLE my_t ( - auto int(5) unsigned DEFAULT '0' NOT NULL auto_increment, - string varchar(10) DEFAULT 'hello', - binary_string varchar(10) binary DEFAULT '' NOT NULL, - tiny tinyint(4) DEFAULT '0' NOT NULL, - short smallint(6) DEFAULT '1' NOT NULL, - medium mediumint(8) DEFAULT '0' NOT NULL, - longint int(11) DEFAULT '0' NOT NULL, - longlong bigint(13) DEFAULT '0' NOT NULL, - num decimal(5,2) DEFAULT '0.00' NOT NULL, - num_fill decimal(6,2) unsigned zerofill DEFAULT '0000.00' NOT NULL, - real_float float(13,1) DEFAULT '0.0' NOT NULL, - real_double double(13,1), - utiny tinyint(3) unsigned DEFAULT '0' NOT NULL, - ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL, - umedium mediumint(8) unsigned DEFAULT '0' NOT NULL, - ulong int(11) unsigned DEFAULT '0' NOT NULL, - ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL, - zero int(5) unsigned zerofill, - time_stamp timestamp(14), - date_field date, - time_field time, - date_time datetime, - blob_col blob, - tinyblob_col tinyblob, - mediumblob_col mediumblob NOT NULL, - longblob_col longblob NOT NULL, - options enum('one','two','three'), - flags set('one','two','three'), - PRIMARY KEY (auto) -) -EOF - chop($query[0][0]); - $query[0][1] = <<EOF; - INSERT INTO my_t VALUES (1,'hello','',0,1,0,0,0,0.00,0000.00,0.0,NULL,0, - 00000,0,0,0,NULL,19980728154204,NULL,'01:00:00', - NULL,NULL,NULL,'','',NULL,NULL) -EOF - chop($query[0][1]); - $query[0][2] = <<EOF; - INSERT INTO my_t VALUES (2,'hello','',0,1,0,0,0,0.00,0000.00, - -340282346638528859811704183484516925440.0,NULL,0, - 00000,0,0,0,NULL,19980728154205,NULL,NULL,NULL,NULL, - NULL,'','',NULL,NULL) -EOF - chop($query[0][2]); - $query[0][3] = <<EOF; - INSERT INTO my_t VALUES (3,'hello','',0,1,0,0,0,0.00,0000.00,0.0,NULL,0,00000, - 0,0,0,NULL,19980728154205,NULL,NULL, - '2002-12-30 22:04:02',NULL,NULL,'','',NULL,NULL) -EOF - chop($query[0][3]); - $query[0][4] = <<EOF; - INSERT INTO my_t VALUES (4,'hello','',0,1,0,0,0,0.00,0000.00,0.0,NULL,0,00000, - 0,0,0,NULL,19980728154205,'1997-12-06',NULL,NULL, - NULL,NULL,'','',NULL,NULL) -EOF - chop($query[0][4]); - $query[0][5] = <<EOF; - INSERT INTO my_t VALUES (5,'hello','',0,1,0,0,0,0.00,0000.00,0.0,NULL,0,00000, - 0,0,0,NULL,19980728154205,NULL,'20:10:08',NULL,NULL, - NULL,'','',NULL,NULL) -EOF - chop($query[0][5]); - $query[0][6] = <<EOF; - INSERT INTO my_t VALUES (6,'hello','',0,1,0,0,0,-0.22,0000.00,0.0,NULL,0, - 00000,0,0,0,NULL,19980728154205,NULL,NULL,NULL, - NULL,NULL,'','',NULL,NULL) -EOF - chop($query[0][6]); - $query[0][7] = <<EOF; - INSERT INTO my_t VALUES (7,'hello','',0,1,0,0,0,-0.00,0000.00,0.0,NULL,0, - 00000,0,0,0,NULL,19980728154205,NULL,NULL,NULL, - NULL,NULL,'','',NULL,NULL) -EOF - chop($query[0][7]); - $query[0][8] = <<EOF; - INSERT INTO my_t VALUES (8,'hello','',0,1,0,0,0,+0.00,0000.00,0.0,NULL,0, - 00000,0,0,0,NULL,19980728154205,NULL,NULL,NULL, - NULL,NULL,'','',NULL,NULL) -EOF - chop($query[0][8]); - $query[0][9] = <<EOF; - INSERT INTO my_t VALUES (9,'hello','',0,1,0,0,0,+0.90,0000.00,0.0,NULL,0, - 00000,0,0,0,NULL,19980728154205,NULL,NULL,NULL, - NULL,NULL,'','',NULL,NULL) -EOF - chop($query[0][9]); - $query[0][10] = <<EOF; - INSERT INTO my_t VALUES (10,'hello','',0,1,0,0,0,-999.99,0000.00,0.0,NULL,0, - 00000,0,0,0,NULL,19980728154206,NULL,NULL,NULL,NULL, - NULL,'','',NULL,NULL) -EOF - chop($query[0][10]); - $query[0][11] = <<EOF; - INSERT INTO my_t VALUES (11,'hello','',127,32767,8388607,2147483647, - 9223372036854775807,9999.99,9999.99, - 329999996548271212625250308919809540096.0,9.0,255, - 65535,16777215,4294967295,18446744073709551615, - 4294967295,00000000000000,'9999-12-31','23:59:59', - '9999-12-31 23:59:59',NULL,NULL,' ',' ','', - 'one,two,three') -EOF - chop($query[0][11]); - $query[0][12] = <<EOF; - INSERT INTO my_t VALUES (12,'hello','',-128,-32768,-8388608,-2147483648, - -9223372036854775808,-999.99,0000.00, - -329999996548271212625250308919809540096.0,10.0,0, - 00000,0,0,0,00000,00000000000000, - '9999-12-31','23:59:59','9999-12-31 23:59:59',NULL, - NULL,' ,-',' ,-','','one,two,three') -EOF - chop($query[0][12]); - $query[0][13] = <<EOF; - INSERT INTO my_t VALUES (13,'hello','',0,1,0,0,0,0.09,0000.00,0.0,NULL,0, - 00000,0,0,0,NULL,19980728154223,NULL,NULL,NULL, - NULL,NULL,'','',NULL,NULL) -EOF - chop($query[0][13]); - $query[0][14] = <<EOF; - INSERT INTO my_t VALUES (14,'hello','',0,1,0,0,0,0.00,0000.00,0.0,NULL,0, - 00000,0,0,0,NULL,19980728154223,NULL,NULL,NULL, - NULL,NULL,'','',NULL,NULL) -EOF - chop($query[0][14]); - $query[0][15] = <<EOF; - INSERT INTO my_t VALUES (15,'hello','',0,1,0,0,0,0.00,0044.00,0.0,NULL,0, - 00000,0,0,0,NULL,19980728154223,NULL,NULL,NULL, - NULL,NULL,'','',NULL,NULL) -EOF - chop($query[0][15]); - $query[0][16] = <<EOF; - INSERT INTO my_t VALUES (16,'hello','',0,1,0,0,0,0.00,9999.99,0.0,NULL,0, - 00000,0,0,0,NULL,19980728154223,NULL,NULL,NULL, - NULL,NULL,'','',NULL,NULL) -EOF - chop($query[0][16]); - $query[0][17] = <<EOF; - INSERT INTO my_t VALUES (17,'hello','',127,32767,8388607,2147483647, - 9223372036854775807,9999.99,9999.99, - 329999996548271212625250308919809540096.0,9.0,255, - 65535,16777215,4294967295,18446744073709551615, - 4294967295,00000000000000,'9999-12-31','23:59:59', - '9999-12-31 23:59:59',NULL,NULL,' ',' ','', - 'one,two,three') -EOF - chop($query[0][17]); - $query[0][18] = <<EOF; - INSERT INTO my_t VALUES (18,'hello','',127,32767,8388607,2147483647, - 9223372036854775807,9999.99,9999.99,0.0,NULL,255, - 65535,16777215,4294967295,18446744073709551615, - 4294967295,19980728154224,NULL,NULL,NULL,NULL, - NULL,'','',NULL,NULL) -EOF - chop($query[0][18]); - $query[0][19] = <<EOF; - INSERT INTO my_t VALUES (19,'hello','',127,32767,8388607,2147483647, - 9223372036854775807,9999.99,9999.99,0.0,NULL,255, - 65535,16777215,4294967295,0,4294967295, - 19980728154224,NULL,NULL,NULL,NULL,NULL,'','', - NULL,NULL) -EOF - chop($query[0][19]); - $query[0][20] = <<EOF; - INSERT INTO my_t VALUES (20,'hello','',-128,-32768,-8388608,-2147483648, - -9223372036854775808,-999.99,0000.00,0.0,NULL,0, - 00000,0,0,18446744073709551615,00000,19980728154224, - NULL,NULL,NULL,NULL,NULL,'','',NULL,NULL) -EOF - chop($query[0][20]); - $query[0][21] = <<EOF; - INSERT INTO my_t VALUES (21,'hello','',-128,-32768,-8388608,-2147483648, - -9223372036854775808,-999.99,0000.00,0.0,NULL,0, - 00000,0,0,0,00000,19980728154225,NULL,NULL,NULL, - NULL,NULL,'','',NULL,NULL) -EOF - chop($query[0][21]); - $query[0][22] = <<EOF; - INSERT INTO my_t VALUES (22,NULL,'1',1,1,1,1,1,1.00,0001.00,1.0,NULL,1,00001, - 1,1,1,00001,19980728154244,NULL,NULL,NULL,NULL,NULL, - '1','1',NULL,NULL) -EOF - chop($query[0][22]); - $query[0][23] = <<EOF; - INSERT INTO my_t VALUES (23,'2','2',2,2,2,2,2,2.00,0002.00,2.0,2.0,2,00002, - 2,2,2,00002,00000000000000,'0000-00-00','02:00:00', - '0000-00-00 00:00:00','2','2','2','2','','') -EOF - chop($query[0][23]); - $query[0][24] = <<EOF; - INSERT INTO my_t VALUES (24,'3','3',3,3,3,3,3,3.00,0003.00,3.0,3.0,3,00003, - 3,3,3,00003,00000000000000,'2000-00-03','00:00:03', - '0000-00-00 00:00:03','3.00','3.00','3.00','3.00', - 'three','one,two') -EOF - chop($query[0][24]); - $query[0][25] = <<EOF; - INSERT INTO my_t VALUES (25,'-4.7','-4.7',-5,-5,-5,-5,-5,-4.70,0000.00,-4.7, - -4.7,0,00000,0,0,0,00000,00000000000000,'0000-00-00', - '00:00:00','0000-00-00 00:00:00','-4.70','-4.70', - '-4.70','-4.70','','three') -EOF - chop($query[0][25]); - $query[0][26] = <<EOF; - INSERT INTO my_t VALUES (26,'+0.09','+0.09',0,0,0,0,0,+0.09,0000.00,0.1,0.1, - 0,00000,0,0,0,00000,00000000000000,'0000-00-00', - '00:09:00','0000-00-00 00:00:00','+0.09','+0.09', - '+0.09','+0.09','','') -EOF - chop($query[0][26]); - $query[0][27] = <<EOF; - INSERT INTO my_t VALUES (27,'1','1',1,1,1,1,1,1.00,0001.00,1.0,1.0,1,00001, - 1,1,1,00001,00000000000000,'2000-00-01','00:00:01', - '0000-00-00 00:00:01','1','1','1','1','one','one') -EOF - chop($query[0][27]); - $query[0][28] = <<EOF; - INSERT INTO my_t VALUES (28,'-1','-1',-1,-1,-1,-1,-1,-1.00,0000.00,-1.0,-1.0, - 0,00000,0,0,18446744073709551615,00000, - 00000000000000,'0000-00-00','00:00:00', - '0000-00-00 00:00:00','-1','-1','-1','-1','', - 'one,two,three') -EOF - chop($query[0][28]); - $query[0][29] = <<EOF; - INSERT INTO my_t VALUES (29,'','',0,0,0,0,0,0.00,0000.00,0.0,0.0,0,00000,0,0, - 0,00000,00000000000000,'0000-00-00','00:00:00', - '0000-00-00 00:00:00','','','','','','') -EOF - chop($query[0][29]); - $query[1][0] = "CREATE TABLE my_t (str char(64))"; - $query[1][1] = "INSERT INTO my_t VALUES ('5.5')"; - $query[1][2] = "INSERT INTO my_t VALUES ('6.8')"; - $query[2][0] = "CREATE TABLE my_t (str char(64))"; - $query[2][1] = <<EOF; - INSERT INTO my_t VALUES - ('9999999999993242342442323423443534529999.02235000054213') -EOF - chop($query[2][1]); - $query[3][0] = "CREATE TABLE my_t (str char(64))"; - $query[3][1] = <<EOF; - INSERT INTO my_t VALUES - ('8494357934579347593475349579347593845948793454350349543348736453') -EOF - chop($query[3][1]); - $query[4][0] = "CREATE TABLE my_t (d double(20,10))"; - $query[4][1] = "INSERT INTO my_t VALUES (10.0000000000)"; - $query[4][2] = "INSERT INTO my_t VALUES (-10.0000000000)"; - $query[5][0] = "CREATE TABLE my_t (d double(20,10))"; - $query[5][1] = "INSERT INTO my_t VALUES (50000.0000000000)"; - $query[6][0] = "CREATE TABLE my_t (d double(20,10))"; - $query[6][1] = "INSERT INTO my_t VALUES (5000000.0000000000)"; - $query[7][0] = "CREATE TABLE my_t (d double(20,10))"; - $query[7][1] = "INSERT INTO my_t VALUES (500000000.0000000000)"; - $query[8][0] = "CREATE TABLE my_t (d double(20,10))"; - $query[8][1] = "INSERT INTO my_t VALUES (50000000000.0000000000)"; - $query[8][2] = "INSERT INTO my_t VALUES (NULL)"; - $query[9][0] = "CREATE TABLE my_t (d double(60,10))"; - $query[9][1] = "INSERT INTO my_t VALUES (93850983054983462912.0000000000)"; - $query[9][2] = "INSERT INTO my_t VALUES (93850983.3495762944)"; - $query[9][3] = <<EOF; - INSERT INTO my_t VALUES (938509832438723448371221493568778534912.0000000000) -EOF - chop($query[9][3]); - $query[10][0] = "CREATE TABLE my_t (i int(11))"; - $query[10][1] = "INSERT INTO my_t VALUES (-100)"; - $query[10][2] = "INSERT INTO my_t VALUES (-200)"; - $query[11][0] = "CREATE TABLE my_t (s char(64))"; - $query[11][1] = "INSERT INTO my_t VALUES ('100.')"; - $query[12][0] = "CREATE TABLE my_t (s char(64))"; - $query[12][1] = "INSERT INTO my_t VALUES ('1e+50')"; - $query[13][0] = "CREATE TABLE my_t (s char(64))"; - $query[13][1] = "INSERT INTO my_t VALUES ('1E+50u')"; - $query[14][0] = "CREATE TABLE my_t (s char(64))"; - $query[14][1] = "INSERT INTO my_t VALUES ('1EU50')"; - $query[15][0] = "CREATE TABLE my_t (s char(64))"; - $query[15][1] = "INSERT INTO my_t VALUES ('123.000')"; - $query[15][2] = "INSERT INTO my_t VALUES ('123.000abc')"; - $query[16][0] = "CREATE TABLE my_t (s char(128))"; - $query[16][1] = <<EOF; - INSERT INTO my_t VALUES - ('-999999999999999999999999999999999999999999999999999999999999999999999999') -EOF - chop($query[16][1]); - $query[17][0] = "CREATE TABLE my_t (s char(128))"; - $query[17][1] = "INSERT INTO my_t VALUES ('-9999999999999999')"; - $query[18][0] = "CREATE TABLE my_t (s char(128))"; - $query[18][1] = "INSERT INTO my_t VALUES ('28446744073709551615001')"; - $query[18][2] = "INSERT INTO my_t VALUES ('184467440737095516150000000')"; - $query[19][0] = "CREATE TABLE my_t (s char(128))"; - $query[19][1] = "INSERT INTO my_t VALUES ('18446744073709551615')"; - $query[20][0] = "CREATE TABLE my_t (s char(128))"; - $query[20][1] = "INSERT INTO my_t VALUES ('18446744073709551616')"; - $query[21][0] = "CREATE TABLE my_t (s char(64))"; - $query[21][1] = "INSERT INTO my_t VALUES ('00740')"; - $query[21][2] = "INSERT INTO my_t VALUES ('00740.')"; - $query[22][0] = "CREATE TABLE my_t (s char(128))"; - $query[22][1] = "INSERT INTO my_t VALUES ('-18446744073709551615')"; - $query[23][0] = "CREATE TABLE my_t (s char(32))"; - $query[23][1] = "INSERT INTO my_t VALUES ('740')"; - $query[23][2] = "INSERT INTO my_t VALUES ('12345')"; - $query[23][3] = "INSERT INTO my_t VALUES ('12345')"; - $query[24][0] = "CREATE TABLE my_t (s char(32))"; - $query[24][1] = "INSERT INTO my_t VALUES ('00740')"; - $query[24][2] = "INSERT INTO my_t VALUES ('00730')"; - $query[24][3] = "INSERT INTO my_t VALUES ('00720')"; - $query[24][4] = "INSERT INTO my_t VALUES ('12345.02')"; - $query[25][0] = "CREATE TABLE my_t (i bigint(20) unsigned)"; - $query[25][1] = "INSERT INTO my_t VALUES (3000)"; - $query[25][2] = "INSERT INTO my_t VALUES (NULL)"; - $query[25][3] = "INSERT INTO my_t VALUES (900000000003)"; - $query[25][4] = "INSERT INTO my_t VALUES (90)"; - $query[26][0] = "CREATE TABLE my_t (i int(11))"; - $query[26][1] = "INSERT INTO my_t VALUES (NULL)"; - $query[27][0] = "CREATE TABLE my_t (d date)"; - $query[27][1] = "INSERT INTO my_t VALUES ('1999-05-01')"; - $query[28][0] = "CREATE TABLE my_t (y year(4))"; - $query[28][1] = "INSERT INTO my_t VALUES (1999)"; - $query[29][0] = "CREATE TABLE my_t (s char(128))"; - $query[29][1] = "INSERT INTO my_t VALUES ('453453444451.7976')"; - $query[30][0] = "CREATE TABLE my_t (s char(128))"; - $query[30][1] = "INSERT INTO my_t VALUES('')"; - $query[31][0] = "CREATE TABLE my_t (s char(128))"; - $query[31][1] = "INSERT INTO my_t VALUES(' ')"; - return $query; -} diff --git a/mysql-test/mysql-test-run-shell.sh b/mysql-test/mysql-test-run-shell.sh deleted file mode 100644 index ea8ce1b76d4..00000000000 --- a/mysql-test/mysql-test-run-shell.sh +++ /dev/null @@ -1,2338 +0,0 @@ -#!/bin/sh -# mysql-test-run - originally written by Matt Wagner <matt@mysql.com> -# modified by Sasha Pachev <sasha@mysql.com> -# Slightly updated by Monty -# Cleaned up again by Matt -# Fixed by Sergei -# List of failed cases (--force) backported from 4.1 by Joerg -# :-) - -#echo "##################################################"; -#echo "This script is deprecated and will soon be removed"; -#echo "Use mysql-test-run.pl instead"; -#echo "##################################################"; -#echo - -#++ -# Access Definitions -#-- -DB=test -DBPASSWD="" -VERBOSE="" -USE_MANAGER=0 -MY_TZ=GMT-3 -TZ=$MY_TZ; export TZ # for UNIX_TIMESTAMP tests to work -LOCAL_SOCKET=@MYSQL_UNIX_ADDR@ - -if [ -z "$MYSQL_TCP_PORT" ]; then - MYSQL_TCP_PORT=@MYSQL_TCP_PORT@ - if [ @MYSQL_TCP_PORT_DEFAULT@ -eq 0 ]; then - ESP=`getent services mysql/tcp` - if [ $? -eq 0 ]; then - MYSQL_TCP_PORT=`echo "$ESP"|sed -e's-^[a-z]*[ ]*\([0-9]*\)/[a-z]*$-\1-g'` - fi - fi -fi - -umask 022 - -# For query_cache test -case `uname` in - SCO_SV | UnixWare | OpenUNIX ) - # do nothing (Causes strange behavior) - ;; - QNX) - # do nothing (avoid error message) - ;; - * ) - ulimit -n 1024 - ;; -esac - -#++ -# Program Definitions -#-- - -LC_COLLATE=C -export LC_COLLATE -PATH=/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11:$PATH -MASTER_40_ARGS="--rpl-recovery-rank=1 --init-rpl-role=master" - -# Standard functions - -which () -{ - IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' - for file - do - for dir in $PATH - do - if test -f $dir/$file - then - echo "$dir/$file" - continue 2 - fi - done - echo "Fatal error: Cannot find program $file in $PATH" 1>&2 - exit 1 - done - IFS="$save_ifs" - exit 0 -} - - -sleep_until_file_deleted () -{ - pid=$1; - file=$2 - loop=$SLEEP_TIME_FOR_DELETE - while (test $loop -gt 0) - do - if [ ! -r $file ] - then - if test $pid != "0" - then - wait_for_pid $pid - fi - return - fi - sleep 1 - loop=`expr $loop - 1` - done -} - -sleep_until_file_created () -{ - file=$1 - loop=$2 - org_time=$2 - while (test $loop -gt 0) - do - if [ -r $file ] - then - return 0 - fi - sleep 1 - loop=`expr $loop - 1` - done - echo "ERROR: $file was not created in $org_time seconds; Aborting" - exit 1; -} - -# For the future - -wait_for_pid() -{ - pid=$1 - #$WAIT_PID pid $SLEEP_TIME_FOR_DELETE -} - -# Check that valgrind is installed -find_valgrind() -{ - FIND_VALGRIND=`which valgrind` # this will print an error if not found - # Give good warning to the user and stop - if [ -z "$FIND_VALGRIND" ] ; then - $ECHO "You need to have the 'valgrind' program in your PATH to run mysql-test-run with option --valgrind. Valgrind's home page is http://valgrind.kde.org ." - exit 1 - fi - # >=2.1.2 requires the --tool option, some versions write to stdout, some to stderr - valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && FIND_VALGRIND="$FIND_VALGRIND --tool=memcheck" - FIND_VALGRIND="$FIND_VALGRIND --alignment=8 --leak-check=yes --num-callers=16 --suppressions=$MYSQL_TEST_DIR/valgrind.supp" -} - -# No paths below as we can't be sure where the program is! - -SED=sed - -BASENAME=`which basename` -if test $? != 0; then exit 1; fi -DIFF=`which diff | $SED q` -if test $? != 0; then exit 1; fi -CAT=cat -CUT=cut -HEAD=head -TAIL=tail -ECHO=echo # use internal echo if possible -EXPR=expr # use internal if possible -FIND=find -GREP=grep -if test $? != 0; then exit 1; fi -PRINTF=printf -RM=rm -if test $? != 0; then exit 1; fi -TR=tr -XARGS=`which xargs` -if test $? != 0; then exit 1; fi -SORT=sort - -# Are we using a source or a binary distribution? - -testdir=@testdir@ -if [ -d bin/mysqld ] && [ -d mysql-test ] ; then - cd mysql-test -else - if [ -d $testdir/mysql-test ] ; then - cd $testdir - fi -fi - -if [ ! -f ./mysql-test-run ] ; then - $ECHO "Can't find the location for the mysql-test-run script" - - $ECHO "Go to to the mysql-test directory and execute the script as follows:" - $ECHO "./mysql-test-run." - exit 1 -fi - -#++ -# Misc. Definitions -#-- - -# BASEDIR is always above mysql-test directory ... -MYSQL_TEST_DIR=`pwd` -cd .. - -if [ -d ./sql ] ; then - SOURCE_DIST=1 -else - BINARY_DIST=1 - - # ... one level for tar.gz, two levels for a RPM installation - if [ ! -f ./bin/mysql_upgrade ] ; then - # Has to be RPM installation - cd .. - fi -fi -BASEDIR=`pwd` - -cd $MYSQL_TEST_DIR -MYSQL_TEST_WINDIR=$MYSQL_TEST_DIR -MYSQLTEST_VARDIR=$MYSQL_TEST_DIR/var -export MYSQL_TEST_DIR MYSQL_TEST_WINDIR MYSQLTEST_VARDIR -STD_DATA=$MYSQL_TEST_DIR/std_data -hostname=`hostname` # Installed in the mysql privilege table - -MANAGER_QUIET_OPT="-q" -TESTDIR="$MYSQL_TEST_DIR/t" -TESTSUFFIX=test -TOT_SKIP=0 -TOT_PASS=0 -TOT_FAIL=0 -TOT_TEST=0 -GOT_WARNINGS=0 -USERT=0 -SYST=0 -REALT=0 -FAST_START="" -MYSQL_TMP_DIR=$MYSQL_TEST_DIR/var/tmp -export MYSQL_TMP_DIR - -# Use a relative path for where the slave will find the dumps -# generated by "LOAD DATA" on the master. The path is relative -# since it must have fixed length to test logging -# i.e otherwise the output from "SHOW MASTER STATUS" will vary -# with the strlen() of MYSQL_TEST_DIR -SLAVE_LOAD_TMPDIR=../tmp - -RES_SPACE=" " -MYSQLD_SRC_DIRS="strings mysys include extra regex myisam \ - myisammrg heap sql" -MY_LOG_DIR="$MYSQL_TEST_DIR/var/log" -# -# Set LD_LIBRARY_PATH if we are using shared libraries -# -LD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$BASEDIR/libmysql_r/.libs:$BASEDIR/zlib/.libs:$LD_LIBRARY_PATH" -DYLD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$BASEDIR/libmysql_r/.libs:$BASEDIR/zlib/.libs:$DYLD_LIBRARY_PATH" -export LD_LIBRARY_PATH DYLD_LIBRARY_PATH - -# -# Allow anyone in the group to see the generated database files -# -UMASK=0660 -UMASK_DIR=0770 -export UMASK UMASK_DIR - -MASTER_RUNNING=0 -MASTER1_RUNNING=0 -MASTER_MYHOST=127.0.0.1 -MASTER_MYPORT=9306 -SLAVE_RUNNING=0 -SLAVE_MYHOST=127.0.0.1 -SLAVE_MYPORT=9308 # leave room for 2 masters for cluster tests -MYSQL_MANAGER_LOG=$MYSQL_TEST_DIR/var/log/manager.log -NDBCLUSTER_PORT=9350 -NDBCLUSTER_PORT_SLAVE=9358 - -# -# 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. -# -if [ -n "$MTR_BUILD_THREAD" ] ; then - MASTER_MYPORT=`expr $MTR_BUILD_THREAD '*' 10 + 10000` - SLAVE_MYPORT=`expr $MASTER_MYPORT + 3` - NDBCLUSTER_PORT=`expr $MASTER_MYPORT + 6` - NDBCLUSTER_PORT_SLAVE=`expr $MASTER_MYPORT + 7` - - echo "Using MTR_BUILD_THREAD = $MTR_BUILD_THREAD" - echo "Using MASTER_MYPORT = $MASTER_MYPORT" - echo "Using SLAVE_MYPORT = $SLAVE_MYPORT" - echo "Using NDBCLUSTER_PORT = $NDBCLUSTER_PORT" - echo "Using NDBCLUSTER_PORT_SLAVE = $NDBCLUSTER_PORT_SLAVE" -fi - -NO_SLAVE=0 -USER_TEST= -FAILED_CASES= - -EXTRA_MASTER_OPT="" -EXTRA_MYSQL_TEST_OPT="" -EXTRA_MYSQLCHECK_OPT="" -EXTRA_MYSQLDUMP_OPT="" -EXTRA_MYSQLSLAP_OPT="" -EXTRA_MYSQLSHOW_OPT="" -EXTRA_MYSQLBINLOG_OPT="" -USE_RUNNING_SERVER=0 -USE_NDBCLUSTER=@USE_NDBCLUSTER@ -USE_NDBCLUSTER_SLAVE=@USE_NDBCLUSTER@ -USE_NDBCLUSTER_ALL=0 -USE_NDBCLUSTER_ONLY=0 -USE_RUNNING_NDBCLUSTER="" -USE_RUNNING_NDBCLUSTER_SLAVE="" -NDB_EXTRA_TEST=0 -NDB_VERBOSE=0 -NDBCLUSTER_EXTRA_OPTS="" -USE_PURIFY="" -PURIFY_LOGS="" -DO_GCOV="" -DO_GDB="" -MANUAL_GDB="" -DO_DDD="" -DO_CLIENT_GDB="" -SLEEP_TIME_AFTER_RESTART=1 -SLEEP_TIME_FOR_DELETE=10 -SLEEP_TIME_FOR_FIRST_MASTER=400 # Enough time to create innodb tables -SLEEP_TIME_FOR_SECOND_MASTER=400 -SLEEP_TIME_FOR_FIRST_SLAVE=400 -SLEEP_TIME_FOR_SECOND_SLAVE=300 -CHARACTER_SET=latin1 -DBUSER="" -START_WAIT_TIMEOUT=10 -STOP_WAIT_TIMEOUT=10 -MYSQL_TEST_SSL_OPTS="" -USE_TIMER="" -USE_EMBEDDED_SERVER="" -TEST_MODE="" - -NDB_MGM_EXTRA_OPTS= -NDB_MGMD_EXTRA_OPTS= -NDBD_EXTRA_OPTS= -MASTER_MYSQLDBINLOG=1 -SLAVE_MYSQLDBINLOG=1 - -DO_STRESS="" -STRESS_SUITE="main" -STRESS_MODE="random" -STRESS_THREADS=5 -STRESS_TEST_COUNT="" -STRESS_LOOP_COUNT="" -STRESS_TEST_DURATION="" -STRESS_INIT_FILE="" -STRESS_TEST_FILE="" -STRESS_TEST="" - -$ECHO "Logging: $0 $*" # To ensure we see all arguments in the output, for the test analysis tool - -while test $# -gt 0; do - case "$1" in - --embedded-server) - USE_EMBEDDED_SERVER=1 - USE_MANAGER=0 NO_SLAVE=1 - USE_RUNNING_SERVER=0 - USE_NDBCLUSTER="" - USE_NDBCLUSTER_SLAVE="" - TEST_MODE="$TEST_MODE embedded" ;; - --purify) - USE_PURIFY=1 - USE_MANAGER=0 - USE_RUNNING_SERVER=0 - TEST_MODE="$TEST_MODE purify" ;; - --user=*) DBUSER=`$ECHO "$1" | $SED -e "s;--user=;;"` ;; - --force) FORCE=1 ;; - --timer) USE_TIMER=1 ;; - --old-master) MASTER_40_ARGS="";; - --master-binary=*) - MASTER_MYSQLD=`$ECHO "$1" | $SED -e "s;--master-binary=;;"` ;; - --slave-binary=*) - SLAVE_MYSQLD=`$ECHO "$1" | $SED -e "s;--slave-binary=;;"` ;; - --local) USE_RUNNING_SERVER=0 ;; - --extern) USE_RUNNING_SERVER=1 ;; - --with-ndbcluster) - USE_NDBCLUSTER="--ndbcluster" ;; - --with-ndbcluster-slave) - USE_NDBCLUSTER_SLAVE="--ndbcluster" ;; - --with-ndbcluster-all) - USE_NDBCLUSTER="--ndbcluster" - USE_NDBCLUSTER_SLAVE="--ndbcluster" - USE_NDBCLUSTER_ALL=1 ;; - --with-ndbcluster-only) - USE_NDBCLUSTER="--ndbcluster" - USE_NDBCLUSTER_SLAVE="--ndbcluster" - USE_NDBCLUSTER_ONLY=1 ;; - --ndb-connectstring=*) - USE_NDBCLUSTER="--ndbcluster" ; - USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndb-connectstring=;;"` ;; - --ndb-connectstring-slave=*) - USE_NDBCLUSTER_SLAVE="--ndbcluster" ; - USE_RUNNING_NDBCLUSTER_SLAVE=`$ECHO "$1" | $SED -e "s;--ndb-connectstring-slave=;;"` ;; - --ndb-extra-test) - NDBCLUSTER_EXTRA_OPTS=" " - NDB_EXTRA_TEST=1 ; - ;; - --ndb-verbose) - NDB_VERBOSE=2 ;; - --ndb_mgm-extra-opts=*) - NDB_MGM_EXTRA_OPTS=`$ECHO "$1" | $SED -e "s;--ndb_mgm-extra-opts=;;"` ;; - --ndb_mgmd-extra-opts=*) - NDB_MGMD_EXTRA_OPTS=`$ECHO "$1" | $SED -e "s;--ndb_mgmd-extra-opts=;;"` ;; - --ndbd-extra-opts=*) - NDBD_EXTRA_OPTS=`$ECHO "$1" | $SED -e "s;--ndbd-extra-opts=;;"` ;; - --tmpdir=*) MYSQL_TMP_DIR=`$ECHO "$1" | $SED -e "s;--tmpdir=;;"` ;; - --local-master) - MASTER_MYPORT=3306; - EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT --host=127.0.0.1 \ - --port=$MYSQL_MYPORT" - LOCAL_MASTER=1 ;; - --master_port=*) MASTER_MYPORT=`$ECHO "$1" | $SED -e "s;--master_port=;;"` ;; - --slave_port=*) SLAVE_MYPORT=`$ECHO "$1" | $SED -e "s;--slave_port=;;"` ;; - --ndbcluster_port=*) NDBCLUSTER_PORT=`$ECHO "$1" | $SED -e "s;--ndbcluster_port=;;"` ;; - --ndbcluster-port=*) NDBCLUSTER_PORT=`$ECHO "$1" | $SED -e "s;--ndbcluster-port=;;"` ;; - --ndbcluster-port-slave=*) NDBCLUSTER_PORT_SLAVE=`$ECHO "$1" | $SED -e "s;--ndbcluster-port-slave=;;"` ;; - --with-openssl) - EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \ - --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem \ - --ssl-cert=$MYSQL_TEST_DIR/std_data/server-cert.pem \ - --ssl-key=$MYSQL_TEST_DIR/std_data/server-key.pem" - EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT \ - --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem \ - --ssl-cert=$MYSQL_TEST_DIR/std_data/server-cert.pem \ - --ssl-key=$MYSQL_TEST_DIR/std_data/server-key.pem" - MYSQL_TEST_SSL_OPTS="--ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem \ - --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem \ - --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem" ;; - --start-and-exit) - START_AND_EXIT=1 - ;; - --socket=*) LOCAL_SOCKET=`$ECHO "$1" | $SED -e "s;--socket=;;"` ;; - --skip-rpl) NO_SLAVE=1 ;; - --skip-test=*) SKIP_TEST=`$ECHO "$1" | $SED -e "s;--skip-test=;;"`;; - --do-test=*) DO_TEST=`$ECHO "$1" | $SED -e "s;--do-test=;;"`;; - --start-from=* ) START_FROM=`$ECHO "$1" | $SED -e "s;--start-from=;;"` ;; - --warnings | --log-warnings) - EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --log-warnings" - EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --log-warnings" - ;; - --wait-timeout=*) - START_WAIT_TIMEOUT=`$ECHO "$1" | $SED -e "s;--wait-timeout=;;"` - STOP_WAIT_TIMEOUT=$START_WAIT_TIMEOUT;; - --record) - RECORD=1; - EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;; - --small-bench) - DO_SMALL_BENCH=1 - DO_BENCH=1 - NO_SLAVE=1 - ;; - --bench) - DO_BENCH=1 - NO_SLAVE=1 - ;; - --stress) - DO_STRESS=1 - NO_SLAVE=1 - SKIP_SLAVE=1 - ;; - --stress-suite=*) - STRESS_SUITE=`$ECHO "$1" | $SED -e "s;--stress-suite=;;"` - ;; - --stress-threads=*) - STRESS_THREADS=`$ECHO "$1" | $SED -e "s;--stress-threads=;;"` - ;; - --stress-test-file=*) - STRESS_TEST_FILE=`$ECHO "$1" | $SED -e "s;--stress-test-file=;;"` - ;; - --stress-init-file=*) - STRESS_INIT_FILE=`$ECHO "$1" | $SED -e "s;--stress-init-file=;;"` - ;; - --stress-mode=*) - STRESS_MODE=`$ECHO "$1" | $SED -e "s;--stress-mode=;;"` - ;; - --stress-loop-count=*) - STRESS_LOOP_COUNT=`$ECHO "$1" | $SED -e "s;--stress-loop-count=;;"` - ;; - --stress-test-count=*) - STRESS_TEST_COUNT=`$ECHO "$1" | $SED -e "s;--stress-test-count=;;"` - ;; - --stress-test-duration=*) - STRESS_TEST_DURATION=`$ECHO "$1" | $SED -e "s;--stress-test-duration=;;"` - ;; - --big*) # Actually --big-test - EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;; - --compress) - EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;; - --sleep=*) - EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" - SLEEP_TIME_AFTER_RESTART=`$ECHO "$1" | $SED -e "s;--sleep=;;"` - ;; - --ps-protocol) - TEST_MODE="$TEST_MODE ps-protocol" EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;; - --user-test=*) - USER_TEST=`$ECHO "$1" | $SED -e "s;--user-test=;;"` - ;; - --mysqld=*) - TMP=`$ECHO "$1" | $SED -e "s;--mysqld=;;"` - EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT $TMP" - EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT $TMP" - ;; - --gcov ) - if [ x$BINARY_DIST = x1 ] ; then - $ECHO "Cannot do coverage test without the source - please use source dist" - exit 1 - fi - DO_GCOV=1 - GCOV=`which gcov` - ;; - --gprof ) - DO_GPROF=1 - ;; - --gdb ) - START_WAIT_TIMEOUT=300 - STOP_WAIT_TIMEOUT=300 - if [ x$BINARY_DIST = x1 ] ; then - $ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --gdb option" - fi - DO_GDB=1 - EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb" - EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb" - # This needs to be checked properly - # USE_MANAGER=1 - USE_RUNNING_SERVER=0 - ;; - --client-gdb ) - if [ x$BINARY_DIST = x1 ] ; then - $ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --client-gdb option" - fi - DO_CLIENT_GDB=1 - EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb" - EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb" - ;; - --manual-gdb ) - DO_GDB=1 - MANUAL_GDB=1 - USE_RUNNING_SERVER=0 - EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb" - EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb" - ;; - --ddd ) - if [ x$BINARY_DIST = x1 ] ; then - $ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --ddd option" - fi - DO_DDD=1 - USE_RUNNING_SERVER=0 - EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb" - EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb" - ;; - --valgrind | --valgrind-all) - find_valgrind; - VALGRIND=$FIND_VALGRIND - EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc" - EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc" - SLEEP_TIME_AFTER_RESTART=10 - SLEEP_TIME_FOR_DELETE=60 - USE_RUNNING_SERVER=0 - if test "$1" = "--valgrind-all" - then - VALGRIND="$VALGRIND -v --show-reachable=yes" - fi - ;; - --valgrind-options=*) - TMP=`$ECHO "$1" | $SED -e "s;--valgrind-options=;;"` - VALGRIND="$VALGRIND $TMP" - ;; - --skip-ndbcluster-slave | --skip-ndb-slave) - USE_NDBCLUSTER_SLAVE="" - EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-ndbcluster" - ;; - --valgrind-mysqltest | --valgrind-mysqltest-all) - find_valgrind; - VALGRIND_MYSQLTEST=$FIND_VALGRIND - if test "$1" = "--valgrind-mysqltest-all" - then - VALGRIND_MYSQLTEST="$VALGRIND_MYSQLTEST -v --show-reachable=yes" - fi - ;; - --skip-ndbcluster | --skip-ndb) - USE_NDBCLUSTER="" - USE_NDBCLUSTER_SLAVE="" - EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-ndbcluster" - EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-ndbcluster" - ;; - --skip-master-binlog) MASTER_MYSQLDBINLOG=0 ;; - --skip-slave-binlog) SLAVE_MYSQLDBINLOG=0 ;; - --skip-*) - EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT $1" - EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT $1" - ;; - --strace-client ) - STRACE_CLIENT=1 - ;; - --debug) - EXTRA_MASTER_MYSQLD_TRACE=" \ - --debug=d:t:i:A,$MYSQL_TEST_DIR/var/log/master.trace" - EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT \ - --debug=d:t:i:A,$MYSQL_TEST_DIR/var/log/slave.trace" - EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT \ - --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqltest.trace" - EXTRA_MYSQLCHECK_OPT="$EXTRA_MYSQLCHECK_OPT \ - --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlcheck.trace" - EXTRA_MYSQLDUMP_OPT="$EXTRA_MYSQLDUMP_OPT \ - --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqldump.trace" - EXTRA_MYSQLSLAP_OPT="$EXTRA_MYSQLSLAP_OPT \ - --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlslap.trace" - EXTRA_MYSQLSHOW_OPT="$EXTRA_MYSQLSHOW_OPT \ - --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlshow.trace" - EXTRA_MYSQLBINLOG_OPT="$EXTRA_MYSQLBINLOG_OPT \ - --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlbinlog.trace" - EXTRA_MYSQL_CLIENT_TEST_OPT="--debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysql_client_test.trace" - ;; - --fast) - FAST_START=1 - ;; - --use-old-data) - USE_OLD_DATA=1 - ;; - --comment=*) - TMP=`$ECHO "$1" | $SED -e "s;--comment=;;"` - echo - echo '############################################' - echo "# $TMP" - echo '############################################' - ;; - -- ) shift; break ;; - --* ) $ECHO "Unrecognized option: $1"; exit 1 ;; - * ) break ;; - esac - shift -done - -if [ -z "$TEST_MODE" ] ; then - TEST_MODE="default" -else - # Remove the leading space if any - TEST_MODE=`echo $TEST_MODE | sed 's/^ *//'` -fi - -# -# Skip tests that doesn't work with shell version -# -SKIP_TEST="$SKIP_TEST bootstrap" - -#++ -# mysqld Environment Parameters -#-- - -MYRUN_DIR=$MYSQL_TEST_DIR/var/run - -MASTER_MYDDIR="$MYSQL_TEST_DIR/var/master-data" -MASTER_MYSOCK="$MYSQL_TMP_DIR/master.sock" -MASTER_MYSOCK1=$MYSQL_MYSOCK"1" -MASTER_MYPID="$MYRUN_DIR/master.pid" -MASTER_MYLOG="$MYSQL_TEST_DIR/var/log/master.log" -MASTER_MYERR="$MYSQL_TEST_DIR/var/log/master.err" - -SLAVE_MYDDIR="$MYSQL_TEST_DIR/var/slave-data" -SLAVE_MYSOCK="$MYSQL_TMP_DIR/slave.sock" -SLAVE_MYPID="$MYRUN_DIR/slave.pid" -SLAVE_MYLOG="$MYSQL_TEST_DIR/var/log/slave.log" -SLAVE_MYERR="$MYSQL_TEST_DIR/var/log/slave.err" - -CURRENT_TEST="$MYSQL_TEST_DIR/var/log/current_test" -SMALL_SERVER="--key_buffer_size=1M --sort_buffer=256K --max_heap_table_size=1M" - -export MASTER_MYHOST MASTER_MYPORT SLAVE_MYHOST SLAVE_MYPORT MYSQL_TCP_PORT MASTER_MYSOCK MASTER_MYSOCK1 - -NDBCLUSTER_OPTS="--port=$NDBCLUSTER_PORT --data-dir=$MYSQL_TEST_DIR/var --ndb_mgm-extra-opts=$NDB_MGM_EXTRA_OPTS --ndb_mgmd-extra-opts=$NDB_MGMD_EXTRA_OPTS --ndbd-extra-opts=$NDBD_EXTRA_OPTS" -NDBCLUSTER_OPTS_SLAVE="--port=$NDBCLUSTER_PORT_SLAVE --data-dir=$MYSQL_TEST_DIR/var" -if [ -n "$USE_NDBCLUSTER_SLAVE" ] ; then - USE_NDBCLUSTER_SLAVE="$USE_NDBCLUSTER_SLAVE --ndb-connectstring=localhost:$NDBCLUSTER_PORT_SLAVE --ndb-extra-logging" -fi -NDB_BACKUP_DIR=$MYSQL_TEST_DIR/var/ndbcluster-$NDBCLUSTER_PORT -NDB_TOOLS_OUTPUT=$MYSQL_TEST_DIR/var/log/ndb_tools.log - -if [ x$SOURCE_DIST = x1 ] ; then - MY_BASEDIR=$MYSQL_TEST_DIR -else - MY_BASEDIR=$BASEDIR -fi - -# Create the directories - -# This should be fixed to be not be dependent on the contence of MYSQL_TMP_DIR -# or MYRUN_DIR -# (mkdir -p is not portable) -[ -d $MYSQL_TEST_DIR/var ] || mkdir $MYSQL_TEST_DIR/var -[ -d $MYSQL_TEST_DIR/var/tmp ] || mkdir $MYSQL_TEST_DIR/var/tmp -[ -d $MYSQL_TEST_DIR/var/run ] || mkdir $MYSQL_TEST_DIR/var/run -[ -d $MYSQL_TEST_DIR/var/log ] || mkdir $MYSQL_TEST_DIR/var/log - -# Use 'test', not '[' as the shell builtin might not have '-L -if test ! -L "$MYSQL_TEST_DIR/var/std_data_ln" ; then - ln -s $MYSQL_TEST_DIR/std_data/ $MYSQL_TEST_DIR/var/std_data_ln -fi - -if test ${COLUMNS:-0} -lt 80 ; then COLUMNS=80 ; fi -E=`$EXPR $COLUMNS - 8` -DASH72=`$ECHO '-------------------------------------------------------'|$CUT -c 1-$E` - -# on source dist, we pick up freshly build executables -# on binary, use what is installed -if [ x$SOURCE_DIST = x1 ] ; then - if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then - if [ -f "$BASEDIR/libmysqld/examples/mysqltest_embedded" ] ; then - MYSQL_TEST="$BASEDIR/libmysqld/examples/mysqltest_embedded" - else - echo "Fatal error: Cannot find embedded server 'mysqltest_embedded'" 1>&2 - exit 1 - fi - MYSQL_CLIENT_TEST="$BASEDIR/libmysqld/examples/mysql_client_test_embedded" - else - MYSQLD="$BASEDIR/sql/mysqld" - if [ -n "$VALGRIND" ] ; then - MYSQLD="$VALGRIND $MYSQLD" - fi - if [ -f "$BASEDIR/client/.libs/lt-mysqltest" ] ; then - MYSQL_TEST="$BASEDIR/client/.libs/lt-mysqltest" - elif [ -f "$BASEDIR/client/.libs/mysqltest" ] ; then - MYSQL_TEST="$BASEDIR/client/.libs/mysqltest" - else - MYSQL_TEST="$BASEDIR/client/mysqltest" - fi - MYSQL_CLIENT_TEST="$BASEDIR/tests/mysql_client_test" - fi - if [ -f "$BASEDIR/client/.libs/mysqlcheck" ] ; then - MYSQL_CHECK="$BASEDIR/client/.libs/mysqlcheck" - else - MYSQL_CHECK="$BASEDIR/client/mysqlcheck" - fi - if [ -f "$BASEDIR/client/.libs/mysqldump" ] ; then - MYSQL_DUMP="$BASEDIR/client/.libs/mysqldump" - else - MYSQL_DUMP="$BASEDIR/client/mysqldump" - fi - if [ -f "$BASEDIR/client/.libs/mysqlslap" ] ; then - MYSQL_SLAP="$BASEDIR/client/.libs/mysqlslap" - else - MYSQL_SLAP="$BASEDIR/client/mysqlslap" - fi - if [ -f "$BASEDIR/client/.libs/mysqlimport" ] ; then - MYSQL_IMPORT="$BASEDIR/client/.libs/mysqlimport" - else - MYSQL_IMPORT="$BASEDIR/client/mysqlimport" - fi - if [ -f "$BASEDIR/client/.libs/mysqlshow" ] ; then - MYSQL_SHOW="$BASEDIR/client/.libs/mysqlshow" - else - MYSQL_SHOW="$BASEDIR/client/mysqlshow" - fi - if [ -f "$BASEDIR/client/.libs/mysqlbinlog" ] ; then - MYSQL_BINLOG="$BASEDIR/client/.libs/mysqlbinlog" - else - MYSQL_BINLOG="$BASEDIR/client/mysqlbinlog" - fi - if [ -n "$STRACE_CLIENT" ]; then - MYSQL_TEST="strace -o $MYSQL_TEST_DIR/var/log/mysqltest.strace $MYSQL_TEST" - fi - - CLIENT_BINDIR="$BASEDIR/client" - MYSQLADMIN="$CLIENT_BINDIR/mysqladmin" - WAIT_PID="$BASEDIR/extra/mysql_waitpid" - MYSQL_MY_PRINT_DEFAULTS="$BASEDIR/extra/my_print_defaults" - MYSQL="$CLIENT_BINDIR/mysql" - LANGUAGE="$BASEDIR/sql/share/english/" - CHARSETSDIR="$BASEDIR/sql/share/charsets" - INSTALL_DB="./install_test_db" - MYSQL_FIX_SYSTEM_TABLES="$BASEDIR/scripts/mysql_fix_privilege_tables" - NDB_TOOLS_DIR="$BASEDIR/storage/ndb/tools" - NDB_MGM="$BASEDIR/storage/ndb/src/mgmclient/ndb_mgm" - - if [ -n "$USE_PURIFY" ] ; then - PSUP="$MYSQL_TEST_DIR/suppress.purify" - PURIFYOPTIONS="-windows=no -log-file=%v.purifylog -append-logfile -add-suppression-files=$PSUP" - if [ -f "${MYSQL_TEST}-purify" ] ; then - MYSQL_TEST="${MYSQL_TEST}-purify" - PLOG="$MYSQL_TEST.purifylog" - if [ -f $PLOG ]; then - mv $PLOG $PLOG.$$ - fi - PURIFY_LOGS="$PLOG" - fi - if [ -f "${MYSQLD}-purify" ] ; then - MYSQLD="${MYSQLD}-purify" - PLOG="$MYSQLD.purifylog" - if [ -f $PLOG ]; then - mv $PLOG $PLOG.$$ - fi - PURIFY_LOGS="$PURIFY_LOGS $PLOG" - fi - fi - -else - - # We have a binary installation. Note that this can be both from - # unpacking a MySQL AB binary distribution (created using - # "scripts/make_binary_distribution", and from a "make install". - # Unfortunately the structure differs a bit, for a "make install" - # currently all binaries are in "bin", for a MySQL AB packaging - # some are in "tests". - - if test -x "$BASEDIR/libexec/mysqld" - then - MYSQLD="$VALGRIND $BASEDIR/libexec/mysqld" - elif test -x "$BASEDIR/bin/mysqld" - then - MYSQLD="$VALGRIND $BASEDIR/bin/mysqld" - elif test -x "$BASEDIR/sbin/mysqld" - then - MYSQLD="$VALGRIND $BASEDIR/sbin/mysqld" - else - $ECHO "Fatal error: Cannot find program mysqld in $BASEDIR/{libexec,bin,sbin}" 1>&2 - exit 1 - fi - CLIENT_BINDIR="$BASEDIR/bin" - if test -d "$BASEDIR/tests" - then - TESTS_BINDIR="$BASEDIR/tests" - else - TESTS_BINDIR="$BASEDIR/bin" - fi - MYSQL_TEST="$CLIENT_BINDIR/mysqltest" - MYSQL_CHECK="$CLIENT_BINDIR/mysqlcheck" - MYSQL_SLAP="$CLIENT_BINDIR/mysqlslap" - MYSQL_SHOW="$CLIENT_BINDIR/mysqlshow" - MYSQL_IMPORT="$CLIENT_BINDIR/mysqlimport" - MYSQL_BINLOG="$CLIENT_BINDIR/mysqlbinlog" - MYSQLADMIN="$CLIENT_BINDIR/mysqladmin" - WAIT_PID="$CLIENT_BINDIR/mysql_waitpid" - MYSQL_MY_PRINT_DEFAULTS="$CLIENT_BINDIR/my_print_defaults" - MYSQL="$CLIENT_BINDIR/mysql" - INSTALL_DB="./install_test_db --bin" - MYSQL_FIX_SYSTEM_TABLES="$CLIENT_BINDIR/mysql_fix_privilege_tables" - NDB_TOOLS_DIR="$CLIENT_BINDIR" - NDB_MGM="$CLIENT_BINDIR/ndb_mgm" - if test -d "$BASEDIR/share/mysql/english" - then - LANGUAGE="$BASEDIR/share/mysql/english/" - CHARSETSDIR="$BASEDIR/share/mysql/charsets" - else - LANGUAGE="$BASEDIR/share/english/" - CHARSETSDIR="$BASEDIR/share/charsets" - fi - if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then - if [ -f "$CLIENT_BINDIR/mysqltest_embedded" ] ; then - MYSQL_TEST="$CLIENT_BINDIR/mysqltest_embedded" - else - echo "Fatal error: Cannot find embedded server 'mysqltest_embedded'" 1>&2 - exit 1 - fi - if [ -d "$BASEDIR/tests/mysql_client_test_embedded" ] ; then - MYSQL_CLIENT_TEST="$TESTS_BINDIR/mysql_client_test_embedded" - else - MYSQL_CLIENT_TEST="$CLIENT_BINDIR/mysql_client_test_embedded" - fi - else - MYSQL_TEST="$CLIENT_BINDIR/mysqltest" - MYSQL_CLIENT_TEST="$CLIENT_BINDIR/mysql_client_test" - fi - if [ -f "$BASEDIR/client/.libs/mysqldump" ] ; then - MYSQL_DUMP="$BASEDIR/client/.libs/mysqldump" - elif [ -f "$BASEDIR/client/mysqldump" ] ; then - MYSQL_DUMP="$BASEDIR/client/mysqldump" - else - MYSQL_DUMP="$BASEDIR/bin/mysqldump" - fi -fi - -if [ -z "$MASTER_MYSQLD" ] -then -MASTER_MYSQLD=$MYSQLD -fi - -if [ -z "$SLAVE_MYSQLD" ] -then -SLAVE_MYSQLD=$MYSQLD -fi - -# If we should run all tests cases, we will use a local server for that - -if [ -z "$1" -a -z "$DO_STRESS" ] -then - USE_RUNNING_SERVER=0 -fi -if [ $USE_RUNNING_SERVER -eq 1 ] -then - MASTER_MYSOCK=$LOCAL_SOCKET; - DBUSER=${DBUSER:-test} -else - DBUSER=${DBUSER:-root} # We want to do FLUSH xxx commands -fi - -if [ -w / ] -then - # We are running as root; We need to add the --root argument - EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --user=root" - EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --user=root" -fi - -MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST --no-defaults --testcase --user=root --socket=$MASTER_MYSOCK --port=$MYSQL_TCP_PORT --silent $EXTRA_MYSQL_CLIENT_TEST_OPT" -# Need to pass additional arguments to MYSQL_CLIENT_TEST for embedded server -# -A marks each argument for passing to the function which initializes the -# embedded library -if [ "x$USE_EMBEDDED_SERVER" = "x1" ]; then - MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST -A --language=$LANGUAGE -A --datadir=$SLAVE_MYDDIR -A --character-sets-dir=$CHARSETSDIR" -fi -# Save path and name of mysqldump -MYSQL_DUMP_DIR="$MYSQL_DUMP" -export MYSQL_DUMP_DIR -MYSQL_CHECK="$MYSQL_CHECK --no-defaults --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLCHECK_OPT" -MYSQL_DUMP="$MYSQL_DUMP --no-defaults --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT" -MYSQL_SLAP="$MYSQL_SLAP -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLSLAP_OPT" -MYSQL_DUMP_SLAVE="$MYSQL_DUMP_DIR --no-defaults -uroot --socket=$SLAVE_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT" -MYSQL_SHOW="$MYSQL_SHOW --no-defaults --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLSHOW_OPT" -MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --debug-info --local-load=$MYSQL_TMP_DIR --character-sets-dir=$CHARSETSDIR $EXTRA_MYSQLBINLOG_OPT" -MYSQL_IMPORT="$MYSQL_IMPORT --no-defaults --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT" -MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose" -MYSQL="$MYSQL --no-defaults --debug-info --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD" -export MYSQL MYSQL_CHECK MYSQL_DUMP MYSQL_DUMP_SLAVE MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES MYSQL_IMPORT -export CLIENT_BINDIR MYSQL_CLIENT_TEST CHARSETSDIR MYSQL_MY_PRINT_DEFAULTS -export MYSQL_SLAP -export NDB_TOOLS_DIR -export NDB_MGM -export NDB_BACKUP_DIR -export NDB_TOOLS_OUTPUT -export PURIFYOPTIONS -NDB_STATUS_OK=1 -export NDB_STATUS_OK -NDB_SLAVE_STATUS_OK=1 -export NDB_SLAVE_STATUS_OK -export NDB_EXTRA_TEST NDBCLUSTER_PORT NDBCLUSTER_PORT_SLAVE - -MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \ - --user=$DBUSER --password=$DBPASSWD --silent -v --skip-safemalloc \ - --tmpdir=$MYSQL_TMP_DIR --port=$MASTER_MYPORT $MYSQL_TEST_SSL_OPTS" -if [ x$USE_TIMER = x1 ] ; then - MYSQL_TEST_ARGS="$MYSQL_TEST_ARGS --timer-file=$MY_LOG_DIR/timer" -fi -MYSQL_TEST_BIN=$MYSQL_TEST -MYSQL_TEST="$MYSQL_TEST $MYSQL_TEST_ARGS" - -# Export MYSQL_TEST variable for use from .test files -export MYSQL_TEST - -GDB_CLIENT_INIT=$MYSQL_TMP_DIR/gdbinit.client -GDB_MASTER_INIT=$MYSQL_TMP_DIR/gdbinit.master -GDB_SLAVE_INIT=$MYSQL_TMP_DIR/gdbinit.slave -GCOV_MSG=$MYSQL_TMP_DIR/mysqld-gcov.out -GCOV_ERR=$MYSQL_TMP_DIR/mysqld-gcov.err -GPROF_DIR=$MYSQL_TMP_DIR/gprof -GPROF_MASTER=$GPROF_DIR/master.gprof -GPROF_SLAVE=$GPROF_DIR/slave.gprof -TIMEFILE="$MYSQL_TEST_DIR/var/log/mysqltest-time" -MYSQLTEST_LOG="$MYSQL_TEST_DIR/var/log/mysqltest.log" -if [ -n "$DO_CLIENT_GDB" -o -n "$DO_GDB" ] ; then - XTERM=`which xterm` -fi - -export MYSQL MYSQL_CHECK MYSQL_DUMP MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR MASTER_MYSOCK - -#++ -# Function Definitions -#-- - -prompt_user () -{ - $ECHO $1 - read unused -} - -# We can't use diff -u or diff -a as these are not portable - -show_failed_diff () -{ - reject_file=r/$1.reject - result_file=r/$1.result - eval_file=r/$1.eval - - if [ -f $eval_file ] - then - result_file=$eval_file - fi - - if [ -x "$DIFF" ] && [ -f $reject_file ] - then - echo "Below are the diffs between actual and expected results:" - echo "-------------------------------------------------------" - $DIFF -c $result_file $reject_file - echo "-------------------------------------------------------" - echo "Please follow the instructions outlined at" - echo "http://forge.mysql.com/wiki/MySQL_Internals_Porting#Debugging_a_MySQL_Server" - echo "to find the reason to this problem and how to report this." - echo "" - fi -} - -do_gdb_test () -{ - mysql_test_args="$MYSQL_TEST_ARGS $1" - $ECHO "set args $mysql_test_args < $2" > $GDB_CLIENT_INIT - echo "Set breakpoints ( if needed) and type 'run' in gdb window" - #this xterm should not be backgrounded - $XTERM -title "Client" -e gdb -x $GDB_CLIENT_INIT $MYSQL_TEST_BIN -} - -error () { - $ECHO "Error: $1" - exit 1 -} - -error_is () { - $ECHO "Errors are (from $TIMEFILE) :" - $CAT < $TIMEFILE - $ECHO "(the last lines may be the most important ones)" -} - -prefix_to_8() { - $ECHO " $1" | $SED -e 's:.*\(........\)$:\1:' -} - -pass_inc () { - TOT_PASS=`$EXPR $TOT_PASS + 1` -} - -fail_inc () { - TOT_FAIL=`$EXPR $TOT_FAIL + 1` -} - -skip_inc () { - TOT_SKIP=`$EXPR $TOT_SKIP + 1` -} - -total_inc () { - TOT_TEST=`$EXPR $TOT_TEST + 1` -} - - -skip_test() { - USERT=" ...." - SYST=" ...." - REALT=" ...." - pname=`$ECHO "$1 "|$CUT -c 1-24` - RES="$pname" - skip_inc - $ECHO "$RES$RES_SPACE [ skipped ]" -} - - -disable_test() { - USERT=" ...." - SYST=" ...." - REALT=" ...." - pname=`$ECHO "$1 "|$CUT -c 1-24` - RES="$pname" - skip_inc - $ECHO "$RES$RES_SPACE [ disabled ] $2" -} - - -report_current_test () { - tname=$1 - echo "CURRENT_TEST: $tname" >> $MASTER_MYERR - eval "master1_running=\$MASTER1_RUNNING" - if [ x$master1_running = x1 ] ; then - echo "CURRENT_TEST: $tname" >> $MASTER_MYERR"1" - fi - if [ -n "$PURIFY_LOGS" ] ; then - for log in $PURIFY_LOGS - do - echo "CURRENT_TEST: $tname" >> $log - done - fi -} - - -report_stats () { - if [ $TOT_FAIL = 0 ]; then - $ECHO "All $TOT_TEST tests were successful." - else - xten=`$EXPR $TOT_PASS \* 10000` - raw=`$EXPR $xten / $TOT_TEST` - raw=`$PRINTF %.4d $raw` - whole=`$PRINTF %.2s $raw` - xwhole=`$EXPR $whole \* 100` - deci=`$EXPR $raw - $xwhole` - $ECHO "Failed ${TOT_FAIL}/${TOT_TEST} tests, ${whole}.${deci}% were successful." - $ECHO "" - $ECHO "The log files in $MY_LOG_DIR may give you some hint" - $ECHO "of what went wrong." - $ECHO "If you want to report this error, please read first the documentation at" - $ECHO "http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html" - fi - - if [ $USE_RUNNING_SERVER -eq 0 ] - then - - # Report if there was any fatal warnings/errors in the log files - # - $RM -f $MY_LOG_DIR/warnings $MY_LOG_DIR/warnings.tmp - # Remove some non fatal warnings from the log files - $SED -e 's!Warning: Table:.* on delete!!g' -e 's!Warning: Setting lower_case_table_names=2!!g' -e 's!Warning: One can only use the --user.*root!!g' -e 's|InnoDB: Warning: we did not need to do crash recovery||g' \ - $MY_LOG_DIR/*.err \ - | $SED -e 's!Warning: Table:.* on rename!!g' \ - > $MY_LOG_DIR/warnings.tmp - - # Find errors - for i in "^Warning:" "^Error:" "^==.* at 0x" "InnoDB: Warning" "missing DBUG_RETURN" "mysqld: Warning" "Attempting backtrace" "Assertion .* failed" - do - if $GREP "$i" $MY_LOG_DIR/warnings.tmp >> $MY_LOG_DIR/warnings - then - GOT_WARNINGS=1 - fi - done - $RM -f $MY_LOG_DIR/warnings.tmp - if [ $GOT_WARNINGS = "1" ] - then - echo "WARNING: Got errors/warnings while running tests. Please examine" - echo "$MY_LOG_DIR/warnings for details." - fi - - fi # USE_RUNNING_SERVER - - # Check valgrind errors from mysqltest - if [ ! -z "$VALGRIND_MYSQLTEST" ] - then - if $GREP "ERROR SUMMARY" $MYSQLTEST_LOG | $GREP -v "0 errors" > /dev/null - then - $ECHO "Valgrind detected errors!" - $GREP "ERROR SUMMARY" $MYSQLTEST_LOG | $GREP -v "0 errors" - $ECHO "See $MYSQLTEST_LOG" - fi - fi -} - -mysql_install_db () { - $ECHO "Removing Stale Files" - if [ -z "$USE_OLD_DATA" ]; then - $RM -rf $MASTER_MYDDIR $MASTER_MYDDIR"1" - $ECHO "Installing Master Databases" - $INSTALL_DB - if [ $? != 0 ]; then - error "Could not install master test DBs" - exit 1 - fi - fi - if [ ! -z "$USE_NDBCLUSTER" ] - then - $ECHO "Installing Master Databases 1" -# $INSTALL_DB -1 - $RM -rf var/master-data1 - mkdir var/master-data1 - cp -r var/master-data/* var/master-data1 - if [ $? != 0 ]; then - error "Could not install master test DBs 1" - exit 1 - fi - fi - $ECHO "Installing Slave Databases" - $RM -rf $SLAVE_MYDDIR $MY_LOG_DIR/* -# $INSTALL_DB -slave - mkdir var/slave-data - cp -r var/master-data/* var/slave-data - if [ $? != 0 ]; then - error "Could not install slave test DBs" - exit 1 - fi - - for slave_num in 1 2 ; - do - $RM -rf var/slave$slave_num-data - mkdir -p var/slave$slave_num-data/mysql - mkdir -p var/slave$slave_num-data/test - cp var/slave-data/mysql/* var/slave$slave_num-data/mysql - done - return 0 -} - -gprof_prepare () -{ - $RM -rf $GPROF_DIR - mkdir -p $GPROF_DIR -} - -gprof_collect () -{ - if [ -f $MASTER_MYDDIR/gmon.out ]; then - gprof $MASTER_MYSQLD $MASTER_MYDDIR/gmon.out > $GPROF_MASTER - echo "Master execution profile has been saved in $GPROF_MASTER" - fi - if [ -f $SLAVE_MYDDIR/gmon.out ]; then - gprof $SLAVE_MYSQLD $SLAVE_MYDDIR/gmon.out > $GPROF_SLAVE - echo "Slave execution profile has been saved in $GPROF_SLAVE" - fi -} - -gcov_prepare () { - $FIND $BASEDIR -name \*.gcov \ - -or -name \*.da | $XARGS $RM -} - -gcov_collect () { - $ECHO "Collecting source coverage info..." - [ -f $GCOV_MSG ] && $RM $GCOV_MSG - [ -f $GCOV_ERR ] && $RM $GCOV_ERR - for d in $MYSQLD_SRC_DIRS; do - cd $BASEDIR/$d - for f in *.h *.cc *.c; do - $GCOV $f 2>>$GCOV_ERR >>$GCOV_MSG - done - cd $MYSQL_TEST_DIR - done - - $ECHO "gcov info in $GCOV_MSG, errors in $GCOV_ERR" -} - -abort_if_failed() -{ - if [ ! $? = 0 ] ; then - echo $1 - exit 1 - fi -} - -launch_in_background() -{ - shift - echo $@ | /bin/sh >> $CUR_MYERR 2>&1 & - sleep 2 #hack - return -} - -shutdown_mysqld() -{ - pid=$1 - ident=$2 - # Shutdown time must be high as slave may be in reconnect - $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=5 --shutdown_timeout=70 shutdown >> $MYSQL_MANAGER_LOG 2>&1 - res=$? - # Some systems require an extra connect - $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1 - if test $res = 0 - then - wait_for_pid $pid - fi - return $res -} - -start_ndbcluster() -{ - if [ ! -n "$USE_NDBCLUSTER" ] ; - then - USING_NDBCLUSTER=0 - USE_NDBCLUSTER_OPT= - fi - - if [ x$USING_NDBCLUSTER = x1 -a -z "$USE_NDBCLUSTER_OPT" ] - then - rm -f $NDB_TOOLS_OUTPUT - if [ -z "$USE_RUNNING_NDBCLUSTER" ] - then - if [ "$DO_BENCH" != 1 -a -z "$NDBCLUSTER_EXTRA_OPTS" ] - then - NDBCLUSTER_EXTRA_OPTS="--small" - fi - OPTS="$NDBCLUSTER_OPTS $NDBCLUSTER_EXTRA_OPTS --character-sets-dir=$CHARSETSDIR --verbose=$NDB_VERBOSE --initial --relative-config-data-dir --core" - if [ "x$NDB_VERBOSE" != "x0" ] ; then - echo "Starting master ndbcluster " $OPTS - fi - ./ndb/ndbcluster $OPTS || NDB_STATUS_OK=0 - if [ x$NDB_STATUS_OK != x1 ] ; then - if [ x$FORCE != x1 ] ; then - exit 1 - fi - USING_NDBCLUSTER=0 - USE_NDBCLUSTER_OPT= - return - fi - - NDB_CONNECTSTRING="host=localhost:$NDBCLUSTER_PORT" - else - NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER" - echo "Using ndbcluster at $NDB_CONNECTSTRING" - fi - USE_NDBCLUSTER_OPT="$USE_NDBCLUSTER --ndb-connectstring=\"$NDB_CONNECTSTRING\" --ndb-extra-logging" - export NDB_CONNECTSTRING - fi -} - -rm_ndbcluster_tables() -{ - $RM -f $1/mysql/apply_status* - $RM -f $1/mysql/schema* -} - -stop_ndbcluster() -{ - if [ -n "$USE_NDBCLUSTER_OPT" ] - then - USE_NDBCLUSTER_OPT= - if [ -z "$USE_RUNNING_NDBCLUSTER" ] - then - # Kill any running ndbcluster stuff - $ECHO "Stopping master cluster" - ./ndb/ndbcluster $NDBCLUSTER_OPTS --stop - # remove ndb table the hard way as not to upset later tests - rm_ndbcluster_tables $MASTER_MYDDIR - rm_ndbcluster_tables $MASTER_MYDDIR"1" - fi - fi -} - -# The embedded server needs the cleanup so we do some of the start work -# but stop before actually running mysqld or anything. - -start_master() -{ - eval "this_master_running=\$MASTER$1_RUNNING" - if [ x$this_master_running = x1 ] || [ x$LOCAL_MASTER = x1 ] ; then - return - fi - # Remove stale binary logs except for 2 tests which need them - if [ "$tname" != "rpl_crash_binlog_ib_1b" ] && [ "$tname" != "rpl_crash_binlog_ib_2b" ] && [ "$tname" != "rpl_crash_binlog_ib_3b" ] - then - $RM -f $MYSQL_TEST_DIR/var/log/master-bin$1.* - fi - - # Remove old master.info and relay-log.info files - $RM -f $MYSQL_TEST_DIR/var/master-data$1/master.info $MYSQL_TEST_DIR/var/master-data$1/relay-log.info - - #run master initialization shell script if one exists - - if [ -f "$master_init_script" ] ; - then - /bin/sh $master_init_script - fi - cd $BASEDIR # for gcov - if [ -n "$1" ] ; then - id=`$EXPR $1 + 101`; - this_master_myport=`$EXPR $MASTER_MYPORT + $1` - NOT_FIRST_MASTER_EXTRA_OPTS="--skip-innodb" - eval "MASTER_MYPORT$1=$this_master_myport" - export MASTER_MYPORT$1 - else - id=1; - this_master_myport=$MASTER_MYPORT - NOT_FIRST_MASTER_EXTRA_OPTS="" - fi - if [ -n "$EXTRA_MASTER_MYSQLD_TRACE" ] - then - CURR_MASTER_MYSQLD_TRACE="$EXTRA_MASTER_MYSQLD_TRACE$1" - fi - if [ x$MASTER_MYSQLDBINLOG = x1 ] - then - MASTER_MYSQLD_BINLOG_OPT="--log-bin=$MYSQL_TEST_DIR/var/log/master-bin$1" - fi - if [ -z "$DO_BENCH" -a -z "$DO_STRESS" ] - then - master_args="--no-defaults \ - --server-id=$id \ - --basedir=$MY_BASEDIR \ - --port=$this_master_myport \ - --port-open-timeout=380 \ - --local-infile \ - --exit-info=256 \ - --core \ - $USE_NDBCLUSTER_OPT \ - --datadir=$MASTER_MYDDIR$1 \ - --pid-file=$MASTER_MYPID$1 \ - --socket=$MASTER_MYSOCK$1 \ - --log=$MASTER_MYLOG$1 \ - --character-sets-dir=$CHARSETSDIR \ - --default-character-set=$CHARACTER_SET \ - --tmpdir=$MYSQL_TMP_DIR \ - --language=$LANGUAGE \ - --innodb_data_file_path=ibdata1:128M:autoextend \ - --open-files-limit=1024 \ - --log-bin-trust-function-creators \ - $MASTER_40_ARGS \ - $SMALL_SERVER \ - $MASTER_MYSQLD_BINLOG_OPT \ - $EXTRA_MASTER_MYSQLD_OPT $EXTRA_MASTER_OPT \ - $NOT_FIRST_MASTER_EXTRA_OPTS $CURR_MASTER_MYSQLD_TRACE" - else - master_args="--no-defaults \ - --server-id=$id --rpl-recovery-rank=1 \ - --basedir=$MY_BASEDIR --init-rpl-role=master \ - --port=$this_master_myport \ - --port-open-timeout=380 \ - --local-infile \ - --datadir=$MASTER_MYDDIR$1 \ - --pid-file=$MASTER_MYPID$1 \ - --socket=$MASTER_MYSOCK$1 \ - --character-sets-dir=$CHARSETSDIR \ - --default-character-set=$CHARACTER_SET \ - --core \ - $USE_NDBCLUSTER_OPT \ - --tmpdir=$MYSQL_TMP_DIR \ - --language=$LANGUAGE \ - --innodb_data_file_path=ibdata1:128M:autoextend \ - --log-bin-trust-function-creators \ - $MASTER_40_ARGS \ - $SMALL_SERVER \ - $MASTER_MYSQLD_BINLOG_OPT \ - $EXTRA_MASTER_MYSQLD_OPT $EXTRA_MASTER_OPT \ - $NOT_FIRST_MASTER_EXTRA_OPTS" - fi - - CUR_MYERR=$MASTER_MYERR$1 - CUR_MYSOCK=$MASTER_MYSOCK$1 - - # For embedded server we collect the server flags and return - if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then - # Add a -A to each argument to pass it to embedded server - EMBEDDED_SERVER_OPTS="" - for opt in $master_args - do - EMBEDDED_SERVER_OPTS="$EMBEDDED_SERVER_OPTS -A $opt" - done - EXTRA_MYSQL_TEST_OPT="$EMBEDDED_SERVER_OPTS" - return - fi - - if [ x$DO_DDD = x1 ] - then - $ECHO "set args $master_args" > $GDB_MASTER_INIT$1 - launch_in_background master ddd -display $DISPLAY --debugger \ - "gdb -x $GDB_MASTER_INIT$1" $MASTER_MYSQLD - elif [ x$DO_GDB = x1 ] - then - if [ x$MANUAL_GDB = x1 ] - then - $ECHO "set args $master_args" > $GDB_MASTER_INIT$1 - $ECHO "To start gdb for the master , type in another window:" - $ECHO "cd $MYSQL_TEST_DIR ; gdb -x $GDB_MASTER_INIT$1 $MASTER_MYSQLD" - wait_for_master=1500 - else - ( $ECHO set args $master_args; - if [ $USE_MANAGER = 0 ] ; then - cat <<EOF -b mysql_parse -commands 1 -disa 1 -end -r -EOF - fi ) > $GDB_MASTER_INIT$1 - launch_in_background master $XTERM -display $DISPLAY \ - -title "Master" -e gdb -x $GDB_MASTER_INIT$1 $MASTER_MYSQLD - fi - else - launch_in_background master $MASTER_MYSQLD $master_args - fi - sleep_until_file_created $MASTER_MYPID$1 $wait_for_master - wait_for_master=$SLEEP_TIME_FOR_SECOND_MASTER - eval "MASTER$1_RUNNING=1" -} - -start_slave() -{ - [ x$SKIP_SLAVE = x1 ] && return - eval "this_slave_running=\$SLAVE$1_RUNNING" - [ x$this_slave_running = 1 ] && return - - # When testing fail-safe replication, we will have more than one slave - # in this case, we start secondary slaves with an argument - slave_ident="slave$1" - if [ -n "$1" ] ; - then - slave_server_id=`$EXPR 2 + $1` - slave_rpl_rank=$slave_server_id - slave_port=`expr $SLAVE_MYPORT + $1` - slave_log="$SLAVE_MYLOG.$1" - slave_err="$SLAVE_MYERR.$1" - slave_datadir="$SLAVE_MYDDIR/../$slave_ident-data/" - slave_pid="$MYRUN_DIR/mysqld-$slave_ident.pid" - slave_sock="$SLAVE_MYSOCK-$1" - else - slave_server_id=2 - slave_rpl_rank=2 - slave_port=$SLAVE_MYPORT - slave_log=$SLAVE_MYLOG - slave_err=$SLAVE_MYERR - slave_datadir=$SLAVE_MYDDIR - slave_pid=$SLAVE_MYPID - slave_sock="$SLAVE_MYSOCK" - fi - - # - if [ x$USING_NDBCLUSTER = x1 -a -n "$USE_NDBCLUSTER_SLAVE" ] ; then - if [ $slave_server_id -eq 2 ] ; then - savedir=`pwd` - cd $MYSQL_TEST_DIR - if [ "$DO_BENCH" != 1 -a -z "$NDBCLUSTER_EXTRA_OPTS" ] - then - NDBCLUSTER_EXTRA_OPTS="--small" - fi - - OPTS="$NDBCLUSTER_OPTS_SLAVE --initial $NDBCLUSTER_EXTRA_OPTS --ndbd-nodes=1 --verbose=$NDB_VERBOSE --relative-config-data-dir --core" - if [ "x$NDB_VERBOSE" != "x0" ] ; then - echo "Starting slave ndbcluster " $OPTS - fi - ./ndb/ndbcluster $OPTS \ - || NDB_SLAVE_STATUS_OK=0 - # > /dev/null 2>&1 || NDB_SLAVE_STATUS_OK=0 - cd $savedir - if [ x$NDB_SLAVE_STATUS_OK != x1 ] ; then - if [ x$FORCE != x1 ] ; then - exit 1 - fi - USE_NDBCLUSTER_SLAVE_OPT= - USE_NDBCLUSTER_SLAVE= - fi - USE_NDBCLUSTER_SLAVE_OPT=$USE_NDBCLUSTER_SLAVE - fi - else - USE_NDBCLUSTER_SLAVE_OPT= - fi - - # Remove stale binary logs and old master.info files - # except for too tests which need them - if [ "$tname" != "rpl_crash_binlog_ib_1b" ] && [ "$tname" != "rpl_crash_binlog_ib_2b" ] && [ "$tname" != "rpl_crash_binlog_ib_3b" ] - then - $RM -f $MYSQL_TEST_DIR/var/log/$slave_ident-*bin.* - $RM -f $slave_datadir/master.info $slave_datadir/relay-log.info - fi - - #run slave initialization shell script if one exists - if [ -f "$slave_init_script" ] ; - then - /bin/sh $slave_init_script - fi - - if [ -z "$SLAVE_MASTER_INFO" ] ; then - master_info="--master-user=root \ - --master-connect-retry=1 \ - --master-host=127.0.0.1 \ - --master-password="" \ - --master-port=$MASTER_MYPORT \ - --server-id=$slave_server_id --rpl-recovery-rank=$slave_rpl_rank" - else - master_info=$SLAVE_MASTER_INFO - fi - - if [ x$SLAVE_MYSQLDBINLOG = x1 ] - then - SLAVE_MYSQLD_BINLOG_OPT="--log-bin=$MYSQL_TEST_DIR/var/log/$slave_ident-bin --log-slave-updates" - fi - - $RM -f $slave_datadir/log.* - slave_args="--no-defaults $master_info \ - --exit-info=256 \ - $SLAVE_MYSQLDBINLOG_OPT \ - --relay-log=$MYSQL_TEST_DIR/var/log/$slave_ident-relay-bin \ - --log=$slave_log \ - --basedir=$MY_BASEDIR \ - --datadir=$slave_datadir \ - --pid-file=$slave_pid \ - --port=$slave_port \ - --port-open-timeout=380 \ - --socket=$slave_sock \ - --character-sets-dir=$CHARSETSDIR \ - --default-character-set=$CHARACTER_SET \ - --core --init-rpl-role=slave \ - --tmpdir=$MYSQL_TMP_DIR \ - --language=$LANGUAGE \ - --skip-innodb --skip-ndbcluster --skip-slave-start \ - --slave-load-tmpdir=$SLAVE_LOAD_TMPDIR \ - --report-host=127.0.0.1 --report-user=root \ - --report-port=$slave_port \ - --master-retry-count=10 \ - -O slave_net_timeout=10 \ - --log-bin-trust-function-creators \ - $SMALL_SERVER \ - $SLAVE_MYSQLD_BINLOG_OPT \ - $EXTRA_SLAVE_MYSQLD_OPT $EXTRA_SLAVE_OPT \ - $USE_NDBCLUSTER_SLAVE_OPT" - CUR_MYERR=$slave_err - CUR_MYSOCK=$slave_sock - - if [ x$DO_DDD = x1 ] - then - $ECHO "set args $slave_args" > $GDB_SLAVE_INIT - launch_in_background $slave_ident ddd -display $DISPLAY --debugger \ - "gdb -x $GDB_SLAVE_INIT" $SLAVE_MYSQLD - elif [ x$DO_GDB = x1 ] - then - if [ x$MANUAL_GDB = x1 ] - then - $ECHO "set args $slave_args" > $GDB_SLAVE_INIT - echo "To start gdb for the slave, type in another window:" - echo "cd $MYSQL_TEST_DIR ; gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD" - wait_for_slave=1500 - else - ( $ECHO set args $slave_args; - if [ $USE_MANAGER = 0 ] ; then - cat <<EOF -b mysql_parse -commands 1 -disa 1 -end -r -EOF - fi ) > $GDB_SLAVE_INIT - launch_in_background $slave_ident $XTERM -display $DISPLAY -title "Slave" -e \ - gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD - fi - else - launch_in_background $slave_ident $SLAVE_MYSQLD $slave_args - fi - eval "SLAVE$1_RUNNING=1" - sleep_until_file_created $slave_pid $wait_for_slave - wait_for_slave=$SLEEP_TIME_FOR_SECOND_SLAVE -} - -mysql_start () -{ -# We should not start the daemon here as we don't know the arguments -# for the test. Better to let the test start the daemon - -# $ECHO "Starting MySQL daemon" -# start_master -# start_slave - cd $MYSQL_TEST_DIR - return 1 -} - -stop_slave () -{ - eval "this_slave_running=\$SLAVE$1_RUNNING" - slave_ident="slave$1" - if [ -n "$1" ] ; - then - slave_pid="$MYRUN_DIR/mysqld-$slave_ident.pid" - else - slave_pid=$SLAVE_MYPID - fi - if [ x$this_slave_running = x1 ] - then - pid=`$CAT $slave_pid` - shutdown_mysqld $pid $slave_ident - if [ $? != 0 ] && [ -f $slave_pid ] - then # try harder! - $ECHO "slave not cooperating with mysqladmin, will try manual kill" - kill $pid - sleep_until_file_deleted $pid $slave_pid - if [ -f $slave_pid ] ; then - $ECHO "slave refused to die. Sending SIGKILL" - kill -9 `$CAT $slave_pid` - $RM -f $slave_pid - else - $ECHO "slave responded to SIGTERM " - fi - else - sleep $SLEEP_TIME_AFTER_RESTART - fi - eval "SLAVE$1_RUNNING=0" - if [ -n "$USE_NDBCLUSTER_SLAVE_OPT" ] ; then - savedir=`pwd` - cd $MYSQL_TEST_DIR - $ECHO "Stopping slave cluster" - ./ndb/ndbcluster $NDBCLUSTER_OPTS_SLAVE --stop - rm_ndbcluster_tables $SLAVE_MYDDIR - cd $savedir - fi - fi -} - -stop_slave_threads () -{ - eval "this_slave_running=\$SLAVE$1_RUNNING" - slave_ident="slave$1" - if [ x$this_slave_running = x1 ] - then - $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$slave_ident.sock stop-slave > /dev/null 2>&1 - fi -} - -stop_master () -{ - eval "this_master_running=\$MASTER$1_RUNNING" - if [ x$this_master_running = x1 ] - then - # For embedded server we don't stop anyting but mark that - # MASTER_RUNNING=0 to get cleanup when calling start_master(). - if [ x$USE_EMBEDDED_SERVER != x1 ] ; then - pid=`$CAT $MASTER_MYPID$1` - shutdown_mysqld $pid master $1 - if [ $? != 0 ] && [ -f $MASTER_MYPID$1 ] - then # try harder! - $ECHO "master not cooperating with mysqladmin, will try manual kill" - kill $pid - sleep_until_file_deleted $pid $MASTER_MYPID$1 - if [ -f $MASTER_MYPID$1 ] ; then - $ECHO "master refused to die. Sending SIGKILL" - kill -9 `$CAT $MASTER_MYPID$1` - $RM -f $MASTER_MYPID$1 - else - $ECHO "master responded to SIGTERM " - fi - else - sleep $SLEEP_TIME_AFTER_RESTART - fi - fi - eval "MASTER$1_RUNNING=0" - fi -} - -mysql_stop () -{ - if [ "$MASTER_RUNNING" = 1 ] - then - $ECHO "Ending Tests" - $ECHO "Shutting-down MySQL daemon" - $ECHO "" - stop_master - stop_master 1 - $ECHO "Master shutdown finished" - stop_slave - stop_slave 1 - stop_slave 2 - $ECHO "Slave shutdown finished" - stop_ndbcluster - fi - return 1 -} - -mysql_restart () -{ - mysql_stop - mysql_start - return 1 -} - -mysql_loadstd () { - - # cp $STD_DATA/*.frm $STD_DATA/*.MRG $MASTER_MYDDIR/test - return 1 -} - -run_testcase () -{ - tf=$1 - tname=`$BASENAME $tf .test` - master_opt_file=$TESTDIR/$tname-master.opt - slave_opt_file=$TESTDIR/$tname-slave.opt - master_init_script=$TESTDIR/$tname-master.sh - slave_init_script=$TESTDIR/$tname-slave.sh - slave_master_info_file=$TESTDIR/$tname.slave-mi - tsrcdir=$TESTDIR/$tname-src - result_file="r/$tname.result" - echo $tname > $CURRENT_TEST - SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0 \& \( $tname : federated \) = 0` - NDBCLUSTER_TEST=`$EXPR \( $tname : '.*ndb.*' \) != 0` - if [ "x$USE_NDBCLUSTER_ALL" = "x1" ] ; then - NDBCLUSTER_TEST=1 - fi - if [ "x$USE_NDBCLUSTER_ONLY" = "x1" -a "x$NDBCLUSTER_TEST" != "x1" ] ; then - skip_test $tname - return - fi - if [ "$USE_MANAGER" = 1 ] ; then - many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)` - fi - if $EXPR "$tname" '<' "$START_FROM" > /dev/null ; then - #skip_test $tname - return - fi - - if [ "$SKIP_TEST" ] ; then - if $EXPR \( "$tname" : "$SKIP_TEST" \) > /dev/null ; then - skip_test $tname - return - fi - fi - - if [ "$DO_TEST" ] ; then - if $EXPR \( "$tname" : "$DO_TEST" \) > /dev/null ; then - : #empty command to keep some shells happy - else - #skip_test $tname - return - fi - fi - - if [ x${NO_SLAVE}x$SKIP_SLAVE = x1x0 ] ; then - skip_test $tname - return - fi - -# if [ -f "$TESTDIR/$tname.disabled" ] -# then -# comment=`$CAT $TESTDIR/$tname.disabled`; -# disable_test $tname "$comment" -# return -# fi - if [ -f "$TESTDIR/disabled.def" ] ; then - comment=`$GREP "^$tname *: *" $TESTDIR/disabled.def`; - if [ -n "$comment" ] - then - comment=`echo $comment | sed 's/^[^:]*: *//'` - disable_test $tname "$comment" - return - fi - fi - - if [ "x$USE_EMBEDDED_SERVER" != "x1" ] ; then - # Stop all slave threads, so that we don't have useless reconnection - # attempts and error messages in case the slave and master servers restart. - stop_slave_threads - stop_slave_threads 1 - stop_slave_threads 2 - fi - - # FIXME temporary solution, we will get a new C version of this - # script soon anyway so it is not worth it spending the time - if [ "x$USE_EMBEDDED_SERVER" = "x1" -a -z "$DO_TEST" ] ; then - for t in \ - "init_connect" \ - "init_file" - do - if [ "$tname" = "$t" ] ; then - skip_test $tname - return - fi - done - fi - - if [ $USE_RUNNING_SERVER -eq 0 ] ; - then - if [ -f $master_opt_file ] ; - then - EXTRA_MASTER_OPT=`$CAT $master_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"` - case "$EXTRA_MASTER_OPT" in - --timezone=*) - TZ=`$ECHO "$EXTRA_MASTER_OPT" | $SED -e "s;--timezone=;;"` - export TZ - # Note that this must be set to space, not "" for test-reset to work - EXTRA_MASTER_OPT=" " - ;; - --result-file=*) - result_file=`$ECHO "$EXTRA_MASTER_OPT" | $SED -e "s;--result-file=;;"` - result_file="r/$result_file.result" - # Note that this must be set to space, not "" for test-reset to work - EXTRA_MASTER_OPT=" " - ;; - --force-restart) - # Note that this must be set to space, not "" for test-reset to work - EXTRA_MASTER_OPT=" " - ;; - esac - stop_master - stop_master 1 - - # only stop the cluster if this test will not use cluster - if [ x$NDBCLUSTER_TEST != x1 ] ; - then - stop_ndbcluster - fi - - report_current_test $tname - USING_NDBCLUSTER=$NDBCLUSTER_TEST - # start_ndbcluster knows if cluster is already started - start_ndbcluster - start_master - if [ x$USING_NDBCLUSTER = x1 -a -z "$DO_BENCH" -a -z "$DO_STRESS" ] ; then - echo "CURRENT_TEST: $tname" >> $MASTER_MYERR"1" - start_master 1 - fi - TZ=$MY_TZ; export TZ - else - # If we had extra master opts to the previous run - # or there is no master running (FIXME strange.....) - # or there is a master init script - if [ ! -z "$EXTRA_MASTER_OPT" ] || [ x$MASTER_RUNNING != x1 ] || \ - [ -f $master_init_script ] || \ - [ -n "$USE_NDBCLUSTER" -a x$NDBCLUSTER_TEST != x$USING_NDBCLUSTER ] - then - EXTRA_MASTER_OPT="" - stop_master - stop_master 1 - - # only stop the cluster if this test will not use cluster - if [ x$NDBCLUSTER_TEST != x1 ] ; - then - stop_ndbcluster - fi - - report_current_test $tname - USING_NDBCLUSTER=$NDBCLUSTER_TEST - # start_ndbcluster knows if cluster is already started - start_ndbcluster - start_master - if [ x$USING_NDBCLUSTER = x1 -a -z "$DO_BENCH" -a -z "$DO_STRESS" ] ; then - echo "CURRENT_TEST: $tname" >> $MASTER_MYERR"1" - start_master 1 - fi - else - report_current_test $tname - fi - fi - - # We never start a slave if embedded server is used - if [ "x$USE_EMBEDDED_SERVER" != "x1" ] ; then - do_slave_restart=0 - if [ -f $slave_opt_file ] ; - then - EXTRA_SLAVE_OPT=`$CAT $slave_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"` - do_slave_restart=1 - else - if [ ! -z "$EXTRA_SLAVE_OPT" ] || [ x$SLAVE_RUNNING != x1 ] ; - then - EXTRA_SLAVE_OPT="" - do_slave_restart=1 - fi - fi - - if [ -f $slave_master_info_file ] ; then - SLAVE_MASTER_INFO=`$CAT $slave_master_info_file` - do_slave_restart=1 - else - if [ ! -z "$SLAVE_MASTER_INFO" ] || [ x$SLAVE_RUNNING != x1 ] ; - then - SLAVE_MASTER_INFO="" - do_slave_restart=1 - fi - fi - - USING_NDBCLUSTER=$NDBCLUSTER_TEST - if [ -n "$USE_NDBCLUSTER_SLAVE_OPT" ] ; then - if [ x$USING_NDBCLUSTER != x1 ] ; then - do_slave_restart=1 - fi - else - if [ x$USING_NDBCLUSTER = x1 ] ; then - do_slave_restart=1 - fi - fi - - - if [ x$do_slave_restart = x1 ] ; then - stop_slave - echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR - start_slave - else - echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR - fi - if [ x$many_slaves = x1 ]; then - start_slave 1 - start_slave 2 - fi - fi - fi - - if [ "x$START_AND_EXIT" = "x1" ] ; then - echo "Servers started, exiting" - exit - fi - - cd $MYSQL_TEST_DIR - - if [ -f $tf ] ; then - $RM -f r/$tname.*reject - mysql_test_args="-R $result_file $EXTRA_MYSQL_TEST_OPT" - if [ -z "$DO_CLIENT_GDB" ] ; then - `$VALGRIND_MYSQLTEST $MYSQL_TEST $mysql_test_args < $tf 2> $TIMEFILE`; - else - do_gdb_test "$mysql_test_args" "$tf" - fi - - res=$? - - # Save the testcase log to mysqltest log file - echo "CURRENT_TEST: $tname" >> $MYSQLTEST_LOG - cat $TIMEFILE >> $MYSQLTEST_LOG - - pname=`$ECHO "$tname "|$CUT -c 1-24` - RES="$pname" - - if [ x$many_slaves = x1 ] ; then - stop_slave 1 - stop_slave 2 - fi - - if [ $res = 0 ]; then - total_inc - pass_inc - TIMER="" - if [ x$USE_TIMER = x1 -a -f "$MY_LOG_DIR/timer" ]; then - TIMER=`cat $MY_LOG_DIR/timer` - TIMER=`$PRINTF "%13s" $TIMER` - fi - $ECHO "$RES$RES_SPACE [ pass ] $TIMER" - else - # why the following ``if'' ? That is why res==1 is special ? - if [ $res = 62 ]; then - skip_inc - $ECHO "$RES$RES_SPACE [ skipped ]" - else - if [ $res -ne 1 ]; then - $ECHO "mysqltest returned unexpected code $res, it has probably crashed" >> $TIMEFILE - fi - total_inc - fail_inc - $ECHO "$RES$RES_SPACE [ fail ]" - $ECHO - error_is - show_failed_diff $tname - $ECHO - if [ x$FORCE != x1 ] ; then - $ECHO "Aborting: $tname failed in $TEST_MODE mode. To continue, re-run with '--force'." - $ECHO - if [ -z "$DO_GDB" ] && [ $USE_RUNNING_SERVER -eq 0 ] && \ - [ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ] - then - mysql_stop - fi - exit 1 - fi - FAILED_CASES="$FAILED_CASES $tname" - if [ -z "$DO_GDB" ] && [ $USE_RUNNING_SERVER -eq 0 ] && \ - [ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ] - then - mysql_restart - fi - fi - fi - fi -} - -run_stress_test() -{ - - STRESS_BASEDIR="$MYSQL_TEST_DIR/var/stress" - - #Clean-up old stress test basedir - if [ -d $STRESS_BASEDIR ] ; then - $RM -rf $STRESS_BASEDIR - fi - #Create stress test basedir - mkdir $STRESS_BASEDIR - - if [ "$STRESS_SUITE" != "main" -a "$STRESS_SUITE" != "default" ] ; then - STRESS_SUITE_DIR="$MYSQL_TEST_DIR/suite/$STRESS_SUITE" - else - STRESS_SUITE_DIR="$MYSQL_TEST_DIR" - fi - - if [ -d "$STRESS_SUITE_DIR" ] ; then - STRESS_SUITE_T_DIR="$STRESS_SUITE_DIR/t" - STRESS_SUITE_R_DIR="$STRESS_SUITE_DIR/r" - #FIXME: check that dirs above are exist - else - echo "Directory $STRESS_SUITE_DIR with test suite doesn't exists. Abort stress testing" - exit 1 - fi - - if [ -n "$STRESS_TEST" ] ; then - STRESS_TEST_FILE="$STRESS_BASEDIR/stress_tests.txt" - echo $STRESS_TEST > $STRESS_TEST_FILE - elif [ -n "$STRESS_TEST_FILE" ] ; then - STRESS_TEST_FILE="$STRESS_SUITE_DIR/$STRESS_TEST_FILE" - if [ ! -f "$STRESS_TEST_FILE" ] ; then - echo "Specified file $STRESS_TEST_FILE with list of tests does not exist" - echo "Please ensure that file exists and has proper permissions" - exit 1 - fi - else - STRESS_TEST_FILE="$STRESS_SUITE_DIR/stress_tests.txt" - if [ ! -f "$STRESS_TEST_FILE" ] ; then - echo "Default file $STRESS_TEST_FILE with list of tests does not exist." - echo "Please use --stress-test-file option to specify custom one or you can" - echo "just specify name of test for testing as last argument in command line" - exit 1 - fi - fi - - if [ -n "$STRESS_INIT_FILE" ] ; then - STRESS_INIT_FILE="$STRESS_SUITE_DIR/$STRESS_INIT_FILE" - if [ ! -f "$STRESS_INIT_FILE" ] ; then - echo "Specified file $STRESS_INIT_FILE with list of tests doesn't exist." - echo "Please ensure that file exists and has proper permissions" - exit 1 - fi - else - STRESS_INIT_FILE="$STRESS_SUITE_DIR/stress_init.txt" - #Check for default init file - if [ ! -f "$STRESS_INIT_FILE" ] ; then - STRESS_INIT_FILE="" - fi - fi - - if [ "$STRESS_MODE" != "random" -a "$STRESS_MODE" != "seq" ] ; then - echo "You specified wrong mode '$STRESS_MODE' for stress test." - echo "Correct values are 'random' or 'seq'" - exit 1 - fi - - STRESS_TEST_ARGS="--server-socket=$MASTER_MYSOCK \ - --server-user=$DBUSER \ - --server-database=$DB \ - --stress-suite-basedir=$MYSQL_TEST_DIR \ - --suite=$STRESS_SUITE \ - --stress-tests-file=$STRESS_TEST_FILE \ - --stress-basedir=$STRESS_BASEDIR \ - --server-logs-dir=$STRESS_BASEDIR \ - --stress-mode=$STRESS_MODE \ - --mysqltest=$CLIENT_BINDIR/mysqltest \ - --threads=$STRESS_THREADS \ - --verbose \ - --cleanup \ - --log-error-details \ - --abort-on-error" - - if [ -n "$STRESS_INIT_FILE" ] ; then - STRESS_TEST_ARGS="$STRESS_TEST_ARGS --stress-init-file=$STRESS_INIT_FILE" - fi - - if [ -z "$STRESS_LOOP_COUNT" -a -z "$STRESS_TEST_COUNT" -a - -z "$STRESS_TEST_DURATION" ] ; then - - #Limit stress testing with 20 loops in case when any limit parameter - #was specified - STRESS_TEST_COUNT=20 - fi - - if [ -n "$STRESS_LOOP_COUNT" ] ; then - STRESS_TEST_ARGS="$STRESS_TEST_ARGS --loop-count=$STRESS_LOOP_COUNT" - fi - - if [ -n "$STRESS_TEST_COUNT" ] ; then - STRESS_TEST_ARGS="$STRESS_TEST_ARGS --test-count=$STRESS_TEST_COUNT" - fi - - if [ -n "$STRESS_TEST_DURATION" ] ; then - STRESS_TEST_ARGS="$STRESS_TEST_ARGS --test-duration=$STRESS_TEST_DURATION" - fi - - echo "Stress test related variables:" - echo "TESTS - $1" - echo "STRESS - $DO_STRESS" - echo "STRESS_SUITE - $STRESS_SUITE" - echo "STRESS_TEST_FILE - $STRESS_TEST_FILE" - echo "STRESS_INIT_FILE - $STRESS_INIT_FILE" - echo "STRESS_THREADS - $STRESS_THREADS" - echo "STRESS_MODE - $STRESS_MODE" - echo "STRESS_TEST_COUNT - $STRESS_TEST_COUNT" - echo "STRESS_LOOP_COUNT - $STRESS_LOOP_COUNT" - echo "STRESS_TEST_DURATION - $STRESS_TEST_DURATION" - - #echo "$STRESS_TEST_ARGS"; - #Run stress test - $MYSQL_TEST_DIR/mysql-stress-test.pl $STRESS_TEST_ARGS - - -} - -###################################################################### -# Main script starts here -###################################################################### - -[ "$DO_GCOV" -a ! -x "$GCOV" ] && error "No gcov found" - -[ "$DO_GCOV" ] && gcov_prepare -[ "$DO_GPROF" ] && gprof_prepare - -if [ $USE_RUNNING_SERVER -eq 0 ] -then - if [ -z "$FAST_START" ] - then - # Ensure that no old mysqld test servers are running - $MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 - $MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK1 -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 - $MYSQLADMIN --no-defaults --socket=$SLAVE_MYSOCK -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 - $MYSQLADMIN --no-defaults --host=$hostname --port=$MASTER_MYPORT --protocol=tcp -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 - $MYSQLADMIN --no-defaults --host=$hostname --protocol=tcp --port=`expr $MASTER_MYPORT + 1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 - $MYSQLADMIN --no-defaults --host=$hostname --protocol=tcp --port=$SLAVE_MYPORT -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 - $MYSQLADMIN --no-defaults --host=$hostname --protocol=tcp --port=`expr $SLAVE_MYPORT + 1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 - sleep_until_file_deleted 0 $MASTER_MYPID - sleep_until_file_deleted 0 $MASTER_MYPID"1" - sleep_until_file_deleted 0 $SLAVE_MYPID - else - rm $MASTER_MYPID $MASTER_MYPID"1" $SLAVE_MYPID - fi - - # just to force stopping anything from previous runs - USE_NDBCLUSTER_OPT=$USE_NDBCLUSTER - stop_ndbcluster - - # Remove files that can cause problems - $RM -rf $MYSQL_TEST_DIR/var/ndbcluster - $RM -rf $MYSQL_TEST_DIR/var/tmp/snapshot* - $RM -rf $MYSQL_TEST_DIR/var/run/* $MYSQL_TEST_DIR/var/tmp/* - - # Remove old berkeley db log files that can confuse the server - $RM -f $MASTER_MYDDIR/log.* - $RM -f $MASTER_MYDDIR"1"/log.* - - # Remove old log and reject files - $RM -f r/*.reject r/*.progress r/*.log r/*.warnings - - wait_for_master=$SLEEP_TIME_FOR_FIRST_MASTER - wait_for_slave=$SLEEP_TIME_FOR_FIRST_SLAVE - $ECHO "Installing Test Databases" - mysql_install_db - - if [ -n "$1" -a `expr "X$*" : '.*ndb'` -eq 0 ] - then - USING_NDBCLUSTER=0 - USE_NDBCLUSTER_OPT= - fi - - mysql_start - $ECHO "Loading Standard Test Databases" - mysql_loadstd -fi - -$ECHO "Starting Tests" - -# Some test cases need USE_RUNNING_SERVER -export USE_RUNNING_SERVER - -# -# This can probably be deleted -# -if [ "$DO_BENCH" = 1 ] -then - start_master - - if [ "$DO_SMALL_BENCH" = 1 ] - then - EXTRA_BENCH_ARGS="--small-test --small-tables" - fi - - if [ x$USING_NDBCLUSTER = x1 ] - then - EXTRA_BENCH_ARGS="--create-options=TYPE=ndb $EXTRA_BENCH_ARGS" - fi - - BENCHDIR=$BASEDIR/sql-bench/ - savedir=`pwd` - cd $BENCHDIR - if [ -z "$1" ] - then - ./run-all-tests --socket=$MASTER_MYSOCK --user=root $EXTRA_BENCH_ARGS --log - else - if [ -x "./$1" ] - then - ./$1 --socket=$MASTER_MYSOCK --user=root $EXTRA_BENCH_ARGS - else - echo "benchmark $1 not found" - fi - fi - cd $savedir - mysql_stop - exit -fi - -# -# Stress testing -# -if [ "$DO_STRESS" = 1 ] -then - - if [ -n "$1" ] ; then - STRESS_TEST="$1"; - fi - - if [ $USE_RUNNING_SERVER -eq 0 ] ; then - start_master - fi - - run_stress_test - - if [ $USE_RUNNING_SERVER -eq 0 ] ; then - mysql_stop - fi - - exit - -fi - - -$ECHO -if [ x$USE_TIMER = x1 ] ; then -$ECHO "TEST RESULT TIME (ms)" -else -$ECHO "TEST RESULT" -fi -$ECHO $DASH72 - -if [ -z "$1" ] ; -then - if [ x$RECORD = x1 ]; then - $ECHO "Will not run in record mode without a specific test case." - else - for tf in $TESTDIR/*.$TESTSUFFIX - do - run_testcase $tf - done - $RM -f $TIMEFILE # Remove for full test - fi -else - while [ ! -z "$1" ]; do - tname=`$BASENAME $1 .test` - tf=$TESTDIR/$tname.$TESTSUFFIX - if [ -f $tf ] ; then - run_testcase $tf - else - $ECHO "Test case $tf does not exist." - fi - shift - done -fi - -$ECHO $DASH72 -$ECHO - -if [ -z "$DO_GDB" ] && [ $USE_RUNNING_SERVER -eq 0 ] && [ -z "$DO_DDD" ] -then - mysql_stop -fi -report_stats -$ECHO - -[ "$DO_GCOV" ] && gcov_collect # collect coverage information -[ "$DO_GPROF" ] && gprof_collect # collect coverage information - -if [ $TOT_FAIL -ne 0 ]; then - $ECHO "mysql-test-run in $TEST_MODE mode: *** Failing the test(s):$FAILED_CASES" - $ECHO - exit 1 -fi -if [ $GOT_WARNINGS -ne 0 ]; then - exit 1 -fi -exit 0 diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 4fb6ac59bce..fe4f59b35b1 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -6,124 +6,108 @@ # # mysql-test-run.pl # -# Tool used for executing a suite of .test file +# Tool used for executing a suite of .test files # # See the "MySQL Test framework manual" for more information # http://dev.mysql.com/doc/mysqltest/en/index.html # -# Please keep the test framework tools identical in all versions! # ############################################################################## -# -# Coding style directions for this perl script -# -# - To make this Perl script easy to alter even for those that not -# code Perl that often, keeep the coding style as close as possible to -# the C/C++ MySQL coding standard. -# -# - All lists of arguments to send to commands are Perl lists/arrays, -# not strings we append args to. Within reason, most string -# concatenation for arguments should be avoided. -# -# - Functions defined in the main program are not to be prefixed, -# functions in "library files" are to be prefixed with "mtr_" (for -# Mysql-Test-Run). There are some exceptions, code that fits best in -# the main program, but are put into separate files to avoid -# clutter, may be without prefix. -# -# - All stat/opendir/-f/ is to be kept in collect_test_cases(). It -# will create a struct that the rest of the program can use to get -# the information. This separates the "find information" from the -# "do the work" and makes the program more easy to maintain. -# -# - The rule when it comes to the logic of this program is -# -# command_line_setup() - is to handle the logic between flags -# collect_test_cases() - is to do its best to select what tests -# to run, dig out options, if needs restart etc. -# run_testcase() - is to run a single testcase, and follow the -# logic set in both above. No, or rare file -# system operations. If a test seems complex, -# it should probably not be here. -# -# A nice way to trace the execution of this script while debugging -# is to use the Devel::Trace package found at -# "http://www.plover.com/~mjd/perl/Trace/" and run this script like -# "perl -d:Trace mysql-test-run.pl" -# +use strict; +use warnings; -use lib "lib/"; +BEGIN { + # Check that mysql-test-run.pl is started from mysql-test/ + unless ( -f "mysql-test-run.pl" ) + { + print "**** ERROR **** ", + "You must start mysql-test-run from the mysql-test/ directory\n"; + exit(1); + } + # Check that lib exist + unless ( -d "lib/" ) + { + print "**** ERROR **** ", + "Could not find the lib/ directory \n"; + exit(1); + } +} -$Devel::Trace::TRACE= 0; # Don't trace boring init stuff +BEGIN { + # Check backward compatibility support + # By setting the environment variable MTR_VERSION + # it's possible to use a previous version of + # mysql-test-run.pl + my $version= $ENV{MTR_VERSION} || 2; + if ( $version == 1 ) + { + print "=======================================================\n"; + print " WARNING: Using mysql-test-run.pl version 1! \n"; + print "=======================================================\n"; + require "lib/v1/mysql-test-run.pl"; + exit(1); + } + elsif ( $version == 2 ) + { + # This is the current version, just continue + ; + } + else + { + print "ERROR: Version $version of mysql-test-run does not exist!\n"; + exit(1); + } +} + +use lib "lib"; -#require 5.6.1; -use File::Path; -use File::Basename; -use File::Copy; -use File::Temp qw /tempdir/; -use File::Spec::Functions qw /splitdir/; use Cwd; use Getopt::Long; -use IO::Socket; +use My::File::Path; # Patched version of File::Path +use File::Basename; +use File::Copy; +use File::Find; +use File::Temp qw / tempdir /; +use File::Spec::Functions qw / splitdir /; +use My::Platform; +use My::SafeProcess; +use My::ConfigFactory; +use My::Options; +use My::Find; +use My::SysInfo; +use My::CoreDump; +use mtr_cases; +use mtr_report; +use mtr_match; +use mtr_unique; use IO::Socket::INET; -use strict; -use warnings; - -select(STDOUT); -$| = 1; # Automatically flush STDOUT +use IO::Select; -our $glob_win32_perl= ($^O eq "MSWin32"); # ActiveState Win32 Perl -our $glob_cygwin_perl= ($^O eq "cygwin"); # Cygwin Perl -our $glob_win32= ($glob_win32_perl or $glob_cygwin_perl); -our $glob_netware= ($^O eq "NetWare"); # NetWare - -require "lib/mtr_cases.pl"; -require "lib/mtr_im.pl"; require "lib/mtr_process.pl"; -require "lib/mtr_timer.pl"; require "lib/mtr_io.pl"; require "lib/mtr_gcov.pl"; -require "lib/mtr_gprof.pl"; -require "lib/mtr_report.pl"; -require "lib/mtr_match.pl"; require "lib/mtr_misc.pl"; -require "lib/mtr_stress.pl"; -require "lib/mtr_unique.pl"; - -$Devel::Trace::TRACE= 1; -############################################################################## -# -# Default settings -# -############################################################################## +$SIG{INT}= sub { mtr_error("Got ^C signal"); }; -# Misc global variables our $mysql_version_id; -our $glob_mysql_test_dir= undef; -our $glob_mysql_bench_dir= undef; -our $glob_scriptname= undef; -our $glob_timers= undef; -our $glob_use_embedded_server= 0; -our @glob_test_mode; - -our $glob_basedir; +our $glob_mysql_test_dir; +our $basedir; our $path_charsetsdir; our $path_client_bindir; our $path_client_libdir; -our $path_share; our $path_language; -our $path_timefile; -our $path_snapshot; -our $path_mysqltest_log; -our $path_current_test_log; -our $path_my_basedir; -our $opt_vardir; # A path but set directly on cmd line -our $path_vardir_trace; # unix formatted opt_vardir for trace files -our $opt_tmpdir; # A path but set directly on cmd line +our $path_current_testlog; +our $path_testlog; + +our $default_vardir; +our $opt_vardir; # Path to use for var/ dir +my $path_vardir_trace; # unix formatted opt_vardir for trace files +my $opt_tmpdir; # Path to use for tmp/ dir +my $path_config_file; # The generated config file, var/my.cnf # Visual Studio produces executables in different sub-directories based on the # configuration used to build them. To make life easier, an environment @@ -131,71 +115,41 @@ our $opt_tmpdir; # A path but set directly on cmd line # executables will be used by the test suite. our $opt_vs_config = $ENV{'MTR_VS_CONFIG'}; -our $default_vardir; +my $DEFAULT_SUITES= "binlog,federated,main,maria,ndb,rpl,rpl_ndb"; +my $opt_suites; -our $opt_usage; -our $opt_list_options; -our $opt_suites; -our $opt_suites_default= "main,binlog,rpl,rpl_ndb,ndb,maria"; # Default suites to run -our $opt_script_debug= 0; # Script debugging, enable with --script-debug our $opt_verbose= 0; # Verbose output, enable with --verbose - -our $exe_master_mysqld; our $exe_mysql; our $exe_mysqladmin; -our $exe_mysql_upgrade; -our $exe_mysqlbinlog; -our $exe_mysql_client_test; -our $exe_bug25714; -our $exe_mysqld; -our $exe_mysqlcheck; -our $exe_mysqldump; -our $exe_mysqlslap; -our $exe_mysqlimport; -our $exe_mysqlshow; -our $exe_mysql_fix_system_tables; -our $file_mysql_fix_privilege_tables; our $exe_mysqltest; -our $exe_ndbd; -our $exe_ndb_mgmd; -our $exe_slave_mysqld; -our $exe_im; -our $exe_my_print_defaults; -our $exe_perror; -our $lib_udf_example; -our $lib_example_plugin; our $exe_libtool; -our $opt_bench= 0; -our $opt_small_bench= 0; our $opt_big_test= 0; our @opt_combinations; -our $opt_skip_combination; our @opt_extra_mysqld_opt; our @opt_extra_mysqltest_opt; -our $opt_compress; -our $opt_ssl; -our $opt_ssl_supported; -our $opt_ps_protocol; -our $opt_sp_protocol; -our $opt_cursor_protocol; -our $opt_view_protocol; +my $opt_compress; +my $opt_ssl; +my $opt_skip_ssl = 1; # Until bug#42366 has been fixed +my $opt_ssl_supported; +my $opt_ps_protocol; +my $opt_sp_protocol; +my $opt_cursor_protocol; +my $opt_view_protocol; our $opt_debug; -our $opt_do_test; our @opt_cases; # The test cases names in argv our $opt_embedded_server; -our $opt_extern= 0; -our $opt_socket; +# Options used when connecting to an already running server +my %opts_extern; +sub using_extern { return (keys %opts_extern > 0);}; -our $opt_fast; +our $opt_fast= 0; our $opt_force; -our $opt_reorder= 0; -our $opt_enable_disabled; our $opt_mem= $ENV{'MTR_MEM'}; our $opt_gcov; @@ -210,59 +164,41 @@ our $opt_client_ddd; our $opt_manual_gdb; our $opt_manual_ddd; our $opt_manual_debug; -our $opt_mtr_build_thread=0; our $opt_debugger; our $opt_client_debugger; -our $opt_gprof; -our $opt_gprof_dir; -our $opt_gprof_master; -our $opt_gprof_slave; - -our $master; -our $slave; -our $clusters; - -our $instance_manager; +my $config; # The currently running config +my $current_config_name; # The currently running config file template -our $opt_master_myport; -our $opt_slave_myport; -our $im_port; -our $im_mysqld1_port; -our $im_mysqld2_port; -our $opt_ndbcluster_port; -our $opt_ndbconnectstring; -our $opt_ndbcluster_port_slave; -our $opt_ndbconnectstring_slave; +my $baseport; +my $opt_build_thread= $ENV{'MTR_BUILD_THREAD'} || "auto"; -our $opt_record; +my $opt_record; my $opt_report_features; -our $opt_check_testcases; -our $opt_mark_progress; -our $opt_skip_rpl; -our $max_slave_num= 0; -our $max_master_num= 1; -our $use_innodb; -our $opt_skip_test; -our $opt_skip_im; +our $opt_check_testcases= 1; +my $opt_mark_progress; -our $opt_sleep; +my $opt_sleep; -our $opt_testcase_timeout; -our $opt_suite_timeout; -my $default_testcase_timeout= 15; # 15 min max -my $default_suite_timeout= 300; # 5 hours max +my $opt_testcase_timeout= 15; # minutes +my $opt_suite_timeout = 300; # minutes +my $opt_shutdown_timeout= 10; # seconds +my $opt_start_timeout = 180; # seconds -our $opt_start_and_exit; -our $opt_start_dirty; -our $opt_start_from; +sub testcase_timeout { return $opt_testcase_timeout * 60; }; +sub suite_timeout { return $opt_suite_timeout * 60; }; +sub check_timeout { return $opt_testcase_timeout * 6; }; -our $opt_strace_client; +my $opt_start; +my $opt_start_dirty; +my $opt_repeat= 1; +my $opt_retry= 3; +my $opt_retry_failure= 2; -our $opt_timer= 1; +my $opt_strace_client; -our $opt_user; +our $opt_user = "root"; my $opt_valgrind= 0; my $opt_valgrind_mysqld= 0; @@ -272,289 +208,559 @@ my @valgrind_args; my $opt_valgrind_path; my $opt_callgrind; -our $opt_stress= ""; -our $opt_stress_suite= "main"; -our $opt_stress_mode= "random"; -our $opt_stress_threads= 5; -our $opt_stress_test_count= 0; -our $opt_stress_loop_count= 0; -our $opt_stress_test_duration= 0; -our $opt_stress_init_file= ""; -our $opt_stress_test_file= ""; - -our $opt_warnings; +our $opt_warnings= 1; our $opt_skip_ndbcluster= 0; -our $opt_skip_ndbcluster_slave= 0; -our $opt_with_ndbcluster= 0; -our $opt_with_ndbcluster_only= 0; -our $glob_ndbcluster_supported= 0; -our $opt_ndb_extra_test= 0; -our $opt_skip_master_binlog= 0; -our $opt_skip_slave_binlog= 0; - -our $exe_ndb_mgm; -our $exe_ndb_waiter; -our $path_ndb_tools_dir; -our $path_ndb_examples_dir; -our $exe_ndb_example; -our $path_ndb_testrun_log; - -our $path_sql_dir; - -our @data_dir_lst; - -our $used_binlog_format; -our $used_default_engine; + +my $exe_ndbd; +my $exe_ndb_mgmd; +my $exe_ndb_waiter; + our $debug_compiled_binaries; our %mysqld_variables; my $source_dist= 0; -our $opt_max_save_core= 5; -my $num_saved_cores= 0; # Number of core files saved in vardir/log/ so far. +my $opt_max_save_core= $ENV{MTR_MAX_SAVE_CORE} || 5; +my $opt_max_save_datadir= $ENV{MTR_MAX_SAVE_DATADIR} || 20; +my $opt_max_test_fail= $ENV{MTR_MAX_TEST_FAIL} || 10; -###################################################################### -# -# Function declarations -# -###################################################################### - -sub main (); -sub initial_setup (); -sub command_line_setup (); -sub set_mtr_build_thread_ports($); -sub datadir_list_setup (); -sub executable_setup (); -sub environment_setup (); -sub kill_running_servers (); -sub remove_stale_vardir (); -sub setup_vardir (); -sub check_ssl_support ($); -sub check_running_as_root(); -sub check_ndbcluster_support ($); -sub rm_ndbcluster_tables ($); -sub ndbcluster_start_install ($); -sub ndbcluster_start ($$); -sub ndbcluster_wait_started ($$); -sub mysqld_wait_started($); -sub run_benchmarks ($); -sub initialize_servers (); -sub mysql_install_db (); -sub install_db ($$); -sub copy_install_db ($$); -sub run_testcase ($); -sub run_testcase_stop_servers ($$$); -sub run_testcase_start_servers ($); -sub run_testcase_check_skip_test($); -sub report_failure_and_restart ($); -sub do_before_start_master ($); -sub do_before_start_slave ($); -sub ndbd_start ($$$); -sub ndb_mgmd_start ($); -sub mysqld_start ($$$); -sub mysqld_arguments ($$$$); -sub stop_all_servers (); -sub run_mysqltest ($); -sub usage ($); - - -###################################################################### -# -# Main program -# -###################################################################### +my $opt_parallel= $ENV{MTR_PARALLEL} || 1; + +select(STDOUT); +$| = 1; # Automatically flush STDOUT main(); -sub main () { + +sub main { + # Default, verbosity on + report_option('verbose', 0); + + # This is needed for test log evaluation in "gen-build-status-page" + # in all cases where the calling tool does not log the commands + # directly before it executes them, like "make test-force-pl" in RPM builds. + mtr_report("Logging: $0 ", join(" ", @ARGV)); command_line_setup(); - check_ndbcluster_support(\%mysqld_variables); - check_ssl_support(\%mysqld_variables); - check_debug_support(\%mysqld_variables); + if ( $opt_gcov ) { + gcov_prepare($basedir); + } + + if (!$opt_suites) { + $opt_suites= $DEFAULT_SUITES; + + # Check for any extra suites to enable based on the path name + my %extra_suites= + ( + "mysql-5.1-new-ndb" => "ndb_team", + "mysql-5.1-new-ndb-merge" => "ndb_team", + "mysql-5.1-telco-6.2" => "ndb_team", + "mysql-5.1-telco-6.2-merge" => "ndb_team", + "mysql-5.1-telco-6.3" => "ndb_team", + "mysql-6.0-ndb" => "ndb_team", + ); + + foreach my $dir ( reverse splitdir($basedir) ) { + my $extra_suite= $extra_suites{$dir}; + if (defined $extra_suite) { + mtr_report("Found extra suite: $extra_suite"); + $opt_suites= "$extra_suite,$opt_suites"; + last; + } + } + } - executable_setup(); + mtr_report("Collecting tests..."); + my $tests= collect_test_cases($opt_suites, \@opt_cases); + + if ( $opt_report_features ) { + # Put "report features" as the first test to run + my $tinfo = My::Test->new + ( + name => 'report_features', + # No result_file => Prints result + path => 'include/report-features.test', + template_path => "include/default_my.cnf", + master_opt => [], + slave_opt => [], + ); + unshift(@$tests, $tinfo); + } + + print "vardir: $opt_vardir\n"; + initialize_servers(); + + ####################################################################### + my $num_tests= @$tests; + if ( not defined $opt_parallel ) { + # Try to find a suitable value for number of workers + my $sys_info= My::SysInfo->new(); + + $opt_parallel= $sys_info->num_cpus(); + for my $limit (2000, 1500, 1000, 500){ + $opt_parallel-- if ($sys_info->min_bogomips() < $limit); + } + $opt_parallel= 8 if ($opt_parallel > 8); + $opt_parallel= $num_tests if ($opt_parallel > $num_tests); + $opt_parallel= 1 if (IS_WINDOWS and $sys_info->isvm()); + $opt_parallel= 1 if ($opt_parallel < 1); + mtr_report("Using parallel: $opt_parallel"); + } + + # Create server socket on any free port + my $server = new IO::Socket::INET + ( + LocalAddr => 'localhost', + Proto => 'tcp', + Listen => $opt_parallel, + ); + mtr_error("Could not create testcase server port: $!") unless $server; + my $server_port = $server->sockport(); + mtr_report("Using server port $server_port"); + + # Create child processes + my %children; + for my $child_num (1..$opt_parallel){ + my $child_pid= My::SafeProcess::Base::_safe_fork(); + if ($child_pid == 0){ + $server= undef; # Close the server port in child + $tests= {}; # Don't need the tests list in child + + # Use subdir of var and tmp unless only one worker + if ($opt_parallel > 1) { + set_vardir("$opt_vardir/$child_num"); + $opt_tmpdir= "$opt_tmpdir/$child_num"; + } - environment_setup(); - signal_setup(); + run_worker($server_port, $child_num); + exit(1); + } - if ( $opt_gcov ) - { - gcov_prepare(); + $children{$child_pid}= 1; } + ####################################################################### - if ( $opt_gprof ) + mtr_report(); + mtr_print_thick_line(); + mtr_print_header(); + + my $completed= run_test_server($server, $tests, $opt_parallel); + + # Send Ctrl-C to any children still running + kill("INT", keys(%children)); + + # Wait for childs to exit + foreach my $pid (keys %children) { - gprof_prepare(); + my $ret_pid= waitpid($pid, 0); + if ($ret_pid != $pid){ + mtr_report("Unknown process $ret_pid exited"); + } + else { + delete $children{$ret_pid}; + } } - if ( $opt_bench ) - { - initialize_servers(); - run_benchmarks(shift); # Shift what? Extra arguments?! + if ( not defined @$completed ) { + mtr_error("Test suite aborted"); } - elsif ( $opt_stress ) - { - initialize_servers(); - run_stress_test() + + if ( @$completed != $num_tests){ + + if ($opt_force){ + # All test should have been run, print any that are still in $tests + #foreach my $test ( @$tests ){ + # $test->print_test(); + #} + } + + # Not all tests completed, failure + mtr_report(); + mtr_report("Only ", int(@$completed), " of $num_tests completed."); + mtr_error("Not all tests completed"); } - else - { - # Figure out which tests we are going to run - if (!$opt_suites) - { - $opt_suites= $opt_suites_default; - - # Check for any extra suites to enable based on the path name - my %extra_suites= - ( - "mysql-5.1-new-ndb" => "ndb_team", - "mysql-5.1-new-ndb-merge" => "ndb_team", - "mysql-5.1-telco-6.2" => "ndb_team", - "mysql-5.1-telco-6.2-merge" => "ndb_team", - "mysql-5.1-telco-6.3" => "ndb_team", - "mysql-6.0-ndb" => "ndb_team", - ); - foreach my $dir ( reverse splitdir($glob_basedir) ) - { - my $extra_suite= $extra_suites{$dir}; - if (defined $extra_suite){ - mtr_report("Found extra suite: $extra_suite"); - $opt_suites= "$extra_suite,$opt_suites"; - last; - } + mtr_print_line(); + + if ( $opt_gcov ) { + gcov_collect($basedir, $opt_gcov, + $opt_gcov_msg, $opt_gcov_err); + } + + mtr_report_stats($completed); + + exit(0); +} + + +sub run_test_server ($$$) { + my ($server, $tests, $childs) = @_; + + my $num_saved_cores= 0; # Number of core files saved in vardir/log/ so far. + my $num_saved_datadir= 0; # Number of datadirs saved in vardir/log/ so far. + my $num_failed_test= 0; # Number of tests failed so far + + # Scheduler variables + my $max_ndb= $childs / 2; + $max_ndb = 4 if $max_ndb > 4; + $max_ndb = 1 if $max_ndb < 1; + my $num_ndb_tests= 0; + + my $completed= []; + my %running; + my $result; + + my $suite_timeout_proc= My::SafeProcess->timer(suite_timeout()); + + my $s= IO::Select->new(); + $s->add($server); + while (1) { + my @ready = $s->can_read(1); # Wake up once every second + foreach my $sock (@ready) { + if ($sock == $server) { + # New client connected + my $child= $sock->accept(); + mtr_verbose("Client connected"); + $s->add($child); + print $child "HELLO\n"; } - } + else { + my $line= <$sock>; + if (!defined $line) { + # Client disconnected + mtr_verbose("Child closed socket"); + $s->remove($sock); + if (--$childs == 0){ + $suite_timeout_proc->kill(); + return $completed; + } + next; + } + chomp($line); + + if ($line eq 'TESTRESULT'){ + $result= My::Test::read_test($sock); + # $result->print_test(); + + # Report test status + mtr_report_test($result); + + if ( $result->is_failed() ) { + + # Save the workers "savedir" in var/log + my $worker_savedir= $result->{savedir}; + my $worker_savename= basename($worker_savedir); + my $savedir= "$opt_vardir/log/$worker_savename"; + + if ($opt_max_save_datadir > 0 && + $num_saved_datadir >= $opt_max_save_datadir) + { + mtr_report(" - skipping '$worker_savedir/'"); + rmtree($worker_savedir); + } + else { + mtr_report(" - saving '$worker_savedir/' to '$savedir/'"); + rename($worker_savedir, $savedir); + # Move any core files from e.g. mysqltest + foreach my $coref (glob("core*"), glob("*.dmp")) + { + mtr_report(" - found '$coref', moving it to '$savedir'"); + move($coref, $savedir); + } + if ($opt_max_save_core > 0) { + # Limit number of core files saved + find({ no_chdir => 1, + wanted => sub { + my $core_file= $File::Find::name; + my $core_name= basename($core_file); + + if ($core_name =~ /^core/ or # Starting with core + (IS_WINDOWS and $core_name =~ /\.dmp$/)){ + # Ending with .dmp + mtr_report(" - found '$core_name'", + "($num_saved_cores/$opt_max_save_core)"); + + My::CoreDump->show($core_file); + + if ($num_saved_cores >= $opt_max_save_core) { + mtr_report(" - deleting it, already saved", + "$opt_max_save_core"); + unlink("$core_file"); + } + ++$num_saved_cores; + } + } + }, + $savedir); + } + } + $num_saved_datadir++; + + if ( !$opt_force ) { + # Test has failed, force is off + $suite_timeout_proc->kill(); + push(@$completed, $result); + return $completed; + } + elsif ($opt_max_test_fail > 0 and + $num_failed_test >= $opt_max_test_fail) { + $suite_timeout_proc->kill(); + mtr_report("Too many tests($num_failed_test) failed!", + "Terminating..."); + return undef; + } + $num_failed_test++; + } + + # Retry test run after test failure + my $retries= $result->{retries} || 2; + my $test_has_failed= $result->{failures} || 0; + if ($test_has_failed and $retries <= $opt_retry){ + # Test should be run one more time unless it has failed + # too many times already + my $failures= $result->{failures}; + if ($opt_retry > 1 and $failures >= $opt_retry_failure){ + mtr_report("\nTest has failed $failures times,", + "no more retries!\n"); + } + else { + mtr_report("\nRetrying test, attempt($retries/$opt_retry)...\n"); + delete($result->{result}); + $result->{retries}= $retries+1; + $result->write_test($sock, 'TESTCASE'); + next; + } + } - my $tests= collect_test_cases($opt_suites); + # Repeat test $opt_repeat number of times + my $repeat= $result->{repeat} || 1; + if ($repeat < $opt_repeat) + { + $result->{retries}= 0; + $result->{failures}= 0; + delete($result->{result}); + $result->{repeat}= $repeat+1; + $result->write_test($sock, 'TESTCASE'); + next; + } - # Turn off NDB and other similar options if no tests use it - my ($need_ndbcluster,$need_im, $need_debug); - foreach my $test (@$tests) - { - next if $test->{skip}; + # Remove from list of running + mtr_error("'", $result->{name},"' is not known to be running") + unless delete $running{$result->key()}; - if (!$opt_extern) - { - $need_ndbcluster||= $test->{ndb_test}; - $need_debug||=$test->{need_debug}; - $need_im||= $test->{component_id} eq 'im'; - - # Count max number of slaves used by a test case - if ( $test->{slave_num} > $max_slave_num) { - $max_slave_num= $test->{slave_num}; - mtr_error("Too many slaves") if $max_slave_num > 3; + # Update scheduler variables + $num_ndb_tests-- if ($result->{ndb_test}); + + # Save result in completed list + push(@$completed, $result); + + } + elsif ($line eq 'START'){ + ; # Send first test + } + else { + mtr_error("Unknown response: '$line' from client"); + } + + # Find next test to schedule + # - Try to use same configuration as worker used last time + # - Limit number of parallel ndb tests + + my $next; + my $second_best; + for(my $i= 0; $i <= @$tests; $i++) + { + my $t= $tests->[$i]; + + last unless defined $t; + + if (run_testcase_check_skip_test($t)){ + # Move the test to completed list + #mtr_report("skip - Moving test $i to completed"); + push(@$completed, splice(@$tests, $i, 1)); + + # Since the test at pos $i was taken away, next + # test will also be at $i -> redo + redo; + } + + # Limit number of parallell NDB tests + if ($t->{ndb_test} and $num_ndb_tests >= $max_ndb){ + #mtr_report("Skipping, num ndb is already at max, $num_ndb_tests"); + next; + } + + # Prefer same configuration + if (defined $result and + $result->{template_path} eq $t->{template_path}) + { + #mtr_report("Test uses same config => good match"); + # Test uses same config => good match + $next= splice(@$tests, $i, 1); + last; + } + + # Second best choice is the first that does not fulfill + # any of the above conditions + if (!defined $second_best){ + #mtr_report("Setting second_best to $i"); + $second_best= $i; + } + } + + # Use second best choice if no other test has been found + if (!$next and defined $second_best){ + #mtr_report("Take second best choice $second_best"); + mtr_error("Internal error, second best too large($second_best)") + if $second_best > $#$tests; + $next= splice(@$tests, $second_best, 1); } - # Count max number of masters used by a test case - if ( $test->{master_num} > $max_master_num) { - $max_master_num= $test->{master_num}; - mtr_error("Too many masters") if $max_master_num > 2; - mtr_error("Too few masters") if $max_master_num < 1; + if ($next) { + #$next->print_test(); + $next->write_test($sock, 'TESTCASE'); + $running{$next->key()}= $next; + $num_ndb_tests++ if ($next->{ndb_test}); + } + else { + # No more test, tell child to exit + #mtr_report("Saying BYE to child"); + print $sock "BYE\n"; } } - $use_innodb||= $test->{'innodb_test'}; } - # Check if cluster can be skipped - if ( !$need_ndbcluster ) + # ---------------------------------------------------- + # Check if test suite timer expired + # ---------------------------------------------------- + if ( ! $suite_timeout_proc->wait_one(0) ) { - $opt_skip_ndbcluster= 1; - $opt_skip_ndbcluster_slave= 1; + mtr_report("Test suite timeout! Terminating..."); + return undef; } + } +} - if ( !$need_debug && !$opt_debug) - { - $opt_debug=0; - } - # Check if slave cluster can be skipped - if ($max_slave_num == 0) - { - $opt_skip_ndbcluster_slave= 1; - } +sub run_worker ($) { + my ($server_port, $thread_num)= @_; - # Check if im can be skipped - if ( ! $need_im ) - { - $opt_skip_im= 1; - } + $SIG{INT}= sub { exit(1); }; - initialize_servers(); + # Connect to server + my $server = new IO::Socket::INET + ( + PeerAddr => 'localhost', + PeerPort => $server_port, + Proto => 'tcp' + ); + mtr_error("Could not connect to server at port $server_port: $!") + unless $server; - if ( $opt_report_features ) { - run_report_features(); - } + # -------------------------------------------------------------------------- + # Set worker name + # -------------------------------------------------------------------------- + report_option('name',"worker[$thread_num]"); - run_tests($tests); - } + # -------------------------------------------------------------------------- + # Use auto build thread in all but first worker + # -------------------------------------------------------------------------- + set_build_thread_ports($thread_num > 1 ? 'auto' : $opt_build_thread); - mtr_exit(0); -} + if (check_ports_free()){ + # Some port was not free(which one has already been printed) + mtr_error("Some port(s) was not free") + } -############################################################################## -# -# Default settings -# -############################################################################## + # -------------------------------------------------------------------------- + # Turn off verbosity in workers, unless explicitly specified + # -------------------------------------------------------------------------- + report_option('verbose', undef) if ($opt_verbose == 0); -# -# When an option is no longer used by this program, it must be explicitly -# ignored or else it will be passed through to mysqld. GetOptions will call -# this subroutine once for each such option on the command line. See -# Getopt::Long documentation. -# + environment_setup(); -sub warn_about_removed_option { - my ($option, $value, $hash_value) = @_; + # Read hello from server which it will send when shared + # resources have been setup + my $hello= <$server>; - warn "WARNING: This option is no longer used, and is ignored: --$option\n"; -} + setup_vardir(); + check_running_as_root(); -sub command_line_setup () { + if ( using_extern() ) { + create_config_file_for_extern(%opts_extern); + } - # These are defaults for things that are set on the command line + # Ask server for first test + print $server "START\n"; - my $opt_comment; + while(my $line= <$server>){ + chomp($line); + if ($line eq 'TESTCASE'){ + my $test= My::Test::read_test($server); + #$test->print_test(); - # Magic number -69.4 results in traditional test ports starting from 9306. - set_mtr_build_thread_ports(-69.4); + # Clear comment and logfile, to avoid + # reusing them from previous test + delete($test->{'comment'}); + delete($test->{'logfile'}); - # If so requested, we try to avail ourselves of a unique build thread number. - if ( $ENV{'MTR_BUILD_THREAD'} ) { - if ( lc($ENV{'MTR_BUILD_THREAD'}) eq 'auto' ) { - print "Requesting build thread... "; - $ENV{'MTR_BUILD_THREAD'} = mtr_require_unique_id_and_wait("/tmp/mysql-test-ports", 200, 299); - print "got ".$ENV{'MTR_BUILD_THREAD'}."\n"; + run_testcase($test); + #$test->{result}= 'MTR_RES_PASSED'; + # Send it back, now with results set + #$test->print_test(); + $test->write_test($server, 'TESTRESULT'); + } + elsif ($line eq 'BYE'){ + mtr_report("Server said BYE"); + exit(0); + } + else { + mtr_error("Could not understand server, '$line'"); } } - if ( $ENV{'MTR_BUILD_THREAD'} ) - { - set_mtr_build_thread_ports($ENV{'MTR_BUILD_THREAD'}); - } + stop_all_servers(); - # This is needed for test log evaluation in "gen-build-status-page" - # in all cases where the calling tool does not log the commands - # directly before it executes them, like "make test-force-pl" in RPM builds. - print "Logging: $0 ", join(" ", @ARGV), "\n"; + exit(1); +} - # Read the command line - # Note: Keep list, and the order, in sync with usage at end of this file - # Options that are no longer used must still be processed, because all - # unprocessed options are passed directly to mysqld. The user will be - # warned that the option is being ignored. - # - # Put the complete option string here. For example, to remove the --suite - # option, remove it from GetOptions() below and put 'suite|suites=s' here. - my @removed_options = ( - ); +sub ignore_option { + my ($opt, $value)= @_; + mtr_report("Ignoring option '$opt'"); +} + + + +# Setup any paths that are $opt_vardir related +sub set_vardir { + my ($vardir)= @_; + + $opt_vardir= $vardir; + + $path_vardir_trace= $opt_vardir; + # Chop off any "c:", DBUG likes a unix path ex: c:/src/... => /src/... + $path_vardir_trace=~ s/^\w://; + + # Location of my.cnf that all clients use + $path_config_file= "$opt_vardir/my.cnf"; + + $path_testlog= "$opt_vardir/log/mysqltest.log"; + $path_current_testlog= "$opt_vardir/log/current_test"; +} + + +sub command_line_setup { + my $opt_comment; + my $opt_usage; + my $opt_list_options; + + # Read the command line options + # Note: Keep list, and the order, in sync with usage at end of this file Getopt::Long::Configure("pass_through"); my %options=( # Control what engine/variation to run @@ -566,43 +772,37 @@ sub command_line_setup () { 'ssl|with-openssl' => \$opt_ssl, 'skip-ssl' => \$opt_skip_ssl, 'compress' => \$opt_compress, - 'bench' => \$opt_bench, - 'small-bench' => \$opt_small_bench, - 'with-ndbcluster|ndb' => \$opt_with_ndbcluster, - 'vs-config' => \$opt_vs_config, + 'vs-config' => \$opt_vs_config, + + # Max number of parallel threads to use + 'parallel=i' => \$opt_parallel, + + # Config file to use as template for all tests + 'defaults-file=s' => \&collect_option, + # Extra config file to append to all generated configs + 'defaults-extra-file=s' => \&collect_option, # Control what test suites or cases to run 'force' => \$opt_force, - 'with-ndbcluster-only' => \$opt_with_ndbcluster_only, + 'with-ndbcluster-only' => \&collect_option, 'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster, - 'skip-ndbcluster-slave|skip-ndb-slave' - => \$opt_skip_ndbcluster_slave, - 'ndb-extra-test' => \$opt_ndb_extra_test, - 'skip-master-binlog' => \$opt_skip_master_binlog, - 'skip-slave-binlog' => \$opt_skip_slave_binlog, - 'do-test=s' => \$opt_do_test, - 'start-from=s' => \$opt_start_from, 'suite|suites=s' => \$opt_suites, - 'skip-rpl' => \$opt_skip_rpl, - 'skip-im' => \$opt_skip_im, - 'skip-test=s' => \$opt_skip_test, + 'skip-rpl' => \&collect_option, + 'skip-test=s' => \&collect_option, + 'do-test=s' => \&collect_option, + 'start-from=s' => \&collect_option, 'big-test' => \$opt_big_test, - 'combination=s' => \@opt_combinations, - 'skip-combination' => \$opt_skip_combination, + 'combination=s' => \@opt_combinations, + 'skip-combinations' => \&collect_option, + + 'skip-im' => \&ignore_option, # Specify ports - 'master_port=i' => \$opt_master_myport, - 'slave_port=i' => \$opt_slave_myport, - 'ndbcluster-port|ndbcluster_port=i' => \$opt_ndbcluster_port, - 'ndbcluster-port-slave=i' => \$opt_ndbcluster_port_slave, - 'im-port=i' => \$im_port, # Instance Manager port. - 'im-mysqld1-port=i' => \$im_mysqld1_port, # Port of mysqld, controlled by IM - 'im-mysqld2-port=i' => \$im_mysqld2_port, # Port of mysqld, controlled by IM - 'mtr-build-thread=i' => \$opt_mtr_build_thread, + 'build-thread|mtr-build-thread=i' => \$opt_build_thread, # Test case authoring 'record' => \$opt_record, - 'check-testcases' => \$opt_check_testcases, + 'check-testcases!' => \$opt_check_testcases, 'mark-progress' => \$opt_mark_progress, # Extra options used when starting mysqld @@ -612,11 +812,10 @@ sub command_line_setup () { 'mysqltest=s' => \@opt_extra_mysqltest_opt, # Run test on running server - 'extern' => \$opt_extern, - 'ndb-connectstring=s' => \$opt_ndbconnectstring, - 'ndb-connectstring-slave=s' => \$opt_ndbconnectstring_slave, + 'extern=s' => \%opts_extern, # Append to hash # Debugging + 'debug' => \$opt_debug, 'gdb' => \$opt_gdb, 'client-gdb' => \$opt_client_gdb, 'manual-gdb' => \$opt_manual_gdb, @@ -626,14 +825,13 @@ sub command_line_setup () { 'manual-ddd' => \$opt_manual_ddd, 'debugger=s' => \$opt_debugger, 'client-debugger=s' => \$opt_client_debugger, - 'strace-client' => \$opt_strace_client, - 'master-binary=s' => \$exe_master_mysqld, - 'slave-binary=s' => \$exe_slave_mysqld, + 'strace-client:s' => \$opt_strace_client, 'max-save-core=i' => \$opt_max_save_core, + 'max-save-datadir=i' => \$opt_max_save_datadir, + 'max-test-fail=i' => \$opt_max_test_fail, # Coverage, profiling etc 'gcov' => \$opt_gcov, - 'gprof' => \$opt_gprof, 'valgrind|valgrind-all' => \$opt_valgrind, 'valgrind-mysqltest' => \$opt_valgrind_mysqltest, 'valgrind-mysqld' => \$opt_valgrind_mysqld, @@ -652,21 +850,9 @@ sub command_line_setup () { 'valgrind-path=s' => \$opt_valgrind_path, 'callgrind' => \$opt_callgrind, - # Stress testing - 'stress' => \$opt_stress, - 'stress-suite=s' => \$opt_stress_suite, - 'stress-threads=i' => \$opt_stress_threads, - 'stress-test-file=s' => \$opt_stress_test_file, - 'stress-init-file=s' => \$opt_stress_init_file, - 'stress-mode=s' => \$opt_stress_mode, - 'stress-loop-count=i' => \$opt_stress_loop_count, - 'stress-test-count=i' => \$opt_stress_test_count, - 'stress-test-duration=i' => \$opt_stress_test_duration, - # Directories 'tmpdir=s' => \$opt_tmpdir, 'vardir=s' => \$opt_vardir, - 'benchdir=s' => \$glob_mysql_bench_dir, 'mem' => \$opt_mem, 'client-bindir=s' => \$path_client_bindir, 'client-libdir=s' => \$path_client_libdir, @@ -674,52 +860,40 @@ sub command_line_setup () { # Misc 'report-features' => \$opt_report_features, 'comment=s' => \$opt_comment, - 'debug' => \$opt_debug, 'fast' => \$opt_fast, - 'reorder' => \$opt_reorder, - 'enable-disabled' => \$opt_enable_disabled, - 'script-debug' => \$opt_script_debug, - 'verbose' => \$opt_verbose, + 'reorder!' => \&collect_option, + 'enable-disabled' => \&collect_option, + 'verbose+' => \$opt_verbose, + 'verbose-restart' => \&report_option, 'sleep=i' => \$opt_sleep, - 'socket=s' => \$opt_socket, 'start-dirty' => \$opt_start_dirty, - 'start-and-exit' => \$opt_start_and_exit, - 'timer!' => \$opt_timer, + 'start' => \$opt_start, + 'print-testcases' => \&collect_option, + 'repeat=i' => \$opt_repeat, + 'retry=i' => \$opt_retry, + 'retry-failure=i' => \$opt_retry_failure, + 'timer!' => \&report_option, 'user=s' => \$opt_user, 'testcase-timeout=i' => \$opt_testcase_timeout, 'suite-timeout=i' => \$opt_suite_timeout, - 'warnings|log-warnings' => \$opt_warnings, - - # Options which are no longer used - (map { $_ => \&warn_about_removed_option } @removed_options), + 'shutdown-timeout=i' => \$opt_shutdown_timeout, + 'warnings!' => \$opt_warnings, + 'timestamp' => \&report_option, + 'timediff' => \&report_option, 'help|h' => \$opt_usage, 'list-options' => \$opt_list_options, ); GetOptions(%options) or usage("Can't read options"); - usage("") if $opt_usage; list_options(\%options) if $opt_list_options; - $glob_scriptname= basename($0); - - if ($opt_mtr_build_thread != 0) - { - set_mtr_build_thread_ports($opt_mtr_build_thread) - } - elsif ($ENV{'MTR_BUILD_THREAD'}) - { - $opt_mtr_build_thread= $ENV{'MTR_BUILD_THREAD'}; - } - - # We require that we are in the "mysql-test" directory - # to run mysql-test-run - if (! -f $glob_scriptname) - { - mtr_error("Can't find the location for the mysql-test-run script\n" . - "Go to to the mysql-test directory and execute the script " . - "as follows:\n./$glob_scriptname"); + # -------------------------------------------------------------------------- + # Setup verbosity + # -------------------------------------------------------------------------- + if ($opt_verbose != 0){ + report_option('verbose', $opt_verbose); } if ( -d "../sql" ) @@ -728,77 +902,28 @@ sub command_line_setup () { } # Find the absolute path to the test directory - $glob_mysql_test_dir= cwd(); - if ( $glob_cygwin_perl ) + $glob_mysql_test_dir= cwd(); + if (IS_CYGWIN) { - # Windows programs like 'mysqld' needs Windows paths - $glob_mysql_test_dir= `cygpath -m "$glob_mysql_test_dir"`; - chomp($glob_mysql_test_dir); + # Use mixed path format i.e c:/path/to/ + $glob_mysql_test_dir= mixed_path($glob_mysql_test_dir); } - $default_vardir= "$glob_mysql_test_dir/var"; # In most cases, the base directory we find everything relative to, # is the parent directory of the "mysql-test" directory. For source # distributions, TAR binary distributions and some other packages. - $glob_basedir= dirname($glob_mysql_test_dir); + $basedir= dirname($glob_mysql_test_dir); # In the RPM case, binaries and libraries are installed in the # default system locations, instead of having our own private base # directory. And we install "/usr/share/mysql-test". Moving up one # more directory relative to "mysql-test" gives us a usable base # directory for RPM installs. - if ( ! $source_dist and ! -d "$glob_basedir/bin" ) - { - $glob_basedir= dirname($glob_basedir); - } - - # Expect mysql-bench to be located adjacent to the source tree, by default - $glob_mysql_bench_dir= "$glob_basedir/../mysql-bench" - unless defined $glob_mysql_bench_dir; - $glob_mysql_bench_dir= undef - unless -d $glob_mysql_bench_dir; - - $path_my_basedir= - $source_dist ? $glob_mysql_test_dir : $glob_basedir; - - $glob_timers= mtr_init_timers(); - - # -------------------------------------------------------------------------- - # Embedded server flag - # -------------------------------------------------------------------------- - if ( $opt_embedded_server ) + if ( ! $source_dist and ! -d "$basedir/bin" ) { - $glob_use_embedded_server= 1; - # Add the location for libmysqld.dll to the path. - if ( $glob_win32 ) - { - my $lib_mysqld= - mtr_path_exists(vs_config_dirs('libmysqld','')); - $lib_mysqld= $glob_cygwin_perl ? ":".`cygpath "$lib_mysqld"` - : ";".$lib_mysqld; - chomp($lib_mysqld); - $ENV{'PATH'}="$ENV{'PATH'}".$lib_mysqld; - } - - push(@glob_test_mode, "embedded"); - $opt_skip_rpl= 1; # We never run replication with embedded - $opt_skip_ndbcluster= 1; # Turn off use of NDB cluster - $opt_skip_ssl= 1; # Turn off use of SSL - - # Turn off use of bin log - push(@opt_extra_mysqld_opt, "--skip-log-bin"); - - if ( $opt_extern ) - { - mtr_error("Can't use --extern with --embedded-server"); - } + $basedir= dirname($basedir); } - # - # Find the mysqld executable to be able to find the mysqld version - # number as early as possible - # - # Look for the client binaries directory if ($path_client_bindir) { @@ -807,52 +932,38 @@ sub command_line_setup () { } else { - $path_client_bindir= mtr_path_exists("$glob_basedir/client_release", - "$glob_basedir/client_debug", + $path_client_bindir= mtr_path_exists("$basedir/client_release", + "$basedir/client_debug", vs_config_dirs('client', ''), - "$glob_basedir/client", - "$glob_basedir/bin"); + "$basedir/client", + "$basedir/bin"); } - + # Look for language files and charsetsdir, use same share - $path_share= mtr_path_exists("$glob_basedir/share/mysql", - "$glob_basedir/sql/share", - "$glob_basedir/share"); + my $path_share= mtr_path_exists("$basedir/share/mysql", + "$basedir/sql/share", + "$basedir/share"); $path_language= mtr_path_exists("$path_share/english"); $path_charsetsdir= mtr_path_exists("$path_share/charsets"); - - if (!$opt_extern) + if (using_extern()) { - $exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'), - vs_config_dirs('sql', 'mysqld-debug'), - "$glob_basedir/sql/mysqld", - "$path_client_bindir/mysqld-max-nt", - "$path_client_bindir/mysqld-max", - "$path_client_bindir/mysqld-nt", - "$path_client_bindir/mysqld", - "$path_client_bindir/mysqld-debug", - "$path_client_bindir/mysqld-max", - "$glob_basedir/libexec/mysqld", - "$glob_basedir/bin/mysqld", - "$glob_basedir/sbin/mysqld"); - - # Use the mysqld found above to find out what features are available - collect_mysqld_features(); + # Connect to the running mysqld and find out what it supports + collect_mysqld_features_from_running_server(); } else { - $mysqld_variables{'port'}= 3306; - $mysqld_variables{'master-port'}= 3306; + # Run the mysqld to find out what features are available + collect_mysqld_features(); } if ( $opt_comment ) { - print "\n"; - print '#' x 78, "\n"; - print "# $opt_comment\n"; - print '#' x 78, "\n\n"; + mtr_report(); + mtr_print_thick_line('#'); + mtr_report("# $opt_comment"); + mtr_print_thick_line('#'); } foreach my $arg ( @ARGV ) @@ -877,25 +988,22 @@ sub command_line_setup () { } } + if ( @opt_cases ) + { + # Run big tests if explicitely specified on command line + $opt_big_test= 1; + } + # -------------------------------------------------------------------------- # Find out type of logging that are being used # -------------------------------------------------------------------------- - if (!$opt_extern && $mysql_version_id >= 50100 ) + foreach my $arg ( @opt_extra_mysqld_opt ) { - foreach my $arg ( @opt_extra_mysqld_opt ) - { - if ( $arg =~ /binlog[-_]format=(\S+)/ ) - { - $used_binlog_format= $1; - } - } - if (defined $used_binlog_format) - { - mtr_report("Using binlog format '$used_binlog_format'"); - } - else + if ( $arg =~ /binlog[-_]format=(\S+)/ ) { - mtr_report("Using dynamic switching of binlog format"); + # Save this for collect phase + collect_option('binlog-format', $1); + mtr_report("Using binlog format '$1'"); } } @@ -903,26 +1011,20 @@ sub command_line_setup () { # -------------------------------------------------------------------------- # Find out default storage engine being used(if any) # -------------------------------------------------------------------------- - if ( $opt_with_ndbcluster ) - { - # --ndb or --with-ndbcluster turns on --default-storage-engine=ndbcluster - push(@opt_extra_mysqld_opt, "--default-storage-engine=ndbcluster"); - } - foreach my $arg ( @opt_extra_mysqld_opt ) { if ( $arg =~ /default-storage-engine=(\S+)/ ) { - $used_default_engine= $1; + # Save this for collect phase + collect_option('default-storage-engine', $1); + mtr_report("Using default engine '$1'") } } - mtr_report("Using default engine '$used_default_engine'") - if defined $used_default_engine; # -------------------------------------------------------------------------- # Check if we should speed up tests by trying to run on tmpfs # -------------------------------------------------------------------------- - if ( defined $opt_mem ) + if ( defined $opt_mem) { mtr_error("Can't use --mem and --vardir at the same time ") if $opt_vardir; @@ -930,7 +1032,7 @@ sub command_line_setup () { if $opt_tmpdir; # Search through list of locations that are known - # to be "fast disks" to list to find a suitable location + # to be "fast disks" to find a suitable location # Use --mem=<dir> as first location to look. my @tmpfs_locations= ($opt_mem, "/dev/shm", "/tmp"); @@ -938,72 +1040,56 @@ sub command_line_setup () { { if ( -d $fs ) { - mtr_report("Using tmpfs in $fs"); - $opt_mem= "$fs/var"; - $opt_mem .= $opt_mtr_build_thread if $opt_mtr_build_thread; + my $template= "var_${opt_build_thread}_XXXX"; + $opt_mem= tempdir( $template, DIR => $fs, CLEANUP => 0); last; } } } # -------------------------------------------------------------------------- - # Set the "var/" directory, as it is the base for everything else + # Set the "var/" directory, the base for everything else # -------------------------------------------------------------------------- + $default_vardir= "$glob_mysql_test_dir/var"; if ( ! $opt_vardir ) { $opt_vardir= $default_vardir; } - elsif ( $mysql_version_id < 50000 and - $opt_vardir ne $default_vardir) - { - # Version 4.1 and --vardir was specified - # Only supported as a symlink from var/ - # by setting up $opt_mem that symlink will be created - if ( ! $glob_win32 ) - { - # Only platforms that have native symlinks can use the vardir trick - $opt_mem= $opt_vardir; - mtr_report("Using 4.1 vardir trick"); - } - - $opt_vardir= $default_vardir; - } - - $path_vardir_trace= $opt_vardir; - # Chop off any "c:", DBUG likes a unix path ex: c:/src/... => /src/... - $path_vardir_trace=~ s/^\w://; # We make the path absolute, as the server will do a chdir() before usage unless ( $opt_vardir =~ m,^/, or - ($glob_win32 and $opt_vardir =~ m,^[a-z]:/,i) ) + (IS_WINDOWS and $opt_vardir =~ m,^[a-z]:/,i) ) { # Make absolute path, relative test dir $opt_vardir= "$glob_mysql_test_dir/$opt_vardir"; } + set_vardir($opt_vardir); + # -------------------------------------------------------------------------- - # Set tmpdir + # Set the "tmp" directory # -------------------------------------------------------------------------- - $opt_tmpdir= "$opt_vardir/tmp" unless $opt_tmpdir; + if ( ! $opt_tmpdir ) + { + $opt_tmpdir= "$opt_vardir/tmp" unless $opt_tmpdir; + + if (check_socket_path_length("$opt_tmpdir/testsocket.sock")) + { + mtr_report("Too long tmpdir path '$opt_tmpdir'", + " creating a shorter one..."); + + # Create temporary directory in standard location for temporary files + $opt_tmpdir= tempdir( TMPDIR => 1, CLEANUP => 1 ); + mtr_report(" - using tmpdir: '$opt_tmpdir'\n"); + } + } $opt_tmpdir =~ s,/+$,,; # Remove ending slash if any # -------------------------------------------------------------------------- - # Check im suport + # fast option # -------------------------------------------------------------------------- - if ($opt_extern) - { - # mtr_report("Disable instance manager when running with extern mysqld"); - $opt_skip_im= 1; - } - elsif ( $mysql_version_id < 50000 ) - { - # Instance manager is not supported until 5.0 - $opt_skip_im= 1; - } - elsif ( $glob_win32 ) - { - mtr_report("Disable Instance manager - testing not supported on Windows"); - $opt_skip_im= 1; + if ($opt_fast){ + $opt_shutdown_timeout= 0; # Kill processes instead of nice shutdown } # -------------------------------------------------------------------------- @@ -1014,25 +1100,68 @@ sub command_line_setup () { mtr_error("Will not run in record mode without a specific test case"); } - if ( $opt_record ) - { - $opt_skip_combination = 1; + if ( $opt_record ) { + # Use only one worker with --record + $opt_parallel= 1; } # -------------------------------------------------------------------------- - # ps protcol flag + # Embedded server flag # -------------------------------------------------------------------------- - if ( $opt_ps_protocol ) + if ( $opt_embedded_server ) { - push(@glob_test_mode, "ps-protocol"); - } + if ( IS_WINDOWS ) + { + # Add the location for libmysqld.dll to the path. + my $separator= ";"; + my $lib_mysqld= + mtr_path_exists(vs_config_dirs('libmysqld','')); + if ( IS_CYGWIN ) + { + $lib_mysqld= posix_path($lib_mysqld); + $separator= ":"; + } + $ENV{'PATH'}= "$ENV{'PATH'}".$separator.$lib_mysqld; + } + $opt_skip_ndbcluster= 1; # Turn off use of NDB cluster + $opt_skip_ssl= 1; # Turn off use of SSL - # -------------------------------------------------------------------------- - # Bench flags - # -------------------------------------------------------------------------- - if ( $opt_small_bench ) - { - $opt_bench= 1; + # Turn off use of bin log + push(@opt_extra_mysqld_opt, "--skip-log-bin"); + + if ( using_extern() ) + { + mtr_error("Can't use --extern with --embedded-server"); + } + + + if ($opt_gdb) + { + mtr_warning("Silently converting --gdb to --client-gdb in embedded mode"); + $opt_client_gdb= $opt_gdb; + $opt_gdb= undef; + } + + if ($opt_ddd) + { + mtr_warning("Silently converting --ddd to --client-ddd in embedded mode"); + $opt_client_ddd= $opt_ddd; + $opt_ddd= undef; + } + + if ($opt_debugger) + { + mtr_warning("Silently converting --debugger to --client-debugger in embedded mode"); + $opt_client_debugger= $opt_debugger; + $opt_debugger= undef; + } + + if ( $opt_gdb || $opt_ddd || $opt_manual_gdb || $opt_manual_ddd || + $opt_manual_debug || $opt_debugger ) + { + mtr_error("You need to use the client debug options for the", + "embedded server. Ex: --client-gdb"); + } } # -------------------------------------------------------------------------- @@ -1060,17 +1189,22 @@ sub command_line_setup () { { # Indicate that we are using debugger $glob_debugger= 1; - if ( $opt_extern ) + if ( using_extern() ) { mtr_error("Can't use --extern when using debugger"); } } # -------------------------------------------------------------------------- - # Check if special exe was selected for master or slave + # Check timeout arguments # -------------------------------------------------------------------------- - $exe_master_mysqld= $exe_master_mysqld || $exe_mysqld; - $exe_slave_mysqld= $exe_slave_mysqld || $exe_mysqld; + + mtr_error("Invalid value '$opt_testcase_timeout' supplied ". + "for option --testcase-timeout") + if ($opt_testcase_timeout <= 0); + mtr_error("Invalid value '$opt_suite_timeout' supplied ". + "for option --testsuite-timeout") + if ($opt_suite_timeout <= 0); # -------------------------------------------------------------------------- # Check valgrind arguments @@ -1081,6 +1215,12 @@ sub command_line_setup () { $opt_valgrind= 1; $opt_valgrind_mysqld= 1; $opt_valgrind_mysqltest= 1; + + # Increase the timeouts when running with valgrind + $opt_testcase_timeout*= 10; + $opt_suite_timeout*= 6; + $opt_start_timeout*= 10; + } elsif ( $opt_valgrind_mysqld ) { @@ -1114,259 +1254,17 @@ sub command_line_setup () { join(" ", @valgrind_args), "\""); } - if ( ! $opt_testcase_timeout ) - { - $opt_testcase_timeout= $default_testcase_timeout; - $opt_testcase_timeout*= 10 if $opt_valgrind; - $opt_testcase_timeout*= 10 if ($opt_debug and $glob_win32); - } - - if ( ! $opt_suite_timeout ) - { - $opt_suite_timeout= $default_suite_timeout; - $opt_suite_timeout*= 6 if $opt_valgrind; - $opt_suite_timeout*= 6 if ($opt_debug and $glob_win32); - } - - if ( ! $opt_user ) - { - if ( $opt_extern ) - { - $opt_user= "test"; - } - else - { - $opt_user= "root"; # We want to do FLUSH xxx commands - } - } - - # On QNX, /tmp/dir/master.sock and /tmp/dir//master.sock seem to be - # considered different, so avoid the extra slash (/) in the socket - # paths. - my $sockdir = $opt_tmpdir; - $sockdir =~ s|/+$||; - - # On some operating systems, there is a limit to the length of a - # UNIX domain socket's path far below PATH_MAX, so try to avoid long - # socket path names. - $sockdir = tempdir(CLEANUP => 0) if ( length($sockdir) >= 70 ); - - $master->[0]= - { - pid => 0, - type => "master", - idx => 0, - path_myddir => "$opt_vardir/master-data", - path_myerr => "$opt_vardir/log/master.err", - path_pid => "$opt_vardir/run/master.pid", - path_sock => "$sockdir/master.sock", - port => $opt_master_myport, - start_timeout => 400, # enough time create innodb tables - cluster => 0, # index in clusters list - start_opts => [], - }; - - $master->[1]= - { - pid => 0, - type => "master", - idx => 1, - path_myddir => "$opt_vardir/master1-data", - path_myerr => "$opt_vardir/log/master1.err", - path_pid => "$opt_vardir/run/master1.pid", - path_sock => "$sockdir/master1.sock", - port => $opt_master_myport + 1, - start_timeout => 400, # enough time create innodb tables - cluster => 0, # index in clusters list - start_opts => [], - }; - - $slave->[0]= - { - pid => 0, - type => "slave", - idx => 0, - path_myddir => "$opt_vardir/slave-data", - path_myerr => "$opt_vardir/log/slave.err", - path_pid => "$opt_vardir/run/slave.pid", - path_sock => "$sockdir/slave.sock", - port => $opt_slave_myport, - start_timeout => 400, - - cluster => 1, # index in clusters list - start_opts => [], - }; - - $slave->[1]= - { - pid => 0, - type => "slave", - idx => 1, - path_myddir => "$opt_vardir/slave1-data", - path_myerr => "$opt_vardir/log/slave1.err", - path_pid => "$opt_vardir/run/slave1.pid", - path_sock => "$sockdir/slave1.sock", - port => $opt_slave_myport + 1, - start_timeout => 300, - cluster => -1, # index in clusters list - start_opts => [], - }; - - $slave->[2]= - { - pid => 0, - type => "slave", - idx => 2, - path_myddir => "$opt_vardir/slave2-data", - path_myerr => "$opt_vardir/log/slave2.err", - path_pid => "$opt_vardir/run/slave2.pid", - path_sock => "$sockdir/slave2.sock", - port => $opt_slave_myport + 2, - start_timeout => 300, - cluster => -1, # index in clusters list - start_opts => [], - }; - - $instance_manager= - { - path_err => "$opt_vardir/log/im.err", - path_log => "$opt_vardir/log/im.log", - path_pid => "$opt_vardir/run/im.pid", - path_angel_pid => "$opt_vardir/run/im.angel.pid", - path_sock => "$sockdir/im.sock", - port => $im_port, - start_timeout => $master->[0]->{'start_timeout'}, - admin_login => 'im_admin', - admin_password => 'im_admin_secret', - admin_sha1 => '*598D51AD2DFF7792045D6DF3DDF9AA1AF737B295', - password_file => "$opt_vardir/im.passwd", - defaults_file => "$opt_vardir/im.cnf", - }; - - $instance_manager->{'instances'}->[0]= - { - server_id => 1, - port => $im_mysqld1_port, - path_datadir => "$opt_vardir/im_mysqld_1.data", - path_sock => "$sockdir/mysqld_1.sock", - path_pid => "$opt_vardir/run/mysqld_1.pid", - start_timeout => 400, # enough time create innodb tables - old_log_format => 1 - }; - - $instance_manager->{'instances'}->[1]= - { - server_id => 2, - port => $im_mysqld2_port, - path_datadir => "$opt_vardir/im_mysqld_2.data", - path_sock => "$sockdir/mysqld_2.sock", - path_pid => "$opt_vardir/run/mysqld_2.pid", - nonguarded => 1, - start_timeout => 400, # enough time create innodb tables - old_log_format => 1 - }; - - my $data_dir= "$opt_vardir/ndbcluster-$opt_ndbcluster_port"; - $clusters->[0]= - { - name => "Master", - nodes => 2, - port => "$opt_ndbcluster_port", - data_dir => "$data_dir", - connect_string => "host=localhost:$opt_ndbcluster_port", - path_pid => "$data_dir/ndb_3.pid", # Nodes + 1 - pid => 0, # pid of ndb_mgmd - installed_ok => 0, - }; - - $data_dir= "$opt_vardir/ndbcluster-$opt_ndbcluster_port_slave"; - $clusters->[1]= - { - name => "Slave", - nodes => 1, - port => "$opt_ndbcluster_port_slave", - data_dir => "$data_dir", - connect_string => "host=localhost:$opt_ndbcluster_port_slave", - path_pid => "$data_dir/ndb_2.pid", # Nodes + 1 - pid => 0, # pid of ndb_mgmd - installed_ok => 0, - }; - - # Init pids of ndbd's - foreach my $cluster ( @{$clusters} ) - { - for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ ) - { - my $nodeid= $idx+1; - $cluster->{'ndbds'}->[$idx]= - { - pid => 0, - nodeid => $nodeid, - path_pid => "$cluster->{'data_dir'}/ndb_${nodeid}.pid", - path_fs => "$cluster->{'data_dir'}/ndb_${nodeid}_fs", - }; - } - } - - # -------------------------------------------------------------------------- - # extern - # -------------------------------------------------------------------------- - if ( $opt_extern ) - { - # Turn off features not supported when running with extern server - $opt_skip_rpl= 1; - $opt_skip_ndbcluster= 1; - - # Setup master->[0] with the settings for the extern server - $master->[0]->{'path_sock'}= $opt_socket ? $opt_socket : "/tmp/mysql.sock"; - mtr_report("Using extern server at '$master->[0]->{path_sock}'"); - } - else - { - mtr_error("--socket can only be used in combination with --extern") - if $opt_socket; - } - - - # -------------------------------------------------------------------------- - # ndbconnectstring and ndbconnectstring_slave - # -------------------------------------------------------------------------- - if ( $opt_ndbconnectstring ) - { - # ndbconnectstring was supplied by user, the tests shoudl be run - # against an already started cluster, change settings - my $cluster= $clusters->[0]; # Master cluster - $cluster->{'connect_string'}= $opt_ndbconnectstring; - $cluster->{'use_running'}= 1; - - mtr_error("Can't specify --ndb-connectstring and --skip-ndbcluster") - if $opt_skip_ndbcluster; - } - $ENV{'NDB_CONNECTSTRING'}= $clusters->[0]->{'connect_string'}; - - - if ( $opt_ndbconnectstring_slave ) - { - # ndbconnectstring-slave was supplied by user, the tests should be run - # agains an already started slave cluster, change settings - my $cluster= $clusters->[1]; # Slave cluster - $cluster->{'connect_string'}= $opt_ndbconnectstring_slave; - $cluster->{'use_running'}= 1; - - mtr_error("Can't specify ndb-connectstring_slave and " . - "--skip-ndbcluster-slave") - if $opt_skip_ndbcluster_slave; - } + mtr_report("Checking supported features..."); + check_ndbcluster_support(\%mysqld_variables); + check_ssl_support(\%mysqld_variables); + check_debug_support(\%mysqld_variables); - $path_timefile= "$opt_vardir/log/mysqltest-time"; - $path_mysqltest_log= "$opt_vardir/log/mysqltest.log"; - $path_current_test_log= "$opt_vardir/log/current_test"; - $path_ndb_testrun_log= "$opt_vardir/log/ndb_testrun.log"; + executable_setup(); - $path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/"; } + # # 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 @@ -1382,79 +1280,47 @@ sub command_line_setup () { # http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html # But a fairly safe range seems to be 5001 - 32767 # +sub set_build_thread_ports($) { + my $build_thread= shift || 0; -sub set_mtr_build_thread_ports($) { - my $mtr_build_thread= shift; - - if ( lc($mtr_build_thread) eq 'auto' ) { - print "Requesting build thread... "; - $ENV{'MTR_BUILD_THREAD'} = $mtr_build_thread = mtr_require_unique_id_and_wait("/tmp/mysql-test-ports", 200, 299); - print "got ".$mtr_build_thread."\n"; + if ( lc($build_thread) eq 'auto' ) { + #mtr_report("Requesting build thread... "); + $build_thread= mtr_get_unique_id(250, 299); + if ( !defined $build_thread ) { + mtr_error("Could not get a unique build thread id"); + } + #mtr_report(" - got $build_thread"); } + $ENV{MTR_BUILD_THREAD}= $build_thread; + $opt_build_thread= $build_thread; - # Up to two masters, up to three slaves - # A magic value in command_line_setup depends on these equations. - $opt_master_myport= $mtr_build_thread * 10 + 10000; # and 1 - $opt_slave_myport= $opt_master_myport + 2; # and 3 4 - $opt_ndbcluster_port= $opt_master_myport + 5; - $opt_ndbcluster_port_slave= $opt_master_myport + 6; - $im_port= $opt_master_myport + 7; - $im_mysqld1_port= $opt_master_myport + 8; - $im_mysqld2_port= $opt_master_myport + 9; - - if ( $opt_master_myport < 5001 or $opt_master_myport + 10 >= 32767 ) + # Calculate baseport + $baseport= $build_thread * 10 + 10000; + if ( $baseport < 5001 or $baseport + 9 >= 32767 ) { mtr_error("MTR_BUILD_THREAD number results in a port", "outside 5001 - 32767", - "($opt_master_myport - $opt_master_myport + 10)"); - } -} - - -sub datadir_list_setup () { - - # Make a list of all data_dirs - for (my $idx= 0; $idx < $max_master_num; $idx++) - { - push(@data_dir_lst, $master->[$idx]->{'path_myddir'}); + "($baseport - $baseport + 9)"); } - for (my $idx= 0; $idx < $max_slave_num; $idx++) - { - push(@data_dir_lst, $slave->[$idx]->{'path_myddir'}); - } + mtr_report("Using MTR_BUILD_THREAD $build_thread,", + "with reserved ports $baseport..".($baseport+9)); - unless ($opt_skip_im) - { - foreach my $instance (@{$instance_manager->{'instances'}}) - { - push(@data_dir_lst, $instance->{'path_datadir'}); - } - } } -############################################################################## -# -# Set paths to various executable programs -# -############################################################################## - - -sub collect_mysqld_features () { +sub collect_mysqld_features { my $found_variable_list_start= 0; - my $tmpdir; - if ( $opt_tmpdir ) { - # Use the requested tmpdir - mkpath($opt_tmpdir) if (! -d $opt_tmpdir); - $tmpdir= $opt_tmpdir; - } - else { - $tmpdir= tempdir(CLEANUP => 0); # Directory removed by this function + my $use_tmpdir; + if ( defined $opt_tmpdir and -d $opt_tmpdir){ + # Create the tempdir in $opt_tmpdir + $use_tmpdir= $opt_tmpdir; } + my $tmpdir= tempdir(CLEANUP => 0, # Directory removed by this function + DIR => $use_tmpdir); # - # Execute "mysqld --help --verbose" to get a list + # Execute "mysqld --no-defaults --help --verbose" to get a # list of all features and settings # # --no-defaults and --skip-grant-tables are to avoid loading @@ -1462,7 +1328,18 @@ sub collect_mysqld_features () { # # --datadir must exist, mysqld will chdir into it # - my $list= `$exe_mysqld --no-defaults --datadir=$tmpdir --language=$path_language --skip-grant-tables --verbose --help`; + my $args; + mtr_init_args(\$args); + mtr_add_arg($args, "--no-defaults"); + mtr_add_arg($args, "--datadir=%s", mixed_path($tmpdir)); + mtr_add_arg($args, "--language=%s", $path_language); + mtr_add_arg($args, "--skip-grant-tables"); + mtr_add_arg($args, "--verbose"); + mtr_add_arg($args, "--help"); + + my $exe_mysqld= find_mysqld($basedir); + my $cmd= join(" ", $exe_mysqld, @$args); + my $list= `$cmd`; foreach my $line (split('\n', $list)) { @@ -1517,99 +1394,75 @@ sub collect_mysqld_features () { } } } - rmtree($tmpdir) if (!$opt_tmpdir); + rmtree($tmpdir); mtr_error("Could not find version of MySQL") unless $mysql_version_id; mtr_error("Could not find variabes list") unless $found_variable_list_start; } -sub run_query($$) { - my ($mysqld, $query)= @_; + +sub collect_mysqld_features_from_running_server () +{ + my $mysql= mtr_exe_exists("$path_client_bindir/mysql"); my $args; mtr_init_args(\$args); mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--user=%s", $opt_user); - mtr_add_arg($args, "--port=%d", $mysqld->{'port'}); - mtr_add_arg($args, "--socket=%s", $mysqld->{'path_sock'}); - mtr_add_arg($args, "--silent"); # Tab separated output - mtr_add_arg($args, "-e '%s'", $query); - - my $cmd= "$exe_mysql " . join(' ', @$args); - mtr_verbose("cmd: $cmd"); - return `$cmd`; -} + while (my ($option, $value)= each( %opts_extern )) { + mtr_add_arg($args, "--$option=$value"); + } -sub collect_mysqld_features_from_running_server () -{ - my $list= run_query($master->[0], "use mysql; SHOW VARIABLES"); + mtr_add_arg($args, "--silent"); # Tab separated output + mtr_add_arg($args, "-e '%s'", "use mysql; SHOW VARIABLES"); + my $cmd= "$mysql " . join(' ', @$args); + mtr_verbose("cmd: $cmd"); - foreach my $line (split('\n', $list)) + my $list = `$cmd` or + mtr_error("Could not connect to extern server using command: '$cmd'"); + foreach my $line (split('\n', $list )) { # Put variables into hash if ( $line =~ /^([\S]+)[ \t]+(.*?)\r?$/ ) { - print "$1=\"$2\"\n"; + # print "$1=\"$2\"\n"; $mysqld_variables{$1}= $2; } } + + # Parse version + my $version_str= $mysqld_variables{'version'}; + if ( $version_str =~ /^([0-9]*)\.([0-9]*)\.([0-9]*)/ ) + { + #print "Major: $1 Minor: $2 Build: $3\n"; + $mysql_version_id= $1*10000 + $2*100 + $3; + #print "mysql_version_id: $mysql_version_id\n"; + mtr_report("MySQL Version $1.$2.$3"); + } + mtr_error("Could not find version of MySQL") unless $mysql_version_id; } -sub executable_setup_im () { +sub find_mysqld { + my ($mysqld_basedir)= @_; - # Look for instance manager binary - mysqlmanager - $exe_im= - mtr_exe_maybe_exists( - "$glob_basedir/server-tools/instance-manager/mysqlmanager", - "$glob_basedir/libexec/mysqlmanager", - "$glob_basedir/bin/mysqlmanager", - "$glob_basedir/sbin/mysqlmanager"); + my @mysqld_names= ("mysqld", "mysqld-max-nt", "mysqld-max", + "mysqld-nt"); - return ($exe_im eq ""); -} + if ( $opt_debug ){ + # Put mysqld-debug first in the list of binaries to look for + mtr_verbose("Adding mysqld-debug first in list of binaries to look for"); + unshift(@mysqld_names, "mysqld-debug"); + } -sub executable_setup_ndb () { - - # Look for ndb tols and binaries - my $ndb_path= mtr_file_exists("$glob_basedir/ndb", - "$glob_basedir/storage/ndb", - "$glob_basedir/bin"); - - $exe_ndbd= - mtr_exe_maybe_exists("$ndb_path/src/kernel/ndbd", - "$ndb_path/ndbd", - "$glob_basedir/libexec/ndbd"); - $exe_ndb_mgm= - mtr_exe_maybe_exists("$ndb_path/src/mgmclient/ndb_mgm", - "$ndb_path/ndb_mgm"); - $exe_ndb_mgmd= - mtr_exe_maybe_exists("$ndb_path/src/mgmsrv/ndb_mgmd", - "$ndb_path/ndb_mgmd", - "$glob_basedir/libexec/ndb_mgmd"); - $exe_ndb_waiter= - mtr_exe_maybe_exists("$ndb_path/tools/ndb_waiter", - "$ndb_path/ndb_waiter"); - - # May not exist - $path_ndb_tools_dir= mtr_file_exists("$ndb_path/tools", - "$ndb_path"); - # May not exist - $path_ndb_examples_dir= - mtr_file_exists("$ndb_path/ndbapi-examples", - "$ndb_path/examples"); - # May not exist - $exe_ndb_example= - mtr_file_exists("$path_ndb_examples_dir/ndbapi_simple/ndbapi_simple"); - - return ( $exe_ndbd eq "" or - $exe_ndb_mgm eq "" or - $exe_ndb_mgmd eq "" or - $exe_ndb_waiter eq ""); + return my_find_bin($mysqld_basedir, + ["sql", "libexec", "sbin", "bin"], + [@mysqld_names]); } + sub executable_setup () { # @@ -1627,105 +1480,35 @@ sub executable_setup () { } } - # Look for my_print_defaults - $exe_my_print_defaults= - mtr_exe_exists(vs_config_dirs('extra', 'my_print_defaults'), - "$path_client_bindir/my_print_defaults", - "$glob_basedir/extra/my_print_defaults"); - - # Look for perror - $exe_perror= mtr_exe_exists(vs_config_dirs('extra', 'perror'), - "$glob_basedir/extra/perror", - "$path_client_bindir/perror"); - # Look for the client binaries - $exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck"); - $exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump"); - $exe_mysqlimport= mtr_exe_exists("$path_client_bindir/mysqlimport"); - $exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow"); - $exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog"); $exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin"); $exe_mysql= mtr_exe_exists("$path_client_bindir/mysql"); - if (!$opt_extern) + if ( ! $opt_skip_ndbcluster ) { - # Look for SQL scripts directory - if ( mtr_file_exists("$path_share/mysql_system_tables.sql") ne "") - { - # The SQL scripts are in path_share - $path_sql_dir= $path_share; - } - else - { - $path_sql_dir= mtr_path_exists("$glob_basedir/share", - "$glob_basedir/scripts"); - } - - if ( $mysql_version_id >= 50100 ) - { - $exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap"); - } - if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server ) - { - $exe_mysql_upgrade= mtr_exe_exists("$path_client_bindir/mysql_upgrade") - } - else - { - $exe_mysql_upgrade= ""; - } - - if ( ! $glob_win32 ) - { - # Look for mysql_fix_system_table script - $exe_mysql_fix_system_tables= - mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables", - "$path_client_bindir/mysql_fix_privilege_tables"); - } + $exe_ndbd= + my_find_bin($basedir, + ["storage/ndb/src/kernel", "libexec", "sbin", "bin"], + "ndbd"); - # Look for mysql_fix_privilege_tables.sql script - $file_mysql_fix_privilege_tables= - mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql", - "$glob_basedir/share/mysql_fix_privilege_tables.sql", - "$glob_basedir/share/mysql/mysql_fix_privilege_tables.sql"); + $exe_ndb_mgmd= + my_find_bin($basedir, + ["storage/ndb/src/mgmsrv", "libexec", "sbin", "bin"], + "ndb_mgmd"); - if ( ! $opt_skip_ndbcluster and executable_setup_ndb()) - { - mtr_warning("Could not find all required ndb binaries, " . - "all ndb tests will fail, use --skip-ndbcluster to " . - "skip testing it."); - - foreach my $cluster (@{$clusters}) - { - $cluster->{"executable_setup_failed"}= 1; - } - } - - if ( ! $opt_skip_im and executable_setup_im()) - { - mtr_warning("Could not find all required instance manager binaries, " . - "all im tests will fail, use --skip-im to " . - "continue without instance manager"); - $instance_manager->{"executable_setup_failed"}= 1; - } - - # Look for the udf_example library - $lib_udf_example= - mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'), - "$glob_basedir/sql/.libs/udf_example.so",); - - # Look for the ha_example library - $lib_example_plugin= - mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'), - "$glob_basedir/storage/example/.libs/ha_example.so",); + $exe_ndb_waiter= + my_find_bin($basedir, + ["storage/ndb/tools/", "bin"], + "ndb_waiter"); } # Look for mysqltest executable - if ( $glob_use_embedded_server ) + if ( $opt_embedded_server ) { $exe_mysqltest= mtr_exe_exists(vs_config_dirs('libmysqld/examples','mysqltest_embedded'), - "$glob_basedir/libmysqld/examples/mysqltest_embedded", + "$basedir/libmysqld/examples/mysqltest_embedded", "$path_client_bindir/mysqltest_embedded"); } else @@ -1733,120 +1516,115 @@ sub executable_setup () { $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest"); } - # Look for mysql_client_test executable which may _not_ exist in - # some versions, test using it should be skipped - if ( $glob_use_embedded_server ) - { - $exe_mysql_client_test= - mtr_exe_maybe_exists( - vs_config_dirs('libmysqld/examples', 'mysql_client_test_embedded'), - "$glob_basedir/libmysqld/examples/mysql_client_test_embedded"); - } - else - { - $exe_mysql_client_test= - mtr_exe_maybe_exists(vs_config_dirs('tests', 'mysql_client_test'), - "$glob_basedir/tests/mysql_client_test", - "$glob_basedir/bin/mysql_client_test"); - } - - # Look for bug25714 executable which may _not_ exist in - # some versions, test using it should be skipped - $exe_bug25714= - mtr_exe_maybe_exists(vs_config_dirs('tests', 'bug25714'), - "$glob_basedir/tests/bug25714"); } -sub generate_cmdline_mysqldump ($) { - my($mysqld) = @_; - return - mtr_native_path($exe_mysqldump) . - " --no-defaults -uroot --debug-check " . - "--port=$mysqld->{'port'} " . - "--socket=$mysqld->{'path_sock'} --password="; +sub client_debug_arg($$) { + my ($args, $client_name)= @_; + + if ( $opt_debug ) { + mtr_add_arg($args, + "--debug=d:t:A,%s/log/%s.trace", + $path_vardir_trace, $client_name) + } } -############################################################################## -# -# Set environment to be used by childs of this process for -# things that are constant duting the whole lifetime of mysql-test-run.pl -# -############################################################################## +sub mysql_fix_arguments () { -sub mysql_client_test_arguments() -{ - my $exe= $exe_mysql_client_test; + return "" if ( IS_WINDOWS ); + my $exe= + mtr_script_exists("$basedir/scripts/mysql_fix_privilege_tables", + "$path_client_bindir/mysql_fix_privilege_tables"); my $args; mtr_init_args(\$args); - if ( $opt_valgrind_mysqltest ) - { - valgrind_arguments($args, \$exe); - } + mtr_add_arg($args, "--defaults-file=%s", $path_config_file); - mtr_add_arg($args, "--no-defaults"); - mtr_add_arg($args, "--testcase"); - mtr_add_arg($args, "--user=root"); - mtr_add_arg($args, "--port=$master->[0]->{'port'}"); - mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}"); + mtr_add_arg($args, "--basedir=", $basedir); + mtr_add_arg($args, "--bindir=", $path_client_bindir); + mtr_add_arg($args, "--verbose"); + return mtr_args2str($exe, @$args); +} - if ( $opt_extern || $mysql_version_id >= 50000 ) - { - mtr_add_arg($args, "--vardir=$opt_vardir") - } - if ( $opt_debug ) - { - mtr_add_arg($args, - "--debug=d:t:A,$path_vardir_trace/log/mysql_client_test.trace"); - } +sub client_arguments ($) { + my $client_name= shift; + my $client_exe= mtr_exe_exists("$path_client_bindir/$client_name"); - if ( $glob_use_embedded_server ) - { - mtr_add_arg($args, - " -A --language=$path_language"); - mtr_add_arg($args, - " -A --datadir=$slave->[0]->{'path_myddir'}"); - mtr_add_arg($args, - " -A --character-sets-dir=$path_charsetsdir"); + my $args; + mtr_init_args(\$args); + mtr_add_arg($args, "--defaults-file=%s", $path_config_file); + client_debug_arg($args, $client_name); + return mtr_args2str($client_exe, @$args); +} + + +sub mysqlslap_arguments () { + my $exe= mtr_exe_maybe_exists("$path_client_bindir/mysqlslap"); + if ( $exe eq "" ) { + # mysqlap was not found + + if (defined $mysql_version_id and $mysql_version_id >= 50100 ) { + mtr_error("Could not find the mysqlslap binary"); + } + return ""; # Don't care about mysqlslap } - return join(" ", $exe, @$args); + my $args; + mtr_init_args(\$args); + mtr_add_arg($args, "--defaults-file=%s", $path_config_file); + client_debug_arg($args, "mysqlslap"); + return mtr_args2str($exe, @$args); } -sub mysql_upgrade_arguments() -{ - my $exe= $exe_mysql_upgrade; + +sub mysqldump_arguments ($) { + my($group_suffix) = @_; + my $exe= mtr_exe_exists("$path_client_bindir/mysqldump"); my $args; mtr_init_args(\$args); -# if ( $opt_valgrind_mysql_ugrade ) -# { -# valgrind_arguments($args, \$exe); -# } + mtr_add_arg($args, "--defaults-file=%s", $path_config_file); + mtr_add_arg($args, "--defaults-group-suffix=%s", $group_suffix); + client_debug_arg($args, "mysqldump-$group_suffix"); + return mtr_args2str($exe, @$args); +} - mtr_add_arg($args, "--no-defaults"); - mtr_add_arg($args, "--user=root"); - mtr_add_arg($args, "--port=$master->[0]->{'port'}"); - mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}"); - mtr_add_arg($args, "--datadir=$master->[0]->{'path_myddir'}"); - mtr_add_arg($args, "--basedir=$glob_basedir"); - mtr_add_arg($args, "--tmpdir=$opt_tmpdir"); - if ( $opt_debug ) - { - mtr_add_arg($args, - "--debug=d:t:A,$path_vardir_trace/log/mysql_upgrade.trace"); +sub mysql_client_test_arguments(){ + my $exe; + # mysql_client_test executable may _not_ exist + if ( $opt_embedded_server ) { + $exe= mtr_exe_maybe_exists( + vs_config_dirs('libmysqld/examples','mysql_client_test_embedded'), + "$basedir/libmysqld/examples/mysql_client_test_embedded", + "$basedir/bin/mysql_client_test_embedded"); + } else { + $exe= mtr_exe_maybe_exists(vs_config_dirs('tests', 'mysql_client_test'), + "$basedir/tests/mysql_client_test", + "$basedir/bin/mysql_client_test"); } - return join(" ", $exe, @$args); + my $args; + mtr_init_args(\$args); + if ( $opt_valgrind_mysqltest ) { + valgrind_arguments($args, \$exe); + } + mtr_add_arg($args, "--defaults-file=%s", $path_config_file); + mtr_add_arg($args, "--testcase"); + mtr_add_arg($args, "--vardir=$opt_vardir"); + client_debug_arg($args,"mysql_client_test"); + + return mtr_args2str($exe, @$args); } -# Note that some env is setup in spawn/run, in "mtr_process.pl" -sub environment_setup () { +# +# Set environment to be used by childs of this process for +# things that are constant during the whole lifetime of mysql-test-run +# +sub environment_setup { umask(022); @@ -1863,25 +1641,68 @@ sub environment_setup () { # are used in favor of the system installed ones if ( $source_dist ) { - push(@ld_library_paths, "$glob_basedir/libmysql/.libs/", - "$glob_basedir/libmysql_r/.libs/", - "$glob_basedir/zlib.libs/"); + push(@ld_library_paths, "$basedir/libmysql/.libs/", + "$basedir/libmysql_r/.libs/", + "$basedir/zlib.libs/"); } else { - push(@ld_library_paths, "$glob_basedir/lib"); + push(@ld_library_paths, "$basedir/lib"); } } - # -------------------------------------------------------------------------- + # -------------------------------------------------------------------------- # Add the path where libndbclient can be found # -------------------------------------------------------------------------- - if ( $glob_ndbcluster_supported ) + if ( !$opt_skip_ndbcluster ) { - push(@ld_library_paths, "$glob_basedir/storage/ndb/src/.libs"); + push(@ld_library_paths, "$basedir/storage/ndb/src/.libs"); } # -------------------------------------------------------------------------- + # Add the path where mysqld will find udf_example.so + # -------------------------------------------------------------------------- + my $lib_udf_example= + mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'), + "$basedir/sql/.libs/udf_example.so",); + + if ( $lib_udf_example ) + { + push(@ld_library_paths, dirname($lib_udf_example)); + } + + $ENV{'UDF_EXAMPLE_LIB'}= + ($lib_udf_example ? basename($lib_udf_example) : ""); + $ENV{'UDF_EXAMPLE_LIB_OPT'}= "--plugin-dir=". + ($lib_udf_example ? dirname($lib_udf_example) : ""); + + # -------------------------------------------------------------------------- + # Add the path where mysqld will find ha_example.so + # -------------------------------------------------------------------------- + if ($mysql_version_id >= 50100) { + my $lib_example_plugin= + mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'), + "$basedir/storage/example/.libs/ha_example.so",); + $ENV{'EXAMPLE_PLUGIN'}= + ($lib_example_plugin ? basename($lib_example_plugin) : ""); + $ENV{'EXAMPLE_PLUGIN_OPT'}= "--plugin-dir=". + ($lib_example_plugin ? dirname($lib_example_plugin) : ""); + + } + + # ---------------------------------------------------- + # Add the path where mysqld will find mypluglib.so + # ---------------------------------------------------- + my $lib_simple_parser= + mtr_file_exists(vs_config_dirs('plugin/fulltext', 'mypluglib.dll'), + "$basedir/plugin/fulltext/.libs/mypluglib.so",); + + $ENV{'SIMPLE_PARSER'}= + ($lib_simple_parser ? basename($lib_simple_parser) : ""); + $ENV{'SIMPLE_PARSER_OPT'}= "--plugin-dir=". + ($lib_simple_parser ? dirname($lib_simple_parser) : ""); + + # -------------------------------------------------------------------------- # Valgrind need to be run with debug libraries otherwise it's almost # impossible to add correct supressions, that means if "/usr/lib/debug" # is available, it should be added to @@ -1895,7 +1716,8 @@ sub environment_setup () { my $deb_version; if ( $opt_valgrind and -d $debug_libraries_path and (! -e '/etc/debian_version' or - ($deb_version= mtr_grab_file('/etc/debian_version')) !~ /^[0-9]+\.[0-9]$/ or + ($deb_version= + mtr_grab_file('/etc/debian_version')) !~ /^[0-9]+\.[0-9]$/ or $deb_version > 3.1 ) ) { push(@ld_library_paths, $debug_libraries_path); @@ -1923,14 +1745,10 @@ sub environment_setup () { split(':', $ENV{'LIBPATH'}) : ()); mtr_debug("LIBPATH: $ENV{'LIBPATH'}"); - # -------------------------------------------------------------------------- - # Also command lines in .opt files may contain env vars - # -------------------------------------------------------------------------- - $ENV{'CHARSETSDIR'}= $path_charsetsdir; $ENV{'UMASK'}= "0660"; # The octal *string* $ENV{'UMASK_DIR'}= "0770"; # The octal *string* - + # # MySQL tests can produce output in various character sets # (especially, ctype_xxx.test). To avoid confusing Perl @@ -1941,380 +1759,132 @@ sub environment_setup () { # $ENV{'LC_ALL'}= "C"; $ENV{'LC_CTYPE'}= "C"; - + $ENV{'LC_COLLATE'}= "C"; - $ENV{'USE_RUNNING_SERVER'}= $opt_extern; + $ENV{'USE_RUNNING_SERVER'}= using_extern(); $ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir; - $ENV{'MYSQLTEST_VARDIR'}= $opt_vardir; + $ENV{'DEFAULT_MASTER_PORT'}= $mysqld_variables{'master-port'} || 3306; $ENV{'MYSQL_TMP_DIR'}= $opt_tmpdir; - $ENV{'MASTER_MYSOCK'}= $master->[0]->{'path_sock'}; - $ENV{'MASTER_MYSOCK1'}= $master->[1]->{'path_sock'}; - $ENV{'MASTER_MYPORT'}= $master->[0]->{'port'}; - $ENV{'MASTER_MYPORT1'}= $master->[1]->{'port'}; - $ENV{'SLAVE_MYSOCK'}= $slave->[0]->{'path_sock'}; - $ENV{'SLAVE_MYPORT'}= $slave->[0]->{'port'}; - $ENV{'SLAVE_MYPORT1'}= $slave->[1]->{'port'}; - $ENV{'SLAVE_MYPORT2'}= $slave->[2]->{'port'}; - $ENV{'MYSQL_TCP_PORT'}= $mysqld_variables{'port'}; - $ENV{'DEFAULT_MASTER_PORT'}= $mysqld_variables{'master-port'}; - - $ENV{'IM_PATH_SOCK'}= $instance_manager->{path_sock}; - $ENV{'IM_USERNAME'}= $instance_manager->{admin_login}; - $ENV{'IM_PASSWORD'}= $instance_manager->{admin_password}; - $ENV{MTR_BUILD_THREAD}= $opt_mtr_build_thread; - - $ENV{'EXE_MYSQL'}= $exe_mysql; - + $ENV{'MYSQLTEST_VARDIR'}= $opt_vardir; # ---------------------------------------------------- # Setup env for NDB # ---------------------------------------------------- if ( ! $opt_skip_ndbcluster ) { - $ENV{'NDB_MGM'}= $exe_ndb_mgm; + $ENV{'NDB_MGM'}= + my_find_bin($basedir, + ["storage/ndb/src/mgmclient", "bin"], + "ndb_mgm"); - $ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port; - $ENV{'NDBCLUSTER_PORT_SLAVE'}= $opt_ndbcluster_port_slave; + $ENV{'NDB_TOOLS_DIR'}= + my_find_dir($basedir, + ["storage/ndb/tools", "bin"]); - $ENV{'NDB_EXTRA_TEST'}= $opt_ndb_extra_test; + $ENV{'NDB_EXAMPLES_DIR'}= + my_find_dir($basedir, + ["storage/ndb/ndbapi-examples", "bin"]); - $ENV{'NDB_BACKUP_DIR'}= $clusters->[0]->{'data_dir'}; - $ENV{'NDB_DATA_DIR'}= $clusters->[0]->{'data_dir'}; - $ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir; - $ENV{'NDB_TOOLS_OUTPUT'}= $path_ndb_testrun_log; + $ENV{'NDB_EXAMPLES_BINARY'}= + my_find_bin($basedir, + ["storage/ndb/ndbapi-examples/ndbapi_simple", "bin"], + "ndbapi_simple", NOT_REQUIRED); - if ( $mysql_version_id >= 50000 ) - { - $ENV{'NDB_EXAMPLES_DIR'}= $path_ndb_examples_dir; - $ENV{'MY_NDB_EXAMPLES_BINARY'}= $exe_ndb_example; - } + my $path_ndb_testrun_log= "$opt_vardir/log/ndb_testrun.log"; + $ENV{'NDB_TOOLS_OUTPUT'}= $path_ndb_testrun_log; $ENV{'NDB_EXAMPLES_OUTPUT'}= $path_ndb_testrun_log; } # ---------------------------------------------------- - # Setup env for IM - # ---------------------------------------------------- - if ( ! $opt_skip_im ) - { - $ENV{'IM_EXE'}= $exe_im; - $ENV{'IM_PATH_PID'}= $instance_manager->{path_pid}; - $ENV{'IM_PATH_ANGEL_PID'}= $instance_manager->{path_angel_pid}; - $ENV{'IM_PORT'}= $instance_manager->{port}; - $ENV{'IM_DEFAULTS_PATH'}= $instance_manager->{defaults_file}; - $ENV{'IM_PASSWORD_PATH'}= $instance_manager->{password_file}; - - $ENV{'IM_MYSQLD1_SOCK'}= - $instance_manager->{instances}->[0]->{path_sock}; - $ENV{'IM_MYSQLD1_PORT'}= - $instance_manager->{instances}->[0]->{port}; - $ENV{'IM_MYSQLD1_PATH_PID'}= - $instance_manager->{instances}->[0]->{path_pid}; - $ENV{'IM_MYSQLD2_SOCK'}= - $instance_manager->{instances}->[1]->{path_sock}; - $ENV{'IM_MYSQLD2_PORT'}= - $instance_manager->{instances}->[1]->{port}; - $ENV{'IM_MYSQLD2_PATH_PID'}= - $instance_manager->{instances}->[1]->{path_pid}; - } - - # ---------------------------------------------------- - # Setup env so childs can execute mysqlcheck - # ---------------------------------------------------- - my $cmdline_mysqlcheck= - mtr_native_path($exe_mysqlcheck) . - " --no-defaults --debug-check -uroot " . - "--port=$master->[0]->{'port'} " . - "--socket=$master->[0]->{'path_sock'} --password="; - - if ( $opt_debug ) - { - $cmdline_mysqlcheck .= - " --debug=d:t:A,$path_vardir_trace/log/mysqlcheck.trace"; - } - $ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck; - - # ---------------------------------------------------- - # Setup env to childs can execute myqldump - # ---------------------------------------------------- - my $cmdline_mysqldump= generate_cmdline_mysqldump($master->[0]); - my $cmdline_mysqldumpslave= generate_cmdline_mysqldump($slave->[0]); - - if ( $opt_debug ) - { - $cmdline_mysqldump .= - " --debug=d:t:A,$path_vardir_trace/log/mysqldump-master.trace"; - $cmdline_mysqldumpslave .= - " --debug=d:t:A,$path_vardir_trace/log/mysqldump-slave.trace"; - } - $ENV{'MYSQL_DUMP'}= $cmdline_mysqldump; - $ENV{'MYSQL_DUMP_SLAVE'}= $cmdline_mysqldumpslave; - - - # ---------------------------------------------------- - # Setup env so childs can execute mysqlslap - # ---------------------------------------------------- - if ( $exe_mysqlslap ) - { - my $cmdline_mysqlslap= - mtr_native_path($exe_mysqlslap) . - " -uroot " . - "--port=$master->[0]->{'port'} " . - "--socket=$master->[0]->{'path_sock'} --password= "; - - if ( $opt_debug ) - { - $cmdline_mysqlslap .= - " --debug=d:t:A,$path_vardir_trace/log/mysqlslap.trace"; - } - $ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap; - } - - # ---------------------------------------------------- - # Setup env so childs can execute mysqlimport - # ---------------------------------------------------- - my $cmdline_mysqlimport= - mtr_native_path($exe_mysqlimport) . - " -uroot --debug-check " . - "--port=$master->[0]->{'port'} " . - "--socket=$master->[0]->{'path_sock'} --password="; - - if ( $opt_debug ) - { - $cmdline_mysqlimport .= - " --debug=d:t:A,$path_vardir_trace/log/mysqlimport.trace"; - } - $ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport; - - - # ---------------------------------------------------- - # Setup env so childs can execute mysqlshow - # ---------------------------------------------------- - my $cmdline_mysqlshow= - mtr_native_path($exe_mysqlshow) . - " -uroot --debug-check " . - "--port=$master->[0]->{'port'} " . - "--socket=$master->[0]->{'path_sock'} --password="; - - if ( $opt_debug ) - { - $cmdline_mysqlshow .= - " --debug=d:t:A,$path_vardir_trace/log/mysqlshow.trace"; - } - $ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow; - - # ---------------------------------------------------- - # Setup env so childs can execute mysqlbinlog - # ---------------------------------------------------- - my $cmdline_mysqlbinlog= - mtr_native_path($exe_mysqlbinlog) . - " --no-defaults --disable-force-if-open --debug-check"; - if ( !$opt_extern && $mysql_version_id >= 50000 ) - { - $cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir"; - } - # Always use the given tmpdir for the LOAD files created - # by mysqlbinlog - $cmdline_mysqlbinlog .=" --local-load=$opt_tmpdir"; - - if ( $opt_debug ) - { - $cmdline_mysqlbinlog .= - " --debug=d:t:A,$path_vardir_trace/log/mysqlbinlog.trace"; - } - $ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog; - - # ---------------------------------------------------- - # Setup env so childs can execute mysql - # ---------------------------------------------------- - my $cmdline_mysql= - mtr_native_path($exe_mysql) . - " --no-defaults --debug-check --host=localhost --user=root --password= " . - "--port=$master->[0]->{'port'} " . - "--socket=$master->[0]->{'path_sock'} ". - "--character-sets-dir=$path_charsetsdir"; - - $ENV{'MYSQL'}= $cmdline_mysql; - - # ---------------------------------------------------- - # Setup env so childs can execute bug25714 - # ---------------------------------------------------- - $ENV{'MYSQL_BUG25714'}= $exe_bug25714; - - # ---------------------------------------------------- - # Setup env so childs can execute mysql_client_test + # mysql clients # ---------------------------------------------------- - $ENV{'MYSQL_CLIENT_TEST'}= mysql_client_test_arguments(); - - # ---------------------------------------------------- - # Setup env so childs can execute mysql_upgrade - # ---------------------------------------------------- - if ( !$opt_extern && $mysql_version_id >= 50000 ) - { - $ENV{'MYSQL_UPGRADE'}= mysql_upgrade_arguments(); - } - - # ---------------------------------------------------- - # Setup env so childs can execute mysql_fix_system_tables - # ---------------------------------------------------- - if ( !$opt_extern && ! $glob_win32 ) - { - my $cmdline_mysql_fix_system_tables= - "$exe_mysql_fix_system_tables --no-defaults --host=localhost " . - "--user=root --password= " . - "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " . - "--port=$master->[0]->{'port'} " . - "--socket=$master->[0]->{'path_sock'}"; - $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables; - - } - if ( !$opt_extern ) - { - $ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables; - } + $ENV{'MYSQL_CHECK'}= client_arguments("mysqlcheck"); + $ENV{'MYSQL_DUMP'}= mysqldump_arguments(".1"); + $ENV{'MYSQL_DUMP_SLAVE'}= mysqldump_arguments(".2"); + $ENV{'MYSQL_SLAP'}= mysqlslap_arguments(); + $ENV{'MYSQL_IMPORT'}= client_arguments("mysqlimport"); + $ENV{'MYSQL_SHOW'}= client_arguments("mysqlshow"); + $ENV{'MYSQL_BINLOG'}= client_arguments("mysqlbinlog"); + $ENV{'MYSQL'}= client_arguments("mysql"); + $ENV{'MYSQL_UPGRADE'}= client_arguments("mysql_upgrade"); + $ENV{'MYSQLADMIN'}= native_path($exe_mysqladmin); + $ENV{'MYSQL_CLIENT_TEST'}= mysql_client_test_arguments(); + $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= mysql_fix_arguments(); + $ENV{'EXE_MYSQL'}= $exe_mysql; # ---------------------------------------------------- - # Setup env so childs can execute my_print_defaults - # ---------------------------------------------------- - $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= mtr_native_path($exe_my_print_defaults); - - # ---------------------------------------------------- - # Setup env so childs can execute mysqladmin - # ---------------------------------------------------- - $ENV{'MYSQLADMIN'}= mtr_native_path($exe_mysqladmin); - - # ---------------------------------------------------- - # Setup env so childs can execute perror + # bug25714 executable may _not_ exist in + # some versions, test using it should be skipped # ---------------------------------------------------- - $ENV{'MY_PERROR'}= mtr_native_path($exe_perror); + my $exe_bug25714= + mtr_exe_maybe_exists(vs_config_dirs('tests', 'bug25714'), + "$basedir/tests/bug25714"); + $ENV{'MYSQL_BUG25714'}= native_path($exe_bug25714); # ---------------------------------------------------- - # Add the path where mysqld will find udf_example.so + # mysql_fix_privilege_tables.sql # ---------------------------------------------------- - $ENV{'UDF_EXAMPLE_LIB'}= - ($lib_udf_example ? basename($lib_udf_example) : ""); - $ENV{'UDF_EXAMPLE_LIB_OPT'}= - ($lib_udf_example ? "--plugin_dir=" . dirname($lib_udf_example) : ""); + my $file_mysql_fix_privilege_tables= + mtr_file_exists("$basedir/scripts/mysql_fix_privilege_tables.sql", + "$basedir/share/mysql_fix_privilege_tables.sql", + "$basedir/share/mysql/mysql_fix_privilege_tables.sql"); + $ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables; # ---------------------------------------------------- - # Add the path where mysqld will find ha_example.so + # my_print_defaults # ---------------------------------------------------- - $ENV{'EXAMPLE_PLUGIN'}= - ($lib_example_plugin ? basename($lib_example_plugin) : ""); - $ENV{'EXAMPLE_PLUGIN_OPT'}= - ($lib_example_plugin ? "--plugin_dir=" . dirname($lib_example_plugin) : ""); + my $exe_my_print_defaults= + mtr_exe_exists(vs_config_dirs('extra', 'my_print_defaults'), + "$path_client_bindir/my_print_defaults", + "$basedir/extra/my_print_defaults"); + $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= native_path($exe_my_print_defaults); # ---------------------------------------------------- # Setup env so childs can execute myisampack and myisamchk # ---------------------------------------------------- - $ENV{'MYISAMCHK'}= mtr_native_path(mtr_exe_exists( + $ENV{'MYISAMCHK'}= native_path(mtr_exe_exists( vs_config_dirs('storage/myisam', 'myisamchk'), vs_config_dirs('myisam', 'myisamchk'), "$path_client_bindir/myisamchk", - "$glob_basedir/storage/myisam/myisamchk", - "$glob_basedir/myisam/myisamchk")); - $ENV{'MYISAMPACK'}= mtr_native_path(mtr_exe_exists( + "$basedir/storage/myisam/myisamchk", + "$basedir/myisam/myisamchk")); + $ENV{'MYISAMPACK'}= native_path(mtr_exe_exists( vs_config_dirs('storage/myisam', 'myisampack'), vs_config_dirs('myisam', 'myisampack'), "$path_client_bindir/myisampack", - "$glob_basedir/storage/myisam/myisampack", - "$glob_basedir/myisam/myisampack")); + "$basedir/storage/myisam/myisampack", + "$basedir/myisam/myisampack")); # ---------------------------------------------------- # Setup env so childs can execute maria_pack and maria_chk # ---------------------------------------------------- - $ENV{'MARIA_CHK'}= mtr_native_path(mtr_exe_maybe_exists( + $ENV{'MARIA_CHK'}= native_path(mtr_exe_maybe_exists( vs_config_dirs('storage/maria', 'maria_chk'), vs_config_dirs('maria', 'maria_chk'), "$path_client_bindir/maria_chk", - "$glob_basedir/storage/maria/maria_chk", - "$glob_basedir/maria/maria_chk")); - $ENV{'MARIA_PACK'}= mtr_native_path(mtr_exe_maybe_exists( + "$basedir/storage/maria/maria_chk", + "$basedir/maria/maria_chk")); + $ENV{'MARIA_PACK'}= native_path(mtr_exe_maybe_exists( vs_config_dirs('storage/maria', 'maria_pack'), vs_config_dirs('maria', 'maria_pack'), "$path_client_bindir/maria_pack", - "$glob_basedir/storage/maria/maria_pack", - "$glob_basedir/maria/maria_pack")); + "$basedir/storage/maria/maria_pack", + "$basedir/maria/maria_pack")); # ---------------------------------------------------- - # We are nice and report a bit about our settings + # perror # ---------------------------------------------------- - if (!$opt_extern) - { - print "Using MTR_BUILD_THREAD = $ENV{MTR_BUILD_THREAD}\n"; - print "Using MASTER_MYPORT = $ENV{MASTER_MYPORT}\n"; - print "Using MASTER_MYPORT1 = $ENV{MASTER_MYPORT1}\n"; - print "Using SLAVE_MYPORT = $ENV{SLAVE_MYPORT}\n"; - print "Using SLAVE_MYPORT1 = $ENV{SLAVE_MYPORT1}\n"; - print "Using SLAVE_MYPORT2 = $ENV{SLAVE_MYPORT2}\n"; - if ( ! $opt_skip_ndbcluster ) - { - print "Using NDBCLUSTER_PORT = $ENV{NDBCLUSTER_PORT}\n"; - if ( ! $opt_skip_ndbcluster_slave ) - { - print "Using NDBCLUSTER_PORT_SLAVE = $ENV{NDBCLUSTER_PORT_SLAVE}\n"; - } - } - if ( ! $opt_skip_im ) - { - print "Using IM_PORT = $ENV{IM_PORT}\n"; - print "Using IM_MYSQLD1_PORT = $ENV{IM_MYSQLD1_PORT}\n"; - print "Using IM_MYSQLD2_PORT = $ENV{IM_MYSQLD2_PORT}\n"; - } - } + my $exe_perror= mtr_exe_exists(vs_config_dirs('extra', 'perror'), + "$basedir/extra/perror", + "$path_client_bindir/perror"); + $ENV{'MY_PERROR'}= native_path($exe_perror); # Create an environment variable to make it possible # to detect that valgrind is being used from test cases $ENV{'VALGRIND_TEST'}= $opt_valgrind; - -} - - -############################################################################## -# -# If we get a ^C, we try to clean up before termination -# -############################################################################## -# FIXME check restrictions what to do in a signal handler - -sub signal_setup () { - $SIG{INT}= \&handle_int_signal; } -sub handle_int_signal () { - $SIG{INT}= 'DEFAULT'; # If we get a ^C again, we die... - mtr_warning("got INT signal, cleaning up....."); - stop_all_servers(); - mtr_error("We die from ^C signal from user"); -} - - -############################################################################## -# -# Handle left overs from previous runs -# -############################################################################## - -sub kill_running_servers () { - - if ( $opt_fast or $glob_use_embedded_server ) - { - # FIXME is embedded server really using PID files?! - unlink($master->[0]->{'path_pid'}); - unlink($master->[1]->{'path_pid'}); - unlink($slave->[0]->{'path_pid'}); - unlink($slave->[1]->{'path_pid'}); - unlink($slave->[2]->{'path_pid'}); - } - else - { - # Ensure that no old mysqld test servers are running - # This is different from terminating processes we have - # started from this run of the script, this is terminating - # leftovers from previous runs. - mtr_kill_leftovers(); - } -} # # Remove var and any directories in var/ created by previous @@ -2322,11 +1892,11 @@ sub kill_running_servers () { # sub remove_stale_vardir () { - mtr_report("Removing Stale Files"); + mtr_report("Removing old var directory..."); # Safety! mtr_error("No, don't remove the vardir when running with --extern") - if $opt_extern; + if using_extern(); mtr_verbose("opt_vardir: $opt_vardir"); if ( $opt_vardir eq $default_vardir ) @@ -2338,30 +1908,22 @@ sub remove_stale_vardir () { { # var is a symlink - if ( $opt_mem and readlink($opt_vardir) eq $opt_mem ) + if ( $opt_mem ) { # Remove the directory which the link points at mtr_verbose("Removing " . readlink($opt_vardir)); - mtr_rmtree(readlink($opt_vardir)); + rmtree(readlink($opt_vardir)); # Remove the "var" symlink mtr_verbose("unlink($opt_vardir)"); unlink($opt_vardir); } - elsif ( $opt_mem ) - { - # Just remove the "var" symlink - mtr_report("WARNING: Removing '$opt_vardir' symlink it's wrong"); - - mtr_verbose("unlink($opt_vardir)"); - unlink($opt_vardir); - } else { # Some users creates a soft link in mysql-test/var to another area # - allow it, but remove all files in it - mtr_report("WARNING: Using the 'mysql-test/var' symlink"); + mtr_report(" - WARNING: Using the 'mysql-test/var' symlink"); # Make sure the directory where it points exist mtr_error("The destination for symlink $opt_vardir does not exist") @@ -2370,7 +1932,7 @@ sub remove_stale_vardir () { foreach my $bin ( glob("$opt_vardir/*") ) { mtr_verbose("Removing bin $bin"); - mtr_rmtree($bin); + rmtree($bin); } } } @@ -2378,7 +1940,7 @@ sub remove_stale_vardir () { { # Remove the entire "var" dir mtr_verbose("Removing $opt_vardir/"); - mtr_rmtree("$opt_vardir/"); + rmtree("$opt_vardir/"); } if ( $opt_mem ) @@ -2387,7 +1949,7 @@ sub remove_stale_vardir () { # remove the $opt_mem dir to assure the symlink # won't point at an old directory mtr_verbose("Removing $opt_mem"); - mtr_rmtree($opt_mem); + rmtree($opt_mem); } } @@ -2400,19 +1962,24 @@ sub remove_stale_vardir () { # Remove the var/ dir in mysql-test dir if any # this could be an old symlink that shouldn't be there mtr_verbose("Removing $default_vardir"); - mtr_rmtree($default_vardir); + rmtree($default_vardir); # Remove the "var" dir mtr_verbose("Removing $opt_vardir/"); - mtr_rmtree("$opt_vardir/"); + rmtree("$opt_vardir/"); } + # Remove the "tmp" dir + mtr_verbose("Removing $opt_tmpdir/"); + rmtree("$opt_tmpdir/"); } + + # # Create var and the directories needed in var # sub setup_vardir() { - mtr_report("Creating Directories"); + mtr_report("Creating var directory '$opt_vardir'..."); if ( $opt_vardir eq $default_vardir ) { @@ -2433,7 +2000,7 @@ sub setup_vardir() { mtr_verbose("Creating $opt_mem"); mkpath($opt_mem); - mtr_report("Symlinking 'var' to '$opt_mem'"); + mtr_report(" - symlinking 'var' to '$opt_mem'"); symlink($opt_mem, $opt_vardir); } } @@ -2453,64 +2020,37 @@ sub setup_vardir() { mkpath("$opt_vardir/log"); mkpath("$opt_vardir/run"); - mkpath("$opt_vardir/tmp"); - mkpath($opt_tmpdir) if $opt_tmpdir ne "$opt_vardir/tmp"; - if ($master->[0]->{'path_sock'} !~ m/^$opt_tmpdir/) - { - mtr_report("Symlinking $master->[0]->{'path_sock'}"); - symlink($master->[0]->{'path_sock'}, "$opt_tmpdir/master.sock"); - } + # Create var/tmp and tmp - they might be different + mkpath("$opt_vardir/tmp"); + mkpath($opt_tmpdir) if ($opt_tmpdir ne "$opt_vardir/tmp"); - # Create new data dirs - foreach my $data_dir (@data_dir_lst) - { - mkpath("$data_dir/mysql"); - mkpath("$data_dir/test"); + # On some operating systems, there is a limit to the length of a + # UNIX domain socket's path far below PATH_MAX. + # Don't allow that to happen + if (check_socket_path_length("$opt_tmpdir/testsocket.sock")){ + mtr_error("Socket path '$opt_tmpdir' too long, it would be ", + "truncated and thus not possible to use for connection to ", + "MySQL Server. Set a shorter with --tmpdir=<path> option"); } - # Make a link std_data_ln in var/ that points to std_data - if ( ! $glob_win32 ) - { - symlink("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data_ln"); - } - else - { - # on windows, copy all files from std_data into var/std_data_ln - mkpath("$opt_vardir/std_data_ln"); - mtr_copy_dir("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data_ln"); - } + # copy all files from std_data into var/std_data + # and make them world readable + copytree("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data", "0022"); # Remove old log files foreach my $name (glob("r/*.progress r/*.log r/*.warnings")) { unlink($name); } - if ( $opt_valgrind and $opt_debug ) - { - # When both --valgrind and --debug is selected, send - # all output to the trace file, making it possible to - # see the exact location where valgrind complains - foreach my $mysqld (@{$master}, @{$slave}) - { - my $sidx= $mysqld->{idx} ? "$mysqld->{idx}" : ""; - my $trace_name= "$opt_vardir/log/" . $mysqld->{type} . "$sidx.trace"; - open(LOG, ">$mysqld->{path_myerr}") or die "Can't create $mysqld->{path_myerr}\n"; - print LOG " -NOTE: When running with --valgrind --debug the output from the .err file is -stored together with the trace file to make it easier to find the exact -position for valgrind errors. -See trace file $trace_name.\n"; - close(LOG); - $mysqld->{path_myerr}= $trace_name; - } - } } +# +# Check if running as root +# i.e a file can be read regardless what mode we set it to +# sub check_running_as_root () { - # Check if running as root - # i.e a file can be read regardless what mode we set it to my $test_file= "$opt_vardir/test_running_as_root.txt"; mtr_tofile($test_file, "MySQL"); chmod(oct("0000"), $test_file); @@ -2527,7 +2067,6 @@ sub check_running_as_root () { # the file will not return 0000 my $file_mode= (stat($test_file))[2] & 07777; - $ENV{'MYSQL_TEST_ROOT'}= "NO"; mtr_verbose("result: $result, file_mode: $file_mode"); if ($result eq "MySQL" && $file_mode == 0) { @@ -2538,19 +2077,15 @@ sub check_running_as_root () { chmod(oct("0755"), $test_file); unlink($test_file); - } sub check_ssl_support ($) { my $mysqld_variables= shift; - if ($opt_skip_ssl || $opt_extern) + if ($opt_skip_ssl) { - if (!$opt_extern) - { - mtr_report("Skipping SSL"); - } + mtr_report(" - skipping SSL"); $opt_ssl_supported= 0; $opt_ssl= 0; return; @@ -2563,12 +2098,12 @@ sub check_ssl_support ($) { mtr_error("Couldn't find support for SSL"); return; } - mtr_report("Skipping SSL, mysqld not compiled with SSL"); + mtr_report(" - skipping SSL, mysqld not compiled with SSL"); $opt_ssl_supported= 0; $opt_ssl= 0; return; } - mtr_report("Setting mysqld to support SSL connections"); + mtr_report(" - SSL connections supported"); $opt_ssl_supported= 1; } @@ -2578,7 +2113,7 @@ sub check_debug_support ($) { if ( ! $mysqld_variables->{'debug'} ) { - #mtr_report("Binaries are not debug compiled"); + #mtr_report(" - binaries are not debug compiled"); $debug_compiled_binaries= 0; if ( $opt_debug ) @@ -2587,11 +2122,11 @@ sub check_debug_support ($) { } return; } - mtr_report("Binaries are debug compiled"); + mtr_report(" - binaries are debug compiled"); $debug_compiled_binaries= 1; } -############################################################################## + # # Helper function to handle configuration-based subdirectories which Visual # Studio uses for storing binaries. If opt_vs_config is set, this returns @@ -2600,155 +2135,57 @@ sub check_debug_support ($) { # # $exe can be undefined, if the directory itself will be used # -############################################################################### - sub vs_config_dirs ($$) { my ($path_part, $exe) = @_; $exe = "" if not defined $exe; + # Don't look in these dirs when not on windows + return () unless IS_WINDOWS; + if ($opt_vs_config) { - return ("$glob_basedir/$path_part/$opt_vs_config/$exe"); + return ("$basedir/$path_part/$opt_vs_config/$exe"); } - return ("$glob_basedir/$path_part/release/$exe", - "$glob_basedir/$path_part/relwithdebinfo/$exe", - "$glob_basedir/$path_part/debug/$exe"); + return ("$basedir/$path_part/release/$exe", + "$basedir/$path_part/relwithdebinfo/$exe", + "$basedir/$path_part/debug/$exe"); } -############################################################################## -# -# Start the ndb cluster -# -############################################################################## sub check_ndbcluster_support ($) { my $mysqld_variables= shift; - if ($opt_skip_ndbcluster || $opt_extern) + if ($opt_skip_ndbcluster) { - if (!$opt_extern) - { - mtr_report("Skipping ndbcluster"); - } - $opt_skip_ndbcluster_slave= 1; + mtr_report(" - skipping ndbcluster"); return; } - if ( ! $mysqld_variables->{'ndb-connectstring'} ) + if ( ! $mysqld_variables{'ndb-connectstring'} ) { - mtr_report("Skipping ndbcluster, mysqld not compiled with ndbcluster"); - $opt_skip_ndbcluster= 1; - $opt_skip_ndbcluster_slave= 1; + mtr_report(" - skipping ndbcluster, mysqld not compiled with ndbcluster"); + $opt_skip_ndbcluster= 2; return; } - $glob_ndbcluster_supported= 1; - mtr_report("Using ndbcluster when necessary, mysqld supports it"); - if ( $mysql_version_id < 50100 ) - { - # Slave cluster is not supported until 5.1 - $opt_skip_ndbcluster_slave= 1; - - } + mtr_report(" - using ndbcluster when necessary, mysqld supports it"); return; } -sub ndbcluster_start_install ($) { - my $cluster= shift; - - mtr_report("Installing $cluster->{'name'} Cluster"); - - mkdir($cluster->{'data_dir'}); - - # Create a config file from template - my $ndb_no_ord=512; - my $ndb_no_attr=2048; - my $ndb_con_op=105000; - my $ndb_dmem="80M"; - my $ndb_imem="24M"; - my $ndb_pbmem="32M"; - my $nodes= $cluster->{'nodes'}; - my $ndb_host= "localhost"; - my $ndb_diskless= 0; - - if (!$opt_bench) - { - # Use a smaller configuration - if ( $mysql_version_id < 50100 ) - { - # 4.1 and 5.0 is using a "larger" --small configuration - $ndb_no_ord=128; - $ndb_con_op=10000; - $ndb_dmem="40M"; - $ndb_imem="12M"; - } - else - { - $ndb_no_ord=32; - $ndb_con_op=10000; - $ndb_dmem="20M"; - $ndb_imem="1M"; - $ndb_pbmem="4M"; - } - } - - my $config_file_template= "ndb/ndb_config_${nodes}_node.ini"; - my $config_file= "$cluster->{'data_dir'}/config.ini"; - - open(IN, $config_file_template) - or mtr_error("Can't open $config_file_template: $!"); - open(OUT, ">", $config_file) - or mtr_error("Can't write to $config_file: $!"); - while (<IN>) - { - chomp; - - s/CHOOSE_MaxNoOfAttributes/$ndb_no_attr/; - s/CHOOSE_MaxNoOfOrderedIndexes/$ndb_no_ord/; - s/CHOOSE_MaxNoOfConcurrentOperations/$ndb_con_op/; - s/CHOOSE_DataMemory/$ndb_dmem/; - s/CHOOSE_IndexMemory/$ndb_imem/; - s/CHOOSE_Diskless/$ndb_diskless/; - s/CHOOSE_HOSTNAME_.*/$ndb_host/; - s/CHOOSE_FILESYSTEM/$cluster->{'data_dir'}/; - s/CHOOSE_PORT_MGM/$cluster->{'port'}/; - if ( $mysql_version_id < 50000 ) - { - my $base_port= $cluster->{'port'} + 1; - s/CHOOSE_PORT_TRANSPORTER/$base_port/; - } - s/CHOOSE_DiskPageBufferMemory/$ndb_pbmem/; - - print OUT "$_ \n"; - } - close OUT; - close IN; - - - # Start cluster with "--initial" - - ndbcluster_start($cluster, "--initial"); - - return 0; -} - - sub ndbcluster_wait_started($$){ my $cluster= shift; my $ndb_waiter_extra_opt= shift; - my $path_waiter_log= "$cluster->{'data_dir'}/ndb_waiter.log"; - my $args; + my $path_waitlog= join('/', $opt_vardir, $cluster->name(), "ndb_waiter.log"); + my $args; mtr_init_args(\$args); - - mtr_add_arg($args, "--no-defaults"); - mtr_add_arg($args, "--core"); - mtr_add_arg($args, "--ndb-connectstring=%s", $cluster->{'connect_string'}); - mtr_add_arg($args, "--timeout=60"); + mtr_add_arg($args, "--defaults-file=%s", $path_config_file); + mtr_add_arg($args, "--defaults-group-suffix=%s", $cluster->suffix()); + mtr_add_arg($args, "--timeout=%d", $opt_start_timeout); if ($ndb_waiter_extra_opt) { @@ -2758,29 +2195,45 @@ sub ndbcluster_wait_started($$){ # Start the ndb_waiter which will connect to the ndb_mgmd # and poll it for state of the ndbd's, will return when # all nodes in the cluster is started - my $res= mtr_run($exe_ndb_waiter, $args, - "", $path_waiter_log, $path_waiter_log, ""); - mtr_verbose("ndbcluster_wait_started, returns: $res") if $res; - return $res; -} - + my $res= My::SafeProcess->run + ( + name => "ndb_waiter ".$cluster->name(), + path => $exe_ndb_waiter, + args => \$args, + output => $path_waitlog, + error => $path_waitlog, + append => 1, + ); + + # Check that ndb_mgmd(s) are still alive + foreach my $ndb_mgmd ( in_cluster($cluster, ndb_mgmds()) ) + { + my $proc= $ndb_mgmd->{proc}; + if ( ! $proc->wait_one(0) ) + { + mtr_warning("$proc died"); + return 2; + } + } -sub mysqld_wait_started($){ - my $mysqld= shift; + # Check that all started ndbd(s) are still alive + foreach my $ndbd ( in_cluster($cluster, ndbds()) ) + { + my $proc= $ndbd->{proc}; + next unless defined $proc; + if ( ! $proc->wait_one(0) ) + { + mtr_warning("$proc died"); + return 3; + } + } - if (sleep_until_file_created($mysqld->{'path_pid'}, - $mysqld->{'start_timeout'}, - $mysqld->{'pid'}) == 0) + if ($res) { - # Failed to wait for pid file + mtr_verbose("ndbcluster_wait_started failed"); return 1; } - - # Get the "real pid" of the process, it will be used for killing - # the process in ActiveState's perl on windows - $mysqld->{'real_pid'}= mtr_get_pid_from_file($mysqld->{'path_pid'}); - return 0; } @@ -2789,267 +2242,252 @@ sub ndb_mgmd_wait_started($) { my ($cluster)= @_; my $retries= 100; - while (ndbcluster_wait_started($cluster, "--no-contact") and - $retries) + while ($retries) { - # Millisceond sleep emulated with select - select(undef, undef, undef, (0.1)); + my $result= ndbcluster_wait_started($cluster, "--no-contact"); + if ($result == 0) + { + # ndb_mgmd is started + mtr_verbose("ndb_mgmd is started"); + return 0; + } + elsif ($result > 1) + { + mtr_warning("Cluster process failed while waiting for start"); + return $result; + } + mtr_milli_sleep(100); $retries--; } - return $retries == 0; - + return 1; } -sub ndb_mgmd_start ($) { - my $cluster= shift; - my $args; # Arg vector - my $pid= -1; +sub ndb_mgmd_start ($$) { + my ($cluster, $ndb_mgmd)= @_; + + mtr_verbose("ndb_mgmd_start"); + my $dir= $ndb_mgmd->value("DataDir"); + mkpath($dir) unless -d $dir; + + my $args; mtr_init_args(\$args); - mtr_add_arg($args, "--no-defaults"); - mtr_add_arg($args, "--core"); + mtr_add_arg($args, "--defaults-file=%s", $path_config_file); + mtr_add_arg($args, "--defaults-group-suffix=%s", $cluster->suffix()); + mtr_add_arg($args, "--mycnf"); mtr_add_arg($args, "--nodaemon"); - mtr_add_arg($args, "--config-file=%s", "$cluster->{'data_dir'}/config.ini"); + my $path_ndb_mgmd_log= "$dir/ndb_mgmd.log"; - my $path_ndb_mgmd_log= "$cluster->{'data_dir'}/\l$cluster->{'name'}_ndb_mgmd.log"; - $pid= mtr_spawn($exe_ndb_mgmd, $args, "", - $path_ndb_mgmd_log, - $path_ndb_mgmd_log, - "", - { append_log_file => 1 }); + $ndb_mgmd->{'proc'}= My::SafeProcess->new + ( + name => $ndb_mgmd->after('cluster_config.'), + path => $exe_ndb_mgmd, + args => \$args, + output => $path_ndb_mgmd_log, + error => $path_ndb_mgmd_log, + append => 1, + verbose => $opt_verbose, + ); + mtr_verbose("Started $ndb_mgmd->{proc}"); # FIXME Should not be needed # Unfortunately the cluster nodes will fail to start # if ndb_mgmd has not started properly if (ndb_mgmd_wait_started($cluster)) { - mtr_error("Failed to wait for start of ndb_mgmd"); + mtr_warning("Failed to wait for start of ndb_mgmd"); + return 1; } - # Remember pid of ndb_mgmd - $cluster->{'pid'}= $pid; - - mtr_verbose("ndb_mgmd_start, pid: $pid"); - - return $pid; + return 0; } -sub ndbd_start ($$$) { - my $cluster= shift; - my $idx= shift; - my $extra_args= shift; +sub ndbd_start { + my ($cluster, $ndbd)= @_; + + mtr_verbose("ndbd_start"); - my $args; # Arg vector - my $pid= -1; + my $dir= $ndbd->value("DataDir"); + mkpath($dir) unless -d $dir; + my $args; mtr_init_args(\$args); - mtr_add_arg($args, "--no-defaults"); - mtr_add_arg($args, "--core"); - mtr_add_arg($args, "--ndb-connectstring=%s", "$cluster->{'connect_string'}"); - if ( $mysql_version_id >= 50000) - { - mtr_add_arg($args, "--character-sets-dir=%s", "$path_charsetsdir"); - } + mtr_add_arg($args, "--defaults-file=%s", $path_config_file); + mtr_add_arg($args, "--defaults-group-suffix=%s", $cluster->suffix()); mtr_add_arg($args, "--nodaemon"); - mtr_add_arg($args, "$extra_args"); - my $nodeid= $cluster->{'ndbds'}->[$idx]->{'nodeid'}; - my $path_ndbd_log= "$cluster->{'data_dir'}/ndb_${nodeid}.log"; - $pid= mtr_spawn($exe_ndbd, $args, "", - $path_ndbd_log, - $path_ndbd_log, - "", - { append_log_file => 1 }); +# > 5.0 { 'character-sets-dir' => \&fix_charset_dir }, - # Add pid to list of pids for this cluster - $cluster->{'ndbds'}->[$idx]->{'pid'}= $pid; - # Rememeber options used when starting - $cluster->{'ndbds'}->[$idx]->{'start_extra_args'}= $extra_args; - $cluster->{'ndbds'}->[$idx]->{'idx'}= $idx; + my $path_ndbd_log= "$dir/ndbd.log"; + my $proc= My::SafeProcess->new + ( + name => $ndbd->after('cluster_config.'), + path => $exe_ndbd, + args => \$args, + output => $path_ndbd_log, + error => $path_ndbd_log, + append => 1, + verbose => $opt_verbose, + ); + mtr_verbose("Started $proc"); - mtr_verbose("ndbd_start, pid: $pid"); + $ndbd->{proc}= $proc; - return $pid; + return; } -sub ndbcluster_start ($$) { +sub ndbcluster_start ($) { my $cluster= shift; - my $extra_args= shift; - mtr_verbose("ndbcluster_start '$cluster->{'name'}'"); + mtr_verbose("ndbcluster_start '".$cluster->name()."'"); - if ( $cluster->{'use_running'} ) + foreach my $ndb_mgmd ( in_cluster($cluster, ndb_mgmds()) ) { - return 0; - } - - if ( $cluster->{'pid'} ) - { - mtr_error("Cluster '$cluster->{'name'}' already started"); + next if started($ndb_mgmd); + ndb_mgmd_start($cluster, $ndb_mgmd); } - ndb_mgmd_start($cluster); - - for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ ) + foreach my $ndbd ( in_cluster($cluster, ndbds()) ) { - ndbd_start($cluster, $idx, $extra_args); + next if started($ndbd); + ndbd_start($cluster, $ndbd); } return 0; } -sub rm_ndbcluster_tables ($) { - my $dir= shift; - foreach my $bin ( glob("$dir/mysql/ndb_apply_status*"), - glob("$dir/mysql/ndb_schema*")) - { - unlink($bin); - } -} +sub create_config_file_for_extern { + my %opts= + ( + socket => '/tmp/mysqld.sock', + port => 3306, + user => $opt_user, + password => '', + @_ + ); + mtr_report("Creating my.cnf file for extern server..."); + my $F= IO::File->new($path_config_file, "w") + or mtr_error("Can't write to $path_config_file: $!"); -############################################################################## -# -# Run the benchmark suite -# -############################################################################## - -sub run_benchmarks ($) { - my $benchmark= shift; - - my $args; - - if ( ! $glob_use_embedded_server ) - { - mysqld_start($master->[0],[],[]); - if ( ! $master->[0]->{'pid'} ) - { - mtr_error("Can't start the mysqld server"); - } + print $F "[client]\n"; + while (my ($option, $value)= each( %opts )) { + print $F "$option= $value\n"; + mtr_report(" $option= $value"); } - mtr_init_args(\$args); + print $F <<EOF - mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'}); - mtr_add_arg($args, "--user=%s", $opt_user); +# binlog reads from [client] and [mysqlbinlog] +[mysqlbinlog] +character-sets-dir= $path_charsetsdir - if ( $opt_small_bench ) - { - mtr_add_arg($args, "--small-test"); - mtr_add_arg($args, "--small-tables"); - } - - if ( $opt_with_ndbcluster ) - { - mtr_add_arg($args, "--create-options=TYPE=ndb"); - } +# mysql_fix_privilege_tables.sh don't read from [client] +[mysql_fix_privilege_tables] +socket = $opts{'socket'} +port = $opts{'port'} +user = $opts{'user'} +password = $opts{'password'} - chdir($glob_mysql_bench_dir) - or mtr_error("Couldn't chdir to '$glob_mysql_bench_dir': $!"); - - if ( ! $benchmark ) - { - mtr_add_arg($args, "--log"); - mtr_run("$glob_mysql_bench_dir/run-all-tests", $args, "", "", "", ""); - # FIXME check result code?! - } - elsif ( -x $benchmark ) - { - mtr_run("$glob_mysql_bench_dir/$benchmark", $args, "", "", "", ""); - # FIXME check result code?! - } - else - { - mtr_error("Benchmark $benchmark not found"); - } - chdir($glob_mysql_test_dir); # Go back +EOF +; - if ( ! $glob_use_embedded_server ) - { - stop_masters(); - } + $F= undef; # Close file } -############################################################################## # -# Run the tests +# Kill processes left from previous runs, normally +# there should be none so make sure to warn +# if there is one # -############################################################################## - -sub run_tests () { - my ($tests)= @_; - - mtr_print_thick_line(); +sub kill_leftovers ($) { + my $rundir= shift; + return unless ( -d $rundir ); - mtr_timer_start($glob_timers,"suite", 60 * $opt_suite_timeout); - - mtr_report_tests_not_skipped_though_disabled($tests); - - mtr_print_header(); + mtr_report("Checking leftover processes..."); - foreach my $tinfo ( @$tests ) + # Scan the "run" directory for process id's to kill + opendir(RUNDIR, $rundir) + or mtr_error("kill_leftovers, can't open dir \"$rundir\": $!"); + while ( my $elem= readdir(RUNDIR) ) { - if (run_testcase_check_skip_test($tinfo)) + # Only read pid from files that end with .pid + if ( $elem =~ /.*[.]pid$/ ) { - next; - } - - mtr_timer_start($glob_timers,"testcase", 60 * $opt_testcase_timeout); - run_testcase($tinfo); - mtr_timer_stop($glob_timers,"testcase"); - } + my $pidfile= "$rundir/$elem"; + next unless -f $pidfile; + my $pid= mtr_fromfile($pidfile); + unlink($pidfile); + unless ($pid=~ /^(\d+)/){ + # The pid was not a valid number + mtr_warning("Got invalid pid '$pid' from '$elem'"); + next; + } + mtr_report(" - found old pid $pid in '$elem', killing it..."); - mtr_print_line(); + my $ret= kill("KILL", $pid); + if ($ret == 0) { + mtr_report(" process did not exist!"); + next; + } - if ( ! $glob_debugger and - ! $opt_extern and - ! $glob_use_embedded_server ) - { - stop_all_servers(); + my $check_counter= 100; + while ($ret > 0 and $check_counter--) { + mtr_milli_sleep(100); + $ret= kill(0, $pid); + } + mtr_report($check_counter ? " ok!" : " failed!"); + } + else + { + mtr_warning("Found non pid file '$elem' in '$rundir'") + if -f "$rundir/$elem"; + } } + closedir(RUNDIR); +} - if ( $opt_gcov ) - { - gcov_collect(); # collect coverage information +# +# Check that all the ports that are going to +# be used are free +# +sub check_ports_free +{ + my @ports_to_check; + for ($baseport..$baseport+9){ + push(@ports_to_check, $_); } - if ( $opt_gprof ) - { - gprof_collect(); # collect coverage information + #mtr_report("Checking ports..."); + # print "@ports_to_check\n"; + foreach my $port (@ports_to_check){ + if (mtr_ping_port($port)){ + mtr_report(" - 'localhost:$port' was not free"); + return 1; # One port was not free + } } - mtr_report_stats($tests); - - mtr_timer_stop($glob_timers,"suite"); + return 0; # All ports free } -############################################################################## -# -# Initiate the test databases -# -############################################################################## - -sub initialize_servers () { - - datadir_list_setup(); +sub initialize_servers { - if ( $opt_extern ) + if ( using_extern() ) { # Running against an already started server, if the specified # vardir does not already exist it should be created if ( ! -d $opt_vardir ) { - mtr_report("Creating '$opt_vardir'"); setup_vardir(); } else @@ -3059,141 +2497,115 @@ sub initialize_servers () { } else { - kill_running_servers(); + # Kill leftovers from previous run + # using any pidfiles found in var/run + kill_leftovers("$opt_vardir/run"); if ( ! $opt_start_dirty ) { remove_stale_vardir(); setup_vardir(); - mysql_install_db(); - if ( $opt_force ) - { - # Save a snapshot of the freshly installed db - # to make it possible to restore to a known point in time - save_installed_db(); - } + mysql_install_db(default_mysqld(), "$opt_vardir/install.db"); } } - check_running_as_root(); - - mtr_log_init("$opt_vardir/log/mysql-test-run.log"); - } -sub mysql_install_db () { - - install_db('master', $master->[0]->{'path_myddir'}); - - if ($max_master_num > 1) - { - copy_install_db('master', $master->[1]->{'path_myddir'}); - } - - # Install the number of slave databses needed - for (my $idx= 0; $idx < $max_slave_num; $idx++) - { - copy_install_db("slave".($idx+1), $slave->[$idx]->{'path_myddir'}); - } - - if ( ! $opt_skip_im ) - { - im_prepare_env($instance_manager); - } - - my $cluster_started_ok= 1; # Assume it can be started - - my $cluster= $clusters->[0]; # Master cluster - if ($opt_skip_ndbcluster || - $cluster->{'use_running'} || - $cluster->{executable_setup_failed}) - { - # Don't install master cluster - } - elsif (ndbcluster_start_install($cluster)) - { - mtr_warning("Failed to start install of $cluster->{name}"); - $cluster_started_ok= 0; - } - - $cluster= $clusters->[1]; # Slave cluster - if ($max_slave_num == 0 || - $opt_skip_ndbcluster_slave || - $cluster->{'use_running'} || - $cluster->{executable_setup_failed}) - { - # Don't install slave cluster - } - elsif (ndbcluster_start_install($cluster)) - { - mtr_warning("Failed to start install of $cluster->{name}"); - $cluster_started_ok= 0; - } - foreach $cluster (@{$clusters}) - { - - next if !$cluster->{'pid'}; - - $cluster->{'installed_ok'}= 1; # Assume install suceeds - - if (ndbcluster_wait_started($cluster, "")) - { - # failed to install, disable usage and flag that its no ok - mtr_report("ndbcluster_install of $cluster->{'name'} failed"); - $cluster->{"installed_ok"}= 0; - - $cluster_started_ok= 0; +# +# Remove all newline characters expect after semicolon +# +sub sql_to_bootstrap { + my ($sql) = @_; + my @lines= split(/\n/, $sql); + my $result= "\n"; + my $delimiter= ';'; + + foreach my $line (@lines) { + + # Change current delimiter if line starts with "delimiter" + if ( $line =~ /^delimiter (.*)/ ) { + my $new= $1; + # Remove old delimiter from end of new + $new=~ s/\Q$delimiter\E$//; + $delimiter = $new; + mtr_debug("changed delimiter to $delimiter"); + # No need to add the delimiter to result + next; } - } - if ( ! $cluster_started_ok ) - { - if ( $opt_force) - { - # Continue without cluster + # Add newline if line ends with $delimiter + # and convert the current delimiter to semicolon + if ( $line =~ /\Q$delimiter\E$/ ){ + $line =~ s/\Q$delimiter\E$/;/; + $result.= "$line\n"; + mtr_debug("Added default delimiter"); + next; } - else - { - mtr_error("To continue, re-run with '--force'."); + + # Remove comments starting with -- + if ( $line =~ /^\s*--/ ) { + mtr_debug("Discarded $line"); + next; } - } - return 0; -} + # Replace @HOSTNAME with localhost + $line=~ s/\'\@HOSTNAME\@\'/localhost/; + # Default, just add the line without newline + # but with a space as separator + $result.= "$line "; -sub copy_install_db ($$) { - my $type= shift; - my $data_dir= shift; + } + return $result; +} - mtr_report("Installing \u$type Database"); - # Just copy the installed db from first master - mtr_copy_dir($master->[0]->{'path_myddir'}, $data_dir); +sub default_mysqld { + # Generate new config file from template + my $config= My::ConfigFactory->new_config + ( { + basedir => $basedir, + template_path => "include/default_my.cnf", + vardir => $opt_vardir, + tmpdir => $opt_tmpdir, + baseport => 0, + user => $opt_user, + password => '', + } + ); + my $mysqld= $config->group('mysqld.1') + or mtr_error("Couldn't find mysqld.1 in default config"); + return $mysqld; } -sub install_db ($$) { - my $type= shift; - my $data_dir= shift; +sub mysql_install_db { + my ($mysqld, $datadir)= @_; + + my $install_datadir= $datadir || $mysqld->value('datadir'); + my $install_basedir= $mysqld->value('basedir'); + my $install_lang= $mysqld->value('language'); + my $install_chsdir= $mysqld->value('character-sets-dir'); - mtr_report("Installing \u$type Database"); + mtr_report("Installing system database..."); my $args; my $cmd_args; mtr_init_args(\$args); mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--bootstrap"); - mtr_add_arg($args, "--basedir=%s", $path_my_basedir); - mtr_add_arg($args, "--datadir=%s", $data_dir); + mtr_add_arg($args, "--basedir=%s", $install_basedir); + mtr_add_arg($args, "--datadir=%s", $install_datadir); mtr_add_arg($args, "--loose-skip-innodb"); + mtr_add_arg($args, "--loose-skip-falcon"); mtr_add_arg($args, "--loose-skip-ndbcluster"); mtr_add_arg($args, "--loose-skip-maria"); mtr_add_arg($args, "--disable-sync-frm"); mtr_add_arg($args, "--loose-disable-debug"); mtr_add_arg($args, "--tmpdir=."); + mtr_add_arg($args, "--tmpdir=%s", "$opt_vardir/tmp/"); mtr_add_arg($args, "--core-file"); # @@ -3204,22 +2616,20 @@ sub install_db ($$) { if ( $opt_debug ) { - mtr_add_arg($args, "--debug=d:t:i:A,%s/log/bootstrap_%s.trace", - $path_vardir_trace, $type); + mtr_add_arg($args, "--debug=d:t:i:A,%s/log/bootstrap.trace", + $path_vardir_trace); } - if ( ! $glob_netware ) - { - mtr_add_arg($args, "--language=%s", $path_language); - mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); - } + mtr_add_arg($args, "--language=%s", $install_lang); + mtr_add_arg($args, "--character-sets-dir=%s", $install_chsdir); # If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g., # configure --disable-grant-options), mysqld will not recognize the # --bootstrap or --skip-grant-tables options. The user can set # MYSQLD_BOOTSTRAP to the full path to a mysqld which does accept # --bootstrap, to accommodate this. - my $exe_mysqld_bootstrap = $ENV{'MYSQLD_BOOTSTRAP'} || $exe_mysqld; + my $exe_mysqld_bootstrap = + $ENV{'MYSQLD_BOOTSTRAP'} || find_mysqld($install_basedir); # ---------------------------------------------------------------------- # export MYSQLD_BOOTSTRAP_CMD variable containing <path>/mysqld <args> @@ -3227,50 +2637,97 @@ sub install_db ($$) { $ENV{'MYSQLD_BOOTSTRAP_CMD'}= "$exe_mysqld_bootstrap " . join(" ", @$args) . " " . join(" ", @$cmd_args); + + # ---------------------------------------------------------------------- # Create the bootstrap.sql file # ---------------------------------------------------------------------- my $bootstrap_sql_file= "$opt_vardir/tmp/bootstrap.sql"; - # Use the mysql database for system tables - mtr_tofile($bootstrap_sql_file, "use mysql"); + my $path_sql= my_find_file($install_basedir, + ["mysql", "sql/share", "share/mysql", + "share", "scripts"], + "mysql_system_tables.sql", + NOT_REQUIRED); - # Add the offical mysql system tables - # for a production system - mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables.sql", - $bootstrap_sql_file); + if (-f $path_sql ) + { + my $sql_dir= dirname($path_sql); + # Use the mysql database for system tables + mtr_tofile($bootstrap_sql_file, "use mysql\n"); + + # Add the offical mysql system tables + # for a production system + mtr_appendfile_to_file("$sql_dir/mysql_system_tables.sql", + $bootstrap_sql_file); - # Add the mysql system tables initial data - # for a production system - mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables_data.sql", - $bootstrap_sql_file); + # Add the mysql system tables initial data + # for a production system + mtr_appendfile_to_file("$sql_dir/mysql_system_tables_data.sql", + $bootstrap_sql_file); - # Add test data for timezone - this is just a subset, on a real - # system these tables will be populated either by mysql_tzinfo_to_sql - # or by downloading the timezone table package from our website - mtr_appendfile_to_file("$path_sql_dir/mysql_test_data_timezone.sql", - $bootstrap_sql_file); + # Add test data for timezone - this is just a subset, on a real + # system these tables will be populated either by mysql_tzinfo_to_sql + # or by downloading the timezone table package from our website + mtr_appendfile_to_file("$sql_dir/mysql_test_data_timezone.sql", + $bootstrap_sql_file); - # Fill help tables, just an empty file when running from bk repo - # but will be replaced by a real fill_help_tables.sql when - # building the source dist - mtr_appendfile_to_file("$path_sql_dir/fill_help_tables.sql", - $bootstrap_sql_file); + # Fill help tables, just an empty file when running from bk repo + # but will be replaced by a real fill_help_tables.sql when + # building the source dist + mtr_appendfile_to_file("$sql_dir/fill_help_tables.sql", + $bootstrap_sql_file); + + } + else + { + # Install db from init_db.sql that exist in early 5.1 and 5.0 + # versions of MySQL + my $init_file= "$install_basedir/mysql-test/lib/init_db.sql"; + mtr_report(" - from '$init_file'"); + my $text= mtr_grab_file($init_file) or + mtr_error("Can't open '$init_file': $!"); + + mtr_tofile($bootstrap_sql_file, + sql_to_bootstrap($text)); + } # Remove anonymous users mtr_tofile($bootstrap_sql_file, - "DELETE FROM mysql.user where user= '';"); + "DELETE FROM mysql.user where user= '';\n"); + + # Create mtr database + mtr_tofile($bootstrap_sql_file, + "CREATE DATABASE mtr;\n"); + + # Add help tables and data for warning detection and supression + mtr_tofile($bootstrap_sql_file, + sql_to_bootstrap(mtr_grab_file("include/mtr_warnings.sql"))); + + # Add procedures for checking server is restored after testcase + mtr_tofile($bootstrap_sql_file, + sql_to_bootstrap(mtr_grab_file("include/mtr_check.sql"))); # Log bootstrap command my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log"; mtr_tofile($path_bootstrap_log, "$exe_mysqld_bootstrap " . join(" ", @$args) . "\n"); - - if ( mtr_run($exe_mysqld_bootstrap, $args, $bootstrap_sql_file, - $path_bootstrap_log, $path_bootstrap_log, - "", { append_log_file => 1 }) != 0 ) - + # Create directories mysql and test + mkpath("$install_datadir/mysql"); + mkpath("$install_datadir/test"); + + if ( My::SafeProcess->run + ( + name => "bootstrap", + path => $exe_mysqld_bootstrap, + args => \$args, + input => $bootstrap_sql_file, + output => $path_bootstrap_log, + error => $path_bootstrap_log, + append => 1, + verbose => $opt_verbose, + ) != 0) { mtr_error("Error executing mysqld --bootstrap\n" . "Could not install system database from $bootstrap_sql_file\n" . @@ -3279,127 +2736,6 @@ sub install_db ($$) { } -sub im_prepare_env($) { - my $instance_manager = shift; - - im_create_passwd_file($instance_manager); - im_prepare_data_dir($instance_manager); -} - - -sub im_create_passwd_file($) { - my $instance_manager = shift; - - my $pwd_file_path = $instance_manager->{'password_file'}; - - mtr_report("Creating IM password file ($pwd_file_path)"); - - open(OUT, ">", $pwd_file_path) - or mtr_error("Can't write to $pwd_file_path: $!"); - - print OUT $instance_manager->{'admin_login'}, ":", - $instance_manager->{'admin_sha1'}, "\n"; - - close(OUT); -} - - -sub im_create_defaults_file($) { - my $instance_manager = shift; - - my $defaults_file = $instance_manager->{'defaults_file'}; - - open(OUT, ">", $defaults_file) - or mtr_error("Can't write to $defaults_file: $!"); - - print OUT <<EOF -[mysql] - -[manager] -pid-file = $instance_manager->{path_pid} -angel-pid-file = $instance_manager->{path_angel_pid} -socket = $instance_manager->{path_sock} -port = $instance_manager->{port} -password-file = $instance_manager->{password_file} -default-mysqld-path = $exe_mysqld - -EOF -; - - foreach my $instance (@{$instance_manager->{'instances'}}) - { - my $server_id = $instance->{'server_id'}; - - print OUT <<EOF -[mysqld$server_id] -socket = $instance->{path_sock} -pid-file = $instance->{path_pid} -port = $instance->{port} -datadir = $instance->{path_datadir} -general-log-file = $instance->{path_datadir}/mysqld$server_id.log -general-log = 1 -log-error = $instance->{path_datadir}/mysqld$server_id.err.log -slow-query-log-file = $instance->{path_datadir}/mysqld$server_id.slow.log -slow-query-log = 1 -language = $path_language -character-sets-dir = $path_charsetsdir -basedir = $path_my_basedir -server_id = $server_id -shutdown-delay = 10 -skip-stack-trace -loose-skip-innodb -loose-skip-ndbcluster -EOF -; - if ( $mysql_version_id < 50100 ) - { - print OUT "skip-bdb\n"; - } - print OUT "nonguarded\n" if $instance->{'nonguarded'}; - if ( $mysql_version_id >= 50100 ) - { - print OUT "log-output=FILE\n" if $instance->{'old_log_format'}; - } - print OUT "\n"; - } - - close(OUT); -} - - -sub im_prepare_data_dir($) { - my $instance_manager = shift; - - foreach my $instance (@{$instance_manager->{'instances'}}) - { - copy_install_db( - 'im_mysqld_' . $instance->{'server_id'}, - $instance->{'path_datadir'}); - } -} - - - -# -# Restore snapshot of the installed slave databases -# if the snapshot exists -# -sub restore_slave_databases ($) { - my ($num_slaves)= @_; - - if ( -d $path_snapshot) - { - for (my $idx= 0; $idx < $num_slaves; $idx++) - { - my $data_dir= $slave->[$idx]->{'path_myddir'}; - my $name= basename($data_dir); - mtr_rmtree($data_dir); - mtr_copy_dir("$path_snapshot/$name", $data_dir); - } - } -} - - sub run_testcase_check_skip_test($) { my ($tinfo)= @_; @@ -3408,12 +2744,14 @@ sub run_testcase_check_skip_test($) # Skip some tests silently # ---------------------------------------------------------------------- - if ( $::opt_start_from ) + my $start_from= $mtr_cases::start_from; + if ( $start_from ) { - if ($tinfo->{'name'} eq $::opt_start_from ) + if ($tinfo->{'name'} eq $start_from || + $tinfo->{'shortname'} eq $start_from) { ## Found parting test. Run this test and all tests after this one - $::opt_start_from= ""; + $mtr_cases::start_from= ""; } else { @@ -3431,152 +2769,315 @@ sub run_testcase_check_skip_test($) if ( $tinfo->{'skip'} ) { - mtr_report_test_name($tinfo); mtr_report_test_skipped($tinfo); return 1; } - if ($tinfo->{'ndb_test'}) - { - foreach my $cluster (@{$clusters}) - { - # Slave cluster is skipped and thus not - # installed, no need to perform checks - last if ($opt_skip_ndbcluster_slave and - $cluster->{'name'} eq 'Slave'); - - # Using running cluster - no need - # to check if test should be skipped - # will be done by test itself - last if ($cluster->{'use_running'}); - - # If test needs this cluster, check binaries was found ok - if ( $cluster->{'executable_setup_failed'} ) - { - mtr_report_test_name($tinfo); - $tinfo->{comment}= - "Failed to find cluster binaries"; - mtr_report_test_failed($tinfo); - return 1; - } + return 0; +} - # If test needs this cluster, check it was installed ok - if ( !$cluster->{'installed_ok'} ) - { - mtr_report_test_name($tinfo); - $tinfo->{comment}= - "Cluster $cluster->{'name'} was not installed ok"; - mtr_report_test_failed($tinfo); - return 1; - } - } - } +sub run_query { + my ($tinfo, $mysqld, $query)= @_; - if ( $tinfo->{'component_id'} eq 'im' ) - { - # If test needs im, check binaries was found ok - if ( $instance_manager->{'executable_setup_failed'} ) - { - mtr_report_test_name($tinfo); - $tinfo->{comment}= - "Failed to find MySQL manager binaries"; - mtr_report_test_failed($tinfo); - return 1; - } - } + my $args; + mtr_init_args(\$args); + mtr_add_arg($args, "--defaults-file=%s", $path_config_file); + mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld')); - return 0; + mtr_add_arg($args, "-e %s", $query); + + my $res= My::SafeProcess->run + ( + name => "run_query -> ".$mysqld->name(), + path => $exe_mysql, + args => \$args, + output => '/dev/null', + error => '/dev/null' + ); + + return $res } sub do_before_run_mysqltest($) { my $tinfo= shift; - my $args; # Remove old files produced by mysqltest - my $base_file= mtr_match_extension($tinfo->{'result_file'}, - "result"); # Trim extension - unlink("$base_file.reject"); - unlink("$base_file.progress"); - unlink("$base_file.log"); - unlink("$base_file.warnings"); - - if (!$opt_extern) - { - if ( $mysql_version_id < 50000 ) { - # Set environment variable NDB_STATUS_OK to 1 - # if script decided to run mysqltest cluster _is_ installed ok - $ENV{'NDB_STATUS_OK'} = "1"; - } elsif ( $mysql_version_id < 50100 ) { - # Set environment variable NDB_STATUS_OK to YES - # if script decided to run mysqltest cluster _is_ installed ok - $ENV{'NDB_STATUS_OK'} = "YES"; - } - if (defined $tinfo->{binlog_format} and $mysql_version_id > 50100 ) + my $base_file= mtr_match_extension($tinfo->{result_file}, + "result"); # Trim extension + if (defined $base_file ){ + unlink("$base_file.reject"); + unlink("$base_file.progress"); + unlink("$base_file.log"); + unlink("$base_file.warnings"); + } + + if ( $mysql_version_id < 50000 ) { + # Set environment variable NDB_STATUS_OK to 1 + # if script decided to run mysqltest cluster _is_ installed ok + $ENV{'NDB_STATUS_OK'} = "1"; + } elsif ( $mysql_version_id < 50100 ) { + # Set environment variable NDB_STATUS_OK to YES + # if script decided to run mysqltest cluster _is_ installed ok + $ENV{'NDB_STATUS_OK'} = "YES"; + } +} + + +# +# Check all server for sideffects +# +# RETURN VALUE +# 0 ok +# 1 Check failed +# >1 Fatal errro + +sub check_testcase($$) +{ + my ($tinfo, $mode)= @_; + my $tname= $tinfo->{name}; + + # Start the mysqltest processes in parallel to save time + # also makes it possible to wait for any process to exit during the check + my %started; + foreach my $mysqld ( mysqlds() ) + { + if ( defined $mysqld->{'proc'} ) { - # Dynamically switch binlog format of - # master, slave is always restarted - foreach my $server ( @$master ) - { - next unless ($server->{'pid'}); + my $proc= start_check_testcase($tinfo, $mode, $mysqld); + $started{$proc->pid()}= $proc; + } + } + + # Return immediately if no check proceess was started + return 0 unless ( keys %started ); + + my $timeout_proc= My::SafeProcess->timer(check_timeout()); + + while (1){ + my $result; + my $proc= My::SafeProcess->wait_any(); + mtr_report("Got $proc"); + + if ( delete $started{$proc->pid()} ) { + + my $err_file= $proc->user_data(); + my $base_file= mtr_match_extension($err_file, "err"); # Trim extension + + # One check testcase process returned + my $res= $proc->exit_status(); + + if ( $res == 0){ + # Check completed without problem + + # Remove the .err file the check generated + unlink($err_file); - mtr_init_args(\$args); - mtr_add_arg($args, "--no-defaults"); - mtr_add_arg($args, "--user=root"); - mtr_add_arg($args, "--port=$server->{'port'}"); - mtr_add_arg($args, "--socket=$server->{'path_sock'}"); + # Remove the .result file the check generated + if ( $mode eq 'after' ){ + unlink("$base_file.result"); + } + + if ( keys(%started) == 0){ + # All checks completed + + $timeout_proc->kill(); + + return 0; + } + # Wait for next process to exit + next; + } + else + { + if ( $mode eq "after" and $res == 1 ) + { + # Test failed, grab the report mysqltest has created + my $report= mtr_grab_file($err_file); + $tinfo->{check}.= + "\nMTR's internal check of the test case '$tname' failed. +This means that the test case does not preserve the state that existed +before the test case was executed. Most likely the test case did not +do a proper clean-up. +This is the diff of the states of the servers before and after the +test case was executed:\n"; + $tinfo->{check}.= $report; - my $sql= "include/set_binlog_format_".$tinfo->{binlog_format}.".sql"; - mtr_verbose("Setting binlog format:", $tinfo->{binlog_format}); - if (mtr_run($exe_mysql, $args, $sql, "", "", "") != 0) + # Check failed, mark the test case with that info + $tinfo->{'check_testcase_failed'}= 1; + $result= 1; + } + elsif ( $res ) { - mtr_error("Failed to switch binlog format"); + my $report= mtr_grab_file($err_file); + $tinfo->{comment}.= + "Could not execute 'check-testcase' $mode ". + "testcase '$tname' (res: $res):\n"; + $tinfo->{comment}.= $report; + + $result= 2; } + else + { + # Remove the .result file the check generated + unlink("$base_file.result"); + } + # Remove the .err file the check generated + unlink($err_file); + } } + elsif ( $proc eq $timeout_proc ) { + $tinfo->{comment}.= "Timeout $timeout_proc for ". + "'check-testcase' expired after ".check_timeout(). + " seconds"; + $result= 4; + } + else { + # Unknown process returned, most likley a crash, abort everything + $tinfo->{comment}= + "The server $proc crashed while running ". + "'check testcase $mode test'"; + $result= 3; + } + + # Kill any check processes still running + map($_->kill(), values(%started)); + + $timeout_proc->kill(); + + return $result; } + + mtr_error("INTERNAL_ERROR: check_testcase"); } -sub do_after_run_mysqltest($) -{ - my $tinfo= shift; - # Save info from this testcase run to mysqltest.log - mtr_appendfile_to_file($path_current_test_log, $path_mysqltest_log) - if -f $path_current_test_log; - mtr_appendfile_to_file($path_timefile, $path_mysqltest_log) - if -f $path_timefile; -} +# Start run mysqltest on one server +# +# RETURN VALUE +# 0 OK +# 1 Check failed +# +sub start_run_one ($$) { + my ($mysqld, $run)= @_; + my $name= "$run-".$mysqld->name(); -sub run_testcase_mark_logs($$) -{ - my ($tinfo, $log_msg)= @_; + my $args; + mtr_init_args(\$args); + + mtr_add_arg($args, "--defaults-file=%s", $path_config_file); + mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld')); - # Write a marker to all log files + mtr_add_arg($args, "--silent"); + mtr_add_arg($args, "--skip-safemalloc"); + mtr_add_arg($args, "--test-file=%s", "include/$run.test"); + + my $errfile= "$opt_vardir/tmp/$name.err"; + my $proc= My::SafeProcess->new + ( + name => $name, + path => $exe_mysqltest, + error => $errfile, + output => $errfile, + args => \$args, + user_data => $errfile, + verbose => $opt_verbose, + ); + mtr_verbose("Started $proc"); + return $proc; +} + + +# +# Run script on all servers, collect results +# +# RETURN VALUE +# 0 ok +# 1 Failure - # The file indicating current test name - mtr_tonewfile($path_current_test_log, $log_msg); +sub run_on_all($$) +{ + my ($tinfo, $run)= @_; - # each mysqld's .err file - foreach my $mysqld (@{$master}, @{$slave}) + # Start the mysqltest processes in parallel to save time + # also makes it possible to wait for any process to exit during the check + # and to have a timeout process + my %started; + foreach my $mysqld ( mysqlds() ) { - mtr_tofile($mysqld->{path_myerr}, $log_msg); + if ( defined $mysqld->{'proc'} ) + { + my $proc= start_run_one($mysqld, $run); + $started{$proc->pid()}= $proc; + } } - if ( $tinfo->{'component_id'} eq 'im') - { - mtr_tofile($instance_manager->{path_err}, $log_msg); - mtr_tofile($instance_manager->{path_log}, $log_msg); + # Return immediately if no check proceess was started + return 0 unless ( keys %started ); + + my $timeout_proc= My::SafeProcess->timer(check_timeout()); + + while (1){ + my $result; + my $proc= My::SafeProcess->wait_any(); + mtr_report("Got $proc"); + + if ( delete $started{$proc->pid()} ) { + + # One mysqltest process returned + my $err_file= $proc->user_data(); + my $res= $proc->exit_status(); + + # Append the report from .err file + $tinfo->{comment}.= " == $err_file ==\n"; + $tinfo->{comment}.= mtr_grab_file($err_file); + $tinfo->{comment}.= "\n"; + + # Remove the .err file + unlink($err_file); + + if ( keys(%started) == 0){ + # All completed + $timeout_proc->kill(); + return 0; + } + + # Wait for next process to exit + next; + } + elsif ( $proc eq $timeout_proc ) { + $tinfo->{comment}.= "Timeout $timeout_proc for '$run' ". + "expired after ". check_timeout(). + " seconds"; + } + else { + # Unknown process returned, most likley a crash, abort everything + $tinfo->{comment}.= + "The server $proc crashed while running '$run'"; + } + + # Kill any check processes still running + map($_->kill(), values(%started)); + + $timeout_proc->kill(); + + return 1; } + mtr_error("INTERNAL_ERROR: run_on_all"); +} - # ndbcluster log file - mtr_tofile($path_ndb_testrun_log, $log_msg); +sub mark_log { + my ($log, $tinfo)= @_; + my $log_msg= "CURRENT_TEST: $tinfo->{name}\n"; + mtr_tofile($log, $log_msg); } + sub find_testcase_skipped_reason($) { my ($tinfo)= @_; @@ -3584,8 +3085,8 @@ sub find_testcase_skipped_reason($) # Set default message $tinfo->{'comment'}= "Detected by testcase(no log file)"; - # Open mysqltest-time(the mysqltest log file) - my $F= IO::File->new($path_timefile) + # Open the test log file + my $F= IO::File->new($path_current_testlog) or return; my $reason; @@ -3600,587 +3101,895 @@ sub find_testcase_skipped_reason($) if ( ! $reason ) { - mtr_warning("Could not find reason for skipping test in $path_timefile"); + mtr_warning("Could not find reason for skipping test in $path_current_testlog"); $reason= "Detected by testcase(reason unknown) "; } $tinfo->{'comment'}= $reason; } -############################################################################## -# -# Run a single test case -# -############################################################################## +sub find_analyze_request +{ + # Open the test log file + my $F= IO::File->new($path_current_testlog) + or return; + my $analyze; -# When we get here, we have already filtered out test cases that doesn't -# apply to the current setup, for example if we use a running server, test -# cases that restart the server are dropped. So this function should mostly -# be about doing things, not a lot of logic. + while ( my $line= <$F> ) + { + # Look for "reason: <reason for skipping test>" + if ( $line =~ /analyze: (.*)/ ) + { + $analyze= $1; + } + } + + return $analyze; +} -# We don't start and kill the servers for each testcase. But some -# testcases needs a restart, because they specify options to start -# mysqld with. After that testcase, we need to restart again, to set -# back the normal options. + +# Return timezone value of tinfo or default value +sub timezone { + my ($tinfo)= @_; + return $tinfo->{timezone} || "GMT-3"; +} + + +# Storage for changed environment variables +my %old_env; + +# +# Run a single test case +# +# RETURN VALUE +# 0 OK +# > 0 failure +# sub run_testcase ($) { my $tinfo= shift; + mtr_verbose("Running test:", $tinfo->{name}); + # ------------------------------------------------------- # Init variables that can change between each test case # ------------------------------------------------------- + my $timezone= timezone($tinfo); + $ENV{'TZ'}= $timezone; + mtr_verbose("Setting timezone: $timezone"); - $ENV{'TZ'}= $tinfo->{'timezone'}; - mtr_verbose("Setting timezone: $tinfo->{'timezone'}"); - - my $master_restart= run_testcase_need_master_restart($tinfo); - my $slave_restart= run_testcase_need_slave_restart($tinfo); - - if ($master_restart or $slave_restart) + if ( ! using_extern() ) { - # Can't restart a running server that may be in use - if ( $opt_extern ) - { - mtr_report_test_name($tinfo); - $tinfo->{comment}= "Can't restart a running server"; - mtr_report_test_skipped($tinfo); - return; + my @restart= servers_need_restart($tinfo); + if ( @restart != 0) { + stop_servers($tinfo, @restart ); } - run_testcase_stop_servers($tinfo, $master_restart, $slave_restart); - } + if ( started(all_servers()) == 0 ) + { - # Write to all log files to indicate start of testcase - run_testcase_mark_logs($tinfo, "CURRENT_TEST: $tinfo->{name}\n"); + # Remove old datadirs + clean_datadir(); - my $died= mtr_record_dead_children(); - if ($died or $master_restart or $slave_restart) - { - if (run_testcase_start_servers($tinfo)) + # Restore old ENV + while (my ($option, $value)= each( %old_env )) { + if (defined $value){ + mtr_verbose("Restoring $option to $value"); + $ENV{$option}= $value; + + } else { + mtr_verbose("Removing $option"); + delete($ENV{$option}); + } + } + %old_env= (); + + mtr_verbose("Generating my.cnf from '$tinfo->{template_path}'"); + + # Generate new config file from template + $config= My::ConfigFactory->new_config + ( { + basedir => $basedir, + template_path => $tinfo->{template_path}, + extra_template_path => $tinfo->{extra_template_path}, + vardir => $opt_vardir, + tmpdir => $opt_tmpdir, + baseport => $baseport, + #hosts => [ 'host1', 'host2' ], + user => $opt_user, + password => '', + ssl => $opt_ssl_supported, + embedded => $opt_embedded_server, + } + ); + + # Write the new my.cnf + $config->save($path_config_file); + + # Remember current config so a restart can occur when a test need + # to use a different one + $current_config_name= $tinfo->{template_path}; + + # + # Set variables in the ENV section + # + foreach my $option ($config->options_in_group("ENV")) + { + # Save old value to restore it before next time + $old_env{$option->name()}= $ENV{$option->name()}; + + mtr_verbose($option->name(), "=",$option->value()); + $ENV{$option->name()}= $option->value(); + } + } + + # Write start of testcase to log + mark_log($path_current_testlog, $tinfo); + + if (start_servers($tinfo)) { - mtr_report_test_name($tinfo); report_failure_and_restart($tinfo); return 1; } } - elsif ($glob_use_embedded_server) - { - run_master_init_script($tinfo); - } - # ---------------------------------------------------------------------- - # If --start-and-exit or --start-dirty given, stop here to let user manually + # -------------------------------------------------------------------- + # If --start or --start-dirty given, stop here to let user manually # run tests # ---------------------------------------------------------------------- - if ( $opt_start_and_exit or $opt_start_dirty ) + if ( $opt_start or $opt_start_dirty ) { - mtr_timer_stop_all($glob_timers); - mtr_report("\nServers started, exiting"); - if ($glob_win32_perl)
+ mtr_print("\nStarted", started(all_servers())); + mtr_print("Waiting for server(s) to exit..."); + my $proc= My::SafeProcess->wait_any(); + if ( grep($proc eq $_, started(all_servers())) ) { - #ActiveState perl hangs when using normal exit, use POSIX::_exit instead - use POSIX qw[ _exit ]; - POSIX::_exit(0); - } - else - { - exit(0); + mtr_print("Server $proc died"); + exit(1); } + mtr_print("Unknown process $proc died"); + exit(1); } - { - do_before_run_mysqltest($tinfo); + my $test_timeout_proc= My::SafeProcess->timer(testcase_timeout()); + + do_before_run_mysqltest($tinfo); - my $res= run_mysqltest($tinfo); - mtr_report_test_name($tinfo); + if ( $opt_check_testcases and check_testcase($tinfo, "before") ){ + # Failed to record state of server or server crashed + report_failure_and_restart($tinfo); - do_after_run_mysqltest($tinfo); + # Stop the test case timer + $test_timeout_proc->kill(); - if ( $res == 0 ) + return 1; + } + + my $test= start_mysqltest($tinfo); + + while (1) + { + my $proc= My::SafeProcess->wait_any(); + unless ( defined $proc ) { - mtr_report_test_passed($tinfo); + mtr_error("wait_any failed"); } - elsif ( $res == 62 ) + mtr_verbose("Got $proc"); + + # ---------------------------------------------------- + # Was it the test program that exited + # ---------------------------------------------------- + if ($proc eq $test) { - # Testcase itself tell us to skip this one + # Stop the test case timer + $test_timeout_proc->kill(); + + my $res= $test->exit_status(); + + if ($res == 0 and $opt_warnings and check_warnings($tinfo) ) + { + # Test case suceeded, but it has produced unexpected + # warnings, continue in $res == 1 + $res= 1; + } + + if ( $res == 0 ) + { + my $check_res; + if ( $opt_check_testcases and + $check_res= check_testcase($tinfo, "after")) + { + if ($check_res == 1) { + # Test case had sideeffects, not fatal error, just continue + stop_all_servers(); + mtr_report("Resuming tests...\n"); + } + else { + # Test case check failed fatally, probably a server crashed + report_failure_and_restart($tinfo); + return 1; + } + } + mtr_report_test_passed($tinfo); + } + elsif ( $res == 62 ) + { + # Testcase itself tell us to skip this one + $tinfo->{skip_detected_by_test}= 1; + # Try to get reason from test log file + find_testcase_skipped_reason($tinfo); + mtr_report_test_skipped($tinfo); + } + elsif ( $res == 65 ) + { + # Testprogram killed by signal + $tinfo->{comment}= + "testprogram crashed(returned code $res)"; + report_failure_and_restart($tinfo); + } + elsif ( $res == 1 ) + { + # Check if the test tool requests that + # an analyze script should be run + my $analyze= find_analyze_request(); + if ($analyze){ + run_on_all($tinfo, "analyze-$analyze"); + } + + # Test case failure reported by mysqltest + report_failure_and_restart($tinfo); + } + else + { + # mysqltest failed, probably crashed + $tinfo->{comment}= + "mysqltest failed with unexpected return code $res"; + report_failure_and_restart($tinfo); + } + + # Save info from this testcase run to mysqltest.log + if( -f $path_current_testlog) + { + mtr_appendfile_to_file($path_current_testlog, $path_testlog); + unlink($path_current_testlog); + } + + return ($res == 62) ? 0 : $res; - # Try to get reason from mysqltest.log - find_testcase_skipped_reason($tinfo); - mtr_report_test_skipped($tinfo); } - elsif ( $res == 63 ) + + # ---------------------------------------------------- + # Check if it was an expected crash + # ---------------------------------------------------- + if ( check_expected_crash_and_restart($proc) ) { - $tinfo->{'timeout'}= 1; # Mark as timeout - report_failure_and_restart($tinfo); + next; } - elsif ( $res == 1 ) + + # ---------------------------------------------------- + # Stop the test case timer + # ---------------------------------------------------- + $test_timeout_proc->kill(); + + # ---------------------------------------------------- + # Check if it was a server that died + # ---------------------------------------------------- + if ( grep($proc eq $_, started(all_servers())) ) { - # Test case failure reported by mysqltest + # Server failed, probably crashed + $tinfo->{comment}= + "Server $proc failed during test run"; + + # ---------------------------------------------------- + # It's not mysqltest that has exited, kill it + # ---------------------------------------------------- + $test->kill(); + report_failure_and_restart($tinfo); + return 1; } - else + + # Try to dump core for mysqltest and all servers + foreach my $proc ($test, started(all_servers())) + { + mtr_print("Trying to dump core for $proc"); + if ($proc->dump_core()) + { + $proc->wait_one(20); + } + } + + # ---------------------------------------------------- + # It's not mysqltest that has exited, kill it + # ---------------------------------------------------- + $test->kill(); + + # ---------------------------------------------------- + # Check if testcase timer expired + # ---------------------------------------------------- + if ( $proc eq $test_timeout_proc ) { - # mysqltest failed, probably crashed + my $log_file_name= $opt_vardir."/log/".$tinfo->{shortname}.".log"; $tinfo->{comment}= - "mysqltest returned unexpected code $res, it has probably crashed"; + "Test case timeout after ".testcase_timeout(). + " seconds\n\n"; + # Add 20 last executed commands from test case log file + if (-e $log_file_name) + { + $tinfo->{comment}.= + "== $log_file_name == \n". + mtr_lastlinesfromfile($log_file_name, 20)."\n"; + } + $tinfo->{'timeout'}= testcase_timeout(); # Mark as timeout + run_on_all($tinfo, 'analyze-timeout'); + report_failure_and_restart($tinfo); + return 1; } - } - - # Remove the file that mysqltest writes info to - unlink($path_timefile); - # ---------------------------------------------------------------------- - # Stop Instance Manager if we are processing an IM-test case. - # ---------------------------------------------------------------------- - if ( $tinfo->{'component_id'} eq 'im' and - !mtr_im_stop($instance_manager, $tinfo->{'name'})) - { - mtr_error("Failed to stop Instance Manager.") + mtr_error("Unhandled process $proc exited"); } + mtr_error("Should never come here"); } # -# Save a snapshot of the installed test db(s) -# I.e take a snapshot of the var/ dir +# Perform a rough examination of the servers +# error log and write all lines that look +# suspicious into $error_log.warnings # -sub save_installed_db () { +sub extract_warning_lines ($) { + my ($error_log) = @_; - mtr_report("Saving snapshot of installed databases"); - mtr_rmtree($path_snapshot); + # Open the servers .err log file and read all lines + # belonging to current tets into @lines + my $Ferr = IO::File->new($error_log) + or mtr_error("Could not open file '$error_log' for reading: $!"); - foreach my $data_dir (@data_dir_lst) + my @lines; + while ( my $line = <$Ferr> ) { - my $name= basename($data_dir); - mtr_copy_dir("$data_dir", "$path_snapshot/$name"); + if ( $line =~ /^CURRENT_TEST:/ ) + { + # Throw away lines from previous tests + @lines = (); + } + push(@lines, $line); } + $Ferr = undef; # Close error log file + + # mysql_client_test.test sends a COM_DEBUG packet to the server + # to provoke a SAFEMALLOC leak report, ignore any warnings + # between "Begin/end safemalloc memory dump" + if ( grep(/Begin safemalloc memory dump:/, @lines) > 0) + { + my $discard_lines= 1; + foreach my $line ( @lines ) + { + if ($line =~ /Begin safemalloc memory dump:/){ + $discard_lines = 1; + } elsif ($line =~ /End safemalloc memory dump./){ + $discard_lines = 0; + } + + if ($discard_lines){ + $line = "ignored"; + } + } + } + + # Write all suspicious lines to $error_log.warnings file + my $warning_log = "$error_log.warnings"; + my $Fwarn = IO::File->new($warning_log, "w") + or die("Could not open file '$warning_log' for writing: $!"); + print $Fwarn "Suspicious lines from $error_log\n"; + + my @patterns = + ( + # The patterns for detection of [Warning] and [ERROR] + # in the server log files have been faulty for a longer period + # and correcting them shows a few additional harmless warnings. + # Thus those patterns are temporarily removed from the list + # of patterns. For more info see BUG#42408 + # qr/^Warning:|mysqld: Warning|\[Warning\]/, + # qr/^Error:|\[ERROR\]/, + qr/^Warning:|mysqld: Warning/, + qr/^Error:/, + qr/^==.* at 0x/, + qr/InnoDB: Warning|InnoDB: Error/, + qr/^safe_mutex:|allocated at line/, + qr/missing DBUG_RETURN/, + qr/Attempting backtrace/, + qr/Assertion .* failed/, + ); + + foreach my $line ( @lines ) + { + foreach my $pat ( @patterns ) + { + if ( $line =~ /$pat/ ) + { + print $Fwarn $line; + last; + } + } + } + $Fwarn = undef; # Close file + } +# Run include/check-warnings.test # -# Save any interesting files in the data_dir -# before the data dir is removed. +# RETURN VALUE +# 0 OK +# 1 Check failed # -sub save_files_before_restore($$) { - my $test_name= shift; - my $data_dir= shift; - my $save_name= "$opt_vardir/log/$test_name"; +sub start_check_warnings ($$) { + my $tinfo= shift; + my $mysqld= shift; + + my $name= "warnings-".$mysqld->name(); - # Look for core files - foreach my $core_file ( glob("$data_dir/core*") ) + extract_warning_lines($mysqld->value('log-error')); + + my $args; + mtr_init_args(\$args); + + mtr_add_arg($args, "--defaults-file=%s", $path_config_file); + mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld')); + + mtr_add_arg($args, "--skip-safemalloc"); + mtr_add_arg($args, "--test-file=%s", "include/check-warnings.test"); + + if ( $opt_embedded_server ) { - last if $opt_max_save_core > 0 && $num_saved_cores >= $opt_max_save_core; - my $core_name= basename($core_file); - mtr_report("Saving $core_name"); - mkdir($save_name) if ! -d $save_name; - rename("$core_file", "$save_name/$core_name"); - ++$num_saved_cores; - } + + # Get the args needed for the embedded server + # and append them to args prefixed + # with --sever-arg= + + my $mysqld= $config->group('embedded') + or mtr_error("Could not get [embedded] section"); + + my $mysqld_args; + mtr_init_args(\$mysqld_args); + my $extra_opts= get_extra_opts($mysqld, $tinfo); + mysqld_arguments($mysqld_args, $mysqld, $extra_opts); + mtr_add_arg($args, "--server-arg=%s", $_) for @$mysqld_args; + } + + my $errfile= "$opt_vardir/tmp/$name.err"; + my $proc= My::SafeProcess->new + ( + name => $name, + path => $exe_mysqltest, + error => $errfile, + output => $errfile, + args => \$args, + user_data => $errfile, + verbose => $opt_verbose, + ); + mtr_verbose("Started $proc"); + return $proc; } # -# Restore snapshot of the installed test db(s) -# if the snapshot exists +# Loop through our list of processes and check the error log +# for unexepcted errors and warnings # -sub restore_installed_db ($) { - my $test_name= shift; +sub check_warnings ($) { + my ($tinfo)= @_; + my $res= 0; - if ( -d $path_snapshot) - { - mtr_report("Restoring snapshot of databases"); + my $tname= $tinfo->{name}; - foreach my $data_dir (@data_dir_lst) - { - my $name= basename($data_dir); - save_files_before_restore($test_name, $data_dir); - mtr_rmtree("$data_dir"); - mtr_copy_dir("$path_snapshot/$name", "$data_dir"); - } + # Clear previous warnings + delete($tinfo->{warnings}); - # Remove the ndb_*_fs dirs for all ndbd nodes - # forcing a clean start of ndb - foreach my $cluster (@{$clusters}) + # Start the mysqltest processes in parallel to save time + # also makes it possible to wait for any process to exit during the check + my %started; + foreach my $mysqld ( mysqlds() ) + { + if ( defined $mysqld->{'proc'} ) { - foreach my $ndbd (@{$cluster->{'ndbds'}}) - { - mtr_rmtree("$ndbd->{'path_fs'}" ); - } + my $proc= start_check_warnings($tinfo, $mysqld); + $started{$proc->pid()}= $proc; } } - else - { - # No snapshot existed - mtr_error("No snapshot existed"); - } -} -sub report_failure_and_restart ($) { - my $tinfo= shift; + # Return immediately if no check proceess was started + return 0 unless ( keys %started ); - mtr_report_test_failed($tinfo); - print "\n"; - if ( $opt_force ) - { - # Stop all servers that are known to be running - stop_all_servers(); + my $timeout_proc= My::SafeProcess->timer(check_timeout()); - # Restore the snapshot of the installed test db - restore_installed_db($tinfo->{'name'}); - mtr_report("Resuming Tests\n"); - return; - } + while (1){ + my $result= 0; + my $proc= My::SafeProcess->wait_any(); + mtr_report("Got $proc"); - my $test_mode= join(" ", @::glob_test_mode) || "default"; - mtr_report("Aborting: $tinfo->{'name'} failed in $test_mode mode. "); - mtr_report("To continue, re-run with '--force'."); - if ( ! $glob_debugger and - ! $opt_extern and - ! $glob_use_embedded_server ) - { - stop_all_servers(); - } - mtr_exit(1); + if ( delete $started{$proc->pid()} ) { + # One check warning process returned + my $res= $proc->exit_status(); + my $err_file= $proc->user_data(); -} + if ( $res == 0 or $res == 62 ){ + if ( $res == 0 ) { + # Check completed with problem + my $report= mtr_grab_file($err_file); + # Log to var/log/warnings file + mtr_tofile("$opt_vardir/log/warnings", + $tname."\n".$report); -sub run_master_init_script ($) { - my ($tinfo)= @_; - my $init_script= $tinfo->{'master_sh'}; + $tinfo->{'warnings'}.= $report; + $result= 1; + } - # Run master initialization shell script if one exists - if ( $init_script ) - { - my $ret= mtr_run("/bin/sh", [$init_script], "", "", "", ""); - if ( $ret != 0 ) - { - # FIXME rewrite those scripts to return 0 if successful - # mtr_warning("$init_script exited with code $ret"); + if ( $res == 62 ) { + # Test case was ok and called "skip" + ; + } + # Remove the .err file the check generated + unlink($err_file); + + if ( keys(%started) == 0){ + # All checks completed + + $timeout_proc->kill(); + + return $result; + } + # Wait for next process to exit + next; + } + else + { + my $report= mtr_grab_file($err_file); + $tinfo->{comment}.= + "Could not execute 'check-warnings' for ". + "testcase '$tname' (res: $res):\n"; + $tinfo->{comment}.= $report; + + $result= 2; + } + # Remove the .err file the check generated + unlink($err_file); } + elsif ( $proc eq $timeout_proc ) { + $tinfo->{comment}.= "Timeout $timeout_proc for ". + "'check warnings' expired after ".check_timeout(). + " seconds"; + $result= 4; + } + else { + # Unknown process returned, most likley a crash, abort everything + $tinfo->{comment}= + "The server $proc crashed while running 'check warnings'"; + $result= 3; + } + + # Kill any check processes still running + map($_->kill(), values(%started)); + + $timeout_proc->kill(); + + return $result; } + + mtr_error("INTERNAL_ERROR: check_warnings"); } -############################################################################## # -# Start and stop servers +# Loop through our list of processes and look for and entry +# with the provided pid, if found check for the file indicating +# expected crash and restart it. # -############################################################################## +sub check_expected_crash_and_restart { + my ($proc)= @_; + foreach my $mysqld ( mysqlds() ) + { + next unless ( $mysqld->{proc} eq $proc ); -sub do_before_start_master ($) { - my ($tinfo)= @_; + # Check if crash expected by looking at the .expect file + # in var/tmp + my $expect_file= "$opt_vardir/tmp/".$mysqld->name().".expect"; + if ( -f $expect_file ) + { + mtr_verbose("Crash was expected, file '$expect_file' exists"); - my $tname= $tinfo->{'name'}; + while (1){ - # FIXME what about second master..... + # If last line in expect file starts with "wait" + # sleep a little and try again, thus allowing the + # test script to control when the server should start + # up again + my $last_line= mtr_lastlinesfromfile($expect_file, 1); + if ($last_line =~ /^wait/ ) + { + mtr_verbose("Test says wait before restart"); + mtr_milli_sleep(100); + next; + } - # Don't delete anything if starting dirty - return if ($opt_start_dirty); + unlink($expect_file); - foreach my $bin ( glob("$opt_vardir/log/master*-bin*") ) - { - unlink($bin); + # Start server with same settings as last time + mysqld_start($mysqld, $mysqld->{'started_opts'}); + + last; + } + } + + return 1; } - # FIXME only remove the ones that are tied to this master - # Remove old master.info and relay-log.info files - unlink("$master->[0]->{'path_myddir'}/master.info"); - unlink("$master->[0]->{'path_myddir'}/relay-log.info"); - unlink("$master->[1]->{'path_myddir'}/master.info"); - unlink("$master->[1]->{'path_myddir'}/relay-log.info"); + # Not an expected crash + return 0; +} - run_master_init_script($tinfo); + +# Remove all files and subdirectories of a directory +sub clean_dir { + my ($dir)= @_; + mtr_verbose("clean_dir: $dir"); + finddepth( + { no_chdir => 1, + wanted => sub { + if (-d $_){ + # A dir + if ($_ eq $dir){ + # The dir to clean + return; + } else { + mtr_verbose("rmdir: '$_'"); + rmdir($_) or mtr_warning("rmdir($_) failed: $!"); + } + } else { + # Hopefully a file + mtr_verbose("unlink: '$_'"); + unlink($_) or mtr_warning("unlink($_) failed: $!"); + } + } + }, + $dir); } -sub do_before_start_slave ($) { - my ($tinfo)= @_; +sub clean_datadir { - my $tname= $tinfo->{'name'}; - my $init_script= $tinfo->{'master_sh'}; + mtr_verbose("Cleaning datadirs..."); - # Don't delete anything if starting dirty - return if ($opt_start_dirty); + if (started(all_servers()) != 0){ + mtr_error("Trying to clean datadir before all servers stopped"); + } - foreach my $bin ( glob("$opt_vardir/log/slave*-bin*") ) + foreach my $cluster ( clusters() ) { - unlink($bin); - } + my $cluster_dir= "$opt_vardir/".$cluster->{name}; + mtr_verbose(" - removing '$cluster_dir'"); + rmtree($cluster_dir); - unlink("$slave->[0]->{'path_myddir'}/master.info"); - unlink("$slave->[0]->{'path_myddir'}/relay-log.info"); + } - # Run slave initialization shell script if one exists - if ( $init_script ) + foreach my $mysqld ( mysqlds() ) { - my $ret= mtr_run("/bin/sh", [$init_script], "", "", "", ""); - if ( $ret != 0 ) - { - # FIXME rewrite those scripts to return 0 if successful - # mtr_warning("$init_script exited with code $ret"); + my $mysqld_dir= dirname($mysqld->value('datadir')); + if (-d $mysqld_dir ) { + mtr_verbose(" - removing '$mysqld_dir'"); + rmtree($mysqld_dir); } } - foreach my $bin ( glob("$slave->[0]->{'path_myddir'}/log.*") ) - { - unlink($bin); + # Remove all files in tmp and var/tmp + clean_dir("$opt_vardir/tmp"); + if ($opt_tmpdir ne "$opt_vardir/tmp"){ + clean_dir($opt_tmpdir); } } -sub mysqld_arguments ($$$$) { - my $args= shift; - my $mysqld= shift; - my $extra_opt= shift; - my $slave_master_info= shift; +# +# Save datadir before it's removed +# +sub save_datadir_after_failure($$) { + my ($dir, $savedir)= @_; - my $idx= $mysqld->{'idx'}; - my $sidx= ""; # Index as string, 0 is empty string - if ( $idx> 0 ) - { - $sidx= $idx; - } + mtr_report(" - saving '$dir'"); + my $dir_name= basename($dir); + rename("$dir", "$savedir/$dir_name"); +} - my $prefix= ""; # If mysqltest server arg - if ( $glob_use_embedded_server ) + +sub remove_ndbfs_from_ndbd_datadir { + my ($ndbd_datadir)= @_; + # Remove the ndb_*_fs directory from ndbd.X/ dir + foreach my $ndbfs_dir ( glob("$ndbd_datadir/ndb_*_fs") ) { - $prefix= "--server-arg="; + next unless -d $ndbfs_dir; # Skip if not a directory + rmtree($ndbfs_dir); } +} - mtr_add_arg($args, "%s--no-defaults", $prefix); - mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir); - mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir); +sub after_failure ($) { + my ($tinfo)= @_; - if (!$opt_extern) - { - if ( $mysql_version_id >= 50036) - { - # Prevent the started mysqld to access files outside of vardir - mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $opt_vardir); - } + mtr_report("Saving datadirs..."); - if ( $mysql_version_id >= 50000 ) { - mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix); - } - } + my $save_dir= "$opt_vardir/log/"; + $save_dir.= $tinfo->{name}; + # Add combination name if any + $save_dir.= "-$tinfo->{combination}" + if defined $tinfo->{combination}; - mtr_add_arg($args, "%s--default-character-set=latin1", $prefix); - mtr_add_arg($args, "%s--language=%s", $prefix, $path_language); - mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix); + # Save savedir path for server + $tinfo->{savedir}= $save_dir; - # Increase default connect_timeout to avoid intermittent - # disconnects when test servers are put under load - # see BUG#28359 - mtr_add_arg($args, "%s--connect-timeout=60", $prefix); + mkpath($save_dir) if ! -d $save_dir; + # Save the used my.cnf file + copy($path_config_file, $save_dir); - # When mysqld is run by a root user(euid is 0), it will fail - # to start unless we specify what user to run as, see BUG#30630 - my $euid= $>; - if (!$glob_win32 and $euid == 0 and - grep(/^--user/, @$extra_opt, @opt_extra_mysqld_opt) == 0) { - mtr_add_arg($args, "%s--user=root", $prefix); - } + # Copy the tmp dir + copytree("$opt_vardir/tmp/", "$save_dir/tmp/"); - if ( $opt_valgrind_mysqld ) - { - mtr_add_arg($args, "%s--skip-safemalloc", $prefix); + if ( clusters() ) { + foreach my $cluster ( clusters() ) { + my $cluster_dir= "$opt_vardir/".$cluster->{name}; - if ( $mysql_version_id < 50100 ) - { - mtr_add_arg($args, "%s--skip-bdb", $prefix); + # Remove the fileystem of each ndbd + foreach my $ndbd ( in_cluster($cluster, ndbds()) ) + { + my $ndbd_datadir= $ndbd->value("DataDir"); + remove_ndbfs_from_ndbd_datadir($ndbd_datadir); + } + + save_datadir_after_failure($cluster_dir, $save_dir); + } + } + else { + foreach my $mysqld ( mysqlds() ) { + my $data_dir= $mysqld->value('datadir'); + save_datadir_after_failure(dirname($data_dir), $save_dir); } } +} - mtr_add_arg($args, "%s--pid-file=%s", $prefix, - $mysqld->{'path_pid'}); - mtr_add_arg($args, "%s--port=%d", $prefix, - $mysqld->{'port'}); +sub report_failure_and_restart ($) { + my $tinfo= shift; - mtr_add_arg($args, "%s--socket=%s", $prefix, - $mysqld->{'path_sock'}); + stop_all_servers(); - mtr_add_arg($args, "%s--datadir=%s", $prefix, - $mysqld->{'path_myddir'}); + $tinfo->{'result'}= 'MTR_RES_FAILED'; - mtr_add_arg($args, "%s--disable-sync-frm", $prefix); # Faster test + my $test_failures= $tinfo->{'failures'} || 0; + $tinfo->{'failures'}= $test_failures + 1; - if (!$opt_extern and $mysql_version_id >= 50106 ) + + if ( $tinfo->{comment} ) { - # Turn on logging to bothe tables and file - mtr_add_arg($args, "%s--log-output=table,file", $prefix); + # The test failure has been detected by mysql-test-run.pl + # when starting the servers or due to other error, the reason for + # failing the test is saved in "comment" + ; } - my $log_base_path= "$opt_vardir/log/$mysqld->{'type'}$sidx"; - mtr_add_arg($args, "%s--general-log-file=%s.log", - $prefix, $log_base_path); - mtr_add_arg($args, "%s--general-log", $prefix); - mtr_add_arg($args, - "%s--slow-query-log-file=%s-slow.log", - $prefix, $log_base_path); - mtr_add_arg($args, "%s--slow-query-log", $prefix); - - # Check if "extra_opt" contains --skip-log-bin - my $skip_binlog= grep(/^--skip-log-bin/, @$extra_opt, @opt_extra_mysqld_opt); - if ( $mysqld->{'type'} eq 'master' ) + if ( !defined $tinfo->{logfile} ) { - if (! ($opt_skip_master_binlog || $skip_binlog) ) + my $logfile= $path_current_testlog; + if ( defined $logfile ) { - mtr_add_arg($args, "%s--log-bin=%s/log/master-bin%s", $prefix, - $opt_vardir, $sidx); + if ( -f $logfile ) + { + # Test failure was detected by test tool and its report + # about what failed has been saved to file. Save the report + # in tinfo + $tinfo->{logfile}= mtr_fromfile($logfile); + } + else + { + # The test tool report didn't exist, display an + # error message + $tinfo->{logfile}= "Could not open test tool report '$logfile'"; + } } + } - mtr_add_arg($args, "%s--server-id=%d", $prefix, - $idx > 0 ? $idx + 101 : 1); + after_failure($tinfo); - mtr_add_arg($args, "%s--loose-innodb_data_file_path=ibdata1:10M:autoextend", - $prefix); + mtr_report_test($tinfo); - mtr_add_arg($args, "%s--local-infile", $prefix); +} - if ( $idx > 0 or !$use_innodb) - { - mtr_add_arg($args, "%s--loose-skip-innodb", $prefix); - } - my $cluster= $clusters->[$mysqld->{'cluster'}]; - if ( $cluster->{'pid'} || # Cluster is started - $cluster->{'use_running'} ) # Using running cluster - { - mtr_add_arg($args, "%s--ndbcluster", $prefix); - mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix, - $cluster->{'connect_string'}); - if ( $mysql_version_id >= 50100 ) - { - mtr_add_arg($args, "%s--ndb-extra-logging", $prefix); - } - } - else - { - mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix); - } - } - else - { - mtr_error("unknown mysqld type") - unless $mysqld->{'type'} eq 'slave'; +sub run_sh_script { + my ($script)= @_; - mtr_add_arg($args, "%s--init-rpl-role=slave", $prefix); - if (! ( $opt_skip_slave_binlog || $skip_binlog )) - { - mtr_add_arg($args, "%s--log-bin=%s/log/slave%s-bin", $prefix, - $opt_vardir, $sidx); # FIXME use own dir for binlogs - mtr_add_arg($args, "%s--log-slave-updates", $prefix); - } + return 0 unless defined $script; - mtr_add_arg($args, "%s--master-retry-count=10", $prefix); - - mtr_add_arg($args, "%s--relay-log=%s/log/slave%s-relay-bin", $prefix, - $opt_vardir, $sidx); - mtr_add_arg($args, "%s--report-host=127.0.0.1", $prefix); - mtr_add_arg($args, "%s--report-port=%d", $prefix, - $mysqld->{'port'}); - mtr_add_arg($args, "%s--report-user=root", $prefix); - mtr_add_arg($args, "%s--loose-skip-innodb", $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. - my $slave_load_path= "../tmp"; - mtr_add_arg($args, "%s--slave-load-tmpdir=%s", $prefix, - $slave_load_path); - mtr_add_arg($args, "%s--set-variable=slave_net_timeout=120", $prefix); - - if ( @$slave_master_info ) - { - foreach my $arg ( @$slave_master_info ) - { - mtr_add_arg($args, "%s%s", $prefix, $arg); - } - } - else - { - if ($mysql_version_id < 50200) - { - mtr_add_arg($args, "%s--master-user=root", $prefix); - mtr_add_arg($args, "%s--master-connect-retry=1", $prefix); - mtr_add_arg($args, "%s--master-host=127.0.0.1", $prefix); - mtr_add_arg($args, "%s--master-password=", $prefix); - mtr_add_arg($args, "%s--master-port=%d", $prefix, - $master->[0]->{'port'}); # First master - } - my $slave_server_id= 2 + $idx; - my $slave_rpl_rank= $slave_server_id; - mtr_add_arg($args, "%s--server-id=%d", $prefix, $slave_server_id); - mtr_add_arg($args, "%s--rpl-recovery-rank=%d", $prefix, $slave_rpl_rank); - } + mtr_verbose("Running '$script'"); + my $ret= system("/bin/sh $script") >> 8; + return $ret; +} - my $cluster= $clusters->[$mysqld->{'cluster'}]; - if ( $cluster->{'pid'} || # Slave cluster is started - $cluster->{'use_running'} ) # Using running slave cluster - { - mtr_add_arg($args, "%s--ndbcluster", $prefix); - mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix, - $cluster->{'connect_string'}); - if ( $mysql_version_id >= 50100 ) - { - mtr_add_arg($args, "%s--ndb-extra-logging", $prefix); - } - } - else - { - mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix); - } +sub mysqld_stop { + my $mysqld= shift or die "usage: mysqld_stop(<mysqld>)"; + + my $args; + mtr_init_args(\$args); + + mtr_add_arg($args, "--no-defaults"); + mtr_add_arg($args, "--user=%s", $opt_user); + mtr_add_arg($args, "--password="); + mtr_add_arg($args, "--port=%d", $mysqld->value('port')); + mtr_add_arg($args, "--host=%s", $mysqld->value('#host')); + mtr_add_arg($args, "--connect_timeout=20"); + mtr_add_arg($args, "--protocol=tcp"); + + mtr_add_arg($args, "shutdown"); - } # end slave + My::SafeProcess->run + ( + name => "mysqladmin shutdown ".$mysqld->name(), + path => $exe_mysqladmin, + args => \$args, + error => "/dev/null", - if ( $debug_compiled_binaries && defined $opt_debug ) + ); +} + + +sub mysqld_arguments ($$$) { + my $args= shift; + my $mysqld= shift; + my $extra_opts= shift; + + mtr_add_arg($args, "--defaults-file=%s", $path_config_file); + + # When mysqld is run by a root user(euid is 0), it will fail + # to start unless we specify what user to run as, see BUG#30630 + my $euid= $>; + if (!IS_WINDOWS and $euid == 0 and + (grep(/^--user/, @$extra_opts)) == 0) { + mtr_add_arg($args, "--user=root"); + } + + if ( $opt_valgrind_mysqld ) { - if ( $opt_debug ) - { - mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/%s%s.trace", - $prefix, $path_vardir_trace, $mysqld->{'type'}, $sidx); - } - else + mtr_add_arg($args, "--skip-safemalloc"); + + if ( $mysql_version_id < 50100 ) { - mtr_add_arg($args, "--disable-debug"); + mtr_add_arg($args, "--skip-bdb"); } } - mtr_add_arg($args, "%s--key_buffer_size=1M", $prefix); - mtr_add_arg($args, "%s--sort_buffer=256K", $prefix); - mtr_add_arg($args, "%s--max_heap_table_size=1M", $prefix); + mtr_add_arg($args, "%s--disable-sync-frm"); - if ( $opt_ssl_supported ) + if (!using_extern() and $mysql_version_id >= 50106 ) { - mtr_add_arg($args, "%s--ssl-ca=%s/std_data/cacert.pem", $prefix, - $glob_mysql_test_dir); - mtr_add_arg($args, "%s--ssl-cert=%s/std_data/server-cert.pem", $prefix, - $glob_mysql_test_dir); - mtr_add_arg($args, "%s--ssl-key=%s/std_data/server-key.pem", $prefix, - $glob_mysql_test_dir); + # Turn on logging to bothe tables and file + mtr_add_arg($args, "%s--log-output=table,file"); } - if ( $opt_warnings ) - { - mtr_add_arg($args, "%s--log-warnings", $prefix); - } + # Check if "extra_opt" contains skip-log-bin + my $skip_binlog= grep(/^(--|--loose-)skip-log-bin/, @$extra_opts); - # Indicate to "mysqld" it will be debugged in debugger + # Indicate to mysqld it will be debugged in debugger if ( $glob_debugger ) { - mtr_add_arg($args, "%s--gdb", $prefix); + mtr_add_arg($args, "--gdb"); } my $found_skip_core= 0; - foreach my $arg ( @opt_extra_mysqld_opt, @$extra_opt ) + foreach my $arg ( @$extra_opts ) { # Allow --skip-core-file to be set in <testname>-[master|slave].opt file if ($arg eq "--skip-core-file") @@ -4191,65 +4000,39 @@ sub mysqld_arguments ($$$$) { { ; # Dont add --binlog-format when running without binlog } + elsif ($arg eq "--loose-skip-log-bin" and + $mysqld->option("log-slave-updates")) + { + ; # Dont add --skip-log-bin when mysqld have --log-slave-updates in config + } else { - mtr_add_arg($args, "%s%s", $prefix, $arg); + mtr_add_arg($args, "%s", $arg); } } if ( !$found_skip_core ) { - mtr_add_arg($args, "%s%s", $prefix, "--core-file"); - } - - if ( $opt_bench ) - { - mtr_add_arg($args, "%s--rpl-recovery-rank=1", $prefix); - mtr_add_arg($args, "%s--init-rpl-role=master", $prefix); - } - elsif ( $mysqld->{'type'} eq 'master' ) - { - mtr_add_arg($args, "%s--open-files-limit=1024", $prefix); + mtr_add_arg($args, "%s", "--core-file"); } return $args; } -############################################################################## -# -# Start mysqld and return the PID -# -############################################################################## -sub mysqld_start ($$$) { +sub mysqld_start ($$) { my $mysqld= shift; - my $extra_opt= shift; - my $slave_master_info= shift; + my $extra_opts= shift; - my $args; # Arg vector - my $exe; - my $pid= -1; - my $wait_for_pid_file= 1; + mtr_verbose(My::Options::toStr("mysqld_start", @$extra_opts)); - my $type= $mysqld->{'type'}; - my $idx= $mysqld->{'idx'}; + my $exe= find_mysqld($mysqld->value('basedir')); + my $wait_for_pid_file= 1; mtr_error("Internal error: mysqld should never be started for embedded") - if $glob_use_embedded_server; - - if ( $type eq 'master' ) - { - $exe= $exe_master_mysqld; - } - elsif ( $type eq 'slave' ) - { - $exe= $exe_slave_mysqld; - } - else - { - mtr_error("Unknown 'type' \"$type\" passed to mysqld_start"); - } + if $opt_embedded_server; + my $args; mtr_init_args(\$args); if ( $opt_valgrind_mysqld ) @@ -4257,23 +4040,30 @@ sub mysqld_start ($$$) { valgrind_arguments($args, \$exe); } - mysqld_arguments($args,$mysqld,$extra_opt,$slave_master_info); + mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld')); + mysqld_arguments($args,$mysqld,$extra_opts); - if ( $opt_gdb || $opt_manual_gdb) + if ( $opt_debug ) { - gdb_arguments(\$args, \$exe, "$type"."_$idx"); + mtr_add_arg($args, "--debug=d:t:i:A,%s/log/%s.trace", + $path_vardir_trace, $mysqld->name()); + } + + if ( $opt_gdb || $opt_manual_gdb ) + { + gdb_arguments(\$args, \$exe, $mysqld->name()); } elsif ( $opt_ddd || $opt_manual_ddd ) { - ddd_arguments(\$args, \$exe, "$type"."_$idx"); + ddd_arguments(\$args, \$exe, $mysqld->name()); } elsif ( $opt_debugger ) { - debugger_arguments(\$args, \$exe, "$type"."_$idx"); + debugger_arguments(\$args, \$exe, $mysqld->name()); } elsif ( $opt_manual_debug ) { - print "\nStart $type in your debugger\n" . + print "\nStart " .$mysqld->name()." in your debugger\n" . "dir: $glob_mysql_test_dir\n" . "exe: $exe\n" . "args: " . join(" ", @$args) . "\n\n" . @@ -4288,629 +4078,506 @@ sub mysqld_start ($$$) { $wait_for_pid_file= 0; } - # Remove the pidfile - unlink($mysqld->{'path_pid'}); + # Remove the old pidfile if any + unlink($mysqld->value('pid-file')); - if ( defined $exe ) + my $output= $mysqld->value('log-error'); + if ( $opt_valgrind and $opt_debug ) { - $pid= mtr_spawn($exe, $args, "", - $mysqld->{'path_myerr'}, - $mysqld->{'path_myerr'}, - "", - { append_log_file => 1 }); + # When both --valgrind and --debug is selected, send + # all output to the trace file, making it possible to + # see the exact location where valgrind complains + $output= "$opt_vardir/log/".$mysqld->name().".trace"; } - - if ( $wait_for_pid_file && !sleep_until_file_created($mysqld->{'path_pid'}, - $mysqld->{'start_timeout'}, - $pid)) + if ( defined $exe ) { - - mtr_error("Failed to start mysqld $mysqld->{'type'}"); + $mysqld->{'proc'}= My::SafeProcess->new + ( + name => $mysqld->name(), + path => $exe, + args => \$args, + output => $output, + error => $output, + append => 1, + verbose => $opt_verbose, + host => undef, + shutdown => sub { mysqld_stop($mysqld) }, + ); + mtr_verbose("Started $mysqld->{proc}"); } - - # Remember pid of the started process - $mysqld->{'pid'}= $pid; + if ( $wait_for_pid_file && + !sleep_until_file_created($mysqld->value('pid-file'), + $opt_start_timeout, + $mysqld->{'proc'})) + { + mtr_error("Failed to start mysqld $mysqld->name()"); + } # Remember options used when starting - $mysqld->{'start_opts'}= $extra_opt; - $mysqld->{'start_slave_master_info'}= $slave_master_info; + $mysqld->{'started_opts'}= $extra_opts; - mtr_verbose("mysqld pid: $pid"); - return $pid; + return; } sub stop_all_servers () { - mtr_report("Stopping All Servers"); - - if ( ! $opt_skip_im ) - { - mtr_report("Shutting-down Instance Manager"); - unless (mtr_im_stop($instance_manager, "stop_all_servers")) - { - mtr_error("Failed to stop Instance Manager.") - } - } - - my %admin_pids; # hash of admin processes that requests shutdown - my @kill_pids; # list of processes to shutdown/kill - my $pid; + mtr_verbose("Stopping all servers..."); - # Start shutdown of all started masters - foreach my $mysqld (@{$slave}, @{$master}) - { - if ( $mysqld->{'pid'} ) - { - $pid= mtr_mysqladmin_start($mysqld, "shutdown", 70); - $admin_pids{$pid}= 1; - - push(@kill_pids,{ - pid => $mysqld->{'pid'}, - real_pid => $mysqld->{'real_pid'}, - pidfile => $mysqld->{'path_pid'}, - sockfile => $mysqld->{'path_sock'}, - port => $mysqld->{'port'}, - errfile => $mysqld->{'path_myerr'}, - }); - - $mysqld->{'pid'}= 0; # Assume we are done with it - } - } + # Kill all started servers + My::SafeProcess::shutdown(0, # shutdown timeout 0 => kill + started(all_servers())); - # Start shutdown of clusters - foreach my $cluster (@{$clusters}) + # Remove pidfiles + foreach my $server ( all_servers() ) { - if ( $cluster->{'pid'} ) - { - $pid= mtr_ndbmgm_start($cluster, "shutdown"); - $admin_pids{$pid}= 1; - - push(@kill_pids,{ - pid => $cluster->{'pid'}, - pidfile => $cluster->{'path_pid'} - }); - - $cluster->{'pid'}= 0; # Assume we are done with it - - foreach my $ndbd (@{$cluster->{'ndbds'}}) - { - if ( $ndbd->{'pid'} ) - { - push(@kill_pids,{ - pid => $ndbd->{'pid'}, - pidfile => $ndbd->{'path_pid'}, - }); - $ndbd->{'pid'}= 0; - } - } - } + my $pid_file= $server->if_exist('pid-file'); + unlink($pid_file) if defined $pid_file; } - # Wait blocking until all shutdown processes has completed - mtr_wait_blocking(\%admin_pids); + # Mark servers as stopped + map($_->{proc}= undef, all_servers()); - # Make sure that process has shutdown else try to kill them - mtr_check_stop_servers(\@kill_pids); - - foreach my $mysqld (@{$master}, @{$slave}) - { - rm_ndbcluster_tables($mysqld->{'path_myddir'}); - } } -sub run_testcase_need_master_restart($) -{ - my ($tinfo)= @_; - - # We try to find out if we are to restart the master(s) - my $do_restart= 0; # Assumes we don't have to +# Find out if server should be restarted for this test +sub server_need_restart { + my ($tinfo, $server)= @_; - if ( $glob_use_embedded_server ) + if ( using_extern() ) { - mtr_verbose("Never start or restart for embedded server"); - return $do_restart; - } - elsif ( $tinfo->{'master_sh'} ) - { - $do_restart= 1; # Always restart if script to run - mtr_verbose("Restart master: Always restart if script to run"); - } - if ( $tinfo->{'force_restart'} ) - { - $do_restart= 1; # Always restart if --force-restart in -opt file - mtr_verbose("Restart master: Restart forced with --force-restart"); + mtr_verbose_restart($server, "no restart for --extern server"); + return 0; } - elsif ( ! $opt_skip_ndbcluster and - !$tinfo->{'ndb_test'} and - $clusters->[0]->{'pid'} != 0 ) + + if ( $opt_embedded_server ) { - $do_restart= 1; # Restart without cluster - mtr_verbose("Restart master: Test does not need cluster"); + mtr_verbose_restart($server, "no start or restart for embedded server"); + return 0; } - elsif ( ! $opt_skip_ndbcluster and - $tinfo->{'ndb_test'} and - $clusters->[0]->{'pid'} == 0 ) - { - $do_restart= 1; # Restart with cluster - mtr_verbose("Restart master: Test need cluster"); + + if ( $tinfo->{'force_restart'} ) { + mtr_verbose_restart($server, "forced in .opt file"); + return 1; } - elsif( $tinfo->{'component_id'} eq 'im' ) + + if ( $tinfo->{template_path} ne $current_config_name) { - $do_restart= 1; - mtr_verbose("Restart master: Always restart for im tests"); + mtr_verbose_restart($server, "using different config file"); + return 1; } - elsif ( $master->[0]->{'running_master_options'} and - $master->[0]->{'running_master_options'}->{'timezone'} ne - $tinfo->{'timezone'}) + + if ( $tinfo->{'master_sh'} || $tinfo->{'slave_sh'} ) { - $do_restart= 1; - mtr_verbose("Restart master: Different timezone"); + mtr_verbose_restart($server, "sh script to run"); + return 1; } - # Check that running master was started with same options - # as the current test requires - elsif (! mtr_same_opts($master->[0]->{'start_opts'}, - $tinfo->{'master_opt'}) ) + + if ( ! started($server) ) { - $do_restart= 1; - mtr_verbose("Restart master: running with different options '" . - join(" ", @{$tinfo->{'master_opt'}}) . "' != '" . - join(" ", @{$master->[0]->{'start_opts'}}) . "'" ); + mtr_verbose_restart($server, "not started"); + return 1; } - elsif( ! $master->[0]->{'pid'} ) + + my $started_tinfo= $server->{'started_tinfo'}; + if ( defined $started_tinfo ) { - if ( $opt_extern ) - { - $do_restart= 0; - mtr_verbose("No restart: using extern master"); - } - else + + # Check if timezone of test that server was started + # with differs from timezone of next test + if ( timezone($started_tinfo) ne timezone($tinfo) ) { - $do_restart= 1; - mtr_verbose("Restart master: master is not started"); + mtr_verbose_restart($server, "different timezone"); + return 1; } } - return $do_restart; -} - -sub run_testcase_need_slave_restart($) -{ - my ($tinfo)= @_; - # We try to find out if we are to restart the slaves - my $do_slave_restart= 0; # Assumes we don't have to - - if ( $glob_use_embedded_server ) - { - mtr_verbose("Never start or restart for embedded server"); - return $do_slave_restart; - } - elsif ( $max_slave_num == 0) - { - mtr_verbose("Skip slave restart: No testcase use slaves"); + # Temporary re-enable the "always restart slave" hack + # this should be removed asap, but will require that each rpl + # testcase cleanup better after itself - ie. stop and reset + # replication + # Use the "#!use-slave-opt" marker to detect that this is a "slave" + # server + if ( $server->option("#!use-slave-opt") ){ + mtr_verbose_restart($server, "Always restart slave(s)"); + return 1; } - else + + my $is_mysqld= grep ($server eq $_, mysqlds()); + if ($is_mysqld) { - # Check if any slave is currently started - my $any_slave_started= 0; - foreach my $mysqld (@{$slave}) + # Check that running process was started with same options + # as the current test requires + my $extra_opts= get_extra_opts($server, $tinfo); + my $started_opts= $server->{'started_opts'}; + + if (!My::Options::same($started_opts, $extra_opts) ) { - if ( $mysqld->{'pid'} ) + my $use_dynamic_option_switch= 0; + if (!$use_dynamic_option_switch) { - $any_slave_started= 1; - last; + mtr_verbose_restart($server, "running with different options '" . + join(" ", @{$extra_opts}) . "' != '" . + join(" ", @{$started_opts}) . "'" ); + return 1; } - } - if ($any_slave_started) - { - mtr_verbose("Restart slave: Slave is started, always restart"); - $do_slave_restart= 1; - } - elsif ( $tinfo->{'slave_num'} ) - { - mtr_verbose("Restart slave: Test need slave"); - $do_slave_restart= 1; + mtr_verbose(My::Options::toStr("started_opts", @$started_opts)); + mtr_verbose(My::Options::toStr("extra_opts", @$extra_opts)); + + # Get diff and check if dynamic switch is possible + my @diff_opts= My::Options::diff($started_opts, $extra_opts); + mtr_verbose(My::Options::toStr("diff_opts", @diff_opts)); + + my $query= My::Options::toSQL(@diff_opts); + mtr_verbose("Attempting dynamic switch '$query'"); + if (run_query($tinfo, $server, $query)){ + mtr_verbose("Restart: running with different options '" . + join(" ", @{$extra_opts}) . "' != '" . + join(" ", @{$started_opts}) . "'" ); + return 1; + } + + # Remember the dynamically set options + $server->{'started_opts'}= $extra_opts; } } - return $do_slave_restart; - + # Default, no restart + return 0; } -# ---------------------------------------------------------------------- -# If not using a running servers we may need to stop and restart. -# We restart in the case we have initiation scripts, server options -# etc to run. But we also restart again after the test first restart -# and test is run, to get back to normal server settings. -# -# To make the code a bit more clean, we actually only stop servers -# here, and mark this to be done. Then a generic "start" part will -# start up the needed servers again. -# ---------------------------------------------------------------------- -sub run_testcase_stop_servers($$$) { - my ($tinfo, $do_restart, $do_slave_restart)= @_; - my $pid; - my %admin_pids; # hash of admin processes that requests shutdown - my @kill_pids; # list of processes to shutdown/kill +sub servers_need_restart($) { + my ($tinfo)= @_; + return grep { server_need_restart($tinfo, $_); } all_servers(); +} - # Remember if we restarted for this test case (count restarts) - $tinfo->{'restarted'}= $do_restart; - if ( $do_restart ) - { - delete $master->[0]->{'running_master_options'}; # Forget history - # Start shutdown of all started masters - foreach my $mysqld (@{$master}) - { - if ( $mysqld->{'pid'} ) - { - $pid= mtr_mysqladmin_start($mysqld, "shutdown", 20); +# +# Return list of specific servers +# - there is no servers in an empty config +# +sub _like { return $config ? $config->like($_[0]) : (); } +sub mysqlds { return _like('mysqld.'); } +sub ndbds { return _like('cluster_config.ndbd.');} +sub ndb_mgmds { return _like('cluster_config.ndb_mgmd.'); } +sub clusters { return _like('mysql_cluster.'); } +sub all_servers { return ( mysqlds(), ndb_mgmds(), ndbds() ); } - $admin_pids{$pid}= 1; - push(@kill_pids,{ - pid => $mysqld->{'pid'}, - real_pid => $mysqld->{'real_pid'}, - pidfile => $mysqld->{'path_pid'}, - sockfile => $mysqld->{'path_sock'}, - port => $mysqld->{'port'}, - errfile => $mysqld->{'path_myerr'}, - }); +# +# Filter a list of servers and return only those that are part +# of the specified cluster +# +sub in_cluster { + my ($cluster)= shift; + # Return only processes for a specific cluster + return grep { $_->suffix() eq $cluster->suffix() } @_; +} - $mysqld->{'pid'}= 0; # Assume we are done with it - } - } - # Start shutdown of master cluster - my $cluster= $clusters->[0]; - if ( $cluster->{'pid'} ) - { - $pid= mtr_ndbmgm_start($cluster, "shutdown"); - $admin_pids{$pid}= 1; - push(@kill_pids,{ - pid => $cluster->{'pid'}, - pidfile => $cluster->{'path_pid'} - }); +# +# Filter a list of servers and return the SafeProcess +# for only those that are started or stopped +# +sub started { return grep(defined $_, map($_->{proc}, @_)); } +sub stopped { return grep(!defined $_, map($_->{proc}, @_)); } - $cluster->{'pid'}= 0; # Assume we are done with it - foreach my $ndbd (@{$cluster->{'ndbds'}}) - { - push(@kill_pids,{ - pid => $ndbd->{'pid'}, - pidfile => $ndbd->{'path_pid'}, - }); - $ndbd->{'pid'}= 0; # Assume we are done with it - } - } - } +sub envsubst { + my $string= shift; - if ( $do_restart || $do_slave_restart ) + if ( ! defined $ENV{$string} ) { + mtr_error(".opt file references '$string' which is not set"); + } - delete $slave->[0]->{'running_slave_options'}; # Forget history - - # Start shutdown of all started slaves - foreach my $mysqld (@{$slave}) - { - if ( $mysqld->{'pid'} ) - { - $pid= mtr_mysqladmin_start($mysqld, "shutdown", 20); - - $admin_pids{$pid}= 1; + return $ENV{$string}; +} - push(@kill_pids,{ - pid => $mysqld->{'pid'}, - real_pid => $mysqld->{'real_pid'}, - pidfile => $mysqld->{'path_pid'}, - sockfile => $mysqld->{'path_sock'}, - port => $mysqld->{'port'}, - errfile => $mysqld->{'path_myerr'}, - }); +sub get_extra_opts { + my ($mysqld, $tinfo)= @_; - $mysqld->{'pid'}= 0; # Assume we are done with it - } - } + my $opts= + $mysqld->option("#!use-slave-opt") ? + $tinfo->{slave_opt} : $tinfo->{master_opt}; - # Start shutdown of slave cluster - my $cluster= $clusters->[1]; - if ( $cluster->{'pid'} ) - { - $pid= mtr_ndbmgm_start($cluster, "shutdown"); + # Expand environment variables + foreach my $opt ( @$opts ) + { + $opt =~ s/\$\{(\w+)\}/envsubst($1)/ge; + $opt =~ s/\$(\w+)/envsubst($1)/ge; + } + return $opts; +} - $admin_pids{$pid}= 1; - push(@kill_pids,{ - pid => $cluster->{'pid'}, - pidfile => $cluster->{'path_pid'} - }); +sub stop_servers($$) { + my ($tinfo, @servers)= @_; - $cluster->{'pid'}= 0; # Assume we are done with it + # Remember if we restarted for this test case (count restarts) + $tinfo->{'restarted'}= 1; - foreach my $ndbd (@{$cluster->{'ndbds'}} ) - { - push(@kill_pids,{ - pid => $ndbd->{'pid'}, - pidfile => $ndbd->{'path_pid'}, - }); - $ndbd->{'pid'}= 0; # Assume we are done with it - } - } - } + if ( join('|', @servers) eq join('|', all_servers()) ) + { + # All servers are going down, use some kind of order to + # avoid too many warnings in the log files - # ---------------------------------------------------------------------- - # Shutdown has now been started and lists for the shutdown processes - # and the processes to be killed has been created - # ---------------------------------------------------------------------- + mtr_report("Restarting all servers"); - # Wait blocking until all shutdown processes has completed - mtr_wait_blocking(\%admin_pids); + # mysqld processes + My::SafeProcess::shutdown( $opt_shutdown_timeout, started(mysqlds()) ); + # cluster processes + My::SafeProcess::shutdown( $opt_shutdown_timeout, + started(ndbds(), ndb_mgmds()) ); + } + else + { + mtr_report("Restarting ", started(@servers)); - # Make sure that process has shutdown else try to kill them - mtr_check_stop_servers(\@kill_pids); + # Stop only some servers + My::SafeProcess::shutdown( $opt_shutdown_timeout, + started(@servers) ); + } - foreach my $mysqld (@{$master}, @{$slave}) + foreach my $server (@servers) { - if ( ! $mysqld->{'pid'} ) - { - # Remove ndbcluster tables if server is stopped - rm_ndbcluster_tables($mysqld->{'path_myddir'}); - } + # Mark server as stopped + $server->{proc}= undef; + + # Forget history + delete $server->{'started_tinfo'}; + delete $server->{'started_opts'}; + delete $server->{'started_cnf'}; } } # -# run_testcase_start_servers +# start_servers # -# Start the servers needed by this test case +# Start servers not already started # # RETURN # 0 OK # 1 Start failed # +sub start_servers($) { + my ($tinfo)= @_; -sub run_testcase_start_servers($) { - my $tinfo= shift; - my $tname= $tinfo->{'name'}; + # Start clusters + foreach my $cluster ( clusters() ) + { + ndbcluster_start($cluster); + } - if ( $tinfo->{'component_id'} eq 'mysqld' ) + # Start mysqlds + foreach my $mysqld ( mysqlds() ) { - if ( ! $opt_skip_ndbcluster and - !$clusters->[0]->{'pid'} and - $tinfo->{'ndb_test'} ) + if ( $mysqld->{proc} ) { - # Test need cluster, cluster is not started, start it - ndbcluster_start($clusters->[0], ""); + # Already started + + # Write start of testcase to log file + mark_log($mysqld->value('log-error'), $tinfo); + + next; } - if ( !$master->[0]->{'pid'} ) + my $datadir= $mysqld->value('datadir'); + if ($opt_start_dirty) { - # Master mysqld is not started - do_before_start_master($tinfo); + # Don't delete anything if starting dirty + ; + } + else + { + + my @options= ('log-bin', 'relay-log'); + foreach my $option_name ( @options ) { + next unless $mysqld->option($option_name); - mysqld_start($master->[0],$tinfo->{'master_opt'},[]); + my $file_name= $mysqld->value($option_name); + next unless + defined $file_name and + -e $file_name; + mtr_debug(" -removing '$file_name'"); + unlink($file_name) or die ("unable to remove file '$file_name'"); + } + + if (-d $datadir ) { + mtr_verbose(" - removing '$datadir'"); + rmtree($datadir); + } } - if ( $clusters->[0]->{'pid'} || $clusters->[0]->{'use_running'} - and ! $master->[1]->{'pid'} and - $tinfo->{'master_num'} > 1 ) + my $mysqld_basedir= $mysqld->value('basedir'); + if ( $basedir eq $mysqld_basedir ) { - # Test needs cluster, start an extra mysqld connected to cluster + # Copy datadir from installed system db + for my $path ( "$opt_vardir", "$opt_vardir/..") { + my $install_db= "$path/install.db"; + copytree($install_db, $datadir) + if -d $install_db; + } + mtr_error("Failed to copy system db to '$datadir'") + unless -d $datadir; + } + else + { + mysql_install_db($mysqld); # For versional testing - if ( $mysql_version_id >= 50100 ) - { - # First wait for first mysql server to have created ndb system - # tables ok FIXME This is a workaround so that only one mysqld - # create the tables - if ( ! sleep_until_file_created( - "$master->[0]->{'path_myddir'}/mysql/ndb_apply_status.ndb", - $master->[0]->{'start_timeout'}, - $master->[0]->{'pid'})) - { + mtr_error("Failed to install system db to '$datadir'") + unless -d $datadir; - $tinfo->{'comment'}= "Failed to create 'mysql/ndb_apply_status' table"; - return 1; - } - } - mysqld_start($master->[1],$tinfo->{'master_opt'},[]); } - # Save this test case information, so next can examine it - $master->[0]->{'running_master_options'}= $tinfo; - } - elsif ( ! $opt_skip_im and $tinfo->{'component_id'} eq 'im' ) - { - # We have to create defaults file every time, in order to ensure that it - # will be the same for each test. The problem is that test can change the - # file (by SET/UNSET commands), so w/o recreating the file, execution of - # one test can affect the other. + # Create the servers tmpdir + my $tmpdir= $mysqld->value('tmpdir'); + mkpath($tmpdir) unless -d $tmpdir; - im_create_defaults_file($instance_manager); + # Write start of testcase to log file + mark_log($mysqld->value('log-error'), $tinfo); - if ( ! mtr_im_start($instance_manager, $tinfo->{im_opts}) ) + # Run <tname>-master.sh + if ($mysqld->option('#!run-master-sh') and + run_sh_script($tinfo->{master_sh}) ) { - $tinfo->{'comment'}= "Failed to start Instance Manager. "; + $tinfo->{'comment'}= "Failed to execute '$tinfo->{master_sh}'"; return 1; } - } - - # ---------------------------------------------------------------------- - # Start slaves - if needed - # ---------------------------------------------------------------------- - if ( $tinfo->{'slave_num'} ) - { - restore_slave_databases($tinfo->{'slave_num'}); - - do_before_start_slave($tinfo); - if ( ! $opt_skip_ndbcluster_slave and - !$clusters->[1]->{'pid'} and - $tinfo->{'ndb_test'} ) + # Run <tname>-slave.sh + if ($mysqld->option('#!run-slave-sh') and + run_sh_script($tinfo->{slave_sh})) { - # Test need slave cluster, cluster is not started, start it - ndbcluster_start($clusters->[1], ""); + $tinfo->{'comment'}= "Failed to execute '$tinfo->{slave_sh}'"; + return 1; } - for ( my $idx= 0; $idx < $tinfo->{'slave_num'}; $idx++ ) + if (!$opt_embedded_server) { - if ( ! $slave->[$idx]->{'pid'} ) - { - mysqld_start($slave->[$idx],$tinfo->{'slave_opt'}, - $tinfo->{'slave_mi'}); + my $extra_opts= get_extra_opts($mysqld, $tinfo); + mysqld_start($mysqld,$extra_opts); - } + # Save this test case information, so next can examine it + $mysqld->{'started_tinfo'}= $tinfo; } - # Save this test case information, so next can examine it - $slave->[0]->{'running_slave_options'}= $tinfo; } # Wait for clusters to start - foreach my $cluster (@{$clusters}) + foreach my $cluster ( clusters() ) { - - next if !$cluster->{'pid'}; - if (ndbcluster_wait_started($cluster, "")) { # failed to start - $tinfo->{'comment'}= "Start of $cluster->{'name'} cluster failed"; + $tinfo->{'comment'}= "Start of '".$cluster->name()."' cluster failed"; return 1; } } - # Wait for mysqld's to start - foreach my $mysqld (@{$master},@{$slave}) + # Wait for mysqlds to start + foreach my $mysqld ( mysqlds() ) { + next if !started($mysqld); - next if !$mysqld->{'pid'}; + if (sleep_until_file_created($mysqld->value('pid-file'), + $opt_start_timeout, + $mysqld->{'proc'}) == 0) { + $tinfo->{comment}= + "Failed to start ".$mysqld->name(); - if (mysqld_wait_started($mysqld)) - { - # failed to start - $tinfo->{'comment'}= - "Failed to start $mysqld->{'type'} mysqld $mysqld->{'idx'}"; + my $logfile= $mysqld->value('log-error'); + if ( defined $logfile and -f $logfile ) + { + $tinfo->{logfile}= mtr_fromfile($logfile); + } + else + { + $tinfo->{logfile}= "Could not open server logfile: '$logfile'"; + } return 1; } } return 0; } + # # Run include/check-testcase.test -# Before a testcase, run in record mode, save result file to var +# Before a testcase, run in record mode and save result file to var/tmp # After testcase, run and compare with the recorded file, they should be equal! # # RETURN VALUE -# 0 OK -# 1 Check failed +# The newly started process # -sub run_check_testcase ($$) { - +sub start_check_testcase ($$$) { + my $tinfo= shift; my $mode= shift; my $mysqld= shift; - my $name= "check-" . $mysqld->{'type'} . $mysqld->{'idx'}; + my $name= "check-".$mysqld->name(); + # Replace dots in name with underscore to avoid that mysqltest + # misinterpret's what the filename extension is :( + $name=~ s/\./_/g; my $args; mtr_init_args(\$args); - mtr_add_arg($args, "--no-defaults"); - mtr_add_arg($args, "--silent"); - mtr_add_arg($args, "--skip-safemalloc"); - mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir); - mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); + mtr_add_arg($args, "--defaults-file=%s", $path_config_file); + mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld')); - mtr_add_arg($args, "--socket=%s", $mysqld->{'path_sock'}); - mtr_add_arg($args, "--port=%d", $mysqld->{'port'}); - mtr_add_arg($args, "--database=test"); - mtr_add_arg($args, "--user=%s", $opt_user); - mtr_add_arg($args, "--password="); + mtr_add_arg($args, "--skip-safemalloc"); - mtr_add_arg($args, "-R"); - mtr_add_arg($args, "$opt_vardir/tmp/$name.result"); + mtr_add_arg($args, "--result-file=%s", "$opt_vardir/tmp/$name.result"); + mtr_add_arg($args, "--test-file=%s", "include/check-testcase.test"); if ( $mode eq "before" ) { mtr_add_arg($args, "--record"); } - - my $res = mtr_run_test($exe_mysqltest,$args, - "include/check-testcase.test", "", "", ""); - - if ( $res == 1 and $mode eq "after") - { - mtr_run("diff",["-u", - "$opt_vardir/tmp/$name.result", - "$opt_vardir/tmp/$name.reject"], - "", "", "", ""); - } - elsif ( $res ) - { - mtr_error("Could not execute 'check-testcase' $mode testcase"); - } - return $res; + my $errfile= "$opt_vardir/tmp/$name.err"; + my $proc= My::SafeProcess->new + ( + name => $name, + path => $exe_mysqltest, + error => $errfile, + output => $errfile, + args => \$args, + user_data => $errfile, + verbose => $opt_verbose, + ); + + mtr_report("Started $proc"); + return $proc; } -############################################################################## -# -# Report the features that were compiled in -# -############################################################################## - -sub run_report_features () { - my $args; - if ( ! $glob_use_embedded_server ) - { - mysqld_start($master->[0],[],[]); - if ( ! $master->[0]->{'pid'} ) - { - mtr_error("Can't start the mysqld server"); - } - mysqld_wait_started($master->[0]); - } - - my $tinfo = {}; - $tinfo->{'name'} = 'report features'; - $tinfo->{'result_file'} = undef; - $tinfo->{'component_id'} = 'mysqld'; - $tinfo->{'path'} = 'include/report-features.test'; - $tinfo->{'timezone'}= "GMT-3"; - $tinfo->{'slave_num'} = 0; - $tinfo->{'master_opt'} = []; - $tinfo->{'slave_opt'} = []; - $tinfo->{'slave_mi'} = []; - $tinfo->{'comment'} = 'report server features'; - run_mysqltest($tinfo); - - if ( ! $glob_use_embedded_server ) - { - stop_all_servers(); - } +sub run_mysqltest ($) { + my $proc= start_mysqltest(@_); + $proc->wait(); } -sub run_mysqltest ($) { +sub start_mysqltest ($) { my ($tinfo)= @_; my $exe= $exe_mysqltest; my $args; mtr_init_args(\$args); - mtr_add_arg($args, "--no-defaults"); + mtr_add_arg($args, "--defaults-file=%s", $path_config_file); mtr_add_arg($args, "--silent"); mtr_add_arg($args, "--skip-safemalloc"); mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir); @@ -4921,21 +4588,7 @@ sub run_mysqltest ($) { mtr_add_arg($args, "--mark-progress") if $opt_mark_progress; - if ($tinfo->{'component_id'} eq 'im') - { - mtr_add_arg($args, "--socket=%s", $instance_manager->{'path_sock'}); - mtr_add_arg($args, "--port=%d", $instance_manager->{'port'}); - mtr_add_arg($args, "--user=%s", $instance_manager->{'admin_login'}); - mtr_add_arg($args, "--password=%s", $instance_manager->{'admin_password'}); - } - else # component_id == mysqld - { - mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'}); - mtr_add_arg($args, "--port=%d", $master->[0]->{'port'}); - mtr_add_arg($args, "--database=test"); - mtr_add_arg($args, "--user=%s", $opt_user); - mtr_add_arg($args, "--password="); - } + mtr_add_arg($args, "--database=test"); if ( $opt_ps_protocol ) { @@ -4959,16 +4612,13 @@ sub run_mysqltest ($) { if ( $opt_strace_client ) { - $exe= "strace"; # FIXME there are ktrace, .... + $exe= $opt_strace_client || "strace"; mtr_add_arg($args, "-o"); mtr_add_arg($args, "%s/log/mysqltest.strace", $opt_vardir); mtr_add_arg($args, "$exe_mysqltest"); } - if ( $opt_timer ) - { - mtr_add_arg($args, "--timer-file=%s/log/timer", $opt_vardir); - } + mtr_add_arg($args, "--timer-file=%s/log/timer", $opt_vardir); if ( $opt_compress ) { @@ -4980,56 +4630,48 @@ sub run_mysqltest ($) { mtr_add_arg($args, "--sleep=%d", $opt_sleep); } - if ( $opt_debug ) - { - mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace", - $path_vardir_trace); - } - - if ( $opt_ssl_supported ) - { - mtr_add_arg($args, "--ssl-ca=%s/std_data/cacert.pem", - $glob_mysql_test_dir); - mtr_add_arg($args, "--ssl-cert=%s/std_data/client-cert.pem", - $glob_mysql_test_dir); - mtr_add_arg($args, "--ssl-key=%s/std_data/client-key.pem", - $glob_mysql_test_dir); - } - if ( $opt_ssl ) { # Turn on SSL for _all_ test cases if option --ssl was used mtr_add_arg($args, "--ssl"); } - elsif ( $opt_ssl_supported ) - { - mtr_add_arg($args, "--skip-ssl"); - } foreach my $arg ( @opt_extra_mysqltest_opt ) { mtr_add_arg($args, "%s", $arg); } - # ---------------------------------------------------------------------- - # If embedded server, we create server args to give mysqltest to pass on - # ---------------------------------------------------------------------- - - if ( $glob_use_embedded_server ) + if ( $opt_embedded_server ) { - mysqld_arguments($args,$master->[0],$tinfo->{'master_opt'},[]); + + # Get the args needed for the embedded server + # and append them to args prefixed + # with --sever-arg= + + my $mysqld= $config->group('embedded') + or mtr_error("Could not get [embedded] section"); + + my $mysqld_args; + mtr_init_args(\$mysqld_args); + my $extra_opts= get_extra_opts($mysqld, $tinfo); + mysqld_arguments($mysqld_args, $mysqld, $extra_opts); + mtr_add_arg($args, "--server-arg=%s", $_) for @$mysqld_args; + + if (IS_WINDOWS) + { + # Trick the server to send output to stderr, with --console + mtr_add_arg($args, "--server-arg=--console"); + } } # ---------------------------------------------------------------------- # export MYSQL_TEST variable containing <path>/mysqltest <args> # ---------------------------------------------------------------------- - $ENV{'MYSQL_TEST'}= - mtr_native_path($exe_mysqltest) . " " . join(" ", @$args); + $ENV{'MYSQL_TEST'}= mtr_args2str($exe_mysqltest, @$args); # ---------------------------------------------------------------------- # Add arguments that should not go into the MYSQL_TEST env var # ---------------------------------------------------------------------- - if ( $opt_valgrind_mysqltest ) { # Prefix the Valgrind options to the argument list. @@ -5050,9 +4692,17 @@ sub run_mysqltest ($) { mtr_add_arg($args, "--result-file=%s", $tinfo->{'result_file'}); } + client_debug_arg($args, "mysqltest"); + if ( $opt_record ) { mtr_add_arg($args, "--record"); + + # When recording to a non existing result file + # the name of that file is in "record_file" + if ( defined $tinfo->{'record_file'} ) { + mtr_add_arg($args, "--result-file=%s", $tinfo->{record_file}); + } } if ( $opt_client_gdb ) @@ -5066,38 +4716,20 @@ sub run_mysqltest ($) { elsif ( $opt_client_debugger ) { debugger_arguments(\$args, \$exe, "client"); - } - - if ( $opt_check_testcases ) - { - foreach my $mysqld (@{$master}, @{$slave}) - { - if ($mysqld->{'pid'}) - { - run_check_testcase("before", $mysqld); - } - } - } - - my $res = mtr_run_test($exe,$args,"","",$path_timefile,""); - - if ( $opt_check_testcases ) - { - foreach my $mysqld (@{$master}, @{$slave}) - { - if ($mysqld->{'pid'}) - { - if (run_check_testcase("after", $mysqld)) - { - # Check failed, mark the test case with that info - $tinfo->{'check_testcase_failed'}= 1; - } - } - } - } - - return $res; - + } + + + my $proc= My::SafeProcess->new + ( + name => "mysqltest", + path => $exe, + args => \$args, + append => 1, + error => $path_current_testlog, + verbose => $opt_verbose, + ); + mtr_verbose("Started $proc"); + return $proc; } @@ -5111,7 +4743,7 @@ sub gdb_arguments { # Write $args to gdb init file my $str= join(" ", @$$args); - my $gdb_init_file= "$opt_tmpdir/gdbinit.$type"; + my $gdb_init_file= "$opt_vardir/tmp/gdbinit.$type"; # Remove the old gdbinit file unlink($gdb_init_file); @@ -5126,9 +4758,13 @@ sub gdb_arguments { else { # write init file for mysqld - mtr_tofile($gdb_init_file, <<EOGDB ); -set args $str -EOGDB + mtr_tofile($gdb_init_file, + "set args $str\n" . + "break mysql_parse\n" . + "commands 1\n" . + "disable 1\n" . + "end\n" . + "run"); } if ( $opt_manual_gdb ) @@ -5171,7 +4807,7 @@ sub ddd_arguments { # Write $args to ddd init file my $str= join(" ", @$$args); - my $gdb_init_file= "$opt_tmpdir/gdbinit.$type"; + my $gdb_init_file= "$opt_vardir/tmp/gdbinit.$type"; # Remove the old gdbinit file unlink($gdb_init_file); @@ -5188,7 +4824,11 @@ sub ddd_arguments { # write init file for mysqld mtr_tofile($gdb_init_file, "file $$exe\n" . - "set args $str\n"); + "set args $str\n" . + "break mysql_parse\n" . + "commands 1\n" . + "disable 1\n" . + "end"); } if ( $opt_manual_ddd ) @@ -5307,14 +4947,11 @@ sub valgrind_arguments { } -############################################################################## # -# Usage +# Usage # -############################################################################## - sub usage ($) { - my $message= shift; + my ($message)= @_; if ( $message ) { @@ -5336,15 +4973,15 @@ Options to control what engine/variation to run compress Use the compressed protocol between client and server ssl Use ssl protocol between client and server skip-ssl Dont start server with support for ssl connections - bench Run the benchmark suite - small-bench Run the benchmarks with --small-tests --small-tables - ndb|with-ndbcluster Use cluster as default table type vs-config Visual Studio configuration used to create executables (default: MTR_VS_CONFIG environment variable) + config|defaults-file=<config template> Use fixed config template for all + tests + defaults_extra_file=<config template> Extra config template to add to + all generated configs + Options to control directories to use - benchdir=DIR The directory where the benchmark suite is stored - (default: ../../mysql-bench) tmpdir=DIR The directory where temporary files are stored (default: ./var/tmp). vardir=DIR The directory where files generated from the test run @@ -5356,6 +4993,9 @@ Options to control directories to use for tmpfs (/dev/shm) The option can also be set using environment variable MTR_MEM=[DIR] + client-bindir=PATH Path to the directory where client binaries are located + client-libdir=PATH Path to the directory where client libraries are located + Options to control what test suites or cases to run @@ -5363,33 +5003,27 @@ Options to control what test suites or cases to run with-ndbcluster-only Run only tests that include "ndb" in the filename skip-ndb[cluster] Skip all tests that need cluster skip-ndb[cluster]-slave Skip all tests that need a slave cluster - ndb-extra Run extra tests from ndb directory do-test=PREFIX or REGEX Run test cases which name are prefixed with PREFIX or fulfills REGEX skip-test=PREFIX or REGEX Skip test cases which name are prefixed with PREFIX or fulfills REGEX - start-from=PREFIX Run test cases starting from test prefixed with PREFIX - suite[s]=NAME1,..,NAMEN Collect tests in suites from the comma separated + start-from=PREFIX Run test cases starting test prefixed with PREFIX where + prefix may be suite.testname or just testname + suite[s]=NAME1,..,NAMEN + Collect tests in suites from the comma separated list of suite names. - The default is: "$opt_suites_default" + The default is: "$DEFAULT_SUITES" skip-rpl Skip the replication test cases. - skip-im Don't start IM, and skip the IM test cases - big-test Set the environment variable BIG_TEST, which can be - checked from test cases. - combination="ARG1 .. ARG2" Specify a set of "mysqld" arguments for one - combination. - skip-combination Skip any combination options and combinations files + big-test Also run tests marked as "big" Options that specify ports - master_port=PORT Specify the port number used by the first master - slave_port=PORT Specify the port number used by the first slave - ndbcluster-port=PORT Specify the port number used by cluster - ndbcluster-port-slave=PORT Specify the port number used by slave cluster - mtr-build-thread=# Specify unique collection of ports. Can also be set by - setting the environment variable MTR_BUILD_THREAD. + mtr-build-thread=# Specify unique number to calculate port number(s) from. + build-thread=# Can be set in environment variable MTR_BUILD_THREAD. + Set MTR_BUILD_THREAD="auto" to automatically aquire + a build thread id that is unique to current host Options for test case authoring @@ -5403,11 +5037,11 @@ Options that pass on options Options to run test on running server - extern Use running server for tests - ndb-connectstring=STR Use running cluster, and connect using STR - ndb-connectstring-slave=STR Use running slave cluster, and connect using STR - user=USER User for connection to extern server - socket=PATH Socket for connection to extern server + extern option=value Run only the tests against an already started server + the options to use for connection to the extern server + must be specified using name-value pair notation + For example: + ./$0 --extern socket=/tmp/mysqld.sock Options for debugging the product @@ -5424,17 +5058,24 @@ Options for debugging the product test(s) manual-ddd Let user manually start mysqld in ddd, before running test(s) - master-binary=PATH Specify the master "mysqld" to use - slave-binary=PATH Specify the slave "mysqld" to use - strace-client Create strace output for mysqltest client + strace-client=[path] Create strace output for mysqltest client, optionally + specifying name and path to the trace program to use. + Example: $0 --strace-client=ktrace max-save-core Limit the number of core files saved (to avoid filling up disks for heavily crashing server). Defaults to - $opt_max_save_core, set to 0 for no limit. + $opt_max_save_core, set to 0 for no limit. Set + it's default with MTR_MAX_SAVE_CORE + max-save-datadir Limit the number of datadir saved (to avoid filling + up disks for heavily crashing server). Defaults to + $opt_max_save_datadir, set to 0 for no limit. Set + it's default with MTR_MAX_SAVE_DATDIR + max-test-fail Limit the number of test failurs before aborting + the current test run. Defaults to + $opt_max_test_fail, set to 0 for no limit. Set + it's default with MTR_MAX_TEST_FAIL -Options for coverage, profiling etc +Options for valgrind - gcov FIXME - gprof FIXME valgrind Run the "mysqltest" and "mysqld" executables using valgrind with default options valgrind-all Synonym for --valgrind @@ -5448,33 +5089,36 @@ Options for coverage, profiling etc callgrind Instruct valgrind to use callgrind Misc options - + user=USER User for connecting to mysqld(default: $opt_user) comment=STR Write STR to the output notimer Don't show test case execution time - script-debug Debug this script itself - verbose More verbose output - start-and-exit Only initialize and start the servers, using the - startup settings for the specified test case (if any) + verbose More verbose output(use multiple times for even more) + start Only initialize and start the servers, using the + startup settings for the first specified test case + Example: + $0 --start alias & start-dirty Only start the servers (without initialization) for - the specified test case (if any) - fast Don't try to clean up from earlier runs + the first specified test case + fast Run as fast as possible, dont't wait for servers + to shutdown etc. + repeat=N Run each test N number of times + retry=N Retry tests that fail N times, limit number of failures + to $opt_retry_failure + retry-failure=N Limit number of retries for a failed test reorder Reorder tests to get fewer server restarts help Get this help text - testcase-timeout=MINUTES Max test case run time (default $default_testcase_timeout) - suite-timeout=MINUTES Max test suite run time (default $default_suite_timeout) - warnings | log-warnings Pass --log-warnings to mysqld + testcase-timeout=MINUTES Max test case run time (default $opt_testcase_timeout) + suite-timeout=MINUTES Max test suite run time (default $opt_suite_timeout) + shutdown-timeout=SECONDS Max number of seconds to wait for server shutdown + before killing servers (default $opt_shutdown_timeout) + warnings Scan the log files for warnings. Use --nowarnings + to turn off. sleep=SECONDS Passed to mysqltest, will be used as fixed sleep time - client-bindir=PATH Path to the directory where client binaries are located - client-libdir=PATH Path to the directory where client libraries are located - -Deprecated options - with-openssl Deprecated option for ssl - HERE - mtr_exit(1); + exit(1); } @@ -5487,6 +5131,5 @@ sub list_options ($) { print "--$_\n"; } - mtr_exit(1); + exit(1); } - diff --git a/mysql-test/ndb/Makefile.am b/mysql-test/ndb/Makefile.am deleted file mode 100644 index 4ddf61cf5cc..00000000000 --- a/mysql-test/ndb/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ - -benchdir_root= $(prefix) -testdir = $(benchdir_root)/mysql-test/ndb - -EXTRA_DIST = ndbcluster.sh -CLEANFILES = ndbcluster -dist_test_DATA = ndb_config_2_node.ini ndb_config_1_node.ini -test_SCRIPTS = ndbcluster - -SUFFIXES = .sh - -.sh: - @RM@ -f $@ $@-t - @SED@ \ - -e 's!@''ndb_port''@!$(ndb_port)!g' \ - -e 's!@''ndbbindir''@!$(ndbbindir)!g' \ - -e 's!@''ndbtoolsdir''@!$(ndbtoolsdir)!g' \ - $< > $@-t - @CHMOD@ +x $@-t - @MV@ $@-t $@ - -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/mysql-test/ndb/basic.result b/mysql-test/ndb/basic.result deleted file mode 100644 index 9d2b18881b9..00000000000 --- a/mysql-test/ndb/basic.result +++ /dev/null @@ -1,69 +0,0 @@ --- NDB Cluster -- Management Client -- ---------------------------------------------------------------------------- - NDB Cluster -- Management Client -- Help ---------------------------------------------------------------------------- -HELP Print help text -HELP SHOW Help for SHOW command -HELP DEBUG Help for debug compiled version -SHOW Print information about cluster -START BACKUP [NOWAIT | WAIT STARTED | WAIT COMPLETED] - Start backup (default WAIT COMPLETED) -ABORT BACKUP <backup id> Abort backup -SHUTDOWN Shutdown all processes in cluster -CLUSTERLOG ON [<severity>] ... Enable Cluster logging -CLUSTERLOG OFF [<severity>] ... Disable Cluster logging -CLUSTERLOG TOGGLE [<severity>] ... Toggle severity filter on/off -CLUSTERLOG INFO Print cluster log information -<id> START Start DB node (started with -n) -<id> RESTART [-n] [-i] Restart DB node -<id> STOP Stop DB node -ENTER SINGLE USER MODE <api-node> Enter single user mode -EXIT SINGLE USER MODE Exit single user mode -<id> STATUS Print status -<id> CLUSTERLOG {<category>=<level>}+ Set log level for cluster log -PURGE STALE SESSIONS Reset reserved nodeid's in the mgmt server -CONNECT [<connectstring>] Connect to management server (reconnect if already connected) -QUIT Quit management client - -<severity> = ALERT | CRITICAL | ERROR | WARNING | INFO | DEBUG -<category> = STARTUP | SHUTDOWN | STATISTICS | CHECKPOINT | NODERESTART | CONNECTION | INFO | ERROR | CONGESTION | DEBUG | BACKUP -<level> = 0 - 15 -<id> = ALL | Any database node id - -Connected to Management Server at: localhost:1186 -Node 1: started (Version 5.0.3) -Node 2: started (Version 5.0.3) - -Node 1: started (Version 5.0.3) - -Node 2: started (Version 5.0.3) - -Executing CLUSTERLOG on node 1 OK! -Executing CLUSTERLOG on node 2 OK! - -Executing CLUSTERLOG on node 1 OK! -Executing CLUSTERLOG on node 2 OK! - -Executing CLUSTERLOG on node 1 OK! -Executing CLUSTERLOG on node 2 OK! - -Executing CLUSTERLOG on node 1 OK! -Executing CLUSTERLOG on node 2 OK! - -Executing CLUSTERLOG on node 1 OK! -Executing CLUSTERLOG on node 2 OK! - -Executing CLUSTERLOG on node 1 OK! -Executing CLUSTERLOG on node 2 OK! - -Executing CLUSTERLOG on node 1 OK! -Executing CLUSTERLOG on node 2 OK! - -Executing CLUSTERLOG on node 1 OK! -Executing CLUSTERLOG on node 2 OK! - -Cluster logging is disabled -Cluster logging is enabled. -Cluster logging is disabled -ALL disabled -ALL enabled diff --git a/mysql-test/ndb/basic.test b/mysql-test/ndb/basic.test deleted file mode 100644 index 945bda94ff6..00000000000 --- a/mysql-test/ndb/basic.test +++ /dev/null @@ -1,17 +0,0 @@ -help -all status -1 status -2 status -all clusterlog connection=8 -all clusterlog startup=7 -all clusterlog checkpoint=7 -all clusterlog noderestart=15 -all clusterlog statistics=7 -all clusterlog error=7 -all clusterlog info=7 -all clusterlog backup=15 -clusterlog off -clusterlog toggle -clusterlog off -clusterlog off all -clusterlog on all diff --git a/mysql-test/ndb/basic_log.result b/mysql-test/ndb/basic_log.result deleted file mode 100644 index e69de29bb2d..00000000000 --- a/mysql-test/ndb/basic_log.result +++ /dev/null diff --git a/mysql-test/ndb/ndb_config_4_node.ini b/mysql-test/ndb/ndb_config_4_node.ini deleted file mode 100644 index d7c66cf177a..00000000000 --- a/mysql-test/ndb/ndb_config_4_node.ini +++ /dev/null @@ -1,55 +0,0 @@ -[ndbd default] -NoOfReplicas= 2 -MaxNoOfConcurrentTransactions= 64 -MaxNoOfConcurrentOperations= CHOOSE_MaxNoOfConcurrentOperations -DataMemory= CHOOSE_DataMemory -IndexMemory= CHOOSE_IndexMemory -Diskless= CHOOSE_Diskless -TimeBetweenWatchDogCheck= 30000 -DataDir= CHOOSE_FILESYSTEM -MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes -MaxNoOfAttributes= CHOOSE_MaxNoOfAttributes -TimeBetweenGlobalCheckpoints= 500 -NoOfFragmentLogFiles= 3 -DiskPageBufferMemory= CHOOSE_DiskPageBufferMemory - -# -# Increase timeouts to cater for slow test-machines -# (possibly running several tests in parallell) -# -HeartbeatIntervalDbDb= 30000 -HeartbeatIntervalDbApi= 30000 -#TransactionDeadlockDetectionTimeout= 7500 - -[ndbd] -HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress - -[ndbd] -HostName= CHOOSE_HOSTNAME_2 # hostname is a valid network adress - -[ndbd] -HostName= CHOOSE_HOSTNAME_3 # hostname is a valid network adress - -[ndbd] -HostName= CHOOSE_HOSTNAME_4 # hostname is a valid network adress - -[ndb_mgmd] -HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress -DataDir= CHOOSE_FILESYSTEM # -PortNumber= CHOOSE_PORT_MGM - -[mysqld] - -[mysqld] - -[mysqld] - -[mysqld] - -[mysqld] - -[mysqld] - -[mysqld] - -[mysqld] diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh deleted file mode 100644 index 2d550294c84..00000000000 --- a/mysql-test/ndb/ndbcluster.sh +++ /dev/null @@ -1,414 +0,0 @@ -#!/bin/sh -# Copyright (C) 2004 MySQL AB -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -# This scripts starts the table handler ndbcluster - -# configurable parameters, make sure to change in mysqlcluterd as well -port=@ndb_port@ -fsdir=`pwd` -# end configurable parameters - -#BASEDIR is always one above mysql-test directory -CWD=`pwd` -cd .. -BASEDIR=`pwd` -cd $CWD - -# Are we using a source or a binary distribution? -if [ -d ../sql ] ; then - SOURCE_DIST=1 - ndbtop=$BASEDIR/storage/ndb - exec_ndb=$ndbtop/src/kernel/ndbd - exec_mgmtsrvr=$ndbtop/src/mgmsrv/ndb_mgmd - exec_waiter=$ndbtop/tools/ndb_waiter - exec_test=$ndbtop/tools/ndb_test_platform - exec_test_ndberror=$ndbtop/src/ndbapi/ndberror_check - exec_mgmtclient=$ndbtop/src/mgmclient/ndb_mgm -else - BINARY_DIST=1 - if test -x "$BASEDIR/libexec/ndbd" - then - exec_ndb=$BASEDIR/libexec/ndbd - exec_mgmtsrvr=$BASEDIR/libexec/ndb_mgmd - else - exec_ndb=$BASEDIR/bin/ndbd - exec_mgmtsrvr=$BASEDIR/bin/ndb_mgmd - fi - exec_waiter=$BASEDIR/bin/ndb_waiter - exec_test=$BASEDIR/bin/ndb_test_platform - exec_test_ndberror= - exec_mgmtclient=$BASEDIR/bin/ndb_mgm -fi - -if $exec_test ; then :; else - echo "ndb not correctly compiled to support this platform" - exit 1 -fi - -if [ $exec_test_ndberror ] ; then -if $exec_test_ndberror ; then :; else - echo "please fix in ndberror.c" - exit 1 -fi -fi - -pidfile=ndbcluster.pid -cfgfile=Ndb.cfg -test_ndb= -stop_ndb= -initial_ndb= -status_ndb= -ndb_diskless=0 -ndbd_nodes=2 -relative_config_data_dir= -opt_core= - -ndb_no_ord=512 -ndb_no_attr=2048 -ndb_con_op=105000 -ndb_dmem=80M -ndb_imem=24M -ndb_pbmem=32M - -VERBOSE=100 -NDB_MGM_EXTRA_OPTS= -NDB_MGMD_EXTRA_OPTS= -NDBD_EXTRA_OPTS= -CHARSETSDIR= - -while test $# -gt 0; do - case "$1" in - --test) - test_ndb=1 - ;; - --stop) - stop_ndb=1 - ;; - --initial) - flags_ndb="$flags_ndb --initial" - initial_ndb=1 - ;; - --debug*) - flags_ndb="$flags_ndb $1" - ;; - --ndbd-nodes=*) - ndbd_nodes=`echo "$1" | sed -e "s;--ndbd-nodes=;;"` - ;; - --status) - status_ndb=1 - ;; - --small) - ndb_no_ord=32 - ndb_con_op=5000 - ndb_dmem=20M - ndb_imem=1M - ndb_pbmem=4M - ;; - --diskless) - ndb_diskless=1 - ;; - --data-dir=*) - fsdir=`echo "$1" | sed -e "s;--data-dir=;;"` - ;; - --relative-config-data-dir) - relative_config_data_dir=1 - ;; - --port=*) - port=`echo "$1" | sed -e "s;--port=;;"` - ;; - --port-base=*) - $ECHO "--port-base option depricated. Ignored." - ;; - --ndb_mgm-extra-opts=*) - NDB_MGM_EXTRA_OPTS=`echo "$1" | sed -e "s;--ndb_mgm-extra-opts=;;"` - ;; - --ndb_mgmd-extra-opts=*) - NDB_MGMD_EXTRA_OPTS=`echo "$1" | sed -e "s;--ndb_mgmd-extra-opts=;;"` - ;; - --ndbd-extra-opts=*) - NDBD_EXTRA_OPTS=`echo "$1" | sed -e "s;--ndbd-extra-opts=;;"` - ;; - --character-sets-dir=*) - CHARSETSDIR=`echo "$1" | sed -e "s;--character-sets-dir=;;"` - ;; - --core) - opt_core="--core" - ;; - --verbose=*) - VERBOSE=`echo "$1" | sed -e "s;--verbose=;;"` - ;; - -- ) shift; break ;; - --* ) $ECHO "Unrecognized option: $1"; exit 1 ;; - * ) break ;; - esac - shift -done - -fs_ndb="$fsdir/ndbcluster-$port" -config_ini=ndb/ndb_config_${ndbd_nodes}_node.ini - -NDB_HOME= -if [ ! -d "$fsdir" ]; then - echo "$fsdir missing" - exit 1 -fi -if [ ! -x "$exec_ndb" ]; then - echo "$exec_ndb missing" - exit 1 -fi -if [ ! -x "$exec_mgmtsrvr" ]; then - echo "$exec_mgmtsrvr missing" - exit 1 -fi -if [ ! -x "$exec_waiter" ]; then - echo "$exec_waiter missing" - exit 1 -fi -if [ ! -f "$config_ini" ]; then - echo "$config_ini missing, unsupported number of nodes" - exit 1 -fi - -exec_mgmtclient="$exec_mgmtclient --no-defaults $opt_core $NDB_MGM_EXTRA_OPTS" -exec_mgmtsrvr="$exec_mgmtsrvr --no-defaults $opt_core $NDB_MGMD_EXTRA_OPTS" -exec_ndb="$exec_ndb --no-defaults $opt_core $NDBD_EXTRA_OPTS --character-sets-dir=$CHARSETSDIR" -exec_waiter="$exec_waiter --no-defaults $opt_core" - -ndb_host="localhost" -ndb_mgmd_port=$port -NDB_CONNECTSTRING="host=$ndb_host:$ndb_mgmd_port" -export NDB_CONNECTSTRING - -sleep_until_file_created () { - file=$1 - loop=$2 - org_time=$2 - message=$3 - while (test $loop -gt 0) - do - if [ -r $file ] - then - return 0 - fi - sleep 1 - loop=`expr $loop - 1` - done - if [ $message ] - then - echo $message - fi - echo "ERROR: $file was not created in $org_time seconds; Aborting" - return 1; -} - -start_default_ndbcluster() { - -# do some checks - -if [ "$initial_ndb" ] ; then - [ -d "$fs_ndb" ] || mkdir "$fs_ndb" -fi -if [ -d "$fs_ndb" ]; then :; else - echo "$fs_ndb filesystem directory does not exist" - exit 1 -fi - -# Start management server as deamon - -# Edit file system path and ports in config file -if [ $relative_config_data_dir ] ; then - config_fs_ndb="." -else - config_fs_ndb=$fs_ndb -fi -if [ $initial_ndb ] ; then - rm -rf $fs_ndb/ndb_* 2>&1 | cat > /dev/null - sed \ - -e s,"CHOOSE_MaxNoOfAttributes","$ndb_no_attr",g \ - -e s,"CHOOSE_MaxNoOfOrderedIndexes","$ndb_no_ord",g \ - -e s,"CHOOSE_MaxNoOfConcurrentOperations","$ndb_con_op",g \ - -e s,"CHOOSE_DataMemory","$ndb_dmem",g \ - -e s,"CHOOSE_IndexMemory","$ndb_imem",g \ - -e s,"CHOOSE_Diskless","$ndb_diskless",g \ - -e s,"CHOOSE_HOSTNAME_".*,"$ndb_host",g \ - -e s,"CHOOSE_FILESYSTEM","$config_fs_ndb",g \ - -e s,"CHOOSE_PORT_MGM","$ndb_mgmd_port",g \ - -e s,"CHOOSE_DiskPageBufferMemory","$ndb_pbmem",g \ - < "$config_ini" \ - > "$fs_ndb/config.ini" -fi - -rm -f "$cfgfile" 2>&1 | cat > /dev/null -rm -f "$fs_ndb/$cfgfile" 2>&1 | cat > /dev/null - -if ( cd "$fs_ndb" ; $exec_mgmtsrvr -f config.ini ) ; then :; else - echo "Unable to start $exec_mgmtsrvr from `pwd`" - exit 1 -fi -if sleep_until_file_created $fs_ndb/ndb_`expr $ndbd_nodes + 1`.pid 120 -then :; else - exit 1 -fi -cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" - -# Start database node - -id=1 -while [ $id -le $ndbd_nodes ] -do - if [ `expr $VERBOSE \> 1` = 1 ] ; then - echo "Starting ndbd $id($ndbd_nodes)" - fi - ( cd "$fs_ndb" ; $exec_ndb $flags_ndb & ) - if sleep_until_file_created $fs_ndb/ndb_${id}.pid 120 - then :; else - stop_default_ndbcluster - exit 1 - fi - cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" - id=`expr $id + 1` -done - -# test if Ndb Cluster starts properly - -if [ `expr $VERBOSE \> 1` = 1 ] ; then - echo "Waiting for NDB data nodes to start..." -fi -if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK" > /dev/null 2>&1 ; then :; else - if [ `expr $VERBOSE \> 0` = 1 ] ; then - echo "Ndbcluster startup failed" - fi - stop_default_ndbcluster - exit 1 -fi -if [ `expr $VERBOSE \> 1` = 1 ] ; then - echo "Ok" -fi - -cat `find "$fs_ndb" -name 'ndb_*.pid'` > $fs_ndb/$pidfile - -if [ `expr $VERBOSE \> 2` = 1 ] ; then - status_ndbcluster -fi -} - -status_ndbcluster() { - # Start management client - $exec_mgmtclient -e show -} - -stop_default_ndbcluster() { - -# Start management client - -exec_mgmtclient="$exec_mgmtclient --try-reconnect=1" - -$exec_mgmtclient -e shutdown 2>&1 | cat > /dev/null - -if [ -f "$fs_ndb/$pidfile" ] ; then - kill_pids=`cat "$fs_ndb/$pidfile"` - attempt=0 - while [ $attempt -lt 10 ] ; do - new_kill_pid="" - kill_pids2="" - for p in $kill_pids ; do - kill -0 $p 2> /dev/null - if [ $? -eq 0 ] ; then - new_kill_pid="$p $new_kill_pid" - kill_pids2="-$p $kill_pids2" - fi - done - kill_pids=$new_kill_pid - if [ -z "$kill_pids" ] ; then - break - fi - sleep 1 - attempt=`expr $attempt + 1` - done - if [ "$kill_pids2" != "" ] ; then - echo "Failed to shutdown ndbcluster, executing kill "$kill_pids2 - kill -9 -- $kill_pids2 2> /dev/null - /bin/kill -9 -- $kill_pids2 2> /dev/null - /usr/bin/kill -9 -- $kill_pids2 2> /dev/null - kill -9 $kill_pids2 2> /dev/null - /bin/kill -9 $kill_pids2 2> /dev/null - /usr/bin/kill -9 $kill_pids2 2> /dev/null - fi - rm "$fs_ndb/$pidfile" -fi -} - -initialize_ndb_test () -{ - fs_result=$fs_ndb/r - rm -rf $fs_result - mkdir $fs_result - echo ------------------ - echo starting ndb tests - echo ------------------ -} - -do_ndb_test () -{ - test_name=$1 - - clusterlog=$fs_ndb/ndb_3_cluster.log - - test_log_result=$fs_result/${test_name}_log.result - test_log_reject=$fs_result/${test_name}_log.reject - test_result=$fs_result/${test_name}.result - test_reject=$fs_result/${test_name}.reject - - clean_log='s/.*\[MgmSrvr\]//' - - cat $clusterlog ndb/${test_name}_log.result | sed -e $clean_log > $test_log_result - - cp ndb/${test_name}.result $test_result - - cat ndb/${test_name}.test | $exec_mgmtclient > $test_reject - cat $clusterlog | sed -e $clean_log > $test_log_reject - - t="pass" - diff -C 5 $test_result $test_reject || t="fail" - printf "ndb_mgm output %20s [%s]\n" $test_name $t - t="pass" - diff -C 5 $test_log_result $test_log_reject || t="fail" - printf "clusterlog output %20s [%s]\n" $test_name $t -} - -if [ $status_ndb ] ; then - status_ndbcluster - exit 0 -fi - -if [ $stop_ndb ] ; then - stop_default_ndbcluster -else - start_default_ndbcluster -fi - -if [ $test_ndb ] ; then - initialize_ndb_test - all_tests=`ls ndb/*.test | sed "s#ndb/##" | sed "s#.test##"` - for a in $all_tests ; do - do_ndb_test $a - done - echo ------------------ - echo shutting down cluster - stop_default_ndbcluster -fi - -exit 0 diff --git a/mysql-test/ndb/restart.result b/mysql-test/ndb/restart.result deleted file mode 100644 index efa1399b5d9..00000000000 --- a/mysql-test/ndb/restart.result +++ /dev/null @@ -1,16 +0,0 @@ --- NDB Cluster -- Management Client -- -Connected to Management Server at: localhost:1186 -ALL disabled -Cluster logging is enabled. -ALERT enabled -Executing CLUSTERLOG on node 1 OK! -Executing CLUSTERLOG on node 2 OK! - -Node 1 is being restarted. - -Executing CLUSTERLOG on node 1 OK! -Executing CLUSTERLOG on node 2 OK! - -Node 1 is being restarted. - -ALL enabled diff --git a/mysql-test/ndb/restart.test b/mysql-test/ndb/restart.test deleted file mode 100644 index 4b4584dd739..00000000000 --- a/mysql-test/ndb/restart.test +++ /dev/null @@ -1,12 +0,0 @@ -clusterlog off all -clusterlog on -clusterlog on alert -all clusterlog connection=0 -sleep 1 -1 restart -sleep 5 -all clusterlog connection=8 -sleep 1 -1 restart -sleep 10 -clusterlog on all diff --git a/mysql-test/ndb/restart_log.result b/mysql-test/ndb/restart_log.result deleted file mode 100644 index 2b25fc7b5b6..00000000000 --- a/mysql-test/ndb/restart_log.result +++ /dev/null @@ -1,20 +0,0 @@ - ALERT -- Node 2: Network partitioning - arbitration required - ALERT -- Node 2: Arbitration won - positive reply from node 3 - ALERT -- Node 2: Node 1 has failed. The Node state at failure was 0 - ALERT -- Node 2: Node failure of 1 DBLQH completed - ALERT -- Node 2: Node failure of 1 DBDICT completed - ALERT -- Node 2: Node failure of 1 DBDIH completed - ALERT -- Node 2: Node failure of 1 DBTC completed - ALERT -- Node 2: Node 2 completed failure of Node 1 - ALERT -- Node 2: All nodes completed failure of Node 1 - ALERT -- Node 3: Node 1 Disconnected - ALERT -- Node 2: Node 1 Disconnected - ALERT -- Node 2: Network partitioning - arbitration required - ALERT -- Node 2: Arbitration won - positive reply from node 3 - ALERT -- Node 2: Node 1 has failed. The Node state at failure was 0 - ALERT -- Node 2: Node failure of 1 DBLQH completed - ALERT -- Node 2: Node failure of 1 DBDICT completed - ALERT -- Node 2: Node failure of 1 DBDIH completed - ALERT -- Node 2: Node failure of 1 DBTC completed - ALERT -- Node 2: Node 2 completed failure of Node 1 - ALERT -- Node 2: All nodes completed failure of Node 1 diff --git a/mysql-test/r/1st.result b/mysql-test/r/1st.result index 60190629dd0..4a82f8c66e9 100644 --- a/mysql-test/r/1st.result +++ b/mysql-test/r/1st.result @@ -1,6 +1,7 @@ show databases; Database information_schema +mtr mysql test show tables in mysql; diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index b3b2d5d6235..2a784d984ed 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -996,6 +996,22 @@ SELECT * FROM t1; v b abc 5 DROP TABLE t1; +create table t1 (a tinytext character set latin1); +alter table t1 convert to character set utf8; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +drop table t1; +create table t1 (a mediumtext character set latin1); +alter table t1 convert to character set utf8; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longtext +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +drop table t1; End of 5.0 tests drop table if exists t1, t2, t3; create table t1 (i int); diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result index e9eb50fc805..8c26ea1ff82 100644 --- a/mysql-test/r/archive.result +++ b/mysql-test/r/archive.result @@ -12694,3 +12694,4 @@ SELECT * FROM t1 ORDER BY a; a b 1 NULL 2 NULL +DROP TABLE t1; diff --git a/mysql-test/r/backup.result b/mysql-test/r/backup.result index 4de599f3af7..b657c620805 100644 --- a/mysql-test/r/backup.result +++ b/mysql-test/r/backup.result @@ -1,24 +1,24 @@ set SQL_LOG_BIN=0; drop table if exists t1, t2, t3, t4; create table t4(n int); -backup table t4 to '../bogus'; +backup table t4 to '../../bogus'; Table Op Msg_type Msg_text test.t4 backup error Failed copying .frm file (errno: X) test.t4 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead test.t4 backup Error Can't create/write to file 'MYSQLTEST_VARDIR/bogus/t4.frm' (Errcode: X) test.t4 backup status Operation failed -backup table t4 to '../tmp'; +backup table t4 to '../../tmp'; Table Op Msg_type Msg_text test.t4 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead test.t4 backup status OK -backup table t4 to '../tmp'; +backup table t4 to '../../tmp'; Table Op Msg_type Msg_text test.t4 backup error Failed copying .frm file (errno: X) test.t4 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead test.t4 backup Error Can't create/write to file 'MYSQLTEST_VARDIR/tmp/t4.frm' (Errcode: X) test.t4 backup status Operation failed drop table t4; -restore table t4 from '../tmp'; +restore table t4 from '../../tmp'; Table Op Msg_type Msg_text test.t4 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead test.t4 restore status OK @@ -27,18 +27,18 @@ count(*) 0 create table t1(n int); insert into t1 values (23),(45),(67); -backup table t1 to '../tmp'; +backup table t1 to '../../tmp'; Table Op Msg_type Msg_text test.t1 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead test.t1 backup status OK drop table t1; -restore table t1 from '../bogus'; +restore table t1 from '../../bogus'; Table Op Msg_type Msg_text t1 restore error Failed copying .frm file Warnings: Warning 1287 The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead Error 29 File 'MYSQLTEST_VARDIR/bogus/t1.frm' not found (Errcode: X) -restore table t1 from '../tmp'; +restore table t1 from '../../tmp'; Table Op Msg_type Msg_text test.t1 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead test.t1 restore status OK @@ -51,13 +51,13 @@ create table t2(m int not null primary key); create table t3(k int not null primary key); insert into t2 values (123),(145),(167); insert into t3 values (223),(245),(267); -backup table t2,t3 to '../tmp'; +backup table t2,t3 to '../../tmp'; Table Op Msg_type Msg_text test.t2 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead test.t2 backup status OK test.t3 backup status OK drop table t1,t2,t3; -restore table t1,t2,t3 from '../tmp'; +restore table t1,t2,t3 from '../../tmp'; Table Op Msg_type Msg_text test.t1 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead test.t1 restore status OK @@ -79,13 +79,13 @@ k 245 267 drop table t1,t2,t3,t4; -restore table t1 from '../tmp'; +restore table t1 from '../../tmp'; Table Op Msg_type Msg_text test.t1 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead test.t1 restore status OK rename table t1 to t5; lock tables t5 write; -backup table t5 to '../tmp'; +backup table t5 to '../../tmp'; unlock tables; Table Op Msg_type Msg_text test.t5 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead @@ -94,12 +94,12 @@ drop table t5; DROP TABLE IF EXISTS `t+1`; CREATE TABLE `t+1` (c1 INT); INSERT INTO `t+1` VALUES (1), (2), (3); -BACKUP TABLE `t+1` TO '../tmp'; +BACKUP TABLE `t+1` TO '../../tmp'; Table Op Msg_type Msg_text test.t+1 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead test.t+1 backup status OK DROP TABLE `t+1`; -RESTORE TABLE `t+1` FROM '../tmp'; +RESTORE TABLE `t+1` FROM '../../tmp'; Table Op Msg_type Msg_text test.t+1 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead test.t+1 restore status OK diff --git a/mysql-test/r/cache_innodb.result b/mysql-test/r/cache_innodb.result index 17cfcd69ec3..f2067e967f2 100644 --- a/mysql-test/r/cache_innodb.result +++ b/mysql-test/r/cache_innodb.result @@ -218,4 +218,5 @@ Qcache_queries_in_cache 1 show status like "Qcache_hits"; Variable_name Value Qcache_hits 2 +set GLOBAL query_cache_size=1048576; drop table t2; diff --git a/mysql-test/r/commit_1innodb.result b/mysql-test/r/commit_1innodb.result index a2c1eb9a82e..a31a881051f 100644 --- a/mysql-test/r/commit_1innodb.result +++ b/mysql-test/r/commit_1innodb.result @@ -263,7 +263,7 @@ rollback; select * from t2; a insert into t2 (a) values (1026); -load data infile "../std_data_ln/words.dat" into table t1 (a) set a:=f2(26); +load data infile "../../std_data/words.dat" into table t1 (a) set a:=f2(26); ERROR 23000: Duplicate entry '26' for key 'a' select * from t2; a @@ -683,10 +683,10 @@ SUCCESS # 23. DDL: RENAME TEMPORARY TABLE, does not start a transaction # No test because of Bug#8729 "rename table fails on temporary table" -# 24. DDL: TRUNCATE TEMPORARY TABLE, does not start a transaction +# 24. DDL: TRUNCATE TEMPORARY TABLE truncate table t2; -call p_verify_status_increment(2, 0, 2, 0); +call p_verify_status_increment(4, 0, 4, 0); SUCCESS commit; @@ -770,8 +770,11 @@ call p_verify_status_increment(0, 0, 0, 0); SUCCESS insert t1 set a=4; -# Sic: a bug. Binlog did not register itself this time. -call p_verify_status_increment(1, 0, 1, 0); +# Binlog does not register itself this time for other than the 1st +# statement of the transaction with MIXED/STATEMENT binlog_format. +# It needs registering with the ROW format. Therefore 1,0,2,2 are +# the correct arguments to this test after bug#40221 fixed. +call p_verify_status_increment(1, 0, 2, 2); SUCCESS release savepoint a; @@ -850,7 +853,7 @@ call p_verify_status_increment(1, 0, 1, 0); SUCCESS truncate table t3; -call p_verify_status_increment(2, 2, 2, 2); +call p_verify_status_increment(4, 4, 4, 4); SUCCESS create view v1 as select * from t2; diff --git a/mysql-test/r/concurrent_innodb_safelog.result b/mysql-test/r/concurrent_innodb_safelog.result index 98e1205901a..c79195b5257 100644 --- a/mysql-test/r/concurrent_innodb_safelog.result +++ b/mysql-test/r/concurrent_innodb_safelog.result @@ -801,3 +801,4 @@ eta tipo c 90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk ** connection default drop table t1; +DROP user mysqltest@localhost; diff --git a/mysql-test/r/concurrent_innodb_unsafelog.result b/mysql-test/r/concurrent_innodb_unsafelog.result index 14973fe07d9..7330d9af6ce 100644 --- a/mysql-test/r/concurrent_innodb_unsafelog.result +++ b/mysql-test/r/concurrent_innodb_unsafelog.result @@ -797,3 +797,4 @@ eta tipo c 90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk ** connection default drop table t1; +DROP user mysqltest@localhost; diff --git a/mysql-test/r/concurrent_insert_func.result b/mysql-test/r/concurrent_insert_func.result deleted file mode 100644 index 87573bb2873..00000000000 --- a/mysql-test/r/concurrent_insert_func.result +++ /dev/null @@ -1,73 +0,0 @@ -drop table if exists t1; -## Creating new table ## -CREATE TABLE t1 -( -name varchar(30) -); -'#--------------------FN_DYNVARS_018_01-------------------------#' -## Setting initial value of variable to 1 ## -SET @@global.concurrent_insert = 1; -INSERT into t1(name) values('Record_1'); -INSERT into t1(name) values('Record_2'); -INSERT into t1(name) values('Record_3'); -## locking table ## -lock table t1 read local; -## Creating new connection to insert some rows in table ## -## New records should come at the end of all rows ## -INSERT into t1(name) values('Record_4'); -SELECT * from t1; -name -Record_1 -Record_2 -Record_3 -Record_4 -## unlocking tables ## -unlock tables; -## deleting record to create hole in table ## -DELETE from t1 where name ='Record_2'; -'#--------------------FN_DYNVARS_018_02-------------------------#' -'#--------------------FN_DYNVARS_018_03-------------------------#' -## lock table and connect with connection1 ## -lock table t1 read local; -## setting value of concurrent_insert to 2 ## -SET @@global.concurrent_insert=2; -## Inserting record in table, record should go at the end of the table ## -INSERT into t1(name) values('Record_5'); -SELECT * from t1; -name -Record_1 -Record_3 -Record_4 -Record_5 -SELECT @@concurrent_insert; -@@concurrent_insert -2 -## Switching to default connection ## -## Unlocking table ## -unlock tables; -SELECT * from t1; -name -Record_1 -Record_3 -Record_4 -Record_5 -## Inserting new row, this should go in the hole ## -INSERT into t1(name) values('Record_6'); -SELECT * from t1; -name -Record_1 -Record_6 -Record_3 -Record_4 -Record_5 -## connection test_con1 ## -DELETE from t1 where name ='Record_3'; -SELECT * from t1; -name -Record_1 -Record_6 -Record_4 -Record_5 -## Dropping table ## -DROP table t1; -## Disconnecting connection ## diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 8b87b7346e6..2901020ab45 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -1803,6 +1803,7 @@ t2 CREATE TABLE `t2` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; +DROP TABLE t1; # -- End of test case for Bug#21380. @@ -1890,5 +1891,7 @@ c1 c2 DROP TABLE t1; # -- End of Bug#34274 +create table `me:i`(id int); +drop table `me:i`; End of 5.1 tests diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result index 8bc6114dbc2..4b96f5a5ed0 100644 --- a/mysql-test/r/csv.result +++ b/mysql-test/r/csv.result @@ -5391,7 +5391,20 @@ drop table t1; create table t1 (a int not null) engine=csv; lock tables t1 read; select * from t1; -ERROR HY000: File './test/t1.CSV' not found (Errcode: 2) +ERROR HY000: File 'MYSQLD_DATADIR/test/t1.CSV' not found (Errcode: 2) unlock tables; drop table t1; +create table t1(a enum ('a') not null) engine=csv; +insert into t1 values (2); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select * from t1 limit 1; +ERROR HY000: Table 't1' is marked as crashed and should be repaired +repair table t1; +Table Op Msg_type Msg_text +test.t1 repair Warning Data truncated for column 'a' at row 1 +test.t1 repair status OK +select * from t1 limit 1; +a +drop table t1; End of 5.1 tests diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result index 2c8059a8afc..2efcf549608 100644 --- a/mysql-test/r/ctype_big5.result +++ b/mysql-test/r/ctype_big5.result @@ -268,8 +268,8 @@ create table t1 (a blob); insert into t1 values (0xEE00); select * into outfile 'test/t1.txt' from t1; delete from t1; -select hex(load_file('MYSQLTEST_VARDIR/master-data/test/t1.txt'));; -hex(load_file('MYSQLTEST_VARDIR/master-data/test/t1.txt')) +select hex(load_file('MYSQLD_DATADIR/test/t1.txt'));; +hex(load_file('MYSQLD_DATADIR/test/t1.txt')) 5CEE5C300A load data infile 't1.txt' into table t1; select hex(a) from t1; diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index ec2182a3304..428629e7e9e 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -1157,4 +1157,57 @@ set names latin1; select hex(char(0x41 using ucs2)); hex(char(0x41 using ucs2)) 0041 +SET character_set_connection=ucs2; +SELECT CHARSET(DAYNAME(19700101)); +CHARSET(DAYNAME(19700101)) +ucs2 +SELECT CHARSET(MONTHNAME(19700101)); +CHARSET(MONTHNAME(19700101)) +ucs2 +SELECT LOWER(DAYNAME(19700101)); +LOWER(DAYNAME(19700101)) +thursday +SELECT LOWER(MONTHNAME(19700101)); +LOWER(MONTHNAME(19700101)) +january +SELECT UPPER(DAYNAME(19700101)); +UPPER(DAYNAME(19700101)) +THURSDAY +SELECT UPPER(MONTHNAME(19700101)); +UPPER(MONTHNAME(19700101)) +JANUARY +SELECT HEX(MONTHNAME(19700101)); +HEX(MONTHNAME(19700101)) +004A0061006E0075006100720079 +SELECT HEX(DAYNAME(19700101)); +HEX(DAYNAME(19700101)) +00540068007500720073006400610079 +SET LC_TIME_NAMES=ru_RU; +SET NAMES utf8; +SET character_set_connection=ucs2; +SELECT CHARSET(DAYNAME(19700101)); +CHARSET(DAYNAME(19700101)) +ucs2 +SELECT CHARSET(MONTHNAME(19700101)); +CHARSET(MONTHNAME(19700101)) +ucs2 +SELECT LOWER(DAYNAME(19700101)); +LOWER(DAYNAME(19700101)) +четверг +SELECT LOWER(MONTHNAME(19700101)); +LOWER(MONTHNAME(19700101)) +ÑÐ½Ð²Ð°Ñ€Ñ +SELECT UPPER(DAYNAME(19700101)); +UPPER(DAYNAME(19700101)) +ЧЕТВЕРГ +SELECT UPPER(MONTHNAME(19700101)); +UPPER(MONTHNAME(19700101)) +ЯÐÐ’ÐРЯ +SELECT HEX(MONTHNAME(19700101)); +HEX(MONTHNAME(19700101)) +042F043D043204300440044F +SELECT HEX(DAYNAME(19700101)); +HEX(DAYNAME(19700101)) +0427043504420432043504400433 +SET character_set_connection=latin1; End of 5.0 tests diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result index dfd8244ef77..99ae6d85fee 100644 --- a/mysql-test/r/date_formats.result +++ b/mysql-test/r/date_formats.result @@ -590,3 +590,13 @@ select str_to_date('04/30/2004 ', '%m/%d/%Y '); str_to_date('04/30/2004 ', '%m/%d/%Y ') 2004-04-30 "End of 4.1 tests" +SELECT DATE_FORMAT("0000-01-01",'%W %d %M %Y') as valid_date; +valid_date +Sunday 01 January 0000 +SELECT DATE_FORMAT("0000-02-28",'%W %d %M %Y') as valid_date; +valid_date +Tuesday 28 February 0000 +SELECT DATE_FORMAT("2009-01-01",'%W %d %M %Y') as valid_date; +valid_date +Thursday 01 January 2009 +"End of 5.0 tests" diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index 6a06a9661aa..f71bbd175e3 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -653,11 +653,11 @@ DROP TABLE IF EXISTS t2; CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20) default NULL); SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE -'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE'; -LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2; +'../../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE'; +LOAD DATA INFILE '../../tmp/data1.tmp' INTO TABLE t2; SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE -'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE'; -LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2; +'../../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE'; +LOAD DATA INFILE '../../tmp/data2.tmp' INTO TABLE t2; SELECT @v19, @v20; @v19 @v20 2 APPLE diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result index cd6877b2967..b798b49dd34 100644 --- a/mysql-test/r/drop.result +++ b/mysql-test/r/drop.result @@ -47,6 +47,7 @@ create database mysqltest; show databases; Database information_schema +mtr mysql mysqltest test @@ -58,6 +59,7 @@ drop database mysqltest; show databases; Database information_schema +mtr mysql test drop database mysqltest; diff --git a/mysql-test/r/error_simulation.result b/mysql-test/r/error_simulation.result index 77599ba303b..6153dad2534 100644 --- a/mysql-test/r/error_simulation.result +++ b/mysql-test/r/error_simulation.result @@ -13,6 +13,7 @@ INSERT INTO t1 VALUES ('AAAAAAAAAH','AAAAAAAAAH'), ('AAAAAAAAAI','AAAAAAAAAI'), ('AAAAAAAAAJ','AAAAAAAAAJ'), ('AAAAAAAAAK','AAAAAAAAAK'); set tmp_table_size=1024; +set session debug="d,raise_error"; SELECT MAX(a) FROM t1 GROUP BY a,b; ERROR 23000: Can't write; duplicate key in table 'tmp_table' set tmp_table_size=default; diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result index c698531dfec..83030a00179 100644 --- a/mysql-test/r/events_bugs.result +++ b/mysql-test/r/events_bugs.result @@ -3,6 +3,8 @@ drop database if exists mysqltest_db1; drop database if exists mysqltest_db2; create database events_test; use events_test; +set @concurrent_insert= @@global.concurrent_insert; +set @@global.concurrent_insert = 0; select * from information_schema.global_variables where variable_name like 'event_scheduler'; VARIABLE_NAME VARIABLE_VALUE EVENT_SCHEDULER ON @@ -60,7 +62,7 @@ select get_lock('test_bug16407', 60); end| "Now if everything is fine the event has compiled and is locked" select /*1*/ user, host, db, info from information_schema.processlist -where info = 'select get_lock(\'test_bug16407\', 60)'; +where state = 'User lock' and info = 'select get_lock(\'test_bug16407\', 60)'; user host db info root localhost events_test select get_lock('test_bug16407', 60) select release_lock('test_bug16407'); @@ -84,7 +86,7 @@ get_lock('ee_16407_2', 60) set global event_scheduler= 1; "Another sql_mode test" set sql_mode="traditional"; -create table events_smode_test(ev_name char(10), a date) engine=myisam; +create table events_smode_test(ev_name char(10), a date); "This should never insert something" create event ee_16407_2 on schedule every 60 second do begin @@ -92,7 +94,7 @@ select get_lock('ee_16407_2', 60) /*ee_16407_2*/; select release_lock('ee_16407_2'); insert into events_test.events_smode_test values('ee_16407_2','1980-19-02'); end| -insert into events_smode_test values ('test','1980-19-02')| +insert into events_test.events_smode_test values ('test','1980-19-02')| ERROR 22007: Incorrect date value: '1980-19-02' for column 'a' at row 1 "This is ok" create event ee_16407_3 on schedule every 60 second do @@ -116,7 +118,7 @@ events_test ee_16407_2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ events_test ee_16407_3 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER events_test ee_16407_4 select /*2*/ user, host, db, info from information_schema.processlist -where info = 'select get_lock(\'ee_16407_2\', 60)'; +where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)'; user host db info root localhost events_test select get_lock('ee_16407_2', 60) root localhost events_test select get_lock('ee_16407_2', 60) @@ -125,10 +127,10 @@ select release_lock('ee_16407_2'); release_lock('ee_16407_2') 1 select /*3*/ user, host, db, info from information_schema.processlist -where info = 'select get_lock(\'ee_16407_2\', 60)'; +where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)'; user host db info set global event_scheduler= off; -select * from events_smode_test order by ev_name, a; +select * from events_test.events_smode_test order by ev_name, a; ev_name a ee_16407_3 1980-02-19 ee_16407_3 1980-02-29 @@ -143,7 +145,7 @@ drop event ee_16407_2; drop event ee_16407_3; drop event ee_16407_4; "And now one last test regarding sql_mode and call of SP from an event" -delete from events_smode_test; +delete from events_test.events_smode_test; set sql_mode='ansi'; select get_lock('ee_16407_5', 60); get_lock('ee_16407_5', 60) @@ -166,10 +168,8 @@ call events_test.ee_16407_6_pendant(); end| "Should have 2 locked processes" select /*4*/ user, host, db, info from information_schema.processlist -where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') -order by info; +where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)'; user host db info -event_scheduler localhost NULL NULL root localhost events_test select get_lock('ee_16407_5', 60) root localhost events_test select get_lock('ee_16407_5', 60) select release_lock('ee_16407_5'); @@ -177,11 +177,9 @@ release_lock('ee_16407_5') 1 "Should have 0 processes locked" select /*5*/ user, host, db, info from information_schema.processlist -where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') -order by info; +where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)'; user host db info -event_scheduler localhost NULL NULL -select * from events_smode_test order by ev_name, a; +select * from events_test.events_smode_test order by ev_name, a; ev_name a ee_16407_6 2004-02-29 "And here we check one more time before we drop the events" @@ -739,4 +737,5 @@ select name from mysql.event where name = 'p' and sql_mode = @full_mode; name drop event e1; DROP DATABASE events_test; -SET GLOBAL event_scheduler = 'ON'; +SET GLOBAL event_scheduler= 'ON'; +SET @@global.concurrent_insert= @concurrent_insert; diff --git a/mysql-test/r/events_restart_phase2.result b/mysql-test/r/events_restart.result index 60ddf06bf23..4db61d357ce 100644 --- a/mysql-test/r/events_restart_phase2.result +++ b/mysql-test/r/events_restart.result @@ -1,3 +1,19 @@ +set global event_scheduler=off; +drop database if exists events_test; +create database events_test; +use events_test; +create table execution_log(name char(10)); +create event abc1 on schedule every 1 second do +insert into execution_log value('abc1'); +create event abc2 on schedule every 1 second do +insert into execution_log value('abc2'); +create event abc3 on schedule every 1 second do +insert into execution_log value('abc3'); +create table event_like like mysql.event; +insert into event_like select * from mysql.event; +alter table mysql.event +change column body body longtext character set utf8 collate utf8_bin; +"Now we restart the server" use events_test; select @@event_scheduler; @@event_scheduler @@ -40,3 +56,9 @@ Restore the original mysql.event table drop table mysql.event; rename table event_like to mysql.event; Now let's restart the server again +use events_test; +select @@event_scheduler; +@@event_scheduler +ON +drop table execution_log; +drop database events_test; diff --git a/mysql-test/r/events_restart_phase1.result b/mysql-test/r/events_restart_phase1.result deleted file mode 100644 index 7b1de62f2ef..00000000000 --- a/mysql-test/r/events_restart_phase1.result +++ /dev/null @@ -1,16 +0,0 @@ -set global event_scheduler=off; -drop database if exists events_test; -create database events_test; -use events_test; -create table execution_log(name char(10)); -create event abc1 on schedule every 1 second do -insert into execution_log value('abc1'); -create event abc2 on schedule every 1 second do -insert into execution_log value('abc2'); -create event abc3 on schedule every 1 second do -insert into execution_log value('abc3'); -create table event_like like mysql.event; -insert into event_like select * from mysql.event; -alter table mysql.event -change column body body longtext character set utf8 collate utf8_bin; -"Now we restart the server" diff --git a/mysql-test/r/events_restart_phase3.result b/mysql-test/r/events_restart_phase3.result deleted file mode 100644 index abed0a2babc..00000000000 --- a/mysql-test/r/events_restart_phase3.result +++ /dev/null @@ -1,6 +0,0 @@ -use events_test; -select @@event_scheduler; -@@event_scheduler -ON -drop table execution_log; -drop database events_test; diff --git a/mysql-test/r/events_scheduling.result b/mysql-test/r/events_scheduling.result index 63140bffaa4..7dfd10a53f8 100644 --- a/mysql-test/r/events_scheduling.result +++ b/mysql-test/r/events_scheduling.result @@ -62,18 +62,6 @@ CREATE EVENT event_4 ON SCHEDULE EVERY 1 SECOND ENDS NOW() + INTERVAL 1 SECOND ON COMPLETION PRESERVE DO INSERT INTO table_4 VALUES (1); -SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1; -IF(SUM(a) >= 4, 'OK', 'ERROR') -OK -SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_2; -IF(SUM(a) >= 4, 'OK', 'ERROR') -OK -SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_3; -IF(SUM(a) >= 1, 'OK', 'ERROR') -OK -SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_4; -IF(SUM(a) >= 1, 'OK', 'ERROR') -OK SELECT IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='event_2'; diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index 598e8c53953..6e2770ef940 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -530,3 +530,12 @@ select 1 from t1 where match(a) against ('water' in boolean mode) and b>='2008-0 drop table t1; show warnings; Level Code Message +CREATE TABLE t1(a CHAR(10)); +INSERT INTO t1 VALUES('aaa15'); +SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE) FROM t1; +MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE) +1 +SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) FROM t1; +MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) +2 +DROP TABLE t1; diff --git a/mysql-test/r/fulltext_plugin.result b/mysql-test/r/fulltext_plugin.result new file mode 100644 index 00000000000..69ebbe07e9e --- /dev/null +++ b/mysql-test/r/fulltext_plugin.result @@ -0,0 +1,5 @@ +INSTALL PLUGIN simple_parser SONAME 'mypluglib.so'; +CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a) WITH PARSER simple_parser); +ALTER TABLE t1 ADD FULLTEXT(b) WITH PARSER simple_parser; +DROP TABLE t1; +UNINSTALL PLUGIN simple_parser; diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result index 62d34c5ce8f..955a784f04c 100644 --- a/mysql-test/r/func_if.result +++ b/mysql-test/r/func_if.result @@ -176,4 +176,13 @@ IF((ROUND(t1.a,2)=1), 2, IF((ROUND(t1.a,2)=1), 2, IF((R DROP TABLE t1; +CREATE TABLE t1 (c LONGTEXT); +INSERT INTO t1 VALUES(1), (2), (3), (4), ('12345678901234567890'); +SELECT * FROM (SELECT MAX(IF(1, CAST(c AS UNSIGNED), 0)) FROM t1) AS te; +MAX(IF(1, CAST(c AS UNSIGNED), 0)) +12345678901234567890 +SELECT * FROM (SELECT MAX(IFNULL(CAST(c AS UNSIGNED), 0)) FROM t1) AS te; +MAX(IFNULL(CAST(c AS UNSIGNED), 0)) +12345678901234567890 +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index e761fb851fb..1e967b668c5 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -575,4 +575,16 @@ id select * from t1 where NOT id in (null, 1); id drop table t1; +CREATE TABLE t1(c0 INTEGER, c1 INTEGER, c2 INTEGER); +INSERT INTO t1 VALUES(1, 1, 1), (1, 1, 1); +SELECT CASE AVG (c0) WHEN c1 * c2 THEN 1 END FROM t1; +CASE AVG (c0) WHEN c1 * c2 THEN 1 END +1 +SELECT CASE c1 * c2 WHEN SUM(c0) THEN 1 WHEN AVG(c0) THEN 2 END FROM t1; +CASE c1 * c2 WHEN SUM(c0) THEN 1 WHEN AVG(c0) THEN 2 END +2 +SELECT CASE c1 WHEN c1 + 1 THEN 1 END, ABS(AVG(c0)) FROM t1; +CASE c1 WHEN c1 + 1 THEN 1 END ABS(AVG(c0)) +NULL 1.0000 +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 78748a4622f..0824f13cafc 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -717,8 +717,6 @@ insert(_latin2'abcd',2,3,_latin2'ef'), replace(_latin2'abcd',_latin2'b',_latin2'B'), encode('abcd','ab') ; -Warnings: -Warning 1265 Data truncated for column 'format(130,10)' at row 1 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -727,7 +725,7 @@ t1 CREATE TABLE `t1` ( `conv(130,16,10)` varchar(64) DEFAULT NULL, `hex(130)` varchar(6) NOT NULL DEFAULT '', `char(130)` varbinary(4) NOT NULL DEFAULT '', - `format(130,10)` varchar(4) NOT NULL DEFAULT '', + `format(130,10)` varchar(37) NOT NULL DEFAULT '', `left(_latin2'a',1)` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '', `right(_latin2'a',1)` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '', `lcase(_latin2'a')` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '', @@ -2513,4 +2511,12 @@ SELECT HEX(c1) from v1; HEX(c1) 414243 DROP VIEW v1; +create table t1(a float); +insert into t1 values (1.33); +select format(a, 2) from t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def format(a, 2) 253 49 4 Y 0 31 8 +format(a, 2) +1.33 +drop table t1; End of 5.0 tests diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index cc0fb88b791..0fa143d95bc 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -592,6 +592,21 @@ unix_timestamp('1970-01-01 03:00:01') select unix_timestamp('2038-01-19 07:14:07'); unix_timestamp('2038-01-19 07:14:07') 0 +SELECT CHARSET(DAYNAME(19700101)); +CHARSET(DAYNAME(19700101)) +latin1 +SELECT CHARSET(MONTHNAME(19700101)); +CHARSET(MONTHNAME(19700101)) +latin1 +SELECT LOWER(DAYNAME(19700101)); +LOWER(DAYNAME(19700101)) +thursday +SELECT LOWER(MONTHNAME(19700101)); +LOWER(MONTHNAME(19700101)) +january +SELECT COERCIBILITY(MONTHNAME('1970-01-01')),COERCIBILITY(DAYNAME('1970-01-01')); +COERCIBILITY(MONTHNAME('1970-01-01')) COERCIBILITY(DAYNAME('1970-01-01')) +4 4 CREATE TABLE t1 (datetime datetime, timestamp timestamp, date date, time time); INSERT INTO t1 values ("2001-01-02 03:04:05", "2002-01-02 03:04:05", "2003-01-02", "06:07:08"); SELECT * from t1; @@ -1078,6 +1093,7 @@ Note 1003 select timestampdiff(WEEK,'2001-02-01','2001-05-01') AS `a1`,timestamp select time_format('100:00:00', '%H %k %h %I %l'); time_format('100:00:00', '%H %k %h %I %l') 100 100 04 04 4 +SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; create table t1 (a timestamp default '2005-05-05 01:01:01', b timestamp default '2005-05-05 01:01:01'); @@ -1121,6 +1137,7 @@ call t_sysdate(); @a != @b 1 drop procedure t_sysdate; +SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; select timestampdiff(month,'2004-09-11','2004-09-11'); timestampdiff(month,'2004-09-11','2004-09-11') 0 diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index d91e21e9399..fdcde4e8739 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -685,7 +685,7 @@ asbinary(g) drop table t1; create table t1 (a TEXT, b GEOMETRY NOT NULL, SPATIAL KEY(b)); alter table t1 disable keys; -load data infile '../std_data_ln/bad_gis_data.dat' into table t1; +load data infile '../../std_data/bad_gis_data.dat' into table t1; ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'b' at row 1 alter table t1 enable keys; drop table t1; diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 16be3eb966d..18f11ebcc71 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -1,3 +1,4 @@ +SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; drop table if exists t1; drop database if exists mysqltest; @@ -1246,6 +1247,11 @@ drop user 'greg'@'localhost'; drop view v1; drop table test; drop function test_function; +SELECT CURRENT_USER(); +CURRENT_USER() +root@localhost +SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin"); +SET PASSWORD FOR CURRENT_USER() = PASSWORD(""); End of 5.0 tests set names utf8; grant select on test.* to юзер_юзер@localhost; @@ -1351,4 +1357,4 @@ DROP PROCEDURE sp3; DROP USER 'userbug33464'@'localhost'; use test; DROP DATABASE dbbug33464; -End of 5.1 tests +SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result index 03c4ea042f6..0c3bd2f48aa 100644 --- a/mysql-test/r/grant2.result +++ b/mysql-test/r/grant2.result @@ -365,6 +365,7 @@ insert into mysql.user select * from t1; drop table t1, t2; drop database TESTDB; flush privileges; +SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; grant all privileges on test.* to `a@`@localhost; grant execute on * to `a@`@localhost; @@ -380,7 +381,7 @@ drop function f2; drop table t2; REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost; drop user `a@`@localhost; -SET GLOBAL log_bin_trust_function_creators = 0; +SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; drop database if exists mysqltest_1; drop database if exists mysqltest_2; drop user mysqltest_u1@localhost; diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 12e1460e128..48f97aeb428 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -1654,6 +1654,7 @@ NULL 1 2 DROP TABLE t1; +DROP TABLE t2; CREATE TABLE t1 ( a INT, b INT ); SELECT b c, (SELECT a FROM t1 WHERE b = c) FROM t1; diff --git a/mysql-test/r/have_bug25714.require b/mysql-test/r/have_bug25714.require deleted file mode 100644 index 5acc378dcf7..00000000000 --- a/mysql-test/r/have_bug25714.require +++ /dev/null @@ -1,2 +0,0 @@ -have_bug25714_exe -1 diff --git a/mysql-test/r/have_simple_parser.require b/mysql-test/r/have_simple_parser.require new file mode 100644 index 00000000000..0e023bd6983 --- /dev/null +++ b/mysql-test/r/have_simple_parser.require @@ -0,0 +1,2 @@ +have_simple_parser +1 diff --git a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result index 45d335bba9e..19826aca43a 100644 --- a/mysql-test/r/index_merge_myisam.result +++ b/mysql-test/r/index_merge_myisam.result @@ -529,6 +529,34 @@ b a y z DROP TABLE t1; +# +# BUG#40974: Incorrect query results when using clause evaluated using range check +# +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (a int); +insert into t1 values (1),(2); +create table t2(a int, b int); +insert into t2 values (1,1), (2, 1000); +create table t3 (a int, b int, filler char(100), key(a), key(b)); +insert into t3 select 1000, 1000,'filler' from t0 A, t0 B, t0 C; +insert into t3 values (1,1,'data'); +insert into t3 values (1,1,'data'); +The plan should be ALL/ALL/ALL(Range checked for each record (index map: 0x3) +explain select * from t1 +where exists (select 1 from t2, t3 +where t2.a=t1.a and (t3.a=t2.b or t3.b=t2.b or t3.b=t2.b+1)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t3 ALL a,b NULL NULL NULL 1002 Range checked for each record (index map: 0x3) +select * from t1 +where exists (select 1 from t2, t3 +where t2.a=t1.a and (t3.a=t2.b or t3.b=t2.b or t3.b=t2.b+1)); +a +1 +2 +drop table t0, t1, t2, t3; End of 5.0 tests #---------------- ROR-index_merge tests ----------------------- SET SESSION STORAGE_ENGINE = MyISAM; diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 85af461eb14..6320b6d7ad3 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -9,11 +9,13 @@ create user mysqltest_3@localhost; create user mysqltest_3; select * from information_schema.SCHEMATA where schema_name > 'm'; CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH +NULL mtr latin1 latin1_swedish_ci NULL NULL mysql latin1 latin1_swedish_ci NULL NULL test latin1 latin1_swedish_ci NULL select schema_name from information_schema.schemata; schema_name information_schema +mtr mysql test show databases like 't%'; @@ -22,6 +24,7 @@ test show databases; Database information_schema +mtr mysql test show databases where `database` = 't%'; @@ -33,7 +36,11 @@ create table t3(a int, KEY a_data (a)); create table mysqltest.t4(a int); create table t5 (id int auto_increment primary key); insert into t5 values (10); -create view v1 (c) as select table_name from information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status'; +create view v1 (c) as +SELECT table_name FROM information_schema.TABLES +WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND +table_name<>'ndb_binlog_index' AND +table_name<>'ndb_apply_status'; select * from v1; c CHARACTER_SETS @@ -269,19 +276,19 @@ select * from t1; select * from t2; end| select parameter_style, sql_data_access, dtd_identifier -from information_schema.routines; +from information_schema.routines where routine_schema='test'; parameter_style sql_data_access dtd_identifier SQL CONTAINS SQL NULL SQL CONTAINS SQL int(11) -show procedure status; +show procedure status where db='test'; Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation test sel2 PROCEDURE root@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci -show function status; +show function status where db='test'; Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation test sub1 FUNCTION root@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci select a.ROUTINE_NAME from information_schema.ROUTINES a, information_schema.SCHEMATA b where -a.ROUTINE_SCHEMA = b.SCHEMA_NAME; +a.ROUTINE_SCHEMA = b.SCHEMA_NAME AND b.SCHEMA_NAME='test'; ROUTINE_NAME sel2 sub1 @@ -292,14 +299,14 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE # ALL NULL NULL NULL NULL NULL 1 SIMPLE # ALL NULL NULL NULL NULL NULL Using where; Using join buffer select a.ROUTINE_NAME, b.name from information_schema.ROUTINES a, -mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) order by 1; +mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) AND a.ROUTINE_SCHEMA='test' order by 1; ROUTINE_NAME name sel2 sel2 sub1 sub1 -select count(*) from information_schema.ROUTINES; +select count(*) from information_schema.ROUTINES where routine_schema='test'; count(*) 2 -create view v1 as select routine_schema, routine_name from information_schema.routines +create view v1 as select routine_schema, routine_name from information_schema.routines where routine_schema='test' order by routine_schema, routine_name; select * from v1; routine_schema routine_name @@ -351,6 +358,7 @@ create view v0 (c) as select schema_name from information_schema.schemata; select * from v0; c information_schema +mtr mysql test explain select * from v0; @@ -842,7 +850,7 @@ VIEWS TABLE_NAME select delete from mysql.user where user='mysqltest_4'; delete from mysql.db where user='mysqltest_4'; flush privileges; -SELECT table_schema, count(*) FROM information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA; +SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA; table_schema count(*) information_schema 28 mysql 22 @@ -882,7 +890,7 @@ if new.j = -1 then set @fired:= "Yes"; end if; end AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci -select * from information_schema.triggers; +select * from information_schema.triggers where trigger_schema in ('mysql', 'information_schema', 'test', 'mysqltest'); TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION NULL test trg1 INSERT NULL test t1 0 NULL begin if new.j > 10 then @@ -1071,7 +1079,7 @@ BEGIN SELECT 'foo' FROM DUAL; END | ERROR 42000: Unknown database 'information_schema' -select ROUTINE_NAME from routines; +select ROUTINE_NAME from routines where ROUTINE_SCHEMA='information_schema'; ROUTINE_NAME grant all on information_schema.* to 'user1'@'localhost'; ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' @@ -1153,7 +1161,7 @@ use mysql; INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL', 'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03', '2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a'); -select routine_name from information_schema.routines; +select routine_name from information_schema.routines where ROUTINE_SCHEMA='test'; routine_name delete from proc where name=''; @@ -1187,7 +1195,7 @@ CREATE FUNCTION f1() RETURNS INT RETURN @a + 1; CREATE USER mysql_bug20230@localhost; GRANT EXECUTE ON PROCEDURE p1 TO mysql_bug20230@localhost; GRANT EXECUTE ON FUNCTION f1 TO mysql_bug20230@localhost; -SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES; +SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='test'; ROUTINE_NAME ROUTINE_DEFINITION f1 RETURN @a + 1 p1 SET @a= 1 @@ -1199,7 +1207,7 @@ SHOW CREATE FUNCTION f1; Function sql_mode Create Function character_set_client collation_connection Database Collation f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) RETURN @a + 1 latin1 latin1_swedish_ci latin1_swedish_ci -SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES; +SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='test'; ROUTINE_NAME ROUTINE_DEFINITION f1 NULL p1 NULL @@ -1302,12 +1310,12 @@ TABLE_PRIVILEGES TABLE_SCHEMA TRIGGERS TRIGGER_SCHEMA USER_PRIVILEGES GRANTEE VIEWS TABLE_SCHEMA -SELECT MAX(table_name) FROM information_schema.tables; +SELECT MAX(table_name) FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test'); MAX(table_name) VIEWS SELECT table_name from information_schema.tables WHERE table_name=(SELECT MAX(table_name) -FROM information_schema.tables); +FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test')); table_name VIEWS DROP TABLE IF EXISTS bug23037; @@ -1707,4 +1715,9 @@ where a.VARIABLE_NAME = b.VARIABLE_NAME; a.VARIABLE_VALUE - b.VARIABLE_VALUE 2 drop table t0; +CREATE TABLE t1(a INT) KEY_BLOCK_SIZE=1; +SELECT CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; +CREATE_OPTIONS +key_block_size=1 +DROP TABLE t1; End of 5.1 tests. diff --git a/mysql-test/r/innodb-autoinc-optimize.result b/mysql-test/r/innodb-autoinc-optimize.result index 2896411a42f..c6da43555b2 100644 --- a/mysql-test/r/innodb-autoinc-optimize.result +++ b/mysql-test/r/innodb-autoinc-optimize.result @@ -5,3 +5,5 @@ optimize table t1; Table Op Msg_type Msg_text test.t1 optimize note Table does not support optimize, doing recreate + analyze instead test.t1 optimize status OK +==== clean up ==== +DROP TABLE t1; diff --git a/mysql-test/r/innodb-autoinc.result b/mysql-test/r/innodb-autoinc.result index e000f910772..1e4b088c6cd 100644 --- a/mysql-test/r/innodb-autoinc.result +++ b/mysql-test/r/innodb-autoinc.result @@ -169,3 +169,413 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 DROP TABLE t1; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL, 1); +DELETE FROM t1 WHERE c1 = 1; +INSERT INTO t1 VALUES (2,1); +INSERT INTO t1 VALUES (NULL,8); +SELECT * FROM t1; +c1 c2 +2 1 +3 8 +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL, 1); +DELETE FROM t1 WHERE c1 = 1; +INSERT INTO t1 VALUES (2,1), (NULL, 8); +INSERT INTO t1 VALUES (NULL,9); +SELECT * FROM t1; +c1 c2 +2 1 +3 8 +5 9 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 100 +auto_increment_offset 10 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL),(5),(NULL); +INSERT INTO t1 VALUES (250),(NULL); +SELECT * FROM t1; +c1 +5 +10 +110 +250 +310 +INSERT INTO t1 VALUES (1000); +SET @@INSERT_ID=400; +INSERT INTO t1 VALUES(NULL),(NULL); +SELECT * FROM t1; +c1 +5 +10 +110 +250 +310 +400 +410 +1000 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(0); +SELECT * FROM t1; +c1 +1 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +INSERT INTO t1 VALUES (-1), (NULL),(2),(NULL); +INSERT INTO t1 VALUES (250),(NULL); +SELECT * FROM t1; +c1 +-1 +1 +2 +10 +110 +250 +410 +SET @@INSERT_ID=400; +INSERT INTO t1 VALUES(NULL),(NULL); +Got one of the listed errors +SELECT * FROM t1; +c1 +-1 +1 +2 +10 +110 +250 +410 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(-1); +SELECT * FROM t1; +c1 +-1 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 100 +auto_increment_offset 10 +INSERT INTO t1 VALUES (-2), (NULL),(2),(NULL); +INSERT INTO t1 VALUES (250),(NULL); +SELECT * FROM t1; +c1 +-2 +-1 +1 +2 +10 +250 +310 +INSERT INTO t1 VALUES (1000); +SET @@INSERT_ID=400; +INSERT INTO t1 VALUES(NULL),(NULL); +SELECT * FROM t1; +c1 +-2 +-1 +1 +2 +10 +250 +310 +400 +410 +1000 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(-1); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +SELECT * FROM t1; +c1 +1 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 100 +auto_increment_offset 10 +INSERT INTO t1 VALUES (-2); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (250); +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1; +c1 +1 +2 +10 +110 +210 +250 +310 +INSERT INTO t1 VALUES (1000); +SET @@INSERT_ID=400; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +c1 +1 +2 +10 +110 +210 +250 +310 +400 +1000 +1010 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(-1); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +SELECT * FROM t1; +c1 +1 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 100 +auto_increment_offset 10 +INSERT INTO t1 VALUES (-2),(NULL),(2),(NULL); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +INSERT INTO t1 VALUES (250),(NULL); +SELECT * FROM t1; +c1 +1 +2 +10 +110 +210 +250 +410 +INSERT INTO t1 VALUES (1000); +SET @@INSERT_ID=400; +INSERT INTO t1 VALUES(NULL),(NULL); +Got one of the listed errors +SELECT * FROM t1; +c1 +1 +2 +10 +110 +210 +250 +410 +1000 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES (9223372036854775794); +SELECT * FROM t1; +c1 +1 +9223372036854775794 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 10 +INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); +SELECT * FROM t1; +c1 +1 +9223372036854775794 +9223372036854775796 +9223372036854775798 +9223372036854775800 +9223372036854775802 +9223372036854775804 +9223372036854775806 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES (18446744073709551603); +SELECT * FROM t1; +c1 +1 +18446744073709551603 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 10 +INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); +SELECT * FROM t1; +c1 +1 +18446744073709551603 +18446744073709551604 +18446744073709551606 +18446744073709551608 +18446744073709551610 +18446744073709551612 +18446744073709551614 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES (18446744073709551603); +SELECT * FROM t1; +c1 +1 +18446744073709551603 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 5 +auto_increment_offset 7 +INSERT INTO t1 VALUES (NULL),(NULL); +SELECT * FROM t1; +c1 +1 +18446744073709551603 +18446744073709551607 +18446744073709551612 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES(-9223372036854775806); +INSERT INTO t1 VALUES(-9223372036854775807); +INSERT INTO t1 VALUES(-9223372036854775808); +SELECT * FROM t1; +c1 +-9223372036854775808 +-9223372036854775807 +-9223372036854775806 +1 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=3, @@SESSION.AUTO_INCREMENT_OFFSET=3; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 3 +auto_increment_offset 3 +INSERT INTO t1 VALUES (NULL),(NULL), (NULL); +SELECT * FROM t1; +c1 +-9223372036854775808 +-9223372036854775807 +-9223372036854775806 +1 +3 +6 +9 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES (18446744073709551610); +SELECT * FROM t1; +c1 +1 +18446744073709551610 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976; +Warnings: +Warning 1292 Truncated incorrect auto_increment_increment value: '1152921504606846976' +Warning 1292 Truncated incorrect auto_increment_offset value: '1152921504606846976' +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 65535 +auto_increment_offset 65535 +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1; +c1 +1 +18446744073709551610 +18446744073709551615 +DROP TABLE t1; diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index d4e3243733a..1f46ade27e0 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1781,6 +1781,7 @@ set global innodb_sync_spin_loops=20; show variables like "innodb_sync_spin_loops"; Variable_name Value innodb_sync_spin_loops 20 +SET @old_innodb_thread_concurrency= @@global.innodb_thread_concurrency; show variables like "innodb_thread_concurrency"; Variable_name Value innodb_thread_concurrency 8 @@ -1798,6 +1799,7 @@ set global innodb_thread_concurrency=16; show variables like "innodb_thread_concurrency"; Variable_name Value innodb_thread_concurrency 16 +SET @@global.innodb_thread_concurrency= @old_innodb_thread_concurrency; show variables like "innodb_concurrency_tickets"; Variable_name Value innodb_concurrency_tickets 500 @@ -3295,3 +3297,11 @@ info: Records: 5 Duplicates: 0 Warnings: 0 TRUNCATE TABLE t1; affected rows: 0 DROP TABLE t1; +Variable_name Value +Handler_update 0 +Variable_name Value +Handler_delete 0 +Variable_name Value +Handler_update 1 +Variable_name Value +Handler_delete 1 diff --git a/mysql-test/suite/rpl/r/rpl_innodb_bug30919.result b/mysql-test/r/innodb_bug30919.result index 42aa4ff302b..42aa4ff302b 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_bug30919.result +++ b/mysql-test/r/innodb_bug30919.result diff --git a/mysql-test/r/innodb_bug38231.result b/mysql-test/r/innodb_bug38231.result new file mode 100644 index 00000000000..2f909779755 --- /dev/null +++ b/mysql-test/r/innodb_bug38231.result @@ -0,0 +1,11 @@ +SET storage_engine=InnoDB; +INSERT INTO bug38231 VALUES (1), (10), (300); +SET autocommit=0; +SELECT * FROM bug38231 FOR UPDATE; +a +1 +10 +300 +TRUNCATE TABLE bug38231; +COMMIT; +DROP TABLE bug38231; diff --git a/mysql-test/r/innodb_bug39438.result b/mysql-test/r/innodb_bug39438.result new file mode 100644 index 00000000000..195775f74c8 --- /dev/null +++ b/mysql-test/r/innodb_bug39438.result @@ -0,0 +1 @@ +SET storage_engine=InnoDB; diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index aeacd054511..6fcc9415d12 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -1683,3 +1683,167 @@ CREATE INDEX i1 on t1 (a(3)); SELECT * FROM t1 WHERE a = 'abcde'; a DROP TABLE t1; +CREATE TABLE foo (a int, b int, c char(10), +PRIMARY KEY (c(3)), +KEY b (b) +) engine=innodb; +CREATE TABLE foo2 (a int, b int, c char(10), +PRIMARY KEY (c), +KEY b (b) +) engine=innodb; +CREATE TABLE bar (a int, b int, c char(10), +PRIMARY KEY (c(3)), +KEY b (b) +) engine=myisam; +INSERT INTO foo VALUES +(1,2,'abcdefghij'), (2,3,''), (3,4,'klmnopqrst'), +(4,5,'uvwxyz'), (5,6,'meotnsyglt'), (4,5,'asfdewe'); +INSERT INTO bar SELECT * FROM foo; +INSERT INTO foo2 SELECT * FROM foo; +EXPLAIN SELECT c FROM bar WHERE b>2;; +id 1 +select_type SIMPLE +table bar +type ALL +possible_keys b +key NULL +key_len NULL +ref NULL +rows 6 +Extra Using where +EXPLAIN SELECT c FROM foo WHERE b>2;; +id 1 +select_type SIMPLE +table foo +type ALL +possible_keys b +key NULL +key_len NULL +ref NULL +rows 6 +Extra Using where +EXPLAIN SELECT c FROM foo2 WHERE b>2;; +id 1 +select_type SIMPLE +table foo2 +type range +possible_keys b +key b +key_len 5 +ref NULL +rows 3 +Extra Using where; Using index +EXPLAIN SELECT c FROM bar WHERE c>2;; +id 1 +select_type SIMPLE +table bar +type ALL +possible_keys PRIMARY +key NULL +key_len NULL +ref NULL +rows 6 +Extra Using where +EXPLAIN SELECT c FROM foo WHERE c>2;; +id 1 +select_type SIMPLE +table foo +type ALL +possible_keys PRIMARY +key NULL +key_len NULL +ref NULL +rows 6 +Extra Using where +EXPLAIN SELECT c FROM foo2 WHERE c>2;; +id 1 +select_type SIMPLE +table foo2 +type index +possible_keys PRIMARY +key b +key_len 5 +ref NULL +rows 6 +Extra Using where; Using index +DROP TABLE foo, bar, foo2; +DROP TABLE IF EXISTS t1,t3,t2; +DROP FUNCTION IF EXISTS f1; +CREATE FUNCTION f1() RETURNS VARCHAR(250) +BEGIN +return 'hhhhhhh' ; +END| +CREATE TABLE t1 (a VARCHAR(20), b VARCHAR(20), c VARCHAR(20)) ENGINE=INNODB; +BEGIN WORK; +CREATE TEMPORARY TABLE t2 (a VARCHAR(20), b VARCHAR(20), c varchar(20)) ENGINE=INNODB; +CREATE TEMPORARY TABLE t3 LIKE t2; +INSERT INTO t1 VALUES ('a','b',NULL),('c','d',NULL),('e','f',NULL); +SET @stmt := CONCAT('INSERT INTO t2 SELECT tbl.a, tbl.b, f1()',' FROM t1 tbl'); +PREPARE stmt1 FROM @stmt; +SET @stmt := CONCAT('INSERT INTO t3', ' SELECT * FROM t2'); +PREPARE stmt3 FROM @stmt; +EXECUTE stmt1; +COMMIT; +DEALLOCATE PREPARE stmt1; +DEALLOCATE PREPARE stmt3; +DROP TABLE t1,t3,t2; +DROP FUNCTION f1; +DROP TABLE IF EXISTS t1,t2; +CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; +CREATE TABLE t2 (id INT PRIMARY KEY, +t1_id INT, INDEX par_ind (t1_id), +FOREIGN KEY (t1_id) REFERENCES t1(id)) ENGINE=INNODB; +INSERT INTO t1 VALUES (1),(2); +INSERT INTO t2 VALUES (3,2); +SET AUTOCOMMIT = 0; +START TRANSACTION; +TRUNCATE TABLE t1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`)) +SELECT * FROM t1; +id +1 +2 +COMMIT; +SELECT * FROM t1; +id +1 +2 +START TRANSACTION; +TRUNCATE TABLE t1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`)) +SELECT * FROM t1; +id +1 +2 +ROLLBACK; +SELECT * FROM t1; +id +1 +2 +SET AUTOCOMMIT = 1; +START TRANSACTION; +SELECT * FROM t1; +id +1 +2 +COMMIT; +TRUNCATE TABLE t1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`)) +SELECT * FROM t1; +id +1 +2 +DELETE FROM t2 WHERE id = 3; +START TRANSACTION; +SELECT * FROM t1; +id +1 +2 +TRUNCATE TABLE t1; +ROLLBACK; +SELECT * FROM t1; +id +TRUNCATE TABLE t2; +DROP TABLE t2; +DROP TABLE t1; +End of 5.1 tests diff --git a/mysql-test/r/innodb_mysql_rbk.result b/mysql-test/r/innodb_mysql_rbk.result new file mode 100644 index 00000000000..21ac4295325 --- /dev/null +++ b/mysql-test/r/innodb_mysql_rbk.result @@ -0,0 +1,21 @@ +CREATE TABLE t1(a INT, b INT NOT NULL, PRIMARY KEY (a)) ENGINE=innodb +DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7); +START TRANSACTION; +SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE; +a b +3 3 +START TRANSACTION; +UPDATE t1 SET b=b+12 WHERE a > 2 ORDER BY a; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ROLLBACK; +START TRANSACTION; +SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE; +a b +3 3 +START TRANSACTION; +UPDATE t1 SET b=10 WHERE a > 1 ORDER BY a; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE b = 10; +a b +DROP TABLE t1; diff --git a/mysql-test/r/innodb_notembedded.result b/mysql-test/r/innodb_notembedded.result index 36714eb62fb..af332aba38a 100644 --- a/mysql-test/r/innodb_notembedded.result +++ b/mysql-test/r/innodb_notembedded.result @@ -1,4 +1,5 @@ drop table if exists t1; +SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; create table t1 (col1 integer primary key, col2 integer) engine=innodb; insert t1 values (1,100); @@ -19,4 +20,4 @@ rollback; rollback; drop table t1; drop function f1; -SET GLOBAL log_bin_trust_function_creators = 0; +SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; diff --git a/mysql-test/r/insert_update.result b/mysql-test/r/insert_update.result index 704cf444681..a285810b78b 100644 --- a/mysql-test/r/insert_update.result +++ b/mysql-test/r/insert_update.result @@ -393,6 +393,7 @@ id c1 cnt 1 0 3 2 2 1 DROP TABLE t1; +DROP TABLE t2; create table t1(f1 int primary key, f2 timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP); insert into t1(f1) values(1); diff --git a/mysql-test/r/key_buffer_size_func.result b/mysql-test/r/key_buffer_size_func.result deleted file mode 100644 index e2eff04f030..00000000000 --- a/mysql-test/r/key_buffer_size_func.result +++ /dev/null @@ -1,36 +0,0 @@ -drop table if exists t1; -## Creating new table t1 ## -CREATE TABLE t1 -( -id INT NOT NULL auto_increment, -PRIMARY KEY (id), -rollno int NOT NULL, -name VARCHAR(30) -); -FLUSH STATUS; -'#--------------------FN_DYNVARS_055_01-------------------------#' -## Setting initial value of variable to 131072 ## -SET @@global.key_buffer_size = 131072; -## Creating two new connections ## -'#--------------------FN_DYNVARS_055_02-------------------------#' -## Connecting with connection test_con1 ## -SELECT @@global.key_buffer_size; -@@global.key_buffer_size -131072 -## Inserting some rows in table ## -INSERT into t1(rollno, name) values(1, 'Record_1'); -INSERT into t1(rollno, name) values(2, 'Record_2'); -INSERT into t1(rollno, name) values(1, 'Record_3'); -INSERT into t1(rollno, name) values(3, 'Record_4'); -INSERT into t1(rollno, name) values(1, 'Record_5'); -INSERT into t1(rollno, name) values(3, 'Record_6'); -INSERT into t1(rollno, name) values(4, 'Record_7'); -INSERT into t1(rollno, name) values(4, 'Record_8'); -INSERT into t1(rollno, name) values(4, 'Record_9'); -INSERT into t1(rollno, name) values(4, 'Record_10'); -## Verifying status of reading & writing variables ## -## Switching to connection test_con2 ## -## Verifying status of reading & writing variables ## -## Dropping table ## -DROP table if exists t1; -## Disconnecting both the connections ## diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result index 4e458e831cf..1e488b320d7 100644 --- a/mysql-test/r/loaddata.result +++ b/mysql-test/r/loaddata.result @@ -1,6 +1,6 @@ drop table if exists t1, t2; create table t1 (a date, b date, c date not null, d date); -load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ','; +load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ','; Warnings: Warning 1265 Data truncated for column 'a' at row 1 Warning 1265 Data truncated for column 'c' at row 1 @@ -8,7 +8,7 @@ Warning 1265 Data truncated for column 'd' at row 1 Warning 1265 Data truncated for column 'a' at row 2 Warning 1265 Data truncated for column 'b' at row 2 Warning 1265 Data truncated for column 'd' at row 2 -load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES; +load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES; SELECT * from t1; a b c d 0000-00-00 NULL 0000-00-00 0000-00-00 @@ -16,7 +16,7 @@ a b c d 2003-03-03 2003-03-03 2003-03-03 NULL 2003-03-03 2003-03-03 2003-03-03 NULL truncate table t1; -load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d); +load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d); Warnings: Warning 1265 Data truncated for column 'c' at row 1 Warning 1265 Data truncated for column 'd' at row 1 @@ -29,7 +29,7 @@ NULL 0000-00-00 0000-00-00 0000-00-00 NULL 2003-03-03 2003-03-03 NULL drop table t1; create table t1 (a text, b text); -load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by ''''; +load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by ''''; Warnings: Warning 1261 Row 3 doesn't contain data for all columns select concat('|',a,'|'), concat('|',b,'|') from t1; @@ -41,7 +41,7 @@ Field 3,'Field 4| |Field 6| | 'Field 7'| drop table t1; create table t1 (a int, b char(10)); -load data infile '../std_data_ln/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines; +load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines; Warnings: Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3 Warning 1262 Row 3 was truncated; it contained more data than there were input columns @@ -55,7 +55,7 @@ a b 3 row 3 0 1234567890 truncate table t1; -load data infile '../std_data_ln/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines; +load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines; Warnings: Warning 1366 Incorrect integer value: ' ' for column 'a' at row 4 @@ -79,7 +79,7 @@ id SET @@SQL_MODE=@OLD_SQL_MODE; drop table t1; create table t1 (a varchar(20), b varchar(20)); -load data infile '../std_data_ln/loaddata_dq.dat' into table t1 fields terminated by ',' enclosed by '"' escaped by '"' (a,b); +load data infile '../../std_data/loaddata_dq.dat' into table t1 fields terminated by ',' enclosed by '"' escaped by '"' (a,b); select * from t1; a b field1 field2 @@ -141,25 +141,25 @@ SELECT t1.id, c1, c2 FROM t1 RIGHT JOIN t2 ON t1.id=t2.id WHERE c1 != c2; id c1 c2 DROP TABLE t1,t2; create table t1 (a int default 100, b int, c varchar(60)); -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10, c=concat("b=",@b); +load data infile '../../std_data/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10, c=concat("b=",@b); select * from t1; a b c NULL 20 b=10 NULL 25 b=15 truncate table t1; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set c= if(a is null,"oops",a); +load data infile '../../std_data/rpl_loaddata.dat' into table t1 (a, @b) set c= if(a is null,"oops",a); select * from t1; a b c NULL NULL oops NULL NULL oops truncate table t1; set @c:=123; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, b) set c= if(@a is null,@c,b); +load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, b) set c= if(@a is null,@c,b); select * from t1; a b c 100 10 123 100 15 123 -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, @b); +load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, @b); select * from t1; a b c 100 10 123 @@ -170,7 +170,7 @@ select @a, @b; @a @b NULL 15 truncate table t1; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 set c=b; +load data infile '../../std_data/rpl_loaddata.dat' into table t1 set c=b; Warnings: Warning 1261 Row 1 doesn't contain data for all columns Warning 1261 Row 2 doesn't contain data for all columns @@ -179,25 +179,25 @@ a b c NULL 10 10 NULL 15 15 truncate table t1; -load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow"; +load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow"; select * from t1; a b c 1 2 Wow 3 4 Wow 5 6 Wow truncate table t1; -load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c=concat(a,"+",b,"+",@c,"+",b,"+",if(c is null,"NIL",c)); +load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c=concat(a,"+",b,"+",@c,"+",b,"+",if(c is null,"NIL",c)); select * from t1; a b c 1 2 1+2+123+2+NIL 3 4 3+4+123+4+NIL 5 6 5+6+123+6+NIL -load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, @b); +load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, @b); ERROR HY000: Can't load value from file with fixed size rows to variable create table t2 (num int primary key, str varchar(10)); insert into t2 values (10,'Ten'), (15,'Fifteen'); truncate table t1; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@dummy,@n) set a= @n, c= (select str from t2 where num=@n); +load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@dummy,@n) set a= @n, c= (select str from t2 where num=@n); select * from t1; a b c 10 NULL Ten @@ -212,7 +212,7 @@ set @@secure_file_priv= 0; ERROR HY000: Variable 'secure_file_priv' is a read only variable truncate table t1; load data infile 'MYSQL_TEST_DIR/t/loaddata.test' into table t1; -ERROR HY000: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement +Got one of the listed errors select * from t1; a b c select load_file("MYSQL_TEST_DIR/t/loaddata.test"); @@ -277,7 +277,7 @@ CREATE VIEW v1 AS SELECT * FROM t1; CREATE VIEW v2 AS SELECT 1 + 2 AS c0, c1, c2 FROM t1; CREATE VIEW v3 AS SELECT 1 AS d1, 2 AS d2; -LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v1 +LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v1 FIELDS ESCAPED BY '\\' TERMINATED BY ',' ENCLOSED BY '"' @@ -297,7 +297,7 @@ c1 c2 DELETE FROM t1; -LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2 +LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v2 FIELDS ESCAPED BY '\\' TERMINATED BY ',' ENCLOSED BY '"' @@ -317,14 +317,14 @@ c0 c1 c2 DELETE FROM t1; -LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2 +LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v2 FIELDS ESCAPED BY '\\' TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' (c0, c2); ERROR HY000: Invalid column reference (v2.c0) in LOAD DATA -LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v3 +LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v3 FIELDS ESCAPED BY '\\' TERMINATED BY ',' ENCLOSED BY '"' diff --git a/mysql-test/r/loaddata_autocom_innodb.result b/mysql-test/r/loaddata_autocom_innodb.result index 11a07cdb783..c1e6b7f2fba 100644 --- a/mysql-test/r/loaddata_autocom_innodb.result +++ b/mysql-test/r/loaddata_autocom_innodb.result @@ -2,7 +2,7 @@ SET SESSION STORAGE_ENGINE = InnoDB; drop table if exists t1; create table t1 (id int unsigned not null auto_increment primary key, a text, b text); start transaction; -load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b); +load data infile 'LOAD_FILE' into table t1 fields terminated by ',' enclosed by '''' (a, b); Warnings: Warning 1261 Row 3 doesn't contain data for all columns commit; @@ -11,7 +11,7 @@ count(*) 4 truncate table t1; start transaction; -load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b); +load data infile 'LOAD_FILE' into table t1 fields terminated by ',' enclosed by '''' (a, b); Warnings: Warning 1261 Row 3 doesn't contain data for all columns rollback; diff --git a/mysql-test/r/log_queries_not_using_indexes_basic.result b/mysql-test/r/log_queries_not_using_indexes_basic.result deleted file mode 100644 index d05437e3f66..00000000000 --- a/mysql-test/r/log_queries_not_using_indexes_basic.result +++ /dev/null @@ -1,53 +0,0 @@ -'#---------------------BS_STVARS_041_01----------------------#' -SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes); -COUNT(@@GLOBAL.log_queries_not_using_indexes) -1 -1 Expected -'#---------------------BS_STVARS_041_02----------------------#' -SET @@GLOBAL.log_queries_not_using_indexes=1; -Expected error 'Read only variable' -"BUG:It should give error on setting this variable as it is readonly variable" -SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes); -COUNT(@@GLOBAL.log_queries_not_using_indexes) -1 -1 Expected -'#---------------------BS_STVARS_041_03----------------------#' -SELECT @@GLOBAL.log_queries_not_using_indexes = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='log_queries_not_using_indexes'; -@@GLOBAL.log_queries_not_using_indexes = VARIABLE_VALUE -0 -1 Expected -SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes); -COUNT(@@GLOBAL.log_queries_not_using_indexes) -1 -1 Expected -SELECT COUNT(VARIABLE_VALUE) -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='log_queries_not_using_indexes'; -COUNT(VARIABLE_VALUE) -1 -1 Expected -'#---------------------BS_STVARS_041_04----------------------#' -SELECT @@log_queries_not_using_indexes = @@GLOBAL.log_queries_not_using_indexes; -@@log_queries_not_using_indexes = @@GLOBAL.log_queries_not_using_indexes -1 -1 Expected -'#---------------------BS_STVARS_041_05----------------------#' -SELECT COUNT(@@log_queries_not_using_indexes); -COUNT(@@log_queries_not_using_indexes) -1 -1 Expected -SELECT COUNT(@@local.log_queries_not_using_indexes); -ERROR HY000: Variable 'log_queries_not_using_indexes' is a GLOBAL variable -Expected error 'Variable is a GLOBAL variable' -SELECT COUNT(@@SESSION.log_queries_not_using_indexes); -ERROR HY000: Variable 'log_queries_not_using_indexes' is a GLOBAL variable -Expected error 'Variable is a GLOBAL variable' -SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes); -COUNT(@@GLOBAL.log_queries_not_using_indexes) -1 -1 Expected -SELECT log_queries_not_using_indexes = @@SESSION.log_queries_not_using_indexes; -ERROR 42S22: Unknown column 'log_queries_not_using_indexes' in 'field list' -Expected error 'Readonly variable' diff --git a/mysql-test/r/log_state.result b/mysql-test/r/log_state.result index 63903a034d2..5c3e3d789a1 100644 --- a/mysql-test/r/log_state.result +++ b/mysql-test/r/log_state.result @@ -1,3 +1,7 @@ +SET @old_general_log= @@global.general_log; +SET @old_general_log_file= @@global.general_log_file; +SET @old_slow_query_log= @@global.slow_query_log; +SET @old_slow_query_log_file= @@global.slow_query_log_file; set global general_log= OFF; truncate table mysql.general_log; truncate table mysql.slow_log; @@ -33,20 +37,26 @@ general_log ON log ON log_slow_queries OFF slow_query_log OFF -set session long_query_time=1; -select sleep(2); -sleep(2) +# Establish connection con1 (user=root) +# Switch to connection con1 +set @long_query_time = <long_query_time>; +set session long_query_time = @long_query_time; +select sleep(@long_query_time + 1); +sleep(@long_query_time + 1) 0 select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%'; start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text +# Switch to connection default set global slow_query_log= ON; -set session long_query_time=1; -select sleep(2); -sleep(2) +# Switch to connection con1 +set session long_query_time = @long_query_time; +select sleep(@long_query_time + 1); +sleep(@long_query_time + 1) 0 select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%'; start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text -TIMESTAMP USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 select sleep(2) +TIMESTAMP USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 select sleep(@long_query_time + 1) +# Switch to connection default show global variables where Variable_name = 'log' or Variable_name = 'log_slow_queries' or Variable_name = 'general_log' or Variable_name = 'slow_query_log'; @@ -92,8 +102,8 @@ slow_query_log_file # show variables like 'log_output'; Variable_name Value log_output FILE,TABLE -set global general_log_file='/not exiting path/log.master'; -ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not exiting path/log.master' +set global general_log_file='/not existing path/log.master'; +ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not existing path/log.master' set global general_log_file='MYSQLTEST_VARDIR'; ERROR 42000: Variable 'general_log_file' can't be set to the value of 'MYSQLTEST_VARDIR' set global general_log_file=''; @@ -153,8 +163,10 @@ select * from mysql.general_log; event_time user_host thread_id server_id command_type argument TIMESTAMP USER_HOST # 1 Query drop table t1 TIMESTAMP USER_HOST # 1 Query select * from mysql.general_log -SET @old_general_log_state = @@global.general_log; -SET @old_slow_log_state = @@global.slow_query_log; +SET @@global.general_log = @old_general_log; +SET @@global.general_log_file = @old_general_log_file; +SET @@global.slow_query_log = @old_slow_query_log; +SET @@global.slow_query_log_file = @old_slow_query_log_file; SET GLOBAL general_log = ON; SET GLOBAL slow_query_log = ON; FLUSH TABLES WITH READ LOCK; @@ -173,10 +185,9 @@ SET GLOBAL READ_ONLY = ON; SET GLOBAL general_log = ON; SET GLOBAL slow_query_log = ON; SET GLOBAL READ_ONLY = OFF; -SET GLOBAL general_log = @old_general_log_state; -SET GLOBAL slow_query_log = @old_slow_log_state; -SET @old_general_log_state = @@global.general_log; -SET @old_slow_log_state = @@global.slow_query_log; +SET GLOBAL general_log = @old_general_log; +SET GLOBAL slow_query_log = @old_slow_query_log; +SET GLOBAL general_log = ON; SHOW VARIABLES LIKE 'general_log'; Variable_name Value general_log ON @@ -239,29 +250,24 @@ log_slow_queries ON SELECT @@slow_query_log, @@log_slow_queries; @@slow_query_log @@log_slow_queries 1 1 -SET GLOBAL general_log = @old_general_log_state; -SET GLOBAL slow_query_log = @old_slow_log_state; -set @old_general_log_file= @@global.general_log_file; -set @old_slow_query_log_file= @@global.slow_query_log_file; -set global general_log_file= concat('/not exiting path/log.maste', 'r'); -ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not exiting path/log.master' -set global general_log_file= NULL; +SET GLOBAL general_log = @old_general_log; +SET GLOBAL slow_query_log = @old_slow_query_log; +SET GLOBAL general_log_file= CONCAT('/not existing path/log.maste', 'r'); +ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not existing path/log.master' +SET GLOBAL general_log_file= NULL; ERROR 42000: Variable 'general_log_file' can't be set to the value of 'NULL' -set global slow_query_log_file= concat('/not exiting path/log.maste', 'r'); -ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of '/not exiting path/log.master' -set global slow_query_log_file= NULL; +SET GLOBAL slow_query_log_file= CONCAT('/not existing path/log.maste', 'r'); +ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of '/not existing path/log.master' +SET GLOBAL slow_query_log_file= NULL; ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of 'NULL' -set global general_log_file= @old_general_log_file; -set global slow_query_log_file= @old_slow_query_log_file; +SET GLOBAL general_log_file= @old_general_log_file; +SET GLOBAL slow_query_log_file= @old_slow_query_log_file; # -- # -- Bug#32748: Inconsistent handling of assignments to -# -- general_log_file/slow_query_log_file. +# -- general_log_file/slow_query_log_file. # -- -SET @general_log_file_saved = @@global.general_log_file; -SET @slow_query_log_file_saved = @@global.slow_query_log_file; - SET GLOBAL general_log_file = 'bug32748.query.log'; SET GLOBAL slow_query_log_file = 'bug32748.slow.log'; @@ -270,8 +276,8 @@ Variable_name Value general_log_file bug32748.query.log slow_query_log_file bug32748.slow.log -SET GLOBAL general_log_file = @general_log_file_saved; -SET GLOBAL slow_query_log_file = @slow_query_log_file_saved; +SET GLOBAL general_log_file = @old_general_log_file; +SET GLOBAL slow_query_log_file = @old_slow_query_log_file; # -- End of Bug#32748. deprecated: @@ -298,4 +304,13 @@ SET GLOBAL general_log_file = @my_glf; SET GLOBAL slow_query_log_file = @my_sqlf; SET GLOBAL general_log = DEFAULT; SET GLOBAL slow_query_log = DEFAULT; +SET @@global.general_log = @old_general_log; +SET @@global.general_log_file = @old_general_log_file; +SET @@global.slow_query_log = @old_slow_query_log; +SET @@global.slow_query_log_file = @old_slow_query_log_file; End of 5.1 tests +# Close connection con1 +SET global general_log = @old_general_log; +SET global general_log_file = @old_general_log_file; +SET global slow_query_log = @old_slow_query_log; +SET global slow_query_log_file = @old_slow_query_log_file; diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result index 2f294314b04..376120abcda 100644 --- a/mysql-test/r/log_tables.result +++ b/mysql-test/r/log_tables.result @@ -1,3 +1,8 @@ +SET @old_general_log_state = @@global.general_log; +SET @old_log_output= @@global.log_output; +SET @old_slow_query_log= @@global.slow_query_log; +SET @old_general_log= @@global.general_log; +SET @old_long_query_time= @@session.long_query_time; use mysql; SET @saved_long_query_time = @@long_query_time; SET @saved_log_output = @@log_output; @@ -432,7 +437,8 @@ SET SESSION long_query_time =@saved_long_query_time; FLUSH LOGS; ALTER TABLE mysql.slow_log DROP COLUMN seq; ALTER TABLE mysql.slow_log ENGINE = CSV; -SET GLOBAL slow_query_log = @saved_slow_query_log; +SET GLOBAL general_log = @old_general_log; +SET GLOBAL slow_query_log = @old_slow_query_log; drop procedure if exists proc25422_truncate_slow; drop procedure if exists proc25422_truncate_general; drop procedure if exists proc25422_alter_slow; @@ -623,8 +629,8 @@ DROP TABLE `db_17876.general_log_data`; DROP PROCEDURE IF EXISTS `db_17876.archiveSlowLog`; DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`; DROP DATABASE IF EXISTS `db_17876`; -SET GLOBAL general_log = @saved_general_log; -SET GLOBAL slow_query_log = @saved_slow_query_log; +SET GLOBAL general_log = @old_general_log; +SET GLOBAL slow_query_log = @old_slow_query_log; select CONNECTION_ID() into @thread_id; truncate table mysql.general_log; set global general_log = on; @@ -840,7 +846,7 @@ Query execute long_query using @lparam Execute select '000 001 002 003 004 005 006 007 008 009010 011 012 013 014 015 016 017 018 019020 021 022 023 024 025 026 027 028 029030 031 032 033 034 035 036 037 038 039040 041 042 043 044 045 046 047 048 049050 051 052 053 054 055 056 057 058 059060 061 062 063 064 065 066 067 068 069070 071 072 073 074 075 076 077 078 079080 081 082 083 084 085 086 087 088 089090 091 092 093 094 095 096 097 098 099100 101 102 103 104 105 106 107 108 109110 111 112 113 114 115 116 117 118 119120 121 122 123 124 125 126 127 128 129130 131 132 133 134 135 136 137 138 139140 141 142 143 144 145 146 147 148 149150 151 152 153 154 155 156 157 158 159160 161 162 163 164 165 166 167 168 169170 171 172 173 174 175 176 177 178 179180 181 182 183 184 185 186 187 188 189190 191 192 193 194 195 196 197 198 199200 201 202 203 204 205 206 207 208 209210 211 212 213 214 215 216 217 218 219220 221 222 223 224 225 226 227 228 229230 231 232 233 234 235 236 237 238 239240 241 242 243 244 245 246 247 248 249250 251 252 253 254 255 256 257 258 259260 261 262 263 264 265 266 267 268 269270 271 272 273 274 275 276 277 278 279280 281 282 283 284 285 286 287 288 289290 291 292 293 294 295 296 297 298 299300 301 302 303 304 305 306 307 308 309310 311 312 313 314 315 316 317 318 319320 321 322 323 324 325 326 327 328 329330 331 332 333 334 335 336 337 338 339340 341 342 343 344 345 346 347 348 349350 351 352 353 354 355 356 357 358 359360 361 362 363 364 365 366 367 368 369370 371 372 373 374 375 376 377 378 379380 381 382 383 384 385 386 387 388 389390 391 392 393 394 395 396 397 398 399400 401 402 403 404 405 406 407 408 409410 411 412 413 414 415 416 417 418 419420 421 422 423 424 425 426 427 428 429430 431 432 433 434 435 436 437 438 439440 441 442 443 444 445 446 447 448 449450 451 452 453 454 455 456 457 458 459460 461 462 463 464 465 466 467 468 469470 471 472 473 474 475 476 477 478 479480 481 482 483 484 485 486 487 488 489490 491 492 493 494 495 496 497 498 499500 501 502 503 504 505 506 507 508 509510 511 512 513 514 515 516 517 518 519520 521 522 523 524 525 526 527 528 529530 531 532 533 534 535 536 537 538 539540 541 542 543 544 545 546 547 548 549550 551 552 553 554 555 556 557 558 559560 561 562 563 564 565 566 567 568 569570 571 572 573 574 575 576 577 578 579580 581 582 583 584 585 586 587 588 589590 591 592 593 594 595 596 597 598 599600 601 602 603 604 605 606 607 608 609610 611 612 613 614 615 616 617 618 619620 621 622 623 624 625 626 627 628 629630 631 632 633 634 635 636 637 638 639640 641 642 643 644 645 646 647 648 649650 651 652 653 654 655 656 657 658 659660 661 662 663 664 665 666 667 668 669670 671 672 673 674 675 676 677 678 679680 681 682 683 684 685 686 687 688 689690 691 692 693 694 695 696 697 698 699700 701 702 703 704 705 706 707 708 709710 711 712 713 714 715 716 717 718 719720 721 722 723 724 725 726 727 728 729730 731 732 733 734 735 736 737 738 739740 741 742 743 744 745 746 747 748 749750 751 752 753 754 755 756 757 758 759760 761 762 763 764 765 766 767 768 769770 771 772 773 774 775 776 777 778 779780 781 782 783 784 785 786 787 788 789790 791 792 793 794 795 796 797 798 799800 801 802 803 804 805 806 807 808 809810 811 812 813 814 815 816 817 818 819820 821 822 823 824 825 826 827 828 829830 831 832 833 834 835 836 837 838 839840 841 842 843 844 845 846 847 848 849850 851 852 853 854 855 856 857 858 859860 861 862 863 864 865 866 867 868 869870 871 872 873 874 875 876 877 878 879880 881 882 883 884 885 886 887 888 889890 891 892 893 894 895 896 897 898 899900 901 902 903 904 905 906 907 908 909910 911 912 913 914 915 916 917 918 919920 921 922 923 924 925 926 927 928 929930 931 932 933 934 935 936 937 938 939940 941 942 943 944 945 946 947 948 949950 951 952 953 954 955 956 957 958 959960 961 962 963 964 965 966 967 968 969970 971 972 973 974 975 976 977 978 979980 981 982 983 984 985 986 987 988 989990 991 992 993 994 995 996 997 998 999' as long_query Query set global general_log = off deallocate prepare long_query; -set global general_log = @saved_general_log; +set global general_log = @old_general_log; DROP TABLE IF EXISTS log_count; DROP TABLE IF EXISTS slow_log_copy; DROP TABLE IF EXISTS general_log_copy; @@ -893,7 +899,7 @@ TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - KEY', f1,f2,f3,SLEEP(1.1) FROM t1 TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - PK', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f1=2 DROP TABLE t1; TRUNCATE TABLE mysql.slow_log; -SET GLOBAL slow_query_log = @saved_slow_query_log; -SET GLOBAL general_log=@saved_general_log; -SET SESSION long_query_time =@saved_long_query_time; -SET GLOBAL LOG_OUTPUT = @saved_log_output; +SET @@session.long_query_time= @old_long_query_time; +SET @@global.log_output= @old_log_output; +SET @@global.slow_query_log= @old_slow_query_log; +SET @@global.general_log= @old_general_log; diff --git a/mysql-test/r/lowercase_table3.result b/mysql-test/r/lowercase_table3.result index 14cff4f98c9..880a203a15f 100644 --- a/mysql-test/r/lowercase_table3.result +++ b/mysql-test/r/lowercase_table3.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("Cannot find or open table test/BUG29839 from"); DROP TABLE IF EXISTS t1,T1; CREATE TABLE t1 (a int); SELECT * from T1; diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 241be890952..33c7a203671 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -2215,7 +2215,7 @@ KEY (c1), KEY (c2) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0; -MyISAM file: MYSQLTEST_VARDIR/master-data/test/t1 +MyISAM file: MYSQLD_DATADIR/test/t1 Record format: Packed Character set: utf8_general_ci (33) Data records: 0 Deleted blocks: 0 diff --git a/mysql-test/r/myisampack.result b/mysql-test/r/myisampack.result index 5f39d318234..7ed9b86d887 100644 --- a/mysql-test/r/myisampack.result +++ b/mysql-test/r/myisampack.result @@ -27,3 +27,25 @@ CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK DROP TABLE t1; +drop table if exists t1; +create table t1(f1 int, f2 char(255)); +insert into t1 values(1, 'foo'), (2, 'bar'); +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +flush tables; +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize error Table 'test.t1' is read only +Warnings: +Error 1036 Table 't1' is read only +drop table t1; diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index a4d96c1c243..25b66fe7fc6 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -180,6 +180,14 @@ ERROR at line 1: DELIMITER cannot contain a backslash character 1 This is a file starting with UTF8 BOM 0xEFBBBF This is a file starting with UTF8 BOM 0xEFBBBF +delimiter +1 +2 +2 +2 +2 +@z:='1' @z=database() +1 NULL End of 5.0 tests WARNING: --server-arg option not supported in this configuration. Warning (Code 1286): Unknown table engine 'nonexistent' diff --git a/mysql-test/r/mysql_client_test.result b/mysql-test/r/mysql_client_test.result index 9766475a418..08d982c85e3 100644 --- a/mysql-test/r/mysql_client_test.result +++ b/mysql-test/r/mysql_client_test.result @@ -1 +1,3 @@ +SET @old_general_log= @@global.general_log; ok +SET @@global.general_log= @old_general_log; diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result index 31846f68b7b..384442f8c31 100644 --- a/mysql-test/r/mysql_upgrade.result +++ b/mysql-test/r/mysql_upgrade.result @@ -1,4 +1,6 @@ Run mysql_upgrade once +mtr.global_suppressions OK +mtr.test_suppressions OK mysql.columns_priv OK mysql.db OK mysql.event OK @@ -29,6 +31,8 @@ mysql.user OK Run it again - should say already completed This installation of MySQL is already upgraded to VERSION, use --force if you still need to run mysql_upgrade Force should run it regardless of wether it's been run before +mtr.global_suppressions OK +mtr.test_suppressions OK mysql.columns_priv OK mysql.db OK mysql.event OK @@ -59,6 +63,8 @@ mysql.user OK CREATE USER mysqltest1@'%' IDENTIFIED by 'sakila'; GRANT ALL ON *.* TO mysqltest1@'%'; Run mysql_upgrade with password protected account +mtr.global_suppressions OK +mtr.test_suppressions OK mysql.columns_priv OK mysql.db OK mysql.event OK @@ -91,6 +97,8 @@ Run mysql_upgrade with a non existing server socket mysqlcheck: Got error: 2005: Unknown MySQL server host 'not_existing_host' (errno) when trying to connect FATAL ERROR: Upgrade failed set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE'; +mtr.global_suppressions OK +mtr.test_suppressions OK mysql.columns_priv OK mysql.db OK mysql.event OK diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 9c2ccc78429..974b4952799 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -1,14 +1,15 @@ +reset master; set timestamp=1000000000; drop table if exists t1,t2,t3,t4,t5,t03,t04; create table t1 (word varchar(20)); create table t2 (id int auto_increment not null primary key); insert into t1 values ("abirvalg"); insert into t2 values (); -load data infile '../std_data_ln/words.dat' into table t1; -load data infile '../std_data_ln/words.dat' into table t1; -load data infile '../std_data_ln/words.dat' into table t1; -load data infile '../std_data_ln/words.dat' into table t1; -load data infile '../std_data_ln/words.dat' into table t1; +load data infile '../../std_data/words.dat' into table t1; +load data infile '../../std_data/words.dat' into table t1; +load data infile '../../std_data/words.dat' into table t1; +load data infile '../../std_data/words.dat' into table t1; +load data infile '../../std_data/words.dat' into table t1; insert into t1 values ("Alas"); flush logs; @@ -20,7 +21,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -66,7 +67,7 @@ DELIMITER /*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -98,7 +99,7 @@ DELIMITER /*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -120,7 +121,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -166,7 +167,7 @@ DELIMITER /*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -198,7 +199,7 @@ DELIMITER /*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -298,7 +299,7 @@ DELIMITER /*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -320,17 +321,17 @@ call p1(); drop procedure p1; flush logs; create table t1 (a varchar(64) character set utf8); -load data infile '../std_data_ln/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; set character_set_database=koi8r; -load data infile '../std_data_ln/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; set character_set_database=latin1; -load data infile '../std_data_ln/loaddata6.dat' into table t1; -load data infile '../std_data_ln/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; set character_set_database=koi8r; -load data infile '../std_data_ln/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; set character_set_database=latin1; -load data infile '../std_data_ln/loaddata6.dat' into table t1; -load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8r; +load data infile '../../std_data/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8r; select hex(a) from t1; hex(a) C3BF @@ -348,7 +349,7 @@ DELIMITER /*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/r/mysqlbinlog2.result b/mysql-test/r/mysqlbinlog2.result index 89fc4b87d29..dba9bdc9d70 100644 --- a/mysql-test/r/mysqlbinlog2.result +++ b/mysql-test/r/mysqlbinlog2.result @@ -22,7 +22,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -65,7 +65,7 @@ SET INSERT_ID=1/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -104,7 +104,7 @@ SET INSERT_ID=4/*!*/; use test/*!*/; SET TIMESTAMP=1579609946/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -130,7 +130,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -165,7 +165,7 @@ SET INSERT_ID=4/*!*/; use test/*!*/; SET TIMESTAMP=1579609946/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -188,7 +188,7 @@ SET INSERT_ID=3/*!*/; use test/*!*/; SET TIMESTAMP=1579609944/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -218,7 +218,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -249,7 +249,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -284,7 +284,7 @@ SET INSERT_ID=6/*!*/; use test/*!*/; SET TIMESTAMP=1579609943/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -307,7 +307,7 @@ SET INSERT_ID=1/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -338,7 +338,7 @@ SET INSERT_ID=6/*!*/; use test/*!*/; SET TIMESTAMP=1579609943/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -361,7 +361,7 @@ SET INSERT_ID=4/*!*/; use test/*!*/; SET TIMESTAMP=1579609946/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -380,7 +380,7 @@ SET INSERT_ID=6/*!*/; use test/*!*/; SET TIMESTAMP=1579609943/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -402,7 +402,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -448,7 +448,7 @@ SET INSERT_ID=3/*!*/; use test/*!*/; SET TIMESTAMP=1579609944/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -471,7 +471,7 @@ SET INSERT_ID=6/*!*/; use test/*!*/; SET TIMESTAMP=1579609943/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -493,7 +493,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -523,7 +523,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -566,7 +566,7 @@ SET INSERT_ID=1/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -604,7 +604,7 @@ SET INSERT_ID=4/*!*/; use test/*!*/; SET TIMESTAMP=1579609946/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -630,7 +630,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -664,7 +664,7 @@ SET INSERT_ID=4/*!*/; use test/*!*/; SET TIMESTAMP=1579609946/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -687,7 +687,7 @@ SET INSERT_ID=3/*!*/; use test/*!*/; SET TIMESTAMP=1579609944/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -717,7 +717,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -747,7 +747,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -782,7 +782,7 @@ SET INSERT_ID=6/*!*/; use test/*!*/; SET TIMESTAMP=1579609943/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -805,7 +805,7 @@ SET INSERT_ID=1/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -836,7 +836,7 @@ SET INSERT_ID=6/*!*/; use test/*!*/; SET TIMESTAMP=1579609943/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -858,7 +858,7 @@ SET INSERT_ID=4/*!*/; use test/*!*/; SET TIMESTAMP=1579609946/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -877,7 +877,7 @@ SET INSERT_ID=6/*!*/; use test/*!*/; SET TIMESTAMP=1579609943/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -899,7 +899,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -945,7 +945,7 @@ SET INSERT_ID=3/*!*/; use test/*!*/; SET TIMESTAMP=1579609944/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -968,7 +968,7 @@ SET INSERT_ID=6/*!*/; use test/*!*/; SET TIMESTAMP=1579609943/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -990,7 +990,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -1020,7 +1020,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/r/mysqlbinlog_base64.result b/mysql-test/r/mysqlbinlog_base64.result index b62023e0ccf..c5e1e2f8ca1 100644 --- a/mysql-test/r/mysqlbinlog_base64.result +++ b/mysql-test/r/mysqlbinlog_base64.result @@ -1,3 +1,4 @@ +reset master; create table t1 (a int); insert into t1 values (1); insert into t1 values (2); @@ -5,7 +6,7 @@ insert into t1 values (3); update t1 set a=a+2 where a=2; update t1 set a=a+2 where a=3; create table t2 (word varchar(20)); -load data infile '../std_data_ln/words.dat' into table t2; +load data infile '../../std_data/words.dat' into table t2; flush logs; drop table t1; drop table t2; @@ -89,7 +90,7 @@ aberration flush logs; drop table t2; create table t2 (word varchar(20)); -load data infile '../std_data_ln/words.dat' into table t2; +load data infile '../../std_data/words.dat' into table t2; insert into t2 select * from t2; insert into t2 select * from t2; insert into t2 select * from t2; diff --git a/mysql-test/r/mysqlbinlog_row.result b/mysql-test/r/mysqlbinlog_row.result index 39ca296e343..9b562ac0fff 100644 --- a/mysql-test/r/mysqlbinlog_row.result +++ b/mysql-test/r/mysqlbinlog_row.result @@ -339,7 +339,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/r/mysqlbinlog_row_big.result b/mysql-test/r/mysqlbinlog_row_big.result index 0daf50e1ac3..f2ca72f9936 100644 --- a/mysql-test/r/mysqlbinlog_row_big.result +++ b/mysql-test/r/mysqlbinlog_row_big.result @@ -9,7 +9,7 @@ SET timestamp=1000000000; # # We need big packets. # -SET @@session.max_allowed_packet= 1024*1024*1024; +SET @@global.max_allowed_packet= 1024*1024*1024; # # Delete all existing binary logs. # diff --git a/mysql-test/r/mysqlbinlog_row_innodb.result b/mysql-test/r/mysqlbinlog_row_innodb.result index 56efba0362f..86f0b67ebb3 100644 --- a/mysql-test/r/mysqlbinlog_row_innodb.result +++ b/mysql-test/r/mysqlbinlog_row_innodb.result @@ -2256,7 +2256,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; @@ -3879,7 +3879,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; @@ -4246,7 +4246,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; @@ -4772,7 +4772,7 @@ c3 VARCHAR(60) # # Load data. # -LOAD DATA INFILE '../std_data_ln/loaddata5.dat' +LOAD DATA INFILE '../../std_data/loaddata5.dat' INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (c1,c2) SET c3 = 'Wow'; affected rows: 3 @@ -4807,7 +4807,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; diff --git a/mysql-test/r/mysqlbinlog_row_myisam.result b/mysql-test/r/mysqlbinlog_row_myisam.result index d3f2a2a1f2f..b9366d941f8 100644 --- a/mysql-test/r/mysqlbinlog_row_myisam.result +++ b/mysql-test/r/mysqlbinlog_row_myisam.result @@ -2256,7 +2256,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; @@ -3901,7 +3901,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; @@ -4274,7 +4274,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; @@ -4810,7 +4810,7 @@ c3 VARCHAR(60) # # Load data. # -LOAD DATA INFILE '../std_data_ln/loaddata5.dat' +LOAD DATA INFILE '../../std_data/loaddata5.dat' INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (c1,c2) SET c3 = 'Wow'; affected rows: 3 @@ -4845,7 +4845,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; diff --git a/mysql-test/r/mysqlbinlog_row_trans.result b/mysql-test/r/mysqlbinlog_row_trans.result index b7dd6a68096..9c3348a9e76 100644 --- a/mysql-test/r/mysqlbinlog_row_trans.result +++ b/mysql-test/r/mysqlbinlog_row_trans.result @@ -135,7 +135,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index e222d66c5b6..6f7fcb7efde 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -1,6 +1,8 @@ DROP TABLE IF EXISTS t1, `t``1`, `t 1`; drop view if exists v1; drop database if exists client_test_db; +mtr.global_suppressions OK +mtr.test_suppressions OK mysql.columns_priv OK mysql.db OK mysql.event OK @@ -130,3 +132,58 @@ v1 v-1 drop view v1, `v-1`; drop table t1; +SET NAMES utf8; +CREATE TABLE `#mysql50#@` (a INT); +SHOW TABLES; +Tables_in_test +#mysql50#@ +SET NAMES DEFAULT; +mysqlcheck --fix-table-names --databases test +SET NAMES utf8; +SHOW TABLES; +Tables_in_test +@ +DROP TABLE `@`; +CREATE TABLE `Ñ` (a INT); +SET NAMES DEFAULT; +mysqlcheck --default-character-set="latin1" --databases test +test.? +Error : Table doesn't exist +error : Corrupt +mysqlcheck --default-character-set="utf8" --databases test +test.Ñ OK +SET NAMES utf8; +DROP TABLE `Ñ`; +SET NAMES DEFAULT; +CREATE DATABASE `#mysql50#a@b`; +USE `#mysql50#a@b`; +CREATE TABLE `#mysql50#c@d` (a INT); +CREATE TABLE t1 (a INT); +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS +WHERE TRIGGER_SCHEMA="#mysql50#a@b" ORDER BY trigger_name; +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL #mysql50#a@b tr1 INSERT NULL #mysql50#a@b #mysql50#c@d 0 NULL SET NEW.a = 10 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +NULL #mysql50#a@b tr2 INSERT NULL #mysql50#a@b t1 0 NULL SET NEW.a = 100 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +Warnings: +Warning 1603 Triggers for table `#mysql50#a@b`.`#mysql50#c@d` have no creation context +Warning 1603 Triggers for table `#mysql50#a@b`.`t1` have no creation context +mysqlcheck --fix-db-names --fix-table-names --all-databases +USE `a@b`; +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS +WHERE TRIGGER_SCHEMA="a@b" ORDER BY trigger_name; +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL a@b tr1 INSERT NULL a@b c@d 0 NULL SET NEW.a = 10 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost utf8 utf8_general_ci latin1_swedish_ci +NULL a@b tr2 INSERT NULL a@b t1 0 NULL SET NEW.a = 100 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost utf8 utf8_general_ci latin1_swedish_ci +INSERT INTO `c@d` VALUES (2), (1); +SELECT * FROM `c@d`; +a +20 +10 +INSERT INTO t1 VALUES (3), (5); +SELECT * FROM t1; +a +300 +500 +DROP DATABASE `a@b`; +USE test; +End of 5.1 tests diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 51a0b6c45ef..1a65f90bd65 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -153,8 +153,12 @@ mysqltest: At line 1: Missing delimiter mysqltest: At line 1: End of line junk detected: "sleep 7 # Another comment " -mysqltest: At line 1: Missing delimiter -mysqltest: At line 1: Missing delimiter +mysqltest: At line 1: Extra argument 'comment +# comment 3 +disable_query_log' passed to 'disconnect' +mysqltest: At line 1: Extra argument 'comment +# comment 3 +disable_query_log' passed to 'disconnect' mysqltest: At line 1: End of line junk detected: "disconnect default # @@ -294,7 +298,7 @@ var5 from query that returns no row failing query in let mysqltest: At line 1: Error running query 'failing query': 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing query' at line 1 mysqltest: At line 1: Missing required argument 'filename' to command 'source' -mysqltest: At line 1: Could not open './non_existingFile' for reading +mysqltest: At line 1: Could not open './non_existingFile' for reading, errno: 2 mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql": At line 1: Source directives are nesting too deep mysqltest: In included file "MYSQLTEST_VARDIR/tmp/error.sql": At line 1: query 'garbage ' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 @@ -444,7 +448,7 @@ ERROR 3D000: No database selected Output from mysqltest-x.inc Output from mysqltest-x.inc Output from mysqltest-x.inc -mysqltest: Could not open './non_existing_file.inc' for reading: errno = 2 +mysqltest: Could not open './non_existing_file.inc' for reading, errno: 2 failing_statement; 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 'failing_statement' at line 1 failing_statement; @@ -487,8 +491,6 @@ mysqltest: At line 3: query 'create table t1 (a int primary key); insert into t1 values (1); select 'select-me'; insertz 'error query'' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'insertz 'error query'' at line 1 - -More results from queries before failure can be found in MYSQLTEST_VARDIR/log/bug11731.log drop table t1; Multi statement using expected error create table t1 (a int primary key); @@ -732,4 +734,21 @@ file2.txt SELECT 'c:\\a.txt' AS col; col z +hej +mysqltest: At line 1: Found junk ' != 143' after $variable in expression +select 1; +1 +1 +select 1; +1 +1 +-- a comment for the server; +mysqltest: At line 1: Found line beginning with -- that didn't contain a valid mysqltest command, check your syntax or use # if you intended to write a comment +con1 +default +con1 +default +con1 +con1 +-closed_connection- End of tests diff --git a/mysql-test/r/not_as_root.require b/mysql-test/r/not_as_root.require deleted file mode 100644 index d9ea5244efc..00000000000 --- a/mysql-test/r/not_as_root.require +++ /dev/null @@ -1,2 +0,0 @@ -running_as_root -NO diff --git a/mysql-test/r/not_embedded_server.result b/mysql-test/r/not_embedded_server.result index 1b734136e6c..4373d6356d9 100644 --- a/mysql-test/r/not_embedded_server.result +++ b/mysql-test/r/not_embedded_server.result @@ -1,12 +1,2 @@ -prepare stmt1 from ' SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!=\'Daemon\' '; -execute stmt1; -ID USER HOST DB COMMAND TIME STATE INFO -number root localhost test Query time executing SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!='Daemon' -deallocate prepare stmt1; FLUSH STATUS; -SHOW GLOBAL STATUS LIKE 'com_select'; -Variable_name Value -Com_select 102 -SHOW GLOBAL STATUS LIKE 'com_select'; -Variable_name Value -Com_select 102 +Value of com_select did not change diff --git a/mysql-test/r/outfile.result b/mysql-test/r/outfile.result Binary files differindex 8503df545d2..bbd8088834f 100644 --- a/mysql-test/r/outfile.result +++ b/mysql-test/r/outfile.result diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 93684ba05e5..cec4e60d139 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -1,3 +1,4 @@ +SET @old_general_log= @@global.general_log; drop table if exists t1, t2; CREATE TABLE t1 ( pk INT NOT NULL AUTO_INCREMENT, @@ -1907,3 +1908,4 @@ count(*) 288 drop table t1; End of 5.1 tests +SET @@global.general_log= @old_general_log; diff --git a/mysql-test/r/partition_datatype.result b/mysql-test/r/partition_datatype.result index 3e4acfdee12..607afb71da5 100644 --- a/mysql-test/r/partition_datatype.result +++ b/mysql-test/r/partition_datatype.result @@ -324,7 +324,7 @@ partition by hash (a) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bit(27) NOT NULL DEFAULT '\0\0\0\0', + `a` bit(27) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (a) diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result index 585447ff333..547ce1ca316 100644 --- a/mysql-test/r/partition_error.result +++ b/mysql-test/r/partition_error.result @@ -87,8 +87,8 @@ partitions 3 partition x2 tablespace ts2, partition x3 tablespace ts3); ERROR HY000: Field in list of fields for partition function not found in table -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); -load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par') +select load_file('$MYSQLD_DATADIR/test/t1.par'); +load_file('$MYSQLD_DATADIR/test/t1.par') NULL CREATE TABLE t1 ( a int not null, @@ -164,8 +164,8 @@ partitions 2 (partition x1 values less than (4), partition x2 values less than (5)); ERROR HY000: Only RANGE PARTITIONING can use VALUES LESS THAN in partition definition -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); -load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par') +select load_file('$MYSQLD_DATADIR/test/t1.par'); +load_file('$MYSQLD_DATADIR/test/t1.par') NULL CREATE TABLE t1 ( a int not null, @@ -177,8 +177,8 @@ partitions 2 (partition x1 values in (4), partition x2 values in (5)); ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); -load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par') +select load_file('$MYSQLD_DATADIR/test/t1.par'); +load_file('$MYSQLD_DATADIR/test/t1.par') NULL CREATE TABLE t1 ( a int not null, @@ -190,8 +190,8 @@ partitions 2 (partition x1 values in (4,6), partition x2 values in (5,7)); ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); -load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par') +select load_file('$MYSQLD_DATADIR/test/t1.par'); +load_file('$MYSQLD_DATADIR/test/t1.par') NULL CREATE TABLE t1 ( a int not null, @@ -201,8 +201,8 @@ primary key (a,b)) partition by key (a) subpartition by key (b); ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); -load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par') +select load_file('$MYSQLD_DATADIR/test/t1.par'); +load_file('$MYSQLD_DATADIR/test/t1.par') NULL CREATE TABLE t1 ( a int not null, @@ -212,8 +212,8 @@ primary key (a,b)) partition by key (a) subpartition by key (a, b); ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); -load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par') +select load_file('$MYSQLD_DATADIR/test/t1.par'); +load_file('$MYSQLD_DATADIR/test/t1.par') NULL CREATE TABLE t1 ( a int not null, @@ -223,8 +223,8 @@ primary key (a,b)) partition by key (a) subpartition by hash (a+b); ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); -load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par') +select load_file('$MYSQLD_DATADIR/test/t1.par'); +load_file('$MYSQLD_DATADIR/test/t1.par') NULL CREATE TABLE t1 ( a int not null, @@ -234,8 +234,8 @@ primary key (a,b)) partition by key (a) subpartition by key (b); ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); -load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par') +select load_file('$MYSQLD_DATADIR/test/t1.par'); +load_file('$MYSQLD_DATADIR/test/t1.par') NULL CREATE TABLE t1 ( a int not null, @@ -245,8 +245,8 @@ primary key (a,b)) partition by key (a) subpartition by key (a, b); ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); -load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par') +select load_file('$MYSQLD_DATADIR/test/t1.par'); +load_file('$MYSQLD_DATADIR/test/t1.par') NULL CREATE TABLE t1 ( a int not null, @@ -256,8 +256,8 @@ primary key (a,b)) partition by key (a) subpartition by hash (a+b); ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); -load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par') +select load_file('$MYSQLD_DATADIR/test/t1.par'); +load_file('$MYSQLD_DATADIR/test/t1.par') NULL CREATE TABLE t1 ( a int not null, @@ -277,8 +277,8 @@ subpartition by hash (sin(a+b)) (partition x1 (subpartition x11, subpartition x12), partition x2 (subpartition x21, subpartition x22)); ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); -load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par') +select load_file('$MYSQLD_DATADIR/test/t1.par'); +load_file('$MYSQLD_DATADIR/test/t1.par') NULL CREATE TABLE t1 ( a int not null, @@ -302,8 +302,8 @@ subpartition by key (a,d) (partition x1 values less than (1) (subpartition x11, subpartition x12), partition x2 values less than (2) (subpartition x21, subpartition x22)); ERROR HY000: Field in list of fields for partition function not found in table -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); -load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par') +select load_file('$MYSQLD_DATADIR/test/t1.par'); +load_file('$MYSQLD_DATADIR/test/t1.par') NULL CREATE TABLE t1 ( a int not null, @@ -330,8 +330,8 @@ c int not null, primary key(a,b)) partition by range (a); ERROR HY000: For RANGE partitions each partition must be defined -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); -load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par') +select load_file('$MYSQLD_DATADIR/test/t1.par'); +load_file('$MYSQLD_DATADIR/test/t1.par') NULL CREATE TABLE t1 ( a int not null, diff --git a/mysql-test/r/partition_innodb_semi_consistent.result b/mysql-test/r/partition_innodb_semi_consistent.result new file mode 100644 index 00000000000..1bb39af043a --- /dev/null +++ b/mysql-test/r/partition_innodb_semi_consistent.result @@ -0,0 +1,128 @@ +drop table if exists t1; +set binlog_format=mixed; +set session transaction isolation level read committed; +create table t1(a int not null) +engine=innodb +DEFAULT CHARSET=latin1 +PARTITION BY RANGE(a) +(PARTITION p0 VALUES LESS THAN (20), +PARTITION p1 VALUES LESS THAN MAXVALUE); +insert into t1 values (1),(2),(3),(4),(5),(6),(7); +set autocommit=0; +select * from t1 where a=3 lock in share mode; +a +3 +set binlog_format=mixed; +set session transaction isolation level read committed; +set autocommit=0; +update t1 set a=10 where a=5; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +commit; +update t1 set a=10 where a=5; +select * from t1 where a=2 for update; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +select * from t1 where a=2 limit 1 for update; +a +2 +update t1 set a=11 where a=6; +update t1 set a=12 where a=2; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +update t1 set a=13 where a=1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +commit; +update t1 set a=14 where a=1; +commit; +select * from t1; +a +10 +11 +14 +2 +3 +4 +7 +drop table t1; +SET SESSION AUTOCOMMIT = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +set binlog_format=mixed; +# Switch to connection con1 +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256)) +ENGINE = InnoDB +PARTITION BY RANGE (a) +(PARTITION p0 VALUES LESS THAN (300), +PARTITION p1 VALUES LESS THAN MAXVALUE); +INSERT INTO t1 VALUES (1,2); +# 1. test for locking: +BEGIN; +UPDATE t1 SET b = 12 WHERE a = 1; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +SELECT * FROM t1; +a b +1 12 +# Switch to connection con2 +UPDATE t1 SET b = 21 WHERE a = 1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +# Switch to connection con1 +SELECT * FROM t1; +a b +1 12 +ROLLBACK; +# 2. test for serialized update: +CREATE TABLE t2 (a INT); +TRUNCATE t1; +INSERT INTO t1 VALUES (1,'init'); +CREATE PROCEDURE p1() +BEGIN +UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1; +INSERT INTO t2 VALUES (); +END| +BEGIN; +UPDATE t1 SET b = CONCAT(b, '+con1') WHERE a = 1; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +SELECT * FROM t1; +a b +1 init+con1 +# Switch to connection con2 +CALL p1;; +# Switch to connection con1 +SELECT * FROM t1; +a b +1 init+con1 +COMMIT; +SELECT * FROM t1; +a b +1 init+con1 +# Switch to connection con2 +SELECT * FROM t1; +a b +1 init+con1+con2 +# Switch to connection con1 +# 3. test for updated key column: +TRUNCATE t1; +TRUNCATE t2; +INSERT INTO t1 VALUES (1,'init'); +BEGIN; +UPDATE t1 SET a = 2, b = CONCAT(b, '+con1') WHERE a = 1; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +SELECT * FROM t1; +a b +2 init+con1 +# Switch to connection con2 +CALL p1;; +# Switch to connection con1 +SELECT * FROM t1; +a b +2 init+con1 +COMMIT; +SELECT * FROM t1; +a b +2 init+con1 +# Switch to connection con2 +SELECT * FROM t1; +a b +2 init+con1 +DROP PROCEDURE p1; +DROP TABLE t1, t2; diff --git a/mysql-test/r/partition_mgm.result b/mysql-test/r/partition_mgm.result index 465bddcb3fb..a1f35756e21 100644 --- a/mysql-test/r/partition_mgm.result +++ b/mysql-test/r/partition_mgm.result @@ -1,4 +1,11 @@ DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a INT PRIMARY KEY) +ENGINE MYISAM +PARTITION BY HASH (a) +PARTITIONS 1; +INSERT INTO t1 VALUES (1),(2),(3),(4),(5); +ALTER TABLE t1 REORGANIZE PARTITION; +DROP TABLE t1; create table t1 (a int) partition by range (a) subpartition by key (a) diff --git a/mysql-test/r/partition_not_windows.result b/mysql-test/r/partition_not_windows.result index fa22b796a28..42dca557b3e 100644 --- a/mysql-test/r/partition_not_windows.result +++ b/mysql-test/r/partition_not_windows.result @@ -37,20 +37,20 @@ DROP TABLE t1, t2; set @@sql_mode=@org_mode; CREATE TABLE t1(a INT) PARTITION BY KEY (a) -(PARTITION p0 DATA DIRECTORY 'TEST_DIR/master-data/test'); +(PARTITION p0 DATA DIRECTORY 'MYSQLD_DATADIR/test'); ERROR HY000: Incorrect arguments to DATA DIRECTORY CREATE TABLE t1(a INT) PARTITION BY KEY (a) -(PARTITION p0 INDEX DIRECTORY 'TEST_DIR/master-data/test'); +(PARTITION p0 INDEX DIRECTORY 'MYSQLD_DATADIR/test'); ERROR HY000: Incorrect arguments to INDEX DIRECTORY CREATE TABLE ts (id INT, purchased DATE) PARTITION BY RANGE(YEAR(purchased)) SUBPARTITION BY HASH(TO_DAYS(purchased)) ( PARTITION p0 VALUES LESS THAN (1990) ( SUBPARTITION s0a -DATA DIRECTORY = 'TEST_DIR/master-data/test', +DATA DIRECTORY = 'MYSQLD_DATADIR/test', SUBPARTITION s0b -DATA DIRECTORY = 'TEST_DIR/master-data/test' +DATA DIRECTORY = 'MYSQLD_DATADIR/test' )); ERROR HY000: Incorrect arguments to DATA DIRECTORY CREATE TABLE ts (id INT, purchased DATE) @@ -58,9 +58,9 @@ PARTITION BY RANGE(YEAR(purchased)) SUBPARTITION BY HASH(TO_DAYS(purchased)) ( PARTITION p0 VALUES LESS THAN (1990) ( SUBPARTITION s0a -INDEX DIRECTORY = 'TEST_DIR/master-data/test', +INDEX DIRECTORY = 'MYSQLD_DATADIR/test', SUBPARTITION s0b -INDEX DIRECTORY = 'TEST_DIR/master-data/test' +INDEX DIRECTORY = 'MYSQLD_DATADIR/test' )); ERROR HY000: Incorrect arguments to INDEX DIRECTORY DROP TABLE IF EXISTS `example`; diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result index b153ad9ad47..26ddc92e97b 100644 --- a/mysql-test/r/partition_pruning.result +++ b/mysql-test/r/partition_pruning.result @@ -1,4 +1,16 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +CREATE TABLE t1 +(a INT NOT NULL AUTO_INCREMENT, +b DATETIME, +PRIMARY KEY (a,b), +KEY (b)) +PARTITION BY RANGE (to_days(b)) +(PARTITION p0 VALUES LESS THAN (733681) COMMENT = 'LESS THAN 2008-10-01', +PARTITION p1 VALUES LESS THAN (733712) COMMENT = 'LESS THAN 2008-11-01', +PARTITION pX VALUES LESS THAN MAXVALUE); +SELECT a,b FROM t1 WHERE b >= '2008-12-01' AND b < '2009-12-00'; +a b +DROP TABLE t1; create table t1 ( a int not null) partition by hash(a) partitions 2; insert into t1 values (1),(2),(3); explain select * from t1 where a=5 and a=6; diff --git a/mysql-test/r/profiling.result b/mysql-test/r/profiling.result index a9ada576b4b..c96074eb830 100644 --- a/mysql-test/r/profiling.result +++ b/mysql-test/r/profiling.result @@ -11,6 +11,7 @@ select @@profiling; 0 set global profiling = ON; ERROR HY000: Variable 'profiling' is a SESSION variable and can't be used with SET GLOBAL +set @start_value= @@global.profiling_history_size; set global profiling_history_size=100; show global variables like 'profil%'; Variable_name Value @@ -412,4 +413,5 @@ Warnings: Note 1051 Unknown table 'test.v1' drop function if exists f1; set session profiling = OFF; +set global profiling_history_size= @start_value; End of 5.0 tests diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result index c6799c6538e..e2905ea0904 100644 --- a/mysql-test/r/ps_1general.result +++ b/mysql-test/r/ps_1general.result @@ -260,6 +260,7 @@ prepare stmt4 from ' show databases '; execute stmt4; Database information_schema +mtr mysql test prepare stmt4 from ' show tables from test like ''t2%'' '; diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index 44ceb7ac159..69423af3ca5 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -669,7 +669,7 @@ word show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 -load data infile 'MYSQLTEST_VARDIR/std_data_ln/words.dat' into table t1; +load data infile 'MYSQLTEST_VARDIR/std_data/words.dat' into table t1; show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 @@ -1116,12 +1116,13 @@ create procedure `p1`() begin select a, f1() from t1; end// +SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; call p1()// a f1() 1 2 2 2 -SET GLOBAL log_bin_trust_function_creators = 0; +SET GLOBAL log_bin_trust_function_creators = @old_log_bin_trust_function_creators; drop procedure p1// drop function f1// drop table t1// @@ -1615,41 +1616,6 @@ id DROP PROCEDURE proc29856; DROP TABLE t1; SET GLOBAL query_cache_size= default; -Bug#28249 Query Cache returns wrong result with concurrent insert/ certain lock -set GLOBAL query_cache_type=1; -set GLOBAL query_cache_limit=10000; -set GLOBAL query_cache_min_res_unit=0; -set GLOBAL query_cache_size= 100000; -flush tables; -drop table if exists t1, t2; -create table t1 (a int); -create table t2 (a int); -insert into t1 values (1),(2),(3); -Locking table T2 with a write lock. -lock table t2 write; -Select blocked by write lock. -select *, (select count(*) from t2) from t1;; -Sleeing is ok, because selecting should be done very fast. -Inserting into table T1. -insert into t1 values (4); -Unlocking the tables. -unlock tables; -Collecting result from previously blocked select. -Next select should contain 4 rows, as the insert is long finished. -select *, (select count(*) from t2) from t1; -a (select count(*) from t2) -1 0 -2 0 -3 0 -4 0 -reset query cache; -select *, (select count(*) from t2) from t1; -a (select count(*) from t2) -1 0 -2 0 -3 0 -4 0 -drop table t1,t2; # # Bug#25132 disabled query cache: Qcache_free_blocks = 1 # diff --git a/mysql-test/r/query_cache_28249.result b/mysql-test/r/query_cache_28249.result new file mode 100644 index 00000000000..aed84911032 --- /dev/null +++ b/mysql-test/r/query_cache_28249.result @@ -0,0 +1,62 @@ +SET @query_cache_type= @@global.query_cache_type; +SET @query_cache_limit= @@global.query_cache_limit; +SET @query_cache_min_res_unit= @@global.query_cache_min_res_unit; +SET @query_cache_size= @@global.query_cache_size; +# Bug#28249 Query Cache returns wrong result with concurrent insert/ certain lock +# Establish connections user1,user2,user3 (user=root) +# Switch to connection user1 +SET GLOBAL query_cache_type=1; +SET GLOBAL query_cache_limit=10000; +SET GLOBAL query_cache_min_res_unit=0; +SET GLOBAL query_cache_size= 100000; +FLUSH TABLES; +DROP TABLE IF EXISTS t1, t2; +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +# Switch to connection user2 +LOCK TABLE t2 WRITE; +# Switch to connection user1 +# "send" the next select, "reap" the result later. +# The select will be blocked by the write lock on the t1. +SELECT *, (SELECT COUNT(*) FROM t2) FROM t1; +# Switch to connection user3 +# Poll till the select of connection user1 is blocked by the write lock on t1. +SELECT user,command,state,info FROM information_schema.processlist +WHERE state = 'Locked' + AND info = 'SELECT *, (SELECT COUNT(*) FROM t2) FROM t1'; +user command state info +root Query Locked SELECT *, (SELECT COUNT(*) FROM t2) FROM t1 +INSERT INTO t1 VALUES (4); +# Switch to connection user2 +UNLOCK TABLES; +# Switch to connection user1 +# Collecting ("reap") the result from the previously blocked select. +# The printing of the result (varies between 3 and 4 rows) set has to be suppressed. +# Switch to connection user3 +# The next select enforces that effects of "concurrent_inserts" like the +# record with a = 4 is missing in result sets can no more happen. +SELECT 1 FROM t1 WHERE a = 4; +1 +1 +# Switch to connection user1 +# The next result set must contain 4 rows. +SELECT *, (SELECT COUNT(*) FROM t2) FROM t1; +a (SELECT COUNT(*) FROM t2) +1 0 +2 0 +3 0 +4 0 +RESET QUERY CACHE; +SELECT *, (SELECT COUNT(*) FROM t2) FROM t1; +a (SELECT COUNT(*) FROM t2) +1 0 +2 0 +3 0 +4 0 +DROP TABLE t1,t2; +# Switch to connection default + close connections user1,user2,user3 +SET GLOBAL query_cache_type= @query_cache_type; +SET GLOBAL query_cache_limit= @query_cache_limit; +SET GLOBAL query_cache_min_res_unit= @query_cache_min_res_unit; +SET GLOBAL query_cache_size= @query_cache_size; diff --git a/mysql-test/r/query_cache_notembedded.result b/mysql-test/r/query_cache_notembedded.result index ec78c2267d2..64bb40f1d17 100644 --- a/mysql-test/r/query_cache_notembedded.result +++ b/mysql-test/r/query_cache_notembedded.result @@ -314,6 +314,7 @@ drop procedure f2; drop procedure f3; drop procedure f4; drop table t1; +SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; reset query cache; drop function if exists f1; @@ -346,7 +347,7 @@ id drop table t1; drop function f1; set GLOBAL query_cache_size=0; -SET GLOBAL log_bin_trust_function_creators = 0; +SET @@global.log_bin_trust_function_creators = @old_log_bin_trust_function_creators; DROP DATABASE IF EXISTS bug30269; FLUSH STATUS; CREATE DATABASE bug30269; diff --git a/mysql-test/r/rpl_init_slave_func.result b/mysql-test/r/rpl_init_slave_func.result deleted file mode 100644 index 3861f40e7d9..00000000000 --- a/mysql-test/r/rpl_init_slave_func.result +++ /dev/null @@ -1,47 +0,0 @@ -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; -'#--------------------FN_DYNVARS_037_01-------------------------#' -SET @@global.init_slave = "SET @a = 10"; -'connect (con1,localhost,root,,)' -'connection con1' -SELECT @@global.init_slave; -@@global.init_slave -SET @a = 10 -'connection master' -'#--------------------FN_DYNVARS_037_02-------------------------#' -'check if value in slave opt file is executed' -'connection slave' -show variables like 'init_slave'; -Variable_name Value -init_slave set global max_connections=500 -show variables like 'max_connections'; -Variable_name Value -max_connections 500 -reset master; -'check if value in slave opt file doesnt apply to master' -'connection master' -show variables like 'init_slave'; -Variable_name Value -init_slave SET @a = 10 -show variables like 'max_connections'; -Variable_name Value -max_connections 151 -'connection slave' -'try creating a temporary variable in init_slave' -SET @@global.init_slave = "SET @a=5"; -stop slave; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -SHOW VARIABLES LIKE 'init_slave'; -Variable_name Value -init_slave SET @a=5 -SELECT @a; -@a -NULL -'Bug#35365 SET statement in init_slave not execute if slave is restarted' -set global max_connections= default; diff --git a/mysql-test/r/schema.result b/mysql-test/r/schema.result index 538abd8d039..564fb3626df 100644 --- a/mysql-test/r/schema.result +++ b/mysql-test/r/schema.result @@ -7,6 +7,7 @@ show schemas; Database information_schema foo +mtr mysql test drop schema foo; diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 4b2464af688..0519489b715 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -4340,6 +4340,39 @@ Handler_read_prev 0 Handler_read_rnd 0 Handler_read_rnd_next 6 DROP TABLE t1, t2; +CREATE TABLE t1 (f1 bigint(20) NOT NULL default '0', +f2 int(11) NOT NULL default '0', +f3 bigint(20) NOT NULL default '0', +f4 varchar(255) NOT NULL default '', +PRIMARY KEY (f1), +KEY key1 (f4), +KEY key2 (f2)); +CREATE TABLE t2 (f1 int(11) NOT NULL default '0', +f2 enum('A1','A2','A3') NOT NULL default 'A1', +f3 int(11) NOT NULL default '0', +PRIMARY KEY (f1), +KEY key1 (f3)); +CREATE TABLE t3 (f1 bigint(20) NOT NULL default '0', +f2 datetime NOT NULL default '1980-01-01 00:00:00', +PRIMARY KEY (f1)); +insert into t1 values (1, 1, 1, 'abc'); +insert into t1 values (2, 1, 2, 'def'); +insert into t1 values (3, 1, 2, 'def'); +insert into t2 values (1, 'A1', 1); +insert into t3 values (1, '1980-01-01'); +SELECT a.f3, cr.f4, count(*) count +FROM t2 a +STRAIGHT_JOIN t1 cr ON cr.f2 = a.f1 +LEFT JOIN +(t1 cr2 +JOIN t3 ae2 ON cr2.f3 = ae2.f1 +) ON a.f1 = cr2.f2 AND ae2.f2 < now() - INTERVAL 7 DAY AND +cr.f4 = cr2.f4 +GROUP BY a.f3, cr.f4; +f3 f4 count +1 abc 1 +1 def 2 +drop table t1, t2, t3; End of 5.0 tests create table t1(a INT, KEY (a)); INSERT INTO t1 VALUES (1),(2),(3),(4),(5); @@ -4358,3 +4391,29 @@ a 4 5 DROP TABLE t1; +CREATE TABLE A (date_key date); +CREATE TABLE C ( +pk int, +int_nokey int, +int_key int, +date_key date NOT NULL, +date_nokey date, +varchar_key varchar(1) +); +INSERT INTO C VALUES +(1,1,1,'0000-00-00',NULL,NULL), +(1,1,1,'0000-00-00',NULL,NULL); +SELECT 1 FROM C WHERE pk > ANY (SELECT 1 FROM C); +1 +SELECT COUNT(DISTINCT 1) FROM C +WHERE date_key = (SELECT 1 FROM A WHERE C.date_key IS NULL) GROUP BY pk; +COUNT(DISTINCT 1) +SELECT date_nokey FROM C +WHERE int_key IN (SELECT 1 FROM A) +HAVING date_nokey = '10:41:7' +ORDER BY date_key; +date_nokey +Warnings: +Warning 1292 Incorrect date value: '10:41:7' for column 'date_nokey' at row 1 +DROP TABLE A,C; +End of 5.1 tests diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index d054e5cdc05..2051939e4b6 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -140,6 +140,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def SCHEMATA SCHEMA_NAME Database 253 64 18 N 1 0 8 Database information_schema +mtr mysql test show databases like "test%"; diff --git a/mysql-test/r/sp-destruct.result b/mysql-test/r/sp-destruct.result index ae294f05b25..d7d44061b76 100644 --- a/mysql-test/r/sp-destruct.result +++ b/mysql-test/r/sp-destruct.result @@ -84,7 +84,7 @@ drop table t1; drop function bug14233_1; drop function bug14233_2; drop procedure bug14233_3; -show procedure status; +show procedure status where db=DATABASE(); Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation -show function status; +show function status where db=DATABASE(); Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 2f8f71077a6..3def6536897 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -1,4 +1,5 @@ drop table if exists t1, t2; +SELECT * FROM mysql.proc INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/proc.txt'; delete from mysql.proc; create procedure syntaxerror(t int)| ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 @@ -1658,3 +1659,4 @@ begin declare continue handler for sqlstate '00000' set @x=0; end$$ ERROR 42000: Bad SQLSTATE: '00000' +LOAD DATA INFILE '../../tmp/proc.txt' INTO TABLE mysql.proc; diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result index cf26f0076d7..66177395ac9 100644 --- a/mysql-test/r/sp-security.result +++ b/mysql-test/r/sp-security.result @@ -142,13 +142,13 @@ use db2; alter procedure q modifies sql data; drop procedure q; use test; -select type,db,name from mysql.proc; +select type,db,name from mysql.proc where db like 'db%'; type db name FUNCTION db1_secret db PROCEDURE db1_secret stamp drop database db1_secret; drop database db2; -select type,db,name from mysql.proc; +select type,db,name from mysql.proc where db like 'db%'; type db name delete from mysql.user where user='user1' or user='user2'; delete from mysql.user where user='' and host='%'; diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 6b58b939a07..01ddde56450 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -544,7 +544,7 @@ drop procedure if exists into_outfile| create procedure into_outfile(x char(16), y int) begin insert into test.t1 values (x, y); -select * into outfile "../tmp/spout" from test.t1; +select * into outfile "MYSQLTEST_VARDIR/tmp/spout" from test.t1; insert into test.t1 values (concat(x, "2"), y+2); end| call into_outfile("ofile", 1)| @@ -554,7 +554,7 @@ drop procedure if exists into_dumpfile| create procedure into_dumpfile(x char(16), y int) begin insert into test.t1 values (x, y); -select * into dumpfile "../tmp/spdump" from test.t1 limit 1; +select * into dumpfile "MYSQLTEST_VARDIR/tmp/spdump" from test.t1 limit 1; insert into test.t1 values (concat(x, "2"), y+2); end| call into_dumpfile("dfile", 1)| @@ -1322,7 +1322,7 @@ end; end if; end loop; end latin1 latin1_swedish_ci latin1_swedish_ci -show procedure status like '%p%'| +show procedure status where name like '%p%' and db='test'| Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation test ip PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci test opp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci @@ -1335,7 +1335,7 @@ i p drop table t3| drop procedure opp| drop procedure ip| -show procedure status like '%p%'| +show procedure status where name like '%p%' and db='test'| Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation drop table if exists t3| create table t3 ( f bigint unsigned not null )| @@ -1945,12 +1945,12 @@ drop procedure bug2260| drop procedure if exists bug2267_1| create procedure bug2267_1() begin -show procedure status; +show procedure status where db='test'; end| drop procedure if exists bug2267_2| create procedure bug2267_2() begin -show function status; +show function status where db='test'; end| drop procedure if exists bug2267_3| create procedure bug2267_3() @@ -1977,7 +1977,7 @@ call bug2267_3()| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation bug2267_1 CREATE DEFINER=`root`@`localhost` PROCEDURE `bug2267_1`() begin -show procedure status; +show procedure status where db='test'; end latin1 latin1_swedish_ci latin1_swedish_ci call bug2267_4()| Function sql_mode Create Function character_set_client collation_connection Database Collation @@ -4342,9 +4342,9 @@ drop procedure if exists bug13012| create procedure bug13012() BEGIN REPAIR TABLE t1; -BACKUP TABLE t1 to '../tmp'; +BACKUP TABLE t1 to '../../tmp'; DROP TABLE t1; -RESTORE TABLE t1 FROM '../tmp'; +RESTORE TABLE t1 FROM '../../tmp'; END| call bug13012()| Table Op Msg_type Msg_text diff --git a/mysql-test/r/status.result b/mysql-test/r/status.result index 1e758ce68c7..b76109a3d0e 100644 --- a/mysql-test/r/status.result +++ b/mysql-test/r/status.result @@ -209,4 +209,31 @@ ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table ' drop database db37908; drop procedure proc37908; drop function func37908; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; +DROP USER mysqltest_1@localhost; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +CREATE FUNCTION f1() RETURNS INTEGER +BEGIN +DECLARE foo INTEGER; +DECLARE bar INTEGER; +SET foo=1; +SET bar=2; +RETURN foo; +END $$ +CREATE PROCEDURE p1() +BEGIN +SELECT 1; +END $$ +SELECT f1(); +f1() +1 +CALL p1(); +1 +1 +SELECT 9; +9 +9 +DROP PROCEDURE p1; +DROP FUNCTION f1; set @@global.concurrent_insert= @old_concurrent_insert; diff --git a/mysql-test/r/status2.result b/mysql-test/r/status2.result new file mode 100644 index 00000000000..146fb2adbaf --- /dev/null +++ b/mysql-test/r/status2.result @@ -0,0 +1,73 @@ +# +# Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines +# +FLUSH STATUS; +CREATE FUNCTION testQuestion() RETURNS INTEGER +BEGIN +DECLARE foo INTEGER; +DECLARE bar INTEGER; +SET foo=1; +SET bar=2; +RETURN foo; +END $$ +CREATE PROCEDURE testQuestion2() +BEGIN +SELECT 1; +END $$ +DROP TABLE IF EXISTS t1,t2; +CREATE TABLE t1 (c1 INT); +CREATE TABLE t2 (c1 INT); +CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND +DO INSERT INTO t1 VALUES(1); +Assert Questions == 7 +SHOW STATUS LIKE 'Questions'; +Variable_name Value +Questions 7 +SELECT testQuestion(); +testQuestion() +1 +Assert Questions == 9 +SHOW STATUS LIKE 'Questions'; +Variable_name Value +Questions 9 +CALL testQuestion2(); +1 +1 +Assert Questions == 11 +SHOW STATUS LIKE 'Questions'; +Variable_name Value +Questions 11 +SELECT 1; +1 +1 +Assert Questions == 13 +SHOW STATUS LIKE 'Questions'; +Variable_name Value +Questions 13 +SELECT 1; +1 +1 +Assert Questions == 14 +SHOW STATUS LIKE 'Questions'; +Variable_name Value +Questions 14 +CREATE TRIGGER trigg1 AFTER INSERT ON t1 +FOR EACH ROW BEGIN +INSERT INTO t2 VALUES (1); +END; +$$ +Assert Questions == 16 +SHOW STATUS LIKE 'Questions'; +Variable_name Value +Questions 16 +INSERT INTO t1 VALUES (1); +Assert Questions == 18 +SHOW STATUS LIKE 'Questions'; +Variable_name Value +Questions 18 +DROP PROCEDURE testQuestion2; +DROP TRIGGER trigg1; +DROP FUNCTION testQuestion; +DROP EVENT ev1; +DROP TABLE t1,t2; +End of 6.0 tests diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index a257d0a8648..1255284f4fe 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -1347,6 +1347,13 @@ t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='123456789*123456789*123456789*123456789*123456789*123456789*' drop table t1; +CREATE TABLE t3 (f1 INT) COMMENT 'כקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחן'; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `f1` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='כקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחן' +DROP TABLE t3; set sql_mode= 'traditional'; create table t1(col1 tinyint, col2 tinyint unsigned, col3 smallint, col4 smallint unsigned, diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index f91147ea0a6..1bf223ceef8 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -1658,9 +1658,9 @@ SELECT DISTINCT (SELECT a) FROM t1 LIMIT 100; DROP TABLE t1; create table t1 (a int, b decimal(13, 3)); insert into t1 values (1, 0.123); -select a, (select max(b) from t1) into outfile "subselect.out.file.1" from t1; +select a, (select max(b) from t1) into outfile "../../tmp/subselect.out.file.1" from t1; delete from t1; -load data infile "subselect.out.file.1" into table t1; +load data infile "../../tmp/subselect.out.file.1" into table t1; select * from t1; a b 1 0.123 diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result index 03bdeaceb58..245dcec04da 100644 --- a/mysql-test/r/symlink.result +++ b/mysql-test/r/symlink.result @@ -147,16 +147,16 @@ CREATE TABLE t1 (a INT) ENGINE MYISAM; DROP TABLE t1; End of 5.0 tests CREATE TABLE t1(a INT) -INDEX DIRECTORY='TEST_DIR/master-data/mysql'; +INDEX DIRECTORY='MYSQLD_DATADIR/mysql'; DROP TABLE IF EXISTS t1; CREATE TABLE t1(a INT) -DATA DIRECTORY='TEST_DIR/master-data/test'; +DATA DIRECTORY='MYSQLD_DATADIR/test'; DROP TABLE IF EXISTS t1; CREATE TABLE t1(a INT) -DATA DIRECTORY='TEST_DIR/master-data/'; +DATA DIRECTORY='MYSQLD_DATADIR/'; DROP TABLE IF EXISTS t1; CREATE TABLE t1(a INT) -INDEX DIRECTORY='TEST_DIR/master-data'; +INDEX DIRECTORY='MYSQLD_DATADIR'; DROP TABLE IF EXISTS t1; CREATE TABLE t1(a INT) INDEX DIRECTORY='TEST_DIR/master-data_var'; diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index 171b53ebf09..0106c9459e7 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -1,4 +1,3 @@ -drop table if exists t1,t1aa,t2aa; show tables; Tables_in_db columns_priv diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result index 6df09463d02..ba6b9f81a2d 100644 --- a/mysql-test/r/temp_table.result +++ b/mysql-test/r/temp_table.result @@ -194,4 +194,20 @@ DELETE FROM t1; SELECT * FROM t1; a b DROP TABLE t1; +DROP TABLE IF EXISTS t1,t2; +DROP FUNCTION IF EXISTS f1; +CREATE TEMPORARY TABLE t1 (a INT); +CREATE TEMPORARY TABLE t2 LIKE t1; +CREATE FUNCTION f1() RETURNS INT +BEGIN +return 1; +END| +INSERT INTO t2 SELECT * FROM t1; +INSERT INTO t1 SELECT f1(); +CREATE TABLE t3 SELECT * FROM t1; +INSERT INTO t1 SELECT f1(); +UPDATE t1,t2 SET t1.a = t2.a; +INSERT INTO t2 SELECT f1(); +DROP TABLE t1,t2,t3; +DROP FUNCTION f1; End of 5.1 tests diff --git a/mysql-test/r/timezone2.result b/mysql-test/r/timezone2.result index ed15172a0e9..2948bb8ecec 100644 --- a/mysql-test/r/timezone2.result +++ b/mysql-test/r/timezone2.result @@ -269,6 +269,7 @@ select * from t1; convert_tz(NULL, NULL, NULL) NULL drop table t1; +SET @old_log_bin_trust_function_creators = @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; create table t1 (ldt datetime, udt datetime); create function f1(i datetime) returns datetime @@ -284,7 +285,7 @@ ldt ldt2 2006-04-19 16:30:00 2006-04-19 16:30:00 drop table t1; drop function f1; -SET GLOBAL log_bin_trust_function_creators = 0; +SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; DROP TABLE IF EXISTS t1; CREATE TABLE t1 (t TIMESTAMP); INSERT INTO t1 VALUES (NULL), (NULL); diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index 35d5134fa6b..2290919f191 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -406,13 +406,13 @@ create table t1 (i int, j int, k int); create trigger trg1 before insert on t1 for each row set new.k = new.i; create trigger trg2 after insert on t1 for each row set @b:= "Fired"; set @b:=""; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, i); +load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, i); select *, @b from t1; i j k @b 10 NULL 10 Fired 15 NULL 15 Fired set @b:=""; -load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, j); +load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, j); select *, @b from t1; i j k @b 10 NULL 10 Fired @@ -449,7 +449,7 @@ ERROR 42S22: Unknown column 'at' in 'OLD' select * from t1; i k 1 1 -load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k); +load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k); ERROR 42S22: Unknown column 'at' in 'NEW' select * from t1; i k @@ -524,7 +524,7 @@ select * from t1; i k 1 1 2 2 -load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k); +load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k); ERROR 42S22: Unknown column 'bt' in 'NEW' select * from t1; i k @@ -997,7 +997,7 @@ insert into t1 (a) values create trigger t2_ai after insert on t2 for each row set @a:= (select max(a) from t2); insert into t2 select * from t1; -load data infile '../std_data_ln/words.dat' into table t1 (a); +load data infile '../../std_data/words.dat' into table t1 (a); drop trigger t1_ai; drop trigger t2_ai; create function f1() returns int return (select max(b) from t1); @@ -1006,7 +1006,7 @@ insert into t1 values ("And",f1()),("the",f1()),("mome", f1()),("raths",f1()),("outgrabe",f1()); create function f2() returns int return (select max(b) from t2); insert into t2 select a, f2() from t1; -load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1(); +load data infile '../../std_data/words.dat' into table t1 (a) set b:= f1(); drop function f1; drop function f2; drop table t1, t2; diff --git a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result index 782cddaeff7..b831771d9c5 100644 --- a/mysql-test/r/type_bit.result +++ b/mysql-test/r/type_bit.result @@ -708,6 +708,47 @@ HEX(b1) HEX(b2) i2 1 0 100 1 0 200 DROP TABLE t1, t2; +CREATE TABLE IF NOT EXISTS t1 ( +f1 bit(2) NOT NULL default b'10', +f2 bit(14) NOT NULL default b'11110000111100' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` bit(2) NOT NULL DEFAULT b'10', + `f2` bit(14) NOT NULL DEFAULT b'11110000111100' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci +DROP TABLE t1; +CREATE TABLE IF NOT EXISTS t1 ( +f1 bit(2) NOT NULL default b'' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; +ERROR 42000: Invalid default value for 'f1' +create table t1bit7 (a1 bit(7) not null) engine=MyISAM; +create table t2bit7 (b1 bit(7)) engine=MyISAM; +insert into t1bit7 values (b'1100000'); +insert into t1bit7 values (b'1100001'); +insert into t1bit7 values (b'1100010'); +insert into t2bit7 values (b'1100001'); +insert into t2bit7 values (b'1100010'); +insert into t2bit7 values (b'1100110'); +select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1; +bin(a1) +1100001 +1100010 +drop table t1bit7, t2bit7; +create table t1bit7 (a1 bit(15) not null) engine=MyISAM; +create table t2bit7 (b1 bit(15)) engine=MyISAM; +insert into t1bit7 values (b'110000011111111'); +insert into t1bit7 values (b'110000111111111'); +insert into t1bit7 values (b'110001011111111'); +insert into t2bit7 values (b'110000111111111'); +insert into t2bit7 values (b'110001011111111'); +insert into t2bit7 values (b'110011011111111'); +select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1; +bin(a1) +110000111111111 +110001011111111 +drop table t1bit7, t2bit7; End of 5.0 tests create table t1(a bit(7)); insert into t1 values(0x40); diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index 90857269c5c..a80adab1f87 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -507,25 +507,25 @@ Warnings: Warning 1101 BLOB/TEXT column 'imagem' can't have a default value insert into t1 (id) values (1); select -charset(load_file('../std_data_ln/words.dat')), -collation(load_file('../std_data_ln/words.dat')), -coercibility(load_file('../std_data_ln/words.dat')); -charset(load_file('../std_data_ln/words.dat')) collation(load_file('../std_data_ln/words.dat')) coercibility(load_file('../std_data_ln/words.dat')) +charset(load_file('../../std_data/words.dat')), +collation(load_file('../../std_data/words.dat')), +coercibility(load_file('../../std_data/words.dat')); +charset(load_file('../../std_data/words.dat')) collation(load_file('../../std_data/words.dat')) coercibility(load_file('../../std_data/words.dat')) binary binary 4 explain extended select -charset(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')), -collation(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')), -coercibility(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')); +charset(load_file('MYSQLTEST_VARDIR/std_data/words.dat')), +collation(load_file('MYSQLTEST_VARDIR/std_data/words.dat')), +coercibility(load_file('MYSQLTEST_VARDIR/std_data/words.dat')); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select charset(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `charset(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`,collation(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `collation(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`,coercibility(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `coercibility(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))` -update t1 set imagem=load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat') where id=1; +Note 1003 select charset(load_file('MYSQLTEST_VARDIR/std_data/words.dat')) AS `charset(load_file('MYSQLTEST_VARDIR/std_data/words.dat'))`,collation(load_file('MYSQLTEST_VARDIR/std_data/words.dat')) AS `collation(load_file('MYSQLTEST_VARDIR/std_data/words.dat'))`,coercibility(load_file('MYSQLTEST_VARDIR/std_data/words.dat')) AS `coercibility(load_file('MYSQLTEST_VARDIR/std_data/words.dat'))` +update t1 set imagem=load_file('MYSQLTEST_VARDIR/std_data/words.dat') where id=1; select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1; if(imagem is null, "ERROR", "OK") length(imagem) OK 581 drop table t1; -create table t1 select load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat') l; +create table t1 select load_file('MYSQLTEST_VARDIR/std_data/words.dat') l; show full fields from t1; Field Type Collation Null Key Default Extra Privileges Comment l longblob NULL YES NULL # diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index 7cb71831bce..f96e07b0c5e 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -65,12 +65,15 @@ CREATE TABLE t1(AFIELD INT); INSERT INTO t1 VALUES(1); CREATE TABLE t2(GMT VARCHAR(32)); INSERT INTO t2 VALUES('GMT-0800'); -SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1, t2 GROUP BY t1.AFIELD; -DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) +SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) +FROM t1, t2 GROUP BY t1.AFIELD; +DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) Wed, 06 March 2002 10:11:12 GMT-0800 INSERT INTO t1 VALUES(1); -SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)), DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1,t2 GROUP BY t1.AFIELD; -DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) +SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)), +DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) +FROM t1,t2 GROUP BY t1.AFIELD; +DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) Wed, 06 March 2002 10:11:12 GMT-0800 Wed, 06 March 2002 10:11:12 GMT-0800 drop table t1,t2; CREATE TABLE t1 (f1 time default NULL, f2 time default NULL); @@ -155,7 +158,7 @@ str_to_date( '', a ) 0000-00-00 00:00:00 NULL DROP TABLE t1; -CREATE TABLE t1 (a DATE, b int, PRIMARY KEY (a,b)); +CREATE TABLE t1 (a DATE, b INT, PRIMARY KEY (a,b)); INSERT INTO t1 VALUES (DATE(NOW()), 1); SELECT COUNT(*) FROM t1 WHERE a = NOW(); COUNT(*) diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index 6fbc8268a64..d4cfd1c04ed 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -392,4 +392,13 @@ f1 + 0e0 1.0000000150475e+30 -1.0000000150475e+30 drop table t1; +create table t1(d double, u bigint unsigned); +insert into t1(d) values (9.22337203685479e18), +(1.84e19); +update t1 set u = d; +select u from t1; +u +9223372036854790144 +18400000000000000000 +drop table t1; End of 5.0 tests diff --git a/mysql-test/r/user_var-binlog.result b/mysql-test/r/user_var-binlog.result index 3a7d59798ae..05efea79fe7 100644 --- a/mysql-test/r/user_var-binlog.result +++ b/mysql-test/r/user_var-binlog.result @@ -22,7 +22,7 @@ SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`/*!*/; use test/*!*/; SET TIMESTAMP=10000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/r/variables-notembedded.result b/mysql-test/r/variables-notembedded.result index 571b6605674..c9125bcee90 100644 --- a/mysql-test/r/variables-notembedded.result +++ b/mysql-test/r/variables-notembedded.result @@ -15,6 +15,7 @@ slave_skip_errors 3,100,137,643,1752 ---- Clean Up ---- set global slave_net_timeout=default; set global sql_slave_skip_counter= 0; +set @@global.slave_net_timeout= @my_slave_net_timeout; # SHOW VARIABLES like 'log_slave_updates'; diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index ac78d8e1871..a393c7eb338 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -15,6 +15,7 @@ set @my_max_heap_table_size =@@global.max_heap_table_size; set @my_max_insert_delayed_threads=@@global.max_insert_delayed_threads; set @my_max_join_size =@@global.max_join_size; set @my_myisam_data_pointer_size =@@global.myisam_data_pointer_size; +set @my_myisam_max_sort_file_size =@@global.myisam_max_sort_file_size; set @my_net_buffer_length =@@global.net_buffer_length; set @my_net_write_timeout =@@global.net_write_timeout; set @my_net_read_timeout =@@global.net_read_timeout; @@ -975,7 +976,7 @@ set global delayed_queue_size =@my_delayed_queue_size; set global flush =@my_flush; set global flush_time =@my_flush_time; set global key_buffer_size =@my_key_buffer_size; -set global max_binlog_cache_size =default; +set global max_binlog_cache_size =@my_max_binlog_cache_size; set global max_binlog_size =@my_max_binlog_size; set global max_connect_errors =@my_max_connect_errors; set global max_connections =@my_max_connections; @@ -986,6 +987,7 @@ set global max_join_size =@my_max_join_size; set global max_user_connections =default; set global max_write_lock_count =default; set global myisam_data_pointer_size =@my_myisam_data_pointer_size; +set global myisam_max_sort_file_size =@my_myisam_max_sort_file_size; set global net_buffer_length =@my_net_buffer_length; set global net_write_timeout =@my_net_write_timeout; set global net_read_timeout =@my_net_read_timeout; @@ -996,6 +998,7 @@ set global server_id =@my_server_id; set global slow_launch_time =@my_slow_launch_time; set global storage_engine =@my_storage_engine; set global thread_cache_size =@my_thread_cache_size; +set global max_allowed_packet = default; show global variables where Variable_name='table_definition_cache' or Variable_name='table_lock_wait_timeout'; Variable_name Value diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 2fefa21eaca..38d05ae84fe 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -1314,7 +1314,7 @@ drop view v2, v1; drop table t1; create table t1 (a int, b char(10)); create view v1 as select * from t1 where a != 0 with check option; -load data infile '../std_data_ln/loaddata3.dat' into table v1 fields terminated by '' enclosed by '' ignore 1 lines; +load data infile '../../std_data/loaddata3.dat' into table v1 fields terminated by '' enclosed by '' ignore 1 lines; ERROR HY000: CHECK OPTION failed 'test.v1' select * from t1; a b @@ -1325,7 +1325,7 @@ a b 1 row 1 2 row 2 delete from t1; -load data infile '../std_data_ln/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines; +load data infile '../../std_data/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines; Warnings: Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3 Error 1369 CHECK OPTION failed 'test.v1' @@ -1345,14 +1345,14 @@ drop view v1; drop table t1; create table t1 (a text, b text); create view v1 as select * from t1 where a <> 'Field A' with check option; -load data infile '../std_data_ln/loaddata2.dat' into table v1 fields terminated by ',' enclosed by ''''; +load data infile '../../std_data/loaddata2.dat' into table v1 fields terminated by ',' enclosed by ''''; ERROR HY000: CHECK OPTION failed 'test.v1' select concat('|',a,'|'), concat('|',b,'|') from t1; concat('|',a,'|') concat('|',b,'|') select concat('|',a,'|'), concat('|',b,'|') from v1; concat('|',a,'|') concat('|',b,'|') delete from t1; -load data infile '../std_data_ln/loaddata2.dat' ignore into table v1 fields terminated by ',' enclosed by ''''; +load data infile '../../std_data/loaddata2.dat' ignore into table v1 fields terminated by ',' enclosed by ''''; Warnings: Error 1369 CHECK OPTION failed 'test.v1' Warning 1261 Row 2 doesn't contain data for all columns diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index 090ac1340ea..7629a1d79a3 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -70,7 +70,7 @@ select @@warning_count; 1 drop table t1; create table t1(a tinyint, b int not null, c date, d char(5)); -load data infile '../std_data_ln/warnings_loaddata.dat' into table t1 fields terminated by ','; +load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated by ','; Warnings: Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 2 Warning 1265 Data truncated for column 'd' at row 3 diff --git a/mysql-test/r/warnings_engine_disabled.result b/mysql-test/r/warnings_engine_disabled.result index aa6170a60a7..e5d35fdaa5f 100644 --- a/mysql-test/r/warnings_engine_disabled.result +++ b/mysql-test/r/warnings_engine_disabled.result @@ -1,7 +1,15 @@ create table t1 (id int) engine=NDB; Warnings: +Warning 1286 Unknown table engine 'NDB' Warning 1266 Using storage engine MyISAM for table 't1' alter table t1 engine=NDB; Warnings: -Warning 1266 Using storage engine MyISAM for table 't1' +Warning 1286 Unknown table engine 'NDB' drop table t1; +SELECT ENGINE, SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='ndbcluster'; +ENGINE SUPPORT +ndbcluster NO +SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE +PLUGIN_NAME='ndbcluster'; +PLUGIN_NAME PLUGIN_STATUS +ndbcluster DISABLED diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result index 56c884343e3..41c0d6bee21 100644 --- a/mysql-test/r/xml.result +++ b/mysql-test/r/xml.result @@ -1029,4 +1029,28 @@ SELECT 1 FROM t1 ORDER BY(UPDATEXML(a, '1', '1')); 1 1 DROP TABLE t1; +SET @xml= +'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> + <head> + <title> Title - document with document declaration</title> + </head> + <body> Hi, Im a webpage with document a declaration </body> +</html>'; +SELECT ExtractValue(@xml, 'html/head/title'); +ExtractValue(@xml, 'html/head/title') + Title - document with document declaration +SELECT ExtractValue(@xml, 'html/body'); +ExtractValue(@xml, 'html/body') + Hi, Im a webpage with document a declaration +SELECT ExtractValue('<xml "xxx" "yyy">CharData</xml>', '/xml'); +ExtractValue('<xml "xxx" "yyy">CharData</xml>', '/xml') +NULL +Warnings: +Warning 1525 Incorrect XML value: 'parse error at line 1 pos 11: STRING unexpected ('>' wanted)' +SELECT ExtractValue('<xml xxx "yyy">CharData</xml>', '/xml'); +ExtractValue('<xml xxx "yyy">CharData</xml>', '/xml') +NULL +Warnings: +Warning 1525 Incorrect XML value: 'parse error at line 1 pos 17: STRING unexpected ('>' wanted)' End of 5.1 tests diff --git a/mysql-test/resolve-stack b/mysql-test/resolve-stack deleted file mode 100755 index cdbe362c752..00000000000 --- a/mysql-test/resolve-stack +++ /dev/null @@ -1,8 +0,0 @@ -#! /bin/sh -# A shortcut for resolving stacks when debugging when -# we cannot duplicate the crash in a debugger and have to -# resort to using stack traces - -nm --numeric-sort ../sql/mysqld > var/tmp/mysqld.sym -echo "Please type or paste the numeric stack trace,Ctrl-C to quit:" -../extra/resolve_stack_dump -s var/tmp/mysqld.sym diff --git a/mysql-test/std_data/bug40482-bin.000001 b/mysql-test/std_data/bug40482-bin.000001 Binary files differnew file mode 100644 index 00000000000..d001bf664c7 --- /dev/null +++ b/mysql-test/std_data/bug40482-bin.000001 diff --git a/mysql-test/std_data/ndb_config_config.ini b/mysql-test/std_data/ndb_config_config.ini new file mode 100644 index 00000000000..c325952d322 --- /dev/null +++ b/mysql-test/std_data/ndb_config_config.ini @@ -0,0 +1,55 @@ +[ndbd default] +NoOfReplicas= 2 +MaxNoOfConcurrentTransactions= 64 +MaxNoOfConcurrentOperations= 10000 +DataMemory= 20M +IndexMemory= 1M +Diskless= 0 +TimeBetweenWatchDogCheck= 30000 +DataDir= /data/msvensson/mysql/mysql-5.1-new-maint/mysql-test/var/ndbcluster-10095 +MaxNoOfOrderedIndexes= 32 +MaxNoOfAttributes= 2048 +TimeBetweenGlobalCheckpoints= 500 +NoOfFragmentLogFiles= 4 +FragmentLogFileSize=12M +DiskPageBufferMemory= 4M +# O_DIRECT has issues on 2.4 whach have not been handled, Bug #29612 +#ODirect= 1 +# the following parametes just function as a small regression +# test that the parameter exists +InitialNoOfOpenFiles= 27 + +# +# Increase timeouts to cater for slow test-machines +# (possibly running several tests in parallell) +# +HeartbeatIntervalDbDb= 30000 +HeartbeatIntervalDbApi= 30000 +#TransactionDeadlockDetectionTimeout= 7500 + +[ndbd] +HostName= localhost + +[ndbd] +HostName= localhost + +[ndb_mgmd] +HostName= localhost +DataDir= /data/msvensson/mysql/mysql-5.1-new-maint/mysql-test/var/ndbcluster-10095 # +PortNumber= 10095 + +[mysqld] + +[mysqld] + +[mysqld] + +[mysqld] + +[mysqld] + +[mysqld] + +[mysqld] + +[mysqld] diff --git a/mysql-test/suite/rpl/data/rpl_bug28618.dat b/mysql-test/std_data/rpl_bug28618.dat index b800c4dd39d..b800c4dd39d 100644 --- a/mysql-test/suite/rpl/data/rpl_bug28618.dat +++ b/mysql-test/std_data/rpl_bug28618.dat diff --git a/mysql-test/suite/rpl/data/rpl_mixed.dat b/mysql-test/std_data/rpl_mixed.dat index 131c57750cc..131c57750cc 100644 --- a/mysql-test/suite/rpl/data/rpl_mixed.dat +++ b/mysql-test/std_data/rpl_mixed.dat diff --git a/mysql-test/suite/binlog/combinations b/mysql-test/suite/binlog/combinations index ea25611a5d4..07042c2cbec 100644 --- a/mysql-test/suite/binlog/combinations +++ b/mysql-test/suite/binlog/combinations @@ -1,8 +1,8 @@ [row] ---binlog-format=row +binlog-format=row [stmt] ---binlog-format=statement +binlog-format=statement [mix] ---binlog-format=mixed +binlog-format=mixed diff --git a/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result b/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result index 68f1f0b2566..8df0568a755 100644 --- a/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result +++ b/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result @@ -1,3 +1,4 @@ +SET @old_relay_log_purge= @@global.relay_log_purge; change master to MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='slave-relay-bin.000001', @@ -37,3 +38,4 @@ DROP PROCEDURE IF EXISTS p2; DROP FUNCTION IF EXISTS f1; DROP TRIGGER IF EXISTS tr1; stop slave sql_thread; +SET @@global.relay_log_purge= @old_relay_log_purge; diff --git a/mysql-test/suite/binlog/r/binlog_base64_flag.result b/mysql-test/suite/binlog/r/binlog_base64_flag.result index fbc2b8344ee..58c444c9571 100644 --- a/mysql-test/suite/binlog/r/binlog_base64_flag.result +++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result @@ -37,7 +37,7 @@ DELIMITER /*!*/; # at 102 <#>use test/*!*/; SET TIMESTAMP=1196959712/*!*/; -<#>SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +<#>SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/suite/binlog/r/binlog_database.result b/mysql-test/suite/binlog/r/binlog_database.result index 3b470fe11af..8dbe0f21852 100644 --- a/mysql-test/suite/binlog/r/binlog_database.result +++ b/mysql-test/suite/binlog/r/binlog_database.result @@ -33,6 +33,7 @@ master-bin.000001 # Query # # use `test`; insert into t1 values (1) master-bin.000001 # Query # # drop database if exists mysqltest1 master-bin.000001 # Query # # use `test`; insert into t1 values (1) master-bin.000001 # Query # # use `test`; drop table tt1, t1 +FLUSH STATUS; set binlog_format=mixed; reset master; create database testing_1; @@ -68,6 +69,7 @@ master-bin.000001 # Query # # use `test`; insert into t1 values (1) master-bin.000001 # Query # # drop database if exists mysqltest1 master-bin.000001 # Query # # use `test`; insert into t1 values (1) master-bin.000001 # Query # # use `test`; drop table tt1, t1 +FLUSH STATUS; set binlog_format=row; reset master; create database testing_1; @@ -108,8 +110,10 @@ master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ +FLUSH STATUS; show databases; Database information_schema +mtr mysql test diff --git a/mysql-test/r/binlog_index.result b/mysql-test/suite/binlog/r/binlog_index.result index 9f3c3746bd4..d49ceb00501 100644 --- a/mysql-test/r/binlog_index.result +++ b/mysql-test/suite/binlog/r/binlog_index.result @@ -9,7 +9,7 @@ master-bin.000003 # master-bin.000004 # purge binary logs TO 'master-bin.000004'; Warnings: -Warning 1612 Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found +Warning 1612 Being purged log master-bin.000001 was not found *** must show a list starting from the 'TO' argument of PURGE *** show binary logs; Log_name File_size @@ -20,7 +20,8 @@ flush logs; flush logs; *** must be a warning master-bin.000001 was not found *** Warnings: -Warning 1612 Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found +Warning 1612 Being purged log master-bin.000001 was not found +Warning 1612 Being purged log master-bin.000001 was not found *** must show one record, of the active binlog, left in the index file after PURGE *** show binary logs; Log_name File_size @@ -33,7 +34,7 @@ purge binary logs TO 'master-bin.000002'; ERROR HY000: Fatal error during log purge show warnings; Level Code Message -Error 1377 a problem with deleting MYSQLTEST_VARDIR/log/master-bin.000001; consider examining correspondence of your binlog index file to the actual binlog files +Error 1377 a problem with deleting master-bin.000001; consider examining correspondence of your binlog index file to the actual binlog files Error 1377 Fatal error during log purge reset master; End of tests diff --git a/mysql-test/suite/binlog/r/binlog_innodb.result b/mysql-test/suite/binlog/r/binlog_innodb.result index adc90d007bd..919ac33ef35 100644 --- a/mysql-test/suite/binlog/r/binlog_innodb.result +++ b/mysql-test/suite/binlog/r/binlog_innodb.result @@ -113,16 +113,17 @@ master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ DROP TABLE t1; +flush status; show status like "binlog_cache_use"; Variable_name Value -Binlog_cache_use 15 +Binlog_cache_use 0 show status like "binlog_cache_disk_use"; Variable_name Value Binlog_cache_disk_use 0 create table t1 (a int) engine=innodb; show status like "binlog_cache_use"; Variable_name Value -Binlog_cache_use 16 +Binlog_cache_use 1 show status like "binlog_cache_disk_use"; Variable_name Value Binlog_cache_disk_use 1 @@ -131,7 +132,7 @@ delete from t1; commit; show status like "binlog_cache_use"; Variable_name Value -Binlog_cache_use 17 +Binlog_cache_use 2 show status like "binlog_cache_disk_use"; Variable_name Value Binlog_cache_disk_use 1 diff --git a/mysql-test/suite/binlog/r/binlog_innodb_row.result b/mysql-test/suite/binlog/r/binlog_innodb_row.result new file mode 100644 index 00000000000..fab79c4bc2f --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_innodb_row.result @@ -0,0 +1,31 @@ +CREATE TABLE t1 (i int unique) ENGINE=innodb; +reset master; +begin; +insert into t1 values (1),(2); +*** the following UPDATE query wont generate any updates for the binlog *** +update t1 set i = 3 where i < 3; +ERROR 23000: Duplicate entry '3' for key 'i' +commit; +*** Results of the test: the binlog must have only Write_rows events not any Update_rows *** +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +delete from t1; +reset master; +begin; +insert into t1 values (1),(2); +*** the following UPDATE query wont generate any updates for the binlog *** +insert into t1 values (3),(4),(1),(2); +ERROR 23000: Duplicate entry '1' for key 'i' +commit; +*** Results of the test: the binlog must have only one Write_rows event not two *** +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +drop table t1; diff --git a/mysql-test/suite/binlog/r/binlog_killed_simulate.result b/mysql-test/suite/binlog/r/binlog_killed_simulate.result index 66d3a86cd5a..634d3f62814 100644 --- a/mysql-test/suite/binlog/r/binlog_killed_simulate.result +++ b/mysql-test/suite/binlog/r/binlog_killed_simulate.result @@ -14,12 +14,12 @@ select 1 /* must return 1 as query completed before got killed*/; 1 create table t2 (a int, b int) ENGINE=MyISAM; reset master; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */; +load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */; ERROR 70100: Query execution was interrupted show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=# -master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */ ;file_id=# +master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */ ;file_id=# select (@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog")) is not null; diff --git a/mysql-test/suite/binlog/r/binlog_multi_engine.result b/mysql-test/suite/binlog/r/binlog_multi_engine.result index a295657b8f8..caae5f55d13 100644 --- a/mysql-test/suite/binlog/r/binlog_multi_engine.result +++ b/mysql-test/suite/binlog/r/binlog_multi_engine.result @@ -17,24 +17,24 @@ TRUNCATE t1b; TRUNCATE t1n; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2) -master-bin.000001 # Query # # use `test`; COMMIT -master-bin.000001 # Query # # use `test`; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2) -master-bin.000001 # Query # # use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c -master-bin.000001 # Query # # use `test`; BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2) -master-bin.000001 # Query # # use `test`; UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f -master-bin.000001 # Query # # use `test`; UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c -master-bin.000001 # Query # # use `test`; COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1n) -master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # use `test`; TRUNCATE t1m -master-bin.000001 # Query # # use `test`; TRUNCATE t1b -master-bin.000001 # Query # # use `test`; TRUNCATE t1n +mysqld-bin.000001 # Query # # use `test`; BEGIN +mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2) +mysqld-bin.000001 # Query # # use `test`; COMMIT +mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2) +mysqld-bin.000001 # Query # # use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c +mysqld-bin.000001 # Query # # use `test`; BEGIN +mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2) +mysqld-bin.000001 # Query # # use `test`; UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f +mysqld-bin.000001 # Query # # use `test`; UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c +mysqld-bin.000001 # Query # # use `test`; COMMIT +mysqld-bin.000001 # Query # # BEGIN +mysqld-bin.000001 # Table_map # # table_id: # (test.t1n) +mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) +mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Query # # COMMIT +mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1m +mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1b +mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1n RESET MASTER; SET SESSION BINLOG_FORMAT=MIXED; INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2); @@ -48,20 +48,20 @@ TRUNCATE t1b; TRUNCATE t1n; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2) -master-bin.000001 # Query # # use `test`; COMMIT -master-bin.000001 # Query # # use `test`; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1n) -master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c -master-bin.000001 # Query # # use `test`; TRUNCATE t1m -master-bin.000001 # Query # # use `test`; TRUNCATE t1b -master-bin.000001 # Query # # use `test`; TRUNCATE t1n +mysqld-bin.000001 # Query # # use `test`; BEGIN +mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2) +mysqld-bin.000001 # Query # # use `test`; COMMIT +mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2) +mysqld-bin.000001 # Query # # BEGIN +mysqld-bin.000001 # Table_map # # table_id: # (test.t1n) +mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) +mysqld-bin.000001 # Write_rows # # table_id: # +mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Query # # COMMIT +mysqld-bin.000001 # Query # # use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c +mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1m +mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1b +mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1n RESET MASTER; SET SESSION BINLOG_FORMAT=ROW; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2); @@ -73,19 +73,19 @@ UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c; ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1m) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # use `test`; COMMIT -master-bin.000001 # Query # # use `test`; BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1b) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # use `test`; COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1n) -master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT +mysqld-bin.000001 # Query # # use `test`; BEGIN +mysqld-bin.000001 # Table_map # # table_id: # (test.t1m) +mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Query # # use `test`; COMMIT +mysqld-bin.000001 # Query # # use `test`; BEGIN +mysqld-bin.000001 # Table_map # # table_id: # (test.t1b) +mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Query # # use `test`; COMMIT +mysqld-bin.000001 # Query # # BEGIN +mysqld-bin.000001 # Table_map # # table_id: # (test.t1n) +mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) +mysqld-bin.000001 # Write_rows # # table_id: # +mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Query # # COMMIT RESET MASTER; DROP TABLE t1m, t1b, t1n; diff --git a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result index a066928fc13..49aa64adfb5 100644 --- a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result +++ b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result @@ -17,7 +17,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=10000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result index 7106480663f..0606c223126 100644 --- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result @@ -133,10 +133,6 @@ master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ -master-bin.000001 # Query # # use `test`; BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t2) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # use `test`; COMMIT insert into t1 values(11); commit; show binlog events from <binlog_start>; @@ -148,8 +144,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t2) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # use `test`; COMMIT -master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ @@ -278,10 +272,6 @@ master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ -master-bin.000001 # Query # # use `test`; BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t2) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; drop table t1,t2 master-bin.000001 # Query # # use `test`; create table t0 (n int) master-bin.000001 # Query # # use `test`; BEGIN @@ -382,7 +372,7 @@ master-bin.000001 # Query # # use `test`; DROP TABLE if exists t2 master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # use `test`; COMMIT +master-bin.000001 # Query # # use `test`; ROLLBACK master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2 master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb master-bin.000001 # Query # # use `test`; BEGIN @@ -400,11 +390,9 @@ master-bin.000001 # Query # # use `test`; DROP TABLE t2 master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # use `test`; COMMIT -master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # use `test`; COMMIT +master-bin.000001 # Query # # use `test`; ROLLBACK master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F @@ -412,7 +400,7 @@ master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # use `test`; COMMIT +master-bin.000001 # Query # # use `test`; ROLLBACK master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Query # # use `test`; TRUNCATE table t2 master-bin.000001 # Query # # use `test`; COMMIT @@ -685,7 +673,7 @@ delete from t1; create table t4 (a int default 0, b int primary key) engine=innodb; insert into t4 values (0, 17); reset master; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2); +load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2); ERROR 23000: Duplicate entry '17' for key 'PRIMARY' select * from t4; a b @@ -913,7 +901,7 @@ delete from t1; create table t4 (a int default 0, b int primary key) engine=innodb; insert into t4 values (0, 17); reset master; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2); +load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2); ERROR 23000: Duplicate entry '17' for key 'PRIMARY' select * from t4; a b @@ -929,7 +917,7 @@ master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=# master-bin.000001 # Intvar # # INSERT_ID=10 master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci -master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=# +master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=# master-bin.000001 # Query # # use `test`; ROLLBACK drop trigger trg_del_t2; drop table t1,t2,t3,t4,t5; diff --git a/mysql-test/suite/binlog/r/binlog_start_comment.result b/mysql-test/suite/binlog/r/binlog_start_comment.result index 162968195f2..c5c906dfc4e 100644 --- a/mysql-test/suite/binlog/r/binlog_start_comment.result +++ b/mysql-test/suite/binlog/r/binlog_start_comment.result @@ -2,7 +2,7 @@ reset master; drop table if exists t1,t2; create table t1 (word varchar(20)) -- create table t1; create table t2 (word varchar(20)) -- create table t2; -load data infile '../std_data_ln/words.dat' into table t1 -- load data to t1; +load data infile '../../std_data/words.dat' into table t1 -- load data to t1; insert into t2 values ("Ada"); flush logs; select * from t2; diff --git a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result index 30f298488fc..1cd77cfbed4 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result +++ b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result @@ -92,7 +92,7 @@ insert into t1 values(1); insert ignore into t1 values(1); replace into t1 values(100); create table t2 (a varchar(200)) engine=blackhole; -load data infile '../std_data_ln/words.dat' into table t2; +load data infile '../../std_data/words.dat' into table t2; alter table t1 add b int; alter table t1 drop b; create table t3 like t1; @@ -127,7 +127,7 @@ master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; create table t2 (a varchar(200)) engine=blackhole master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=581 -master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/words.dat' into table t2 ;file_id=# +master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/words.dat' into table t2 ;file_id=# master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; alter table t1 add b int master-bin.000001 # Query # # use `test`; alter table t1 drop b diff --git a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result index 1b14686a97d..b7edf7fedb8 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result +++ b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result @@ -16,7 +16,7 @@ SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`/*!*/; use test/*!*/; SET TIMESTAMP=10000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result index 3d71f333852..6d943ed9da1 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result @@ -611,7 +611,7 @@ delete from t1; create table t4 (a int default 0, b int primary key) engine=innodb; insert into t4 values (0, 17); reset master; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2); +load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2); ERROR 23000: Duplicate entry '17' for key 'PRIMARY' select * from t4; a b @@ -625,7 +625,7 @@ master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Intvar # # INSERT_ID=10 master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=# master-bin.000001 # Intvar # # INSERT_ID=10 -master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=# +master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=# master-bin.000001 # Query # # use `test`; ROLLBACK /* the output must denote there is the query */; drop trigger trg_del_t2; @@ -845,7 +845,7 @@ delete from t1; create table t4 (a int default 0, b int primary key) engine=innodb; insert into t4 values (0, 17); reset master; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2); +load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2); ERROR 23000: Duplicate entry '17' for key 'PRIMARY' select * from t4; a b @@ -861,7 +861,7 @@ master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=# master-bin.000001 # Intvar # # INSERT_ID=10 master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci -master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=# +master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=# master-bin.000001 # Query # # use `test`; ROLLBACK drop trigger trg_del_t2; drop table t1,t2,t3,t4,t5; diff --git a/mysql-test/suite/binlog/r/binlog_stm_row.result b/mysql-test/suite/binlog/r/binlog_stm_row.result index 97ec38cfb3e..58106865395 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_row.result +++ b/mysql-test/suite/binlog/r/binlog_stm_row.result @@ -1,5 +1,6 @@ DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; +SET @old_binlog_format=@@BINLOG_FORMAT; SET GLOBAL BINLOG_FORMAT = STATEMENT; SET SESSION BINLOG_FORMAT = STATEMENT; CREATE TABLE t1 (a INT); @@ -69,3 +70,4 @@ master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # use `test`; COMMIT DROP TABLE t1; DROP TABLE t2; +SET GLOBAL BINLOG_FORMAT = @old_binlog_format; diff --git a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test index e77c9398c59..f20cc33f820 100644 --- a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test +++ b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test @@ -17,9 +17,15 @@ source include/have_log_bin.inc; -copy_file $MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001 $MYSQLTEST_VARDIR/master-data/slave-relay-bin.000001; +# Need to restore this at the end; CHANGE MASTER modifies it (see the +# manual for CHANGE MASTER). +SET @old_relay_log_purge= @@global.relay_log_purge; -write_file $MYSQLTEST_VARDIR/master-data/slave-relay-bin.index; +let $MYSQLD_DATADIR= `select @@datadir`; + +copy_file $MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001 $MYSQLD_DATADIR/slave-relay-bin.000001; + +write_file $MYSQLD_DATADIR/slave-relay-bin.index; slave-relay-bin.000001 EOF @@ -46,9 +52,9 @@ DROP FUNCTION IF EXISTS f1; DROP TRIGGER IF EXISTS tr1; enable_warnings; -remove_file $MYSQLTEST_VARDIR/master-data/slave-relay-bin.000001; -remove_file $MYSQLTEST_VARDIR/master-data/slave-relay-bin.index; +remove_file $MYSQLD_DATADIR/slave-relay-bin.000001; +remove_file $MYSQLD_DATADIR/slave-relay-bin.index; stop slave sql_thread; -let $keep_connection=1; source include/wait_for_slave_sql_to_stop.inc; +SET @@global.relay_log_purge= @old_relay_log_purge; diff --git a/mysql-test/t/binlog_index.test b/mysql-test/suite/binlog/t/binlog_index.test index 1e44a9b02e2..13287465b88 100644 --- a/mysql-test/t/binlog_index.test +++ b/mysql-test/suite/binlog/t/binlog_index.test @@ -13,11 +13,11 @@ flush logs; flush logs; source include/show_binary_logs.inc; - -remove_file $MYSQLTEST_VARDIR/log/master-bin.000001; +let $MYSQLD_DATADIR= `select @@datadir`; +remove_file $MYSQLD_DATADIR/master-bin.000001; # there must be a warning with file names ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +replace_regex /\.[\\\/]master/master/; purge binary logs TO 'master-bin.000004'; --echo *** must show a list starting from the 'TO' argument of PURGE *** @@ -32,12 +32,12 @@ reset master; flush logs; flush logs; flush logs; -remove_file $MYSQLTEST_VARDIR/log/master-bin.000001; +remove_file $MYSQLD_DATADIR/master-bin.000001; --echo *** must be a warning master-bin.000001 was not found *** let $date=`select NOW() + INTERVAL 1 MINUTE`; --disable_query_log ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +replace_regex /\.[\\\/]master/master/; eval purge binary logs BEFORE '$date'; --enable_query_log @@ -55,14 +55,14 @@ flush logs; flush logs; flush logs; -remove_file $MYSQLTEST_VARDIR/log/master-bin.000001; -mkdir $MYSQLTEST_VARDIR/log/master-bin.000001; +remove_file $MYSQLD_DATADIR/master-bin.000001; +mkdir $MYSQLD_DATADIR/master-bin.000001; --error ER_BINLOG_PURGE_FATAL_ERR purge binary logs TO 'master-bin.000002'; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +replace_regex /\.[\\\/]master/master/; show warnings; -rmdir $MYSQLTEST_VARDIR/log/master-bin.000001; +rmdir $MYSQLD_DATADIR/master-bin.000001; --disable_warnings reset master; --enable_warnings diff --git a/mysql-test/suite/binlog/t/binlog_innodb.test b/mysql-test/suite/binlog/t/binlog_innodb.test index df99e3786ee..f84fd65226a 100644 --- a/mysql-test/suite/binlog/t/binlog_innodb.test +++ b/mysql-test/suite/binlog/t/binlog_innodb.test @@ -101,6 +101,7 @@ DROP TABLE t1; # Actually this test has nothing to do with innodb per se, it just requires # transactional table. # +flush status; show status like "binlog_cache_use"; show status like "binlog_cache_disk_use"; diff --git a/mysql-test/suite/binlog/t/binlog_innodb_row.test b/mysql-test/suite/binlog/t/binlog_innodb_row.test new file mode 100644 index 00000000000..aaba98e3284 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_innodb_row.test @@ -0,0 +1,42 @@ +# +# Tests of innodb/binlog with the row binlog format +# +source include/have_innodb.inc; +source include/have_log_bin.inc; +source include/have_binlog_format_row.inc; + +# +# Bug #40221 Replication failure on RBR + UPDATE the primary key +# + +CREATE TABLE t1 (i int unique) ENGINE=innodb; +reset master; + +# part 1: update can cause the dup key + +begin; +insert into t1 values (1),(2); +--echo *** the following UPDATE query wont generate any updates for the binlog *** +--error ER_DUP_ENTRY +update t1 set i = 3 where i < 3; +commit; + +--echo *** Results of the test: the binlog must have only Write_rows events not any Update_rows *** +source include/show_binlog_events.inc; + +# part 2: insert can cause the dup key + +delete from t1; +reset master; + +begin; +insert into t1 values (1),(2); +--echo *** the following UPDATE query wont generate any updates for the binlog *** +--error ER_DUP_ENTRY +insert into t1 values (3),(4),(1),(2); +commit; + +--echo *** Results of the test: the binlog must have only one Write_rows event not two *** +source include/show_binlog_events.inc; + +drop table t1; diff --git a/mysql-test/suite/binlog/t/binlog_killed.test b/mysql-test/suite/binlog/t/binlog_killed.test index e63186b64c8..9b30ec4a0db 100644 --- a/mysql-test/suite/binlog/t/binlog_killed.test +++ b/mysql-test/suite/binlog/t/binlog_killed.test @@ -50,7 +50,8 @@ connection con2; reap; let $rows= `select count(*) from t2 /* must be 2 or 0 */`; ---exec $MYSQL_BINLOG --force-if-open --start-position=134 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog +let $MYSQLD_DATADIR= `select @@datadir`; +--exec $MYSQL_BINLOG --force-if-open --start-position=134 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog")) @@ -261,7 +262,7 @@ source include/show_binlog_events.inc; # a proof the query is binlogged with an error ---exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog +--exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog")) @@ -307,7 +308,7 @@ source include/show_binlog_events.inc; # a proof the query is binlogged with an error ---exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog +--exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog")) diff --git a/mysql-test/suite/binlog/t/binlog_killed_simulate.test b/mysql-test/suite/binlog/t/binlog_killed_simulate.test index 8af51fc5fe5..ec61271ae88 100644 --- a/mysql-test/suite/binlog/t/binlog_killed_simulate.test +++ b/mysql-test/suite/binlog/t/binlog_killed_simulate.test @@ -23,7 +23,8 @@ update t1 set a=2 /* will be "killed" after work has been done */; #todo: introduce a suite private macro that provides numeric values # for some constants like the offset of the first real event # that is different between severs versions. ---exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog +let $MYSQLD_DATADIR= `select @@datadir`; +--exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog")) @@ -44,14 +45,14 @@ remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog; create table t2 (a int, b int) ENGINE=MyISAM; reset master; --error ER_QUERY_INTERRUPTED -load data infile '../std_data_ln/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */; +load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */; # a proof the query is binlogged with an error source include/show_binlog_events.inc; ---exec $MYSQL_BINLOG --force-if-open --start-position=98 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog +--exec $MYSQL_BINLOG --force-if-open --start-position=98 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog")) diff --git a/mysql-test/suite/binlog/t/binlog_start_comment.test b/mysql-test/suite/binlog/t/binlog_start_comment.test index 6f8540efd07..98f2ca05505 100644 --- a/mysql-test/suite/binlog/t/binlog_start_comment.test +++ b/mysql-test/suite/binlog/t/binlog_start_comment.test @@ -10,15 +10,16 @@ drop table if exists t1,t2; --enable_warnings create table t1 (word varchar(20)) -- create table t1; create table t2 (word varchar(20)) -- create table t2; -load data infile '../std_data_ln/words.dat' into table t1 -- load data to t1; +load data infile '../../std_data/words.dat' into table t1 -- load data to t1; insert into t2 values ("Ada"); flush logs; select * from t2; ---exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_start_comment.binlog +let $MYSQLD_DATADIR= `select @@datadir`; +--exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_start_comment.binlog --exec $MYSQL --local-infile=1 < $MYSQLTEST_VARDIR/tmp/binlog_start_comment.binlog flush logs; select * from t2; # clean up drop table t1,t2; -#--remove_file $MYSQLTEST_VARDIR/tmp/binlog_start_comment.binlog +remove_file $MYSQLTEST_VARDIR/tmp/binlog_start_comment.binlog; diff --git a/mysql-test/suite/binlog/t/binlog_stm_row.test b/mysql-test/suite/binlog/t/binlog_stm_row.test index 4944e65c9f3..74a2d3126a3 100644 --- a/mysql-test/suite/binlog/t/binlog_stm_row.test +++ b/mysql-test/suite/binlog/t/binlog_stm_row.test @@ -19,6 +19,7 @@ DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; --enable_warnings +SET @old_binlog_format=@@BINLOG_FORMAT; SET GLOBAL BINLOG_FORMAT = STATEMENT; SET SESSION BINLOG_FORMAT = STATEMENT; @@ -105,3 +106,4 @@ source include/show_binlog_events.inc; DROP TABLE t1; DROP TABLE t2; +SET GLOBAL BINLOG_FORMAT = @old_binlog_format; diff --git a/mysql-test/suite/bugs/combinations b/mysql-test/suite/bugs/combinations index ea25611a5d4..07042c2cbec 100644 --- a/mysql-test/suite/bugs/combinations +++ b/mysql-test/suite/bugs/combinations @@ -1,8 +1,8 @@ [row] ---binlog-format=row +binlog-format=row [stmt] ---binlog-format=statement +binlog-format=statement [mix] ---binlog-format=mixed +binlog-format=mixed diff --git a/mysql-test/suite/federated/disabled.def b/mysql-test/suite/federated/disabled.def new file mode 100644 index 00000000000..9a9149ec80a --- /dev/null +++ b/mysql-test/suite/federated/disabled.def @@ -0,0 +1,12 @@ +############################################################################## +# +# List the test cases that are to be disabled temporarily. +# +# Separate the test case name and the comment with ':'. +# +# <testcasename> : BUG#<xxxx> <comment> +# +# Do not use any TAB characters for whitespace. +# +############################################################################## +federated_transactions : Bug#29523 Transactions do not work diff --git a/mysql-test/suite/federated/federated.inc b/mysql-test/suite/federated/federated.inc new file mode 100644 index 00000000000..6f85f7f32c4 --- /dev/null +++ b/mysql-test/suite/federated/federated.inc @@ -0,0 +1,17 @@ +--source include/not_embedded.inc +--source have_federated_db.inc + +connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); +connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); + +connection master; +--disable_warnings +DROP DATABASE IF EXISTS federated; +--enable_warnings +CREATE DATABASE federated; + +connection slave; +--disable_warnings +DROP DATABASE IF EXISTS federated; +--enable_warnings +CREATE DATABASE federated; diff --git a/mysql-test/r/federated.result b/mysql-test/suite/federated/federated.result index efd288613a0..d13eb9526ca 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/suite/federated/federated.result @@ -1,10 +1,3 @@ -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; -stop slave; DROP DATABASE IF EXISTS federated; CREATE DATABASE federated; DROP DATABASE IF EXISTS federated; @@ -1695,7 +1688,7 @@ a b c 13 17 221 19 23 437 delete from federated.t1; -load data infile '../std_data_ln/loaddata5.dat' into table federated.t1 fields terminated by '' enclosed by '' ignore 1 lines (a, b); +load data infile '../../std_data/loaddata5.dat' into table federated.t1 fields terminated by '' enclosed by '' ignore 1 lines (a, b); select * from federated.t1 order by a; a b c 3 4 12 diff --git a/mysql-test/t/federated.test b/mysql-test/suite/federated/federated.test index f45bff2597f..fa448e74a18 100644 --- a/mysql-test/t/federated.test +++ b/mysql-test/suite/federated/federated.test @@ -6,7 +6,7 @@ # should work with embedded server after mysqltest is fixed --source include/not_embedded.inc ---source include/federated.inc +--source federated.inc connection default; @@ -1537,7 +1537,7 @@ insert into federated.t1 (a, b) select * from federated.t2; select * from federated.t1 order by a; delete from federated.t1; # load -load data infile '../std_data_ln/loaddata5.dat' into table federated.t1 fields terminated by '' enclosed by '' ignore 1 lines (a, b); +load data infile '../../std_data/loaddata5.dat' into table federated.t1 fields terminated by '' enclosed by '' ignore 1 lines (a, b); select * from federated.t1 order by a; drop tables federated.t1, federated.t2; @@ -1955,4 +1955,4 @@ connection slave; SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT; connection default; -source include/federated_cleanup.inc; +source federated_cleanup.inc; diff --git a/mysql-test/r/federated_archive.result b/mysql-test/suite/federated/federated_archive.result index 3fd7cb2acd4..c7e3ee205f3 100644 --- a/mysql-test/r/federated_archive.result +++ b/mysql-test/suite/federated/federated_archive.result @@ -1,10 +1,3 @@ -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; -stop slave; DROP DATABASE IF EXISTS federated; CREATE DATABASE federated; DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/t/federated_archive.test b/mysql-test/suite/federated/federated_archive.test index f8df5f1c51a..1bde23889be 100644 --- a/mysql-test/t/federated_archive.test +++ b/mysql-test/suite/federated/federated_archive.test @@ -1,7 +1,5 @@ -# should work with embedded server after mysqltest is fixed --- source include/not_embedded.inc source include/have_archive.inc; -source include/federated.inc; +source federated.inc; connection slave; @@ -56,5 +54,5 @@ connection slave; DROP TABLE federated.archive_table; -source include/federated_cleanup.inc; +source federated_cleanup.inc; diff --git a/mysql-test/r/federated_bug_13118.result b/mysql-test/suite/federated/federated_bug_13118.result index cc14dae87d9..a9023d8e9bc 100644 --- a/mysql-test/r/federated_bug_13118.result +++ b/mysql-test/suite/federated/federated_bug_13118.result @@ -1,10 +1,3 @@ -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; -stop slave; DROP DATABASE IF EXISTS federated; CREATE DATABASE federated; DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/t/federated_bug_13118.test b/mysql-test/suite/federated/federated_bug_13118.test index e429a660489..fad6be75dac 100644 --- a/mysql-test/t/federated_bug_13118.test +++ b/mysql-test/suite/federated/federated_bug_13118.test @@ -1,7 +1,4 @@ -# should work with embedded server after mysqltest is fixed --- source include/not_embedded.inc -source include/federated.inc; - +source federated.inc; connection slave; --disable_warnings @@ -40,5 +37,5 @@ connection slave; DROP TABLE federated.bug_13118_table; -source include/federated_cleanup.inc; +source federated_cleanup.inc; diff --git a/mysql-test/r/federated_bug_25714.result b/mysql-test/suite/federated/federated_bug_25714.result index 5730eedc246..49fae0b3574 100644 --- a/mysql-test/r/federated_bug_25714.result +++ b/mysql-test/suite/federated/federated_bug_25714.result @@ -1,10 +1,3 @@ -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; -stop slave; DROP DATABASE IF EXISTS federated; CREATE DATABASE federated; DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/t/federated_bug_25714.test b/mysql-test/suite/federated/federated_bug_25714.test index 6d112cae5b8..4de04944f6a 100644 --- a/mysql-test/t/federated_bug_25714.test +++ b/mysql-test/suite/federated/federated_bug_25714.test @@ -1,5 +1,10 @@ ---source include/have_bug25714.inc -source include/federated.inc; +source federated.inc; + + # Check that path to the specific test program has been setup +if (`select LENGTH("$MYSQL_BUG25714") = 0`) +{ + skip Need bug25714 test program; +} connection master; # Disable concurrent inserts to avoid test failures when reading @@ -53,6 +58,5 @@ DROP TABLE federated.t1; SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT; -source include/federated_cleanup.inc; - +source federated_cleanup.inc; diff --git a/mysql-test/include/federated_cleanup.inc b/mysql-test/suite/federated/federated_cleanup.inc index 06fd7f6737a..06fd7f6737a 100644 --- a/mysql-test/include/federated_cleanup.inc +++ b/mysql-test/suite/federated/federated_cleanup.inc diff --git a/mysql-test/t/federated_innodb-slave.opt b/mysql-test/suite/federated/federated_innodb-slave.opt index 627becdbfb5..627becdbfb5 100644 --- a/mysql-test/t/federated_innodb-slave.opt +++ b/mysql-test/suite/federated/federated_innodb-slave.opt diff --git a/mysql-test/r/federated_innodb.result b/mysql-test/suite/federated/federated_innodb.result index 70ba3acb279..786997afa8d 100644 --- a/mysql-test/r/federated_innodb.result +++ b/mysql-test/suite/federated/federated_innodb.result @@ -1,10 +1,3 @@ -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; -stop slave; DROP DATABASE IF EXISTS federated; CREATE DATABASE federated; DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/t/federated_innodb.test b/mysql-test/suite/federated/federated_innodb.test index 0617cb15d97..278c5b18661 100644 --- a/mysql-test/t/federated_innodb.test +++ b/mysql-test/suite/federated/federated_innodb.test @@ -4,7 +4,7 @@ # See Bug #40645 Test main.federated_innodb does not always clean up after itself source include/have_innodb.inc; -source include/federated.inc; +source federated.inc; # # Bug#25513 Federated transaction failures @@ -36,4 +36,4 @@ connection slave; drop table federated.t1; -source include/federated_cleanup.inc; +source federated_cleanup.inc; diff --git a/mysql-test/r/federated_server.result b/mysql-test/suite/federated/federated_server.result index 32717b4f0e3..7260d6837db 100644 --- a/mysql-test/r/federated_server.result +++ b/mysql-test/suite/federated/federated_server.result @@ -1,10 +1,3 @@ -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; -stop slave; DROP DATABASE IF EXISTS federated; CREATE DATABASE federated; DROP DATABASE IF EXISTS federated; @@ -266,9 +259,8 @@ use test; create procedure p1 () begin DECLARE v INT DEFAULT 0; -DECLARE e INT DEFAULT 0; DECLARE i INT; -DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET e = e + 1; +DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; SET i = sleep(5); WHILE v < 10000 do CREATE SERVER s @@ -278,15 +270,10 @@ ALTER SERVER s OPTIONS (USER 'Remote'); DROP SERVER s; SET v = v + 1; END WHILE; -SELECT e > 0; END// use test; call p1(); call p1(); -e > 0 -1 -e > 0 -1 drop procedure p1; drop server if exists s; DROP TABLE IF EXISTS federated.t1; diff --git a/mysql-test/t/federated_server.test b/mysql-test/suite/federated/federated_server.test index 444285ac045..ec952d071f2 100644 --- a/mysql-test/t/federated_server.test +++ b/mysql-test/suite/federated/federated_server.test @@ -1,9 +1,6 @@ # WL #3031 This test tests the new servers table as well as # if federated can utilise the servers table -# should work with embedded server after mysqltest is fixed --- source include/not_embedded.inc --- source include/federated.inc --- source include/big_test.inc +-- source federated.inc connection slave; create database first_db; @@ -308,9 +305,8 @@ delimiter //; create procedure p1 () begin DECLARE v INT DEFAULT 0; - DECLARE e INT DEFAULT 0; DECLARE i INT; - DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET e = e + 1; + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; SET i = sleep(5); WHILE v < 10000 do CREATE SERVER s @@ -320,7 +316,6 @@ begin DROP SERVER s; SET v = v + 1; END WHILE; - SELECT e > 0; END// delimiter ;// connection other; @@ -334,4 +329,4 @@ drop procedure p1; drop server if exists s; -source include/federated_cleanup.inc; +source federated_cleanup.inc; diff --git a/mysql-test/t/federated_transactions-slave.opt b/mysql-test/suite/federated/federated_transactions-slave.opt index 48457b17309..48457b17309 100644 --- a/mysql-test/t/federated_transactions-slave.opt +++ b/mysql-test/suite/federated/federated_transactions-slave.opt diff --git a/mysql-test/r/federated_transactions.result b/mysql-test/suite/federated/federated_transactions.result index 40644e3535e..40644e3535e 100644 --- a/mysql-test/r/federated_transactions.result +++ b/mysql-test/suite/federated/federated_transactions.result diff --git a/mysql-test/t/federated_transactions.test b/mysql-test/suite/federated/federated_transactions.test index 2fc737730bf..cd08d310273 100644 --- a/mysql-test/t/federated_transactions.test +++ b/mysql-test/suite/federated/federated_transactions.test @@ -1,7 +1,5 @@ -# should work with embedded server after mysqltest is fixed --- source include/not_embedded.inc source include/have_innodb.inc; -source include/federated.inc; +source federated.inc; connection slave; DROP TABLE IF EXISTS federated.t1; @@ -37,4 +35,4 @@ INSERT INTO federated.t1 (id, name) VALUES (6, 'fig'); SELECT * FROM federated.t1; DELETE FROM federated.t1; -source include/federated_cleanup.inc; +source federated_cleanup.inc; diff --git a/mysql-test/suite/federated/have_federated_db.inc b/mysql-test/suite/federated/have_federated_db.inc new file mode 100644 index 00000000000..81f49aaa48e --- /dev/null +++ b/mysql-test/suite/federated/have_federated_db.inc @@ -0,0 +1,6 @@ +if (!`SELECT count(*) FROM information_schema.engines WHERE + (support = 'YES' OR support = 'DEFAULT') AND + engine = 'federated'`) +{ + skip Need federated engine; +} diff --git a/mysql-test/suite/federated/my.cnf b/mysql-test/suite/federated/my.cnf new file mode 100644 index 00000000000..3e84845b945 --- /dev/null +++ b/mysql-test/suite/federated/my.cnf @@ -0,0 +1,12 @@ +# Use default setting for mysqld processes +!include include/default_mysqld.cnf + +[mysqld.1] +log-bin= master-bin + +[mysqld.2] + + +[ENV] +MASTER_MYPORT= @mysqld.1.port +SLAVE_MYPORT= @mysqld.2.port diff --git a/mysql-test/suite/funcs_1/r/is_collation_charset_applic.result b/mysql-test/suite/funcs_1/r/is_coll_char_set_appl.result index 7eba964bdf6..7eba964bdf6 100644 --- a/mysql-test/suite/funcs_1/r/is_collation_charset_applic.result +++ b/mysql-test/suite/funcs_1/r/is_coll_char_set_appl.result diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result index 15466887ecc..94aa75c6db2 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is.result @@ -43,10 +43,10 @@ NULL information_schema COLUMN_PRIVILEGES TABLE_NAME 4 NO varchar 64 192 NULL N NULL information_schema COLUMN_PRIVILEGES TABLE_SCHEMA 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema ENGINES COMMENT 3 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select NULL information_schema ENGINES ENGINE 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema ENGINES SAVEPOINTS 6 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select +NULL information_schema ENGINES SAVEPOINTS 6 NULL YES varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema ENGINES SUPPORT 2 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) select -NULL information_schema ENGINES TRANSACTIONS 4 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select -NULL information_schema ENGINES XA 5 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select +NULL information_schema ENGINES TRANSACTIONS 4 NULL YES varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select +NULL information_schema ENGINES XA 5 NULL YES varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema EVENTS CHARACTER_SET_CLIENT 22 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select NULL information_schema EVENTS COLLATION_CONNECTION 23 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select NULL information_schema EVENTS CREATED 17 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select diff --git a/mysql-test/suite/funcs_1/r/is_engines.result b/mysql-test/suite/funcs_1/r/is_engines.result index ba98ddd8f1e..9965fc5ad73 100644 --- a/mysql-test/suite/funcs_1/r/is_engines.result +++ b/mysql-test/suite/funcs_1/r/is_engines.result @@ -31,27 +31,27 @@ Field Type Null Key Default Extra ENGINE varchar(64) NO SUPPORT varchar(8) NO COMMENT varchar(80) NO -TRANSACTIONS varchar(3) NO -XA varchar(3) NO -SAVEPOINTS varchar(3) NO +TRANSACTIONS varchar(3) YES NULL +XA varchar(3) YES NULL +SAVEPOINTS varchar(3) YES NULL SHOW CREATE TABLE information_schema.ENGINES; Table Create Table ENGINES CREATE TEMPORARY TABLE `ENGINES` ( `ENGINE` varchar(64) NOT NULL DEFAULT '', `SUPPORT` varchar(8) NOT NULL DEFAULT '', `COMMENT` varchar(80) NOT NULL DEFAULT '', - `TRANSACTIONS` varchar(3) NOT NULL DEFAULT '', - `XA` varchar(3) NOT NULL DEFAULT '', - `SAVEPOINTS` varchar(3) NOT NULL DEFAULT '' + `TRANSACTIONS` varchar(3) DEFAULT NULL, + `XA` varchar(3) DEFAULT NULL, + `SAVEPOINTS` varchar(3) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW COLUMNS FROM information_schema.ENGINES; Field Type Null Key Default Extra ENGINE varchar(64) NO SUPPORT varchar(8) NO COMMENT varchar(80) NO -TRANSACTIONS varchar(3) NO -XA varchar(3) NO -SAVEPOINTS varchar(3) NO +TRANSACTIONS varchar(3) YES NULL +XA varchar(3) YES NULL +SAVEPOINTS varchar(3) YES NULL ######################################################################## # Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and # DDL on INFORMATION_SCHEMA tables are not supported diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result index 38fa933e13f..0c414df0c57 100644 --- a/mysql-test/suite/funcs_1/r/storedproc.result +++ b/mysql-test/suite/funcs_1/r/storedproc.result @@ -191,2427 +191,1215 @@ ERROR 22007: Illegal double '1.7976931348623157493578e+308' value found during p UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+100; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+100, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+100); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+99; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+99, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+99); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+98; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+98, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+98); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+97; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+97, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+97); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+96; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+96, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+96); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+95; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+95, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+95); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+94; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+94, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+94); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+93; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+93, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+93); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+92; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+92, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+92); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+91; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+91, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+91); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+90; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+90, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+90); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+89; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+89, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+89); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+88; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+88, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+88); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+87; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+87, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+87); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+86; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+86, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+86); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+85; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+85, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+85); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+84; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+84, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+84); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+83; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+83, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+83); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+82; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+82, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+82); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+81; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+81, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+81); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+80; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+80, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+80); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+79; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+79, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+79); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+78; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+78, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+78); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+77; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+77, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+77); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+76; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+76, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+76); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+75; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+75, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+75); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+74; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+74, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+74); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+73; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+73, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+73); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+72; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+72, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+72); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+71; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+71, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+71); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+70; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+70, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+70); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+69; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+69, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+69); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+68; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+68, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+68); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+67; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+67, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+67); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+66; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+66, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+66); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+65; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+65, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+65); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+64; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+64, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+64); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+63; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+63, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+63); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+62; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+62, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+62); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+61; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+61, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+61); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+60; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+60, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+60); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+59; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+59, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+59); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+58; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+58, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+58); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+57; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+57, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+57); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+56; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+56, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+56); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+55; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+55, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+55); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+54; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+54, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+54); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+53; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+53, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+53); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+52; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+52, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+52); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+51; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+51, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+51); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+50; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+50, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+50); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+49; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+49, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+49); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+48; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+48, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+48); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+47; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+47, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+47); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+46; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+46, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+46); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+45; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+45, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+45); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+44; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+44, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+44); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+43; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+43, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+43); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+42; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+42, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+42); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+41; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+41, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+41); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+40; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+40, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+40); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+39; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+39, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+39); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+38; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+38, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+38); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+37; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+37, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+37); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+36; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+36, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+36); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+35; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+35, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+35); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+34; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+34, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+34); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+33; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+33, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+33); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+32; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+32, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+32); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+31; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+31, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+31); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+30; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+30, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+30); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+29; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+29, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+29); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+28; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+28, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+28); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+27; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+27, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+27); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+26; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+26, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+26); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+25; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+25, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+25); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+24; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+24, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+24); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+23; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+23, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+23); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+22; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+22, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+22); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+21; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+21, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+21); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+20; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+20, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+20); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+19; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+19, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+19); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+18; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+18, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+18); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+17; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+17, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+17); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+16; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+16, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+16); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+15; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+15, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+15); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+14; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+14, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+14); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+13; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+13, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+13); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+12; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+12, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+12); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+11; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+11, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+11); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+10; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+10, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+10); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+9; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+9, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+9); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+8; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+8, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+8); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+7; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+7, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+7); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+6; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+6, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+6); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+5; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+5, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+5); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+4; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+4, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+4); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+3; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+3, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+3); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+2; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+2, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+2); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+1; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+1, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+1); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+0; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+0, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+0); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-100; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-100, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-100); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-99; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-99, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-99); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-98; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-98, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-98); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-97; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-97, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-97); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-96; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-96, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-96); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-95; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-95, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-95); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-94; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-94, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-94); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-93; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-93, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-93); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-92; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-92, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-92); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-91; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-91, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-91); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-90; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-90, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-90); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-89; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-89, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-89); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-88; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-88, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-88); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-87; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-87, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-87); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-86; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-86, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-86); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-85; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-85, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-85); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-84; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-84, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-84); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-83; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-83, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-83); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-82; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-82, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-82); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-81; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-81, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-81); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-80; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-80, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-80); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-79; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-79, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-79); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-78; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-78, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-78); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-77; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-77, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-77); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-76; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-76, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-76); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-75; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-75, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-75); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-74; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-74, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-74); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-73; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-73, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-73); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-72; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-72, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-72); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-71; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-71, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-71); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-70; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-70, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-70); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-69; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-69, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-69); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-68; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-68, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-68); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-67; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-67, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-67); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-66; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-66, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-66); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-65; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-65, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-65); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-64; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-64, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-64); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-63; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-63, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-63); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-62; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-62, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-62); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-61; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-61, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-61); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-60; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-60, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-60); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-59; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-59, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-59); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-58; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-58, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-58); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-57; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-57, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-57); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-56; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-56, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-56); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-55; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-55, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-55); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-54; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-54, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-54); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-53; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-53, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-53); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-52; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-52, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-52); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-51; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-51, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-51); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-50; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-50, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-50); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-49; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-49, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-49); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-48; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-48, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-48); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-47; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-47, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-47); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-46; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-46, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-46); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-45; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-45, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-45); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-44; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-44, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-44); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-43; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-43, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-43); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-42; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-42, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-42); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-41; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-41, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-41); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-40; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-40, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-40); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-39; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-39, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-39); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-38; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-38, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-38); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-37; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-37, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-37); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-36; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-36, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-36); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-35; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-35, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-35); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-34; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-34, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-34); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-33; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-33, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-33); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-32; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-32, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-32); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-31; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-31, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-31); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-30; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-30, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-30); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-29; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-29, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-29); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-28; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-28, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-28); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-27; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-27, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-27); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-26; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-26, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-26); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-25; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-25, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-25); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-24; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-24, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-24); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-23; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-23, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-23); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-22; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-22, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-22); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-21; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-21, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-21); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-20; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-20, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-20); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-19; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-19, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-19); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-18; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-18, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-18); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-17; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-17, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-17); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-16; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-16, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-16); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-15; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-15, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-15); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-14; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-14, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-14); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-13; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-13, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-13); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-12; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-12, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-12); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-11; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-11, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-11); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-10; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-10, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-10); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-9; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-9, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-9); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-8; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-8, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-8); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-7; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-7, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-7); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-6; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-6, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-6); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-5; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-5, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-5); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-4; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-4, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-4); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-3; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-3, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-3); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-2; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-2, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-2); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-1; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-1, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-1); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-0; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-0, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-0); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 DROP PROCEDURE sproc_1; DROP FUNCTION func_1; DROP TABLE t1_aux; diff --git a/mysql-test/suite/funcs_1/storedproc/param_check.inc b/mysql-test/suite/funcs_1/storedproc/param_check.inc index f6c0b30ab8b..203187f92b1 100644 --- a/mysql-test/suite/funcs_1/storedproc/param_check.inc +++ b/mysql-test/suite/funcs_1/storedproc/param_check.inc @@ -16,15 +16,32 @@ # Created: # 2008-08-27 mleich # - +# Modified: +# 2008-11-17 pcrews +# added --disable / --enable_warning statements to minimize differences +# between platforms (Bug#40177 Test funcs_1.storedproc failing on Pushbuild) +# +# TODO: (After 5.1 GA) +# 1) Examine reordering statements in this file to minimize the number of +# --disable / --enable_warning statements. Unsure if performance gains +# warrant the working time +# 2) We could probably add a comparison of the # of warnings before the +# assignment of @v1_proc and @v1_func to the # of warnings after assignment +# The difference of these values should be zero +# Refer to Bug#40177 - http://bugs.mysql.com/bug.php?id=40177 for notes as well + eval UPDATE t1_aux SET f1 = NULL; # Enforce that all user variables have the same data type and initial value. SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; +--disable_warnings eval UPDATE t1_aux SET f1 = $test_value; +--enable_warnings SELECT f1 INTO @v1_tab FROM t1_aux; +--disable_warnings eval CALL sproc_1($test_value, @v1_proc); eval SET @v1_func = func_1($test_value); +--enable_warnings if (`SELECT @v1_tab <> @v1_proc OR @v1_tab <> @v2_proc OR @v1_tab <> @v1_func`) { diff --git a/mysql-test/suite/funcs_1/t/is_collation_charset_applic.test b/mysql-test/suite/funcs_1/t/is_coll_char_set_appl.test index cda7b578aae..84690b0647c 100644 --- a/mysql-test/suite/funcs_1/t/is_collation_charset_applic.test +++ b/mysql-test/suite/funcs_1/t/is_coll_char_set_appl.test @@ -1,7 +1,7 @@ -# suite/funcs_1/t/is_collation_character_set_applicability.test +# suite/funcs_1/t/is_coll_char_set_appl.test # # Check the layout of information_schema.collation_character_set_applicability -# and some functionality realted tests. +# and some functionality related tests. # # Author: # 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of diff --git a/mysql-test/suite/funcs_2/t/disabled.def b/mysql-test/suite/funcs_2/t/disabled.def index c903662e052..da6230bd7ed 100644 --- a/mysql-test/suite/funcs_2/t/disabled.def +++ b/mysql-test/suite/funcs_2/t/disabled.def @@ -1,6 +1,6 @@ # Disabled by hhunger (2008-03-03) due to WL4204 -innodb_charset : Due to bug#20447 -myisam_charset : Due to bug#20477 -memory_charset : Due to bug#20447 -ndb_charset : Due to bug#20447 +innodb_charset : Bug#20447 Problem with prefix keys with contractions and expansions +myisam_charset : Bug#20447 Problem with prefix keys with contractions and expansions +memory_charset : Bug#20447 Problem with prefix keys with contractions and expansions +ndb_charset : Bug#20447 Problem with prefix keys with contractions and expansions diff --git a/mysql-test/suite/maria/r/maria-big2.result b/mysql-test/suite/maria/r/maria-big2.result index 03b959642b4..7fc57d6a203 100644 --- a/mysql-test/suite/maria/r/maria-big2.result +++ b/mysql-test/suite/maria/r/maria-big2.result @@ -3,3 +3,7 @@ Table Op Msg_type Msg_text test.t2 check status OK Table Op Msg_type Msg_text test.t2 check status OK +check table t2 extended; +Table Op Msg_type Msg_text +test.t2 check status OK +drop table t2; diff --git a/mysql-test/suite/maria/r/maria-purge.result b/mysql-test/suite/maria/r/maria-purge.result index 14cf51948a8..79c9a723225 100644 --- a/mysql-test/suite/maria/r/maria-purge.result +++ b/mysql-test/suite/maria/r/maria-purge.result @@ -38,13 +38,13 @@ set global maria_log_file_size=16777216; set global maria_checkpoint_interval=30; SHOW ENGINE maria logs; Type Name Status -MARIA master-data/maria_log.00000002 in use +MARIA data/maria_log.00000002 in use insert into t2 select * from t1; insert into t1 select * from t2; set global maria_checkpoint_interval=30; SHOW ENGINE maria logs; Type Name Status -MARIA master-data/maria_log.00000004 in use +MARIA data/maria_log.00000004 in use set global maria_log_file_size=16777216; select @@global.maria_log_file_size; @@global.maria_log_file_size @@ -52,7 +52,7 @@ select @@global.maria_log_file_size; set global maria_checkpoint_interval=30; SHOW ENGINE maria logs; Type Name Status -MARIA master-data/maria_log.00000004 in use +MARIA data/maria_log.00000004 in use set global maria_log_file_size=8388608; select @@global.maria_log_file_size; @@global.maria_log_file_size @@ -62,32 +62,32 @@ insert into t1 select * from t2; set global maria_checkpoint_interval=30; SHOW ENGINE maria logs; Type Name Status -MARIA master-data/maria_log.00000004 free -MARIA master-data/maria_log.00000005 free -MARIA master-data/maria_log.00000006 free -MARIA master-data/maria_log.00000007 free -MARIA master-data/maria_log.00000008 in use +MARIA data/maria_log.00000004 free +MARIA data/maria_log.00000005 free +MARIA data/maria_log.00000006 free +MARIA data/maria_log.00000007 free +MARIA data/maria_log.00000008 in use flush logs; SHOW ENGINE maria logs; Type Name Status -MARIA master-data/maria_log.00000008 in use +MARIA data/maria_log.00000008 in use set global maria_log_file_size=16777216; set global maria_log_purge_type=external; insert into t1 select * from t2; set global maria_checkpoint_interval=30; SHOW ENGINE maria logs; Type Name Status -MARIA master-data/maria_log.00000008 free -MARIA master-data/maria_log.00000009 in use +MARIA data/maria_log.00000008 free +MARIA data/maria_log.00000009 in use flush logs; SHOW ENGINE maria logs; Type Name Status -MARIA master-data/maria_log.00000008 free -MARIA master-data/maria_log.00000009 in use +MARIA data/maria_log.00000008 free +MARIA data/maria_log.00000009 in use set global maria_log_purge_type=immediate; insert into t1 select * from t2; set global maria_checkpoint_interval=30; SHOW ENGINE maria logs; Type Name Status -MARIA master-data/maria_log.00000011 in use +MARIA data/maria_log.00000011 in use drop table t1, t2; diff --git a/mysql-test/suite/maria/r/maria-recover.result b/mysql-test/suite/maria/r/maria-recover.result index ecb6aa8bf5f..5fc3207e2dc 100644 --- a/mysql-test/suite/maria/r/maria-recover.result +++ b/mysql-test/suite/maria/r/maria-recover.result @@ -32,3 +32,4 @@ select * from t_corrupted2; a ThursdayMorningsMarket drop database mysqltest; +set @@global.maria_recover=BACKUP; diff --git a/mysql-test/suite/maria/r/maria-recovery-rtree-ft.result b/mysql-test/suite/maria/r/maria-recovery-rtree-ft.result index 474d63d5c93..a2df72dfb90 100644 --- a/mysql-test/suite/maria/r/maria-recovery-rtree-ft.result +++ b/mysql-test/suite/maria/r/maria-recovery-rtree-ft.result @@ -156,4 +156,6 @@ mysqltest.t1 check status OK Checksum-check ok use mysqltest; -drop table t1,t2; +drop database mysqltest_for_comparison; +drop database mysqltest_for_feeding_recovery; +drop database mysqltest; diff --git a/mysql-test/suite/maria/r/maria-recovery3.result b/mysql-test/suite/maria/r/maria-recovery3.result index 670104b2ba4..72b7ff66e02 100644 --- a/mysql-test/suite/maria/r/maria-recovery3.result +++ b/mysql-test/suite/maria/r/maria-recovery3.result @@ -90,4 +90,5 @@ Table Op Msg_type Msg_text mysqltest.t1 check status OK drop table t1; drop database mysqltest_for_comparison; +drop database mysqltest_for_feeding_recovery; drop database mysqltest; diff --git a/mysql-test/suite/maria/r/maria.result b/mysql-test/suite/maria/r/maria.result index ab554f0a433..47b72f9ef58 100644 --- a/mysql-test/suite/maria/r/maria.result +++ b/mysql-test/suite/maria/r/maria.result @@ -2131,7 +2131,7 @@ c3 VARCHAR(10) NOT NULL, KEY (c1), KEY (c2) ) ENGINE=maria DEFAULT CHARSET=utf8 PACK_KEYS=0; -MARIA file: MYSQLTEST_VARDIR/master-data/test/t1 +MARIA file: MYSQLTEST_VARDIR/mysqld.1/data/test/t1 Record format: Block Crashsafe: yes Character set: utf8_general_ci (33) diff --git a/mysql-test/suite/maria/r/maria2.result b/mysql-test/suite/maria/r/maria2.result index eae5d7cf422..b7cbfbe48cf 100644 --- a/mysql-test/suite/maria/r/maria2.result +++ b/mysql-test/suite/maria/r/maria2.result @@ -44,13 +44,13 @@ id s drop table t1; create table t1 (pk int primary key, apk int unique, data int) engine=maria; insert into t1 values (1, 1, 1), (4, 4, 4), (6, 6, 6); -load data concurrent infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk); +load data concurrent infile '../../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk); select * from t1 order by pk; pk apk data 1 1 1 3 4 NULL 5 6 NULL -load data infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk); +load data infile '../../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk); select * from t1 order by pk; pk apk data 1 1 1 diff --git a/mysql-test/suite/maria/r/maria3.result b/mysql-test/suite/maria/r/maria3.result index 6a0342d7a4d..4eeb02565b7 100644 --- a/mysql-test/suite/maria/r/maria3.result +++ b/mysql-test/suite/maria/r/maria3.result @@ -266,10 +266,10 @@ maria_checkpoint_interval 30 maria_force_start_after_recovery_failures 0 maria_log_file_size 4294959104 maria_log_purge_type immediate -maria_max_sort_file_size 9223372036854775807 +maria_max_sort_file_size 9223372036853727232 maria_page_checksum OFF maria_pagecache_age_threshold 300 -maria_pagecache_buffer_size 8388600 +maria_pagecache_buffer_size 8384512 maria_pagecache_division_limit 100 maria_recover OFF maria_repair_threads 1 diff --git a/mysql-test/suite/maria/t/maria-autozerofill.test b/mysql-test/suite/maria/t/maria-autozerofill.test index b3801679755..1ad3464206b 100644 --- a/mysql-test/suite/maria/t/maria-autozerofill.test +++ b/mysql-test/suite/maria/t/maria-autozerofill.test @@ -24,7 +24,7 @@ create table t1(a int) engine=maria; insert into t1 values(1); flush table t1; # Check that table is not zerofilled, not movable ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -48,7 +48,7 @@ enable_ps_protocol; flush table t1; # Check that table is auto-zerofilled, movable ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -65,7 +65,7 @@ insert into t1 values(2); flush table t1; # Check that table is not zerofilled, not movable ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; diff --git a/mysql-test/suite/maria/t/maria-big.test b/mysql-test/suite/maria/t/maria-big.test index 92177c0a9af..d664dc05095 100644 --- a/mysql-test/suite/maria/t/maria-big.test +++ b/mysql-test/suite/maria/t/maria-big.test @@ -64,3 +64,11 @@ select a,length(b) from t1; check table t1; drop table t1; + +# Set defaults back +--disable_result_log +--disable_query_log +set global maria_log_file_size=default; +set global max_allowed_packet=default; +--enable_result_log +--enable_query_log diff --git a/mysql-test/suite/maria/t/maria-big2.test b/mysql-test/suite/maria/t/maria-big2.test index a06b6ea843b..867ce71d4b5 100644 --- a/mysql-test/suite/maria/t/maria-big2.test +++ b/mysql-test/suite/maria/t/maria-big2.test @@ -3968,8 +3968,6 @@ check table t2 extended; insert into t2(a,b) values ('khtlbejbtbtllowhmyhjyuyrioqcobsdzehdydiosshlsxmcazvggwvfdbsljoslaqbdmqunazcsmlvslxzkzwgihyfqmurpvhnxfdnqkzbegwboqymsxnfcespljoutxnfsomfamunmxklsklxxugokmhfoeetuxaqvrdmtpkpivjygmnpevzxodicjlwnloxizngjkwmfs','oa') ; check table t2 extended; -if (0) -{ insert into t2(a,b) values ('jaiaxujiqrrozh','oieurlfbbwwlkguvnloqsslsvhwuscyczrabztoaplqxfkxfxzbheiiqaxxdlkouwsdokanmrybgumlkwndavk') ; insert into t2(a,b) values ('omjfobinorjjzunhhvttazeyaqsyzkmxaglnrvloidfvbcmtnzljwhrlsmfgcdxfxbrpvkgkpubwpxbnrdchqvkclttixvjaedmnmpsnvajjmboqcnammkydqdajqcdemkiwrxvhtrkygviuhoewderwszmxvgruofwqk','lqdgwouzhktfrlxbbezsxgzponchhognwjkqgovqxzgbgsmuilvhipqeyxttiyhbuvbhwjdtnttlneqhmxsbggejridrzniyadovgquxlgpgjpsrdeemjikkhe') @@ -4072,5 +4070,6 @@ insert into t2(a,b) values ('vdypigdzycrldcfovmctkgeplggrowiuhybmwcwfna','vrgast ; insert into t2(a,b) values ('mozkakabudlebgqdozmskoznveytfekierfwfretwuirnxwdbhxfrembjguuizghjbgsiykzuenzgnrwpitpkbzdlaoofyzgkjisfsmgzaeqefothgxtxfnetuooyasqpmlfuoumztxryckfferfigfhlwjthlupgyrfbeneqsdnhftrhuldhgdkkpryrgazwergqxlhnboydjepgphierwwwcdreo','odaetcnblobbncllnwikkemfggnqwdmasluatsjltlrnkjxbtwofsxwtxjksejcmcihtbisgplpzjfmlldwporhoexdfaakpsziliengmjhkinoedmtfesewdtpjhksehtezhbujkbgtwxpyqzkwzaywyiocnplccfxuznlrbkligsazzng') ; -} enable_query_log; +check table t2 extended; +drop table t2; diff --git a/mysql-test/suite/maria/t/maria-connect.test b/mysql-test/suite/maria/t/maria-connect.test index 35a1518ca5a..f34f319a388 100644 --- a/mysql-test/suite/maria/t/maria-connect.test +++ b/mysql-test/suite/maria/t/maria-connect.test @@ -38,5 +38,6 @@ set binlog_format=default; --disable_result_log --disable_query_log eval set global storage_engine=$default; +set global maria_log_file_size=default; --enable_result_log --enable_query_log diff --git a/mysql-test/suite/maria/t/maria-page-checksum.test b/mysql-test/suite/maria/t/maria-page-checksum.test index e0a0a1517b1..3283a5c3c28 100644 --- a/mysql-test/suite/maria/t/maria-page-checksum.test +++ b/mysql-test/suite/maria/t/maria-page-checksum.test @@ -21,7 +21,7 @@ select @@global.maria_page_checksum; set global maria_page_checksum = 0 ; create table t1(a int) engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -34,7 +34,7 @@ EOF set global maria_page_checksum = 0 ; alter table t1 engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -50,7 +50,7 @@ drop table t1; set global maria_page_checksum = 0 ; create table t1(a int) engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -63,7 +63,7 @@ EOF set global maria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -79,7 +79,7 @@ drop table t1; set global maria_page_checksum = 0 ; create table t1(a int) engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -92,7 +92,7 @@ EOF set global maria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -108,7 +108,7 @@ drop table t1; set global maria_page_checksum = 0 ; create table t1(a int) engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -121,7 +121,7 @@ EOF set global maria_page_checksum = 1 ; alter table t1 engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -137,7 +137,7 @@ drop table t1; set global maria_page_checksum = 0 ; create table t1(a int) engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -150,7 +150,7 @@ EOF set global maria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -166,7 +166,7 @@ drop table t1; set global maria_page_checksum = 0 ; create table t1(a int) engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -179,7 +179,7 @@ EOF set global maria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -195,7 +195,7 @@ drop table t1; set global maria_page_checksum = 0 ; create table t1(a int) engine=maria PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -208,7 +208,7 @@ EOF set global maria_page_checksum = 0 ; alter table t1 engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -224,7 +224,7 @@ drop table t1; set global maria_page_checksum = 0 ; create table t1(a int) engine=maria PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -237,7 +237,7 @@ EOF set global maria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -253,7 +253,7 @@ drop table t1; set global maria_page_checksum = 0 ; create table t1(a int) engine=maria PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -266,7 +266,7 @@ EOF set global maria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -282,7 +282,7 @@ drop table t1; set global maria_page_checksum = 0 ; create table t1(a int) engine=maria PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -295,7 +295,7 @@ EOF set global maria_page_checksum = 1 ; alter table t1 engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -311,7 +311,7 @@ drop table t1; set global maria_page_checksum = 0 ; create table t1(a int) engine=maria PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -324,7 +324,7 @@ EOF set global maria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -340,7 +340,7 @@ drop table t1; set global maria_page_checksum = 0 ; create table t1(a int) engine=maria PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -353,7 +353,7 @@ EOF set global maria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -369,7 +369,7 @@ drop table t1; set global maria_page_checksum = 0 ; create table t1(a int) engine=maria PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -382,7 +382,7 @@ EOF set global maria_page_checksum = 0 ; alter table t1 engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -398,7 +398,7 @@ drop table t1; set global maria_page_checksum = 0 ; create table t1(a int) engine=maria PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -411,7 +411,7 @@ EOF set global maria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -427,7 +427,7 @@ drop table t1; set global maria_page_checksum = 0 ; create table t1(a int) engine=maria PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -440,7 +440,7 @@ EOF set global maria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -456,7 +456,7 @@ drop table t1; set global maria_page_checksum = 0 ; create table t1(a int) engine=maria PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -469,7 +469,7 @@ EOF set global maria_page_checksum = 1 ; alter table t1 engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -485,7 +485,7 @@ drop table t1; set global maria_page_checksum = 0 ; create table t1(a int) engine=maria PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -498,7 +498,7 @@ EOF set global maria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -514,7 +514,7 @@ drop table t1; set global maria_page_checksum = 0 ; create table t1(a int) engine=maria PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -527,7 +527,7 @@ EOF set global maria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -543,7 +543,7 @@ drop table t1; set global maria_page_checksum = 1 ; create table t1(a int) engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -556,7 +556,7 @@ EOF set global maria_page_checksum = 0 ; alter table t1 engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -572,7 +572,7 @@ drop table t1; set global maria_page_checksum = 1 ; create table t1(a int) engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -585,7 +585,7 @@ EOF set global maria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -601,7 +601,7 @@ drop table t1; set global maria_page_checksum = 1 ; create table t1(a int) engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -614,7 +614,7 @@ EOF set global maria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -630,7 +630,7 @@ drop table t1; set global maria_page_checksum = 1 ; create table t1(a int) engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -643,7 +643,7 @@ EOF set global maria_page_checksum = 1 ; alter table t1 engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -659,7 +659,7 @@ drop table t1; set global maria_page_checksum = 1 ; create table t1(a int) engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -672,7 +672,7 @@ EOF set global maria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -688,7 +688,7 @@ drop table t1; set global maria_page_checksum = 1 ; create table t1(a int) engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -701,7 +701,7 @@ EOF set global maria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -717,7 +717,7 @@ drop table t1; set global maria_page_checksum = 1 ; create table t1(a int) engine=maria PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -730,7 +730,7 @@ EOF set global maria_page_checksum = 0 ; alter table t1 engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -746,7 +746,7 @@ drop table t1; set global maria_page_checksum = 1 ; create table t1(a int) engine=maria PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -759,7 +759,7 @@ EOF set global maria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -775,7 +775,7 @@ drop table t1; set global maria_page_checksum = 1 ; create table t1(a int) engine=maria PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -788,7 +788,7 @@ EOF set global maria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -804,7 +804,7 @@ drop table t1; set global maria_page_checksum = 1 ; create table t1(a int) engine=maria PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -817,7 +817,7 @@ EOF set global maria_page_checksum = 1 ; alter table t1 engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -833,7 +833,7 @@ drop table t1; set global maria_page_checksum = 1 ; create table t1(a int) engine=maria PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -846,7 +846,7 @@ EOF set global maria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -862,7 +862,7 @@ drop table t1; set global maria_page_checksum = 1 ; create table t1(a int) engine=maria PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -875,7 +875,7 @@ EOF set global maria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -891,7 +891,7 @@ drop table t1; set global maria_page_checksum = 1 ; create table t1(a int) engine=maria PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -904,7 +904,7 @@ EOF set global maria_page_checksum = 0 ; alter table t1 engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -920,7 +920,7 @@ drop table t1; set global maria_page_checksum = 1 ; create table t1(a int) engine=maria PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -933,7 +933,7 @@ EOF set global maria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -949,7 +949,7 @@ drop table t1; set global maria_page_checksum = 1 ; create table t1(a int) engine=maria PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -962,7 +962,7 @@ EOF set global maria_page_checksum = 0 ; alter table t1 PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -978,7 +978,7 @@ drop table t1; set global maria_page_checksum = 1 ; create table t1(a int) engine=maria PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -991,7 +991,7 @@ EOF set global maria_page_checksum = 1 ; alter table t1 engine=maria ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1007,7 +1007,7 @@ drop table t1; set global maria_page_checksum = 1 ; create table t1(a int) engine=maria PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1020,7 +1020,7 @@ EOF set global maria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=0 ; show create table t1 /* expecting PAGE_CHECKSUM=0 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1036,7 +1036,7 @@ drop table t1; set global maria_page_checksum = 1 ; create table t1(a int) engine=maria PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1049,7 +1049,7 @@ EOF set global maria_page_checksum = 1 ; alter table t1 PAGE_CHECKSUM=1 ; show create table t1 /* expecting PAGE_CHECKSUM=1 */ ; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1072,7 +1072,7 @@ drop table t1; --echo # iteration 1 create table t1(a int) engine=maria ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1084,7 +1084,7 @@ EOF alter table t1 modify a bigint ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1099,7 +1099,7 @@ drop table t1; --echo # iteration 2 create table t1(a int) engine=maria ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1111,7 +1111,7 @@ EOF alter table t1 transactional=0 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1126,7 +1126,7 @@ drop table t1; --echo # iteration 3 create table t1(a int) engine=maria ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1138,7 +1138,7 @@ EOF alter table t1 transactional=1 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1153,7 +1153,7 @@ drop table t1; --echo # iteration 4 create table t1(a int) engine=maria ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1165,7 +1165,7 @@ EOF alter table t1 engine=maria ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1180,7 +1180,7 @@ drop table t1; --echo # iteration 5 create table t1(a int) engine=maria ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1192,7 +1192,7 @@ EOF alter table t1 engine=maria transactional=0 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1207,7 +1207,7 @@ drop table t1; --echo # iteration 6 create table t1(a int) engine=maria ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1219,7 +1219,7 @@ EOF alter table t1 engine=maria transactional=1 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1234,7 +1234,7 @@ drop table t1; --echo # iteration 7 create table t1(a int) engine=maria transactional=0 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1246,7 +1246,7 @@ EOF alter table t1 modify a bigint ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1261,7 +1261,7 @@ drop table t1; --echo # iteration 8 create table t1(a int) engine=maria transactional=0 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1273,7 +1273,7 @@ EOF alter table t1 transactional=0 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1288,7 +1288,7 @@ drop table t1; --echo # iteration 9 create table t1(a int) engine=maria transactional=0 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1300,7 +1300,7 @@ EOF alter table t1 transactional=1 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1315,7 +1315,7 @@ drop table t1; --echo # iteration 10 create table t1(a int) engine=maria transactional=0 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1327,7 +1327,7 @@ EOF alter table t1 engine=maria ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1342,7 +1342,7 @@ drop table t1; --echo # iteration 11 create table t1(a int) engine=maria transactional=0 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1354,7 +1354,7 @@ EOF alter table t1 engine=maria transactional=0 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1369,7 +1369,7 @@ drop table t1; --echo # iteration 12 create table t1(a int) engine=maria transactional=0 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1381,7 +1381,7 @@ EOF alter table t1 engine=maria transactional=1 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1396,7 +1396,7 @@ drop table t1; --echo # iteration 13 create table t1(a int) engine=maria transactional=1 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1408,7 +1408,7 @@ EOF alter table t1 modify a bigint ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1423,7 +1423,7 @@ drop table t1; --echo # iteration 14 create table t1(a int) engine=maria transactional=1 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1435,7 +1435,7 @@ EOF alter table t1 transactional=0 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1450,7 +1450,7 @@ drop table t1; --echo # iteration 15 create table t1(a int) engine=maria transactional=1 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1462,7 +1462,7 @@ EOF alter table t1 transactional=1 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1477,7 +1477,7 @@ drop table t1; --echo # iteration 16 create table t1(a int) engine=maria transactional=1 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1489,7 +1489,7 @@ EOF alter table t1 engine=maria ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1504,7 +1504,7 @@ drop table t1; --echo # iteration 17 create table t1(a int) engine=maria transactional=1 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1516,7 +1516,7 @@ EOF alter table t1 engine=maria transactional=0 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1531,7 +1531,7 @@ drop table t1; --echo # iteration 18 create table t1(a int) engine=maria transactional=1 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; @@ -1543,7 +1543,7 @@ EOF alter table t1 engine=maria transactional=1 ; show create table t1; ---exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/master-data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt +--exec $MARIA_CHK -dv $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt perl; use strict; use warnings; diff --git a/mysql-test/suite/maria/t/maria-purge.test b/mysql-test/suite/maria/t/maria-purge.test index 1e588807895..d30b71ae6ea 100644 --- a/mysql-test/suite/maria/t/maria-purge.test +++ b/mysql-test/suite/maria/t/maria-purge.test @@ -64,19 +64,19 @@ insert into t1 select * from t2; set global maria_log_file_size=16777216; # force a checkpoint to allow log purge eval set global maria_checkpoint_interval=$def_checkinterval; ---replace_regex /Size +[0-9]+ ; .+master-data/master-data/ +--replace_regex /Size +[0-9]+ ; .+data/data/ SHOW ENGINE maria logs; insert into t2 select * from t1; insert into t1 select * from t2; eval set global maria_checkpoint_interval=$def_checkinterval; ---replace_regex /Size +[0-9]+ ; .+master-data/master-data/ +--replace_regex /Size +[0-9]+ ; .+data/data/ SHOW ENGINE maria logs; set global maria_log_file_size=16777216; select @@global.maria_log_file_size; eval set global maria_checkpoint_interval=$def_checkinterval; ---replace_regex /Size +[0-9]+ ; .+master-data/master-data/ +--replace_regex /Size +[0-9]+ ; .+data/data/ SHOW ENGINE maria logs; set global maria_log_file_size=8388608; select @@global.maria_log_file_size; @@ -84,26 +84,26 @@ select @@global.maria_log_file_size; set global maria_log_purge_type=at_flush; insert into t1 select * from t2; eval set global maria_checkpoint_interval=$def_checkinterval; ---replace_regex /Size +[0-9]+ ; .+master-data/master-data/ +--replace_regex /Size +[0-9]+ ; .+data/data/ SHOW ENGINE maria logs; flush logs; ---replace_regex /Size +[0-9]+ ; .+master-data/master-data/ +--replace_regex /Size +[0-9]+ ; .+data/data/ SHOW ENGINE maria logs; set global maria_log_file_size=16777216; set global maria_log_purge_type=external; insert into t1 select * from t2; eval set global maria_checkpoint_interval=$def_checkinterval; ---replace_regex /Size +[0-9]+ ; .+master-data/master-data/ +--replace_regex /Size +[0-9]+ ; .+data/data/ SHOW ENGINE maria logs; flush logs; ---replace_regex /Size +[0-9]+ ; .+master-data/master-data/ +--replace_regex /Size +[0-9]+ ; .+data/data/ SHOW ENGINE maria logs; set global maria_log_purge_type=immediate; insert into t1 select * from t2; eval set global maria_checkpoint_interval=$def_checkinterval; ---replace_regex /Size +[0-9]+ ; .+master-data/master-data/ +--replace_regex /Size +[0-9]+ ; .+data/data/ SHOW ENGINE maria logs; drop table t1, t2; diff --git a/mysql-test/suite/maria/t/maria-recover.test b/mysql-test/suite/maria/t/maria-recover.test index 63e764a3b0e..de085d3ee8f 100644 --- a/mysql-test/suite/maria/t/maria-recover.test +++ b/mysql-test/suite/maria/t/maria-recover.test @@ -28,9 +28,9 @@ insert into t1 select concat(a,'b') from t1 limit 1; # a specific name to do specific detection (don't want to ignore # any corruption messages of other tests using "t2" as table). -copy_file $MYSQLTEST_VARDIR/master-data/mysqltest/t1.frm $MYSQLTEST_VARDIR/master-data/mysqltest/t_corrupted2.frm; -copy_file $MYSQLTEST_VARDIR/master-data/mysqltest/t1.MAD $MYSQLTEST_VARDIR/master-data/mysqltest/t_corrupted2.MAD; -copy_file $MYSQLTEST_VARDIR/master-data/mysqltest/t1.MAI $MYSQLTEST_VARDIR/master-data/mysqltest/t_corrupted2.MAI; +copy_file $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/t1.frm $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/t_corrupted2.frm; +copy_file $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/t1.MAD $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/t_corrupted2.MAD; +copy_file $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/t1.MAI $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest/t_corrupted2.MAI; # Ruin the index file. # If maria-block-size is smaller than the default, the corruption @@ -38,7 +38,7 @@ copy_file $MYSQLTEST_VARDIR/master-data/mysqltest/t1.MAI $MYSQLTEST_VARDIR/maste perl; use strict; use warnings; - my $fname= "$ENV{'MYSQLTEST_VARDIR'}/master-data/mysqltest/t_corrupted2.MAI"; + my $fname= "$ENV{'MYSQLTEST_VARDIR'}/mysqld.1/data/mysqltest/t_corrupted2.MAI"; open(FILE, "+<", $fname) or die; my $whatever= ("\xAB" x 100); sysseek (FILE, 8192, 0) or die; @@ -54,3 +54,4 @@ enable_ps_protocol; select * from t_corrupted2; # should show just rows drop database mysqltest; +set @@global.maria_recover=BACKUP; diff --git a/mysql-test/suite/maria/t/maria-recovery-rtree-ft.test b/mysql-test/suite/maria/t/maria-recovery-rtree-ft.test index 5416c2e4edf..f66d3d8a4a4 100644 --- a/mysql-test/suite/maria/t/maria-recovery-rtree-ft.test +++ b/mysql-test/suite/maria/t/maria-recovery-rtree-ft.test @@ -208,4 +208,10 @@ select count(*) from t2; } -- source include/maria_verify_recovery.inc -drop table t1,t2; + +let $mms_purpose=comparison; +eval drop database mysqltest_for_$mms_purpose; +let $mms_purpose=feeding_recovery; +eval drop database mysqltest_for_$mms_purpose; +drop database mysqltest; + diff --git a/mysql-test/suite/maria/t/maria-recovery.test b/mysql-test/suite/maria/t/maria-recovery.test index c3c9306f4d5..6ba8e65e658 100644 --- a/mysql-test/suite/maria/t/maria-recovery.test +++ b/mysql-test/suite/maria/t/maria-recovery.test @@ -6,7 +6,7 @@ --source include/have_maria.inc set global maria_log_file_size=4294967295; -let $MARIA_LOG=../tmp; +let $MARIA_LOG=../../tmp; --disable_warnings drop database if exists mysqltest; diff --git a/mysql-test/suite/maria/t/maria-recovery2.test b/mysql-test/suite/maria/t/maria-recovery2.test index 8ce601625f6..0ab66f8fa35 100644 --- a/mysql-test/suite/maria/t/maria-recovery2.test +++ b/mysql-test/suite/maria/t/maria-recovery2.test @@ -6,7 +6,7 @@ --source include/have_maria.inc set global maria_log_file_size=4294967295; -let $MARIA_LOG=../tmp; +let $MARIA_LOG=../../tmp; --disable_warnings drop database if exists mysqltest; diff --git a/mysql-test/suite/maria/t/maria-recovery3.test b/mysql-test/suite/maria/t/maria-recovery3.test index fc1883b1aa7..a08267070d0 100644 --- a/mysql-test/suite/maria/t/maria-recovery3.test +++ b/mysql-test/suite/maria/t/maria-recovery3.test @@ -6,7 +6,7 @@ --source include/have_maria.inc set global maria_log_file_size=4294967295; -let $MARIA_LOG=../tmp; +let $MARIA_LOG=../../tmp; --disable_warnings drop database if exists mysqltest; @@ -113,4 +113,6 @@ drop table t1; # clean up everything let $mms_purpose=comparison; eval drop database mysqltest_for_$mms_purpose; +let $mms_purpose=feeding_recovery; +eval drop database mysqltest_for_$mms_purpose; drop database mysqltest; diff --git a/mysql-test/suite/maria/t/maria.test b/mysql-test/suite/maria/t/maria.test index 216ac9df5c8..eeb69c3687c 100644 --- a/mysql-test/suite/maria/t/maria.test +++ b/mysql-test/suite/maria/t/maria.test @@ -1075,9 +1075,9 @@ SHOW TABLE STATUS LIKE 't1'; ALTER TABLE t1 ENABLE KEYS; --replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # SHOW TABLE STATUS LIKE 't1'; -#--exec ls -log var/master-data/test/t1 -#--exec maria_chk -dvv var/master-data/test/t1 -#--exec maria_chk -iev var/master-data/test/t1 +#--exec ls -log var/mysqld.1/data/test/t1 +#--exec maria_chk -dvv var/mysqld.1/data/test/t1 +#--exec maria_chk -iev var/mysqld.1/data/test/t1 --echo # Enable keys with parallel repair SET @@maria_repair_threads=2; ALTER TABLE t1 DISABLE KEYS; @@ -1406,7 +1406,7 @@ CREATE TABLE t1 ( KEY (c2) ) ENGINE=maria DEFAULT CHARSET=utf8 PACK_KEYS=0; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MARIA_CHK -d $MYSQLTEST_VARDIR/master-data/test/t1 +--exec $MARIA_CHK -d $MYSQLTEST_VARDIR/mysqld.1/data/test/t1 DROP TABLE t1; # Test warnings with transactional=1 with MyISAM @@ -1874,5 +1874,6 @@ drop table t1; --disable_result_log --disable_query_log eval set global storage_engine=$default_engine, maria_page_checksum=$default_checksum; +set global maria_log_file_size=default; --enable_result_log --enable_query_log diff --git a/mysql-test/suite/maria/t/maria2-master.opt b/mysql-test/suite/maria/t/maria2-master.opt new file mode 100644 index 00000000000..4c6c914a6fd --- /dev/null +++ b/mysql-test/suite/maria/t/maria2-master.opt @@ -0,0 +1,2 @@ +--secure-file-priv="" + diff --git a/mysql-test/suite/maria/t/maria2.test b/mysql-test/suite/maria/t/maria2.test index 682e03890a4..3dd35697a1f 100644 --- a/mysql-test/suite/maria/t/maria2.test +++ b/mysql-test/suite/maria/t/maria2.test @@ -103,8 +103,8 @@ drop table t1; # test LOAD DATA INFILE REPLACE create table t1 (pk int primary key, apk int unique, data int) engine=maria; insert into t1 values (1, 1, 1), (4, 4, 4), (6, 6, 6); -load data concurrent infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk); +load data concurrent infile '../../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk); select * from t1 order by pk; -load data infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk); +load data infile '../../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk); select * from t1 order by pk; drop table t1; diff --git a/mysql-test/suite/maria/t/maria3.test b/mysql-test/suite/maria/t/maria3.test index ddb6af8fa7a..eeb3706fed3 100644 --- a/mysql-test/suite/maria/t/maria3.test +++ b/mysql-test/suite/maria/t/maria3.test @@ -484,5 +484,6 @@ drop table t1, t2; --disable_result_log --disable_query_log eval set global storage_engine=$default_engine, maria_page_checksum=$default_checksum; +set global maria_log_file_size=default; --enable_result_log --enable_query_log diff --git a/mysql-test/suite/maria/t/maria_partition.test b/mysql-test/suite/maria/t/maria_partition.test index e923096b75e..4e99735f9a8 100644 --- a/mysql-test/suite/maria/t/maria_partition.test +++ b/mysql-test/suite/maria/t/maria_partition.test @@ -31,5 +31,6 @@ drop table t1; --disable_result_log --disable_query_log eval set global storage_engine=$default_engine, maria_page_checksum=$default_checksum; +set global maria_log_file_size=default; --enable_result_log --enable_query_log diff --git a/mysql-test/suite/maria/t/maria_showlog_error.test b/mysql-test/suite/maria/t/maria_showlog_error.test index d5eded903cd..c1e776fb085 100644 --- a/mysql-test/suite/maria/t/maria_showlog_error.test +++ b/mysql-test/suite/maria/t/maria_showlog_error.test @@ -18,7 +18,7 @@ connection default; connection default; -remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000001; +remove_file $MYSQLTEST_VARDIR/mysqld.1/data/$MARIA_LOG/maria_log.00000001; --replace_regex /Size unknown ; .*maria_log.00000001/Size unknown ; maria_log.00000001/ show engine maria logs; diff --git a/mysql-test/suite/maria/t/ps_maria.test b/mysql-test/suite/maria/t/ps_maria.test index d5a756c261e..29ebcfed5b2 100644 --- a/mysql-test/suite/maria/t/ps_maria.test +++ b/mysql-test/suite/maria/t/ps_maria.test @@ -45,3 +45,9 @@ drop table t2 ; drop table t1, t9; # End of 4.1 tests + +--disable_result_log +--disable_query_log +set global maria_log_file_size=default; +--enable_result_log +--enable_query_log diff --git a/mysql-test/suite/ndb/my.cnf b/mysql-test/suite/ndb/my.cnf new file mode 100644 index 00000000000..60769272ada --- /dev/null +++ b/mysql-test/suite/ndb/my.cnf @@ -0,0 +1,20 @@ +!include include/default_mysqld.cnf +!include include/default_ndbd.cnf + +[cluster_config.1] +NoOfReplicas= 2 +ndbd=, +ndb_mgmd= +mysqld=, + +[mysqld] +# Make all mysqlds use cluster +ndbcluster + +[ENV] +NDB_CONNECTSTRING= @mysql_cluster.1.ndb_connectstring +MASTER_MYPORT= @mysqld.1.1.port +MASTER_MYPORT1= @mysqld.2.1.port + +NDB_BACKUP_DIR= @cluster_config.ndbd.1.1.BackupDataDir + diff --git a/mysql-test/suite/ndb/r/loaddata_autocom_ndb.result b/mysql-test/suite/ndb/r/loaddata_autocom_ndb.result index f98e6a76981..b4d0b0b81a7 100644 --- a/mysql-test/suite/ndb/r/loaddata_autocom_ndb.result +++ b/mysql-test/suite/ndb/r/loaddata_autocom_ndb.result @@ -2,7 +2,7 @@ SET SESSION STORAGE_ENGINE = ndbcluster; drop table if exists t1; create table t1 (id int unsigned not null auto_increment primary key, a text, b text); start transaction; -load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b); +load data infile 'LOAD_FILE' into table t1 fields terminated by ',' enclosed by '''' (a, b); Warnings: Warning 1261 Row 3 doesn't contain data for all columns commit; @@ -11,7 +11,7 @@ count(*) 4 truncate table t1; start transaction; -load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b); +load data infile 'LOAD_FILE' into table t1 fields terminated by ',' enclosed by '''' (a, b); Warnings: Warning 1261 Row 3 doesn't contain data for all columns rollback; diff --git a/mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result b/mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result index 6631feeaa17..0699f8c4a59 100644 --- a/mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result +++ b/mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result @@ -10,32 +10,32 @@ create table t1 (a int primary key) engine=ndb; create table t2 (a int primary key) engine=ndb; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin1.000001 # Query 1 # create database mysqltest -master-bin1.000001 # Query 1 # use `mysqltest`; create table t1 (a int primary key) engine=ndb -master-bin1.000001 # Query 102 # use `test`; create table t2 (a int primary key) engine=ndb +mysqld-bin.000001 # Query 1 # create database mysqltest +mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t1 (a int primary key) engine=ndb +mysqld-bin.000001 # Query 2 # use `test`; create table t2 (a int primary key) engine=ndb show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # create database mysqltest -master-bin.000001 # Query 1 # use `mysqltest`; create table t1 (a int primary key) engine=ndb -master-bin.000001 # Query 102 # use `test`; create table t2 (a int primary key) engine=ndb +mysqld-bin.000001 # Query 1 # create database mysqltest +mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t1 (a int primary key) engine=ndb +mysqld-bin.000001 # Query 2 # use `test`; create table t2 (a int primary key) engine=ndb reset master; reset master; alter table t2 add column (b int); show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 102 # use `test`; alter table t2 add column (b int) +mysqld-bin.000001 # Query 2 # use `test`; alter table t2 add column (b int) reset master; reset master; ALTER DATABASE mysqltest CHARACTER SET latin1; drop table mysqltest.t1; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 102 # ALTER DATABASE mysqltest CHARACTER SET latin1 -master-bin.000001 # Query 102 # use `mysqltest`; drop table `t1` +mysqld-bin.000001 # Query 2 # ALTER DATABASE mysqltest CHARACTER SET latin1 +mysqld-bin.000001 # Query 2 # use `mysqltest`; drop table `t1` show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 102 # ALTER DATABASE mysqltest CHARACTER SET latin1 -master-bin.000001 # Query 102 # use `mysqltest`; drop table `t1` +mysqld-bin.000001 # Query 2 # ALTER DATABASE mysqltest CHARACTER SET latin1 +mysqld-bin.000001 # Query 2 # use `mysqltest`; drop table `t1` reset master; reset master; use test; @@ -44,14 +44,14 @@ drop database mysqltest; create table t1 (a int primary key) engine=ndb; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin1.000001 # Query 102 # BEGIN -master-bin1.000001 # Table_map 102 # table_id: # (test.t2) -master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status) -master-bin1.000001 # Write_rows 102 # table_id: # -master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F -master-bin1.000001 # Query 102 # COMMIT -master-bin1.000001 # Query 1 # drop database mysqltest -master-bin1.000001 # Query 1 # use `test`; create table t1 (a int primary key) engine=ndb +mysqld-bin.000001 # Query 2 # BEGIN +mysqld-bin.000001 # Table_map 2 # table_id: # (test.t2) +mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status) +mysqld-bin.000001 # Write_rows 2 # table_id: # +mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Query 2 # COMMIT +mysqld-bin.000001 # Query 1 # drop database mysqltest +mysqld-bin.000001 # Query 1 # use `test`; create table t1 (a int primary key) engine=ndb drop table t2; reset master; reset master; @@ -85,63 +85,63 @@ DROP LOGFILE GROUP lg1 ENGINE =NDB; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin1.000001 # Query 1 # CREATE LOGFILE GROUP lg1 +mysqld-bin.000001 # Query 1 # CREATE LOGFILE GROUP lg1 ADD UNDOFILE 'undofile.dat' INITIAL_SIZE 16M UNDO_BUFFER_SIZE = 1M ENGINE=NDB -master-bin1.000001 # Query 1 # ALTER LOGFILE GROUP lg1 +mysqld-bin.000001 # Query 1 # ALTER LOGFILE GROUP lg1 ADD UNDOFILE 'undofile02.dat' INITIAL_SIZE = 4M ENGINE=NDB -master-bin1.000001 # Query 1 # CREATE TABLESPACE ts1 +mysqld-bin.000001 # Query 1 # CREATE TABLESPACE ts1 ADD DATAFILE 'datafile.dat' USE LOGFILE GROUP lg1 INITIAL_SIZE 12M ENGINE NDB -master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1 +mysqld-bin.000001 # Query 1 # ALTER TABLESPACE ts1 ADD DATAFILE 'datafile02.dat' INITIAL_SIZE = 4M ENGINE=NDB -master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1 +mysqld-bin.000001 # Query 1 # ALTER TABLESPACE ts1 DROP DATAFILE 'datafile.dat' ENGINE = NDB -master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1 +mysqld-bin.000001 # Query 1 # ALTER TABLESPACE ts1 DROP DATAFILE 'datafile02.dat' ENGINE = NDB -master-bin1.000001 # Query 1 # DROP TABLESPACE ts1 +mysqld-bin.000001 # Query 1 # DROP TABLESPACE ts1 ENGINE = NDB -master-bin1.000001 # Query 1 # DROP LOGFILE GROUP lg1 +mysqld-bin.000001 # Query 1 # DROP LOGFILE GROUP lg1 ENGINE =NDB show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin1.000001 # Query 1 # CREATE LOGFILE GROUP lg1 +mysqld-bin.000001 # Query 1 # CREATE LOGFILE GROUP lg1 ADD UNDOFILE 'undofile.dat' INITIAL_SIZE 16M UNDO_BUFFER_SIZE = 1M ENGINE=NDB -master-bin1.000001 # Query 1 # ALTER LOGFILE GROUP lg1 +mysqld-bin.000001 # Query 1 # ALTER LOGFILE GROUP lg1 ADD UNDOFILE 'undofile02.dat' INITIAL_SIZE = 4M ENGINE=NDB -master-bin1.000001 # Query 1 # CREATE TABLESPACE ts1 +mysqld-bin.000001 # Query 1 # CREATE TABLESPACE ts1 ADD DATAFILE 'datafile.dat' USE LOGFILE GROUP lg1 INITIAL_SIZE 12M ENGINE NDB -master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1 +mysqld-bin.000001 # Query 1 # ALTER TABLESPACE ts1 ADD DATAFILE 'datafile02.dat' INITIAL_SIZE = 4M ENGINE=NDB -master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1 +mysqld-bin.000001 # Query 1 # ALTER TABLESPACE ts1 DROP DATAFILE 'datafile.dat' ENGINE = NDB -master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1 +mysqld-bin.000001 # Query 1 # ALTER TABLESPACE ts1 DROP DATAFILE 'datafile02.dat' ENGINE = NDB -master-bin1.000001 # Query 1 # DROP TABLESPACE ts1 +mysqld-bin.000001 # Query 1 # DROP TABLESPACE ts1 ENGINE = NDB -master-bin1.000001 # Query 1 # DROP LOGFILE GROUP lg1 +mysqld-bin.000001 # Query 1 # DROP LOGFILE GROUP lg1 ENGINE =NDB drop table t1; reset master; @@ -156,13 +156,13 @@ create table t3 (a int key) engine=ndb; rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin1.000001 # Query 1 # use `test`; create table t1 (a int key) engine=ndb -master-bin1.000001 # Query 1 # use `test`; create table t2 (a int key) engine=ndb -master-bin1.000001 # Query 1 # use `test`; create table t3 (a int key) engine=ndb -master-bin1.000001 # Query 1 # use `test`; rename table `test.t3` to `test.t4` -master-bin1.000001 # Query 1 # use `test`; rename table `test.t2` to `test.t3` -master-bin1.000001 # Query 1 # use `test`; rename table `test.t1` to `test.t2` -master-bin1.000001 # Query 1 # use `test`; rename table `test.t4` to `test.t1` +mysqld-bin.000001 # Query 1 # use `test`; create table t1 (a int key) engine=ndb +mysqld-bin.000001 # Query 1 # use `test`; create table t2 (a int key) engine=ndb +mysqld-bin.000001 # Query 1 # use `test`; create table t3 (a int key) engine=ndb +mysqld-bin.000001 # Query 1 # use `test`; rename table `test.t3` to `test.t4` +mysqld-bin.000001 # Query 1 # use `test`; rename table `test.t2` to `test.t3` +mysqld-bin.000001 # Query 1 # use `test`; rename table `test.t1` to `test.t2` +mysqld-bin.000001 # Query 1 # use `test`; rename table `test.t4` to `test.t1` drop table t1; drop table t2; drop table t3; @@ -179,18 +179,18 @@ insert into t2 values(2); drop table t2; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin1.000001 # Query 1 # use `test`; create table t1 (a int key) engine=ndb -master-bin1.000001 # Query 102 # BEGIN -master-bin1.000001 # Table_map 102 # table_id: # (test.t1) -master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status) -master-bin1.000001 # Write_rows 102 # table_id: # -master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F -master-bin1.000001 # Query 102 # COMMIT -master-bin1.000001 # Query 1 # use `test`; rename table `test.t1` to `test.t2` -master-bin1.000001 # Query 102 # BEGIN -master-bin1.000001 # Table_map 102 # table_id: # (test.t2) -master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status) -master-bin1.000001 # Write_rows 102 # table_id: # -master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F -master-bin1.000001 # Query 102 # COMMIT -master-bin1.000001 # Query 102 # use `test`; drop table t2 +mysqld-bin.000001 # Query 1 # use `test`; create table t1 (a int key) engine=ndb +mysqld-bin.000001 # Query 2 # BEGIN +mysqld-bin.000001 # Table_map 2 # table_id: # (test.t1) +mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status) +mysqld-bin.000001 # Write_rows 2 # table_id: # +mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Query 2 # COMMIT +mysqld-bin.000001 # Query 1 # use `test`; rename table `test.t1` to `test.t2` +mysqld-bin.000001 # Query 2 # BEGIN +mysqld-bin.000001 # Table_map 2 # table_id: # (test.t2) +mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status) +mysqld-bin.000001 # Write_rows 2 # table_id: # +mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Query 2 # COMMIT +mysqld-bin.000001 # Query 2 # use `test`; drop table t2 diff --git a/mysql-test/suite/ndb/r/ndb_binlog_discover.result b/mysql-test/suite/ndb/r/ndb_binlog_discover.result index 7c3a976c4d5..f8704971878 100644 --- a/mysql-test/suite/ndb/r/ndb_binlog_discover.result +++ b/mysql-test/suite/ndb/r/ndb_binlog_discover.result @@ -3,15 +3,15 @@ create table t1 (a int key) engine=ndb; reset master; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Incident 1 # #1 (LOST_EVENTS) -master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 -PURGE MASTER LOGS TO 'master-bin.000002'; +mysqld-bin.000001 # Incident 1 # #1 (LOST_EVENTS) +mysqld-bin.000001 # Rotate 1 # mysqld-bin.000002;pos=4 +PURGE MASTER LOGS TO 'mysqld-bin.000002'; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000002 # Query 1 # BEGIN -master-bin.000002 # Table_map 1 # table_id: # (test.t1) -master-bin.000002 # Table_map 1 # table_id: # (mysql.ndb_apply_status) -master-bin.000002 # Write_rows 1 # table_id: # -master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000002 # Query 1 # COMMIT +mysqld-bin.000002 # Query 1 # BEGIN +mysqld-bin.000002 # Table_map 1 # table_id: # (test.t1) +mysqld-bin.000002 # Table_map 1 # table_id: # (mysql.ndb_apply_status) +mysqld-bin.000002 # Write_rows 1 # table_id: # +mysqld-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F +mysqld-bin.000002 # Query 1 # COMMIT drop table t1; diff --git a/mysql-test/suite/ndb/r/ndb_binlog_format.result b/mysql-test/suite/ndb/r/ndb_binlog_format.result index 30c2ca872ed..bb02002ed58 100644 --- a/mysql-test/suite/ndb/r/ndb_binlog_format.result +++ b/mysql-test/suite/ndb/r/ndb_binlog_format.result @@ -14,19 +14,19 @@ UPDATE t3, t2 SET e = 2, b = 3 WHERE f = c; COMMIT; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (1,2), (2,1), (2,2) -master-bin.000001 # Query # # use `test`; BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES (1,1), (1,2), (2,1), (2,2) -master-bin.000001 # Query # # use `test`; COMMIT -master-bin.000001 # Query # # use `test`; UPDATE t1, t2 SET m = 2, b = 3 WHERE n = c -master-bin.000001 # Query # # use `test`; BEGIN -master-bin.000001 # Query # # use `test`; INSERT INTO t3 VALUES (1,1), (1,2), (2,1), (2,2) -master-bin.000001 # Query # # use `test`; UPDATE t1, t3 SET m = 2, e = 3 WHERE n = f -master-bin.000001 # Query # # use `test`; UPDATE t3, t2 SET e = 2, b = 3 WHERE f = c -master-bin.000001 # Query # # use `test`; COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t3) -master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT +mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (1,2), (2,1), (2,2) +mysqld-bin.000001 # Query # # use `test`; BEGIN +mysqld-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES (1,1), (1,2), (2,1), (2,2) +mysqld-bin.000001 # Query # # use `test`; COMMIT +mysqld-bin.000001 # Query # # use `test`; UPDATE t1, t2 SET m = 2, b = 3 WHERE n = c +mysqld-bin.000001 # Query # # use `test`; BEGIN +mysqld-bin.000001 # Query # # use `test`; INSERT INTO t3 VALUES (1,1), (1,2), (2,1), (2,2) +mysqld-bin.000001 # Query # # use `test`; UPDATE t1, t3 SET m = 2, e = 3 WHERE n = f +mysqld-bin.000001 # Query # # use `test`; UPDATE t3, t2 SET e = 2, b = 3 WHERE f = c +mysqld-bin.000001 # Query # # use `test`; COMMIT +mysqld-bin.000001 # Query # # BEGIN +mysqld-bin.000001 # Table_map # # table_id: # (test.t3) +mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) +mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Query # # COMMIT DROP TABLE t1, t2, t3; diff --git a/mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result b/mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result index e4c9faa802c..d018f67dd71 100644 --- a/mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result +++ b/mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result @@ -7,5 +7,5 @@ create table t1 (a int primary key, b int) engine=ndb; insert into t1 values (1, 1); show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; drop table if exists t1 +mysqld-bin.000001 # Query 1 # use `test`; drop table if exists t1 drop database mysqltest; diff --git a/mysql-test/suite/ndb/r/ndb_binlog_log_bin.result b/mysql-test/suite/ndb/r/ndb_binlog_log_bin.result index f80a46324e0..0260d49f75f 100644 --- a/mysql-test/suite/ndb/r/ndb_binlog_log_bin.result +++ b/mysql-test/suite/ndb/r/ndb_binlog_log_bin.result @@ -11,27 +11,27 @@ insert into t1 values (1,1); alter table t1 add c int; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # BEGIN -master-bin.000001 # Table_map 1 # table_id: # (mysqltest.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # COMMIT +mysqld-bin.000001 # Query 1 # BEGIN +mysqld-bin.000001 # Table_map 1 # table_id: # (mysqltest.t1) +mysqld-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) +mysqld-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Query 1 # COMMIT reset master; use mysqltest; insert into t2 values (1,1); show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin1.000001 # Query 102 # BEGIN -master-bin1.000001 # Table_map 102 # table_id: # (mysqltest.t1) -master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status) -master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F -master-bin1.000001 # Query 102 # COMMIT -master-bin1.000001 # Query 102 # BEGIN -master-bin1.000001 # Table_map 102 # table_id: # (mysqltest.t2) -master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status) -master-bin1.000001 # Write_rows 102 # table_id: # -master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F -master-bin1.000001 # Query 102 # COMMIT +mysqld-bin.000001 # Query 2 # BEGIN +mysqld-bin.000001 # Table_map 2 # table_id: # (mysqltest.t1) +mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status) +mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Query 2 # COMMIT +mysqld-bin.000001 # Query 2 # BEGIN +mysqld-bin.000001 # Table_map 2 # table_id: # (mysqltest.t2) +mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status) +mysqld-bin.000001 # Write_rows 2 # table_id: # +mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Query 2 # COMMIT reset master; use mysqltest; drop table t1; @@ -41,40 +41,40 @@ create table t2 (d int key, e int) engine=ndb; insert into t1 values (1,1); show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # BEGIN -master-bin.000001 # Table_map 1 # table_id: # (mysqltest.t2) -master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # COMMIT -master-bin.000001 # Query 1 # use `mysqltest`; drop table t1 -master-bin.000001 # Query 1 # use `mysqltest`; drop table t2 -master-bin.000001 # Query 1 # use `mysqltest`; create table t1 (d int key, e int) engine=ndb -master-bin.000001 # Query 1 # use `mysqltest`; create table t2 (d int key, e int) engine=ndb -master-bin.000001 # Query 1 # BEGIN -master-bin.000001 # Table_map 1 # table_id: # (mysqltest.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # COMMIT +mysqld-bin.000001 # Query 1 # BEGIN +mysqld-bin.000001 # Table_map 1 # table_id: # (mysqltest.t2) +mysqld-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) +mysqld-bin.000001 # Write_rows 1 # table_id: # +mysqld-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Query 1 # COMMIT +mysqld-bin.000001 # Query 1 # use `mysqltest`; drop table t1 +mysqld-bin.000001 # Query 1 # use `mysqltest`; drop table t2 +mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t1 (d int key, e int) engine=ndb +mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t2 (d int key, e int) engine=ndb +mysqld-bin.000001 # Query 1 # BEGIN +mysqld-bin.000001 # Table_map 1 # table_id: # (mysqltest.t1) +mysqld-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) +mysqld-bin.000001 # Write_rows 1 # table_id: # +mysqld-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Query 1 # COMMIT use mysqltest; insert into t2 values (1,1); show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin1.000001 # Query 1 # use `mysqltest`; drop table `t1` -master-bin1.000001 # Query 1 # use `mysqltest`; drop table `t2` -master-bin1.000001 # Query 1 # use `mysqltest`; create table t1 (d int key, e int) engine=ndb -master-bin1.000001 # Query 1 # use `mysqltest`; create table t2 (d int key, e int) engine=ndb -master-bin1.000001 # Query 102 # BEGIN -master-bin1.000001 # Table_map 102 # table_id: # (mysqltest.t1) -master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status) -master-bin1.000001 # Write_rows 102 # table_id: # -master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F -master-bin1.000001 # Query 102 # COMMIT -master-bin1.000001 # Query 102 # BEGIN -master-bin1.000001 # Table_map 102 # table_id: # (mysqltest.t2) -master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status) -master-bin1.000001 # Write_rows 102 # table_id: # -master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F -master-bin1.000001 # Query 102 # COMMIT +mysqld-bin.000001 # Query 1 # use `mysqltest`; drop table `t1` +mysqld-bin.000001 # Query 1 # use `mysqltest`; drop table `t2` +mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t1 (d int key, e int) engine=ndb +mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t2 (d int key, e int) engine=ndb +mysqld-bin.000001 # Query 2 # BEGIN +mysqld-bin.000001 # Table_map 2 # table_id: # (mysqltest.t1) +mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status) +mysqld-bin.000001 # Write_rows 2 # table_id: # +mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Query 2 # COMMIT +mysqld-bin.000001 # Query 2 # BEGIN +mysqld-bin.000001 # Table_map 2 # table_id: # (mysqltest.t2) +mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status) +mysqld-bin.000001 # Write_rows 2 # table_id: # +mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Query 2 # COMMIT drop database mysqltest; diff --git a/mysql-test/suite/ndb/r/ndb_binlog_multi.result b/mysql-test/suite/ndb/r/ndb_binlog_multi.result index b2a9da39be0..e1af4aea092 100644 --- a/mysql-test/suite/ndb/r/ndb_binlog_multi.result +++ b/mysql-test/suite/ndb/r/ndb_binlog_multi.result @@ -8,13 +8,13 @@ CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB; INSERT INTO t2 VALUES (1,1),(2,2); show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin1.000001 # Query 102 # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB -master-bin1.000001 # Query 102 # BEGIN -master-bin1.000001 # Table_map 102 # table_id: # (test.t2) -master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status) -master-bin1.000001 # Write_rows 102 # table_id: # -master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F -master-bin1.000001 # Query 102 # COMMIT +mysqld-bin.000001 # Query 2 # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB +mysqld-bin.000001 # Query 2 # BEGIN +mysqld-bin.000001 # Table_map 2 # table_id: # (test.t2) +mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status) +mysqld-bin.000001 # Write_rows 2 # table_id: # +mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Query 2 # COMMIT select * from t2 order by a; a b 1 1 @@ -30,14 +30,14 @@ a b DROP TABLE t2; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 102 # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB -master-bin.000001 # Query 1 # BEGIN -master-bin.000001 # Table_map 1 # table_id: # (test.t2) -master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # COMMIT -master-bin.000001 # Query 1 # use `test`; DROP TABLE t2 +mysqld-bin.000001 # Query 2 # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB +mysqld-bin.000001 # Query 1 # BEGIN +mysqld-bin.000001 # Table_map 1 # table_id: # (test.t2) +mysqld-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) +mysqld-bin.000001 # Write_rows 1 # table_id: # +mysqld-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Query 1 # COMMIT +mysqld-bin.000001 # Query 1 # use `test`; DROP TABLE t2 SELECT inserts,updates,deletes,schemaops FROM mysql.ndb_binlog_index WHERE epoch=<the_epoch>; inserts updates deletes schemaops @@ -48,13 +48,13 @@ CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB; INSERT INTO t1 VALUES (1),(2); show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin1.000001 # Query 102 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB -master-bin1.000001 # Query 102 # BEGIN -master-bin1.000001 # Table_map 102 # table_id: # (test.t1) -master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status) -master-bin1.000001 # Write_rows 102 # table_id: # -master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F -master-bin1.000001 # Query 102 # COMMIT +mysqld-bin.000001 # Query 2 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB +mysqld-bin.000001 # Query 2 # BEGIN +mysqld-bin.000001 # Table_map 2 # table_id: # (test.t1) +mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status) +mysqld-bin.000001 # Write_rows 2 # table_id: # +mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Query 2 # COMMIT SELECT @the_epoch2:=epoch,inserts,updates,deletes,schemaops FROM mysql.ndb_binlog_index ORDER BY epoch DESC LIMIT 1; @the_epoch2:=epoch inserts updates deletes schemaops @@ -66,14 +66,14 @@ inserts updates deletes schemaops drop table t1; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin1.000001 # Query 102 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB -master-bin1.000001 # Query 102 # BEGIN -master-bin1.000001 # Table_map 102 # table_id: # (test.t1) -master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status) -master-bin1.000001 # Write_rows 102 # table_id: # -master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F -master-bin1.000001 # Query 102 # COMMIT -master-bin1.000001 # Query 102 # use `test`; drop table t1 +mysqld-bin.000001 # Query 2 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB +mysqld-bin.000001 # Query 2 # BEGIN +mysqld-bin.000001 # Table_map 2 # table_id: # (test.t1) +mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status) +mysqld-bin.000001 # Write_rows 2 # table_id: # +mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Query 2 # COMMIT +mysqld-bin.000001 # Query 2 # use `test`; drop table t1 SELECT inserts,updates,deletes,schemaops FROM mysql.ndb_binlog_index WHERE epoch > <the_epoch> AND epoch <= <the_epoch2>; inserts updates deletes schemaops diff --git a/mysql-test/suite/ndb/r/ndb_config.result b/mysql-test/suite/ndb/r/ndb_config.result index 9495af29df6..e12741212d6 100644 --- a/mysql-test/suite/ndb/r/ndb_config.result +++ b/mysql-test/suite/ndb/r/ndb_config.result @@ -1,4 +1,4 @@ -ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4, mysqld,5, mysqld,6, mysqld,7, mysqld,8, mysqld,9, mysqld,10, mysqld,11, +ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4,localhost mysqld,5,localhost mysqld,6,localhost 1,localhost,20971520,1048576 2,localhost,20971520,1048576 1 localhost 20971520 1048576 2 localhost 20971520 1048576 diff --git a/mysql-test/suite/ndb/r/ndb_load.result b/mysql-test/suite/ndb/r/ndb_load.result index 416a350066b..f990b12e735 100644 --- a/mysql-test/suite/ndb/r/ndb_load.result +++ b/mysql-test/suite/ndb/r/ndb_load.result @@ -1,10 +1,10 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=NDB; -LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1 ; +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_ln/words.dat' INTO TABLE t1 ; +LOAD DATA INFILE '../../../std_data/words.dat' INTO TABLE t1 ; SELECT * FROM t1 ORDER BY word; word Aarhus diff --git a/mysql-test/suite/ndb/r/ndb_loaddatalocal.result b/mysql-test/suite/ndb/r/ndb_loaddatalocal.result index 1d15c608f03..71d1b143089 100644 --- a/mysql-test/suite/ndb/r/ndb_loaddatalocal.result +++ b/mysql-test/suite/ndb/r/ndb_loaddatalocal.result @@ -1,19 +1,19 @@ DROP TABLE IF EXISTS t1; create table t1(a int) engine=myisam; -select * into outfile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1; +select * into outfile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1; drop table t1; create table t1(a int) engine=ndb; -load data local infile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1; +load data local infile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1; select count(*) from t1; count(*) 10000 drop table t1; create table t1(a int) engine=myisam; insert into t1 values (1), (2), (2), (3); -select * into outfile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1; +select * into outfile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1; drop table t1; create table t1(a int primary key) engine=ndb; -load data local infile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1; +load data local infile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1; select * from t1 order by a; a 1 @@ -22,10 +22,10 @@ a drop table t1; create table t1(a int) engine=myisam; insert into t1 values (1), (1), (2), (3); -select * into outfile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1; +select * into outfile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1; drop table t1; create table t1(a int primary key) engine=ndb; -load data local infile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1; +load data local infile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1; select * from t1 order by a; a 1 @@ -34,10 +34,10 @@ a drop table t1; create table t1(a int) engine=myisam; insert into t1 values (1), (2), (3), (3); -select * into outfile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1; +select * into outfile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1; drop table t1; create table t1(a int primary key) engine=ndb; -load data local infile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1; +load data local infile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1; select * from t1 order by a; a 1 diff --git a/mysql-test/suite/ndb/r/ndb_read_multi_range.result b/mysql-test/suite/ndb/r/ndb_read_multi_range.result index 4c3496f3f47..113fb28bb78 100644 --- a/mysql-test/suite/ndb/r/ndb_read_multi_range.result +++ b/mysql-test/suite/ndb/r/ndb_read_multi_range.result @@ -491,4 +491,4 @@ select * from t2 order by id; id 3 drop trigger kaboom; -drop table t1; +drop table t1, t2; diff --git a/mysql-test/suite/ndb/r/ndb_replace.result b/mysql-test/suite/ndb/r/ndb_replace.result index 23844ce3bff..ba78017ef7b 100644 --- a/mysql-test/suite/ndb/r/ndb_replace.result +++ b/mysql-test/suite/ndb/r/ndb_replace.result @@ -72,7 +72,7 @@ pk apk data 3 3 3 delete from t1; insert into t1 values (1, 1, 1), (4, 4, 4), (6, 6, 6); -load data infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk); +load data infile '../../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk); select * from t1 order by pk; pk apk data 1 1 1 @@ -80,7 +80,7 @@ pk apk data 5 6 NULL delete from t1; insert into t1 values (1, 1, 1), (3, 3, 3), (5, 5, 5); -load data infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk); +load data infile '../../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk); select * from t1 order by pk; pk apk data 1 1 1 diff --git a/mysql-test/suite/ndb/r/ndb_restore.result b/mysql-test/suite/ndb/r/ndb_restore.result index a33c5c5f31c..48c32bc14b6 100644 --- a/mysql-test/suite/ndb/r/ndb_restore.result +++ b/mysql-test/suite/ndb/r/ndb_restore.result @@ -131,12 +131,8 @@ create table t9 engine=myisam as select * from t9_c; create table t10 engine=myisam as select * from t10_c; ForceVarPart: 0 ForceVarPart: 1 -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; -SELECT @the_backup_id:=backup_id FROM test.backup_info; -@the_backup_id:=backup_id -<the_backup_id> +CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c; ForceVarPart: 0 @@ -290,12 +286,8 @@ auto_increment 10001 ALTER TABLE t7_c PARTITION BY LINEAR KEY (`dardtestard`); -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; -SELECT @the_backup_id:=backup_id FROM test.backup_info; -@the_backup_id:=backup_id -<the_backup_id> +CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c; select count(*) from t1; @@ -498,12 +490,8 @@ select * from t9_c) a; count(*) 3 drop table t1_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c; -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; -SELECT @the_backup_id:=backup_id FROM test.backup_info; -@the_backup_id:=backup_id -<the_backup_id> +CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; drop table if exists t2_c; diff --git a/mysql-test/suite/ndb/r/ndb_restore_partition.result b/mysql-test/suite/ndb/r/ndb_restore_partition.result index 7dc4057e615..58a35437a2e 100644 --- a/mysql-test/suite/ndb/r/ndb_restore_partition.result +++ b/mysql-test/suite/ndb/r/ndb_restore_partition.result @@ -125,12 +125,8 @@ create table t6 engine=myisam as select * from t6_c; create table t7 engine=myisam as select * from t7_c; create table t8 engine=myisam as select * from t8_c; create table t9 engine=myisam as select * from t9_c; -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; -SELECT @the_backup_id:=backup_id FROM test.backup_info; -@the_backup_id:=backup_id -<the_backup_id> +CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c; select count(*) from t1; @@ -248,12 +244,8 @@ PARTITION BY LINEAR HASH (`relatta`) PARTITIONS 4; ALTER TABLE t7_c PARTITION BY LINEAR KEY (`dardtestard`); -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; -SELECT @the_backup_id:=backup_id FROM test.backup_info; -@the_backup_id:=backup_id -<the_backup_id> +CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c; select count(*) from t1; @@ -456,12 +448,8 @@ select * from t9_c) a; count(*) 3 drop table t1_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c; -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; -SELECT @the_backup_id:=backup_id FROM test.backup_info; -@the_backup_id:=backup_id -<the_backup_id> +CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; Create table test/def/t2_c failed: Translate frm error drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; diff --git a/mysql-test/suite/ndb/r/ndb_restore_print.result b/mysql-test/suite/ndb/r/ndb_restore_print.result index e05f8e43d1a..7ff15652b3f 100644 --- a/mysql-test/suite/ndb/r/ndb_restore_print.result +++ b/mysql-test/suite/ndb/r/ndb_restore_print.result @@ -227,12 +227,8 @@ hex(h3) NULL hex(i1) NULL hex(i2) NULL hex(i3) NULL -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; -SELECT @the_backup_id:=backup_id FROM test.backup_info; -@the_backup_id:=backup_id -<the_backup_id> +CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; 1;0x1;0x17;0x789A;0x789ABCDE;0xFEDC0001;127;255;32767;65535;2147483647;4294967295;9223372036854775807;18446744073709551615;1;12345678901234567890123456789012;123456789;1;12345678901234567890123456789012;123456789;0x12;0x123456789ABCDEF0;0x012345;0x12;0x123456789ABCDEF0;0x00123450 2;0x0;0x0;0x0;0x0;0x0;-128;0;-32768;0;-2147483648;0;-9223372036854775808;0;;;;;;;0x0;0x0;0x0;0x0;0x0;0x0 @@ -261,12 +257,8 @@ create table t4 (pk int key, a int) engine ndb; insert into t2 values (1,11),(2,12),(3,13),(4,14),(5,15); insert into t3 values (1,21),(2,22),(3,23),(4,24),(5,25); insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35); -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; -SELECT @the_backup_id:=backup_id FROM test.backup_info; -@the_backup_id:=backup_id -<the_backup_id> +CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; '1' '1' '12345678901234567890123456789012' '123456789' '1' '12345678901234567890123456789012' '123456789' '0x20' '0x123456789ABCDEF020' '0x012345000020' '0x1200000020' '0x123456789ABCDEF000000020' '0x00123450000020' @@ -305,12 +297,8 @@ create table t1 insert into t1 values(1, 8388607, 16777215); insert into t1 values(2, -8388608, 0); insert into t1 values(3, -1, 1); -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; -SELECT @the_backup_id:=backup_id FROM test.backup_info; -@the_backup_id:=backup_id -<the_backup_id> +CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; 1;8388607;16777215 2;-8388608;0 diff --git a/mysql-test/suite/ndb/r/ndb_single_user.result b/mysql-test/suite/ndb/r/ndb_single_user.result index 0a4f7cd0b5f..8133e540d71 100644 --- a/mysql-test/suite/ndb/r/ndb_single_user.result +++ b/mysql-test/suite/ndb/r/ndb_single_user.result @@ -1,5 +1,4 @@ -use test; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; +drop table if exists t1,t2; create table t1 (a int key, b int unique, c int) engine ndb; ERROR HY000: Can't create table 'test.t1' (errno: 299) CREATE LOGFILE GROUP lg1 @@ -85,6 +84,7 @@ update t1 set b=b+100 where a > 7; delete from t1; insert into t1 select * from t2; create unique index new_index on t1 (b,c); +drop table t2; drop table t1; ERROR 42S02: Unknown table 't1' create index new_index_fail on t1 (c); diff --git a/mysql-test/suite/ndb/r/ndb_trigger.result b/mysql-test/suite/ndb/r/ndb_trigger.result index d074ad01c22..cc3e27df852 100644 --- a/mysql-test/suite/ndb/r/ndb_trigger.result +++ b/mysql-test/suite/ndb/r/ndb_trigger.result @@ -120,7 +120,7 @@ d 1 2.050000000000000000000000000000 delete from t1; delete from t2; insert into t1 values (3, 1, 1.05), (5, 2, 2.05); -load data infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (id, a); +load data infile '../../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (id, a); select * from t1 order by id; id a b 3 4 0.000000000000000000000000000000 diff --git a/mysql-test/suite/ndb/t/disabled.def b/mysql-test/suite/ndb/t/disabled.def index c638c7b4774..0fc9a5d3ad6 100644 --- a/mysql-test/suite/ndb/t/disabled.def +++ b/mysql-test/suite/ndb/t/disabled.def @@ -9,8 +9,7 @@ # Do not use any TAB characters for whitespace. # ############################################################################## -partition_03ndb : BUG#16385 2006-03-24 mikael Partitions: crash when updating a range partitioned NDB table -ndb_partition_error2 : HF is not sure if the test can work as internded on all the platforms +ndb_partition_error2 : Bug#40989 ndb_partition_error2 needs maintenance # the below testcase have been reworked to avoid the bug, test contains comment, keep bug open diff --git a/mysql-test/suite/ndb/t/ndb_alter_table.test b/mysql-test/suite/ndb/t/ndb_alter_table.test index cbd941b8a9c..bf0f8a540bb 100644 --- a/mysql-test/suite/ndb/t/ndb_alter_table.test +++ b/mysql-test/suite/ndb/t/ndb_alter_table.test @@ -362,7 +362,8 @@ CREATE TABLE t1 ( CREATE TEMPORARY TABLE ndb_show_tables (id INT, type VARCHAR(20), state VARCHAR(20), logging VARCHAR(20), _database VARCHAR(255), _schema VARCHAR(20), name VARCHAR(255)); --disable_warnings ---exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat +let $MYSQLD_DATADIR= `select @@datadir`; +--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLD_DATADIR/test/tmp.dat LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables; --enable_warnings @@ -372,7 +373,7 @@ truncate ndb_show_tables; alter table t1 change tiny new_tiny tinyint(4) DEFAULT '0' NOT NULL; --disable_warnings ---exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat +--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLD_DATADIR/test/tmp.dat LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables; --enable_warnings @@ -386,9 +387,9 @@ alter table t1 add index i2(new_tiny); drop index i1 on t1; --disable_warnings ---exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat +--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLD_DATADIR/test/tmp.dat LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables; ---exec rm $MYSQLTEST_VARDIR/master-data/test/tmp.dat || true +--exec rm $MYSQLD_DATADIR/test/tmp.dat || true --enable_warnings select 'no_copy' from ndb_show_tables where id = @t1_id and name like '%t1%'; diff --git a/mysql-test/suite/ndb/t/ndb_binlog_discover.test b/mysql-test/suite/ndb/t/ndb_binlog_discover.test index e842b57093a..dc8275a8a39 100644 --- a/mysql-test/suite/ndb/t/ndb_binlog_discover.test +++ b/mysql-test/suite/ndb/t/ndb_binlog_discover.test @@ -30,7 +30,7 @@ while ($mysql_errno) --enable_query_log --source include/show_binlog_events2.inc -PURGE MASTER LOGS TO 'master-bin.000002'; +PURGE MASTER LOGS TO 'mysqld-bin.000002'; --source include/show_binlog_events2.inc drop table t1; diff --git a/mysql-test/suite/ndb/t/ndb_config.test b/mysql-test/suite/ndb/t/ndb_config.test index f63c0087c1e..08d1226953c 100644 --- a/mysql-test/suite/ndb/t/ndb_config.test +++ b/mysql-test/suite/ndb/t/ndb_config.test @@ -6,7 +6,7 @@ --exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid,host,DataMemory,IndexMemory --type=ndbd 2> /dev/null --exec $NDB_TOOLS_DIR/ndb_config --no-defaults -r \\\n -f " " --query=nodeid,host,DataMemory,IndexMemory --type=ndbd 2> /dev/null --exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --type=ndbd --host=localhost 2> /dev/null ---exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=type,nodeid,host --config-file=$NDB_BACKUP_DIR/config.ini 2> /dev/null +--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=type,nodeid,host --config-file=$MYSQL_TEST_DIR/std_data/ndb_config_config.ini 2> /dev/null # End of 4.1 tests @@ -18,6 +18,6 @@ --exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster2 --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --ndb-shm --connections --query=type,nodeid1,nodeid2,group,nodeidserver --mycnf 2> /dev/null ---exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=localhost --config-file=$NDB_BACKUP_DIR/config.ini 2> /dev/null ---exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=1.2.3.4 --config-file=$NDB_BACKUP_DIR/config.ini 2> /dev/null ---exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=127.0.0.1 --config-file=$NDB_BACKUP_DIR/config.ini 2> /dev/null +--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=localhost --config-file=$MYSQL_TEST_DIR/std_data/ndb_config_config.ini 2> /dev/null +--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=1.2.3.4 --config-file=$MYSQL_TEST_DIR/std_data/ndb_config_config.ini 2> /dev/null +--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=127.0.0.1 --config-file=$MYSQL_TEST_DIR/std_data/ndb_config_config.ini 2> /dev/null diff --git a/mysql-test/suite/ndb/t/ndb_load.test b/mysql-test/suite/ndb/t/ndb_load.test index af2df70b74e..aa48b3dfdcf 100644 --- a/mysql-test/suite/ndb/t/ndb_load.test +++ b/mysql-test/suite/ndb/t/ndb_load.test @@ -12,12 +12,12 @@ DROP TABLE IF EXISTS t1; # should give duplicate key CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=NDB; --error 1022 -LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1 ; +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_ln/words.dat' INTO TABLE t1 ; +LOAD DATA INFILE '../../../std_data/words.dat' INTO TABLE t1 ; SELECT * FROM t1 ORDER BY word; DROP TABLE t1; diff --git a/mysql-test/suite/ndb/t/ndb_loaddatalocal.test b/mysql-test/suite/ndb/t/ndb_loaddatalocal.test index 3eae3891f43..257a26087b7 100644 --- a/mysql-test/suite/ndb/t/ndb_loaddatalocal.test +++ b/mysql-test/suite/ndb/t/ndb_loaddatalocal.test @@ -15,55 +15,56 @@ while ($1) dec $1; } set SQL_LOG_BIN=1; +let $MYSQLD_DATADIR= `select @@datadir`; enable_query_log; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval select * into outfile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval select * into outfile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1; #This will generate a 20KB file, now test LOAD DATA LOCAL drop table t1; create table t1(a int) engine=ndb; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval load data local infile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1; select count(*) from t1; ---remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile +--remove_file $MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile drop table t1; create table t1(a int) engine=myisam; insert into t1 values (1), (2), (2), (3); ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval select * into outfile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval select * into outfile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1; drop table t1; create table t1(a int primary key) engine=ndb; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1; ---remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval load data local infile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1; +--remove_file $MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile select * from t1 order by a; drop table t1; create table t1(a int) engine=myisam; insert into t1 values (1), (1), (2), (3); ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval select * into outfile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval select * into outfile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1; drop table t1; create table t1(a int primary key) engine=ndb; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1; ---remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval load data local infile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1; +--remove_file $MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile select * from t1 order by a; drop table t1; create table t1(a int) engine=myisam; insert into t1 values (1), (2), (3), (3); ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval select * into outfile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval select * into outfile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1; drop table t1; create table t1(a int primary key) engine=ndb; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1; ---remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval load data local infile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1; +--remove_file $MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile select * from t1 order by a; drop table t1; diff --git a/mysql-test/suite/ndb/t/ndb_read_multi_range.test b/mysql-test/suite/ndb/t/ndb_read_multi_range.test index 1965874940b..1c439e65099 100644 --- a/mysql-test/suite/ndb/t/ndb_read_multi_range.test +++ b/mysql-test/suite/ndb/t/ndb_read_multi_range.test @@ -337,4 +337,4 @@ delete from t1 where id in (1,2); select * from t2 order by id; drop trigger kaboom; -drop table t1; +drop table t1, t2; diff --git a/mysql-test/suite/ndb/t/ndb_replace.test b/mysql-test/suite/ndb/t/ndb_replace.test index aa2072b98dd..432cf7f2dcd 100644 --- a/mysql-test/suite/ndb/t/ndb_replace.test +++ b/mysql-test/suite/ndb/t/ndb_replace.test @@ -85,12 +85,12 @@ select * from t1 order by pk; delete from t1; # Test for load data replace which updates pk insert into t1 values (1, 1, 1), (4, 4, 4), (6, 6, 6); -load data infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk); +load data infile '../../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk); select * from t1 order by pk; delete from t1; # Now test for load data replace which doesn't touch pk insert into t1 values (1, 1, 1), (3, 3, 3), (5, 5, 5); -load data infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk); +load data infile '../../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk); select * from t1 order by pk; delete from t1; # Finally test for both types of replace ... select diff --git a/mysql-test/suite/ndb/t/ndb_single_user.test b/mysql-test/suite/ndb/t/ndb_single_user.test index 07925b25917..a64ac066a49 100644 --- a/mysql-test/suite/ndb/t/ndb_single_user.test +++ b/mysql-test/suite/ndb/t/ndb_single_user.test @@ -3,8 +3,7 @@ -- source include/not_embedded.inc --disable_warnings -use test; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; +drop table if exists t1,t2; --enable_warnings # operations allowed while cluster is in single user mode @@ -15,8 +14,8 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; --eval set @node_id= SUBSTRING('$node_id', 20)+0 --enable_query_log --let $node_id= `SELECT @node_id` ---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "enter single user mode $node_id" >> $NDB_TOOLS_OUTPUT ---exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" --single-user >> $NDB_TOOLS_OUTPUT +--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "enter single user mode $node_id" >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" --single-user >> $NDB_TOOLS_OUTPUT # verify that we are indeed in single user mode # and test that some operations give correct errors @@ -103,6 +102,8 @@ insert into t1 select * from t2; # - prior to bugfix this would fail create unique index new_index on t1 (b,c); +drop table t2; + # test some sql on other mysqld --connection server2 --error 1051 @@ -124,7 +125,7 @@ update t1 set b=b+100; --error 1296 update t1 set b=b+100 where a > 7; ---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "exit single user mode" >> $NDB_TOOLS_OUTPUT +--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "exit single user mode" >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT # @@ -139,8 +140,8 @@ BEGIN; update t1 set b=b+100 where a=2; # enter single user mode ---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "enter single user mode $node_id" >> $NDB_TOOLS_OUTPUT ---exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" --single-user >> $NDB_TOOLS_OUTPUT +--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "enter single user mode $node_id" >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" --single-user >> $NDB_TOOLS_OUTPUT --connection server1 update t1 set b=b+100 where a=3; @@ -160,7 +161,7 @@ create table t2 (a int) engine myisam; alter table t2 add column (b int); # exit single user mode ---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "exit single user mode" >> $NDB_TOOLS_OUTPUT +--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "exit single user mode" >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT # cleanup diff --git a/mysql-test/suite/ndb/t/ndb_trigger.test b/mysql-test/suite/ndb/t/ndb_trigger.test index 2e944174fd0..9f01157fc93 100644 --- a/mysql-test/suite/ndb/t/ndb_trigger.test +++ b/mysql-test/suite/ndb/t/ndb_trigger.test @@ -98,7 +98,7 @@ delete from t1; delete from t2; # Check for load data replace insert into t1 values (3, 1, 1.05), (5, 2, 2.05); -load data infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (id, a); +load data infile '../../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (id, a); select * from t1 order by id; select * from t2 order by op, a, b; update t4 set b = 10 where a = 1; diff --git a/mysql-test/suite/ndb/t/ndbapi.test b/mysql-test/suite/ndb/t/ndbapi.test index 3424513f8af..398a2cbfbfa 100644 --- a/mysql-test/suite/ndb/t/ndbapi.test +++ b/mysql-test/suite/ndb/t/ndbapi.test @@ -7,28 +7,28 @@ drop database if exists mysqltest; --enable_warnings --exec echo Running ndbapi_simple ---exec $NDB_EXAMPLES_DIR/ndbapi_simple/ndbapi_simple $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT +--exec $NDB_EXAMPLES_DIR/ndbapi_simple/ndbapi_simple $MASTER_MYSOCK "$NDB_CONNECTSTRING" >> $NDB_EXAMPLES_OUTPUT --exec echo Running ndbapi_simple_index ---exec $NDB_EXAMPLES_DIR/ndbapi_simple_index/ndbapi_simple_index $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT +--exec $NDB_EXAMPLES_DIR/ndbapi_simple_index/ndbapi_simple_index $MASTER_MYSOCK "$NDB_CONNECTSTRING" >> $NDB_EXAMPLES_OUTPUT --exec echo Running ndbapi_scan ---exec $NDB_EXAMPLES_DIR/ndbapi_scan/ndbapi_scan $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT +--exec $NDB_EXAMPLES_DIR/ndbapi_scan/ndbapi_scan $MASTER_MYSOCK "$NDB_CONNECTSTRING" >> $NDB_EXAMPLES_OUTPUT --exec echo Running ndbapi_retries ---exec $NDB_EXAMPLES_DIR/ndbapi_retries/ndbapi_retries $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT +--exec $NDB_EXAMPLES_DIR/ndbapi_retries/ndbapi_retries $MASTER_MYSOCK "$NDB_CONNECTSTRING" >> $NDB_EXAMPLES_OUTPUT --exec echo Running ndbapi_async ---exec $NDB_EXAMPLES_DIR/ndbapi_async/ndbapi_async $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT +--exec $NDB_EXAMPLES_DIR/ndbapi_async/ndbapi_async $MASTER_MYSOCK "$NDB_CONNECTSTRING" >> $NDB_EXAMPLES_OUTPUT --exec echo Running ndbapi_async1 ---exec $NDB_EXAMPLES_DIR/ndbapi_async1/ndbapi_async1 $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT +--exec $NDB_EXAMPLES_DIR/ndbapi_async1/ndbapi_async1 $MASTER_MYSOCK "$NDB_CONNECTSTRING" >> $NDB_EXAMPLES_OUTPUT use TEST_DB; create table t0(c0 int, c1 int, c2 char(4), c3 char(4), c4 text, primary key(c0, c2)) engine ndb charset latin1; #--exec echo Running ndbapi_event -#--exec $NDB_EXAMPLES_DIR/ndbapi_event/ndbapi_event "localhost:$NDBCLUSTER_PORT" 1 >> $NDB_EXAMPLES_OUTPUT +#--exec $NDB_EXAMPLES_DIR/ndbapi_event/ndbapi_event "$NDB_CONNECTSTRING" 1 >> $NDB_EXAMPLES_OUTPUT insert into t0 values (1, 2, 'a', 'b', null); insert into t0 values (3, 4, 'c', 'd', null); update t0 set c3 = 'e' where c0 = 1 and c2 = 'a'; -- use pk @@ -41,4 +41,4 @@ delete from t0; drop table t0; --exec echo Running mgmapi_logevent ---exec $NDB_EXAMPLES_DIR/mgmapi_logevent/mgmapi_logevent "localhost:$NDBCLUSTER_PORT" 1 >> $NDB_EXAMPLES_OUTPUT +--exec $NDB_EXAMPLES_DIR/mgmapi_logevent/mgmapi_logevent "$NDB_CONNECTSTRING" 1 >> $NDB_EXAMPLES_OUTPUT diff --git a/mysql-test/suite/ndb_team/r/ndb_dd_backuprestore.result b/mysql-test/suite/ndb_team/r/ndb_dd_backuprestore.result index 768aa86c832..102a96a15f4 100644 --- a/mysql-test/suite/ndb_team/r/ndb_dd_backuprestore.result +++ b/mysql-test/suite/ndb_team/r/ndb_dd_backuprestore.result @@ -27,12 +27,8 @@ pk1 c2 c3 hex(c4) 3 Sweden 498 1 4 Sweden 497 1 5 Sweden 496 1 -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; -SELECT @the_backup_id:=backup_id FROM test.backup_info; -@the_backup_id:=backup_id -<the_backup_id> +CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; DROP TABLE test.t1; ALTER TABLESPACE table_space1 @@ -95,12 +91,8 @@ LENGTH(data) SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2; LENGTH(data) 16384 -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; -SELECT @the_backup_id:=backup_id FROM test.backup_info; -@the_backup_id:=backup_id -<the_backup_id> +CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; DROP TABLE test.t1; DROP TABLE test.t2; @@ -325,12 +317,8 @@ pk1 c2 c3 hex(c4) 248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1 247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1 246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1 -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; -SELECT @the_backup_id:=backup_id FROM test.backup_info; -@the_backup_id:=backup_id -<the_backup_id> +CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; DROP TABLE test.t1; DROP TABLE test.t2; diff --git a/mysql-test/suite/ndb_team/r/rpl_ndb_dd_advance.result b/mysql-test/suite/ndb_team/r/rpl_ndb_dd_advance.result index 7f26313894c..37188aeb1ca 100644 --- a/mysql-test/suite/ndb_team/r/rpl_ndb_dd_advance.result +++ b/mysql-test/suite/ndb_team/r/rpl_ndb_dd_advance.result @@ -265,13 +265,9 @@ COUNT(*) SELECT COUNT(*) FROM history; COUNT(*) 200 -CREATE TEMPORARY TABLE IF NOT EXISTS mysql.backup_info (id INT, backup_id INT) ENGINE = HEAP; -DELETE FROM mysql.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE mysql.backup_info FIELDS TERMINATED BY ','; -SELECT @the_backup_id:=backup_id FROM mysql.backup_info; -@the_backup_id:=backup_id -<the_backup_id> -DROP TABLE IF EXISTS mysql.backup_info; +CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +DROP TABLE test.backup_info; ************ Restore the slave ************************ CREATE DATABASE tpcb; ***** Check a few slave restore values *************** diff --git a/mysql-test/suite/ndb_team/t/rpl_ndb_dd_advance.test b/mysql-test/suite/ndb_team/t/rpl_ndb_dd_advance.test index a7e00262f5c..e08b1b6f701 100644 --- a/mysql-test/suite/ndb_team/t/rpl_ndb_dd_advance.test +++ b/mysql-test/suite/ndb_team/t/rpl_ndb_dd_advance.test @@ -9,8 +9,6 @@ --source include/have_binlog_format_mixed_or_row.inc --source include/ndb_default_cluster.inc --source include/not_embedded.inc -#--source include/big_test.inc -#--source include/have_ndb_extra.inc --source include/ndb_master-slave.inc #### Test start cleanup section ##### @@ -289,25 +287,7 @@ while ($j) SELECT COUNT(*) FROM history; -#RESET MASTER; ---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT - ---exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat - -CREATE TEMPORARY TABLE IF NOT EXISTS mysql.backup_info (id INT, backup_id INT) ENGINE = HEAP; - -DELETE FROM mysql.backup_info; - -LOAD DATA INFILE '../tmp.dat' INTO TABLE mysql.backup_info FIELDS TERMINATED BY ','; ---exec rm $MYSQLTEST_VARDIR/tmp.dat || true ---replace_column 1 <the_backup_id> - -SELECT @the_backup_id:=backup_id FROM mysql.backup_info; - -let the_backup_id=`select @the_backup_id`; - -DROP TABLE IF EXISTS mysql.backup_info; -#RESET MASTER; +--source include/ndb_backup.inc --echo ************ Restore the slave ************************ connection slave; @@ -424,7 +404,7 @@ diff_files $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_M.sql $MYSQLTEST_VARDIR/tmp/RPL_DD_A ## Note: Ths files should only get removed, if the above diff succeeds. ---exec rm $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_M.sql ---exec rm $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_S.sql +remove_file $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_M.sql; +remove_file $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_S.sql; # End 5.1 test case diff --git a/mysql-test/suite/parts/inc/partition.pre b/mysql-test/suite/parts/inc/partition.pre index 0c906ce4581..7c3b0d9d1ef 100644 --- a/mysql-test/suite/parts/inc/partition.pre +++ b/mysql-test/suite/parts/inc/partition.pre @@ -246,7 +246,7 @@ if (0) # Option, for displaying files: # $ls= 1 (default) # --> Display the table related directory content via -# "ls $MYSQLTEST_VARDIR/master-data/test/t1*" +# "ls $MYSQLTEST_VARDIR/mysqld.1/data/test/t1*" # if these informations were collected. # This is probably not portable to some OS. # $ls= 0 @@ -410,7 +410,7 @@ if (0) # 3. How to analyze a partitioning bug revealed with these tests/ How to build # a small replay script from the monstrous protocols ? #------------------------------------------------------------------------------# -# a) crash -- use the file var/master-data/mysql/general_log.CSV +# a) crash -- use the file var/mysqld.1/data/mysql/general_log.CSV # b) no crash, but unexpected server response (there is no "reject file) # -- use the file r/<testcase>.log # Please be aware that the option $debug= 0 suppresses the diff --git a/mysql-test/suite/parts/inc/partition_check_drop.inc b/mysql-test/suite/parts/inc/partition_check_drop.inc index 1ab12e738ab..daaa5e541c7 100644 --- a/mysql-test/suite/parts/inc/partition_check_drop.inc +++ b/mysql-test/suite/parts/inc/partition_check_drop.inc @@ -18,21 +18,28 @@ if ($no_debug) --disable_query_log } +# Get the MySQL Servers datadir without ending slash +let $MYSQLD_DATADIR= `select LEFT(@@datadir, LENGTH(@@datadir)-1)`; +#echo MYSQLD_DATADIR: $MYSQLD_DATADIR; + if ($do_file_tests) { -let $ls_file= $MYSQLTEST_VARDIR/master-data/test/tmp2; -# List the files belonging to the table t1 ---list_files_write_file $ls_file $MYSQLTEST_VARDIR/master-data/test t1* ---chmod 0644 $ls_file -if ($with_directories) -{ ---list_files_append_file $ls_file $MYSQLTEST_VARDIR/tmp t1* -} -eval SET @aux = load_file('$ls_file'); + let $ls_file= $MYSQLD_DATADIR/test/tmp2; + # List the files belonging to the table t1 + --list_files_write_file $ls_file $MYSQLD_DATADIR/test t1* + --chmod 0644 $ls_file + if ($with_directories) + { + --list_files_append_file $ls_file $MYSQLTEST_VARDIR/tmp t1* + } + eval SET @aux = load_file('$ls_file'); + + # clean up + remove_file $ls_file; } if (!$do_file_tests) { -SET @aux = '--- not determined ---'; + SET @aux = '--- not determined ---'; } # UPDATE the current filelist of the table t1 within t0_definition @@ -59,7 +66,7 @@ if ($found_garbage) } # Do a manual cleanup, because the following tests should not suffer from # remaining files - --exec rm -f $MYSQLTEST_VARDIR/master-data/test/t1* || true + --exec rm -f $MYSQLD_DATADIR/test/t1* || true if ($with_directories) { --exec rm -f $MYSQLTEST_VARDIR/tmp/t1* || true diff --git a/mysql-test/suite/parts/inc/partition_layout.inc b/mysql-test/suite/parts/inc/partition_layout.inc index 23872b7ff1f..67d0fd4c0e9 100644 --- a/mysql-test/suite/parts/inc/partition_layout.inc +++ b/mysql-test/suite/parts/inc/partition_layout.inc @@ -9,6 +9,7 @@ eval SHOW CREATE TABLE t1; # listing of files belonging to the table t1 if ($ls) { - --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR - --list_files $MYSQLTEST_VARDIR/master-data/test t1* + let $MYSQLD_DATADIR= `select @@datadir`; + --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR + --list_files $MYSQLD_DATADIR/test t1* } diff --git a/mysql-test/suite/parts/inc/partition_layout_check1.inc b/mysql-test/suite/parts/inc/partition_layout_check1.inc index fb5887f9124..68539fea30c 100644 --- a/mysql-test/suite/parts/inc/partition_layout_check1.inc +++ b/mysql-test/suite/parts/inc/partition_layout_check1.inc @@ -1,12 +1,12 @@ ################################################################################ -# inc/partition_layout_check1.inc # +# inc/partition_layout_check1.inc # # # # Purpose: # # Store the SHOW CREATE TABLE output and the list of files belonging to # # this table + print this into the protocol # # This script is only usefule when sourced within the partitioning tests. # # # -# Attention: The routine inc/partition_layout_check2.inc is very similar # +# Attention: The routine inc/partition_layout_check2.inc is very similar # # to this one. So if something has to be changed here it # # might be necessary to do it also there # # # @@ -25,31 +25,34 @@ if ($no_debug) # Clean the table holding the definition of t1 DELETE FROM t0_definition; +# Get the MySQL Servers datadir without ending slash +let $MYSQLD_DATADIR= `select LEFT(@@datadir, LENGTH(@@datadir)-1)`; +#echo MYSQLD_DATADIR: $MYSQLD_DATADIR; + # Dump the current definition of the table t1 to tmp1 # This complicated method - let another mysqltest collect the output - is used # because of two reasons # - SHOW CREATE TABLE t1 is at least currently most probably more reliable than # the corresponding SELECT on the INFORMATION_SCHEMA # - SHOW CREATE TABLE .. cannot write its out put into a file like SELECT -let $show_file= $MYSQLTEST_VARDIR/master-data/test/tmp1; +let $show_file= $MYSQLD_DATADIR/test/tmp1; --exec echo "SHOW CREATE TABLE t1;" | $MYSQL_TEST > $show_file 2>&1 || true - if ($do_file_tests) { -# List the files belonging to the table t1 -let $ls_file= $MYSQLTEST_VARDIR/master-data/test/tmp2; ---list_files_write_file $ls_file $MYSQLTEST_VARDIR/master-data/test t1* ---chmod 0644 $ls_file -if ($with_directories) -{ ---list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-data-dir t1* ---list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-idx-dir t1* -} -eval SET @aux = load_file('$ls_file'); + # List the files belonging to the table t1 + let $ls_file= $MYSQLD_DATADIR/test/tmp2; + --list_files_write_file $ls_file $MYSQLD_DATADIR/test t1* + --chmod 0644 $ls_file + if ($with_directories) + { + --list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-data-dir t1* + --list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-idx-dir t1* + } + eval SET @aux = load_file('$ls_file'); } if (!$do_file_tests) { -SET @aux = '--- not determined ---'; + SET @aux = '--- not determined ---'; } # Insert the current definition of the table t1 into t0_definition @@ -66,9 +69,9 @@ if ($do_file_tests) if ($ls) { # Print the list of files into the protocol - eval SELECT REPLACE(@aux,'$MYSQLTEST_VARDIR','\$MYSQLTEST_VARDIR') - AS "unified filelist" - FROM t0_definition WHERE state = 'old'; + replace_result $MYSQLD_DATADIR MYSQLD_DATADIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR; + SELECT file_list AS "unified filelist" + FROM t0_definition WHERE state = 'old'; } } --enable_query_log diff --git a/mysql-test/suite/parts/inc/partition_layout_check2.inc b/mysql-test/suite/parts/inc/partition_layout_check2.inc index 17dc0016b1d..d9783337a31 100644 --- a/mysql-test/suite/parts/inc/partition_layout_check2.inc +++ b/mysql-test/suite/parts/inc/partition_layout_check2.inc @@ -7,7 +7,7 @@ # since the call of inc/partition_layout_check1.inc # # This script is only usefule when sourced within the partitioning tests. # # # -# Attention: The routine inc/partition_layout_check1.inc is very similar # +# Attention: The routine inc/partition_layout_check1.inc is very similar # # to this one. So if something has to be changed here it # # might be necessary to do it also there # # # @@ -23,26 +23,31 @@ if ($no_debug) # Clean the table holding the definition of t1 DELETE FROM t0_definition WHERE state = 'new'; + +# Get the MySQL Servers datadir without ending slash +let $MYSQLD_DATADIR= `select LEFT(@@datadir, LENGTH(@@datadir)-1)`; +#echo MYSQLD_DATADIR: $MYSQLD_DATADIR; + # Dump the current definition of the table t1 to tmp1 -let $show_file= $MYSQLTEST_VARDIR/master-data/test/tmp1; +let $show_file= $MYSQLD_DATADIR/test/tmp1; --exec echo "SHOW CREATE TABLE t1;" | $MYSQL_TEST > $show_file 2>&1 || true if ($do_file_tests) { -# List the files belonging to the table t1 -let $ls_file= $MYSQLTEST_VARDIR/master-data/test/tmp2; ---list_files_write_file $ls_file $MYSQLTEST_VARDIR/master-data/test t1* ---chmod 0644 $ls_file -if ($with_directories) -{ ---list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-data-dir t1* ---list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-idx-dir t1* -} -eval SET @aux = load_file('$ls_file'); + # List the files belonging to the table t1 + let $ls_file= $MYSQLD_DATADIR/test/tmp2; + --list_files_write_file $ls_file $MYSQLD_DATADIR/test t1* + --chmod 0644 $ls_file + if ($with_directories) + { + --list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-data-dir t1* + --list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-idx-dir t1* + } + eval SET @aux = load_file('$ls_file'); } if (!$do_file_tests) { -SET @aux = '--- not determined ---'; + SET @aux = '--- not determined ---'; } # Insert the current definition of the table t1 into t0_definition diff --git a/mysql-test/suite/parts/inc/partition_supported_sql_funcs.inc b/mysql-test/suite/parts/inc/partition_supported_sql_funcs.inc index 6e7b15c606b..83d0fa37375 100644 --- a/mysql-test/suite/parts/inc/partition_supported_sql_funcs.inc +++ b/mysql-test/suite/parts/inc/partition_supported_sql_funcs.inc @@ -124,9 +124,12 @@ eval insert into t3 values ($val1); eval insert into t3 values ($val2); eval insert into t3 values ($val3); -eval load data infile '../std_data_ln/parts/$infile' into table t4; -eval load data infile '../std_data_ln/parts/$infile' into table t5; -eval load data infile '../std_data_ln/parts/$infile' into table t6; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval load data infile '$MYSQLTEST_VARDIR/std_data/parts/$infile' into table t4; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval load data infile '$MYSQLTEST_VARDIR/std_data/parts/$infile' into table t5; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval load data infile '$MYSQLTEST_VARDIR/std_data/parts/$infile' into table t6; eval select $sqlfunc from t1 order by col1; diff --git a/mysql-test/suite/parts/r/part_supported_sql_func_innodb.result b/mysql-test/suite/parts/r/part_supported_sql_func_innodb.result index abdcab76d26..79462c25050 100644 --- a/mysql-test/suite/parts/r/part_supported_sql_func_innodb.result +++ b/mysql-test/suite/parts/r/part_supported_sql_func_innodb.result @@ -55,9 +55,9 @@ insert into t2 values (17 ); insert into t3 values (5 ); insert into t3 values (13 ); insert into t3 values (17 ); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t6; select abs(col1) from t1 order by col1; abs(col1) 5 @@ -1740,9 +1740,9 @@ insert into t2 values (17); insert into t3 values (5); insert into t3 values (19); insert into t3 values (17); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t6; select mod(col1,10) from t1 order by col1; mod(col1,10) 5 @@ -3447,9 +3447,9 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-02-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-01-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select day(col1) from t1 order by col1; day(col1) 17 @@ -3952,9 +3952,9 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-02-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-01-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select dayofmonth(col1) from t1 order by col1; dayofmonth(col1) 17 @@ -4457,9 +4457,9 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-02-17'); insert into t3 values ('2006-01-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select dayofweek(col1) from t1 order by col1; dayofweek(col1) 3 @@ -4974,9 +4974,9 @@ insert into t2 values ('2006-02-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-02-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select dayofyear(col1) from t1 order by col1; dayofyear(col1) 3 @@ -5481,9 +5481,9 @@ insert into t2 values ('2006-02-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-02-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select dayofyear(col1) from t1 order by col1; dayofyear(col1) 3 @@ -5988,9 +5988,9 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-02-17'); insert into t3 values ('2006-01-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select extract(month from col1) from t1 order by col1; extract(month from col1) 1 @@ -6495,9 +6495,9 @@ insert into t2 values ('21:59'); insert into t3 values ('09:09'); insert into t3 values ('14:30'); insert into t3 values ('21:59'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6; select hour(col1) from t1 order by col1; hour(col1) 9 @@ -7008,9 +7008,9 @@ insert into t2 values ('00:59:22.000024'); insert into t3 values ('09:09:15.000002'); insert into t3 values ('04:30:01.000018'); insert into t3 values ('00:59:22.000024'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6; select microsecond(col1) from t1 order by col1; microsecond(col1) 0 @@ -7507,9 +7507,9 @@ insert into t2 values ('21:59:22'); insert into t3 values ('09:09:15'); insert into t3 values ('14:30:45'); insert into t3 values ('21:59:22'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6; select minute(col1) from t1 order by col1; minute(col1) 9 @@ -8026,9 +8026,9 @@ insert into t2 values ('21:59:22'); insert into t3 values ('09:09:09'); insert into t3 values ('14:30:20'); insert into t3 values ('21:59:22'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6; select second(col1) from t1 order by col1; second(col1) 9 @@ -8545,9 +8545,9 @@ insert into t2 values ('21:59:22'); insert into t3 values ('09:09:09'); insert into t3 values ('14:30:20'); insert into t3 values ('21:59:22'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6; select second(col1) from t1 order by col1; second(col1) 9 @@ -9064,9 +9064,9 @@ insert into t2 values ('2006-05-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-12-17'); insert into t3 values ('2006-05-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select month(col1) from t1 order by col1; month(col1) 1 @@ -9577,9 +9577,9 @@ insert into t2 values ('2006-09-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-12-17'); insert into t3 values ('2006-09-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select quarter(col1) from t1 order by col1; quarter(col1) 1 @@ -10088,9 +10088,9 @@ insert into t2 values ('21:59:22'); insert into t3 values ('09:09:15'); insert into t3 values ('14:30:45'); insert into t3 values ('21:59:22'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6; select time_to_sec(col1)-(time_to_sec(col1)-20) from t1 order by col1; time_to_sec(col1)-(time_to_sec(col1)-20) 20 @@ -10605,9 +10605,9 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-02-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-01-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select to_days(col1)-to_days('2006-01-01') from t1 order by col1; to_days(col1)-to_days('2006-01-01') 16 @@ -11114,9 +11114,9 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-02-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-01-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select datediff(col1, '2006-01-01') from t1 order by col1; datediff(col1, '2006-01-01') 16 @@ -11623,9 +11623,9 @@ insert into t2 values ('2006-05-25'); insert into t3 values ('2006-12-03'); insert into t3 values ('2006-11-17'); insert into t3 values ('2006-05-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select weekday(col1) from t1 order by col1; weekday(col1) 4 @@ -12132,9 +12132,9 @@ insert into t2 values ('2004-05-25'); insert into t3 values ('1996-01-03'); insert into t3 values ('2000-02-17'); insert into t3 values ('2004-05-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select year(col1)-1990 from t1 order by col1; year(col1)-1990 6 @@ -12645,9 +12645,9 @@ insert into t2 values ('2006-03-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-08-17'); insert into t3 values ('2006-03-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select yearweek(col1)-200600 from t1 order by col1; yearweek(col1)-200600 1 diff --git a/mysql-test/suite/parts/r/part_supported_sql_func_myisam.result b/mysql-test/suite/parts/r/part_supported_sql_func_myisam.result index 3a54be8fec2..375a6e130be 100644 --- a/mysql-test/suite/parts/r/part_supported_sql_func_myisam.result +++ b/mysql-test/suite/parts/r/part_supported_sql_func_myisam.result @@ -55,9 +55,9 @@ insert into t2 values (17 ); insert into t3 values (5 ); insert into t3 values (13 ); insert into t3 values (17 ); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t6; select abs(col1) from t1 order by col1; abs(col1) 5 @@ -1740,9 +1740,9 @@ insert into t2 values (17); insert into t3 values (5); insert into t3 values (19); insert into t3 values (17); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t6; select mod(col1,10) from t1 order by col1; mod(col1,10) 5 @@ -3447,9 +3447,9 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-02-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-01-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select day(col1) from t1 order by col1; day(col1) 17 @@ -3952,9 +3952,9 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-02-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-01-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select dayofmonth(col1) from t1 order by col1; dayofmonth(col1) 17 @@ -4457,9 +4457,9 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-02-17'); insert into t3 values ('2006-01-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select dayofweek(col1) from t1 order by col1; dayofweek(col1) 3 @@ -4974,9 +4974,9 @@ insert into t2 values ('2006-02-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-02-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select dayofyear(col1) from t1 order by col1; dayofyear(col1) 3 @@ -5481,9 +5481,9 @@ insert into t2 values ('2006-02-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-02-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select dayofyear(col1) from t1 order by col1; dayofyear(col1) 3 @@ -5988,9 +5988,9 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-02-17'); insert into t3 values ('2006-01-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select extract(month from col1) from t1 order by col1; extract(month from col1) 1 @@ -6495,9 +6495,9 @@ insert into t2 values ('21:59'); insert into t3 values ('09:09'); insert into t3 values ('14:30'); insert into t3 values ('21:59'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6; select hour(col1) from t1 order by col1; hour(col1) 9 @@ -7008,9 +7008,9 @@ insert into t2 values ('00:59:22.000024'); insert into t3 values ('09:09:15.000002'); insert into t3 values ('04:30:01.000018'); insert into t3 values ('00:59:22.000024'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6; select microsecond(col1) from t1 order by col1; microsecond(col1) 0 @@ -7507,9 +7507,9 @@ insert into t2 values ('21:59:22'); insert into t3 values ('09:09:15'); insert into t3 values ('14:30:45'); insert into t3 values ('21:59:22'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6; select minute(col1) from t1 order by col1; minute(col1) 9 @@ -8026,9 +8026,9 @@ insert into t2 values ('21:59:22'); insert into t3 values ('09:09:09'); insert into t3 values ('14:30:20'); insert into t3 values ('21:59:22'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6; select second(col1) from t1 order by col1; second(col1) 9 @@ -8545,9 +8545,9 @@ insert into t2 values ('21:59:22'); insert into t3 values ('09:09:09'); insert into t3 values ('14:30:20'); insert into t3 values ('21:59:22'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6; select second(col1) from t1 order by col1; second(col1) 9 @@ -9064,9 +9064,9 @@ insert into t2 values ('2006-05-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-12-17'); insert into t3 values ('2006-05-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select month(col1) from t1 order by col1; month(col1) 1 @@ -9577,9 +9577,9 @@ insert into t2 values ('2006-09-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-12-17'); insert into t3 values ('2006-09-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select quarter(col1) from t1 order by col1; quarter(col1) 1 @@ -10088,9 +10088,9 @@ insert into t2 values ('21:59:22'); insert into t3 values ('09:09:15'); insert into t3 values ('14:30:45'); insert into t3 values ('21:59:22'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6; select time_to_sec(col1)-(time_to_sec(col1)-20) from t1 order by col1; time_to_sec(col1)-(time_to_sec(col1)-20) 20 @@ -10605,9 +10605,9 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-02-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-01-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select to_days(col1)-to_days('2006-01-01') from t1 order by col1; to_days(col1)-to_days('2006-01-01') 16 @@ -11114,9 +11114,9 @@ insert into t2 values ('2006-01-25'); insert into t3 values ('2006-02-03'); insert into t3 values ('2006-01-17'); insert into t3 values ('2006-01-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select datediff(col1, '2006-01-01') from t1 order by col1; datediff(col1, '2006-01-01') 16 @@ -11623,9 +11623,9 @@ insert into t2 values ('2006-05-25'); insert into t3 values ('2006-12-03'); insert into t3 values ('2006-11-17'); insert into t3 values ('2006-05-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select weekday(col1) from t1 order by col1; weekday(col1) 4 @@ -12132,9 +12132,9 @@ insert into t2 values ('2004-05-25'); insert into t3 values ('1996-01-03'); insert into t3 values ('2000-02-17'); insert into t3 values ('2004-05-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select year(col1)-1990 from t1 order by col1; year(col1)-1990 6 @@ -12645,9 +12645,9 @@ insert into t2 values ('2006-03-25'); insert into t3 values ('2006-01-03'); insert into t3 values ('2006-08-17'); insert into t3 values ('2006-03-25'); -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5; -load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5; +load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6; select yearweek(col1)-200600 from t1 order by col1; yearweek(col1)-200600 1 diff --git a/mysql-test/suite/parts/r/partition_bit_innodb.result b/mysql-test/suite/parts/r/partition_bit_innodb.result index 2ea66592679..a9ae917f13d 100644 --- a/mysql-test/suite/parts/r/partition_bit_innodb.result +++ b/mysql-test/suite/parts/r/partition_bit_innodb.result @@ -6,7 +6,7 @@ create table t1 (a bit(0), primary key (a)) engine='INNODB' partition by key (a) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bit(1) NOT NULL DEFAULT '\0', + `a` bit(1) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) */ @@ -18,7 +18,7 @@ partition pa2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bit(1) NOT NULL DEFAULT '\0', + `a` bit(1) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) @@ -30,7 +30,7 @@ partition by key (a) partitions 2; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bit(64) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0', + `a` bit(64) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) @@ -58,7 +58,7 @@ partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bit(64) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0', + `a` bit(64) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) @@ -88,7 +88,7 @@ partition by key (a) partitions 4; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` bit(1) NOT NULL DEFAULT '\0', + `a` bit(1) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) @@ -102,7 +102,7 @@ alter table t2 drop primary key; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` bit(1) NOT NULL DEFAULT '\0' + `a` bit(1) NOT NULL DEFAULT b'0' ) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) PARTITIONS 4 */ @@ -114,7 +114,7 @@ alter table t2 add primary key (a); show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` bit(1) NOT NULL DEFAULT '\0', + `a` bit(1) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) @@ -133,7 +133,7 @@ partition pa4 values less than (256)); show create table t3; Table Create Table t3 CREATE TABLE `t3` ( - `a` bit(8) NOT NULL DEFAULT '\0', + `a` bit(8) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) @@ -416,7 +416,7 @@ partition pa3 values in (17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32)); show create table t4; Table Create Table t4 CREATE TABLE `t4` ( - `a` bit(8) NOT NULL DEFAULT '\0', + `a` bit(8) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) diff --git a/mysql-test/suite/parts/r/partition_bit_myisam.result b/mysql-test/suite/parts/r/partition_bit_myisam.result index c1f067d80d1..680845c9971 100644 --- a/mysql-test/suite/parts/r/partition_bit_myisam.result +++ b/mysql-test/suite/parts/r/partition_bit_myisam.result @@ -6,7 +6,7 @@ create table t1 (a bit(0), primary key (a)) engine='MyISAM' partition by key (a) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bit(1) NOT NULL DEFAULT '\0', + `a` bit(1) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) */ @@ -18,7 +18,7 @@ partition pa2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bit(1) NOT NULL DEFAULT '\0', + `a` bit(1) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) @@ -30,7 +30,7 @@ partition by key (a) partitions 2; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bit(64) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0', + `a` bit(64) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) @@ -58,7 +58,7 @@ partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bit(64) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0', + `a` bit(64) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) @@ -88,7 +88,7 @@ partition by key (a) partitions 4; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` bit(1) NOT NULL DEFAULT '\0', + `a` bit(1) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) @@ -102,7 +102,7 @@ alter table t2 drop primary key; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` bit(1) NOT NULL DEFAULT '\0' + `a` bit(1) NOT NULL DEFAULT b'0' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) PARTITIONS 4 */ @@ -114,7 +114,7 @@ alter table t2 add primary key (a); show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` bit(1) NOT NULL DEFAULT '\0', + `a` bit(1) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) @@ -133,7 +133,7 @@ partition pa4 values less than (256)); show create table t3; Table Create Table t3 CREATE TABLE `t3` ( - `a` bit(8) NOT NULL DEFAULT '\0', + `a` bit(8) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) @@ -416,7 +416,7 @@ partition pa3 values in (17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32)); show create table t4; Table Create Table t4 CREATE TABLE `t4` ( - `a` bit(8) NOT NULL DEFAULT '\0', + `a` bit(8) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) diff --git a/mysql-test/suite/parts/r/partition_bit_ndb.result b/mysql-test/suite/parts/r/partition_bit_ndb.result deleted file mode 100644 index add3ed394ad..00000000000 --- a/mysql-test/suite/parts/r/partition_bit_ndb.result +++ /dev/null @@ -1,126 +0,0 @@ -SET @max_row = 20; -create table t1 (a bit(65), primary key (a)) partition by key (a); -ERROR 42000: Display width out of range for column 'a' (max = 64) -create table t1 (a bit(0), primary key (a)) partition by key (a); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` bit(1) NOT NULL DEFAULT '\0', - PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) */ -drop table t1; -create table t1 (a bit(0), primary key (a)) partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp', -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp'); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` bit(1) NOT NULL DEFAULT '\0', - PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/tmp/' INDEX DIRECTORY='/tmp/' -/*!50100 PARTITION BY KEY (a) -(PARTITION pa1 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, - PARTITION pa2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ -drop table t1; -create table t1 (a bit(64), primary key (a)) partition by key (a); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` bit(64) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0', - PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) */ -insert into t1 values -(b'1111111111111111111111111111111111111111111111111111111111111111'), -(b'1000000000000000000000000000000000000000000000000000000000000000'), -(b'0000000000000000000000000000000000000000000000000000000000000001'), -(b'1010101010101010101010101010101010101010101010101010101010101010'), -(b'0101010101010101010101010101010101010101010101010101010101010101'); -select hex(a) from t1; -hex(a) -1 -5555555555555555 -8000000000000000 -AAAAAAAAAAAAAAAA -FFFFFFFFFFFFFFFF -drop table t1; -create table t1 (a bit(64), primary key (a)) partition by key (a)( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` bit(64) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0', - PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/tmp/' INDEX DIRECTORY='/tmp/' -/*!50100 PARTITION BY KEY (a) -(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, - PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, - PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ -insert into t1 values -(b'1111111111111111111111111111111111111111111111111111111111111111'), -(b'1000000000000000000000000000000000000000000000000000000000000000'), -(b'0000000000000000000000000000000000000000000000000000000000000001'), -(b'1010101010101010101010101010101010101010101010101010101010101010'), -(b'0101010101010101010101010101010101010101010101010101010101010101'); -select hex(a) from t1; -hex(a) -1 -5555555555555555 -8000000000000000 -AAAAAAAAAAAAAAAA -FFFFFFFFFFFFFFFF -drop table t1; -create table t1 (a bit, primary key (a)) partition by key (a); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` bit(1) NOT NULL DEFAULT '\0', - PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) */ -insert into t1 values (b'0'), (b'1'); -select hex(a) from t1; -hex(a) -0 -1 -alter table t1 drop primary key; -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` bit(1) NOT NULL DEFAULT '\0' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) */ -select hex(a) from t1; -hex(a) -0 -1 -alter table t1 add primary key (a); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` bit(1) NOT NULL DEFAULT '\0', - PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) */ -select hex(a) from t1; -hex(a) -0 -1 -drop table t1; diff --git a/mysql-test/suite/parts/r/partition_special_innodb.result b/mysql-test/suite/parts/r/partition_special_innodb.result index 5eab78de8c2..8869f6d450c 100644 --- a/mysql-test/suite/parts/r/partition_special_innodb.result +++ b/mysql-test/suite/parts/r/partition_special_innodb.result @@ -213,5 +213,10 @@ START TRANSACTION; INSERT INTO t1 VALUES (NULL, 'first row t2'); SET autocommit=OFF; ALTER TABLE t1 AUTO_INCREMENT = 10; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction INSERT INTO t1 VALUES (NULL, 'second row t2'); +SELECT a,b FROM t1 ORDER BY a; +a b +1 first row t2 +2 second row t2 DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_t55.out b/mysql-test/suite/parts/r/partition_t55.out index d86ceda8c38..e309785a30c 100644 --- a/mysql-test/suite/parts/r/partition_t55.out +++ b/mysql-test/suite/parts/r/partition_t55.out @@ -4,65 +4,65 @@ t55 CREATE TABLE `t55` ( `colint` int(11) DEFAULT NULL, `col1` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (abs(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */ -27 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp0.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp0.MYI -18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp1.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp1.MYI -9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp2.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp2.MYI -18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp3.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp3.MYI -18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp4.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp4.MYI -9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp0.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp0.MYI -9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp1.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp1.MYI -18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp2.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp2.MYI -18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp3.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp3.MYI -36 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp4.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp4.MYI -36 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp0.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp0.MYI -0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp1.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp1.MYI -9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp2.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp2.MYI -18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp3.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp3.MYI -27 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp4.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp4.MYI -9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp0.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp0.MYI -9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp1.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp1.MYI -9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp2.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp2.MYI -18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp3.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp3.MYI -45 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp4.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp4.MYI -9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp0.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp0.MYI -9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp1.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp1.MYI -9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp2.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp2.MYI -0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp3.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp3.MYI -0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp4.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp4.MYI -0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp0.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp0.MYI -0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp1.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp1.MYI -0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp2.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp2.MYI -9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp3.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp3.MYI -9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp4.MYD -1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp4.MYI -8594 MYSQL_TEST_DIR/var/master-data/test/t55.frm -408 MYSQL_TEST_DIR/var/master-data/test/t55.par +27 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p0#SP#p0sp0.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p0#SP#p0sp0.MYI +18 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p0#SP#p0sp1.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p0#SP#p0sp1.MYI +9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p0#SP#p0sp2.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p0#SP#p0sp2.MYI +18 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p0#SP#p0sp3.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p0#SP#p0sp3.MYI +18 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p0#SP#p0sp4.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p0#SP#p0sp4.MYI +9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p1#SP#p1sp0.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p1#SP#p1sp0.MYI +9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p1#SP#p1sp1.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p1#SP#p1sp1.MYI +18 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p1#SP#p1sp2.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p1#SP#p1sp2.MYI +18 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p1#SP#p1sp3.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p1#SP#p1sp3.MYI +36 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p1#SP#p1sp4.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p1#SP#p1sp4.MYI +36 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p2#SP#p2sp0.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p2#SP#p2sp0.MYI +0 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p2#SP#p2sp1.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p2#SP#p2sp1.MYI +9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p2#SP#p2sp2.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p2#SP#p2sp2.MYI +18 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p2#SP#p2sp3.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p2#SP#p2sp3.MYI +27 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p2#SP#p2sp4.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p2#SP#p2sp4.MYI +9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p3#SP#p3sp0.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p3#SP#p3sp0.MYI +9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p3#SP#p3sp1.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p3#SP#p3sp1.MYI +9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p3#SP#p3sp2.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p3#SP#p3sp2.MYI +18 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p3#SP#p3sp3.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p3#SP#p3sp3.MYI +45 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p3#SP#p3sp4.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p3#SP#p3sp4.MYI +9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p4#SP#p4sp0.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p4#SP#p4sp0.MYI +9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p4#SP#p4sp1.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p4#SP#p4sp1.MYI +9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p4#SP#p4sp2.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p4#SP#p4sp2.MYI +0 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p4#SP#p4sp3.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p4#SP#p4sp3.MYI +0 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p4#SP#p4sp4.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p4#SP#p4sp4.MYI +0 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p5#SP#p5sp0.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p5#SP#p5sp0.MYI +0 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p5#SP#p5sp1.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p5#SP#p5sp1.MYI +0 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p5#SP#p5sp2.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p5#SP#p5sp2.MYI +9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p5#SP#p5sp3.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p5#SP#p5sp3.MYI +9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p5#SP#p5sp4.MYD +1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p5#SP#p5sp4.MYI +8594 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55.frm +408 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55.par diff --git a/mysql-test/suite/parts/t/disabled.def b/mysql-test/suite/parts/t/disabled.def index b9cd3462635..518a3c90422 100644 --- a/mysql-test/suite/parts/t/disabled.def +++ b/mysql-test/suite/parts/t/disabled.def @@ -1,8 +1,3 @@ partition_basic_ndb : Bug#19899 Crashing the server # http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-limitations-syntax.html -partition_bit_ndb : NDB does not support bit column in index -partition_sessions : needs system_3_init.inc partition_syntax_ndb : Bug#36735 Not supported -partition_value_innodb : Bug#30581 partition_value tests use disallowed CAST() function -partition_value_myisam : Bug#30581 partition_value tests use disallowed CAST() function -partition_value_ndb : Bug#30581 partition_value tests use disallowed CAST() function diff --git a/mysql-test/suite/parts/t/partition_basic_symlink_innodb.test b/mysql-test/suite/parts/t/partition_basic_symlink_innodb.test index 51e6397c018..17c6a845b25 100644 --- a/mysql-test/suite/parts/t/partition_basic_symlink_innodb.test +++ b/mysql-test/suite/parts/t/partition_basic_symlink_innodb.test @@ -35,6 +35,9 @@ --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings + +let $MYSQLD_DATADIR= `select @@datadir`; + --mkdir $MYSQLTEST_VARDIR/mysql-test-data-dir --mkdir $MYSQLTEST_VARDIR/mysql-test-idx-dir --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR @@ -49,17 +52,17 @@ PARTITION BY HASH (c1) INDEX DIRECTORY = '$MYSQLTEST_VARDIR/mysql-test-idx-dir' ); --echo # Verifying .frm and .par files ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1.frm ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1.par +--file_exists $MYSQLD_DATADIR/test/t1.frm +--file_exists $MYSQLD_DATADIR/test/t1.par --echo # Verifying that there are no MyISAM files --error 1 ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD +--file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYD --error 1 ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI +--file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYI --error 1 ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD +--file_exists $MYSQLD_DATADIR/test/t1#P#p1.MYD --error 1 ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI +--file_exists $MYSQLD_DATADIR/test/t1#P#p1.MYI --error 1 --file_exists $MYSQLTEST_VARDIR/mysql-test-data-dir/t1#P#p0.MYD --error 1 @@ -73,12 +76,12 @@ FLUSH TABLES; SHOW CREATE TABLE t1; ALTER TABLE t1 ENGINE = MyISAM; --echo # Verifying .frm, .par and MyISAM files (.MYD, MYI) ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1.frm ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1.par ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI +--file_exists $MYSQLD_DATADIR/test/t1.frm +--file_exists $MYSQLD_DATADIR/test/t1.par +--file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYD +--file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYI +--file_exists $MYSQLD_DATADIR/test/t1#P#p1.MYD +--file_exists $MYSQLD_DATADIR/test/t1#P#p1.MYI --file_exists $MYSQLTEST_VARDIR/mysql-test-data-dir/t1#P#p0.MYD --file_exists $MYSQLTEST_VARDIR/mysql-test-idx-dir/t1#P#p0.MYI --file_exists $MYSQLTEST_VARDIR/mysql-test-data-dir/t1#P#p1.MYD diff --git a/mysql-test/suite/parts/t/partition_bit_ndb.test b/mysql-test/suite/parts/t/partition_bit_ndb.test deleted file mode 100644 index 227d3d53401..00000000000 --- a/mysql-test/suite/parts/t/partition_bit_ndb.test +++ /dev/null @@ -1,60 +0,0 @@ -################################################################################ -# t/partition_bit_ndb.test # -# # -# Purpose: # -# Tests around bit type # -# NDB branch # -# # -#------------------------------------------------------------------------------# -# Original Author: HH # -# Original Date: 2006-08-01 # -# Change Author: # -# Change Date: # -# Change: # -################################################################################ - -# -# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! -# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN -# THE SOURCED FILES ONLY. -# -# Please read the README at the end of inc/partition.pre before changing -# any of the variables. -# - -#------------------------------------------------------------------------------# -# General not engine specific settings and requirements - -##### Options, for debugging support ##### -let $debug= 0; -let $with_partitioning= 1; - -##### Option, for displaying files ##### -let $ls= 1; - -##### Number of rows for the INSERT/UPDATE/DELETE/SELECT experiments ##### -# on partioned tables -SET @max_row = 20; - -# The server must support partitioning. ---source include/have_partition.inc - -#------------------------------------------------------------------------------# -# Engine specific settings and requirements - -##### Storage engine to be tested ---source include/have_ndb.inc -let $engine= 'NDB'; -connection default; - -# range, list and hash partitioning in ndb requires new_mode ---disable_query_log -set new=on; ---enable_query_log -##### Assign a big number smaller than the maximum value for partitions ##### -# and smaller than the maximum value of SIGNED INTEGER -let $MAX_VALUE= (2147483646); - -#------------------------------------------------------------------------------# -# Execute the tests to be applied to all storage engines ---source suite/parts/inc/partition_bit.inc diff --git a/mysql-test/suite/parts/t/partition_sessions.test b/mysql-test/suite/parts/t/partition_sessions.test deleted file mode 100644 index 3d59292bee5..00000000000 --- a/mysql-test/suite/parts/t/partition_sessions.test +++ /dev/null @@ -1,391 +0,0 @@ - -#-------------------------------------------------- -# Initialize system_3 test variables -#-------------------------------------------------- - ---source suite/system_3/include/system_3_init.inc - -let $NUM_VAL=`SELECT @NUM_VAL`; -let $LOAD_LINES=`SELECT @LOAD_LINES`; -let $LOG_UPPER=`SELECT @LOG_UPPER`; -let $LOG_LOWER=`SELECT @LOG_LOWER`; -#let $ENG1=`SELECT @ENG1`; -let $ENG2=`SELECT @ENG2`; -let $ENG_LOG=`SELECT @ENG_LOG`; -let $CLIENT_HOST=`SELECT @CLIENT_HOST`; -let $ENG=innodb; -let $ENG1=innodb; -#--------------------------------------------------------- -# Column list with definition for all tables to be checked -#--------------------------------------------------------- - -let $column_list= f1 int, -f2 char (15), -f3 decimal (5,3), -f4 datetime; - -let $col_access_list = f1,f2,f3,f4 ; -let $col_new_list = new.f1,new.f2,new.f3 new.f4 ; - -#--------------------------------------------------- -# Setting the parameters to use during testing -#--------------------------------------------------- -# Set number of variations of the f1 variable (used to segment the rows -# being updated/deleted by a user at a time. The higher the number, the -# more smaller segments used with each query. ---replace_result $NUM_VAL NUM_VAL -eval set @f1_nums=$NUM_VAL; - -# The following sets the number controls the size of the log table. -# Once a size of '@threshold' is reached, the first rows are removed -# sunch that the table is down to '@shrink_to' lines ---replace_result $LOG_LOWER LOG_LOWER -eval set @shrink_to=$LOG_LOWER; ---replace_result $LOG_UPPER LOG_UPPER -eval set @threshold=$LOG_UPPER; - -#--------------------------------------------------- -# Creating the database tables and loading the data -#--------------------------------------------------- - ---disable_warnings -drop database if exists systest1; ---enable_warnings - -create database systest1; - ---disable_abort_on_error ---replace_result $CLIENT_HOST CLIENT_HOST -eval create user systuser@'$CLIENT_HOST'; ---enable_abort_on_error ---replace_result $CLIENT_HOST CLIENT_HOST -eval set password for systuser@'$CLIENT_HOST' = password('systpass'); ---replace_result $CLIENT_HOST CLIENT_HOST -eval grant ALL on systest1.* to systuser@'$CLIENT_HOST'; -use systest1; ---replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK -connect (systuser,localhost,systuser,systpass,systest1,$MASTER_MYPORT,$MASTER_MYSOCK); - -create table tb1_master ( - f1 int, - f2 char(15), - f3 decimal (5,3), - f4 datetime -); - -#--replace_result $ENG_LOG ENG_LOG -eval create table tb1_logs ( - i1 int NOT NULL auto_increment, primary key (i1), - dt1 datetime NOT NULL, - entry_dsc char(100), - f4 int -) engine=$ENG_LOG -; -#PARTITION BY HASH (i1) PARTITIONS 8; - -if ($debug) -{ -SHOW CREATE TABLE tb1_logs; -} - -#--replace_result $ENG_LOG ENG_LOG -eval create table ddl_logs ( - i1 int NOT NULL auto_increment, primary key (i1), - dt1 datetime NOT NULL, - entry_dsc char(100), - errno int -) engine=$ENG_LOG; -#PARTITION BY HASH (i1) PARTITIONS 8; - -if ($debug) -{ -SHOW CREATE TABLE tb1_logs; -} -create table test_stat ( - dt1 datetime, - table_name char(20), - row_count int, - start_row int, - end_row int -); - -#---------------------------------------------------------------------- -# tb3_eng1: key partitioning -#---------------------------------------------------------------------- - -#--replace_result $ENG1 ENG1 -eval create table tb3_eng1 ( - i1 int NOT NULL auto_increment, primary key (i1), - $column_list -) engine=$ENG1 -PARTITION BY KEY (i1) PARTITIONS 4 -(PARTITION part1, -PARTITION part2, -PARTITION part3, -PARTITION part4); - -#--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data local infile '$MYSQL_TEST_DIR/suite/system_3/data/tb1.txt' - into table tb3_eng1 ($col_access_list); - -if ($WITH_TRIGGERS) -{ -delimiter //; - -Create trigger tb3_eng1_ins after insert on tb3_eng1 for each row -BEGIN - insert into tb1_logs (dt1, entry_dsc, f4) - values (now(), concat('Insert row ', new.f1,' ', - new.f2, ' ', new.f3, ' (tb3_eng1)'), new.f1); -END// - -Create trigger tb3_eng1_upd after update on tb3_eng1 for each row -BEGIN - insert into tb1_logs (dt1, entry_dsc, f4) - values (now(), concat('Update row ', old.f1,' ', old.f2, '->', - new.f2, ' ', old.f3, '->', new.f3, ' (tb3_eng1)'), new.f1); -END// - -Create trigger tb3_eng1_del after delete on tb3_eng1 for each row -BEGIN - insert into tb1_logs (dt1, entry_dsc, f4) - values (now(), concat('Delete row ', old.f1,' ', old.f2, ' ', - old.f3, ' (tb3_eng1)'), old.f1); -END// - -delimiter ;// -} -delimiter //; - -# This functions returns a random integer number -# between zero and 'num' -#----------------------------------------------- -create function int_rand(num int) returns int -BEGIN - return round(num*rand()+0.5); -END// - -# This function returns a string in the length 'len' of -# random letters (ascii range of 65-122) -#------------------------------------------------------ -create function str_rand (len int) returns char(12) -BEGIN - declare tmp_letter char(1); - declare tmp_word char(12); - declare word_str char(12) default ''; - wl_loop: WHILE len DO - set tmp_letter=char(round(57*rand()+65)); - set tmp_word=concat(word_str,tmp_letter); - set word_str=tmp_word; - set len=len-1; - END WHILE wl_loop; - return word_str; -END// - - -# This procedure scans 'tb1_master' table for rows where f1='num_pr' -# and for each row inserts a row in 'tb3_eng1' -#------------------------------------------------------------------ -eval create procedure ins_tb3_eng1 (num_pr int, str_pr char(15)) -BEGIN - declare done int default 0; - declare v3 decimal(5,3); - declare cur1 cursor for - select f3 from tb1_master where f1=num_pr; - declare continue handler for sqlstate '01000' set done = 1; - declare continue handler for sqlstate '02000' set done = 1; - open cur1; - fetch cur1 into v3; - wl_loop: WHILE NOT done DO - insert into tb3_eng1 ($col_access_list) values - (int_rand(@f1_nums), concat('I:',str_pr,'-',num_pr), v3, now()); - fetch cur1 into v3; - END WHILE wl_loop; - close cur1; -END// - - -# This procedure does selects from the 'tb1_logs' and inserts the -# count into the table -#------------------------------------------------------------------ -create procedure slct_tb1_logs () -BEGIN - declare done int default 0; - declare v4 int; - declare v_count int default 0; - declare str_val char(15) default ELT(int_rand(3), - 'Insert', 'Update', 'Delete'); - declare cur1 cursor for - select f4 from tb1_logs where entry_dsc like concat('%',str_val,'%'); - declare continue handler for sqlstate '01000' set done = 1; - declare continue handler for sqlstate '02000' set done = 1; - open cur1; - fetch cur1 into v4; - wl_loop: WHILE NOT done DO - set v_count=v_count+1; - fetch cur1 into v4; - END WHILE wl_loop; - close cur1; - insert into tb1_logs (dt1, entry_dsc, f4) - values (now(), concat('Number of \'', str_val, '\' rows is: ', - v_count, ' (tb1_log)'),0); -END// - -delimiter ;// - ---disable_abort_on_error -insert into systest1.tb3_eng1 values (NULL,50,'init_val',12.345,'2005-01-01 00:00:00'); -insert into systest1.tb3_eng1 values (NULL,70,'init_val',12.345,'2005-01-01 00:00:00'); ---enable_abort_on_error - -connection default;0. ---disable_abort_on_error ---replace_result $CLIENT_HOST CLIENT_HOST -eval create user syst1user@'$CLIENT_HOST'; ---enable_abort_on_error ---replace_result $CLIENT_HOST CLIENT_HOST -eval set password for syst1user@'$CLIENT_HOST' = password('systpass'); ---replace_result $CLIENT_HOST CLIENT_HOST -eval grant ALL on systest1.* to syst1user@'$CLIENT_HOST'; -use systest1; ---replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK -connect (syst1user,localhost,syst1user,systpass,systest1,$MASTER_MYPORT,$MASTER_MYSOCK); - ---source suite/system_3/include/system_3_init.inc -use systest1; -let $NUM_VAL=`SELECT @NUM_VAL`; -eval SET @f1_nums=$NUM_VAL; -SET @tmp_num=int_rand(@f1_nums); -SET @tmp_word=str_rand(4); - -# DEBUG select @tmp_num, @tmp_word; - -# Insert rows replacing the deleted rows using a strored procedure -# that reads the rows from a master table -CALL ins_tb3_eng1 (@tmp_num, @tmp_word); - -connection syst1user; ---source suite/system_3/include/system_3_init.inc -use systest1; -let $NUM_VAL=`SELECT @NUM_VAL`; -eval SET @f1_nums=$NUM_VAL; -SET @tmp_num=int_rand(@f1_nums); -SET @tmp_word=str_rand(4); - -# DEBUG select @tmp_num, @tmp_word; - -# Insert rows replacing the deleted rows using a strored procedure -# that reads the rows from a master table -CALL ins_tb3_eng1 (@tmp_num, @tmp_word); - -connection systuser; ---source suite/system_3/include/system_3_init.inc -use systest1; -call slct_tb1_logs(); - -connection syst1user; ---source suite/system_3/include/system_3_init.inc -use systest1; -let $NUM_VAL=`SELECT @NUM_VAL`; -eval set @f1_nums=$NUM_VAL; -set @tmp_num=int_rand(@f1_nums); -set @tmp_word=str_rand(4); - -select @tmp_num, @tmp_word; - -# Update all rows in the table where f1 is one less the random number -update tb3_eng1 - set f2=concat('U:',@tmp_word,'-',@tmp_num), f3=f3+1 - where f1=@tmp_num-1; - -connection systuser; ---source suite/system_3/include/system_3_init.inc -use systest1; -let $NUM_VAL=`SELECT @NUM_VAL`; -eval set @f1_nums=$NUM_VAL; -set @tmp_num=int_rand(@f1_nums); -set @tmp_word=str_rand(4); - -select @tmp_num, @tmp_word; - -# Update all rows in the table where f1 is one less the random number -update tb3_eng1 - set f2=concat('U:',@tmp_word,'-',@tmp_num), f3=f3+1 - where f1=@tmp_num-1; - -connection syst1user; ---source suite/system_3/include/system_3_init.inc -use systest1; -call slct_tb1_logs(); - -connection systuser; ---source suite/system_3/include/system_3_init.inc -use systest1; -let $NUM_VAL=`SELECT @NUM_VAL`; -eval set @f1_nums=$NUM_VAL; -set @tmp_num=int_rand(@f1_nums); -set @tmp_word=str_rand(4); - -select @tmp_num, @tmp_word; - -# Update all rows in the table where f1 is one less the random number -update tb3_eng1 - set f2=concat('U:',@tmp_word,'-',@tmp_num), f3=f3+1 - where f1=@tmp_num-1; - - -connection syst1user; ---source suite/system_3/include/system_3_init.inc -use systest1; -#--replace_result $NUM_VAL <NUM_VAL> -let $NUM_VAL=`SELECT @NUM_VAL`; -eval set @f1_nums=$NUM_VAL; -set @tmp_num=int_rand(@f1_nums); -select @tmp_num; - -# DEBUG select @tmp_num, @tmp_word; - -# Delete all rows from the table where f1 is equal to the above number -delete from tb3_eng1 where f1=@tmp_num; - -connection systuser; ---source suite/system_3/include/system_3_init.inc -use systest1; -select * from tb3_eng1 where f1>40; - - -connection syst1user; ---source suite/system_3/include/system_3_init.inc -use systest1; -let $NUM_VAL=`SELECT @NUM_VAL`; -eval set @f1_nums=$NUM_VAL; -set @tmp_num=int_rand(@f1_nums); -select @tmp_num; - -# DEBUG select @tmp_num, @tmp_word; - -# Delete all rows from the table where f1 is equal to the above number -delete from tb3_eng1 where f1=@tmp_num; - -connection systuser; ---source suite/system_3/include/system_3_init.inc -use systest1; -select * from tb3_eng1 where f1>40; - -connection syst1user; ---source suite/system_3/include/system_3_init.inc -use systest1; -let $NUM_VAL=`SELECT @NUM_VAL`; -eval set @f1_nums=$NUM_VAL; -set @tmp_num=int_rand(@f1_nums); -select @tmp_num; - -select @tmp_num, @tmp_word; - -# Delete all rows from the table where f1 is equal to the above number -delete from tb3_eng1 where f1=@tmp_num; - -connection systuser; ---source suite/system_3/include/system_3_init.inc -use systest1; -select * from tb3_eng1 where f1>40; diff --git a/mysql-test/suite/parts/t/partition_special_innodb.test b/mysql-test/suite/parts/t/partition_special_innodb.test index b9fc8bdcd56..eac19f6d588 100644 --- a/mysql-test/suite/parts/t/partition_special_innodb.test +++ b/mysql-test/suite/parts/t/partition_special_innodb.test @@ -68,10 +68,12 @@ INSERT INTO t1 VALUES (NULL, 'first row t2'); --connection con2 SET autocommit=OFF; +--error ER_LOCK_WAIT_TIMEOUT ALTER TABLE t1 AUTO_INCREMENT = 10; --connection con1 INSERT INTO t1 VALUES (NULL, 'second row t2'); +SELECT a,b FROM t1 ORDER BY a; --disconnect con2 --disconnect con1 --connection default diff --git a/mysql-test/suite/parts/t/partition_value_innodb.test b/mysql-test/suite/parts/t/partition_value_innodb.test index 9d59533a54e..fe47f533107 100644 --- a/mysql-test/suite/parts/t/partition_value_innodb.test +++ b/mysql-test/suite/parts/t/partition_value_innodb.test @@ -8,9 +8,9 @@ #------------------------------------------------------------------------------# # Original Author: mleich # # Original Date: 2006-04-11 # -# Change Author: # -# Change Date: # -# Change: # +# Change Author: mleich # +# Change Date: 2008-12-08 # +# Change: Remove test from disabled.def + change test that it gets skipped # ################################################################################ # @@ -22,6 +22,12 @@ # any of the variables. # +# +# CAST() within the partitioning function si no more supported, but we get +# this functionality probably soon again. Therefor we do not delete this test. +--skip # CAST() in partitioning function is currently not supported. + + #------------------------------------------------------------------------------# # General not engine specific settings and requirements diff --git a/mysql-test/suite/parts/t/partition_value_myisam.test b/mysql-test/suite/parts/t/partition_value_myisam.test index d6020669509..026ad57f0b2 100644 --- a/mysql-test/suite/parts/t/partition_value_myisam.test +++ b/mysql-test/suite/parts/t/partition_value_myisam.test @@ -8,9 +8,9 @@ #------------------------------------------------------------------------------# # Original Author: mleich # # Original Date: 2006-04-11 # -# Change Author: # -# Change Date: # -# Change: # +# Change Author: mleich # +# Change Date: 2008-12-08 # +# Change: Remove test from disabled.def + change test that it gets skipped # ################################################################################ # @@ -22,6 +22,12 @@ # any of the variables. # +# +# CAST() within the partitioning function si no more supported, but we get +# this functionality probably soon again. Therefor we do not delete this test. +--skip # CAST() in partitioning function is currently not supported. + + #------------------------------------------------------------------------------# # General not engine specific settings and requirements diff --git a/mysql-test/suite/parts/t/partition_value_ndb.test b/mysql-test/suite/parts/t/partition_value_ndb.test index 2f948b95727..80b4ba6fb64 100644 --- a/mysql-test/suite/parts/t/partition_value_ndb.test +++ b/mysql-test/suite/parts/t/partition_value_ndb.test @@ -8,9 +8,9 @@ #------------------------------------------------------------------------------# # Original Author: mleich # # Original Date: 2006-04-11 # -# Change Author: # -# Change Date: # -# Change: # +# Change Author: mleich # +# Change Date: 2008-12-08 # +# Change: Remove test from disabled.def + change test that it gets skipped # ################################################################################ # @@ -22,6 +22,12 @@ # any of the variables. # +# +# CAST() within the partitioning function si no more supported, but we get +# this functionality probably soon again. Therefor we do not delete this test. +--skip # CAST() in partitioning function is currently not supported. + + #------------------------------------------------------------------------------# # General not engine specific settings and requirements diff --git a/mysql-test/suite/rpl/combinations b/mysql-test/suite/rpl/combinations index ea25611a5d4..07042c2cbec 100644 --- a/mysql-test/suite/rpl/combinations +++ b/mysql-test/suite/rpl/combinations @@ -1,8 +1,8 @@ [row] ---binlog-format=row +binlog-format=row [stmt] ---binlog-format=statement +binlog-format=statement [mix] ---binlog-format=mixed +binlog-format=mixed diff --git a/mysql-test/suite/rpl/include/rpl_mixed_dml.inc b/mysql-test/suite/rpl/include/rpl_mixed_dml.inc index d7041d82a2a..e9adb805c99 100644 --- a/mysql-test/suite/rpl/include/rpl_mixed_dml.inc +++ b/mysql-test/suite/rpl/include/rpl_mixed_dml.inc @@ -51,9 +51,8 @@ DELETE FROM t2 WHERE a = 2; --echo --echo ******************** LOAD DATA INFILE ******************** ---copy_file ./suite/rpl/data/rpl_mixed.dat $MYSQLTEST_VARDIR/tmp/rpl_mixed.dat -LOAD DATA INFILE '../tmp/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ; ---remove_file $MYSQLTEST_VARDIR/tmp/rpl_mixed.dat +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ; SELECT * FROM t1 ORDER BY a; --source suite/rpl/include/rpl_mixed_check_select.inc --source suite/rpl/include/rpl_mixed_clear_tables.inc @@ -329,6 +328,7 @@ DROP VIEW v2; --echo ******************** SHOW BINLOG EVENTS ******************** --replace_column 2 # 5 # --replace_regex /Server ver: .+/Server ver: #/ /table_id: [0-9]+/table_id: #/ /COMMIT.+xid=[0-9]+.+/#/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR show binlog events from 1; sync_slave_with_master; # as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID @@ -344,4 +344,4 @@ sync_slave_with_master; # will be created. You will need to go to the mysql-test dir and diff # the files your self to see what is not matching ---exec diff $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql +--diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql diff --git a/mysql-test/suite/rpl/my.cnf b/mysql-test/suite/rpl/my.cnf new file mode 100644 index 00000000000..ea4caeb2ddd --- /dev/null +++ b/mysql-test/suite/rpl/my.cnf @@ -0,0 +1,14 @@ +# Use settings from rpl_1slave_base.cnf +# add setting to connect the slave to the master by default +!include rpl_1slave_base.cnf + +[mysqld.2] +# Hardcode the host to 127.0.0.1 until running on more +# than one host and it need to be masked +# master-host= @mysqld.1.#host +master-host= 127.0.0.1 +master-port= @mysqld.1.port +master-password= @mysqld.1.#password +master-user= @mysqld.1.#user +master-connect-retry= 1 + diff --git a/mysql-test/suite/rpl/r/rpl_LD_INFILE.result b/mysql-test/suite/rpl/r/rpl_LD_INFILE.result index 70013f95d85..b092dd9e088 100644 --- a/mysql-test/suite/rpl/r/rpl_LD_INFILE.result +++ b/mysql-test/suite/rpl/r/rpl_LD_INFILE.result @@ -6,10 +6,10 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a)); -LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1; +LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1; DELETE FROM test.t1 WHERE a = 'abashed'; DELETE FROM test.t1; -LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1; +LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1; SELECT * FROM test.t1 ORDER BY a DESC; a aberration diff --git a/mysql-test/suite/rpl/r/rpl_alter_db.result b/mysql-test/suite/rpl/r/rpl_alter_db.result index 6edbe5d427f..60c07d0dede 100644 --- a/mysql-test/suite/rpl/r/rpl_alter_db.result +++ b/mysql-test/suite/rpl/r/rpl_alter_db.result @@ -4,5 +4,9 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -use mysql; +==== Verify that alter database does not stop replication ==== +create database temp_db; +use temp_db; alter database collate latin1_bin; +==== Clean up ==== +drop database temp_db; diff --git a/mysql-test/suite/rpl/r/rpl_auto_increment.result b/mysql-test/suite/rpl/r/rpl_auto_increment.result index 083f3a4e901..2a4c3a09361 100644 --- a/mysql-test/suite/rpl/r/rpl_auto_increment.result +++ b/mysql-test/suite/rpl/r/rpl_auto_increment.result @@ -227,3 +227,20 @@ select * from t3 order by a; a 127 drop table t1,t2,t3; +set auto_increment_increment=1; +set auto_increment_offset=1; +CREATE TABLE t1 (id MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=innodb; +INSERT INTO t1 VALUES (NULL), (NULL), (NULL); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 +drop table t1; diff --git a/mysql-test/suite/rpl/r/rpl_binlog_corruption.result b/mysql-test/suite/rpl/r/rpl_binlog_corruption.result new file mode 100644 index 00000000000..f94d2833603 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_binlog_corruption.result @@ -0,0 +1,8 @@ +call mtr.add_suppression('Found invalid event in binary log'); +==== Initialize ==== +Setting up fake replication from MYSQL_TEST_DIR/std_data/bug40482-bin.000001 +==== Test ==== +START SLAVE SQL_THREAD; +Last_SQL_Error = Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave. +==== Clean up ==== +Cleaning up after setup_fake_relay_log.inc diff --git a/mysql-test/suite/rpl/r/rpl_blackhole.result b/mysql-test/suite/rpl/r/rpl_blackhole.result index 27094e761b0..b48a782b570 100644 --- a/mysql-test/suite/rpl/r/rpl_blackhole.result +++ b/mysql-test/suite/rpl/r/rpl_blackhole.result @@ -98,3 +98,4 @@ SELECT COUNT(*) FROM t1; COUNT(*) 0 >>> Something was written to binary log <<< +drop table t1,t2; diff --git a/mysql-test/suite/rpl/r/rpl_bug26395.result b/mysql-test/suite/rpl/r/rpl_bug26395.result new file mode 100644 index 00000000000..c6dd2d01ed3 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_bug26395.result @@ -0,0 +1,41 @@ +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; +==== Initialize ==== +[on master] +CREATE TABLE tinnodb (a INT) ENGINE = INNODB; +SHOW CREATE TABLE tinnodb; +Table Create Table +tinnodb CREATE TABLE `tinnodb` ( + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +set @old_debug= @@debug; +set @@debug= 'd,do_not_write_xid'; +==== Test ==== +INSERT INTO tinnodb VALUES (1); +SELECT * FROM tinnodb ORDER BY a; +a +1 +[on slave] +==== Verify results on slave ==== +include/stop_slave.inc +SELECT "" AS Slave_IO_State; +Slave_IO_State + +SELECT "" AS Last_SQL_Error; +Last_SQL_Error + +SELECT "" AS Last_IO_Error; +Last_IO_Error + +SELECT * FROM tinnodb ORDER BY a; +a +==== Clean up ==== +[on master] +DROP TABLE tinnodb; +set @@debug= @old_debug; +[on slave] +DROP TABLE tinnodb; diff --git a/mysql-test/suite/rpl/r/rpl_bug33931.result b/mysql-test/suite/rpl/r/rpl_bug33931.result index 4043f04215b..1b3f2cfc7dc 100644 --- a/mysql-test/suite/rpl/r/rpl_bug33931.result +++ b/mysql-test/suite/rpl/r/rpl_bug33931.result @@ -1,6 +1,8 @@ reset master; +call mtr.add_suppression("Failed during slave.*thread initialization"); stop slave; reset slave; +SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; start slave; show slave status; Slave_IO_State # @@ -41,3 +43,4 @@ Last_IO_Errno 0 Last_IO_Error Last_SQL_Errno 0 Last_SQL_Error +SET GLOBAL debug=""; diff --git a/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result b/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result new file mode 100644 index 00000000000..c3ccc76d1bc --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result @@ -0,0 +1,298 @@ +*** Set up circular ring by schema A->B->C->D->A *** +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; +STOP SLAVE; +RESET SLAVE; +RESET MASTER; +STOP SLAVE; +RESET SLAVE; +SET auto_increment_increment = 4; +SET auto_increment_offset = 1; +RESET MASTER; +RESET SLAVE; +CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_A_PORT,master_user='root',MASTER_LOG_FILE='MASTER_A_LOG_FILE'; +SET auto_increment_increment = 4; +SET auto_increment_offset = 2; +RESET MASTER; +STOP SLAVE; +RESET SLAVE; +CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_B_PORT,master_user='root',MASTER_LOG_FILE='MASTER_B_LOG_FILE'; +SET auto_increment_increment = 4; +SET auto_increment_offset = 3; +RESET MASTER; +STOP SLAVE; +RESET SLAVE; +CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_C_PORT,master_user='root',MASTER_LOG_FILE='MASTER_C_LOG_FILE'; +SET auto_increment_increment = 4; +SET auto_increment_offset = 4; +CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_D_PORT,master_user='root',MASTER_LOG_FILE='MASTER_D_LOG_FILE'; +SHOW VARIABLES LIKE 'auto_increment_%'; +Variable_name Value +auto_increment_increment 4 +auto_increment_offset 1 +SHOW VARIABLES LIKE 'auto_increment_%'; +Variable_name Value +auto_increment_increment 4 +auto_increment_offset 2 +SHOW VARIABLES LIKE 'auto_increment_%'; +Variable_name Value +auto_increment_increment 4 +auto_increment_offset 3 +SHOW VARIABLES LIKE 'auto_increment_%'; +Variable_name Value +auto_increment_increment 4 +auto_increment_offset 4 +1 +START SLAVE; +START SLAVE; +START SLAVE; +START SLAVE; + +*** Preparing data *** +CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=MyISAM; +CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=InnoDB; + +*** Testing schema A->B->C->D->A *** + +INSERT INTO t1(b,c) VALUES('A',1); +INSERT INTO t1(b,c) VALUES('B',1); +INSERT INTO t1(b,c) VALUES('C',1); +INSERT INTO t1(b,c) VALUES('D',1); +SELECT 'Master A',a,b FROM t1 WHERE c = 1 ORDER BY a,b; +Master A a b +Master A 1 A +Master A 2 B +Master A 3 C +Master A 4 D +SELECT 'Master B',a,b FROM t1 WHERE c = 1 ORDER BY a,b; +Master B a b +Master B 1 A +Master B 2 B +Master B 3 C +Master B 4 D +SELECT 'Master C',a,b FROM t1 WHERE c = 1 ORDER BY a,b; +Master C a b +Master C 1 A +Master C 2 B +Master C 3 C +Master C 4 D +SELECT 'Master D',a,b FROM t1 WHERE c = 1 ORDER BY a,b; +Master D a b +Master D 1 A +Master D 2 B +Master D 3 C +Master D 4 D + +*** Testing schema A->B->D->A if C has failure *** + +* Do failure for C and then make new connection B->D * +STOP SLAVE; +SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; +include/start_slave.inc +INSERT INTO t1 VALUES(6,'C',2); +INSERT INTO t1(b,c) VALUES('B',2); +INSERT INTO t1(b,c) VALUES('A',2); +INSERT INTO t1(b,c) VALUES('D',2); + +* Data on servers (C failed) * +SELECT 'Master A',a,b FROM t1 WHERE c = 2 ORDER BY a,b; +Master A a b +Master A 5 A +Master A 8 D +SELECT 'Master B',a,b FROM t1 WHERE c = 2 ORDER BY a,b; +Master B a b +Master B 5 A +Master B 6 B +Master B 8 D +SELECT 'Master C',a,b FROM t1 WHERE c = 2 ORDER BY a,b; +Master C a b +Master C 6 C +SELECT 'Master D',a,b FROM t1 WHERE c = 2 ORDER BY a,b; +Master D a b +Master D 8 D + +* Reconfigure replication to schema A->B->D->A * +STOP SLAVE; +STOP SLAVE; +CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_B_PORT,master_user='root',master_log_file='LOG_FILE',master_log_pos=LOG_POS; +include/start_slave.inc + +* Check data inserted before failure * +SELECT 'Master A',a,b FROM t1 WHERE c = 2 ORDER BY a,b; +Master A a b +Master A 5 A +Master A 6 B +Master A 8 D +SELECT 'Master B',a,b FROM t1 WHERE c = 2 ORDER BY a,b; +Master B a b +Master B 5 A +Master B 6 B +Master B 8 D +SELECT 'Master C',a,b FROM t1 WHERE c = 2 ORDER BY a,b; +Master C a b +Master C 6 C +SELECT 'Master D',a,b FROM t1 WHERE c = 2 ORDER BY a,b; +Master D a b +Master D 5 A +Master D 6 B +Master D 8 D + +* Check data inserted after failure * +INSERT INTO t1(b,c) VALUES('A',3); +INSERT INTO t1(b,c) VALUES('B',3); +INSERT INTO t1(b,c) VALUES('D',3); +SELECT 'Master A',a,b FROM t1 WHERE c = 3 ORDER BY a,b; +Master A a b +Master A 9 A +Master A 10 B +Master A 12 D +SELECT 'Master B',a,b FROM t1 WHERE c = 3 ORDER BY a,b; +Master B a b +Master B 9 A +Master B 10 B +Master B 12 D +SELECT 'Master C',a,b FROM t1 WHERE c = 3 ORDER BY a,b; +Master C a b +SELECT 'Master D',a,b FROM t1 WHERE c = 3 ORDER BY a,b; +Master D a b +Master D 9 A +Master D 10 B +Master D 12 D + +*** Testing restoring scheme A->B->C->D->A after failure *** + +* Remove wrong event from C and restore B->C->D * +include/stop_slave.inc +DELETE FROM t1 WHERE a = 6; +START SLAVE; +RESET MASTER; +RESET SLAVE; +CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_C_PORT,master_user='root',master_log_file='LOG_FILE',master_log_pos=LOG_POS; +START SLAVE; + +* Check data inserted before restoring schema A->B->C->D->A * +SELECT 'Master A',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b; +Master A a b +Master A 5 A +Master A 6 B +Master A 8 D +Master A 9 A +Master A 10 B +Master A 12 D +SELECT 'Master B',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b; +Master B a b +Master B 5 A +Master B 6 B +Master B 8 D +Master B 9 A +Master B 10 B +Master B 12 D +SELECT 'Master C',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b; +Master C a b +Master C 5 A +Master C 6 B +Master C 8 D +Master C 9 A +Master C 10 B +Master C 12 D +SELECT 'Master D',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b; +Master D a b +Master D 5 A +Master D 6 B +Master D 8 D +Master D 9 A +Master D 10 B +Master D 12 D + +* Check data inserted after restoring schema A->B->C->D->A * +INSERT INTO t1(b,c) VALUES('A',4); +INSERT INTO t1(b,c) VALUES('B',4); +INSERT INTO t1(b,c) VALUES('C',4); +INSERT INTO t1(b,c) VALUES('D',4); +SELECT 'Master A',a,b FROM t1 WHERE c = 4 ORDER BY a,b; +Master A a b +Master A 13 A +Master A 14 B +Master A 15 C +Master A 16 D +SELECT 'Master B',a,b FROM t1 WHERE c = 4 ORDER BY a,b; +Master B a b +Master B 13 A +Master B 14 B +Master B 15 C +Master B 16 D +SELECT 'Master C',a,b FROM t1 WHERE c = 4 ORDER BY a,b; +Master C a b +Master C 13 A +Master C 14 B +Master C 15 C +Master C 16 D +SELECT 'Master D',a,b FROM t1 WHERE c = 4 ORDER BY a,b; +Master D a b +Master D 13 A +Master D 14 B +Master D 15 C +Master D 16 D + +* Transactions with commits * +BEGIN; +BEGIN; +SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b; +Master A b COUNT(*) +Master A A 100 +Master A B 100 +Master A C 100 +Master A D 100 +SELECT 'Master B',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b; +Master B b COUNT(*) +Master B A 100 +Master B B 100 +Master B C 100 +Master B D 100 +SELECT 'Master C',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b; +Master C b COUNT(*) +Master C A 100 +Master C B 100 +Master C C 100 +Master C D 100 +SELECT 'Master D',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b; +Master D b COUNT(*) +Master D A 100 +Master D B 100 +Master D C 100 +Master D D 100 + +* Transactions with rollbacks * +BEGIN; +BEGIN; +SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b; +Master A b COUNT(*) +Master A B 100 +Master A D 100 +SELECT 'Master B',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b; +Master B b COUNT(*) +Master B B 100 +Master B D 100 +SELECT 'Master C',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b; +Master C b COUNT(*) +Master C B 100 +Master C D 100 +SELECT 'Master D',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b; +Master D b COUNT(*) +Master D B 100 +Master D D 100 + +*** Clean up *** +DROP TABLE t1,t2; +STOP SLAVE; +RESET SLAVE; +STOP SLAVE; +RESET SLAVE; +STOP SLAVE; +RESET SLAVE; +STOP SLAVE; +RESET SLAVE; diff --git a/mysql-test/suite/rpl/r/rpl_drop_db.result b/mysql-test/suite/rpl/r/rpl_drop_db.result index c0efdf5290d..8825797f80d 100644 --- a/mysql-test/suite/rpl/r/rpl_drop_db.result +++ b/mysql-test/suite/rpl/r/rpl_drop_db.result @@ -31,8 +31,7 @@ use test; select * from t1; n 1234 -stop slave; -drop database mysqltest1; -drop database mysqltest1; use test; drop table t1; +drop database mysqltest1; +include/stop_slave.inc diff --git a/mysql-test/suite/rpl/r/rpl_drop_view.result b/mysql-test/suite/rpl/r/rpl_drop_view.result index ef625464881..c359011612a 100644 --- a/mysql-test/suite/rpl/r/rpl_drop_view.result +++ b/mysql-test/suite/rpl/r/rpl_drop_view.result @@ -25,3 +25,5 @@ select * from v2; ERROR 42S02: Table 'test.v2' doesn't exist select * from v3; ERROR 42S02: Table 'test.v3' doesn't exist +==== clean up ==== +drop table t1, t2, t3; diff --git a/mysql-test/suite/rpl/r/rpl_events.result b/mysql-test/suite/rpl/r/rpl_events.result index e4a412cb1d5..b797183f9d2 100644 --- a/mysql-test/suite/rpl/r/rpl_events.result +++ b/mysql-test/suite/rpl/r/rpl_events.result @@ -1,10 +1,11 @@ -set global event_scheduler=1; 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; +SET @old_event_scheduler = @@global.event_scheduler; +set global event_scheduler=1; set binlog_format=row; DROP EVENT IF EXISTS test.justonce; drop table if exists t1,t2; @@ -34,7 +35,7 @@ db name status originator test justonce SLAVESIDE_DISABLED 1 "Dropping event test.slave_once on the slave" DROP EVENT IF EXISTS test.slave_once; -CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO +CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once'); "Checking event status on the slave for originator value = slave's server_id" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once'; @@ -45,7 +46,7 @@ DROP EVENT IF EXISTS test.slave_once; "Dropping event test.justonce on the master" DROP EVENT IF EXISTS test.justonce; "Creating event test.er on the master" -CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO +CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er'); "Checking event status on the master" SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; @@ -56,7 +57,7 @@ SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND db name status originator body test er SLAVESIDE_DISABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er') "Altering event test.er on the master" -ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO +ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er'); "Checking event status on the master" SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; @@ -75,7 +76,7 @@ db name status originator SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; db name status originator "Creating event test.slave_terminate on the slave" -CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DO +CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate'); "Checking event status on the slave" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; @@ -123,7 +124,7 @@ db name status originator test justonce SLAVESIDE_DISABLED 1 "Dropping event test.slave_once on the slave" DROP EVENT IF EXISTS test.slave_once; -CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO +CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once'); "Checking event status on the slave for originator value = slave's server_id" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once'; @@ -134,7 +135,7 @@ DROP EVENT IF EXISTS test.slave_once; "Dropping event test.justonce on the master" DROP EVENT IF EXISTS test.justonce; "Creating event test.er on the master" -CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO +CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er'); "Checking event status on the master" SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; @@ -145,7 +146,7 @@ SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND db name status originator body test er SLAVESIDE_DISABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er') "Altering event test.er on the master" -ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO +ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er'); "Checking event status on the master" SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; @@ -164,7 +165,7 @@ db name status originator SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; db name status originator "Creating event test.slave_terminate on the slave" -CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DO +CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate'); "Checking event status on the slave" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; @@ -190,4 +191,5 @@ select * from t28953; END;| ALTER EVENT event1 RENAME TO event2; DROP EVENT event2; +SET @@global.event_scheduler= @old_event_scheduler; DROP TABLE t28953; diff --git a/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result b/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result index fb7f29da656..7eddaabc636 100644 --- a/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result +++ b/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result @@ -50,82 +50,82 @@ UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1; --source include/wait_for_slave_sql_error_and_skip.inc Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1' set global sql_slave_skip_counter=1; -start slave; +include/start_slave.inc UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1; --source include/wait_for_slave_sql_error_and_skip.inc Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1' set global sql_slave_skip_counter=1; -start slave; +include/start_slave.inc UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1; --source include/wait_for_slave_sql_error_and_skip.inc Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1' set global sql_slave_skip_counter=1; -start slave; +include/start_slave.inc UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1; --source include/wait_for_slave_sql_error_and_skip.inc Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1' set global sql_slave_skip_counter=1; -start slave; +include/start_slave.inc UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1; --source include/wait_for_slave_sql_error_and_skip.inc Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1' set global sql_slave_skip_counter=1; -start slave; +include/start_slave.inc UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1; --source include/wait_for_slave_sql_error_and_skip.inc Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1' set global sql_slave_skip_counter=1; -start slave; +include/start_slave.inc UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1; --source include/wait_for_slave_sql_error_and_skip.inc Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1' set global sql_slave_skip_counter=1; -start slave; +include/start_slave.inc UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1; --source include/wait_for_slave_sql_error_and_skip.inc Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1' set global sql_slave_skip_counter=1; -start slave; +include/start_slave.inc UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1; --source include/wait_for_slave_sql_error_and_skip.inc Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1' set global sql_slave_skip_counter=1; -start slave; +include/start_slave.inc UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1; --source include/wait_for_slave_sql_error_and_skip.inc Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1' set global sql_slave_skip_counter=1; -start slave; +include/start_slave.inc UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1; --source include/wait_for_slave_sql_error_and_skip.inc Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1' set global sql_slave_skip_counter=1; -start slave; +include/start_slave.inc UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1; --source include/wait_for_slave_sql_error_and_skip.inc Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1' set global sql_slave_skip_counter=1; -start slave; +include/start_slave.inc UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1; --source include/wait_for_slave_sql_error_and_skip.inc Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1' set global sql_slave_skip_counter=1; -start slave; +include/start_slave.inc UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1; --source include/wait_for_slave_sql_error_and_skip.inc Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1' set global sql_slave_skip_counter=1; -start slave; +include/start_slave.inc UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1; --source include/wait_for_slave_sql_error_and_skip.inc Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1' set global sql_slave_skip_counter=1; -start slave; +include/start_slave.inc UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1; --source include/wait_for_slave_sql_error_and_skip.inc Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1' set global sql_slave_skip_counter=1; -start slave; +include/start_slave.inc [on slave] show tables like 't%'; Tables_in_test (t%) diff --git a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result index baa740bf250..600ac44fc86 100644 --- a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result +++ b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result @@ -6,7 +6,7 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; show variables like 'relay_log%'; Variable_name Value -relay_log MYSQLTEST_VARDIR/master-data/relay-log +relay_log MYSQLD_DATADIR/relay-log relay_log_index relay_log_info_file relay-log.info relay_log_purge ON @@ -18,11 +18,7 @@ start slave; stop slave; change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=SLAVE_PORT; -start slave; - -let $result_pattern= '%127.0.0.1%root%slave-bin.000001%slave-bin.000001%Yes%Yes%0%0%None%' ; - ---source include/wait_slave_status.inc +include/start_slave.inc FLUSH LOGS; SHOW SLAVE STATUS; Slave_IO_State # diff --git a/mysql-test/suite/rpl/r/rpl_found_rows.result b/mysql-test/suite/rpl/r/rpl_found_rows.result index 25be9eb63b3..45a931872cf 100644 --- a/mysql-test/suite/rpl/r/rpl_found_rows.result +++ b/mysql-test/suite/rpl/r/rpl_found_rows.result @@ -103,10 +103,10 @@ DROP PROCEDURE just_log; DROP PROCEDURE calc_and_log; DROP FUNCTION log_rows; **** Resetting master and slave **** -STOP SLAVE; +include/stop_slave.inc RESET SLAVE; RESET MASTER; -START SLAVE; +include/start_slave.inc #### 2. Using mixed mode #### ==== 2.1. Checking a procedure ==== **** On Master **** diff --git a/mysql-test/suite/rpl/r/rpl_idempotency.result b/mysql-test/suite/rpl/r/rpl_idempotency.result index 5a4052864ad..f39d0f1f37f 100644 --- a/mysql-test/suite/rpl/r/rpl_idempotency.result +++ b/mysql-test/suite/rpl/r/rpl_idempotency.result @@ -4,6 +4,9 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: 1032"); +call mtr.add_suppression("Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452"); +SET @old_slave_exec_mode= @@global.slave_exec_mode; CREATE TABLE t1 (a INT PRIMARY KEY); CREATE TABLE t2 (a INT); INSERT INTO t1 VALUES (-1),(-2),(-3); @@ -220,7 +223,7 @@ Last_SQL_Error 0 set global slave_exec_mode='IDEMPOTENT'; start slave sql_thread; -set global slave_exec_mode='STRICT'; +SET @@global.slave_exec_mode= @old_slave_exec_mode; set @@session.binlog_format= @save_binlog_format; drop table t1,t2,ti2,ti1; *** end of tests diff --git a/mysql-test/suite/rpl/r/rpl_ignore_table.result b/mysql-test/suite/rpl/r/rpl_ignore_table.result index cdc3f5e9579..e77be425270 100644 --- a/mysql-test/suite/rpl/r/rpl_ignore_table.result +++ b/mysql-test/suite/rpl/r/rpl_ignore_table.result @@ -116,7 +116,8 @@ show grants for mysqltest4@localhost; Grants for mysqltest4@localhost GRANT USAGE ON *.* TO 'mysqltest4'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7' set global slave_exec_mode='IDEMPOTENT'; -drop table t1, t4, mysqltest2.t2; +drop table t1, mysqltest2.t2; +drop table t4; drop database mysqltest2; delete from mysql.user where user like "mysqltest%"; delete from mysql.db where user like "mysqltest%"; diff --git a/mysql-test/suite/rpl/r/rpl_init_slave.result b/mysql-test/suite/rpl/r/rpl_init_slave.result index 5ff72e57f0e..908abf56c1f 100644 --- a/mysql-test/suite/rpl/r/rpl_init_slave.result +++ b/mysql-test/suite/rpl/r/rpl_init_slave.result @@ -5,8 +5,8 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; set global max_connections=151; -stop slave; -start slave; +include/stop_slave.inc +include/start_slave.inc show variables like 'init_slave'; Variable_name Value init_slave set global max_connections=500 @@ -25,6 +25,6 @@ set global init_connect="set @c=1"; show variables like 'init_connect'; Variable_name Value init_connect set @c=1 -stop slave; +include/stop_slave.inc set global init_connect= @my_global_init_connect; set global max_connections= default; diff --git a/mysql-test/suite/rpl/r/rpl_innodb.result b/mysql-test/suite/rpl/r/rpl_innodb.result index 658f92f4d75..bf6c3cb8c86 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_innodb.result @@ -12,7 +12,7 @@ PRIMARY KEY (id), UNIQUE KEY unique_rec (name,number) ) ENGINE=InnoDB; LOAD DATA -INFILE '../std_data_ln/loaddata_pair.dat' +INFILE '../../std_data/loaddata_pair.dat' REPLACE INTO TABLE t4 (name,number); SELECT * FROM t4; @@ -24,7 +24,7 @@ id name number 1 XXX 12345 2 XXY 12345 LOAD DATA -INFILE '../std_data_ln/loaddata_pair.dat' +INFILE '../../std_data/loaddata_pair.dat' REPLACE INTO TABLE t4 (name,number); SELECT * FROM t4; @@ -43,6 +43,7 @@ CREATE TEMPORARY TABLE mysqltest1.tmp (f1 BIGINT); CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE="InnoDB"; SET AUTOCOMMIT = 0; -------- switch to slave -------- +ALTER TABLE mysqltest1.t1 ENGINE = MyISAM; SHOW CREATE TABLE mysqltest1.t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result index 85308442fd8..fbb1e2355c3 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result @@ -77,7 +77,7 @@ t1 CREATE TABLE `t1` ( `b` char(254) DEFAULT NULL, PRIMARY KEY (`a`), KEY `index1` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -85,7 +85,7 @@ t2 CREATE TABLE `t2` ( `b` char(254) DEFAULT NULL, PRIMARY KEY (`a`), KEY `index1` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ******************** DDL for indexes ******************** ALTER TABLE t2 ADD COLUMN d datetime; @@ -120,7 +120,7 @@ t1 CREATE TABLE `t1` ( `b` char(254) DEFAULT NULL, PRIMARY KEY (`a`), KEY `index1` (`b`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -131,7 +131,7 @@ t2 CREATE TABLE `t2` ( KEY `index1` (`b`), KEY `index2` (`d`), KEY `index3` (`a`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ALTER TABLE t2 DROP COLUMN d; diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result index d70d8dadf54..8602718ba46 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result @@ -103,7 +103,7 @@ DELETE FROM t1; DELETE FROM t2; ******************** LOAD DATA INFILE ******************** -LOAD DATA INFILE '../tmp/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ; SELECT * FROM t1 ORDER BY a; a b 10 line A @@ -885,7 +885,7 @@ master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2 master-bin.000001 # Xid 1 # # master-bin.000001 # Query 1 # use `test_rpl`; BEGIN master-bin.000001 # Begin_load_query 1 # ;file_id=#;block_len=# -master-bin.000001 # Execute_load_query 1 # use `test_rpl`; LOAD DATA INFILE '../tmp/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;file_id=# +master-bin.000001 # Execute_load_query 1 # use `test_rpl`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;file_id=# master-bin.000001 # Xid 1 # # master-bin.000001 # Query 1 # use `test_rpl`; BEGIN master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1 diff --git a/mysql-test/suite/rpl/r/rpl_load_table_from_master.result b/mysql-test/suite/rpl/r/rpl_load_table_from_master.result index c24f857d829..9d9a1d7d6cb 100644 --- a/mysql-test/suite/rpl/r/rpl_load_table_from_master.result +++ b/mysql-test/suite/rpl/r/rpl_load_table_from_master.result @@ -29,9 +29,9 @@ drop table t1; drop table t1; set SQL_LOG_BIN=0; create table t1 (word char(20) not null, index(word))ENGINE=MyISAM; -load data infile '../std_data_ln/words.dat' into table t1; +load data infile '../../std_data/words.dat' into table t1; create table t2 (word char(20) not null)ENGINE=MyISAM; -load data infile '../std_data_ln/words.dat' into table t2; +load data infile '../../std_data/words.dat' into table t2; create table t3 (word char(20) not null primary key)ENGINE=MyISAM; load table t1 from master; load table t2 from master; diff --git a/mysql-test/suite/rpl/r/rpl_loaddata.result b/mysql-test/suite/rpl/r/rpl_loaddata.result index 070c50db3d5..d7a02bc84a5 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata.result @@ -9,12 +9,12 @@ select last_insert_id(); last_insert_id() 0 create table t1(a int not null auto_increment, b int, primary key(a) ); -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; +load data infile '../../std_data/rpl_loaddata.dat' into table t1; select last_insert_id(); last_insert_id() 1 create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60)); -load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines; +load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines; create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60)); insert into t3 select * from t2; select * from t1; @@ -31,7 +31,7 @@ drop table t2; drop table t3; create table t1(a int, b int, unique(b)); insert into t1 values(1,10); -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; +load data infile '../../std_data/rpl_loaddata.dat' into table t1; set global sql_slave_skip_counter=1; start slave; show slave status; @@ -40,7 +40,7 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File set sql_log_bin=0; delete from t1; set sql_log_bin=1; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; +load data infile '../../std_data/rpl_loaddata.dat' into table t1; stop slave; change master to master_user='test'; change master to master_user='root'; @@ -52,7 +52,7 @@ start slave; set sql_log_bin=0; delete from t1; set sql_log_bin=1; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; +load data infile '../../std_data/rpl_loaddata.dat' into table t1; stop slave; reset slave; show slave status; @@ -61,7 +61,7 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File reset master; create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60), unique(day)) engine=MyISAM; -load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields +load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines; ERROR 23000: Duplicate entry '2003-03-22' for key 'day' @@ -76,14 +76,13 @@ day id category name 2003-03-22 2161 c asdf alter table t2 drop key day; delete from t2; -load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields +load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines; ERROR 23000: Duplicate entry '2003-03-22' for key 'day' -drop table t2; -drop table t2; -drop table t1; +drop table t1, t2; +drop table t1, t2; CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB; -LOAD DATA INFILE "../std_data_ln/words.dat" INTO TABLE t1; +LOAD DATA INFILE "../../std_data/words.dat" INTO TABLE t1; ERROR 23000: Duplicate entry 'Aarhus' for key 'PRIMARY' DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_charset.result b/mysql-test/suite/rpl/r/rpl_loaddata_charset.result index 929d06e74cf..7ba67150cb9 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_charset.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_charset.result @@ -5,17 +5,17 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; create table t1 (a varchar(10) character set utf8); -load data infile '../std_data_ln/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; set @@character_set_database=koi8r; -load data infile '../std_data_ln/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; set @@character_set_database=DEFAULT; -load data infile '../std_data_ln/loaddata6.dat' into table t1; -load data infile '../std_data_ln/loaddata6.dat' into table t1; -load data infile '../std_data_ln/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; set @@character_set_database=koi8r; -load data infile '../std_data_ln/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; set @@character_set_database=DEFAULT; -load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8r; +load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8r; select hex(a) from t1; hex(a) C3BF diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result index a4d67754bd6..27fb8623e85 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result @@ -45,7 +45,7 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error -LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE t1; +LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE t1; SHOW SLAVE STATUS; Slave_IO_State # Master_Host 127.0.0.1 diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_m.result b/mysql-test/suite/rpl/r/rpl_loaddata_m.result index 9dbae6d38c4..a1294d515fa 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_m.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_m.result @@ -7,20 +7,21 @@ start slave; drop database if exists mysqltest; USE test; CREATE TABLE t1(a INT, b INT, UNIQUE(b)); -LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE test.t1; +LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE test.t1; SELECT COUNT(*) FROM test.t1; COUNT(*) 2 CREATE DATABASE mysqltest; USE mysqltest; CREATE TABLE t1(a INT, b INT, UNIQUE(b)); -LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE mysqltest.t1; +LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1; SELECT COUNT(*) FROM mysqltest.t1; COUNT(*) 2 SHOW DATABASES; Database information_schema +mtr mysql mysqltest test diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_s.result b/mysql-test/suite/rpl/r/rpl_loaddata_s.result index 4fc33eee20d..779a3af9631 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_s.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_s.result @@ -6,7 +6,7 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; reset master; create table test.t1(a int, b int, unique(b)); -load data infile '../std_data_ln/rpl_loaddata.dat' into table test.t1; +load data infile '../../std_data/rpl_loaddata.dat' into table test.t1; select count(*) from test.t1; count(*) 2 diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_simple.result b/mysql-test/suite/rpl/r/rpl_loaddata_simple.result index 196093211b6..5e3923616ed 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_simple.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_simple.result @@ -5,7 +5,7 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; CREATE TABLE t1 (word CHAR(20) NOT NULL); -LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; +LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; SELECT * FROM t1 ORDER BY word; word Aarhus diff --git a/mysql-test/suite/rpl/r/rpl_loaddatalocal.result b/mysql-test/suite/rpl/r/rpl_loaddatalocal.result index bb1b0610aa8..96de55e9dcf 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddatalocal.result +++ b/mysql-test/suite/rpl/r/rpl_loaddatalocal.result @@ -5,19 +5,19 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; create table t1(a int); -select * into outfile 'MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' from t1; +select * into outfile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; truncate table t1; -load data local infile 'MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1; +load data local infile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1; select a,count(*) from t1 group by a; a count(*) 1 10000 drop table t1; create table t1(a int); insert into t1 values (1), (2), (2), (3); -select * into outfile 'MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' from t1; +select * into outfile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; drop table t1; create table t1(a int primary key); -load data local infile 'MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1; +load data local infile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1; SELECT * FROM t1 ORDER BY a; a 1 diff --git a/mysql-test/suite/rpl/r/rpl_loadfile.result b/mysql-test/suite/rpl/r/rpl_loadfile.result index 7487693a9f7..7a5a7bc50c9 100644 --- a/mysql-test/suite/rpl/r/rpl_loadfile.result +++ b/mysql-test/suite/rpl/r/rpl_loadfile.result @@ -8,11 +8,11 @@ DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a)); INSERT INTO test.t1 VALUES(1,'test'); -UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=1; +UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=1; create procedure test.p1() begin INSERT INTO test.t1 VALUES(2,'test'); -UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=2; +UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=2; end| CALL test.p1(); SELECT * FROM test.t1 ORDER BY blob_column; diff --git a/mysql-test/suite/rpl/r/rpl_log_pos.result b/mysql-test/suite/rpl/r/rpl_log_pos.result index e0c4dedde10..7b3ebf62959 100644 --- a/mysql-test/suite/rpl/r/rpl_log_pos.result +++ b/mysql-test/suite/rpl/r/rpl_log_pos.result @@ -7,7 +7,7 @@ start slave; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB> -stop slave; +include/stop_slave.inc change master to master_log_pos=75; SHOW SLAVE STATUS; Slave_IO_State # @@ -49,7 +49,7 @@ Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error start slave; -stop slave; +include/stop_slave.inc SHOW SLAVE STATUS; Slave_IO_State # Master_Host 127.0.0.1 diff --git a/mysql-test/suite/rpl/r/rpl_misc_functions.result b/mysql-test/suite/rpl/r/rpl_misc_functions.result index a8e5520ca8f..28b777822e4 100644 --- a/mysql-test/suite/rpl/r/rpl_misc_functions.result +++ b/mysql-test/suite/rpl/r/rpl_misc_functions.result @@ -14,8 +14,8 @@ set sql_log_bin=1; insert into t1 values(3, 0, 0, 0, password('does_this_work?')); insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?')); select * into outfile 'rpl_misc_functions.outfile' from t1; -create table t2 like t1; -load data local infile 'MYSQLTEST_VARDIR/master-data/test/rpl_misc_functions.outfile' into table t2; +create temporary table t2 like t1; +load data local infile 'MYSQLD_DATADIR/test/rpl_misc_functions.outfile' into table t2; select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p); id i r1 r2 p id i r1 r2 p drop table t1; @@ -41,9 +41,9 @@ CALL test_replication_sp2(); INSERT INTO t1 (col_a) VALUES (test_replication_sf()); INSERT INTO t1 (col_a) VALUES (test_replication_sf()); INSERT INTO t1 (col_a) VALUES (test_replication_sf()); -select * from t1 into outfile "../tmp/t1_slave.txt"; +select * from t1 into outfile "../../tmp/t1_slave.txt"; create temporary table t1_slave select * from t1 where 1=0; -load data infile '../tmp/t1_slave.txt' into table t1_slave; +load data infile '../../tmp/t1_slave.txt' into table t1_slave; select count(*) into @aux from t1 join t1_slave using (id) where ABS(t1.col_a - t1_slave.col_a) < 0.0000001 ; SELECT @aux; diff --git a/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result b/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result index 38972a4f571..08d3241c48f 100644 --- a/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result +++ b/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result @@ -14,7 +14,7 @@ n 2002 show slave hosts; Server_id Host Port Rpl_recovery_rank Master_id -2 127.0.0.1 9999 2 1 +2 127.0.0.1 9999 0 1 drop table t1; stop slave; create table t2(id int auto_increment primary key, created datetime); diff --git a/mysql-test/suite/rpl/r/rpl_multi_engine.result b/mysql-test/suite/rpl/r/rpl_multi_engine.result index 7cb7d873415..e26777c15ce 100644 --- a/mysql-test/suite/rpl/r/rpl_multi_engine.result +++ b/mysql-test/suite/rpl/r/rpl_multi_engine.result @@ -4,13 +4,10 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -create database if not exists mysqltest1; -use mysqltest1; drop table if exists t1; CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id)); -use mysqltest1; alter table t1 engine=myisam; show create table t1; Table Create Table @@ -55,7 +52,7 @@ id hex(b1) vc bc d f total y t select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; id hex(b1) vc bc d f total y t 42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00 -DELETE FROM mysqltest1.t1 WHERE id = 42; +DELETE FROM t1 WHERE id = 42; select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; id hex(b1) vc bc d f total y t select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; @@ -89,7 +86,7 @@ id hex(b1) vc bc d f total y t select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; id hex(b1) vc bc d f total y t 42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00 -DELETE FROM mysqltest1.t1 WHERE id = 42; +DELETE FROM t1 WHERE id = 42; select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; id hex(b1) vc bc d f total y t select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; @@ -123,7 +120,7 @@ id hex(b1) vc bc d f total y t select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; id hex(b1) vc bc d f total y t 42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00 -DELETE FROM mysqltest1.t1 WHERE id = 42; +DELETE FROM t1 WHERE id = 42; select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; id hex(b1) vc bc d f total y t select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; @@ -172,7 +169,7 @@ id hex(b1) vc bc d f total y t select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; id hex(b1) vc bc d f total y t 42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00 -DELETE FROM mysqltest1.t1 WHERE id = 42; +DELETE FROM t1 WHERE id = 42; select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; id hex(b1) vc bc d f total y t select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; @@ -206,7 +203,7 @@ id hex(b1) vc bc d f total y t select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; id hex(b1) vc bc d f total y t 42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00 -DELETE FROM mysqltest1.t1 WHERE id = 42; +DELETE FROM t1 WHERE id = 42; select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; id hex(b1) vc bc d f total y t select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; @@ -240,7 +237,7 @@ id hex(b1) vc bc d f total y t select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; id hex(b1) vc bc d f total y t 42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00 -DELETE FROM mysqltest1.t1 WHERE id = 42; +DELETE FROM t1 WHERE id = 42; select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; id hex(b1) vc bc d f total y t select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; @@ -289,7 +286,7 @@ id hex(b1) vc bc d f total y t select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; id hex(b1) vc bc d f total y t 42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00 -DELETE FROM mysqltest1.t1 WHERE id = 42; +DELETE FROM t1 WHERE id = 42; select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; id hex(b1) vc bc d f total y t select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; @@ -323,7 +320,7 @@ id hex(b1) vc bc d f total y t select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; id hex(b1) vc bc d f total y t 42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00 -DELETE FROM mysqltest1.t1 WHERE id = 42; +DELETE FROM t1 WHERE id = 42; select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; id hex(b1) vc bc d f total y t select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; @@ -357,10 +354,9 @@ id hex(b1) vc bc d f total y t select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; id hex(b1) vc bc d f total y t 42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00 -DELETE FROM mysqltest1.t1 WHERE id = 42; +DELETE FROM t1 WHERE id = 42; select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; id hex(b1) vc bc d f total y t select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; id hex(b1) vc bc d f total y t DROP TABLE t1; -DROP DATABASE mysqltest1; diff --git a/mysql-test/suite/rpl/r/rpl_packet.result b/mysql-test/suite/rpl/r/rpl_packet.result index f89d6b3459a..4c64054e348 100644 --- a/mysql-test/suite/rpl/r/rpl_packet.result +++ b/mysql-test/suite/rpl/r/rpl_packet.result @@ -8,8 +8,8 @@ drop database if exists DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________ create database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________; SET @@global.max_allowed_packet=1024; SET @@global.net_buffer_length=1024; -STOP SLAVE; -START SLAVE; +include/stop_slave.inc +include/start_slave.inc select @@net_buffer_length, @@max_allowed_packet; @@net_buffer_length @@max_allowed_packet 1024 1024 @@ -27,46 +27,13 @@ SLAVE_RUNNING ON drop database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________; SET @@global.max_allowed_packet=4096; SET @@global.net_buffer_length=4096; -STOP SLAVE; -START SLAVE; -CREATE TABLe `t1` (`f1` LONGTEXT) ENGINE=MyISAM; +include/stop_slave.inc +include/start_slave.inc +CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM; INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048'); -show slave status; -Slave_IO_State # -Master_Host 127.0.0.1 -Master_User root -Master_Port MASTER_MYPORT -Connect_Retry 1 -Master_Log_File master-bin.000001 -Read_Master_Log_Pos # -Relay_Log_File # -Relay_Log_Pos # -Relay_Master_Log_File master-bin.000001 -Slave_IO_Running No -Slave_SQL_Running # -Replicate_Do_DB -Replicate_Ignore_DB -Replicate_Do_Table -Replicate_Ignore_Table -Replicate_Wild_Do_Table -Replicate_Wild_Ignore_Table -Last_Errno 0 -Last_Error -Skip_Counter 0 -Exec_Master_Log_Pos # -Relay_Log_Space # -Until_Condition None -Until_Log_File -Until_Log_Pos 0 -Master_SSL_Allowed No -Master_SSL_CA_File -Master_SSL_CA_Path -Master_SSL_Cert -Master_SSL_Cipher -Master_SSL_Key -Seconds_Behind_Master # -Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 -Last_IO_Error -Last_SQL_Errno 0 -Last_SQL_Error +Slave_IO_Running = No (expect No) +==== clean up ==== +DROP TABLE t1; +SET @@global.max_allowed_packet= 1024; +SET @@global.net_buffer_length= 1024; +DROP TABLE t1; diff --git a/mysql-test/suite/rpl/r/rpl_ps.result b/mysql-test/suite/rpl/r/rpl_ps.result index faba43ae934..89e822b3eb6 100644 --- a/mysql-test/suite/rpl/r/rpl_ps.result +++ b/mysql-test/suite/rpl/r/rpl_ps.result @@ -68,6 +68,7 @@ test latin1_swedish_ci DROP DATABASE mysqltest1; use test; +DROP TABLE t1; # Connection: slave diff --git a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result index 8f145b94046..0551240eb8a 100644 --- a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result +++ b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result @@ -4,6 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +SET @old_binlog_format= @@global.binlog_format; SET BINLOG_FORMAT=MIXED; SET GLOBAL BINLOG_FORMAT=MIXED; SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT; @@ -65,7 +66,6 @@ Last_SQL_Error SHOW BINLOG EVENTS; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 -slave-bin.000001 # Query 2 # use `test`; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9 slave-bin.000001 # Query 1 # use `test`; CREATE TABLE t1 (a INT, b LONG) slave-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (1,1), (2,2) slave-bin.000001 # Query 1 # use `test`; BEGIN @@ -73,3 +73,4 @@ slave-bin.000001 # Table_map 1 # table_id: # (test.t1) slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F slave-bin.000001 # Query 1 # use `test`; COMMIT DROP TABLE IF EXISTS t1; +SET @@global.binlog_format= @old_binlog_format; diff --git a/mysql-test/suite/rpl/r/rpl_replicate_do.result b/mysql-test/suite/rpl/r/rpl_replicate_do.result index d854a2d0f8d..33088ee2ec8 100644 --- a/mysql-test/suite/rpl/r/rpl_replicate_do.result +++ b/mysql-test/suite/rpl/r/rpl_replicate_do.result @@ -9,7 +9,7 @@ drop table if exists t11; create table t2 (n int); insert into t2 values(4); create table t2 (s char(20)); -load data infile '../std_data_ln/words.dat' into table t2; +load data infile '../../std_data/words.dat' into table t2; insert into t2 values('five'); create table t1 (m int); insert into t1 values(15),(16),(17); diff --git a/mysql-test/suite/rpl/r/rpl_rewrt_db.result b/mysql-test/suite/rpl/r/rpl_rewrt_db.result index 1b843bffdca..76dd574191f 100644 --- a/mysql-test/suite/rpl/r/rpl_rewrt_db.result +++ b/mysql-test/suite/rpl/r/rpl_rewrt_db.result @@ -24,7 +24,7 @@ drop database if exists rewrite; create database rewrite; use test; create table t1 (a date, b date, c date not null, d date); -load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ','; +load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ','; Warnings: Warning 1265 Data truncated for column 'a' at row 1 Warning 1265 Data truncated for column 'c' at row 1 @@ -32,7 +32,7 @@ Warning 1265 Data truncated for column 'd' at row 1 Warning 1265 Data truncated for column 'a' at row 2 Warning 1265 Data truncated for column 'b' at row 2 Warning 1265 Data truncated for column 'd' at row 2 -load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES; +load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES; select * from rewrite.t1; a b c d 0000-00-00 NULL 0000-00-00 0000-00-00 @@ -40,7 +40,7 @@ a b c d 2003-03-03 2003-03-03 2003-03-03 NULL 2003-03-03 2003-03-03 2003-03-03 NULL truncate table t1; -load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d); +load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d); Warnings: Warning 1265 Data truncated for column 'c' at row 1 Warning 1265 Data truncated for column 'd' at row 1 @@ -53,7 +53,7 @@ NULL 0000-00-00 0000-00-00 0000-00-00 NULL 2003-03-03 2003-03-03 NULL drop table t1; create table t1 (a text, b text); -load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by ''''; +load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by ''''; Warnings: Warning 1261 Row 3 doesn't contain data for all columns select concat('|',a,'|'), concat('|',b,'|') from rewrite.t1; @@ -65,7 +65,7 @@ Field 3,'Field 4| |Field 6| | 'Field 7'| drop table t1; create table t1 (a int, b char(10)); -load data infile '../std_data_ln/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines; +load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines; Warnings: Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3 Warning 1262 Row 3 was truncated; it contained more data than there were input columns @@ -79,7 +79,7 @@ a b 3 row 3 0 1234567890 truncate table t1; -load data infile '../std_data_ln/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines; +load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines; Warnings: Warning 1366 Incorrect integer value: ' ' for column 'a' at row 4 diff --git a/mysql-test/suite/rpl/r/rpl_row_001.result b/mysql-test/suite/rpl/r/rpl_row_001.result index fad60af664f..0d682eb82e1 100644 --- a/mysql-test/suite/rpl/r/rpl_row_001.result +++ b/mysql-test/suite/rpl/r/rpl_row_001.result @@ -5,8 +5,8 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; CREATE TABLE t1 (word CHAR(20) NOT NULL); -LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; -LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1; +LOAD DATA INFILE 'LOAD_FILE' INTO TABLE t1; +LOAD DATA INFILE 'LOAD_FILE' INTO TABLE t1; SELECT * FROM t1 ORDER BY word LIMIT 10; word Aarhus diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result index 670456ba6fd..1504c16bd7e 100644 --- a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result +++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result @@ -9,6 +9,7 @@ CREATE DATABASE test_ignore; SHOW DATABASES; Database information_schema +mtr mysql test test_ignore @@ -35,6 +36,7 @@ master-bin.000001 # Query # # use `test`; COMMIT SHOW DATABASES; Database information_schema +mtr mysql test USE test; diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result b/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result index 77148fc688c..a980092ac37 100644 --- a/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result +++ b/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result @@ -423,10 +423,10 @@ a b c **** On Master **** DELETE FROM t1; **** Resetting master and slave **** -STOP SLAVE; +include/stop_slave.inc RESET SLAVE; RESET MASTER; -START SLAVE; +include/start_slave.inc **** On Master **** INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M'); **** On Master **** diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result b/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result index 8d071d503bc..ea0c322fe6d 100644 --- a/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result @@ -423,10 +423,10 @@ a b c **** On Master **** DELETE FROM t1; **** Resetting master and slave **** -STOP SLAVE; +include/stop_slave.inc RESET SLAVE; RESET MASTER; -START SLAVE; +include/start_slave.inc **** On Master **** INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M'); **** On Master **** diff --git a/mysql-test/suite/rpl/r/rpl_row_conflicts.result b/mysql-test/suite/rpl/r/rpl_row_conflicts.result new file mode 100644 index 00000000000..0f15bfc7156 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_conflicts.result @@ -0,0 +1,109 @@ +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; +call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: .*"); +[on slave] +SET @old_slave_exec_mode= @@global.slave_exec_mode; +######## Run with slave_exec_mode=STRICT ######## +SET @@global.slave_exec_mode = 'STRICT'; +==== Initialize ==== +[on master] +CREATE TABLE t1(a INT PRIMARY KEY); +[on slave] +==== Test: SQL thread sees 'INSERT' of existing key ==== +---- Prepare slave so that it will get duplicate key error ---- +INSERT INTO t1 VALUES (1); +---- Insert rows on master ---- +[on master] +INSERT INTO t1 VALUES (1); +SELECT * FROM t1; +a +1 +[on slave] +---- Wait until slave stops with an error ---- +Last_SQL_Error = Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos 346 (expected "duplicate key" error) +SELECT * FROM t1; +a +1 +---- Resolve the conflict on the slave and restart SQL thread ---- +DELETE FROM t1 WHERE a = 1; +START SLAVE SQL_THREAD; +---- Sync slave and verify that there is no error ---- +Last_SQL_Error = '' (expected no error) +SELECT * FROM t1; +a +1 +==== Test: SQL thread sees 'DELETE' of non-existing row ==== +---- On master, insert two rows, the second with binlogging off ---- +[on master] +DELETE FROM t1; +INSERT INTO t1 VALUES (1); +[on slave] +DELETE FROM t1 WHERE a = 1; +---- On master, remove the row that does not exist on slave ---- +[on master] +DELETE FROM t1 WHERE a = 1; +SELECT * FROM t1; +a +[on slave] +---- Wait until slave stops with an error ---- +Last_SQL_Error = Could not execute Delete_rows event on table test.t1; Can't find record in 't1', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log master-bin.000001, end_log_pos 982 (expected "can't find record" error) +SELECT * FROM t1; +a +---- Resolve the conflict on the slave and restart SQL thread ---- +INSERT INTO t1 VALUES (1); +START SLAVE SQL_THREAD; +---- Sync slave and verify that there is no error ---- +Last_SQL_Error = (expected no error) +SELECT * FROM t1; +a +==== Clean up ==== +[on master] +DROP TABLE t1; +[on slave] +######## Run with slave_exec_mode=IDEMPOTENT ######## +set @@global.slave_exec_mode= 'IDEMPOTENT'; +==== Initialize ==== +[on master] +CREATE TABLE t1(a INT PRIMARY KEY); +[on slave] +==== Test: SQL thread sees 'INSERT' of existing key ==== +---- Prepare slave so that it will get duplicate key error ---- +INSERT INTO t1 VALUES (1); +---- Insert rows on master ---- +[on master] +INSERT INTO t1 VALUES (1); +SELECT * FROM t1; +a +1 +[on slave] +---- Sync slave and verify that there is no error ---- +Last_SQL_Error = '' (expected no error) +SELECT * FROM t1; +a +1 +==== Test: SQL thread sees 'DELETE' of non-existing row ==== +---- On master, insert two rows, the second with binlogging off ---- +[on master] +DELETE FROM t1; +INSERT INTO t1 VALUES (1); +[on slave] +DELETE FROM t1 WHERE a = 1; +---- On master, remove the row that does not exist on slave ---- +[on master] +DELETE FROM t1 WHERE a = 1; +SELECT * FROM t1; +a +[on slave] +---- Sync slave and verify that there is no error ---- +Last_SQL_Error = (expected no error) +SELECT * FROM t1; +a +==== Clean up ==== +[on master] +DROP TABLE t1; +[on slave] +SET @@global.slave_exec_mode= @old_slave_exec_mode; diff --git a/mysql-test/suite/rpl/r/rpl_row_create_table.result b/mysql-test/suite/rpl/r/rpl_row_create_table.result index ad659c37b7f..29f58632fde 100644 --- a/mysql-test/suite/rpl/r/rpl_row_create_table.result +++ b/mysql-test/suite/rpl/r/rpl_row_create_table.result @@ -4,34 +4,39 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +**** Resetting master and slave **** +include/stop_slave.inc +RESET SLAVE; +RESET MASTER; +include/start_slave.inc CREATE TABLE t1 (a INT, b INT); CREATE TABLE t2 (a INT, b INT) ENGINE=Merge; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8; -SHOW BINLOG EVENTS FROM 216; +SHOW BINLOG EVENTS FROM 106; Log_name # -Pos 216 +Pos 106 Event_type Query Server_id # -End_log_pos 309 +End_log_pos 199 Info use `test`; CREATE TABLE t1 (a INT, b INT) Log_name # -Pos 309 +Pos 199 Event_type Query Server_id # -End_log_pos 415 +End_log_pos 305 Info use `test`; CREATE TABLE t2 (a INT, b INT) ENGINE=Merge Log_name # -Pos 415 +Pos 305 Event_type Query Server_id # -End_log_pos 521 +End_log_pos 411 Info use `test`; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8 Log_name # -Pos 521 +Pos 411 Event_type Query Server_id # -End_log_pos 640 +End_log_pos 530 Info use `test`; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8 **** On Master **** SHOW CREATE TABLE t1; @@ -125,9 +130,14 @@ NULL 3 6 NULL 4 2 NULL 5 10 NULL 6 12 +**** Resetting master and slave **** +include/stop_slave.inc +RESET SLAVE; +RESET MASTER; +include/start_slave.inc CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3; ERROR 23000: Duplicate entry '2' for key 'b' -SHOW BINLOG EVENTS FROM 1374; +SHOW BINLOG EVENTS FROM 106; Log_name Pos Event_type Server_id End_log_pos Info CREATE TABLE t7 (a INT, b INT UNIQUE); INSERT INTO t7 SELECT a,b FROM tt3; @@ -137,18 +147,23 @@ a b 1 2 2 4 3 6 -SHOW BINLOG EVENTS FROM 1374; +SHOW BINLOG EVENTS FROM 106; Log_name Pos Event_type Server_id End_log_pos Info -# 1374 Query # 1474 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE) -# 1474 Query # 1542 use `test`; BEGIN -# 1542 Table_map # 1584 table_id: # (test.t7) -# 1584 Write_rows # 1640 table_id: # flags: STMT_END_F -# 1640 Query # 1711 use `test`; ROLLBACK +# 106 Query # 206 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE) +# 206 Query # 274 use `test`; BEGIN +# 274 Table_map # 316 table_id: # (test.t7) +# 316 Write_rows # 372 table_id: # flags: STMT_END_F +# 372 Query # 443 use `test`; ROLLBACK SELECT * FROM t7 ORDER BY a,b; a b 1 2 2 4 3 6 +**** Resetting master and slave **** +include/stop_slave.inc +RESET SLAVE; +RESET MASTER; +include/start_slave.inc CREATE TEMPORARY TABLE tt4 (a INT, b INT); INSERT INTO tt4 VALUES (4,8), (5,10), (6,12); BEGIN; @@ -156,12 +171,12 @@ INSERT INTO t7 SELECT a,b FROM tt4; ROLLBACK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back -SHOW BINLOG EVENTS FROM 1711; +SHOW BINLOG EVENTS FROM 106; Log_name Pos Event_type Server_id End_log_pos Info -# 1711 Query # 1779 use `test`; BEGIN -# 1779 Table_map # 1821 table_id: # (test.t7) -# 1821 Write_rows # 1877 table_id: # flags: STMT_END_F -# 1877 Query # 1946 use `test`; COMMIT +# 106 Query # 174 use `test`; BEGIN +# 174 Table_map # 216 table_id: # (test.t7) +# 216 Write_rows # 272 table_id: # flags: STMT_END_F +# 272 Query # 343 use `test`; ROLLBACK SELECT * FROM t7 ORDER BY a,b; a b 1 2 @@ -178,6 +193,11 @@ a b 4 8 5 10 6 12 +**** Resetting master and slave **** +include/stop_slave.inc +RESET SLAVE; +RESET MASTER; +include/start_slave.inc CREATE TABLE t8 LIKE t4; CREATE TABLE t9 LIKE tt4; CREATE TEMPORARY TABLE tt5 LIKE t4; @@ -196,10 +216,10 @@ Create Table CREATE TABLE `t9` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -SHOW BINLOG EVENTS FROM 1946; +SHOW BINLOG EVENTS FROM 106; Log_name Pos Event_type Server_id End_log_pos Info -# 1946 Query # 2032 use `test`; CREATE TABLE t8 LIKE t4 -# 2032 Query # 2171 use `test`; CREATE TABLE `t9` ( +# 106 Query # 192 use `test`; CREATE TABLE t8 LIKE t4 +# 192 Query # 331 use `test`; CREATE TABLE `t9` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) @@ -276,9 +296,8 @@ a 1 2 3 -SHOW BINLOG EVENTS; +SHOW BINLOG EVENTS FROM 106; Log_name Pos Event_type Server_id End_log_pos Info -# 4 Format_desc # 106 Server ver: #, Binlog ver: # # 106 Query # 192 use `test`; CREATE TABLE t1 (a INT) # 192 Query # 260 use `test`; BEGIN # 260 Table_map # 301 table_id: # (test.t1) @@ -308,7 +327,7 @@ Log_name Pos Event_type Server_id End_log_pos Info # 1329 Query # 1397 use `test`; BEGIN # 1397 Table_map # 1438 table_id: # (test.t1) # 1438 Write_rows # 1482 table_id: # flags: STMT_END_F -# 1482 Query # 1551 use `test`; COMMIT +# 1482 Query # 1553 use `test`; ROLLBACK SHOW TABLES; Tables_in_test t1 @@ -371,9 +390,8 @@ a 4 6 9 -SHOW BINLOG EVENTS; +SHOW BINLOG EVENTS FROM 106; Log_name Pos Event_type Server_id End_log_pos Info -# 4 Format_desc # 106 Server ver: #, Binlog ver: # # 106 Query # 192 use `test`; CREATE TABLE t1 (a INT) # 192 Query # 260 use `test`; BEGIN # 260 Table_map # 301 table_id: # (test.t1) @@ -394,6 +412,11 @@ a 6 9 TRUNCATE TABLE t2; +**** Resetting master and slave **** +include/stop_slave.inc +RESET SLAVE; +RESET MASTER; +include/start_slave.inc BEGIN; INSERT INTO t2 SELECT a*a FROM t1; CREATE TEMPORARY TABLE tt2 @@ -406,14 +429,14 @@ Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back SELECT * FROM t2 ORDER BY a; a -SHOW BINLOG EVENTS FROM 949; +SHOW BINLOG EVENTS FROM 106; Log_name Pos Event_type Server_id End_log_pos Info -# 949 Query # 1017 use `test`; BEGIN -# 1017 Table_map # 1058 table_id: # (test.t2) -# 1058 Write_rows # 1102 table_id: # flags: STMT_END_F -# 1102 Table_map # 1143 table_id: # (test.t2) -# 1143 Write_rows # 1182 table_id: # flags: STMT_END_F -# 1182 Query # 1253 use `test`; ROLLBACK +# 106 Query # 174 use `test`; BEGIN +# 174 Table_map # 215 table_id: # (test.t2) +# 215 Write_rows # 259 table_id: # flags: STMT_END_F +# 259 Table_map # 300 table_id: # (test.t2) +# 300 Write_rows # 339 table_id: # flags: STMT_END_F +# 339 Query # 410 use `test`; ROLLBACK SELECT * FROM t2 ORDER BY a; a DROP TABLE t1,t2; @@ -436,11 +459,13 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +DROP DATABASE IF EXISTS mysqltest1; CREATE DATABASE mysqltest1; CREATE TABLE mysqltest1.without_select (f1 BIGINT); CREATE TABLE mysqltest1.with_select AS SELECT 1 AS f1; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # DROP DATABASE IF EXISTS mysqltest1 master-bin.000001 # Query # # CREATE DATABASE mysqltest1 master-bin.000001 # Query # # use `test`; CREATE TABLE mysqltest1.without_select (f1 BIGINT) master-bin.000001 # Query # # use `test`; BEGIN diff --git a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result index 04db52c840b..18a5dbfccc1 100644 --- a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result +++ b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result @@ -30,4 +30,5 @@ flush tables with read lock; start slave; stop slave; ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction +unlock tables; drop table t3, t4, t5; diff --git a/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result b/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result index 1dd97878666..562e3dc2862 100644 --- a/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result +++ b/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result @@ -4,56 +4,18 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -create table t1 (a int not null primary key); -insert into t1 values (1); -create table t2 (a int); -insert into t2 values (1); -update t1, t2 set t1.a = 0 where t1.a = t2.a; -show tables; -Tables_in_test -t1 -select * from t1; -a -0 -drop table t1; -insert into t1 values (1); -SHOW SLAVE STATUS; -Slave_IO_State # -Master_Host 127.0.0.1 -Master_User root -Master_Port MASTER_PORT -Connect_Retry 1 -Master_Log_File master-bin.000001 -Read_Master_Log_Pos 1153 -Relay_Log_File # -Relay_Log_Pos # -Relay_Master_Log_File master-bin.000001 -Slave_IO_Running Yes -Slave_SQL_Running No -Replicate_Do_DB -Replicate_Ignore_DB -Replicate_Do_Table -Replicate_Ignore_Table # -Replicate_Wild_Do_Table -Replicate_Wild_Ignore_Table -Last_Errno 1146 -Last_Error Error 'Table 'test.t1' doesn't exist' on opening tables -Skip_Counter 0 -Exec_Master_Log_Pos 941 -Relay_Log_Space # -Until_Condition None -Until_Log_File -Until_Log_Pos 0 -Master_SSL_Allowed No -Master_SSL_CA_File -Master_SSL_CA_Path -Master_SSL_Cert -Master_SSL_Cipher -Master_SSL_Key -Seconds_Behind_Master # -Master_SSL_Verify_Server_Cert No -Last_IO_Errno # -Last_IO_Error # -Last_SQL_Errno 1146 -Last_SQL_Error Error 'Table 'test.t1' doesn't exist' on opening tables -drop table t1, t2; +==== Setup table on master but not on slave ==== +[on master] +CREATE TABLE t1 (a INT); +[on slave] +DROP TABLE t1; +==== Modify table on master ==== +[on master] +INSERT INTO t1 VALUES (1); +==== Verify error on slave ==== +[on slave] +Last_SQL_Error = Error 'Table 'test.t1' doesn't exist' on opening tables +==== Clean up ==== +include/stop_slave.inc +[on master] +DROP TABLE t1; diff --git a/mysql-test/suite/rpl/r/rpl_row_loaddata_m.result b/mysql-test/suite/rpl/r/rpl_row_loaddata_m.result index 149efddaf8d..198e55c71d0 100644 --- a/mysql-test/suite/rpl/r/rpl_row_loaddata_m.result +++ b/mysql-test/suite/rpl/r/rpl_row_loaddata_m.result @@ -9,7 +9,7 @@ stop slave; create database mysqltest; use mysqltest; create table t1(a int, b int, unique(b)); -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; +load data infile '../../std_data/rpl_loaddata.dat' into table t1; show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # # diff --git a/mysql-test/suite/rpl/r/rpl_row_log.result b/mysql-test/suite/rpl/r/rpl_row_log.result index c0d70bb0cdd..e3b2ad67738 100644 --- a/mysql-test/suite/rpl/r/rpl_row_log.result +++ b/mysql-test/suite/rpl/r/rpl_row_log.result @@ -4,7 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -stop slave; +include/stop_slave.inc reset master; reset slave; start slave; @@ -12,7 +12,7 @@ create table t1(n int not null auto_increment primary key)ENGINE=MyISAM; insert into t1 values (NULL); drop table t1; create table t1 (word char(20) not null)ENGINE=MyISAM; -load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines; +load data infile 'LOAD_FILE' into table t1 ignore 1 lines; select count(*) from t1; count(*) 69 @@ -113,10 +113,6 @@ Aberdeen Abernathy aberrant aberration - -let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ; - ---source include/wait_slave_status.inc select * from t1 order by 1 asc; word Aarhus @@ -189,7 +185,8 @@ Abernathy aberrant aberration flush logs; -stop slave; +include/stop_slave.inc +include/start_slave.inc create table t2 (n int)ENGINE=MyISAM; insert into t2 values (1); show binlog events from <binlog_start>; @@ -219,7 +216,6 @@ show binary logs; Log_name File_size master-bin.000001 1540 master-bin.000002 516 -start slave; show binary logs; Log_name File_size slave-bin.000001 1638 @@ -292,13 +288,23 @@ ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find tar DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; +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 table t1(a int auto_increment primary key, b int); insert into t1 values (NULL, 1); -reset master; set insert_id=5; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id()); show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; create table t1(a int auto_increment primary key, b int) +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F diff --git a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result index 790038799c0..0b27ed72ff8 100644 --- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result @@ -4,7 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -stop slave; +include/stop_slave.inc reset master; reset slave; start slave; @@ -12,7 +12,7 @@ create table t1(n int not null auto_increment primary key)ENGINE=InnoDB; insert into t1 values (NULL); drop table t1; create table t1 (word char(20) not null)ENGINE=InnoDB; -load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines; +load data infile 'LOAD_FILE' into table t1 ignore 1 lines; select count(*) from t1; count(*) 69 @@ -113,10 +113,6 @@ Aberdeen Abernathy aberrant aberration - -let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ; - ---source include/wait_slave_status.inc select * from t1 order by 1 asc; word Aarhus @@ -189,7 +185,8 @@ Abernathy aberrant aberration flush logs; -stop slave; +include/stop_slave.inc +include/start_slave.inc create table t2 (n int)ENGINE=InnoDB; insert into t2 values (1); show binlog events from <binlog_start>; @@ -219,7 +216,6 @@ show binary logs; Log_name File_size master-bin.000001 1456 master-bin.000002 474 -start slave; show binary logs; Log_name File_size slave-bin.000001 1536 @@ -292,13 +288,23 @@ ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find tar DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; +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 table t1(a int auto_increment primary key, b int); insert into t1 values (NULL, 1); -reset master; set insert_id=5; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id()); show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; create table t1(a int auto_increment primary key, b int) +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F diff --git a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result index 392f5904233..2215b34814e 100644 --- a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result +++ b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result @@ -1,5 +1,3 @@ -SET SESSION BINLOG_FORMAT=ROW; -SET GLOBAL BINLOG_FORMAT=ROW; stop slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; reset master; diff --git a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result index 2d9d801047b..2cb316c6a1f 100644 --- a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result +++ b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result @@ -159,7 +159,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -181,7 +181,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -290,7 +290,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -321,7 +321,7 @@ ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/suite/rpl/r/rpl_row_mystery22.result b/mysql-test/suite/rpl/r/rpl_row_mystery22.result deleted file mode 100644 index 5e42a89d741..00000000000 --- a/mysql-test/suite/rpl/r/rpl_row_mystery22.result +++ /dev/null @@ -1,32 +0,0 @@ -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 table t1(n int auto_increment primary key, s char(10)); -set @@global.slave_exec_mode= 'IDEMPOTENT'; -insert into t1 values (2,'old'); -insert into t1 values(NULL,'new'); -insert into t1 values(NULL,'new'); -select * from t1 order by n; -n s -1 new -2 new -delete from t1 where n = 2; -start slave; -stop slave; -create table t2(n int); -drop table t2; -insert into t1 values(NULL,'new'); -set sql_log_bin=0; -insert into t1 values(NULL,'new'); -set sql_log_bin=1; -delete from t1 where n=4; -start slave; -select * from t1 order by n; -n s -1 new -3 new -drop table t1; -set @@global.slave_exec_mode= default; diff --git a/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result b/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result index 0fd4ff86893..1934b01505c 100644 --- a/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result +++ b/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result @@ -5,7 +5,7 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; create table t1 (words varchar(20)) engine=myisam; -load data infile '../std_data_ln/words.dat' into table t1 (words); +load data infile '../../std_data/words.dat' into table t1 (words); select count(*) from t1; count(*) 70 @@ -13,4 +13,5 @@ select count(*) from t1; count(*) 70 drop table t1; +include/stop_slave.inc drop table t1; diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result index e81d4f7454e..a6a2181cd2a 100644 --- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result +++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result @@ -140,7 +140,7 @@ Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 +Last_IO_Errno <Last_IO_Errno> Last_IO_Error <Last_IO_Error> Last_SQL_Errno 1364 Last_SQL_Error <Last_SQL_Error> @@ -191,7 +191,7 @@ Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 +Last_IO_Errno <Last_IO_Errno> Last_IO_Error <Last_IO_Error> Last_SQL_Errno 0 Last_SQL_Error <Last_SQL_Error> @@ -232,7 +232,7 @@ Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 +Last_IO_Errno <Last_IO_Errno> Last_IO_Error <Last_IO_Error> Last_SQL_Errno 1535 Last_SQL_Error <Last_SQL_Error> @@ -275,7 +275,7 @@ Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 +Last_IO_Errno <Last_IO_Errno> Last_IO_Error <Last_IO_Error> Last_SQL_Errno 1535 Last_SQL_Error <Last_SQL_Error> @@ -318,7 +318,7 @@ Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 +Last_IO_Errno <Last_IO_Errno> Last_IO_Error <Last_IO_Error> Last_SQL_Errno 1535 Last_SQL_Error <Last_SQL_Error> @@ -360,7 +360,7 @@ Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 +Last_IO_Errno <Last_IO_Errno> Last_IO_Error <Last_IO_Error> Last_SQL_Errno 0 Last_SQL_Error <Last_SQL_Error> diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result index a6834be5a86..02e8c074354 100644 --- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result @@ -140,7 +140,7 @@ Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 +Last_IO_Errno <Last_IO_Errno> Last_IO_Error <Last_IO_Error> Last_SQL_Errno 1364 Last_SQL_Error <Last_SQL_Error> @@ -191,7 +191,7 @@ Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 +Last_IO_Errno <Last_IO_Errno> Last_IO_Error <Last_IO_Error> Last_SQL_Errno 0 Last_SQL_Error <Last_SQL_Error> @@ -232,7 +232,7 @@ Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 +Last_IO_Errno <Last_IO_Errno> Last_IO_Error <Last_IO_Error> Last_SQL_Errno 1535 Last_SQL_Error <Last_SQL_Error> @@ -275,7 +275,7 @@ Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 +Last_IO_Errno <Last_IO_Errno> Last_IO_Error <Last_IO_Error> Last_SQL_Errno 1535 Last_SQL_Error <Last_SQL_Error> @@ -318,7 +318,7 @@ Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 +Last_IO_Errno <Last_IO_Errno> Last_IO_Error <Last_IO_Error> Last_SQL_Errno 1535 Last_SQL_Error <Last_SQL_Error> @@ -360,7 +360,7 @@ Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 +Last_IO_Errno <Last_IO_Errno> Last_IO_Error <Last_IO_Error> Last_SQL_Errno 0 Last_SQL_Error <Last_SQL_Error> diff --git a/mysql-test/suite/rpl/r/rpl_row_until.result b/mysql-test/suite/rpl/r/rpl_row_until.result index f544ef95702..be1ec51f74a 100644 --- a/mysql-test/suite/rpl/r/rpl_row_until.result +++ b/mysql-test/suite/rpl/r/rpl_row_until.result @@ -4,7 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -stop slave; +include/stop_slave.inc create table t1(n int not null auto_increment primary key); insert into t1 values (1),(2),(3),(4); drop table t1; @@ -149,8 +149,8 @@ Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error start slave; -stop slave; -start slave until master_log_file='master-bin.000001', master_log_pos=740; +include/stop_slave.inc +start slave sql_thread until master_log_file='master-bin.000001', master_log_pos=740; SHOW SLAVE STATUS; Slave_IO_State # Master_Host 127.0.0.1 @@ -162,7 +162,7 @@ Read_Master_Log_Pos 1161 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 -Slave_IO_Running Yes +Slave_IO_Running No Slave_SQL_Running No Replicate_Do_DB Replicate_Ignore_DB @@ -200,7 +200,7 @@ start slave until relay_log_file='slave-relay-bin.000002'; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL -start slave sql_thread; +start slave; start slave until master_log_file='master-bin.000001', master_log_pos=740; Warnings: Note 1254 Slave is already running diff --git a/mysql-test/suite/rpl/r/rpl_server_id1.result b/mysql-test/suite/rpl/r/rpl_server_id1.result index 724f0071e07..76f187e3b01 100644 --- a/mysql-test/suite/rpl/r/rpl_server_id1.result +++ b/mysql-test/suite/rpl/r/rpl_server_id1.result @@ -5,7 +5,7 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; reset master; -stop slave; +include/stop_slave.inc change master to master_port=SLAVE_PORT; start slave; *** must be having the replicate-same-server-id IO thread error *** diff --git a/mysql-test/suite/rpl/r/rpl_server_id2.result b/mysql-test/suite/rpl/r/rpl_server_id2.result index f68f9ff829d..bb5a175fbfe 100644 --- a/mysql-test/suite/rpl/r/rpl_server_id2.result +++ b/mysql-test/suite/rpl/r/rpl_server_id2.result @@ -8,45 +8,6 @@ create table t1 (n int); reset master; stop slave; change master to master_port=SLAVE_PORT; -show slave status; -Slave_IO_State -Master_Host 127.0.0.1 -Master_User root -Master_Port SLAVE_PORT -Connect_Retry 1 -Master_Log_File -Read_Master_Log_Pos 4 -Relay_Log_File slave-relay-bin.000001 -Relay_Log_Pos 4 -Relay_Master_Log_File -Slave_IO_Running No -Slave_SQL_Running No -Replicate_Do_DB -Replicate_Ignore_DB -Replicate_Do_Table -Replicate_Ignore_Table -Replicate_Wild_Do_Table -Replicate_Wild_Ignore_Table # -Last_Errno 0 -Last_Error -Skip_Counter 0 -Exec_Master_Log_Pos 0 -Relay_Log_Space 106 -Until_Condition None -Until_Log_File -Until_Log_Pos 0 -Master_SSL_Allowed No -Master_SSL_CA_File -Master_SSL_CA_Path -Master_SSL_Cert -Master_SSL_Cipher -Master_SSL_Key -Seconds_Behind_Master NULL -Master_SSL_Verify_Server_Cert No -Last_IO_Errno # -Last_IO_Error # -Last_SQL_Errno 0 -Last_SQL_Error start slave; insert into t1 values (1); select * from t1; @@ -55,3 +16,15 @@ n 1 stop slave; drop table t1; +reset master; +create table t1(n int); +create table t2(n int); +change master to master_port=MASTER_PORT; +start slave until master_log_file='master-bin.000001', master_log_pos=UNTIL_POS; +*** checking until postion execution: must be only t1 in the list *** +show tables; +Tables_in_test +t1 +start slave sql_thread; +drop table t1; +drop table t2; diff --git a/mysql-test/suite/rpl/r/rpl_slave_grp_exec.result b/mysql-test/suite/rpl/r/rpl_slave_grp_exec.result new file mode 100644 index 00000000000..eb3c4ef5978 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_slave_grp_exec.result @@ -0,0 +1,123 @@ +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; + +*** Preparing data *** +CREATE TABLE t1 (a INT NOT NULL, b VARCHAR(10)) ENGINE=MyISAM; +CREATE TABLE t2 LIKE t1; +CREATE TABLE t3 LIKE t1; +CREATE TRIGGER tr1 BEFORE UPDATE ON t1 +FOR EACH ROW BEGIN +UPDATE t2 SET b='YY' WHERE a=NEW.a; +END| +CREATE TRIGGER tr2 AFTER UPDATE ON t1 +FOR EACH ROW BEGIN +UPDATE t3 SET b='ZZ' WHERE a=NEW.a; +END| + +*** Test non-transactional group w/o PK *** +INSERT INTO t3 VALUES(1, 'AA'); +INSERT INTO t2 VALUES(1, 'AA'); +INSERT INTO t1 VALUES(1, 'AA'); +RENAME TABLE t3 TO t3_bak; +UPDATE t1 SET b = 'XX' WHERE a = 1; +SELECT * FROM t1 ORDER BY a; +a b +1 XX +SELECT * FROM t2 ORDER BY a; +a b +1 YY +SELECT * FROM t3 ORDER BY a; +a b +1 ZZ +SHOW TABLES LIKE 't%'; +Tables_in_test (t%) +t1 +t2 +t3_bak +SELECT * FROM t1 ORDER BY a; +a b +1 AA_for_row_or_XX_for_stmt_mixed +SELECT * FROM t2 ORDER BY a; +a b +1 AA_for_row_or_YY_for_stmt_mixed +include/stop_slave.inc +RENAME TABLE t3_bak TO t3; +include/start_slave.inc +TRUNCATE t1; +TRUNCATE t2; +TRUNCATE t3; + +*** Test non-transactional group w/ PK *** +ALTER TABLE t1 ADD PRIMARY KEY (a); +ALTER TABLE t2 ADD PRIMARY KEY (a); +ALTER TABLE t3 ADD PRIMARY KEY (a); +RENAME TABLE t3 TO t3_bak; +INSERT INTO t3 VALUES(2, 'B'); +INSERT INTO t2 VALUES(2, 'B'); +INSERT INTO t1 VALUES(2, 'B'); +UPDATE t1 SET b = 'X' WHERE a = 2; +SELECT * FROM t1 ORDER BY a; +a b +2 X +SELECT * FROM t2 ORDER BY a; +a b +2 YY +SELECT * FROM t3 ORDER BY a; +a b +2 ZZ +SHOW TABLES LIKE 't%'; +Tables_in_test (t%) +t1 +t2 +t3_bak +SELECT * FROM t1 ORDER BY a; +a b +SELECT * FROM t2 ORDER BY a; +a b +include/stop_slave.inc +RENAME TABLE t3_bak TO t3; +include/start_slave.inc +TRUNCATE t1; +TRUNCATE t2; +TRUNCATE t3; + +*** Test transactional group w/ PK *** +ALTER TABLE t1 ENGINE=InnoDB; +ALTER TABLE t2 ENGINE=InnoDB; +ALTER TABLE t3 ENGINE=InnoDB; +RENAME TABLE t3 TO t3_bak; +BEGIN; +INSERT INTO t1 VALUES (3, 'C'), (4, 'D'); +INSERT INTO t2 VALUES (3, 'C'), (4, 'D'); +INSERT INTO t3 VALUES (3, 'C'), (4, 'D'); +COMMIT; +SELECT * FROM t1 ORDER BY a; +a b +3 C +4 D +SELECT * FROM t2 ORDER BY a; +a b +3 C +4 D +SELECT * FROM t3 ORDER BY a; +a b +3 C +4 D +SHOW TABLES LIKE 't%'; +Tables_in_test (t%) +t1 +t2 +t3_bak +SELECT * FROM t1 ORDER BY a; +a b +SELECT * FROM t2 ORDER BY a; +a b +include/stop_slave.inc +RENAME TABLE t3_bak TO t3; +include/start_slave.inc +*** Clean up *** +DROP TABLE t1,t2,t3; diff --git a/mysql-test/suite/rpl/r/rpl_slave_skip.result b/mysql-test/suite/rpl/r/rpl_slave_skip.result index bb03c3b6cca..747e8f235a8 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_skip.result +++ b/mysql-test/suite/rpl/r/rpl_slave_skip.result @@ -166,7 +166,7 @@ BEGIN UPDATE t3 SET a =2, b = 'master only'; END| **** On Slave **** -STOP SLAVE; +include/stop_slave.inc **** On Master **** UPDATE t1 SET a = 2, b = 'master only' WHERE a = 1; DROP TRIGGER tr1; @@ -174,6 +174,7 @@ DROP TRIGGER tr2; INSERT INTO t1 VALUES (3,'master/slave'); INSERT INTO t2 VALUES (3,'master/slave'); INSERT INTO t3 VALUES (3,'master/slave'); +COMMIT; SELECT * FROM t1 ORDER BY a; a b 2 master only @@ -188,7 +189,7 @@ a b 3 master/slave *** On Slave *** SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -START SLAVE; +include/start_slave.inc SELECT * FROM t1 ORDER BY a; a b 1 master/slave @@ -208,7 +209,7 @@ CREATE TABLE t4 (a INT, b VARCHAR(20)) ENGINE=innodb; CREATE TABLE t5 (a INT, b VARCHAR(20)) ENGINE=innodb; CREATE TABLE t6 (a INT, b VARCHAR(20)) ENGINE=innodb; **** On Slave **** -STOP SLAVE; +include/stop_slave.inc *** On Master *** BEGIN; INSERT INTO t4 VALUES (2, 'master only'); @@ -234,7 +235,7 @@ a b 3 master/slave *** On Slave *** SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -START SLAVE; +include/start_slave.inc SELECT * FROM t4 ORDER BY a; a b 3 master/slave @@ -245,7 +246,7 @@ SELECT * FROM t6 ORDER BY a; a b 3 master/slave **** On Slave **** -STOP SLAVE; +include/stop_slave.inc *** On Master *** BEGIN; INSERT INTO t4 VALUES (6, 'master only'); @@ -277,7 +278,7 @@ a b 7 master only *** On Slave *** SET GLOBAL SQL_SLAVE_SKIP_COUNTER=10; -START SLAVE; +include/start_slave.inc SELECT * FROM t4 ORDER BY a; a b 3 master/slave @@ -287,7 +288,7 @@ a b SELECT * FROM t6 ORDER BY a; a b 3 master/slave -STOP SLAVE; +include/stop_slave.inc SET AUTOCOMMIT=0; INSERT INTO t4 VALUES (4, 'master only'); INSERT INTO t5 VALUES (4, 'master only'); @@ -323,7 +324,7 @@ a b 7 master only *** On Slave *** SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -START SLAVE; +include/start_slave.inc SELECT * FROM t4 ORDER BY a; a b 3 master/slave @@ -341,10 +342,10 @@ DROP TABLE t4, t5, t6; *** On Master *** CREATE TABLE t10 (a INT, b VARCHAR(20)) ENGINE=myisam; *** On Slave *** -STOP SLAVE; +include/stop_slave.inc *** On Master *** SET SESSION BINLOG_FORMAT=STATEMENT; -LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/rpl_bug28618.dat' INTO TABLE t10 FIELDS TERMINATED BY '|'; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/rpl_bug28618.dat' INTO TABLE t10 FIELDS TERMINATED BY '|'; SELECT * FROM t10 ORDER BY a; a b 1 master only @@ -352,7 +353,7 @@ a b 3 master only *** On Slave *** SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -START SLAVE; +include/start_slave.inc SELECT * FROM t10 ORDER BY a; a b DROP TABLE t10; diff --git a/mysql-test/suite/rpl/r/rpl_slave_status.result b/mysql-test/suite/rpl/r/rpl_slave_status.result index b435af499df..a98a81dc74f 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_status.result +++ b/mysql-test/suite/rpl/r/rpl_slave_status.result @@ -6,31 +6,30 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; ==== Create new replication user ==== [on master] -grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl'; +GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY 'rpl'; [on slave] -stop slave; -change master to master_user='rpl',master_password='rpl'; -start slave; +include/stop_slave.inc +CHANGE MASTER TO master_user='rpl', master_password='rpl'; +include/start_slave.inc ==== Do replication as new user ==== [on master] -create table t1 (n int); -insert into t1 values (1); +CREATE TABLE t1 (n INT); +INSERT INTO t1 VALUES (1); [on slave] -select * from t1; +SELECT * FROM t1; n 1 ==== Delete new replication user ==== [on master] -drop user rpl@127.0.0.1; -flush privileges; +DROP USER rpl@127.0.0.1; +FLUSH PRIVILEGES; [on slave] ==== Restart slave without privileges ===== -stop slave; -start slave; +include/stop_slave.inc +START SLAVE; ==== Verify that Slave_IO_Running = No ==== Slave_IO_Running = No (should be No) ==== Cleanup (Note that slave IO thread is not running) ==== -drop table t1; -delete from mysql.user where user='rpl'; +DROP TABLE t1; [on master] -drop table t1; +DROP TABLE t1; diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result index 3ca4f86cf64..4a8a4050c02 100644 --- a/mysql-test/suite/rpl/r/rpl_sp.result +++ b/mysql-test/suite/rpl/r/rpl_sp.result @@ -191,11 +191,15 @@ begin return unix_timestamp(); end| ERROR HY000: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) +set @old_log_bin_trust_routine_creators= @@global.log_bin_trust_routine_creators; +set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; set global log_bin_trust_routine_creators=1; Warnings: Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use '@@log_bin_trust_function_creators' instead set global log_bin_trust_function_creators=0; set global log_bin_trust_function_creators=1; +set @old_log_bin_trust_routine_creators= @@global.log_bin_trust_routine_creators; +set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; set global log_bin_trust_function_creators=1; create function fn2() returns int @@ -549,8 +553,14 @@ insert into t values (1); return 0; end master-bin.000001 # Query 1 # use `mysqltest`; SELECT `mysqltest2`.`f1`() -set global log_bin_trust_function_creators=0; -set global log_bin_trust_function_creators=0; +set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators; +Warnings: +Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use '@@log_bin_trust_function_creators' instead +set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; +set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators; +Warnings: +Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use '@@log_bin_trust_function_creators' instead +set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; drop database mysqltest; drop database mysqltest2; use test; @@ -605,7 +615,7 @@ DELIMITER /*!*/; ROLLBACK/*!*/; SET TIMESTAMP=t/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/suite/rpl/r/rpl_sp_effects.result b/mysql-test/suite/rpl/r/rpl_sp_effects.result index a39d189aa3a..d9cdfd81167 100644 --- a/mysql-test/suite/rpl/r/rpl_sp_effects.result +++ b/mysql-test/suite/rpl/r/rpl_sp_effects.result @@ -4,6 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; drop procedure if exists p1; drop procedure if exists p2; drop function if exists f1; @@ -275,5 +276,5 @@ E drop table t2; drop procedure sp_bug26199; drop function sf_bug26199; -SET GLOBAL log_bin_trust_function_creators = 0; +SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; end of the tests diff --git a/mysql-test/suite/rpl/r/rpl_stm_000001.result b/mysql-test/suite/rpl/r/rpl_stm_000001.result index 3b4cd05f640..24e454eb876 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_000001.result +++ b/mysql-test/suite/rpl/r/rpl_stm_000001.result @@ -5,7 +5,7 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; create table t1 (word char(20) not null); -load data infile '../std_data_ln/words.dat' into table t1; +load data infile '../../std_data/words.dat' into table t1; load data local infile 'MYSQL_TEST_DIR/std_data/words.dat' into table t1; select * from t1 limit 10; word diff --git a/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result b/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result index 13aa45d8ced..e69952787fb 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result +++ b/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result @@ -11,3 +11,6 @@ set sql_log_bin=1; insert into t1 values(1),(2); ERROR 23000: Duplicate entry '2' for key 'a' drop table t1; +Error: "Query caused different errors on master and slave. Error on master: 'Duplicate entry '%-.192s' for key %d' (1062), Error on slave: 'no error' (0). Default database: 'test'. Query: 'insert into t1 values(1),(2)'" (expected different error codes on master and slave) +Errno: "0" (expected 0) +drop table t1; diff --git a/mysql-test/suite/rpl/r/rpl_stm_conflicts.result b/mysql-test/suite/rpl/r/rpl_stm_conflicts.result new file mode 100644 index 00000000000..b0df9516b7c --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_stm_conflicts.result @@ -0,0 +1,54 @@ +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; +==== Initialize ==== +[on master] +CREATE TABLE t1(a INT PRIMARY KEY); +[on slave] +==== Test: SQL thread sees 'INSERT' of existing key ==== +---- Prepare slave so that it will get duplicate key error ---- +INSERT INTO t1 VALUES (1); +---- Insert rows on master ---- +[on master] +INSERT INTO t1 VALUES (1); +SELECT * FROM t1; +a +1 +[on slave] +---- Wait until slave stops with an error ---- +Last_SQL_Error = Error 'Duplicate entry '1' for key 'PRIMARY'' on query. Default database: 'test'. Query: 'INSERT INTO t1 VALUES (1)' (expected "duplicate key" error) +SELECT * FROM t1; +a +1 +---- Resolve the conflict on the slave and restart SQL thread ---- +DELETE FROM t1 WHERE a = 1; +START SLAVE SQL_THREAD; +---- Sync slave and verify that there is no error ---- +Last_SQL_Error = '' (expected no error) +SELECT * FROM t1; +a +1 +==== Test: SQL thread sees 'DELETE' of non-existing row ==== +---- On master, insert two rows, the second with binlogging off ---- +[on master] +DELETE FROM t1; +INSERT INTO t1 VALUES (1); +[on slave] +DELETE FROM t1 WHERE a = 1; +---- On master, remove the row that does not exist on slave ---- +[on master] +DELETE FROM t1 WHERE a = 1; +SELECT * FROM t1; +a +[on slave] +---- Sync slave and verify that there is no error ---- +Last_SQL_Error = (expected no error) +SELECT * FROM t1; +a +==== Clean up ==== +[on master] +DROP TABLE t1; +[on slave] diff --git a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result index bc14c443f48..ea2a9ce9a79 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result +++ b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result @@ -30,4 +30,5 @@ flush tables with read lock; start slave; stop slave; ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction +unlock tables; drop table t3, t4, t5; diff --git a/mysql-test/suite/rpl/r/rpl_stm_log.result b/mysql-test/suite/rpl/r/rpl_stm_log.result index 20f8e04afe7..154050e8557 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_log.result +++ b/mysql-test/suite/rpl/r/rpl_stm_log.result @@ -4,7 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -stop slave; +include/stop_slave.inc reset master; reset slave; start slave; @@ -12,7 +12,7 @@ create table t1(n int not null auto_increment primary key)ENGINE=MyISAM; insert into t1 values (NULL); drop table t1; create table t1 (word char(20) not null)ENGINE=MyISAM; -load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines; +load data infile 'LOAD_FILE' into table t1 ignore 1 lines; select count(*) from t1; count(*) 69 @@ -25,7 +25,7 @@ master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL) master-bin.000001 # Query 1 # use `test`; drop table t1 master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581 -master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1 +master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../../std_data/words.dat' into table t1 ignore 1 lines ;file_id=1 show binlog events from 106 limit 1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM @@ -109,10 +109,6 @@ Aberdeen Abernathy aberrant aberration - -let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ; - ---source include/wait_slave_status.inc select * from t1 order by 1 asc; word Aarhus @@ -185,7 +181,8 @@ Abernathy aberrant aberration flush logs; -stop slave; +include/stop_slave.inc +include/start_slave.inc create table t2 (n int)ENGINE=MyISAM; insert into t2 values (1); show binlog events from <binlog_start>; @@ -196,7 +193,7 @@ master-bin.000001 # Query # # use `test`; insert into t1 values (NULL) master-bin.000001 # Query # # use `test`; drop table t1 master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=# -master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=# +master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/words.dat' into table t1 ignore 1 lines ;file_id=# master-bin.000001 # Rotate # # master-bin.000002;pos=4 show binlog events in 'master-bin.000002'; Log_name Pos Event_type Server_id End_log_pos Info @@ -208,10 +205,9 @@ show binary logs; Log_name File_size master-bin.000001 1347 master-bin.000002 392 -start slave; show binary logs; Log_name File_size -slave-bin.000001 1447 +slave-bin.000001 1450 slave-bin.000002 293 show binlog events in 'slave-bin.000001' from 4; Log_name Pos Event_type Server_id End_log_pos Info @@ -222,7 +218,7 @@ slave-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL) slave-bin.000001 # Query 1 # use `test`; drop table t1 slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM slave-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581 -slave-bin.000001 # Execute_load_query 1 # use `test`; load data INFILE '../tmp/SQL_LOAD-2-1-1.data' INTO table t1 ignore 1 lines ;file_id=1 +slave-bin.000001 # Execute_load_query 1 # use `test`; load data INFILE '../../tmp/SQL_LOAD-2-1-1.data' INTO table t1 ignore 1 lines ;file_id=1 slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4 show binlog events in 'slave-bin.000002' from 4; @@ -274,13 +270,21 @@ ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find tar DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; +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 table t1(a int auto_increment primary key, b int); insert into t1 values (NULL, 1); -reset master; set insert_id=5; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id()); show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; create table t1(a int auto_increment primary key, b int) +master-bin.000001 # Intvar # # INSERT_ID=1 +master-bin.000001 # Query # # use `test`; insert into t1 values (NULL, 1) master-bin.000001 # Intvar # # LAST_INSERT_ID=1 master-bin.000001 # Intvar # # INSERT_ID=5 master-bin.000001 # Query # # use `test`; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id()) diff --git a/mysql-test/suite/rpl/r/rpl_stm_mystery22.result b/mysql-test/suite/rpl/r/rpl_stm_mystery22.result deleted file mode 100644 index ea34b308ec2..00000000000 --- a/mysql-test/suite/rpl/r/rpl_stm_mystery22.result +++ /dev/null @@ -1,31 +0,0 @@ -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 table t1(n int auto_increment primary key, s char(10)); -insert into t1 values (2,'old'); -insert into t1 values(NULL,'new'); -insert into t1 values(NULL,'new'); -select * from t1 order by n; -n s -1 new -2 old -delete from t1 where n = 2; -start slave; -stop slave; -create table t2(n int); -drop table t2; -insert into t1 values(NULL,'new'); -set sql_log_bin=0; -insert into t1 values(NULL,'new'); -set sql_log_bin=1; -delete from t1 where n=4; -start slave; -select * from t1 order by n; -n s -1 new -2 new -3 new -drop table t1; diff --git a/mysql-test/suite/rpl/r/rpl_stm_until.result b/mysql-test/suite/rpl/r/rpl_stm_until.result index 619115aa534..55074f0be0d 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_until.result +++ b/mysql-test/suite/rpl/r/rpl_stm_until.result @@ -4,7 +4,10 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -stop slave; +[on slave] +include/stop_slave.inc +==== Create some events on master ==== +[on master] create table t1(n int not null auto_increment primary key); insert into t1 values (1),(2),(3),(4); drop table t1; @@ -12,6 +15,8 @@ create table t2(n int not null auto_increment primary key); insert into t2 values (1),(2); insert into t2 values (3),(4); drop table t2; +==== Replicate one event at a time on slave ==== +[on slave] start slave until master_log_file='master-bin.000001', master_log_pos=323; select * from t1; n @@ -149,7 +154,9 @@ Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error start slave; -stop slave; +[on master] +[on slave] +include/stop_slave.inc start slave until master_log_file='master-bin.000001', master_log_pos=776; SHOW SLAVE STATUS; Slave_IO_State # @@ -190,6 +197,7 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +==== Test various error conditions ==== start slave until master_log_file='master-bin', master_log_pos=561; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12; diff --git a/mysql-test/suite/rpl/r/rpl_temporary.result b/mysql-test/suite/rpl/r/rpl_temporary.result index d8fea78ecb4..568d5368adb 100644 --- a/mysql-test/suite/rpl/r/rpl_temporary.result +++ b/mysql-test/suite/rpl/r/rpl_temporary.result @@ -4,6 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +call mtr.add_suppression("Slave: Can\'t find record in \'user\' Error_code: 1032"); reset master; SET @save_select_limit=@@session.sql_select_limit; SET @@session.sql_select_limit=10, @@session.pseudo_thread_id=100; diff --git a/mysql-test/suite/rpl/r/rpl_temporary_errors.result b/mysql-test/suite/rpl/r/rpl_temporary_errors.result index 430e63c5859..d14380a6369 100644 --- a/mysql-test/suite/rpl/r/rpl_temporary_errors.result +++ b/mysql-test/suite/rpl/r/rpl_temporary_errors.result @@ -4,6 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +call mtr.add_suppression("Deadlock found"); **** On Master **** SET SESSION BINLOG_FORMAT=ROW; CREATE TABLE t1 (a INT PRIMARY KEY, b INT); diff --git a/mysql-test/suite/rpl/r/rpl_timezone.result b/mysql-test/suite/rpl/r/rpl_timezone.result index cd71dbe628e..927756dd530 100644 --- a/mysql-test/suite/rpl/r/rpl_timezone.result +++ b/mysql-test/suite/rpl/r/rpl_timezone.result @@ -42,7 +42,7 @@ t n 2004-06-11 09:39:02 6 delete from t1; set time_zone='UTC'; -load data infile '../std_data_ln/rpl_timezone2.dat' into table t1; +load data infile '../../std_data/rpl_timezone2.dat' into table t1; Warnings: Warning 1265 Data truncated for column 't' at row 1 Warning 1261 Row 1 doesn't contain data for all columns diff --git a/mysql-test/suite/rpl/r/rpl_trigger.result b/mysql-test/suite/rpl/r/rpl_trigger.result index 68c82ed037f..b68af8f4afe 100644 --- a/mysql-test/suite/rpl/r/rpl_trigger.result +++ b/mysql-test/suite/rpl/r/rpl_trigger.result @@ -975,3 +975,22 @@ a b 2 b 3 c drop table t1; +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 table t1 ( f int ) engine = innodb; +create table log ( r int ) engine = myisam; +create trigger tr +after insert on t1 +for each row insert into log values ( new.f ); +set autocommit = 0; +insert into t1 values ( 1 ); +rollback; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +Comparing tables master:test.t1 and slave:test.t1 +Comparing tables master:test.log and slave:test.log +drop table t1, log; diff --git a/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result b/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result index 1ae98706975..92e13064856 100644 --- a/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result +++ b/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result @@ -10,6 +10,8 @@ DROP TABLE IF EXISTS t1; RESET SLAVE; START SLAVE; **** On Master **** +SET @old_session_binlog_format= @@session.binlog_format; +SET @old_global_binlog_format= @@global.binlog_format; SET SESSION BINLOG_FORMAT=STATEMENT; SET GLOBAL BINLOG_FORMAT=STATEMENT; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM; @@ -42,12 +44,16 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2) master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 master-bin.000001 # Query # # use `test`; DROP TABLE t1 RESET MASTER; +SET @@session.binlog_format= @old_session_binlog_format; +SET @@global.binlog_format= @old_global_binlog_format; STOP SLAVE; DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1; RESET SLAVE; START SLAVE; **** On Master **** +SET @old_session_binlog_format= @@session.binlog_format; +SET @old_global_binlog_format= @@global.binlog_format; SET SESSION BINLOG_FORMAT=MIXED; SET GLOBAL BINLOG_FORMAT=MIXED; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM; @@ -80,12 +86,16 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2) master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 master-bin.000001 # Query # # use `test`; DROP TABLE t1 RESET MASTER; +SET @@session.binlog_format= @old_session_binlog_format; +SET @@global.binlog_format= @old_global_binlog_format; STOP SLAVE; DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1; RESET SLAVE; START SLAVE; **** On Master **** +SET @old_session_binlog_format= @@session.binlog_format; +SET @old_global_binlog_format= @@global.binlog_format; SET SESSION BINLOG_FORMAT=ROW; SET GLOBAL BINLOG_FORMAT=ROW; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM; @@ -121,12 +131,16 @@ master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 master-bin.000001 # Query # # use `test`; DROP TABLE t1 RESET MASTER; +SET @@session.binlog_format= @old_session_binlog_format; +SET @@global.binlog_format= @old_global_binlog_format; STOP SLAVE; DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1; RESET SLAVE; START SLAVE; **** On Master **** +SET @old_session_binlog_format= @@session.binlog_format; +SET @old_global_binlog_format= @@global.binlog_format; SET SESSION BINLOG_FORMAT=STATEMENT; SET GLOBAL BINLOG_FORMAT=STATEMENT; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM; @@ -159,12 +173,16 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2) master-bin.000001 # Query # # use `test`; DELETE FROM t1 master-bin.000001 # Query # # use `test`; DROP TABLE t1 RESET MASTER; +SET @@session.binlog_format= @old_session_binlog_format; +SET @@global.binlog_format= @old_global_binlog_format; STOP SLAVE; DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1; RESET SLAVE; START SLAVE; **** On Master **** +SET @old_session_binlog_format= @@session.binlog_format; +SET @old_global_binlog_format= @@global.binlog_format; SET SESSION BINLOG_FORMAT=MIXED; SET GLOBAL BINLOG_FORMAT=MIXED; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM; @@ -197,12 +215,16 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2) master-bin.000001 # Query # # use `test`; DELETE FROM t1 master-bin.000001 # Query # # use `test`; DROP TABLE t1 RESET MASTER; +SET @@session.binlog_format= @old_session_binlog_format; +SET @@global.binlog_format= @old_global_binlog_format; STOP SLAVE; DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1; RESET SLAVE; START SLAVE; **** On Master **** +SET @old_session_binlog_format= @@session.binlog_format; +SET @old_global_binlog_format= @@global.binlog_format; SET SESSION BINLOG_FORMAT=ROW; SET GLOBAL BINLOG_FORMAT=ROW; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM; @@ -242,3 +264,5 @@ master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE t1 RESET MASTER; +SET @@session.binlog_format= @old_session_binlog_format; +SET @@global.binlog_format= @old_global_binlog_format; diff --git a/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result b/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result index 728b8450314..94461c33c46 100644 --- a/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result +++ b/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result @@ -10,6 +10,8 @@ DROP TABLE IF EXISTS t1; RESET SLAVE; START SLAVE; **** On Master **** +SET @old_session_binlog_format= @@session.binlog_format; +SET @old_global_binlog_format= @@global.binlog_format; SET SESSION BINLOG_FORMAT=STATEMENT; SET GLOBAL BINLOG_FORMAT=STATEMENT; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB; @@ -46,12 +48,16 @@ master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Query # # use `test`; DROP TABLE t1 RESET MASTER; +SET @@session.binlog_format= @old_session_binlog_format; +SET @@global.binlog_format= @old_global_binlog_format; STOP SLAVE; DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1; RESET SLAVE; START SLAVE; **** On Master **** +SET @old_session_binlog_format= @@session.binlog_format; +SET @old_global_binlog_format= @@global.binlog_format; SET SESSION BINLOG_FORMAT=MIXED; SET GLOBAL BINLOG_FORMAT=MIXED; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB; @@ -88,12 +94,16 @@ master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Query # # use `test`; DROP TABLE t1 RESET MASTER; +SET @@session.binlog_format= @old_session_binlog_format; +SET @@global.binlog_format= @old_global_binlog_format; STOP SLAVE; DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1; RESET SLAVE; START SLAVE; **** On Master **** +SET @old_session_binlog_format= @@session.binlog_format; +SET @old_global_binlog_format= @@global.binlog_format; SET SESSION BINLOG_FORMAT=ROW; SET GLOBAL BINLOG_FORMAT=ROW; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB; @@ -131,12 +141,16 @@ master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Query # # use `test`; DROP TABLE t1 RESET MASTER; +SET @@session.binlog_format= @old_session_binlog_format; +SET @@global.binlog_format= @old_global_binlog_format; STOP SLAVE; DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1; RESET SLAVE; START SLAVE; **** On Master **** +SET @old_session_binlog_format= @@session.binlog_format; +SET @old_global_binlog_format= @@global.binlog_format; SET SESSION BINLOG_FORMAT=STATEMENT; SET GLOBAL BINLOG_FORMAT=STATEMENT; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB; @@ -173,12 +187,16 @@ master-bin.000001 # Query # # use `test`; DELETE FROM t1 master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Query # # use `test`; DROP TABLE t1 RESET MASTER; +SET @@session.binlog_format= @old_session_binlog_format; +SET @@global.binlog_format= @old_global_binlog_format; STOP SLAVE; DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1; RESET SLAVE; START SLAVE; **** On Master **** +SET @old_session_binlog_format= @@session.binlog_format; +SET @old_global_binlog_format= @@global.binlog_format; SET SESSION BINLOG_FORMAT=MIXED; SET GLOBAL BINLOG_FORMAT=MIXED; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB; @@ -215,12 +233,16 @@ master-bin.000001 # Query # # use `test`; DELETE FROM t1 master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Query # # use `test`; DROP TABLE t1 RESET MASTER; +SET @@session.binlog_format= @old_session_binlog_format; +SET @@global.binlog_format= @old_global_binlog_format; STOP SLAVE; DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1; RESET SLAVE; START SLAVE; **** On Master **** +SET @old_session_binlog_format= @@session.binlog_format; +SET @old_global_binlog_format= @@global.binlog_format; SET SESSION BINLOG_FORMAT=ROW; SET GLOBAL BINLOG_FORMAT=ROW; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB; @@ -260,3 +282,5 @@ master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Query # # use `test`; DROP TABLE t1 RESET MASTER; +SET @@session.binlog_format= @old_session_binlog_format; +SET @@global.binlog_format= @old_global_binlog_format; diff --git a/mysql-test/suite/rpl/r/rpl_variables.result b/mysql-test/suite/rpl/r/rpl_variables.result index 902340f0219..b3108c75a6e 100644 --- a/mysql-test/suite/rpl/r/rpl_variables.result +++ b/mysql-test/suite/rpl/r/rpl_variables.result @@ -40,10 +40,10 @@ SET @user_num = 10; SET @user_text = 'Alunda'; [on master] **** Resetting master and slave **** -STOP SLAVE; +include/stop_slave.inc RESET SLAVE; RESET MASTER; -START SLAVE; +include/start_slave.inc [on slave] SET @@global.init_slave = 'SELECT 1'; [on master] diff --git a/mysql-test/suite/rpl/rpl_1slave_base.cnf b/mysql-test/suite/rpl/rpl_1slave_base.cnf new file mode 100644 index 00000000000..23b7ded9a7d --- /dev/null +++ b/mysql-test/suite/rpl/rpl_1slave_base.cnf @@ -0,0 +1,50 @@ +# Use default setting for mysqld processes +!include include/default_mysqld.cnf + +[mysqld.1] + +# Run the master.sh script before starting this process +#!run-master-sh + +log-bin= master-bin + +loose-innodb + +[mysqld.2] +# Run the slave.sh script before starting this process +#!run-slave-sh + +# Append <testname>-slave.opt file to the list of argument used when +# starting the mysqld +#!use-slave-opt + +log-bin= slave-bin +relay-log= slave-relay-bin + +init-rpl-role= slave +log-slave-updates +master-retry-count= 10 + +# Values reported by slave when it connect to master +# and shows up in SHOW SLAVE STATUS; +report-host= 127.0.0.1 +report-port= @mysqld.2.port +report-user= root + +skip-slave-start + +# 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. +slave-load-tmpdir= ../../tmp + +loose-innodb + + +[ENV] +MASTER_MYPORT= @mysqld.1.port +MASTER_MYSOCK= @mysqld.1.socket + +SLAVE_MYPORT= @mysqld.2.port +SLAVE_MYSOCK= @mysqld.2.socket + diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def index 8cae44a3607..f3f329c4b5b 100644 --- a/mysql-test/suite/rpl/t/disabled.def +++ b/mysql-test/suite/rpl/t/disabled.def @@ -10,3 +10,4 @@ # ############################################################################## +rpl_binlog_corruption : BUG#41793 2008-12-30 sven rpl_binlog_corruption disabled in main (needs new mtr) diff --git a/mysql-test/suite/rpl/t/rpl000017-slave.sh b/mysql-test/suite/rpl/t/rpl000017-slave.sh index 17188aba0db..1d95798260a 100755 --- a/mysql-test/suite/rpl/t/rpl000017-slave.sh +++ b/mysql-test/suite/rpl/t/rpl000017-slave.sh @@ -1,6 +1,6 @@ rm -f $MYSQLTEST_VARDIR/log/*relay* -rm -f $MYSQLTEST_VARDIR/slave-data/relay-log.info -cat > $MYSQLTEST_VARDIR/slave-data/master.info <<EOF +rm -f $MYSQLTEST_VARDIR/mysqld.2/data/relay-log.info +cat > $MYSQLTEST_VARDIR/mysqld.2/data/master.info <<EOF master-bin.000001 4 127.0.0.1 diff --git a/mysql-test/suite/rpl/t/rpl000018-master.opt b/mysql-test/suite/rpl/t/rpl000018-master.opt deleted file mode 100644 index ad2c6a647b5..00000000000 --- a/mysql-test/suite/rpl/t/rpl000018-master.opt +++ /dev/null @@ -1 +0,0 @@ --O max_binlog_size=4096 diff --git a/mysql-test/suite/rpl/t/rpl000018-slave.opt b/mysql-test/suite/rpl/t/rpl000018-slave.opt deleted file mode 100644 index e854f0d0bb2..00000000000 --- a/mysql-test/suite/rpl/t/rpl000018-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---skip-slave-start --abort-slave-event-count=1 diff --git a/mysql-test/suite/rpl/t/rpl_000015.slave-mi b/mysql-test/suite/rpl/t/rpl_000015-slave.opt index 28bc753dd56..28bc753dd56 100644 --- a/mysql-test/suite/rpl/t/rpl_000015.slave-mi +++ b/mysql-test/suite/rpl/t/rpl_000015-slave.opt diff --git a/mysql-test/suite/rpl/t/rpl_000015.cnf b/mysql-test/suite/rpl/t/rpl_000015.cnf new file mode 100644 index 00000000000..46f8af242c2 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_000015.cnf @@ -0,0 +1,2 @@ +!include ../rpl_1slave_base.cnf + diff --git a/mysql-test/suite/rpl/t/rpl_LD_INFILE.test b/mysql-test/suite/rpl/t/rpl_LD_INFILE.test index bace5d4c1f5..ae647ed6648 100644 --- a/mysql-test/suite/rpl/t/rpl_LD_INFILE.test +++ b/mysql-test/suite/rpl/t/rpl_LD_INFILE.test @@ -16,10 +16,10 @@ DROP TABLE IF EXISTS test.t1; # Section 1 test CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a)); -LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1; +LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1; DELETE FROM test.t1 WHERE a = 'abashed'; DELETE FROM test.t1; -LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1; +LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1; SELECT * FROM test.t1 ORDER BY a DESC; diff --git a/mysql-test/suite/rpl/t/rpl_alter_db.test b/mysql-test/suite/rpl/t/rpl_alter_db.test index 5ac8a2f4018..341496350d7 100644 --- a/mysql-test/suite/rpl/t/rpl_alter_db.test +++ b/mysql-test/suite/rpl/t/rpl_alter_db.test @@ -1,10 +1,14 @@ source include/master-slave.inc; -connection master; -use mysql; # to be different from initial `test' db of mysqltest client -alter database collate latin1_bin; -save_master_pos; -connection slave; -sync_with_master; +--echo ==== Verify that alter database does not stop replication ==== +create database temp_db; +use temp_db; # to be different from initial `test' db of mysqltest client +alter database collate latin1_bin; +sync_slave_with_master; + +--echo ==== Clean up ==== +connection master; +drop database temp_db; +sync_slave_with_master; diff --git a/mysql-test/suite/rpl/t/rpl_auto_increment-slave.opt b/mysql-test/suite/rpl/t/rpl_auto_increment-slave.opt deleted file mode 100644 index 48457b17309..00000000000 --- a/mysql-test/suite/rpl/t/rpl_auto_increment-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-innodb diff --git a/mysql-test/suite/rpl/t/rpl_binlog_corruption-master.opt b/mysql-test/suite/rpl/t/rpl_binlog_corruption-master.opt new file mode 100644 index 00000000000..815a8f81d32 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_binlog_corruption-master.opt @@ -0,0 +1 @@ +--replicate-same-server-id --relay-log=slave-relay-bin diff --git a/mysql-test/suite/rpl/t/rpl_binlog_corruption.test b/mysql-test/suite/rpl/t/rpl_binlog_corruption.test new file mode 100644 index 00000000000..39799180f8b --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_binlog_corruption.test @@ -0,0 +1,42 @@ +# ==== Purpose ==== +# +# Verify that the slave stops gracefully when reading a relay log with +# corrupted data. +# +# ==== Implementation ==== +# +# Setup "fake replication" where the slave only starts the SQL thread, +# not the IO thread, and reads from an existing relay log that has +# been prepared so that it contains the error. This requires some +# extra server options: see the -master.opt file. +# +# ==== Related bugs ==== +# +# BUG#31793: log event corruption causes crash +# BUG#40482: server/mysqlbinlog crashes when reading invalid Incident_log_event + +source include/have_log_bin.inc; +# BUG#40482 only manifested itself in debug-compiled binaries. +source include/have_debug.inc; + +call mtr.add_suppression('Found invalid event in binary log'); + + +# +# BUG#40482: server/mysqlbinlog crashes when reading invalid Incident_log_event +# +# The relay log contains an Incident_log_event with a non-existing +# incident number. + +--echo ==== Initialize ==== +let $fake_relay_log= $MYSQL_TEST_DIR/std_data/bug40482-bin.000001; +source include/setup_fake_relay_log.inc; + +--echo ==== Test ==== +START SLAVE SQL_THREAD; +source include/wait_for_slave_sql_error.inc; +let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1); +--echo Last_SQL_Error = $error + +--echo ==== Clean up ==== +source include/cleanup_fake_relay_log.inc; diff --git a/mysql-test/suite/rpl/t/rpl_binlog_grant.test b/mysql-test/suite/rpl/t/rpl_binlog_grant.test index e95f69a3f99..31163927ce2 100644 --- a/mysql-test/suite/rpl/t/rpl_binlog_grant.test +++ b/mysql-test/suite/rpl/t/rpl_binlog_grant.test @@ -42,3 +42,4 @@ show grants for x@y; show binlog events; drop user x@y; drop database d1; +--sync_slave_with_master diff --git a/mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules.test b/mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules.test index d8e25b244fa..d56a32ce2bd 100644 --- a/mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules.test +++ b/mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules.test @@ -16,8 +16,9 @@ reset master; create table t1 (a int); insert into t1 values (1); +let $MYSQLD_DATADIR= `select @@datadir`; flush logs; ---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/bug36099.sql +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/bug36099.sql drop table t1; --exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/bug36099.sql" diff --git a/mysql-test/suite/rpl/t/rpl_blackhole.test b/mysql-test/suite/rpl/t/rpl_blackhole.test index e8dfbd51552..f0c698cb9e2 100644 --- a/mysql-test/suite/rpl/t/rpl_blackhole.test +++ b/mysql-test/suite/rpl/t/rpl_blackhole.test @@ -78,3 +78,6 @@ source extra/rpl_tests/rpl_blackhole.test; # Test delete, key let $statement = DELETE FROM t1 WHERE a % 2 = 0 AND b = 3; source extra/rpl_tests/rpl_blackhole.test; + +connection master; +drop table t1,t2; diff --git a/mysql-test/suite/rpl/t/rpl_bug26395.test b/mysql-test/suite/rpl/t/rpl_bug26395.test new file mode 100644 index 00000000000..97c152d52e9 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_bug26395.test @@ -0,0 +1,97 @@ +# ==== Purpose ==== +# +# Tests that an autocommitted XA transaction where the master crashes +# just before writing the XID log event is executed correctly. The +# master rolls back, so the slave should not execute statement. +# +# This test was previously part of rpl_ndb_transaction.test +# +# +# ==== Method ==== +# +# We want master to be alive so that it can replicate the statement to +# the slave. So in the test case, we must not crash the +# master. Instead, we fake the crash by just not writing the XID event +# to the binlog. This is done by the @@debug='d,do_not_write_xid' +# flag. This, in turn, requires us to do 'source +# include/have_debug.inc' +# +# So, unlike if the master had crashed, the master *will* execute the +# statement. But the slave should not execute it. Hence, after the +# test is executed, the expected result on master is a table with one +# row, and on slave a table with no rows. +# +# To simulate the slave correctly, we wait until everything up to but +# not including the XID is replicated. This has to be done with +# include/sync_slave_io_with_master.inc, not sync_slave_with_master, +# since the latter waits until the slave *SQL* thread has caught up +# with the master's position, which it will never do. +# +# +# ==== Related bugs ==== +# +# BUG#26395: if crash during autocommit update to transactional table on master, slave fails + +source include/have_innodb.inc; +# have_debug is needed since we use the @@debug variable on master +source include/have_debug.inc; +source include/master-slave.inc; + + +--echo ==== Initialize ==== + +--echo [on master] +--connection master + +CREATE TABLE tinnodb (a INT) ENGINE = INNODB; +SHOW CREATE TABLE tinnodb; + +# do_not_write_xid stops the master from writing an XID event. +set @old_debug= @@debug; +set @@debug= 'd,do_not_write_xid'; + + +--echo ==== Test ==== + +# Save the position up to which the slave SQL thread should execute. +save_master_pos; + +# Execute query and check that the row made it to the table. +INSERT INTO tinnodb VALUES (1); +SELECT * FROM tinnodb ORDER BY a; + +# Sync slave's IO thread. +--echo [on slave] +source include/sync_slave_io_with_master.inc; + +# Sync slave's SQL thread. +sync_with_master 0; + + +--echo ==== Verify results on slave ==== + +source include/stop_slave.inc; +let $tmp= query_get_value("SHOW SLAVE STATUS", Slave_IO_State, 1); +eval SELECT "$tmp" AS Slave_IO_State; +let $tmp= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); +eval SELECT "$tmp" AS Last_SQL_Error; +let $tmp= query_get_value("SHOW SLAVE STATUS", Last_IO_Error, 1); +eval SELECT "$tmp" AS Last_IO_Error; +SELECT * FROM tinnodb ORDER BY a; + + +--echo ==== Clean up ==== + +# Easiest to clean up master and slave separately, without +# replication, since master and slave are out of sync. + +--echo [on master] +connection master; +DROP TABLE tinnodb; +set @@debug= @old_debug; + +--echo [on slave] +connection slave; +DROP TABLE tinnodb; + +# Warning: do not add more tests here. The binlog is in a bad state. diff --git a/mysql-test/suite/rpl/t/rpl_bug33931-slave.opt b/mysql-test/suite/rpl/t/rpl_bug33931-slave.opt deleted file mode 100644 index 55fe328a41d..00000000000 --- a/mysql-test/suite/rpl/t/rpl_bug33931-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-debug=d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init diff --git a/mysql-test/suite/rpl/t/rpl_bug33931.test b/mysql-test/suite/rpl/t/rpl_bug33931.test index 788f79d4c1c..a439b346538 100644 --- a/mysql-test/suite/rpl/t/rpl_bug33931.test +++ b/mysql-test/suite/rpl/t/rpl_bug33931.test @@ -13,10 +13,18 @@ connection master; reset master; connection slave; + +# Add suppression for expected warnings in slaves error log +call mtr.add_suppression("Failed during slave.*thread initialization"); + --disable_warnings stop slave; --enable_warnings reset slave; + +# Set debug flags on slave to force errors to occur +SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; + start slave; connection master; @@ -33,5 +41,8 @@ source include/wait_for_slave_to_stop.inc; --replace_column 1 # 8 # 9 # 23 # 33 # query_vertical show slave status; -# no clean-up is needed +# +# Cleanup +# +SET GLOBAL debug=""; diff --git a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf new file mode 100644 index 00000000000..141aaa7788d --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf @@ -0,0 +1,27 @@ +!include ../my.cnf + +[mysqld.1] +log-slave-updates +innodb + +[mysqld.2] +log-slave-updates +innodb + +[mysqld.3] +log-slave-updates +innodb + +[mysqld.4] +log-slave-updates +innodb + +[ENV] +SLAVE_MYPORT1= @mysqld.3.port +SLAVE_MYSOCK1= @mysqld.3.socket + +SLAVE_MYPORT2= @mysqld.4.port +SLAVE_MYSOCK2= @mysqld.4.socket + + + diff --git a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test new file mode 100644 index 00000000000..a49253f90c1 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test @@ -0,0 +1,324 @@ +############################################################# +# Author: Serge Kozlov <skozlov@mysql.com> +# Date: 03/12/2008 +# Purpose: Testing circular replication based on schema +# A->B->C->D->A with using AUTO_INCREMENT_INCREMENT, +# AUTO_INCREMENT_OFFSET variables and failover +############################################################# +--source include/have_innodb.inc + +# Set up circular ring and new names for servers +--echo *** Set up circular ring by schema A->B->C->D->A *** +--source include/circular_rpl_for_4_hosts_init.inc +--echo + +# Preparing data. +--echo *** Preparing data *** +--connection master_a +CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=MyISAM; +CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=InnoDB; +--source include/circular_rpl_for_4_hosts_sync.inc +--connection master_d +--echo + +# +# Testing +# + +--echo *** Testing schema A->B->C->D->A *** +--echo +# insert data via all hosts +--connection master_a +INSERT INTO t1(b,c) VALUES('A',1); +--sync_slave_with_master master_b +INSERT INTO t1(b,c) VALUES('B',1); +--sync_slave_with_master master_c +INSERT INTO t1(b,c) VALUES('C',1); +--sync_slave_with_master master_d +INSERT INTO t1(b,c) VALUES('D',1); + +--source include/circular_rpl_for_4_hosts_sync.inc + +--connection master_a +SELECT 'Master A',a,b FROM t1 WHERE c = 1 ORDER BY a,b; +--connection master_b +SELECT 'Master B',a,b FROM t1 WHERE c = 1 ORDER BY a,b; +--connection master_c +SELECT 'Master C',a,b FROM t1 WHERE c = 1 ORDER BY a,b; +--connection master_d +SELECT 'Master D',a,b FROM t1 WHERE c = 1 ORDER BY a,b; +--echo + +--echo *** Testing schema A->B->D->A if C has failure *** +--echo +--echo * Do failure for C and then make new connection B->D * +# Do not replicate next event from C +--connection master_d +connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT2); +STOP SLAVE; +SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; +source include/start_slave.inc; +disconnect slave; +--connection master_c +INSERT INTO t1 VALUES(6,'C',2); +--save_master_pos +--connection master_b +INSERT INTO t1(b,c) VALUES('B',2); +# Wait while C will stop. +--connection master_c +source include/wait_for_slave_sql_to_stop.inc; +--connection master_a +INSERT INTO t1(b,c) VALUES('A',2); +--connection master_d +INSERT INTO t1(b,c) VALUES('D',2); + + +# Sync all servers except C +--connection master_b +let $wait_condition= SELECT COUNT(*)=3 FROM t1 WHERE a > 4; +--source include/wait_condition.inc + +--echo +--echo * Data on servers (C failed) * +# Masters C,D shouldn't have correct data +--connection master_a +SELECT 'Master A',a,b FROM t1 WHERE c = 2 ORDER BY a,b; +--connection master_b +SELECT 'Master B',a,b FROM t1 WHERE c = 2 ORDER BY a,b; +--connection master_c +SELECT 'Master C',a,b FROM t1 WHERE c = 2 ORDER BY a,b; +--connection master_d +SELECT 'Master D',a,b FROM t1 WHERE c = 2 ORDER BY a,b; +--echo + +--echo * Reconfigure replication to schema A->B->D->A * +# Exclude Master C +--connection master_c +STOP SLAVE; +--let $pos_c= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1) +--let $file_c= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1) +--connection master_d +STOP SLAVE; +--replace_result $SLAVE_MYPORT MASTER_B_PORT $file_c LOG_FILE $pos_c LOG_POS +--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT,master_user='root',master_log_file='$file_c',master_log_pos=$pos_c +connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT2); +source include/start_slave.inc; +disconnect slave; +--connection master_b +--sync_slave_with_master master_d +--sync_slave_with_master master_a +--echo + +--echo * Check data inserted before failure * +--connection master_a +SELECT 'Master A',a,b FROM t1 WHERE c = 2 ORDER BY a,b; +--connection master_b +SELECT 'Master B',a,b FROM t1 WHERE c = 2 ORDER BY a,b; +--connection master_c +SELECT 'Master C',a,b FROM t1 WHERE c = 2 ORDER BY a,b; +--connection master_d +SELECT 'Master D',a,b FROM t1 WHERE c = 2 ORDER BY a,b; +--echo + +--echo * Check data inserted after failure * +--connection master_a +INSERT INTO t1(b,c) VALUES('A',3); +--connection master_b +INSERT INTO t1(b,c) VALUES('B',3); +--connection master_d +INSERT INTO t1(b,c) VALUES('D',3); +connection master_a; + +--sync_slave_with_master master_b +--sync_slave_with_master master_d +--sync_slave_with_master master_a +--sync_slave_with_master master_b + +--connection master_a +SELECT 'Master A',a,b FROM t1 WHERE c = 3 ORDER BY a,b; +--connection master_b +SELECT 'Master B',a,b FROM t1 WHERE c = 3 ORDER BY a,b; +--connection master_c +SELECT 'Master C',a,b FROM t1 WHERE c = 3 ORDER BY a,b; +--connection master_d +SELECT 'Master D',a,b FROM t1 WHERE c = 3 ORDER BY a,b; +--connection master_a +--echo + +--echo *** Testing restoring scheme A->B->C->D->A after failure *** +--echo +# Master D will ignore a next event from C so that event will not be +# distributed to other servers +--echo * Remove wrong event from C and restore B->C->D * +--connection master_d +source include/stop_slave.inc; +--connection master_c +DELETE FROM t1 WHERE a = 6; +START SLAVE; +--connection master_b +--sync_slave_with_master master_c +RESET MASTER; +--let $file_d= query_get_value(SHOW MASTER STATUS, File, 1) +--let $pos_d= query_get_value(SHOW MASTER STATUS, Position, 1) +--connection master_d +RESET SLAVE; +--replace_result $SLAVE_MYPORT1 MASTER_C_PORT $file_d LOG_FILE $pos_d LOG_POS +--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT1,master_user='root',master_log_file='$file_d',master_log_pos=$pos_d +START SLAVE; +--connection master_c +--sync_slave_with_master master_d +--source include/circular_rpl_for_4_hosts_sync.inc + +--echo +--echo * Check data inserted before restoring schema A->B->C->D->A * +--connection master_a +SELECT 'Master A',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b; +--sync_slave_with_master master_b +SELECT 'Master B',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b; +--sync_slave_with_master master_c +SELECT 'Master C',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b; +--sync_slave_with_master master_d +SELECT 'Master D',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b; +--sync_slave_with_master master_a +--echo + +--echo * Check data inserted after restoring schema A->B->C->D->A * +--connection master_a +INSERT INTO t1(b,c) VALUES('A',4); +--connection master_b +INSERT INTO t1(b,c) VALUES('B',4); +--connection master_c +INSERT INTO t1(b,c) VALUES('C',4); +--connection master_d +INSERT INTO t1(b,c) VALUES('D',4); +--connection master_a + +--source include/circular_rpl_for_4_hosts_sync.inc + +--connection master_a +SELECT 'Master A',a,b FROM t1 WHERE c = 4 ORDER BY a,b; +--connection master_b +SELECT 'Master B',a,b FROM t1 WHERE c = 4 ORDER BY a,b; +--connection master_c +SELECT 'Master C',a,b FROM t1 WHERE c = 4 ORDER BY a,b; +--connection master_d +SELECT 'Master D',a,b FROM t1 WHERE c = 4 ORDER BY a,b; +--connection master_a +--echo + +--echo * Transactions with commits * +# Testing mixing of transactions and regular inserts +--connection master_a +BEGIN; +--connection master_c +BEGIN; +let $counter= 100; +--connection master_a +--disable_query_log +while ($counter) { + --connection master_a + INSERT INTO t2(b,c) VALUES('A',1); + --connection master_b + INSERT INTO t2(b,c) VALUES('B',1); + --connection master_c + INSERT INTO t2(b,c) VALUES('C',1); + --connection master_d + INSERT INTO t2(b,c) VALUES('D',1); + dec $counter; +} +--connection master_a +COMMIT; +--connection master_c +COMMIT; +--connection master_a +--enable_query_log + + +--let $wait_condition= SELECT COUNT(*)=400 FROM t2 WHERE c = 1 +--connection master_a +--source include/wait_condition.inc +--connection master_b +--source include/wait_condition.inc +--connection master_c +--source include/wait_condition.inc +--connection master_d +--source include/wait_condition.inc + +--connection master_a +SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b; +--connection master_b +SELECT 'Master B',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b; +--connection master_c +SELECT 'Master C',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b; +--connection master_d +SELECT 'Master D',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b; +--connection master_a +--echo + +--echo * Transactions with rollbacks * +# Testing mixing of transactions with rollback and regular inserts +--connection master_a +BEGIN; +--connection master_c +BEGIN; +let $counter= 100; +--connection master_a +--disable_query_log +while ($counter) { + --connection master_a + INSERT INTO t2(b,c) VALUES('A',2); + --connection master_b + INSERT INTO t2(b,c) VALUES('B',2); + --connection master_c + INSERT INTO t2(b,c) VALUES('C',2); + --connection master_d + INSERT INTO t2(b,c) VALUES('D',2); + dec $counter; +} +--connection master_a +ROLLBACK; +--connection master_c +ROLLBACK; +--connection master_a +--enable_query_log + +--let $wait_condition= SELECT COUNT(*)=200 FROM t2 WHERE c = 2 +--connection master_a +--source include/wait_condition.inc +--connection master_b +--source include/wait_condition.inc +--connection master_c +--source include/wait_condition.inc +--connection master_d +--source include/wait_condition.inc + +--connection master_a +SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b; +--connection master_b +SELECT 'Master B',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b; +--connection master_c +SELECT 'Master C',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b; +--connection master_d +SELECT 'Master D',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b; +--connection master_a + +--echo + +# Clean up +--echo *** Clean up *** +--connection master_a +DROP TABLE t1,t2; +--source include/circular_rpl_for_4_hosts_sync.inc + +--connection master_a +STOP SLAVE; +RESET SLAVE; +--connection master_b +STOP SLAVE; +RESET SLAVE; +--connection master_c +STOP SLAVE; +RESET SLAVE; +--connection master_d +STOP SLAVE; +RESET SLAVE; diff --git a/mysql-test/suite/rpl/t/rpl_deadlock_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_deadlock_innodb-slave.opt index c52c239a1a1..3819e7c3f7b 100644 --- a/mysql-test/suite/rpl/t/rpl_deadlock_innodb-slave.opt +++ b/mysql-test/suite/rpl/t/rpl_deadlock_innodb-slave.opt @@ -1 +1 @@ ---innodb --innodb_lock_wait_timeout=4 --slave-transaction-retries=2 --max-relay-log-size=4096 +--innodb_lock_wait_timeout=4 --slave-transaction-retries=2 --max-relay-log-size=4096 diff --git a/mysql-test/suite/rpl/t/rpl_drop_db.test b/mysql-test/suite/rpl/t/rpl_drop_db.test index 7f4a7843c4a..11e93e7307a 100644 --- a/mysql-test/suite/rpl/t/rpl_drop_db.test +++ b/mysql-test/suite/rpl/t/rpl_drop_db.test @@ -47,15 +47,15 @@ use test; select * from t1; #cleanup -connection slave; -stop slave; -drop database mysqltest1; - connection master; + # Remove the "extra" file created above ---remove_file $MYSQLTEST_VARDIR/master-data/mysqltest1/f1.txt -drop database mysqltest1; +let $MYSQLD_DATADIR= `select @@datadir`; +remove_file $MYSQLD_DATADIR/mysqltest1/f1.txt; use test; drop table t1; +drop database mysqltest1; +sync_slave_with_master; +source include/stop_slave.inc; diff --git a/mysql-test/suite/rpl/t/rpl_drop_view.test b/mysql-test/suite/rpl/t/rpl_drop_view.test index 8d826b8214d..11633a0a7e8 100644 --- a/mysql-test/suite/rpl/t/rpl_drop_view.test +++ b/mysql-test/suite/rpl/t/rpl_drop_view.test @@ -29,3 +29,8 @@ select * from v1; select * from v2; --error 1146 select * from v3; + +--echo ==== clean up ==== +connection master; +drop table t1, t2, t3; +sync_slave_with_master; diff --git a/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test b/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test index 7ab9064b7f6..9efb3d16d2b 100644 --- a/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test +++ b/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test @@ -12,7 +12,8 @@ source include/have_innodb.inc; # set up "dual head" -let $keep_connection= 1; +# Needed for debug info in wait_for_slave_sql_to_stop. +let $master_connection= slave; connection slave; reset master; diff --git a/mysql-test/suite/rpl/t/rpl_events.test b/mysql-test/suite/rpl/t/rpl_events.test index 2a9cf86fe55..d06a3118389 100644 --- a/mysql-test/suite/rpl/t/rpl_events.test +++ b/mysql-test/suite/rpl/t/rpl_events.test @@ -5,11 +5,12 @@ # in both row based and statement based format # ################################################################## -set global event_scheduler=1; - --source include/not_embedded.inc --source include/master-slave.inc +SET @old_event_scheduler = @@global.event_scheduler; +set global event_scheduler=1; + let $engine_type= MyISAM; set binlog_format=row; @@ -51,5 +52,6 @@ sync_slave_with_master; # that there is no bad timing cauing it to try to access the table. connection master; +SET @@global.event_scheduler= @old_event_scheduler; DROP TABLE t28953; sync_slave_with_master; diff --git a/mysql-test/suite/rpl/t/rpl_extraCol_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_extraCol_innodb-slave.opt deleted file mode 100644 index 627becdbfb5..00000000000 --- a/mysql-test/suite/rpl/t/rpl_extraCol_innodb-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb diff --git a/mysql-test/suite/rpl/t/rpl_extraColmaster_innodb-master.opt b/mysql-test/suite/rpl/t/rpl_extraColmaster_innodb-master.opt deleted file mode 100644 index 627becdbfb5..00000000000 --- a/mysql-test/suite/rpl/t/rpl_extraColmaster_innodb-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb diff --git a/mysql-test/suite/rpl/t/rpl_extraColmaster_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_extraColmaster_innodb-slave.opt deleted file mode 100644 index 1338b6eba04..00000000000 --- a/mysql-test/suite/rpl/t/rpl_extraColmaster_innodb-slave.opt +++ /dev/null @@ -1 +0,0 @@ - --innodb diff --git a/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test b/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test index 274599857be..bf71ffbfd1e 100644 --- a/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test +++ b/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test @@ -124,9 +124,11 @@ UPDATE t7 LEFT JOIN (t8, t4, t1) ON (t7.id=t8.id and t7.id=t4.id and t7.id=t1.id sync_slave_with_master; connection master; -# Parameter for include/wait_for_slave_sql_error_and_skip.inc, ask it -# to show SQL error message -let show_sql_error=1; +# Parameters for include/wait_for_slave_sql_error_and_skip.inc: +# Ask it to show SQL error message. +let $show_sql_error= 1; +# The expected error will always be 1146 (ER_NO_SUCH_TABLE). +let $slave_sql_errno= 1146; # # Only do tables are referenced for update, these statements should diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt b/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt index a4d1d403dc9..95bca94fd3a 100644 --- a/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt +++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt @@ -1 +1 @@ --O max_binlog_size=1M --relay-log=$MYSQLTEST_VARDIR/master-data/relay-log +-O max_binlog_size=1M --relay-log=$MYSQLTEST_VARDIR/mysqld.1/data/relay-log diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt b/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt index 95839c831c9..e2aa63225a3 100644 --- a/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt +++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt @@ -1 +1 @@ --O max_binlog_size=1M --relay-log=$MYSQLTEST_VARDIR/slave-data/relay-log +-O max_binlog_size=1M --relay-log=$MYSQLTEST_VARDIR/mysqld.2/data/relay-log diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop.test b/mysql-test/suite/rpl/t/rpl_flushlog_loop.test index caead008169..a8befe612c2 100644 --- a/mysql-test/suite/rpl/t/rpl_flushlog_loop.test +++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop.test @@ -2,7 +2,8 @@ # in case of bi-directional replication -- source include/master-slave.inc ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +let $MYSQLD_DATADIR= `select @@datadir`; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR/ show variables like 'relay_log%'; connection slave; @@ -24,13 +25,8 @@ stop slave; --replace_result $SLAVE_MYPORT SLAVE_PORT eval change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=$SLAVE_MYPORT; -start slave; -# -# Wait for start of slave IO and SQL threads -# -let $result_pattern= '%127.0.0.1%root%slave-bin.000001%slave-bin.000001%Yes%Yes%0%0%None%'; ---source include/wait_slave_status.inc +source include/start_slave.inc; # # Flush logs of slave @@ -73,3 +69,9 @@ source include/wait_for_slave_param.inc; --replace_result $SLAVE_MYPORT SLAVE_PORT $slave_param_value POSITION --replace_column 1 # 8 # 9 # 16 # 23 # 33 # 34 # 35 # --query_vertical SHOW SLAVE STATUS + +--disable_query_log +connection master; +DROP TABLE t1; +sync_slave_with_master; +--enable_query_log diff --git a/mysql-test/suite/rpl/t/rpl_foreign_key_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_foreign_key_innodb-slave.opt deleted file mode 100644 index 627becdbfb5..00000000000 --- a/mysql-test/suite/rpl/t/rpl_foreign_key_innodb-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb diff --git a/mysql-test/suite/rpl/t/rpl_idempotency-master.opt b/mysql-test/suite/rpl/t/rpl_idempotency-master.opt deleted file mode 100644 index 66f581b56d0..00000000000 --- a/mysql-test/suite/rpl/t/rpl_idempotency-master.opt +++ /dev/null @@ -1,2 +0,0 @@ ---innodb - diff --git a/mysql-test/suite/rpl/t/rpl_idempotency-slave.opt b/mysql-test/suite/rpl/t/rpl_idempotency-slave.opt index 71ccf047474..03fc19ca6ae 100644 --- a/mysql-test/suite/rpl/t/rpl_idempotency-slave.opt +++ b/mysql-test/suite/rpl/t/rpl_idempotency-slave.opt @@ -1,2 +1 @@ ---slave-exec-mode=IDEMPOTENT --innodb - +--slave-exec-mode=IDEMPOTENT diff --git a/mysql-test/suite/rpl/t/rpl_idempotency.test b/mysql-test/suite/rpl/t/rpl_idempotency.test index cec91a6f4b7..1946aa100ab 100644 --- a/mysql-test/suite/rpl/t/rpl_idempotency.test +++ b/mysql-test/suite/rpl/t/rpl_idempotency.test @@ -7,6 +7,12 @@ source include/have_innodb.inc; connection slave; source include/have_innodb.inc; +# Add suppression for expected warning(s) in slaves error log +call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: 1032"); +call mtr.add_suppression("Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452"); + +SET @old_slave_exec_mode= @@global.slave_exec_mode; + connection master; CREATE TABLE t1 (a INT PRIMARY KEY); CREATE TABLE t2 (a INT); @@ -203,9 +209,8 @@ select * from ti1 order by b /* must be (2),(3) */; # foreign key: row is referenced --echo *** slave must stop -source include/wait_for_slave_sql_to_stop.inc; - connection slave; +source include/wait_for_slave_sql_to_stop.inc; let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); disable_query_log; @@ -236,11 +241,10 @@ delete from ti1 where b=3; connection master; insert into ti2 set a=3, b=3 /* offending write event */; ---echo *** slave must stop - -source include/wait_for_slave_sql_to_stop.inc; +--echo *** slave must stop connection slave; +source include/wait_for_slave_sql_to_stop.inc; let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); disable_query_log; @@ -278,9 +282,8 @@ connection master; insert into ti1 set b=1 /* offending write event */; --echo *** slave must stop -source include/wait_for_slave_sql_to_stop.inc; - connection slave; +source include/wait_for_slave_sql_to_stop.inc; let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); disable_query_log; @@ -314,9 +317,8 @@ connection master; DELETE FROM t1 WHERE a = -2; --echo *** slave must stop -source include/wait_for_slave_sql_to_stop.inc; - connection slave; +source include/wait_for_slave_sql_to_stop.inc; let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); disable_query_log; @@ -333,9 +335,8 @@ set global slave_exec_mode='STRICT'; connection master; DELETE FROM t2 WHERE a = -2; --echo *** slave must stop -source include/wait_for_slave_sql_to_stop.inc; - connection slave; +source include/wait_for_slave_sql_to_stop.inc; let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); disable_query_log; @@ -356,9 +357,8 @@ connection master; UPDATE t1 SET a = 1 WHERE a = -1; --echo *** slave must stop -source include/wait_for_slave_sql_to_stop.inc; - connection slave; +source include/wait_for_slave_sql_to_stop.inc; let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); disable_query_log; @@ -377,9 +377,8 @@ connection master; UPDATE t2 SET a = 1 WHERE a = -1; --echo *** slave must stop -source include/wait_for_slave_sql_to_stop.inc; - connection slave; +source include/wait_for_slave_sql_to_stop.inc; let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); disable_query_log; @@ -391,8 +390,7 @@ start slave sql_thread; connection master; sync_slave_with_master; #connection slave; -set global slave_exec_mode='STRICT'; - +SET @@global.slave_exec_mode= @old_slave_exec_mode; # cleanup for bug#31609 tests @@ -400,16 +398,6 @@ connection master; set @@session.binlog_format= @save_binlog_format; drop table t1,t2,ti2,ti1; -sync_slave_with_master; - +--source include/master-slave-end.inc --echo *** end of tests - - - - - - - - - diff --git a/mysql-test/suite/rpl/t/rpl_ignore_table.test b/mysql-test/suite/rpl/t/rpl_ignore_table.test index 7f13b16b0de..66f96e8f4e8 100644 --- a/mysql-test/suite/rpl/t/rpl_ignore_table.test +++ b/mysql-test/suite/rpl/t/rpl_ignore_table.test @@ -127,7 +127,8 @@ show grants for mysqltest4@localhost; set global slave_exec_mode='IDEMPOTENT'; connection master; -drop table t1, t4, mysqltest2.t2; +drop table t1, mysqltest2.t2; +drop table t4; drop database mysqltest2; delete from mysql.user where user like "mysqltest%"; delete from mysql.db where user like "mysqltest%"; diff --git a/mysql-test/suite/rpl/t/rpl_incident.test b/mysql-test/suite/rpl/t/rpl_incident.test index e99b88899bf..38fcc116736 100644 --- a/mysql-test/suite/rpl/t/rpl_incident.test +++ b/mysql-test/suite/rpl/t/rpl_incident.test @@ -14,7 +14,7 @@ REPLACE INTO t1 VALUES (4); SELECT * FROM t1; connection slave; ---wait_for_slave_to_stop +source include/wait_for_slave_sql_to_stop.inc; # The 4 should not be inserted into the table, since the incident log # event should have stop the slave. diff --git a/mysql-test/suite/rpl/t/rpl_init_slave.test b/mysql-test/suite/rpl/t/rpl_init_slave.test index 1511bd541ed..58d1f6bdc01 100644 --- a/mysql-test/suite/rpl/t/rpl_init_slave.test +++ b/mysql-test/suite/rpl/t/rpl_init_slave.test @@ -7,33 +7,25 @@ source include/master-slave.inc; set global max_connections=151; connection slave; -stop slave; -source include/wait_for_slave_to_stop.inc; -start slave; -source include/wait_for_slave_to_start.inc; +source include/stop_slave.inc; +source include/start_slave.inc; connection master; -save_master_pos; -connection slave; +sync_slave_with_master; show variables like 'init_slave'; show variables like 'max_connections'; -sync_with_master; reset master; connection master; show variables like 'init_slave'; show variables like 'max_connections'; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; # Save variable value set @my_global_init_connect= @@global.init_connect; set global init_connect="set @c=1"; show variables like 'init_connect'; connection master; -save_master_pos; -connection slave; -sync_with_master; -stop slave; +sync_slave_with_master; +source include/stop_slave.inc; # Restore changed global variable set global init_connect= @my_global_init_connect; diff --git a/mysql-test/suite/rpl/t/rpl_innodb-master.opt b/mysql-test/suite/rpl/t/rpl_innodb-master.opt index 8636d2d8734..0eed7aaadad 100644 --- a/mysql-test/suite/rpl/t/rpl_innodb-master.opt +++ b/mysql-test/suite/rpl/t/rpl_innodb-master.opt @@ -1 +1 @@ ---innodb --innodb_autoinc_lock_mode=0 +--innodb_autoinc_lock_mode=0 diff --git a/mysql-test/suite/rpl/t/rpl_innodb.test b/mysql-test/suite/rpl/t/rpl_innodb.test index 30d40e19614..64a85d27c88 100644 --- a/mysql-test/suite/rpl/t/rpl_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_innodb.test @@ -18,7 +18,7 @@ CREATE TABLE t4 ( --disable_warnings LOAD DATA - INFILE '../std_data_ln/loaddata_pair.dat' + INFILE '../../std_data/loaddata_pair.dat' REPLACE INTO TABLE t4 (name,number); --enable_warnings @@ -30,7 +30,7 @@ SELECT * FROM t4; connection master; --disable_warnings LOAD DATA - INFILE '../std_data_ln/loaddata_pair.dat' + INFILE '../../std_data/loaddata_pair.dat' REPLACE INTO TABLE t4 (name,number); --enable_warnings @@ -74,6 +74,17 @@ SET AUTOCOMMIT = 0; sync_slave_with_master; --echo -------- switch to slave -------- connection slave; + +# We want to verify that the following transactions are written to the +# binlog, despite the transaction is rolled back. (The should be +# written to the binlog since they contain non-transactional DROP +# TEMPORARY TABLE). To see that, we use the auxiliary table t1, which +# is transactional (InnoDB) on master and MyISAM on slave. t1 should +# be transactional on master so that the insert into t1 does not cause +# the transaction to be logged. Since t1 is non-transactional on +# slave, the change will not be rolled back, so the inserted rows will +# stay in t1 and we can verify that the transaction was replicated. +ALTER TABLE mysqltest1.t1 ENGINE = MyISAM; SHOW CREATE TABLE mysqltest1.t1; --echo -------- switch to master -------- @@ -100,8 +111,7 @@ connection slave; SHOW CREATE TABLE mysqltest1.tmp; --error ER_NO_SUCH_TABLE SHOW CREATE TABLE mysqltest1.tmp2; -# has two rows here : as the default is MyISAM and -# it can't be rolled back by the master's ROLLBACK. +# t1 has two rows here: the transaction not rolled back since t1 uses MyISAM SELECT COUNT(*) FROM mysqltest1.t1; FLUSH LOGS; diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug28430-master.opt b/mysql-test/suite/rpl/t/rpl_innodb_bug28430-master.opt index 8636d2d8734..0eed7aaadad 100644 --- a/mysql-test/suite/rpl/t/rpl_innodb_bug28430-master.opt +++ b/mysql-test/suite/rpl/t/rpl_innodb_bug28430-master.opt @@ -1 +1 @@ ---innodb --innodb_autoinc_lock_mode=0 +--innodb_autoinc_lock_mode=0 diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug28430-slave.opt b/mysql-test/suite/rpl/t/rpl_innodb_bug28430-slave.opt index 8636d2d8734..0eed7aaadad 100644 --- a/mysql-test/suite/rpl/t/rpl_innodb_bug28430-slave.opt +++ b/mysql-test/suite/rpl/t/rpl_innodb_bug28430-slave.opt @@ -1 +1 @@ ---innodb --innodb_autoinc_lock_mode=0 +--innodb_autoinc_lock_mode=0 diff --git a/mysql-test/suite/rpl/t/rpl_insert.test b/mysql-test/suite/rpl/t/rpl_insert.test index 4dacd77c9ac..6fb9ec8fd72 100644 --- a/mysql-test/suite/rpl/t/rpl_insert.test +++ b/mysql-test/suite/rpl/t/rpl_insert.test @@ -13,6 +13,9 @@ USE mysqlslap; CREATE TABLE t1 (id INT, name VARCHAR(64)) ENGINE=MyISAM; +sync_slave_with_master; +connection master; + let $query = "INSERT DELAYED INTO t1 VALUES (1, 'Dr. No'), (2, 'From Russia With Love'), (3, 'Goldfinger'), (4, 'Thunderball'), (5, 'You Only Live Twice')"; --exec $MYSQL_SLAP --silent --concurrency=5 --iterations=200 --query=$query --delimiter=";" diff --git a/mysql-test/suite/rpl/t/rpl_insert_id-slave.opt b/mysql-test/suite/rpl/t/rpl_insert_id-slave.opt deleted file mode 100644 index 48457b17309..00000000000 --- a/mysql-test/suite/rpl/t/rpl_insert_id-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-innodb diff --git a/mysql-test/suite/rpl/t/rpl_insert_id_pk-slave.opt b/mysql-test/suite/rpl/t/rpl_insert_id_pk-slave.opt deleted file mode 100644 index 48457b17309..00000000000 --- a/mysql-test/suite/rpl/t/rpl_insert_id_pk-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-innodb diff --git a/mysql-test/suite/rpl/t/rpl_insert_ignore-slave.opt b/mysql-test/suite/rpl/t/rpl_insert_ignore-slave.opt deleted file mode 100644 index 48457b17309..00000000000 --- a/mysql-test/suite/rpl/t/rpl_insert_ignore-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-innodb diff --git a/mysql-test/suite/rpl/t/rpl_invoked_features-master.opt b/mysql-test/suite/rpl/t/rpl_invoked_features-master.opt deleted file mode 100644 index 627becdbfb5..00000000000 --- a/mysql-test/suite/rpl/t/rpl_invoked_features-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb diff --git a/mysql-test/suite/rpl/t/rpl_invoked_features-slave.opt b/mysql-test/suite/rpl/t/rpl_invoked_features-slave.opt deleted file mode 100644 index 627becdbfb5..00000000000 --- a/mysql-test/suite/rpl/t/rpl_invoked_features-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb diff --git a/mysql-test/suite/rpl/t/rpl_load_from_master.test b/mysql-test/suite/rpl/t/rpl_load_from_master.test index b04d8a44226..0f085457817 100644 --- a/mysql-test/suite/rpl/t/rpl_load_from_master.test +++ b/mysql-test/suite/rpl/t/rpl_load_from_master.test @@ -144,10 +144,11 @@ select * from mysqltest.t1; # DISABLED FOR NOW AS chmod IS NOT PORTABLE ON NON-UNIX # insert into mysqltest.t1 values(10, 'should be there'); # flush tables; -# system chmod 500 $MYSQLTEST_VARDIR/slave-data/mysqltest/; +let $MYSQLD_SLAVE_DATADIR= `select @@datadir`; +# system chmod 500 $MYSQLD_SLAVE_DATADIR/mysqltest/; # --error 6 # load data from master; # should fail (errno 13) -# system chmod 700 $MYSQLTEST_VARDIR/slave-data/mysqltest/; +# system chmod 700 $MYSQLD_SLAVE_DATADIR/mysqltest/; # select * from mysqltest.t1; # should contain the row (10, ...) diff --git a/mysql-test/suite/rpl/t/rpl_load_table_from_master.test b/mysql-test/suite/rpl/t/rpl_load_table_from_master.test index b9cec3858a9..aad113878d3 100644 --- a/mysql-test/suite/rpl/t/rpl_load_table_from_master.test +++ b/mysql-test/suite/rpl/t/rpl_load_table_from_master.test @@ -71,9 +71,9 @@ sync_with_master; connection master; set SQL_LOG_BIN=0; create table t1 (word char(20) not null, index(word))ENGINE=MyISAM; -load data infile '../std_data_ln/words.dat' into table t1; +load data infile '../../std_data/words.dat' into table t1; create table t2 (word char(20) not null)ENGINE=MyISAM; -load data infile '../std_data_ln/words.dat' into table t2; +load data infile '../../std_data/words.dat' into table t2; create table t3 (word char(20) not null primary key)ENGINE=MyISAM; connection slave; load table t1 from master; diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_charset.test b/mysql-test/suite/rpl/t/rpl_loaddata_charset.test index 7f2389cb9f6..c191d29d5a3 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_charset.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_charset.test @@ -9,17 +9,17 @@ source include/master-slave.inc; # connection master; create table t1 (a varchar(10) character set utf8); -load data infile '../std_data_ln/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; set @@character_set_database=koi8r; -load data infile '../std_data_ln/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; set @@character_set_database=DEFAULT; -load data infile '../std_data_ln/loaddata6.dat' into table t1; -load data infile '../std_data_ln/loaddata6.dat' into table t1; -load data infile '../std_data_ln/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; set @@character_set_database=koi8r; -load data infile '../std_data_ln/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; set @@character_set_database=DEFAULT; -load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8r; +load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8r; select hex(a) from t1; diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test index dceee7a65af..b7d9995c834 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test @@ -13,7 +13,7 @@ source include/show_slave_status.inc; # Now we feed it a load data infile, which should make it stop with a # fatal error. connection master; -LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE t1; +LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE t1; connection slave; wait_for_slave_to_stop; diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_m.test b/mysql-test/suite/rpl/t/rpl_loaddata_m.test index 537d4c163ef..42c3ad99f33 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_m.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_m.test @@ -17,14 +17,14 @@ connection master; # 'test' database should be ignored by the slave USE test; CREATE TABLE t1(a INT, b INT, UNIQUE(b)); -LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE test.t1; +LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE test.t1; SELECT COUNT(*) FROM test.t1; # 'mysqltest' database should NOT be ignored by the slave CREATE DATABASE mysqltest; USE mysqltest; CREATE TABLE t1(a INT, b INT, UNIQUE(b)); -LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE mysqltest.t1; +LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1; SELECT COUNT(*) FROM mysqltest.t1; # Now lets check the slave to see what we have :-) diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_s.test b/mysql-test/suite/rpl/t/rpl_loaddata_s.test index f397d741310..2dd2218eb5c 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_s.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_s.test @@ -12,7 +12,7 @@ reset master; connection master; # 'test' is the current database create table test.t1(a int, b int, unique(b)); -load data infile '../std_data_ln/rpl_loaddata.dat' into table test.t1; +load data infile '../../std_data/rpl_loaddata.dat' into table test.t1; # Test logging on slave; diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_simple.test b/mysql-test/suite/rpl/t/rpl_loaddata_simple.test index 9e908cac677..439c2b48ca5 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_simple.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_simple.test @@ -1,7 +1,7 @@ --source include/master-slave.inc CREATE TABLE t1 (word CHAR(20) NOT NULL); -LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; +LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; SELECT * FROM t1 ORDER BY word; sync_slave_with_master; diff --git a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test index b10603e7195..0de402f301a 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test +++ b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test @@ -19,13 +19,14 @@ while ($1) } set SQL_LOG_BIN=1; enable_query_log; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval select * into outfile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' from t1; +let $MYSQLD_DATADIR= `select @@datadir`; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; #This will generate a 20KB file, now test LOAD DATA LOCAL truncate table t1; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval load data local infile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1; ---remove_file $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1; +--remove_file $MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile save_master_pos; connection slave; sync_with_master; @@ -46,13 +47,13 @@ sync_with_master; connection master; create table t1(a int); insert into t1 values (1), (2), (2), (3); ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval select * into outfile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' from t1; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; drop table t1; create table t1(a int primary key); ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval load data local infile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1; ---remove_file $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1; +--remove_file $MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile SELECT * FROM t1 ORDER BY a; save_master_pos; connection slave; diff --git a/mysql-test/suite/rpl/t/rpl_loadfile.test b/mysql-test/suite/rpl/t/rpl_loadfile.test index 532db77c248..5aa4da41fe5 100644 --- a/mysql-test/suite/rpl/t/rpl_loadfile.test +++ b/mysql-test/suite/rpl/t/rpl_loadfile.test @@ -24,12 +24,12 @@ DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a)); INSERT INTO test.t1 VALUES(1,'test'); -UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=1; +UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=1; delimiter |; create procedure test.p1() begin INSERT INTO test.t1 VALUES(2,'test'); - UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=2; + UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=2; end| delimiter ;| diff --git a/mysql-test/suite/rpl/t/rpl_log_pos.test b/mysql-test/suite/rpl/t/rpl_log_pos.test index 45a097b6f14..5e8390f97ed 100644 --- a/mysql-test/suite/rpl/t/rpl_log_pos.test +++ b/mysql-test/suite/rpl/t/rpl_log_pos.test @@ -13,20 +13,14 @@ source include/master-slave.inc; source include/show_master_status.inc; sync_slave_with_master; -stop slave; ---source include/wait_for_slave_to_stop.inc +source include/stop_slave.inc; change master to master_log_pos=75; source include/show_slave_status2.inc; start slave; -let $slave_param= Slave_SQL_Running; -let $slave_param_value= Yes; ---source include/wait_for_slave_param.inc -let $slave_param= Slave_IO_Running; -let $slave_param_value= No; ---source include/wait_for_slave_param.inc -stop slave; ---source include/wait_for_slave_to_stop.inc +source include/wait_for_slave_sql_to_start.inc; +source include/wait_for_slave_io_to_stop.inc; +source include/stop_slave.inc; source include/show_slave_status.inc; connection master; diff --git a/mysql-test/suite/rpl/t/rpl_misc_functions.test b/mysql-test/suite/rpl/t/rpl_misc_functions.test index 4a47e9645f9..d2e61d579e3 100644 --- a/mysql-test/suite/rpl/t/rpl_misc_functions.test +++ b/mysql-test/suite/rpl/t/rpl_misc_functions.test @@ -21,11 +21,12 @@ insert into t1 values(3, 0, 0, 0, password('does_this_work?')); # "altogether now" insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?')); select * into outfile 'rpl_misc_functions.outfile' from t1; +let $MYSQLD_DATADIR= `select @@datadir`; sync_slave_with_master; -create table t2 like t1; +create temporary table t2 like t1; # read the values from the master table ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval load data local infile '$MYSQLTEST_VARDIR/master-data/test/rpl_misc_functions.outfile' into table t2; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval load data local infile '$MYSQLD_DATADIR/test/rpl_misc_functions.outfile' into table t2; # compare them with the replica; the SELECT below should return no row select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p); @@ -81,12 +82,12 @@ INSERT INTO t1 (col_a) VALUES (test_replication_sf()); --sync_slave_with_master # Dump table on slave -select * from t1 into outfile "../tmp/t1_slave.txt"; +select * from t1 into outfile "../../tmp/t1_slave.txt"; # Load data from slave into temp table on master connection master; create temporary table t1_slave select * from t1 where 1=0; -load data infile '../tmp/t1_slave.txt' into table t1_slave; +load data infile '../../tmp/t1_slave.txt' into table t1_slave; --remove_file $MYSQLTEST_VARDIR/tmp/t1_slave.txt # Compare master and slave temp table, use subtraction @@ -109,7 +110,7 @@ DROP TABLE t1, t1_slave; DROP PROCEDURE test_replication_sp1; DROP PROCEDURE test_replication_sp2; DROP FUNCTION test_replication_sf; ---remove_file $MYSQLTEST_VARDIR/master-data/test/rpl_misc_functions.outfile +--remove_file $MYSQLD_DATADIR/test/rpl_misc_functions.outfile --sync_slave_with_master diff --git a/mysql-test/suite/rpl/t/rpl_multi_engine-slave.opt b/mysql-test/suite/rpl/t/rpl_multi_engine-slave.opt deleted file mode 100644 index 48457b17309..00000000000 --- a/mysql-test/suite/rpl/t/rpl_multi_engine-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-innodb diff --git a/mysql-test/suite/rpl/t/rpl_multi_engine.test b/mysql-test/suite/rpl/t/rpl_multi_engine.test index 10780c765f7..31c4a2050d7 100644 --- a/mysql-test/suite/rpl/t/rpl_multi_engine.test +++ b/mysql-test/suite/rpl/t/rpl_multi_engine.test @@ -12,16 +12,14 @@ connection slave; connection master; -- source include/have_innodb.inc --disable_warnings -create database if not exists mysqltest1; -use mysqltest1; drop table if exists t1; +--enable_warnings CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id)); sync_slave_with_master; -use mysqltest1; # MyISAM to MyISAM then InnoDB then MEMORY @@ -101,8 +99,6 @@ show create table t1; # cleanup connection master; DROP TABLE t1; -# Need to drop mysqltest1 as well so other test will pass. -DROP DATABASE mysqltest1; sync_slave_with_master; # End of 5.1 test case diff --git a/mysql-test/suite/rpl/t/rpl_packet.test b/mysql-test/suite/rpl/t/rpl_packet.test index 1bde61aef78..79cb2d9d735 100644 --- a/mysql-test/suite/rpl/t/rpl_packet.test +++ b/mysql-test/suite/rpl/t/rpl_packet.test @@ -13,15 +13,15 @@ enable_warnings; eval create database $db; connection master; +let $old_max_allowed_packet= `SELECT @@global.max_allowed_packet`; +let $old_net_buffer_length= `SELECT @@global.net_buffer_length`; SET @@global.max_allowed_packet=1024; SET @@global.net_buffer_length=1024; # Restart slave for setting to take effect connection slave; -STOP SLAVE; -source include/wait_for_slave_to_stop.inc; -START SLAVE; -source include/wait_for_slave_to_start.inc; +source include/stop_slave.inc; +source include/start_slave.inc; # Reconnect to master for new setting to take effect disconnect master; @@ -65,26 +65,35 @@ SET @@global.net_buffer_length=4096; # Restart slave for new setting to take effect connection slave; -STOP SLAVE; -source include/wait_for_slave_to_stop.inc; -START SLAVE; -source include/wait_for_slave_to_start.inc; +source include/stop_slave.inc; +source include/start_slave.inc; # Reconnect to master for new setting to take effect disconnect master; connect (master, localhost, root); connection master; -CREATE TABLe `t1` (`f1` LONGTEXT) ENGINE=MyISAM; +CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM; + +sync_slave_with_master; + +connection master; INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048'); # The slave I/O thread must stop after trying to read the above event connection slave; ---source include/wait_for_slave_io_to_stop.inc ---replace_result $MASTER_MYPORT MASTER_MYPORT -# import is only the 11th column Slave_IO_Running ---replace_column 1 # 7 # 8 # 9 # 12 # 22 # 23 # 33 # -query_vertical show slave status; +--source include/wait_for_slave_io_to_stop.inc +let $slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1); +--echo Slave_IO_Running = $slave_io_running (expect No) + +--echo ==== clean up ==== +connection master; +DROP TABLE t1; +eval SET @@global.max_allowed_packet= $old_max_allowed_packet; +eval SET @@global.net_buffer_length= $old_net_buffer_length; +# slave is stopped +connection slave; +DROP TABLE t1; # End of tests diff --git a/mysql-test/suite/rpl/t/rpl_ps.test b/mysql-test/suite/rpl/t/rpl_ps.test index 27f1ac3348d..b00dec6b80c 100644 --- a/mysql-test/suite/rpl/t/rpl_ps.test +++ b/mysql-test/suite/rpl/t/rpl_ps.test @@ -123,7 +123,7 @@ DROP DATABASE mysqltest1; --echo use test; - +DROP TABLE t1; --echo --save_master_pos diff --git a/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test b/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test index 72ae6a99c44..8863c9d4ac7 100644 --- a/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test +++ b/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test @@ -5,6 +5,8 @@ # Test that the slave temporarily switches to ROW when seeing binrow # events when it is in STATEMENT or MIXED mode +SET @old_binlog_format= @@global.binlog_format; + SET BINLOG_FORMAT=MIXED; SET GLOBAL BINLOG_FORMAT=MIXED; SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT; @@ -33,6 +35,7 @@ SHOW BINLOG EVENTS; connection master; DROP TABLE IF EXISTS t1; +SET @@global.binlog_format= @old_binlog_format; # Let's compare. Note: If they match test will pass, if they do not match # the test will show that the diff statement failed and not reject file diff --git a/mysql-test/suite/rpl/t/rpl_read_only-slave.opt b/mysql-test/suite/rpl/t/rpl_read_only-slave.opt deleted file mode 100644 index 48457b17309..00000000000 --- a/mysql-test/suite/rpl/t/rpl_read_only-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-innodb diff --git a/mysql-test/suite/rpl/t/rpl_relay_space_innodb-master.opt b/mysql-test/suite/rpl/t/rpl_relay_space_innodb-master.opt deleted file mode 100644 index 627becdbfb5..00000000000 --- a/mysql-test/suite/rpl/t/rpl_relay_space_innodb-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb diff --git a/mysql-test/suite/rpl/t/rpl_relay_space_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_relay_space_innodb-slave.opt deleted file mode 100644 index 627becdbfb5..00000000000 --- a/mysql-test/suite/rpl/t/rpl_relay_space_innodb-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb diff --git a/mysql-test/suite/rpl/t/rpl_relayrotate-slave.opt b/mysql-test/suite/rpl/t/rpl_relayrotate-slave.opt index cf4319f2b40..e5b24dd9413 100644 --- a/mysql-test/suite/rpl/t/rpl_relayrotate-slave.opt +++ b/mysql-test/suite/rpl/t/rpl_relayrotate-slave.opt @@ -1,3 +1,2 @@ -O max_relay_log_size=16384 ---loose-innodb --log-warnings diff --git a/mysql-test/suite/rpl/t/rpl_replicate_do.test b/mysql-test/suite/rpl/t/rpl_replicate_do.test index 90f00764691..fea168ee9f1 100644 --- a/mysql-test/suite/rpl/t/rpl_replicate_do.test +++ b/mysql-test/suite/rpl/t/rpl_replicate_do.test @@ -11,7 +11,7 @@ create table t2 (n int); insert into t2 values(4); connection master; create table t2 (s char(20)); -load data infile '../std_data_ln/words.dat' into table t2; +load data infile '../../std_data/words.dat' into table t2; insert into t2 values('five'); create table t1 (m int); insert into t1 values(15),(16),(17); diff --git a/mysql-test/suite/rpl/t/rpl_rewrt_db.test b/mysql-test/suite/rpl/t/rpl_rewrt_db.test index 52f04e073dd..4dfe2edaf35 100644 --- a/mysql-test/suite/rpl/t/rpl_rewrt_db.test +++ b/mysql-test/suite/rpl/t/rpl_rewrt_db.test @@ -34,8 +34,8 @@ create database rewrite; connection master; use test; create table t1 (a date, b date, c date not null, d date); -load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ','; -load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES; +load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ','; +load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES; sync_slave_with_master; connection slave; @@ -43,7 +43,7 @@ select * from rewrite.t1; connection master; truncate table t1; -load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d); +load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d); sync_slave_with_master; connection slave; @@ -52,7 +52,7 @@ select * from rewrite.t1; connection master; drop table t1; create table t1 (a text, b text); -load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by ''''; +load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by ''''; sync_slave_with_master; connection slave; @@ -61,7 +61,7 @@ select concat('|',a,'|'), concat('|',b,'|') from rewrite.t1; connection master; drop table t1; create table t1 (a int, b char(10)); -load data infile '../std_data_ln/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines; +load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines; sync_slave_with_master; connection slave; @@ -69,7 +69,7 @@ select * from rewrite.t1; connection master; truncate table t1; -load data infile '../std_data_ln/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines; +load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines; sync_slave_with_master; connection slave; diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt b/mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt deleted file mode 100644 index ad2c6a647b5..00000000000 --- a/mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt +++ /dev/null @@ -1 +0,0 @@ --O max_binlog_size=4096 diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs.slave-mi b/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt index 80190bf6d29..80190bf6d29 100644 --- a/mysql-test/suite/rpl/t/rpl_rotate_logs.slave-mi +++ b/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs.cnf b/mysql-test/suite/rpl/t/rpl_rotate_logs.cnf new file mode 100644 index 00000000000..7e676dc2da8 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.cnf @@ -0,0 +1,6 @@ +!include ../rpl_1slave_base.cnf + +[mysqld.1] +max_binlog_size=4096 + + diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs.test b/mysql-test/suite/rpl/t/rpl_rotate_logs.test index 9133c429934..2bad7b27272 100644 --- a/mysql-test/suite/rpl/t/rpl_rotate_logs.test +++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.test @@ -23,9 +23,10 @@ drop table if exists t1, t2, t3, t4; --enable_warnings connect (slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK); # Create empty file -write_file $MYSQLTEST_VARDIR/slave-data/master.info; +let $MYSQLD_SLAVE_DATADIR= `select @@datadir`; +write_file $MYSQLD_SLAVE_DATADIR/master.info; EOF -chmod 0000 $MYSQLTEST_VARDIR/slave-data/master.info; +chmod 0000 $MYSQLD_SLAVE_DATADIR/master.info; connection slave; --disable_warnings drop table if exists t1, t2, t3, t4; @@ -36,7 +37,7 @@ drop table if exists t1, t2, t3, t4; --replace_result $MYSQL_TEST_DIR TESTDIR --error 1105,1105,29 start slave; -chmod 0600 $MYSQLTEST_VARDIR/slave-data/master.info; +chmod 0600 $MYSQLD_SLAVE_DATADIR/master.info; # It will fail again because the file is empty so the slave cannot get valuable # info about how to connect to the master from it (failure in # init_strvar_from_file() in init_master_info()). diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-master.opt b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-master.opt index ed7656c1f99..de86b63f230 100644 --- a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-master.opt +++ b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-master.opt @@ -1,2 +1,2 @@ ---binlog_ignore_db=test_ignore --loose-innodb +--binlog_ignore_db=test_ignore diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-slave.opt b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-slave.opt deleted file mode 100644 index 48457b17309..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-innodb diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_3innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_row_basic_3innodb-slave.opt deleted file mode 100644 index 627becdbfb5..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_basic_3innodb-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb diff --git a/mysql-test/suite/rpl/t/rpl_row_blob_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_row_blob_innodb-slave.opt deleted file mode 100644 index 627becdbfb5..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_blob_innodb-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb diff --git a/mysql-test/suite/rpl/t/rpl_row_conflicts.test b/mysql-test/suite/rpl/t/rpl_row_conflicts.test new file mode 100644 index 00000000000..59757e2e802 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_conflicts.test @@ -0,0 +1,31 @@ +# See the top of mysql-test/extra/rpl_tests/rpl_conflicts.test for +# explanation of what this test does. +# +# This test file is for row-logging mode. It runs the test twice, with +# slave_exec_mode=STRICT and slave_exec_mode=IDEMPOTENT, respectively. + +source include/have_binlog_format_row.inc; +source include/master-slave.inc; + +connection slave; +call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: .*"); + +--echo [on slave] +connection slave; +SET @old_slave_exec_mode= @@global.slave_exec_mode; + + +--echo ######## Run with slave_exec_mode=STRICT ######## + +SET @@global.slave_exec_mode = 'STRICT'; +source extra/rpl_tests/rpl_conflicts.test; + + +--echo ######## Run with slave_exec_mode=IDEMPOTENT ######## + +set @@global.slave_exec_mode= 'IDEMPOTENT'; +source extra/rpl_tests/rpl_conflicts.test; + + +SET @@global.slave_exec_mode= @old_slave_exec_mode; +source include/master-slave-end.inc; diff --git a/mysql-test/suite/rpl/t/rpl_row_create_table-slave.opt b/mysql-test/suite/rpl/t/rpl_row_create_table-slave.opt deleted file mode 100644 index 48457b17309..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_create_table-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-innodb diff --git a/mysql-test/suite/rpl/t/rpl_row_create_table.test b/mysql-test/suite/rpl/t/rpl_row_create_table.test index 3fb5aa8e1f2..319f9546a81 100644 --- a/mysql-test/suite/rpl/t/rpl_row_create_table.test +++ b/mysql-test/suite/rpl/t/rpl_row_create_table.test @@ -29,6 +29,8 @@ SET GLOBAL storage_engine=memory; START SLAVE; --enable_query_log +--source include/reset_master_and_slave.inc + connection master; CREATE TABLE t1 (a INT, b INT); CREATE TABLE t2 (a INT, b INT) ENGINE=Merge; @@ -36,7 +38,7 @@ CREATE TABLE t3 (a INT, b INT) CHARSET=utf8; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8; --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ ---query_vertical SHOW BINLOG EVENTS FROM 216 +--query_vertical SHOW BINLOG EVENTS FROM 106 --echo **** On Master **** --query_vertical SHOW CREATE TABLE t1 --query_vertical SHOW CREATE TABLE t2 @@ -65,6 +67,8 @@ SELECT * FROM t5 ORDER BY a,b,c; --query_vertical SHOW CREATE TABLE t6 SELECT * FROM t6 ORDER BY a,b,c; +--source include/reset_master_and_slave.inc + connection master; # Test for erroneous constructions --error ER_DUP_ENTRY @@ -72,7 +76,7 @@ CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3; # Shouldn't be written to the binary log --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 1374; +SHOW BINLOG EVENTS FROM 106; # Test that INSERT-SELECT works the same way as for SBR. CREATE TABLE t7 (a INT, b INT UNIQUE); @@ -82,10 +86,12 @@ SELECT * FROM t7 ORDER BY a,b; # Should be written to the binary log --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 1374; +SHOW BINLOG EVENTS FROM 106; sync_slave_with_master; SELECT * FROM t7 ORDER BY a,b; +--source include/reset_master_and_slave.inc + connection master; CREATE TEMPORARY TABLE tt4 (a INT, b INT); INSERT INTO tt4 VALUES (4,8), (5,10), (6,12); @@ -94,11 +100,13 @@ INSERT INTO t7 SELECT a,b FROM tt4; ROLLBACK; --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 1711; +SHOW BINLOG EVENTS FROM 106; SELECT * FROM t7 ORDER BY a,b; sync_slave_with_master; SELECT * FROM t7 ORDER BY a,b; +--source include/reset_master_and_slave.inc + connection master; CREATE TABLE t8 LIKE t4; CREATE TABLE t9 LIKE tt4; @@ -110,7 +118,7 @@ CREATE TEMPORARY TABLE tt7 SELECT 1; --query_vertical SHOW CREATE TABLE t9 --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 1946; +SHOW BINLOG EVENTS FROM 106; sync_slave_with_master; --echo **** On Slave **** --query_vertical SHOW CREATE TABLE t8 @@ -162,7 +170,7 @@ SELECT * FROM t3 ORDER BY a; SELECT * FROM t4 ORDER BY a; --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS; +SHOW BINLOG EVENTS FROM 106; sync_slave_with_master; SHOW TABLES; SELECT TABLE_NAME,ENGINE @@ -208,13 +216,17 @@ COMMIT; SELECT * FROM t2 ORDER BY a; --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS; +SHOW BINLOG EVENTS FROM 106; sync_slave_with_master; SELECT * FROM t2 ORDER BY a; connection master; TRUNCATE TABLE t2; +sync_slave_with_master; +--source include/reset_master_and_slave.inc + +connection master; BEGIN; INSERT INTO t2 SELECT a*a FROM t1; CREATE TEMPORARY TABLE tt2 @@ -227,7 +239,7 @@ ROLLBACK; SELECT * FROM t2 ORDER BY a; --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 949; +SHOW BINLOG EVENTS FROM 106; sync_slave_with_master; SELECT * FROM t2 ORDER BY a; @@ -266,6 +278,9 @@ sync_slave_with_master; source include/master-slave-reset.inc; connection master; +--disable_warnings +DROP DATABASE IF EXISTS mysqltest1; +--enable_warnings CREATE DATABASE mysqltest1; CREATE TABLE mysqltest1.without_select (f1 BIGINT); diff --git a/mysql-test/suite/rpl/t/rpl_row_func003-slave.opt b/mysql-test/suite/rpl/t/rpl_row_func003-slave.opt deleted file mode 100644 index 48457b17309..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_func003-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-innodb diff --git a/mysql-test/suite/rpl/t/rpl_row_inexist_tbl-slave.opt b/mysql-test/suite/rpl/t/rpl_row_inexist_tbl-slave.opt deleted file mode 100644 index abd717f8222..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_inexist_tbl-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---replicate-ignore-table=test.t2 diff --git a/mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test b/mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test index 25a8c0e744e..0c038c41ebf 100644 --- a/mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test +++ b/mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test @@ -1,33 +1,42 @@ -# Test to see what slave says when master is updating a table it does -# not have +# ==== Purpose ==== +# +# Verify that slave gives an error message if master updates a table +# that slave does not have. +# +# ==== Method ==== +# +# Create a table on master, wait till it's on slave, remove it from +# slave. Then update the table on master. + --source include/have_binlog_format_row.inc source include/master-slave.inc; -connection master; -create table t1 (a int not null primary key); -insert into t1 values (1); -create table t2 (a int); -insert into t2 values (1); -update t1, t2 set t1.a = 0 where t1.a = t2.a; +--echo ==== Setup table on master but not on slave ==== +--echo [on master] +CREATE TABLE t1 (a INT); +--echo [on slave] sync_slave_with_master; -# t2 should not have been replicated -# t1 should have been properly updated -show tables; -select * from t1; -drop table t1; +DROP TABLE t1; +--echo ==== Modify table on master ==== +--echo [on master] connection master; -insert into t1 values (1); +INSERT INTO t1 VALUES (1); +--echo ==== Verify error on slave ==== +--echo [on slave] connection slave; # slave should have stopped because can't find table t1 --source include/wait_for_slave_sql_to_stop.inc # see if we have a good error message: ---replace_column 7 # -source include/show_slave_status.inc; +let $err= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1); +--echo Last_SQL_Error = $err + +--echo ==== Clean up ==== +source include/stop_slave.inc; -# cleanup +--echo [on master] connection master; -drop table t1, t2; +DROP TABLE t1; diff --git a/mysql-test/suite/rpl/t/rpl_row_log_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_row_log_innodb-slave.opt deleted file mode 100644 index 627becdbfb5..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_log_innodb-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb diff --git a/mysql-test/suite/rpl/t/rpl_row_max_relay_size.test b/mysql-test/suite/rpl/t/rpl_row_max_relay_size.test index a0be59e44a7..ea4b958ae4c 100644 --- a/mysql-test/suite/rpl/t/rpl_row_max_relay_size.test +++ b/mysql-test/suite/rpl/t/rpl_row_max_relay_size.test @@ -4,8 +4,7 @@ # Test of manual relay log rotation with FLUSH LOGS. # Requires statement logging --- source include/not_ndb_default.inc -SET SESSION BINLOG_FORMAT=ROW; -SET GLOBAL BINLOG_FORMAT=ROW; --- source extra/rpl_tests/rpl_max_relay_size.test +source include/not_ndb_default.inc; +source include/have_binlog_format_row.inc; +source extra/rpl_tests/rpl_max_relay_size.test; diff --git a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test index 192c1e325bf..62b46eeb58e 100644 --- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test +++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test @@ -37,11 +37,11 @@ CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, --disable_query_log INSERT INTO t1 VALUES ("abirvalg"); -LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; -LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; -LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; -LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; -LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; +LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; +LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; +LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; +LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; +LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; # d1 length 3000 set @d1 = 'dd1'; @@ -96,10 +96,10 @@ select "--- Test 1 Dump binlog to file --" as ""; # # Prepare local temporary file to recreate what we have currently. +let $MYSQLD_DATADIR= `select @@datadir;`; +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/master.sql ---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/master.sql - ---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/master.sql +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/master.sql # Now that we have our file, lets get rid of the current database. # Cleanup the master and the slave and try to recreate. @@ -160,7 +160,7 @@ connection master; # We should be gold by the time, so I will get rid of our file. ---exec rm $MYSQLTEST_VARDIR/tmp/master.sql +remove_file $MYSQLTEST_VARDIR/tmp/master.sql; # this test for position option @@ -168,8 +168,9 @@ connection master; --disable_query_log select "--- Test 2 position test --" as ""; --enable_query_log +let $MYSQLD_DATADIR= `select @@datadir;`; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416 --stop-position=569 $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416 --stop-position=569 $MYSQLD_DATADIR/master-bin.000001 # These are tests for remote binlog. # They should return the same as previous test. @@ -263,14 +264,15 @@ select "--- Test 5 LOAD DATA --" as ""; --disable_query_log select "--- Test 6 reading stdin --" as ""; --enable_query_log +let $MYSQLD_DATADIR= `select @@datadir;`; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL_BINLOG --short-form --stop-position=569 - < $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- Test 7 reading stdin w/position --" as ""; --enable_query_log --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL_BINLOG --short-form --position=416 --stop-position=569 - < $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --position=416 --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001 # Bug#16217 (mysql client did not know how not switch its internal charset) --disable_query_log @@ -299,9 +301,10 @@ create table t4 (f text character set utf8); create table t5 (f text character set cp932); --exec $MYSQL --default-character-set=utf8 test -e "insert into t4 values(_utf8'ソ')" --exec $MYSQL --default-character-set=cp932 test -e "insert into t5 values(_cp932'ƒ\');" +let $MYSQLD_DATADIR= `select @@datadir;`; flush logs; rename table t4 to t04, t5 to t05; ---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 | $MYSQL --default-character-set=utf8 +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL --default-character-set=utf8 # original and recovered data must be equal select HEX(f) from t04; select HEX(f) from t4; @@ -337,10 +340,12 @@ INSERT INTO t1 VALUES(1,1); SELECT * FROM t1; +let $MYSQLD_DATADIR= `select @@datadir;`; + FLUSH LOGS; --exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql ---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/local.sql +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/local.sql --diff_files $MYSQLTEST_VARDIR/tmp/local.sql $MYSQLTEST_VARDIR/tmp/remote.sql diff --git a/mysql-test/suite/rpl/t/rpl_row_mystery22.test b/mysql-test/suite/rpl/t/rpl_row_mystery22.test deleted file mode 100644 index a3ba8648b22..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_mystery22.test +++ /dev/null @@ -1,52 +0,0 @@ -# Originally taken from rpl_mystery22.test, -# but this row-based-replication test has a totally different spirit: -# slave will not stop because of dup key, -# instead we test if it does overwrite the dup key -# as expected. --- source include/have_binlog_format_row.inc --- source include/master-slave.inc - -# first, cause a duplicate key problem on the slave -create table t1(n int auto_increment primary key, s char(10)); -sync_slave_with_master; - -# bug#31552/31609 idempotency is not default any longer -# so that the declared in heading comments aim of the test -# should be backed up with explicit setting of the slave mode -set @@global.slave_exec_mode= 'IDEMPOTENT'; - -insert into t1 values (2,'old'); -connection master; -insert into t1 values(NULL,'new'); -insert into t1 values(NULL,'new'); -save_master_pos; -connection slave; -sync_with_master; -select * from t1 order by n; -delete from t1 where n = 2; ---disable_warnings -start slave; ---enable_warnings -sync_with_master; -stop slave; -connection master; -create table t2(n int); -drop table t2; -insert into t1 values(NULL,'new'); -# what happens when we delete a row which does not exist on slave? -set sql_log_bin=0; -insert into t1 values(NULL,'new'); -set sql_log_bin=1; -delete from t1 where n=4; -save_master_pos; -connection slave; ---disable_warnings -start slave; ---enable_warnings -sync_with_master; -select * from t1 order by n; -#clean up -connection master; -drop table t1; -sync_slave_with_master; -set @@global.slave_exec_mode= default; diff --git a/mysql-test/suite/rpl/t/rpl_row_sp002_innodb-master.opt b/mysql-test/suite/rpl/t/rpl_row_sp002_innodb-master.opt deleted file mode 100644 index 627becdbfb5..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_sp002_innodb-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb diff --git a/mysql-test/suite/rpl/t/rpl_row_sp002_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_row_sp002_innodb-slave.opt deleted file mode 100644 index 627becdbfb5..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_sp002_innodb-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb diff --git a/mysql-test/suite/rpl/t/rpl_row_sp003-master.opt b/mysql-test/suite/rpl/t/rpl_row_sp003-master.opt deleted file mode 100644 index 48457b17309..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_sp003-master.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-innodb diff --git a/mysql-test/suite/rpl/t/rpl_row_sp003-slave.opt b/mysql-test/suite/rpl/t/rpl_row_sp003-slave.opt deleted file mode 100644 index 48457b17309..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_sp003-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-innodb diff --git a/mysql-test/suite/rpl/t/rpl_row_sp005.test b/mysql-test/suite/rpl/t/rpl_row_sp005.test index b118242dc3b..f5a74325b7c 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp005.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp005.test @@ -84,6 +84,7 @@ let $message=< ---- Master selects-- >; --source include/show_msg.inc connection master; CALL test.p1(); + let $wait_condition= SELECT COUNT(*) = 4 FROM t3; --source include/wait_condition.inc save_master_pos; diff --git a/mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB-slave.opt b/mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB-slave.opt deleted file mode 100644 index 627becdbfb5..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb diff --git a/mysql-test/suite/rpl/t/rpl_row_sp007_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_row_sp007_innodb-slave.opt deleted file mode 100644 index 627becdbfb5..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_sp007_innodb-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb diff --git a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test index 29b3008e822..9b24c78e62d 100644 --- a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test +++ b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test @@ -9,18 +9,18 @@ connection master; create table t1 (words varchar(20)) engine=myisam; -load data infile '../std_data_ln/words.dat' into table t1 (words); +load data infile '../../std_data/words.dat' into table t1 (words); select count(*) from t1; save_master_pos; connection slave; -# slave will automatically tell itself to stop thanks to the .opt +# slave will automatically stop the sql thread thanks to the .opt # file; it will initiate the stop request after the first # Rows_log_event (out of 3) but should wait until the last one is # executed before stopping. -wait_for_slave_to_stop; +source include/wait_for_slave_sql_to_stop.inc; # check that we inserted all rows (waited until the last Rows event) select count(*) from t1; @@ -28,4 +28,5 @@ select count(*) from t1; connection master; drop table t1; connection slave; # slave SQL thread is stopped +source include/stop_slave.inc; drop table t1; diff --git a/mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb-slave.opt deleted file mode 100644 index 627becdbfb5..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb diff --git a/mysql-test/suite/rpl/t/rpl_row_until.test b/mysql-test/suite/rpl/t/rpl_row_until.test index bdf7351d9a5..d89de7d9ebd 100644 --- a/mysql-test/suite/rpl/t/rpl_row_until.test +++ b/mysql-test/suite/rpl/t/rpl_row_until.test @@ -9,12 +9,8 @@ let $VERSION=`select version()`; # stop slave before he will start replication also sync with master # for avoiding undetermenistic behaviour -save_master_pos; -connection slave; -sync_with_master; -stop slave; -# Make sure the slave sql and io thread has stopped ---source include/wait_for_slave_to_stop.inc +sync_slave_with_master; +--source include/stop_slave.inc connection master; # create some events on master @@ -53,12 +49,13 @@ connection master; save_master_pos; connection slave; sync_with_master; -stop slave; -# Make sure the slave sql and io thread has stopped ---source include/wait_for_slave_to_stop.inc +--source include/stop_slave.inc # this should stop immediately as we are already there -start slave until master_log_file='master-bin.000001', master_log_pos=740; +start slave sql_thread until master_log_file='master-bin.000001', master_log_pos=740; +--let $slave_param= Until_Log_Pos +--let $slave_param_value= 740 +--source include/wait_for_slave_param.inc --source include/wait_for_slave_sql_to_stop.inc # here the sql slave thread should be stopped --replace_result bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004 @@ -76,5 +73,5 @@ start slave until relay_log_file='slave-relay-bin.000002'; --error 1277 start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561; # Warning should be given for second command -start slave sql_thread; +start slave; start slave until master_log_file='master-bin.000001', master_log_pos=740; diff --git a/mysql-test/suite/rpl/t/rpl_server_id1.test b/mysql-test/suite/rpl/t/rpl_server_id1.test index a0467d93543..c97f7975278 100644 --- a/mysql-test/suite/rpl/t/rpl_server_id1.test +++ b/mysql-test/suite/rpl/t/rpl_server_id1.test @@ -9,7 +9,7 @@ connection slave; reset master; # replicate ourselves -stop slave; +source include/stop_slave.inc; --replace_result $SLAVE_MYPORT SLAVE_PORT eval change master to master_port=$SLAVE_MYPORT; start slave; diff --git a/mysql-test/suite/rpl/t/rpl_server_id2.test b/mysql-test/suite/rpl/t/rpl_server_id2.test index 7e67fb42b4f..488a3aa6ab6 100644 --- a/mysql-test/suite/rpl/t/rpl_server_id2.test +++ b/mysql-test/suite/rpl/t/rpl_server_id2.test @@ -9,9 +9,6 @@ reset master; stop slave; --replace_result $SLAVE_MYPORT SLAVE_PORT eval change master to master_port=$SLAVE_MYPORT; ---replace_result $SLAVE_MYPORT SLAVE_PORT ---replace_column 18 # 35 # 36 # -query_vertical show slave status; start slave; insert into t1 values (1); save_master_pos; @@ -23,4 +20,44 @@ select * from t1; # check that indeed 2 were inserted stop slave; drop table t1; -# End of 4.1 tests + +# +# Bug#38934 slave slave until does not work with --replicate-same-server-id +# +# Verifying that slave performs all events until the master_log_pos +# in presense of --replicate-same-server-id the slave is started with. + +connection master; +reset master; + +# setting the until position to correspond to the first following create table +# which will make the event executed and the slave sql thread stopped +# right after that. +let $until_pos= query_get_value(SHOW MASTER STATUS, Position, 1); +inc $until_pos; + +create table t1(n int); +create table t2(n int); + +connection slave; +--replace_result $MASTER_MYPORT MASTER_PORT +eval change master to master_port=$MASTER_MYPORT; +--replace_result $until_pos UNTIL_POS +eval start slave until master_log_file='master-bin.000001', master_log_pos=$until_pos; +--source include/wait_for_slave_io_to_start.inc +--source include/wait_for_slave_sql_to_stop.inc + +--echo *** checking until postion execution: must be only t1 in the list *** +show tables; + +# cleanup + +connection slave; +start slave sql_thread; + +connection master; +drop table t1; +drop table t2; +sync_slave_with_master; + +# End of tests diff --git a/mysql-test/suite/rpl/t/rpl_slave_grp_exec.test b/mysql-test/suite/rpl/t/rpl_slave_grp_exec.test new file mode 100644 index 00000000000..1a0ff8d52f0 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_slave_grp_exec.test @@ -0,0 +1,176 @@ +############################################################# +# Author: Serge Kozlov <skozlov@mysql.com> +# Date: 03/21/2008 +# Purpose: +# WL#3734 Test: slave group execution +# Testing slave group execution: stop in middle of the group +# (of events) should be immpossible on slave. +# Group of events means set of statements between BEGIN/COMMIT +# for transactional engines or a statement for +# non-transactional engines that fires triggers and +# affects to another tables. +# Implementation of slave stop in middle of the group: +# Delete the table on slave before start of the group +# on master where this table is participant of the group. +# So sql thread will failed inside of the group. +# Expected results: +# 1. For non-transactional engines w/o PK slave should trying +# to complete executing of the group. +# 2. For non-transactional engines slave should stop on +# start position of the group. +############################################################# +--source include/have_innodb.inc +--source include/master-slave.inc +--echo + +# Create tables and data +--echo *** Preparing data *** +--connection master +CREATE TABLE t1 (a INT NOT NULL, b VARCHAR(10)) ENGINE=MyISAM; +CREATE TABLE t2 LIKE t1; +CREATE TABLE t3 LIKE t1; + +DELIMITER |; +CREATE TRIGGER tr1 BEFORE UPDATE ON t1 + FOR EACH ROW BEGIN + UPDATE t2 SET b='YY' WHERE a=NEW.a; + END| +CREATE TRIGGER tr2 AFTER UPDATE ON t1 + FOR EACH ROW BEGIN + UPDATE t3 SET b='ZZ' WHERE a=NEW.a; + END| +DELIMITER ;| +--echo + +# Test non-transactional group with MyISAM tables w/o PK. +# Data for t1,t2 should be replicated for SBR even t3 +# doesn't exist on slave +--echo *** Test non-transactional group w/o PK *** + +--connection master +INSERT INTO t3 VALUES(1, 'AA'); +INSERT INTO t2 VALUES(1, 'AA'); +INSERT INTO t1 VALUES(1, 'AA'); +--sync_slave_with_master + +RENAME TABLE t3 TO t3_bak; + +--connection master +UPDATE t1 SET b = 'XX' WHERE a = 1; +SELECT * FROM t1 ORDER BY a; +SELECT * FROM t2 ORDER BY a; +SELECT * FROM t3 ORDER BY a; + +--connection slave +--source include/wait_for_slave_sql_to_stop.inc +SHOW TABLES LIKE 't%'; +if (`SELECT @@BINLOG_FORMAT = 'ROW'`) { +--replace_regex /AA/AA_for_row_or_XX_for_stmt_mixed/ + SELECT * FROM t1 ORDER BY a; +--replace_regex /AA/AA_for_row_or_YY_for_stmt_mixed/ + SELECT * FROM t2 ORDER BY a; +} +if (!`SELECT @@BINLOG_FORMAT = 'ROW'`) { +--replace_regex /XX/AA_for_row_or_XX_for_stmt_mixed/ + SELECT * FROM t1 ORDER BY a; +--replace_regex /YY/AA_for_row_or_YY_for_stmt_mixed/ + SELECT * FROM t2 ORDER BY a; +} + +--source include/stop_slave.inc +RENAME TABLE t3_bak TO t3; +--source include/start_slave.inc + +--connection master +TRUNCATE t1; +TRUNCATE t2; +TRUNCATE t3; +--sync_slave_with_master +--echo + + +# Test non-transactional group with MyISAM tables and PK. +# No data replicated because update based on PK +--echo *** Test non-transactional group w/ PK *** + +--connection master +ALTER TABLE t1 ADD PRIMARY KEY (a); +ALTER TABLE t2 ADD PRIMARY KEY (a); +ALTER TABLE t3 ADD PRIMARY KEY (a); +--sync_slave_with_master +RENAME TABLE t3 TO t3_bak; + +--connection master +INSERT INTO t3 VALUES(2, 'B'); +INSERT INTO t2 VALUES(2, 'B'); +INSERT INTO t1 VALUES(2, 'B'); +UPDATE t1 SET b = 'X' WHERE a = 2; + +--connection slave +--source include/wait_for_slave_sql_to_stop.inc + +--connection master +SELECT * FROM t1 ORDER BY a; +SELECT * FROM t2 ORDER BY a; +SELECT * FROM t3 ORDER BY a; + +--connection slave +SHOW TABLES LIKE 't%'; +SELECT * FROM t1 ORDER BY a; +SELECT * FROM t2 ORDER BY a; + +--source include/stop_slave.inc +RENAME TABLE t3_bak TO t3; +--source include/start_slave.inc + +--connection master +TRUNCATE t1; +TRUNCATE t2; +TRUNCATE t3; +--sync_slave_with_master +--echo + + +# Test transactional group with InnoDB tables with PK +# No data replicated if errors happens inside transaction +--echo *** Test transactional group w/ PK *** + +--connection master +ALTER TABLE t1 ENGINE=InnoDB; +ALTER TABLE t2 ENGINE=InnoDB; +ALTER TABLE t3 ENGINE=InnoDB; + +--connection slave +RENAME TABLE t3 TO t3_bak; + +--connection master +BEGIN; +INSERT INTO t1 VALUES (3, 'C'), (4, 'D'); +INSERT INTO t2 VALUES (3, 'C'), (4, 'D'); +INSERT INTO t3 VALUES (3, 'C'), (4, 'D'); +COMMIT; + +--connection slave +--source include/wait_for_slave_sql_to_stop.inc + +--connection master +SELECT * FROM t1 ORDER BY a; +SELECT * FROM t2 ORDER BY a; +SELECT * FROM t3 ORDER BY a; + +--connection slave +SHOW TABLES LIKE 't%'; +SELECT * FROM t1 ORDER BY a; +SELECT * FROM t2 ORDER BY a; + +source include/stop_slave.inc; +RENAME TABLE t3_bak TO t3; +source include/start_slave.inc; + +# Clean up +--echo *** Clean up *** +--connection master +DROP TABLE t1,t2,t3; +--sync_slave_with_master + +# End of 5.1 test diff --git a/mysql-test/suite/rpl/t/rpl_slave_skip-slave.opt b/mysql-test/suite/rpl/t/rpl_slave_skip-slave.opt deleted file mode 100644 index 627becdbfb5..00000000000 --- a/mysql-test/suite/rpl/t/rpl_slave_skip-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb diff --git a/mysql-test/suite/rpl/t/rpl_slave_skip.test b/mysql-test/suite/rpl/t/rpl_slave_skip.test index 8a5b1ae0ae4..f4cb0f69e93 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_skip.test +++ b/mysql-test/suite/rpl/t/rpl_slave_skip.test @@ -110,8 +110,7 @@ DELIMITER ;| --echo **** On Slave **** sync_slave_with_master; -STOP SLAVE; -source include/wait_for_slave_to_stop.inc; +source include/stop_slave.inc; --echo **** On Master **** connection master; @@ -121,6 +120,7 @@ DROP TRIGGER tr2; INSERT INTO t1 VALUES (3,'master/slave'); INSERT INTO t2 VALUES (3,'master/slave'); INSERT INTO t3 VALUES (3,'master/slave'); +COMMIT; SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; @@ -131,8 +131,7 @@ save_master_pos; --echo *** On Slave *** connection slave; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -START SLAVE; -source include/wait_for_slave_to_start.inc; +source include/start_slave.inc; sync_with_master; SELECT * FROM t1 ORDER BY a; @@ -156,8 +155,7 @@ CREATE TABLE t6 (a INT, b VARCHAR(20)) ENGINE=innodb; --echo **** On Slave **** sync_slave_with_master; -STOP SLAVE; -source include/wait_for_slave_to_stop.inc; +source include/stop_slave.inc; --echo *** On Master *** connection master; @@ -182,8 +180,7 @@ save_master_pos; --echo *** On Slave *** connection slave; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -START SLAVE; -source include/wait_for_slave_to_start.inc; +source include/start_slave.inc; sync_with_master; SELECT * FROM t4 ORDER BY a; @@ -194,8 +191,7 @@ SELECT * FROM t6 ORDER BY a; --echo **** On Slave **** connection slave; -STOP SLAVE; -source include/wait_for_slave_to_stop.inc; +source include/stop_slave.inc; --echo *** On Master *** connection master; @@ -220,8 +216,7 @@ save_master_pos; --echo *** On Slave *** connection slave; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=10; -START SLAVE; -source include/wait_for_slave_to_start.inc; +source include/start_slave.inc; sync_with_master; SELECT * FROM t4 ORDER BY a; @@ -232,8 +227,7 @@ SELECT * FROM t6 ORDER BY a; # And the same, but with autocommit = 0 # connection slave; -STOP SLAVE; -source include/wait_for_slave_to_stop.inc; +source include/stop_slave.inc; connection master; SET AUTOCOMMIT=0; @@ -257,8 +251,7 @@ save_master_pos; --echo *** On Slave *** connection slave; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -START SLAVE; -source include/wait_for_slave_to_start.inc; +source include/start_slave.inc; sync_with_master; SELECT * FROM t4 ORDER BY a; @@ -280,16 +273,14 @@ CREATE TABLE t10 (a INT, b VARCHAR(20)) ENGINE=myisam; --echo *** On Slave *** sync_slave_with_master; -STOP SLAVE; -source include/wait_for_slave_to_stop.inc; +source include/stop_slave.inc; --echo *** On Master *** connection master; SET SESSION BINLOG_FORMAT=STATEMENT; -exec cp ./suite/rpl/data/rpl_bug28618.dat $MYSQLTEST_VARDIR/tmp/; + --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/rpl_bug28618.dat' INTO TABLE t10 FIELDS TERMINATED BY '|'; -remove_file $MYSQLTEST_VARDIR/tmp/rpl_bug28618.dat; +eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data/rpl_bug28618.dat' INTO TABLE t10 FIELDS TERMINATED BY '|'; SELECT * FROM t10 ORDER BY a; @@ -298,8 +289,7 @@ save_master_pos; --echo *** On Slave *** connection slave; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -START SLAVE; -source include/wait_for_slave_to_start.inc; +source include/start_slave.inc; sync_with_master; SELECT * FROM t10 ORDER BY a; diff --git a/mysql-test/suite/rpl/t/rpl_slave_status.test b/mysql-test/suite/rpl/t/rpl_slave_status.test index 46836382ac4..4edf1802a5d 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_status.test +++ b/mysql-test/suite/rpl/t/rpl_slave_status.test @@ -23,39 +23,36 @@ --echo ==== Create new replication user ==== --echo [on master] connection master; -grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl'; +GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY 'rpl'; --echo [on slave] sync_slave_with_master; -stop slave; -source include/wait_for_slave_to_stop.inc; -change master to master_user='rpl',master_password='rpl'; -start slave; -source include/wait_for_slave_to_start.inc; +source include/stop_slave.inc; +CHANGE MASTER TO master_user='rpl', master_password='rpl'; +source include/start_slave.inc; --echo ==== Do replication as new user ==== --echo [on master] connection master; -create table t1 (n int); -insert into t1 values (1); +CREATE TABLE t1 (n INT); +INSERT INTO t1 VALUES (1); --echo [on slave] sync_slave_with_master; -select * from t1; +SELECT * FROM t1; --echo ==== Delete new replication user ==== --echo [on master] connection master; -drop user rpl@127.0.0.1; -flush privileges; +DROP USER rpl@127.0.0.1; +FLUSH PRIVILEGES; --echo [on slave] sync_slave_with_master; --echo ==== Restart slave without privileges ===== # (slave.err will contain access denied error for this START SLAVE command) -stop slave; -source include/wait_for_slave_to_stop.inc; -start slave; +source include/stop_slave.inc; +START SLAVE; source include/wait_for_slave_sql_to_start.inc; --echo ==== Verify that Slave_IO_Running = No ==== @@ -63,11 +60,10 @@ let $result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1); --echo Slave_IO_Running = $result (should be No) --echo ==== Cleanup (Note that slave IO thread is not running) ==== -drop table t1; -delete from mysql.user where user='rpl'; +DROP TABLE t1; # cleanup: slave io thread has been stopped "irrecoverably" # so we clean up mess manually --echo [on master] connection master; -drop table t1; +DROP TABLE t1; diff --git a/mysql-test/suite/rpl/t/rpl_sp.test b/mysql-test/suite/rpl/t/rpl_sp.test index acf50d59b85..ec6464fb095 100644 --- a/mysql-test/suite/rpl/t/rpl_sp.test +++ b/mysql-test/suite/rpl/t/rpl_sp.test @@ -11,6 +11,7 @@ source include/have_binlog_format_mixed.inc; source include/master-slave.inc; + # we need a db != test, where we don't have automatic grants --disable_warnings drop database if exists mysqltest1; @@ -240,6 +241,8 @@ begin end| delimiter ;| connection master; +set @old_log_bin_trust_routine_creators= @@global.log_bin_trust_routine_creators; +set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; # test old variable name: set global log_bin_trust_routine_creators=1; # now use new name: @@ -247,6 +250,8 @@ set global log_bin_trust_function_creators=0; set global log_bin_trust_function_creators=1; # slave needs it too otherwise will not execute what master allowed: connection slave; +set @old_log_bin_trust_routine_creators= @@global.log_bin_trust_routine_creators; +set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; set global log_bin_trust_function_creators=1; connection con1; @@ -571,9 +576,12 @@ show binlog events in 'master-bin.000001' from 106; # Restore log_bin_trust_function_creators to its original value. # This is a cleanup for all parts above where we tested stored # functions and triggers. -set global log_bin_trust_function_creators=0; +connection slave; +set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators; +set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; connection master; -set global log_bin_trust_function_creators=0; +set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators; +set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; # Clean up drop database mysqltest; @@ -625,8 +633,9 @@ show function status like '%mysqltestbug36570%'; connection master; flush logs; +let $MYSQLD_DATADIR= `select @@datadir`; --replace_regex s/$MYSQL_TEST_DIR/MYSQL_TEST_DIR/ s/TIMESTAMP=[0-9]*/TIMESTAMP=t/ ---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 use test; drop procedure mysqltestbug36570_p1; drop procedure ` mysqltestbug36570_p2`; diff --git a/mysql-test/suite/rpl/t/rpl_sp_effects.test b/mysql-test/suite/rpl/t/rpl_sp_effects.test index c1092e3260f..63ac3a8ad9c 100644 --- a/mysql-test/suite/rpl/t/rpl_sp_effects.test +++ b/mysql-test/suite/rpl/t/rpl_sp_effects.test @@ -10,6 +10,8 @@ # **************************************************************** connection master; +SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; + # cleanup --disable_warnings drop procedure if exists p1; @@ -254,8 +256,8 @@ drop table t2; drop procedure sp_bug26199; drop function sf_bug26199; -sync_slave_with_master; +SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; -SET GLOBAL log_bin_trust_function_creators = 0; +sync_slave_with_master; --echo end of the tests diff --git a/mysql-test/suite/rpl/t/rpl_start_stop_slave.test b/mysql-test/suite/rpl/t/rpl_start_stop_slave.test index 93c613f4cf4..dbf0775c978 100644 --- a/mysql-test/suite/rpl/t/rpl_start_stop_slave.test +++ b/mysql-test/suite/rpl/t/rpl_start_stop_slave.test @@ -25,6 +25,7 @@ let $wait_condition= SELECT COUNT(*) > 0 FROM t1; source include/wait_condition.inc; stop slave io_thread; start slave io_thread; +source include/wait_for_slave_to_start.inc; sync_with_master; connection master; diff --git a/mysql-test/suite/rpl/t/rpl_stm_000001-slave.opt b/mysql-test/suite/rpl/t/rpl_stm_000001-slave.opt deleted file mode 100644 index 48457b17309..00000000000 --- a/mysql-test/suite/rpl/t/rpl_stm_000001-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-innodb diff --git a/mysql-test/suite/rpl/t/rpl_stm_conflicts.test b/mysql-test/suite/rpl/t/rpl_stm_conflicts.test new file mode 100644 index 00000000000..07b7a0bf8f7 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_stm_conflicts.test @@ -0,0 +1,11 @@ +# See the top of mysql-test/extra/rpl_tests/rpl_conflicts.test for an +# explanation of what this test does. +# +# This test file is for statement-logging mode. + +source include/have_binlog_format_mixed_or_statement.inc; +source include/master-slave.inc; + +source extra/rpl_tests/rpl_conflicts.test; + +source include/master-slave-end.inc; diff --git a/mysql-test/suite/rpl/t/rpl_stm_mystery22.test b/mysql-test/suite/rpl/t/rpl_stm_mystery22.test deleted file mode 100644 index b43a734fffc..00000000000 --- a/mysql-test/suite/rpl/t/rpl_stm_mystery22.test +++ /dev/null @@ -1,66 +0,0 @@ -################################ -# Change Author: JBM -# Change Date: 2006-01-12 -# Change: Added back have stm binlog -# and added requirments comments -################################ -# test case to make slave thread get ahead by 22 bytes -################################ -#REQUIREMENT: If there is a faked slave duplicate key insert -#error and the slave is restarted, the replication should -#proceed in a correct way. -################################ -#REQUIREMENT: If there is a faked slave non-existing record -#delete error and the slave is restarted, then the replication -#should proceed in a correct way. -################################# - --- source include/have_binlog_format_mixed_or_statement.inc --- source include/master-slave.inc - -# first, cause a duplicate key problem on the slave -create table t1(n int auto_increment primary key, s char(10)); -sync_slave_with_master; -insert into t1 values (2,'old'); -connection master; -insert into t1 values(NULL,'new'); -insert into t1 values(NULL,'new'); -save_master_pos; -connection slave; -# wait until the slave tries to run the query, fails and aborts slave thread -source include/wait_for_slave_sql_error.inc; -select * from t1 order by n; -delete from t1 where n = 2; ---disable_warnings -start slave; ---enable_warnings -sync_with_master; -#now the buggy slave would be confused on the offset but it can replicate -#in order to make it break, we need to stop/start the slave one more time -stop slave; -connection master; -# to be able to really confuse the slave, we need some non-auto-increment -# events in the log -create table t2(n int); -drop table t2; -insert into t1 values(NULL,'new'); -# what happens when we delete a row which does not exist on slave? -set sql_log_bin=0; -insert into t1 values(NULL,'new'); -set sql_log_bin=1; -delete from t1 where n=4; -save_master_pos; -connection slave; ---disable_warnings -start slave; ---enable_warnings -#now the truth comes out - if the slave is buggy, it will never sync because -#the slave thread is not able to read events -sync_with_master; -select * from t1 order by n; -#clean up -connection master; -drop table t1; -sync_slave_with_master; - -# End of 4.1 tests diff --git a/mysql-test/suite/rpl/t/rpl_stm_until.test b/mysql-test/suite/rpl/t/rpl_stm_until.test index 2793e8833fd..07a3b27763d 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_until.test +++ b/mysql-test/suite/rpl/t/rpl_stm_until.test @@ -1,22 +1,37 @@ +# ==== Purpose ==== +# +# Verify that START SLAVE UNTIL replicates until the given binlog +# position but not longer. Verify that START SLAVE UNTIL with various +# incorrect arguments gives an error. +# +# ==== Method ==== +# +# On master, create a table and insert some rows. On slave, START +# SLAVE UNTIL so that it reads one event at a time, and check the +# table and the slave status each time. +# +# Then, on slave, run START SLAVE UNTIL with incorrect arguments and +# verify that it gives an error. +# +# ==== Related bugs ==== +# +# Bug in this test: BUG#37717: rpl.rpl_stm_until 'stmt' fails sporadically on pushbuild + -- source include/have_binlog_format_mixed_or_statement.inc -- source include/master-slave.inc # Test is dependent on binlog positions -# prepare version for substitutions -let $VERSION=`select version()`; +# Stop slave before it starts replication. Also sync with master +# to avoid nondeterministic behaviour. +--echo [on slave] +sync_slave_with_master; +--source include/stop_slave.inc -# stop slave before he will start replication also sync with master -# for avoiding undetermenistic behaviour -save_master_pos; -connection slave; -sync_with_master; -stop slave; -# Make sure the slave sql and io thread has stopped ---source include/wait_for_slave_to_stop.inc +--echo ==== Create some events on master ==== +--echo [on master] connection master; -# create some events on master create table t1(n int not null auto_increment primary key); insert into t1 values (1),(2),(3),(4); drop table t1; @@ -25,9 +40,13 @@ insert into t2 values (1),(2); insert into t2 values (3),(4); drop table t2; +--echo ==== Replicate one event at a time on slave ==== + # try to replicate all queries until drop of t1 +--echo [on slave] connection slave; start slave until master_log_file='master-bin.000001', master_log_pos=323; +--source include/wait_for_slave_io_to_start.inc --source include/wait_for_slave_sql_to_stop.inc # here table should be still not deleted select * from t1; @@ -35,6 +54,7 @@ source include/show_slave_status2.inc; # this should fail right after start start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291; +--source include/wait_for_slave_io_to_start.inc --source include/wait_for_slave_sql_to_stop.inc # again this table should be still not deleted select * from t1; @@ -42,28 +62,28 @@ source include/show_slave_status2.inc; # try replicate all up to and not including the second insert to t2; start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=746; +--source include/wait_for_slave_io_to_start.inc --source include/wait_for_slave_sql_to_stop.inc select * from t2; source include/show_slave_status2.inc; # clean up start slave; +--echo [on master] connection master; -save_master_pos; -connection slave; -sync_with_master; -stop slave; -# Make sure the slave sql and io thread has stopped ---source include/wait_for_slave_to_stop.inc +--echo [on slave] +sync_slave_with_master; +--source include/stop_slave.inc # this should stop immediately as we are already there start slave until master_log_file='master-bin.000001', master_log_pos=776; +--source include/wait_for_slave_io_to_start.inc --source include/wait_for_slave_sql_to_stop.inc -# here the sql slave thread should be stopped --replace_result bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004 source include/show_slave_status2.inc; -#testing various error conditions +--echo ==== Test various error conditions ==== + --error 1277 start slave until master_log_file='master-bin', master_log_pos=561; --error 1277 @@ -78,4 +98,3 @@ start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561; start slave sql_thread; start slave until master_log_file='master-bin.000001', master_log_pos=776; -# End of 4.1 tests diff --git a/mysql-test/suite/rpl/t/rpl_temporary.test b/mysql-test/suite/rpl/t/rpl_temporary.test index a40d1cbb5c5..0bf3ecf97a2 100644 --- a/mysql-test/suite/rpl/t/rpl_temporary.test +++ b/mysql-test/suite/rpl/t/rpl_temporary.test @@ -16,6 +16,10 @@ source include/add_anonymous_users.inc; # (otherwise RESET MASTER may come too early). save_master_pos; connection slave; + +# Add suppression for expected warning(s) in slaves error log +call mtr.add_suppression("Slave: Can\'t find record in \'user\' Error_code: 1032"); + sync_with_master; reset master; connection master; diff --git a/mysql-test/suite/rpl/t/rpl_temporary_errors.test b/mysql-test/suite/rpl/t/rpl_temporary_errors.test index f38ed29f7d4..3b373e00a62 100644 --- a/mysql-test/suite/rpl/t/rpl_temporary_errors.test +++ b/mysql-test/suite/rpl/t/rpl_temporary_errors.test @@ -1,5 +1,7 @@ source include/master-slave.inc; +call mtr.add_suppression("Deadlock found"); + --echo **** On Master **** connection master; SET SESSION BINLOG_FORMAT=ROW; diff --git a/mysql-test/suite/rpl/t/rpl_timezone.test b/mysql-test/suite/rpl/t/rpl_timezone.test index dac21000a62..d65242f2a22 100644 --- a/mysql-test/suite/rpl/t/rpl_timezone.test +++ b/mysql-test/suite/rpl/t/rpl_timezone.test @@ -67,7 +67,7 @@ connection master; connection master; delete from t1; set time_zone='UTC'; -load data infile '../std_data_ln/rpl_timezone2.dat' into table t1; +load data infile '../../std_data/rpl_timezone2.dat' into table t1; SELECT * FROM t1 ORDER BY n; sync_slave_with_master; set time_zone='UTC'; diff --git a/mysql-test/suite/rpl/t/rpl_trigger.test b/mysql-test/suite/rpl/t/rpl_trigger.test index 911110d17dc..1317e6b6289 100644 --- a/mysql-test/suite/rpl/t/rpl_trigger.test +++ b/mysql-test/suite/rpl/t/rpl_trigger.test @@ -300,8 +300,10 @@ STOP SLAVE; # Replace master's binlog. connection master; +let $MYSQLD_DATADIR= `select @@datadir`; FLUSH LOGS; -exec cp $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLTEST_VARDIR/log/master-bin.000001; +remove_file $MYSQLD_DATADIR/master-bin.000001; +copy_file $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLD_DATADIR/master-bin.000001; # Make the slave to replay the new binlog. @@ -467,20 +469,49 @@ drop trigger if exists t1_bi; insert into t1 values (3, "c"); select * from t1; - -save_master_pos; -connection slave; -sync_with_master; - +sync_slave_with_master; select * from t1; connection master; drop table t1; +sync_slave_with_master; # -# End of tests +# Bug#40116: Uncommited changes are replicated and stay on slave after +# rollback on master # -save_master_pos; + +connection master; +source include/master-slave-reset.inc; +source include/have_innodb.inc; connection slave; -sync_with_master; +source include/have_innodb.inc; + +connection master; +create table t1 ( f int ) engine = innodb; +create table log ( r int ) engine = myisam; +create trigger tr + after insert on t1 + for each row insert into log values ( new.f ); + +set autocommit = 0; +insert into t1 values ( 1 ); +rollback; +sync_slave_with_master; + +let $diff_table_1=master:test.t1; +let $diff_table_2=slave:test.t1; +--source include/diff_tables.inc + +let $diff_table_1=master:test.log; +let $diff_table_2=slave:test.log; +--source include/diff_tables.inc + +connection master; +drop table t1, log; +sync_slave_with_master; + +# +# End of tests +# diff --git a/mysql-test/suite/rpl_ndb/my.cnf b/mysql-test/suite/rpl_ndb/my.cnf new file mode 100644 index 00000000000..58fec36eedd --- /dev/null +++ b/mysql-test/suite/rpl_ndb/my.cnf @@ -0,0 +1,75 @@ +!include include/default_mysqld.cnf +!include include/default_ndbd.cnf + +[cluster_config.1] +NoOfReplicas= 2 +ndbd=, +ndb_mgmd= +mysqld=, + +[cluster_config.slave] +NoOfReplicas= 1 +ndbd= +ndb_mgmd= +mysqld= + +[mysqld] +# Make all mysqlds use cluster +ndbcluster +# Turn on bin logging +log-bin= master-bin + +[mysqld.1.1] + +[mysqld.1.1] + +[mysqld.1.slave] + +# Append <testname>-slave.opt file to the list of argument used when +# starting the mysqld +#!use-slave-opt + +# Connect mysqld in the second cluster as save to first mysqld +# Hardcode the host to 127.0.0.1 until running on more +# than one host and it probably need to be masked anyway +# master-host= @mysqld.1.#host +master-host= 127.0.0.1 +master-port= @mysqld.1.1.port +master-password= @mysqld.1.1.#password +master-user= @mysqld.1.1.#user +master-connect-retry= 1 + +log-bin= slave-bin +relay-log= slave-relay-bin + +init-rpl-role= slave +log-slave-updates +master-retry-count= 10 + +# Values reported by slave when it connect to master +# and shows up in SHOW SLAVE STATUS; +report-host= 127.0.0.1 +report-port= @mysqld.1.slave.port +report-user= root + +loose-skip-innodb +skip-slave-start + +# 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. +slave-load-tmpdir= ../../../tmp + +rpl-recovery-rank= @mysqld.1.slave.server-id + + +[ENV] +NDB_CONNECTSTRING= @mysql_cluster.1.ndb_connectstring +MASTER_MYPORT= @mysqld.1.1.port +MASTER_MYPORT1= @mysqld.2.1.port + +NDB_CONNECTSTRING_SLAVE= @mysql_cluster.slave.ndb_connectstring +SLAVE_MYPORT= @mysqld.1.slave.port +SLAVE_MYSOCK= @mysqld.1.slave.socket + +NDB_BACKUP_DIR= @cluster_config.ndbd.1.1.BackupDataDir diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result index 84b60b599d8..28ca1ac43b9 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result @@ -8,6 +8,7 @@ SET storage_engine=ndb; === NDB -> MYISAM === +set @old_slave_exec_mode= @@global.slave_exec_mode; set @@global.slave_exec_mode= 'IDEMPOTENT'; CREATE TABLE mysql.ndb_apply_status ( server_id INT UNSIGNED NOT NULL, @@ -803,3 +804,4 @@ TRUNCATE TABLE t1; --- Do Cleanup -- DROP TABLE IF EXISTS t1; drop table mysql.ndb_apply_status; +set @@global.slave_exec_mode= @old_slave_exec_mode; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result index b5b3dc6b66c..b16a63ec5ad 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result @@ -180,7 +180,7 @@ Last_IO_Error <Last_IO_Error> Last_SQL_Errno <Last_SQL_Errno> Last_SQL_Error <Last_SQL_Error> set GLOBAL slave_transaction_retries=10; -START SLAVE; +include/start_slave.inc select * from t1 order by nid; nid nom prenom 1 LOCK ABC1 diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result index e4b5e9b9216..2daacb351a9 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result @@ -52,8 +52,8 @@ Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 -Last_IO_Error +Last_IO_Errno # +Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error SELECT * FROM t1 ORDER BY a; @@ -95,8 +95,8 @@ Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 -Last_IO_Error +Last_IO_Errno # +Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error STOP SLAVE; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_2ch.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_2ch.result new file mode 100644 index 00000000000..bb662542a56 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_2ch.result @@ -0,0 +1,102 @@ +STOP SLAVE; +STOP SLAVE; +STOP SLAVE; +STOP SLAVE; +DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; +RESET MASTER; +DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; +RESET MASTER; +DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; +RESET MASTER; +DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; +RESET MASTER; +RESET SLAVE; +CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_MYPORT,master_user='root'; +START SLAVE; +RESET SLAVE; +CHANGE MASTER TO master_host='127.0.0.1',master_port=SLAVE_MYPORT1,master_user='root'; +START SLAVE; + +*** Check server_id of mysqld servers *** +SHOW VARIABLES LIKE "server_id"; +Variable_name Value +server_id 1 +SET auto_increment_offset = 1; +SET auto_increment_increment = 2; +SHOW VARIABLES LIKE "server_id"; +Variable_name Value +server_id 1 +SET auto_increment_offset = 1; +SET auto_increment_increment = 2; +SHOW VARIABLES LIKE "server_id"; +Variable_name Value +server_id 2 +SET auto_increment_offset = 2; +SET auto_increment_increment = 2; +SHOW VARIABLES LIKE "server_id"; +Variable_name Value +server_id 2 +SET auto_increment_offset = 2; +SET auto_increment_increment = 2; + +*** Preparing data *** +CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=ndb; + +*** Basic testing *** +Insert rows via all hosts +Check data on both clusters +* Cluster A * +SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 1 GROUP BY b ORDER BY b; +COUNT(*) SUM(a) b +10 190 master +10 210 master1 +10 200 slave +10 220 slave1 +* Cluster B * +SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 1 GROUP BY b ORDER BY b; +COUNT(*) SUM(a) b +10 190 master +10 210 master1 +10 200 slave +10 220 slave1 + +*** Transaction testing *** +BEGIN; +BEGIN; +COMMIT; +COMMIT; +Check data on both clusters +* Cluster A * +SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 2 GROUP BY b ORDER BY b; +COUNT(*) SUM(a) b +100 23900 master +100 24100 master1 +100 24000 slave +100 24200 slave1 +* Cluster B * +SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 2 GROUP BY b ORDER BY b; +COUNT(*) SUM(a) b +100 23900 master +100 24100 master1 +100 24000 slave +100 24200 slave1 + +BEGIN; +BEGIN; +ROLLBACK; +ROLLBACK; +Check data on both clusters +* Cluster A * +SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 3 GROUP BY b ORDER BY b; +COUNT(*) SUM(a) b +100 64100 master1 +100 64000 slave +* Cluster B * +SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 3 GROUP BY b ORDER BY b; +COUNT(*) SUM(a) b +100 64100 master1 +100 64000 slave + +DROP TABLE t1; +DROP TABLE IF EXISTS t1; + diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result index 18c00583df1..01f8d94da48 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result @@ -49,8 +49,8 @@ Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 -Last_IO_Error +Last_IO_Errno # +Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error SELECT * FROM t1 ORDER BY a; @@ -98,7 +98,7 @@ Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 -Last_IO_Error +Last_IO_Errno # +Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result index 75151f45419..a6e2144f532 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result @@ -11,8 +11,6 @@ show variables like "%character_set_ser%"; Variable_name Value character_set_server ucs2 DROP TABLE IF EXISTS t1; -create table t1 (a int) ENGINE=NDB; -drop table t1; CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0', `nom` char(4) default NULL, `prenom` char(4) default NULL, @@ -25,3 +23,5 @@ nid nom prenom select * from t1 order by nid; nid nom prenom 1 XYZ1 ABC1 +==== clean up ==== +DROP TABLE t1; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result index 148e6247b03..7c3f331958f 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result @@ -23,11 +23,11 @@ select count(*) from t2; count(*) 0 begin; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t2; +load data infile '../../../std_data/rpl_loaddata.dat' into table t2; Warnings: Warning 1262 Row 1 was truncated; it contained more data than there were input columns Warning 1262 Row 2 was truncated; it contained more data than there were input columns -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; +load data infile '../../../std_data/rpl_loaddata.dat' into table t1; Warnings: Warning 1262 Row 1 was truncated; it contained more data than there were input columns Warning 1262 Row 2 was truncated; it contained more data than there were input columns @@ -49,11 +49,11 @@ count(*) delete from t1; delete from t2; begin; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t2; +load data infile '../../../std_data/rpl_loaddata.dat' into table t2; Warnings: Warning 1262 Row 1 was truncated; it contained more data than there were input columns Warning 1262 Row 2 was truncated; it contained more data than there were input columns -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; +load data infile '../../../std_data/rpl_loaddata.dat' into table t1; Warnings: Warning 1262 Row 1 was truncated; it contained more data than there were input columns Warning 1262 Row 2 was truncated; it contained more data than there were input columns @@ -77,11 +77,11 @@ delete from t2; begin; insert into t2 values(3),(4); insert into t1 values(3),(4); -load data infile '../std_data_ln/rpl_loaddata.dat' into table t2; +load data infile '../../../std_data/rpl_loaddata.dat' into table t2; Warnings: Warning 1262 Row 1 was truncated; it contained more data than there were input columns Warning 1262 Row 2 was truncated; it contained more data than there were input columns -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; +load data infile '../../../std_data/rpl_loaddata.dat' into table t1; Warnings: Warning 1262 Row 1 was truncated; it contained more data than there were input columns Warning 1262 Row 2 was truncated; it contained more data than there were input columns diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result index 18558c57140..6a2e3e80a20 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result @@ -4,7 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -stop slave; +include/stop_slave.inc reset master; reset slave; start slave; @@ -12,7 +12,7 @@ create table t1(n int not null auto_increment primary key)ENGINE=NDB; insert into t1 values (NULL); drop table t1; create table t1 (word char(20) not null)ENGINE=NDB; -load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines; +load data infile 'LOAD_FILE' into table t1 ignore 1 lines; select count(*) from t1; count(*) 69 @@ -117,10 +117,6 @@ Aberdeen Abernathy aberrant aberration - -let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ; - ---source include/wait_slave_status.inc select * from t1 order by 1 asc; word Aarhus @@ -193,7 +189,8 @@ Abernathy aberrant aberration flush logs; -stop slave; +include/stop_slave.inc +include/start_slave.inc create table t2 (n int)ENGINE=NDB; insert into t2 values (1); show binlog events from <binlog_start>; @@ -229,7 +226,6 @@ show binary logs; Log_name File_size master-bin.000001 1760 master-bin.000002 623 -start slave; show binary logs; Log_name File_size slave-bin.000001 1855 @@ -308,13 +304,23 @@ ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find tar DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; +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 table t1(a int auto_increment primary key, b int); insert into t1 values (NULL, 1); -reset master; set insert_id=5; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id()); show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; create table t1(a int auto_increment primary key, b int) +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result new file mode 100644 index 00000000000..da60b0bbbbf --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result @@ -0,0 +1,457 @@ +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 TABLE tmyisam (a int) ENGINE = MYISAM; +CREATE TABLE tinnodb (a int) ENGINE = INNODB; +CREATE TABLE tndb (a int) ENGINE = NDB; +SHOW CREATE TABLE tmyisam; +Table Create Table +tmyisam CREATE TABLE `tmyisam` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SHOW CREATE TABLE tinnodb; +Table Create Table +tinnodb CREATE TABLE `tinnodb` ( + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW CREATE TABLE tndb; +Table Create Table +tndb CREATE TABLE `tndb` ( + `a` int(11) DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 +[on master] +==== Single-engine transactions ==== +---- autocommitted ---- +SET AUTOCOMMIT = 1; +INSERT INTO tmyisam VALUES (0); +INSERT INTO tinnodb VALUES (1); +INSERT INTO tndb VALUES (2); +---- committed with BEGIN ---- +BEGIN; +INSERT INTO tmyisam VALUES (3); +INSERT INTO tmyisam VALUES (4); +COMMIT; +BEGIN; +INSERT INTO tinnodb VALUES (5); +INSERT INTO tinnodb VALUES (6); +COMMIT; +BEGIN; +INSERT INTO tndb VALUES (7); +INSERT INTO tndb VALUES (8); +COMMIT; +---- rolled back with BEGIN ---- +BEGIN; +INSERT INTO tmyisam VALUES (9); +INSERT INTO tmyisam VALUES (10); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO tinnodb VALUES (11); +INSERT INTO tinnodb VALUES (12); +ROLLBACK; +BEGIN; +INSERT INTO tndb VALUES (13); +INSERT INTO tndb VALUES (14); +ROLLBACK; +---- committed with AUTOCOMMIT = 0 ---- +SET AUTOCOMMIT = 0; +INSERT INTO tmyisam VALUES (15); +INSERT INTO tmyisam VALUES (16); +COMMIT; +INSERT INTO tinnodb VALUES (17); +INSERT INTO tinnodb VALUES (18); +COMMIT; +INSERT INTO tndb VALUES (19); +INSERT INTO tndb VALUES (20); +COMMIT; +---- rolled back with AUTOCOMMIT = 0 ---- +INSERT INTO tmyisam VALUES (21); +INSERT INTO tmyisam VALUES (22); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +INSERT INTO tinnodb VALUES (23); +INSERT INTO tinnodb VALUES (24); +ROLLBACK; +INSERT INTO tndb VALUES (25); +INSERT INTO tndb VALUES (26); +ROLLBACK; +SET AUTOCOMMIT = 1; +==== MyISAM + InnoDB ==== +---- committed with BEGIN ---- +BEGIN; +INSERT INTO tmyisam VALUES (27); +INSERT INTO tinnodb VALUES (28); +COMMIT; +BEGIN; +INSERT INTO tinnodb VALUES (29); +INSERT INTO tmyisam VALUES (30); +COMMIT; +---- rolled back with BEGIN ---- +BEGIN; +INSERT INTO tmyisam VALUES (31); +INSERT INTO tinnodb VALUES (32); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO tinnodb VALUES (33); +INSERT INTO tmyisam VALUES (34); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +---- committed with AUTOCOMMIT = 0 ---- +SET AUTOCOMMIT = 0; +INSERT INTO tmyisam VALUES (35); +INSERT INTO tinnodb VALUES (36); +COMMIT; +INSERT INTO tinnodb VALUES (37); +INSERT INTO tmyisam VALUES (38); +COMMIT; +---- rolled back with AUTOCOMMIT = 0 ---- +INSERT INTO tmyisam VALUES (39); +INSERT INTO tinnodb VALUES (40); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +INSERT INTO tinnodb VALUES (41); +INSERT INTO tmyisam VALUES (42); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +SET AUTOCOMMIT = 1; +==== MyISAM + NDB ==== +---- committed with BEGIN---- +BEGIN; +INSERT INTO tmyisam VALUES (43); +INSERT INTO tndb VALUES (44); +COMMIT; +BEGIN; +INSERT INTO tndb VALUES (45); +INSERT INTO tmyisam VALUES (46); +COMMIT; +---- rolled back with BEGIN ---- +BEGIN; +INSERT INTO tmyisam VALUES (47); +INSERT INTO tndb VALUES (48); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO tndb VALUES (49); +INSERT INTO tmyisam VALUES (50); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +---- committed with AUTOCOMMIT = 0 ---- +SET AUTOCOMMIT = 0; +INSERT INTO tmyisam VALUES (51); +INSERT INTO tndb VALUES (52); +COMMIT; +INSERT INTO tndb VALUES (53); +INSERT INTO tmyisam VALUES (54); +COMMIT; +---- rolled back with AUTOCOMMIT = 0 ---- +INSERT INTO tmyisam VALUES (55); +INSERT INTO tndb VALUES (56); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +INSERT INTO tndb VALUES (57); +INSERT INTO tmyisam VALUES (58); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +SET AUTOCOMMIT = 1; +==== InnoDB + NDB ==== +---- committed with BEGIN ---- +BEGIN; +INSERT INTO tinnodb VALUES (59); +INSERT INTO tndb VALUES (60); +COMMIT; +BEGIN; +INSERT INTO tndb VALUES (61); +INSERT INTO tinnodb VALUES (62); +COMMIT; +---- rolled back with BEGIN ---- +BEGIN; +INSERT INTO tinnodb VALUES (63); +INSERT INTO tndb VALUES (64); +ROLLBACK; +BEGIN; +INSERT INTO tndb VALUES (65); +INSERT INTO tinnodb VALUES (66); +ROLLBACK; +---- committed with AUTOCOMMIT = 0 ---- +SET AUTOCOMMIT = 0; +INSERT INTO tinnodb VALUES (67); +INSERT INTO tndb VALUES (68); +COMMIT; +INSERT INTO tndb VALUES (69); +INSERT INTO tinnodb VALUES (70); +COMMIT; +---- rolled back with AUTOCOMMIT = 0 ---- +INSERT INTO tinnodb VALUES (71); +INSERT INTO tndb VALUES (72); +ROLLBACK; +INSERT INTO tndb VALUES (73); +INSERT INTO tinnodb VALUES (74); +ROLLBACK; +SET AUTOCOMMIT = 1; +==== MyISAM + InnoDB + NDB ==== +---- committed with BEGIN ---- +BEGIN; +INSERT INTO tmyisam VALUES (75); +INSERT INTO tinnodb VALUES (76); +INSERT INTO tndb VALUES (77); +COMMIT; +BEGIN; +INSERT INTO tmyisam VALUES (78); +INSERT INTO tndb VALUES (79); +INSERT INTO tinnodb VALUES (80); +COMMIT; +BEGIN; +INSERT INTO tinnodb VALUES (81); +INSERT INTO tmyisam VALUES (82); +INSERT INTO tndb VALUES (83); +COMMIT; +BEGIN; +INSERT INTO tinnodb VALUES (84); +INSERT INTO tndb VALUES (85); +INSERT INTO tmyisam VALUES (86); +COMMIT; +BEGIN; +INSERT INTO tndb VALUES (87); +INSERT INTO tmyisam VALUES (88); +INSERT INTO tinnodb VALUES (89); +COMMIT; +BEGIN; +INSERT INTO tndb VALUES (90); +INSERT INTO tinnodb VALUES (91); +INSERT INTO tmyisam VALUES (92); +COMMIT; +---- rolled back with BEGIN ---- +BEGIN; +INSERT INTO tmyisam VALUES (93); +INSERT INTO tinnodb VALUES (94); +INSERT INTO tndb VALUES (95); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO tmyisam VALUES (96); +INSERT INTO tndb VALUES (97); +INSERT INTO tinnodb VALUES (98); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO tinnodb VALUES (99); +INSERT INTO tmyisam VALUES (100); +INSERT INTO tndb VALUES (101); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO tinnodb VALUES (102); +INSERT INTO tndb VALUES (103); +INSERT INTO tmyisam VALUES (104); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO tndb VALUES (105); +INSERT INTO tmyisam VALUES (106); +INSERT INTO tinnodb VALUES (107); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO tndb VALUES (108); +INSERT INTO tinnodb VALUES (109); +INSERT INTO tmyisam VALUES (110); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +---- committed with AUTOCOMMIT = 0 ---- +SET AUTOCOMMIT = 0; +INSERT INTO tmyisam VALUES (111); +INSERT INTO tinnodb VALUES (112); +INSERT INTO tndb VALUES (113); +COMMIT; +INSERT INTO tmyisam VALUES (114); +INSERT INTO tndb VALUES (115); +INSERT INTO tinnodb VALUES (116); +COMMIT; +INSERT INTO tinnodb VALUES (117); +INSERT INTO tmyisam VALUES (118); +INSERT INTO tndb VALUES (119); +COMMIT; +INSERT INTO tinnodb VALUES (120); +INSERT INTO tndb VALUES (121); +INSERT INTO tmyisam VALUES (122); +COMMIT; +INSERT INTO tndb VALUES (123); +INSERT INTO tmyisam VALUES (124); +INSERT INTO tinnodb VALUES (125); +COMMIT; +INSERT INTO tndb VALUES (126); +INSERT INTO tinnodb VALUES (127); +INSERT INTO tmyisam VALUES (128); +COMMIT; +---- rolled back with AUTOCOMMIT = 0 ---- +INSERT INTO tmyisam VALUES (129); +INSERT INTO tinnodb VALUES (130); +INSERT INTO tndb VALUES (131); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +INSERT INTO tmyisam VALUES (132); +INSERT INTO tndb VALUES (133); +INSERT INTO tinnodb VALUES (134); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +INSERT INTO tinnodb VALUES (135); +INSERT INTO tmyisam VALUES (136); +INSERT INTO tndb VALUES (137); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +INSERT INTO tinnodb VALUES (138); +INSERT INTO tndb VALUES (139); +INSERT INTO tmyisam VALUES (140); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +INSERT INTO tndb VALUES (141); +INSERT INTO tmyisam VALUES (142); +INSERT INTO tinnodb VALUES (143); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +INSERT INTO tndb VALUES (144); +INSERT INTO tinnodb VALUES (145); +INSERT INTO tmyisam VALUES (146); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +SET AUTOCOMMIT = 1; +==== Verify the result ==== +SELECT * FROM tmyisam ORDER BY a; +a +0 +3 +4 +9 +10 +15 +16 +21 +22 +27 +30 +31 +34 +35 +38 +39 +42 +43 +46 +47 +50 +51 +54 +55 +58 +75 +78 +82 +86 +88 +92 +93 +96 +100 +104 +106 +110 +111 +114 +118 +122 +124 +128 +129 +132 +136 +140 +142 +146 +SELECT * FROM tinnodb ORDER BY a; +a +1 +5 +6 +17 +18 +28 +29 +36 +37 +59 +62 +67 +70 +76 +80 +81 +84 +89 +91 +112 +116 +117 +120 +125 +127 +SELECT * FROM tndb ORDER BY a; +a +2 +7 +8 +19 +20 +44 +45 +52 +53 +60 +61 +68 +69 +77 +79 +83 +85 +87 +90 +113 +115 +119 +121 +123 +126 +[on slave] +Comparing tables master:test.tmyisam and slave:test.tmyisam +Comparing tables master:test.tinnodb and slave:test.tinnodb +Comparing tables master:test.tndb and slave:test.tndb +==== Clean up ==== +[on master] +DROP TABLE tmyisam, tinnodb, tndb; +[on slave] diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result index 760114f3639..f8eb5ebdd89 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result @@ -26,10 +26,10 @@ stop slave; SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) FROM mysql.ndb_binlog_index WHERE epoch = <the_epoch> ; @the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1) -106 master-bin1.000001 +106 master-bin.000001 CHANGE MASTER TO master_port=<MASTER_PORT1>, -master_log_file = 'master-bin1.000001', +master_log_file = 'master-bin.000001', master_log_pos = 106 ; start slave; INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4); @@ -52,4 +52,6 @@ c1 c2 c3 row3 C 3 row4 D 4 row5 E 5 +==== clean up ==== +DROP TABLE t1; STOP SLAVE; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result index 56bb31e329d..7f75bdedd65 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result @@ -5,8 +5,8 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; CREATE TABLE t1 (word CHAR(20) NOT NULL); -LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; -LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1; +LOAD DATA INFILE 'LOAD_FILE' INTO TABLE t1; +LOAD DATA INFILE 'LOAD_FILE' INTO TABLE t1; SELECT * FROM t1 ORDER BY word LIMIT 10; word Aarhus diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result index f2a1ba410b9..c788893e055 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result @@ -25,12 +25,8 @@ hex(c2) hex(c3) c1 0 1 BCDEF 1 0 CD 0 0 DEFGHIJKL -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; -SELECT @the_backup_id:=backup_id FROM test.backup_info; -@the_backup_id:=backup_id -<the_backup_id> +CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; UPDATE t1 SET c2=0 WHERE c3="row2"; SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_transaction.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_transaction.result deleted file mode 100644 index bbd0a873dc8..00000000000 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_transaction.result +++ /dev/null @@ -1,110 +0,0 @@ -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 TABLE tmyisam (a int) ENGINE = MYISAM; -CREATE TABLE tinnodb (a int) ENGINE = INNODB; -CREATE TABLE tndb (a int) ENGINE = NDB; -SHOW CREATE TABLE tmyisam; -Table Create Table -tmyisam CREATE TABLE `tmyisam` ( - `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -SHOW CREATE TABLE tinnodb; -Table Create Table -tinnodb CREATE TABLE `tinnodb` ( - `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -SHOW CREATE TABLE tndb; -Table Create Table -tndb CREATE TABLE `tndb` ( - `a` int(11) DEFAULT NULL -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 -==== Test 1: Non-XA Engines ==== ---- on master --- -SET AUTOCOMMIT = 1; -INSERT INTO tndb VALUES (1); -INSERT INTO tmyisam VALUES (1); -BEGIN; -INSERT INTO tndb VALUES (2); -INSERT INTO tndb VALUES (3); -COMMIT; -BEGIN; -INSERT INTO tmyisam VALUES (2); -INSERT INTO tmyisam VALUES (3); -COMMIT; -BEGIN; -INSERT INTO tndb VALUES (4); -INSERT INTO tmyisam VALUES (4); -COMMIT; -BEGIN; -INSERT INTO tndb VALUES (5); -INSERT INTO tndb VALUES (6); -ROLLBACK; -BEGIN; -INSERT INTO tmyisam VALUES (5); -INSERT INTO tmyisam VALUES (6); -ROLLBACK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back -BEGIN; -INSERT INTO tndb VALUES (7); -INSERT INTO tmyisam VALUES (7); -ROLLBACK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back -SELECT * FROM tndb ORDER BY a; -a -1 -2 -3 -4 -SELECT * FROM tmyisam ORDER BY a; -a -1 -2 -3 -4 -5 -6 -7 ---- on slave --- -SELECT * FROM tndb ORDER BY a; -a -1 -2 -3 -4 -SELECT * FROM tmyisam ORDER BY a; -a -1 -2 -3 -4 -5 -6 -7 -==== Test 2: Master crash before writing XID event on XA engine ==== ---- on master --- -INSERT INTO tinnodb VALUES (1); -SELECT * FROM tinnodb ORDER BY a; -a -1 ---- on slave --- -STOP SLAVE; -SELECT "" AS Slave_IO_State; -Slave_IO_State - -SELECT "" AS Last_SQL_Error; -Last_SQL_Error - -SELECT "" AS Last_IO_Error; -Last_IO_Error - -SELECT * FROM tinnodb ORDER BY a; -a ---- on master --- -DROP TABLE tmyisam, tinnodb, tndb; -DROP TABLE tmyisam, tinnodb, tndb; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result b/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result index aa9d3132cbb..409397cb3d1 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result @@ -423,10 +423,10 @@ a b c **** On Master **** DELETE FROM t1; **** Resetting master and slave **** -STOP SLAVE; +include/stop_slave.inc RESET SLAVE; RESET MASTER; -START SLAVE; +include/start_slave.inc **** On Master **** INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M'); **** On Master **** diff --git a/mysql-test/suite/rpl_ndb/t/disabled.def b/mysql-test/suite/rpl_ndb/t/disabled.def index ebc99feeac6..694f7098980 100644 --- a/mysql-test/suite/rpl_ndb/t/disabled.def +++ b/mysql-test/suite/rpl_ndb/t/disabled.def @@ -10,7 +10,7 @@ # ############################################################################## -rpl_ndb_circular : Bug#33849 COMMIT event missing in cluster circular replication. -rpl_ndb_circular_simplex : Bug#33849 COMMIT event missing in cluster circular replication. +rpl_ndb_circular : Bug#41183 rpl_ndb_circular, rpl_ndb_circular_simplex need maintenance, crash +rpl_ndb_circular_simplex : Bug#41183 rpl_ndb_circular, rpl_ndb_circular_simplex need maintenance, crash # the below testcase have been reworked to avoid the bug, test contains comment, keep bug open diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test index 43ad901d746..3b075808481 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test @@ -12,6 +12,14 @@ -- connection slave -- source include/have_innodb.inc + +# Remove any old ndb_apply_status from slaves datadir +let $datadir= `SELECT @@datadir`; +--error 0,1 +remove_file $datadir/mysql/ndb_apply_status.frm; +--error 0,1 +remove_file $datadir/mysql/ndb_apply_status.ndb; + set @@global.slave_exec_mode= 'IDEMPOTENT'; CREATE TABLE mysql.ndb_apply_status ( server_id INT UNSIGNED NOT NULL, diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test index b19116ffd78..560efec255b 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test @@ -11,6 +11,14 @@ -- source include/master-slave.inc -- connection slave + +# Remove any old ndb_apply_status from slaves datadir +let $datadir= `SELECT @@datadir`; +--error 0,1 +remove_file $datadir/mysql/ndb_apply_status.frm; +--error 0,1 +remove_file $datadir/mysql/ndb_apply_status.ndb; + set @@global.slave_exec_mode= 'IDEMPOTENT'; CREATE TABLE mysql.ndb_apply_status ( server_id INT UNSIGNED NOT NULL, diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2ndb.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2ndb.test index 1657a6902ba..e954c72fd1d 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2ndb.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2ndb.test @@ -5,6 +5,7 @@ # to other engines (innodb, myisam), see also rpl_ndb_2other.test ############################################################## --source include/have_binlog_format_mixed_or_row.inc +--source include/have_ndb.inc --source include/ndb_master-slave.inc # On master use NDB as storage engine. diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test index 67e8f7cea42..41f91d62dec 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test @@ -17,6 +17,15 @@ SET storage_engine=ndb; --echo === NDB -> MYISAM === --echo connection slave; + +# Remove any old ndb_apply_status from slaves datadir +let $datadir= `SELECT @@datadir`; +--error 0,1 +remove_file $datadir/mysql/ndb_apply_status.frm; +--error 0,1 +remove_file $datadir/mysql/ndb_apply_status.ndb; + +set @old_slave_exec_mode= @@global.slave_exec_mode; set @@global.slave_exec_mode= 'IDEMPOTENT'; CREATE TABLE mysql.ndb_apply_status ( server_id INT UNSIGNED NOT NULL, @@ -38,3 +47,4 @@ SET storage_engine=innodb; connection slave; drop table mysql.ndb_apply_status; +set @@global.slave_exec_mode= @old_slave_exec_mode; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test index ce951f01212..b90e6fff8bc 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test @@ -73,7 +73,7 @@ CREATE TABLE ACCOUNT_TYPE ( ACCOUNT_TYPE_ID INT UNSIGNED NOT NULL, # # create "BANK" application # ---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/bank/bankCreator >> $NDB_TOOLS_OUTPUT +--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/bank/bankCreator >> $NDB_TOOLS_OUTPUT # # start main loop @@ -88,9 +88,9 @@ while ($2) # # start "BANK" application # ---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/bank/bankTimer -w 5 >> $NDB_TOOLS_OUTPUT & ---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/bank/bankMakeGL >> $NDB_TOOLS_OUTPUT & ---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/bank/bankTransactionMaker >> $NDB_TOOLS_OUTPUT & +--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/bank/bankTimer -w 5 >> $NDB_TOOLS_OUTPUT & +--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/bank/bankMakeGL >> $NDB_TOOLS_OUTPUT & +--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/bank/bankTransactionMaker >> $NDB_TOOLS_OUTPUT & # # let the "BANK" run for a while @@ -114,10 +114,10 @@ CREATE DATABASE BANK; # start by taking a backup on master --connection master RESET MASTER; ---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT +--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "start backup" >> $NDB_TOOLS_OUTPUT # there is no neat way to find the backupid, this is a hack to find it... ---exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat +--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="$NDB_CONNECTSTRING" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat CREATE TABLE IF NOT EXISTS mysql.backup_info (id INT, backup_id INT) ENGINE = HEAP; DELETE FROM mysql.backup_info; LOAD DATA INFILE '../tmp.dat' INTO TABLE mysql.backup_info FIELDS TERMINATED BY ','; @@ -128,8 +128,8 @@ let the_backup_id=`select @the_backup_id`; # restore on slave, first check that nothing is there --connection slave ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT # # now setup replication to continue from last epoch @@ -150,7 +150,7 @@ while ($1) --replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 34 <Last_IO_Errno> 35 <Last_IO_Error> SHOW SLAVE STATUS; STOP SLAVE; - --exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT_SLAVE ../storage/ndb/test/ndbapi/bank/bankValidateAllGLs >> $NDB_TOOLS_OUTPUT + --exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING_SLAVE ../storage/ndb/test/ndbapi/bank/bankValidateAllGLs >> $NDB_TOOLS_OUTPUT START SLAVE; --dec $1 } diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test index c7d8db8ef8b..5903cd223ad 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test @@ -184,22 +184,21 @@ set GLOBAL slave_transaction_retries=1; --echo **** On Master **** UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1; +--echo **** On Slave **** # Wait for deadlock to be detected. # When detected, the slave will stop, so we just wait for it to stop. +connection slave; source include/wait_for_slave_sql_to_stop.inc; # Replication should have stopped, since max retries were not enough. # verify with show slave status ---connection slave ---echo **** On Slave **** --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 19 <Last_Errno> 20 <Last_Error> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error> 37 <Last_SQL_Errno> 38 <Last_SQL_Error> --query_vertical SHOW SLAVE STATUS; # now set max retries high enough to succeed, and start slave again set GLOBAL slave_transaction_retries=10; -START SLAVE; -source include/wait_for_slave_to_start.inc; +source include/start_slave.inc; # Wait for deadlock to be detected and retried. # We want to wait until at least one retry has been made, but before # the slave stops. currently, there is no safe way to do that: we diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test index c1a48d08c53..2cc46e2420e 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test @@ -5,11 +5,13 @@ --connection slave RESET MASTER; + --connection master --replace_result $SLAVE_MYPORT SLAVE_PORT --eval CHANGE MASTER TO master_host="127.0.0.1",master_port=$SLAVE_MYPORT,master_user="root" START SLAVE; + # create the table on the "slave" --connection slave CREATE TABLE t1 (a int key, b int) ENGINE=ndb; @@ -37,13 +39,15 @@ INSERT INTO t1 VALUES (2,3); --connection slave SELECT * FROM t1 ORDER BY a; #SELECT * FROM t2 ORDER BY a; ---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # +# BUG#34654 Last_IO_Errno is not reset - Mask columns 35 and 36 +--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # --query_vertical show slave status; # connect to master and ensure data it there. --connection master SELECT * FROM t1 ORDER BY a; #SELECT * FROM t2 ORDER BY a; ---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # +# BUG#34654 Last_IO_Errno is not reset - Mask columns 35 and 36 +--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # --query_vertical show slave status; # stop replication on "master" as not to replicate diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf new file mode 100644 index 00000000000..b1b010ef0f3 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf @@ -0,0 +1,31 @@ +!include ../my.cnf + +[mysqld.1.1] +server-id= 1 +log-bin + +[mysqld.2.1] +server-id= 1 +log-bin + +[mysqld.1.slave] +server-id= 2 +log-bin +skip-slave-start + +[mysqld.2.slave] +server-id= 2 +master-host= 127.0.0.1 +master-port= @mysqld.2.1.port +master-password= @mysqld.2.1.#password +master-user= @mysqld.2.1.#user +master-connect-retry= 1 +init-rpl-role= slave +log-bin +skip-slave-start +ndb_connectstring= @mysql_cluster.slave.ndb_connectstring + +[ENV] + +SLAVE_MYPORT1= @mysqld.2.slave.port +SLAVE_MYSOCK1= @mysqld.2.slave.socket diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.test new file mode 100644 index 00000000000..a6b1c8c40ed --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.test @@ -0,0 +1,181 @@ +############################################################# +# Author: Serge Kozlov <skozlov@mysql.com> +# Date: 03/17/2008 +# Purpose: Testing cluster circular replication based on two +# independent channels between two clusters +############################################################# +--source include/have_ndb.inc +--source include/ndb_master-slave_2ch.inc +--source include/have_binlog_format_mixed_or_row.inc +--echo + +# Check server_id and set auto_increment_* variables +--echo *** Check server_id of mysqld servers *** +--connection master +SHOW VARIABLES LIKE "server_id"; +SET auto_increment_offset = 1; +SET auto_increment_increment = 2; +--connection master1 +SHOW VARIABLES LIKE "server_id"; +SET auto_increment_offset = 1; +SET auto_increment_increment = 2; +--connection slave +SHOW VARIABLES LIKE "server_id"; +SET auto_increment_offset = 2; +SET auto_increment_increment = 2; +--connection slave1 +SHOW VARIABLES LIKE "server_id"; +SET auto_increment_offset = 2; +SET auto_increment_increment = 2; +--echo + +# Preparing data. +--echo *** Preparing data *** +--connection master +CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=ndb; + +let $wait_binlog_event= CREATE TABLE t1; +--source include/wait_for_binlog_event.inc +--connection master1 +--source include/wait_for_binlog_event.inc +--connection slave +--source include/wait_for_binlog_event.inc +--connection slave1 +--source include/wait_for_binlog_event.inc +--echo + +# +# Testing +# + +--echo *** Basic testing *** +# insert data via all hosts +--echo Insert rows via all hosts +--disable_query_log +let $counter= 10; +while ($counter) { + --connection master + INSERT INTO t1(b,c) VALUES('master',1); + --connection master1 + INSERT INTO t1(b,c) VALUES('master1',1); + --connection slave + INSERT INTO t1(b,c) VALUES('slave',1); + --connection slave1 + INSERT INTO t1(b,c) VALUES('slave1',1); + dec $counter; +} +--connection master +--enable_query_log + +# Wait replication between clusters +let $wait_condition= SELECT COUNT(*)=40 FROM t1 WHERE c = 1; +--source include/wait_condition.inc +--connection slave +--source include/wait_condition.inc + +# Check data +--echo Check data on both clusters +--connection master +--echo * Cluster A * +SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 1 GROUP BY b ORDER BY b; +--connection slave +--echo * Cluster B * +SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 1 GROUP BY b ORDER BY b; +--echo + +--echo *** Transaction testing *** +# Start transaction for one mysqld and do mass of inserts for other. +# Do it for for both clusters + +--connection master +BEGIN; +--connection slave1 +BEGIN; +let $counter= 100; +--connection master +--disable_query_log +while ($counter) { + --connection master + INSERT INTO t1(b,c) VALUES('master',2); + --connection master1 + INSERT INTO t1(b,c) VALUES('master1',2); + --connection slave + INSERT INTO t1(b,c) VALUES('slave',2); + --connection slave1 + INSERT INTO t1(b,c) VALUES('slave1',2); + dec $counter; +} +--connection master +--enable_query_log +COMMIT; +--connection slave1 +COMMIT; + +# Wait replication between clusters +--connection master +let $wait_condition= SELECT COUNT(*)=400 FROM t1 WHERE c = 2; +--source include/wait_condition.inc +--connection slave +--source include/wait_condition.inc + +--echo Check data on both clusters +--connection master +--echo * Cluster A * +SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 2 GROUP BY b ORDER BY b; +--connection slave +--echo * Cluster B * +SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 2 GROUP BY b ORDER BY b; +--echo + +# Start transaction and then roll back + +--connection master +BEGIN; +--connection slave1 +BEGIN; +let $counter= 100; +--connection master +--disable_query_log +while ($counter) { + --connection master + INSERT INTO t1(b,c) VALUES('master',3); + --connection master1 + INSERT INTO t1(b,c) VALUES('master1',3); + --connection slave + INSERT INTO t1(b,c) VALUES('slave',3); + --connection slave1 + INSERT INTO t1(b,c) VALUES('slave1',3); + dec $counter; +} +--connection master +--enable_query_log +ROLLBACK; +--connection slave1 +ROLLBACK; + +# Wait replication between clusters +--connection master +let $wait_condition= SELECT COUNT(*)=200 FROM t1 WHERE c = 3; +--source include/wait_condition.inc +--connection slave +--source include/wait_condition.inc + +--echo Check data on both clusters +--connection master +--echo * Cluster A * +SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 3 GROUP BY b ORDER BY b; +--connection slave +--echo * Cluster B * +SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 3 GROUP BY b ORDER BY b; +--echo + +# Clean up +--connection master +DROP TABLE t1; +--connection slave +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +--echo + +# End of test 5.1 diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test index fcbff1392f4..d5ddfc2b739 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test @@ -49,7 +49,7 @@ sync_with_master; # Check that there is no error in replication --replace_result $SLAVE_MYPORT SLAVE_PORT ---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # +--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # query_vertical SHOW SLAVE STATUS; # Check that we have the data on the master @@ -76,5 +76,5 @@ SELECT * FROM t1 ORDER BY a; # Check that there is no error in replication --replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # +--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # query_vertical SHOW SLAVE STATUS; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test index be7fd1acd2e..8d5ad334766 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test @@ -22,10 +22,7 @@ show variables like "%character_set_ser%"; --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings -create table t1 (a int) ENGINE=NDB; -drop table t1; ---connection master CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0', `nom` char(4) default NULL, `prenom` char(4) default NULL, @@ -35,8 +32,12 @@ CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0', INSERT INTO t1 VALUES(1,"XYZ1","ABC1"); select * from t1 order by nid; ---sync_slave_with_master +sync_slave_with_master; # connect to slave and ensure data it there. ---connection slave +connection slave; select * from t1 order by nid; +--echo ==== clean up ==== +connection master; +DROP TABLE t1; +sync_slave_with_master; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test index 2f2414ba578..fcc2928c5e2 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test @@ -21,8 +21,8 @@ select count(*) from t2; connection master; begin; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t2; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; +load data infile '../../../std_data/rpl_loaddata.dat' into table t2; +load data infile '../../../std_data/rpl_loaddata.dat' into table t1; rollback; select count(*) from t1; @@ -35,8 +35,8 @@ connection master; delete from t1; delete from t2; begin; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t2; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; +load data infile '../../../std_data/rpl_loaddata.dat' into table t2; +load data infile '../../../std_data/rpl_loaddata.dat' into table t1; rollback; select count(*) from t1; @@ -51,8 +51,8 @@ delete from t2; begin; insert into t2 values(3),(4); insert into t1 values(3),(4); -load data infile '../std_data_ln/rpl_loaddata.dat' into table t2; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; +load data infile '../../../std_data/rpl_loaddata.dat' into table t2; +load data infile '../../../std_data/rpl_loaddata.dat' into table t1; rollback; select count(*) from t1; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test index a695eee3221..75fe2688b4a 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test @@ -62,5 +62,5 @@ CREATE TABLE SERVER # # start "load" application # ---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/DbCreate >> $NDB_TOOLS_OUTPUT ---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/DbAsyncGenerator >> $NDB_TOOLS_OUTPUT +--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/DbCreate >> $NDB_TOOLS_OUTPUT +--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/DbAsyncGenerator >> $NDB_TOOLS_OUTPUT diff --git a/mysql-test/suite/rpl/t/rpl_dual_pos_advance-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-master.opt index 627becdbfb5..627becdbfb5 100644 --- a/mysql-test/suite/rpl/t/rpl_dual_pos_advance-slave.opt +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-master.opt diff --git a/mysql-test/suite/rpl/t/rpl_extraCol_innodb-master.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-slave.opt index 627becdbfb5..627becdbfb5 100644 --- a/mysql-test/suite/rpl/t/rpl_extraCol_innodb-master.opt +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-slave.opt diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test new file mode 100644 index 00000000000..14b76722fa6 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test @@ -0,0 +1,450 @@ +# ==== Purpose ==== +# +# Tests that transactions containing multiple table types are +# replicated correctly to the slave. +# +# This test was previously part of rpl_ndb_transactions. +# +# +# ==== Method ==== +# +# Try all combinations of the following: +# - Committed/rollback transactions. +# - Transactions started by AUTOCOMMIT = 0 or BEGIN. +# - Transactions using myisam, innodb, or ndb tables, or combinations +# of them. For combinations, we use the engines in all possible +# orders. +# For single-engine transactions, we also try with AUTOCOMMIT = 1. +# +# +# ==== Related bugs ==== +# +# BUG#26395: if crash during autocommit update to transactional table on master, slave fails + + +source include/have_ndb.inc; +source include/ndb_master-slave.inc; +source include/have_innodb.inc; + +CREATE TABLE tmyisam (a int) ENGINE = MYISAM; +CREATE TABLE tinnodb (a int) ENGINE = INNODB; +CREATE TABLE tndb (a int) ENGINE = NDB; + +SHOW CREATE TABLE tmyisam; +SHOW CREATE TABLE tinnodb; +SHOW CREATE TABLE tndb; + + +--echo [on master] + + +--echo ==== Single-engine transactions ==== + +--echo ---- autocommitted ---- + +SET AUTOCOMMIT = 1; + +INSERT INTO tmyisam VALUES (0); +INSERT INTO tinnodb VALUES (1); +INSERT INTO tndb VALUES (2); + +--echo ---- committed with BEGIN ---- + +BEGIN; +INSERT INTO tmyisam VALUES (3); +INSERT INTO tmyisam VALUES (4); +COMMIT; + +BEGIN; +INSERT INTO tinnodb VALUES (5); +INSERT INTO tinnodb VALUES (6); +COMMIT; + +BEGIN; +INSERT INTO tndb VALUES (7); +INSERT INTO tndb VALUES (8); +COMMIT; + +--echo ---- rolled back with BEGIN ---- + +BEGIN; +INSERT INTO tmyisam VALUES (9); +INSERT INTO tmyisam VALUES (10); +ROLLBACK; + +BEGIN; +INSERT INTO tinnodb VALUES (11); +INSERT INTO tinnodb VALUES (12); +ROLLBACK; + +BEGIN; +INSERT INTO tndb VALUES (13); +INSERT INTO tndb VALUES (14); +ROLLBACK; + + +--echo ---- committed with AUTOCOMMIT = 0 ---- + +SET AUTOCOMMIT = 0; + +INSERT INTO tmyisam VALUES (15); +INSERT INTO tmyisam VALUES (16); +COMMIT; + +INSERT INTO tinnodb VALUES (17); +INSERT INTO tinnodb VALUES (18); +COMMIT; + +INSERT INTO tndb VALUES (19); +INSERT INTO tndb VALUES (20); +COMMIT; + +--echo ---- rolled back with AUTOCOMMIT = 0 ---- + +INSERT INTO tmyisam VALUES (21); +INSERT INTO tmyisam VALUES (22); +ROLLBACK; + +INSERT INTO tinnodb VALUES (23); +INSERT INTO tinnodb VALUES (24); +ROLLBACK; + +INSERT INTO tndb VALUES (25); +INSERT INTO tndb VALUES (26); +ROLLBACK; + +SET AUTOCOMMIT = 1; + + +--echo ==== MyISAM + InnoDB ==== + +--echo ---- committed with BEGIN ---- + +BEGIN; +INSERT INTO tmyisam VALUES (27); +INSERT INTO tinnodb VALUES (28); +COMMIT; + +BEGIN; +INSERT INTO tinnodb VALUES (29); +INSERT INTO tmyisam VALUES (30); +COMMIT; + +--echo ---- rolled back with BEGIN ---- + +BEGIN; +INSERT INTO tmyisam VALUES (31); +INSERT INTO tinnodb VALUES (32); +ROLLBACK; + +BEGIN; +INSERT INTO tinnodb VALUES (33); +INSERT INTO tmyisam VALUES (34); +ROLLBACK; + +--echo ---- committed with AUTOCOMMIT = 0 ---- + +SET AUTOCOMMIT = 0; + +INSERT INTO tmyisam VALUES (35); +INSERT INTO tinnodb VALUES (36); +COMMIT; + +INSERT INTO tinnodb VALUES (37); +INSERT INTO tmyisam VALUES (38); +COMMIT; + +--echo ---- rolled back with AUTOCOMMIT = 0 ---- + +INSERT INTO tmyisam VALUES (39); +INSERT INTO tinnodb VALUES (40); +ROLLBACK; + +INSERT INTO tinnodb VALUES (41); +INSERT INTO tmyisam VALUES (42); +ROLLBACK; + +SET AUTOCOMMIT = 1; + + +--echo ==== MyISAM + NDB ==== + +--echo ---- committed with BEGIN---- + +BEGIN; +INSERT INTO tmyisam VALUES (43); +INSERT INTO tndb VALUES (44); +COMMIT; + +BEGIN; +INSERT INTO tndb VALUES (45); +INSERT INTO tmyisam VALUES (46); +COMMIT; + +--echo ---- rolled back with BEGIN ---- + +BEGIN; +INSERT INTO tmyisam VALUES (47); +INSERT INTO tndb VALUES (48); +ROLLBACK; + +BEGIN; +INSERT INTO tndb VALUES (49); +INSERT INTO tmyisam VALUES (50); +ROLLBACK; + +--echo ---- committed with AUTOCOMMIT = 0 ---- + +SET AUTOCOMMIT = 0; + +INSERT INTO tmyisam VALUES (51); +INSERT INTO tndb VALUES (52); +COMMIT; + +INSERT INTO tndb VALUES (53); +INSERT INTO tmyisam VALUES (54); +COMMIT; + +--echo ---- rolled back with AUTOCOMMIT = 0 ---- + +INSERT INTO tmyisam VALUES (55); +INSERT INTO tndb VALUES (56); +ROLLBACK; + +INSERT INTO tndb VALUES (57); +INSERT INTO tmyisam VALUES (58); +ROLLBACK; + +SET AUTOCOMMIT = 1; + + +--echo ==== InnoDB + NDB ==== + +--echo ---- committed with BEGIN ---- + +BEGIN; +INSERT INTO tinnodb VALUES (59); +INSERT INTO tndb VALUES (60); +COMMIT; + +BEGIN; +INSERT INTO tndb VALUES (61); +INSERT INTO tinnodb VALUES (62); +COMMIT; + +--echo ---- rolled back with BEGIN ---- + +BEGIN; +INSERT INTO tinnodb VALUES (63); +INSERT INTO tndb VALUES (64); +ROLLBACK; + +BEGIN; +INSERT INTO tndb VALUES (65); +INSERT INTO tinnodb VALUES (66); +ROLLBACK; + +--echo ---- committed with AUTOCOMMIT = 0 ---- + +SET AUTOCOMMIT = 0; + +INSERT INTO tinnodb VALUES (67); +INSERT INTO tndb VALUES (68); +COMMIT; + +INSERT INTO tndb VALUES (69); +INSERT INTO tinnodb VALUES (70); +COMMIT; + +--echo ---- rolled back with AUTOCOMMIT = 0 ---- + +INSERT INTO tinnodb VALUES (71); +INSERT INTO tndb VALUES (72); +ROLLBACK; + +INSERT INTO tndb VALUES (73); +INSERT INTO tinnodb VALUES (74); +ROLLBACK; + +SET AUTOCOMMIT = 1; + + +--echo ==== MyISAM + InnoDB + NDB ==== + +--echo ---- committed with BEGIN ---- + +BEGIN; +INSERT INTO tmyisam VALUES (75); +INSERT INTO tinnodb VALUES (76); +INSERT INTO tndb VALUES (77); +COMMIT; + +BEGIN; +INSERT INTO tmyisam VALUES (78); +INSERT INTO tndb VALUES (79); +INSERT INTO tinnodb VALUES (80); +COMMIT; + +BEGIN; +INSERT INTO tinnodb VALUES (81); +INSERT INTO tmyisam VALUES (82); +INSERT INTO tndb VALUES (83); +COMMIT; + +BEGIN; +INSERT INTO tinnodb VALUES (84); +INSERT INTO tndb VALUES (85); +INSERT INTO tmyisam VALUES (86); +COMMIT; + +BEGIN; +INSERT INTO tndb VALUES (87); +INSERT INTO tmyisam VALUES (88); +INSERT INTO tinnodb VALUES (89); +COMMIT; + +BEGIN; +INSERT INTO tndb VALUES (90); +INSERT INTO tinnodb VALUES (91); +INSERT INTO tmyisam VALUES (92); +COMMIT; + +--echo ---- rolled back with BEGIN ---- + +BEGIN; +INSERT INTO tmyisam VALUES (93); +INSERT INTO tinnodb VALUES (94); +INSERT INTO tndb VALUES (95); +ROLLBACK; + +BEGIN; +INSERT INTO tmyisam VALUES (96); +INSERT INTO tndb VALUES (97); +INSERT INTO tinnodb VALUES (98); +ROLLBACK; + +BEGIN; +INSERT INTO tinnodb VALUES (99); +INSERT INTO tmyisam VALUES (100); +INSERT INTO tndb VALUES (101); +ROLLBACK; + +BEGIN; +INSERT INTO tinnodb VALUES (102); +INSERT INTO tndb VALUES (103); +INSERT INTO tmyisam VALUES (104); +ROLLBACK; + +BEGIN; +INSERT INTO tndb VALUES (105); +INSERT INTO tmyisam VALUES (106); +INSERT INTO tinnodb VALUES (107); +ROLLBACK; + +BEGIN; +INSERT INTO tndb VALUES (108); +INSERT INTO tinnodb VALUES (109); +INSERT INTO tmyisam VALUES (110); +ROLLBACK; + +--echo ---- committed with AUTOCOMMIT = 0 ---- + +SET AUTOCOMMIT = 0; + +INSERT INTO tmyisam VALUES (111); +INSERT INTO tinnodb VALUES (112); +INSERT INTO tndb VALUES (113); +COMMIT; + +INSERT INTO tmyisam VALUES (114); +INSERT INTO tndb VALUES (115); +INSERT INTO tinnodb VALUES (116); +COMMIT; + +INSERT INTO tinnodb VALUES (117); +INSERT INTO tmyisam VALUES (118); +INSERT INTO tndb VALUES (119); +COMMIT; + +INSERT INTO tinnodb VALUES (120); +INSERT INTO tndb VALUES (121); +INSERT INTO tmyisam VALUES (122); +COMMIT; + +INSERT INTO tndb VALUES (123); +INSERT INTO tmyisam VALUES (124); +INSERT INTO tinnodb VALUES (125); +COMMIT; + +INSERT INTO tndb VALUES (126); +INSERT INTO tinnodb VALUES (127); +INSERT INTO tmyisam VALUES (128); +COMMIT; + +--echo ---- rolled back with AUTOCOMMIT = 0 ---- + +INSERT INTO tmyisam VALUES (129); +INSERT INTO tinnodb VALUES (130); +INSERT INTO tndb VALUES (131); +ROLLBACK; + +INSERT INTO tmyisam VALUES (132); +INSERT INTO tndb VALUES (133); +INSERT INTO tinnodb VALUES (134); +ROLLBACK; + +INSERT INTO tinnodb VALUES (135); +INSERT INTO tmyisam VALUES (136); +INSERT INTO tndb VALUES (137); +ROLLBACK; + +INSERT INTO tinnodb VALUES (138); +INSERT INTO tndb VALUES (139); +INSERT INTO tmyisam VALUES (140); +ROLLBACK; + +INSERT INTO tndb VALUES (141); +INSERT INTO tmyisam VALUES (142); +INSERT INTO tinnodb VALUES (143); +ROLLBACK; + +INSERT INTO tndb VALUES (144); +INSERT INTO tinnodb VALUES (145); +INSERT INTO tmyisam VALUES (146); +ROLLBACK; + +SET AUTOCOMMIT = 1; + + +--echo ==== Verify the result ==== + +SELECT * FROM tmyisam ORDER BY a; +SELECT * FROM tinnodb ORDER BY a; +SELECT * FROM tndb ORDER BY a; + +--echo [on slave] +--sync_slave_with_master + +let $diff_table_1=master:test.tmyisam; +let $diff_table_2=slave:test.tmyisam; +source include/diff_tables.inc; + +let $diff_table_1=master:test.tinnodb; +let $diff_table_2=slave:test.tinnodb; +source include/diff_tables.inc; + +let $diff_table_1=master:test.tndb; +let $diff_table_2=slave:test.tndb; +source include/diff_tables.inc; + + +--echo ==== Clean up ==== + +--echo [on master] +connection master; +DROP TABLE tmyisam, tinnodb, tndb; + +--echo [on slave] +sync_slave_with_master; + +source include/master-slave-end.inc; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test index 1ee9aaf5372..eb128cfa2ce 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test @@ -64,4 +64,9 @@ sync_slave_with_master; connection slave; SELECT * FROM t1 ORDER BY c3; +--echo ==== clean up ==== +connection server2; +DROP TABLE t1; +sync_slave_with_master; + STOP SLAVE; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test index 116f0879ca0..88572c3e9a2 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test @@ -39,8 +39,8 @@ SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3; # we should have no tables SHOW TABLES; ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT # # BUG#11960 @@ -50,8 +50,8 @@ SHOW TABLES; DROP DATABASE ndbsynctest; CREATE DATABASE ndbsynctest; USE ndbsynctest; ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT # continue test SHOW TABLES; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction-master.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction-master.opt deleted file mode 100644 index 5411960b4aa..00000000000 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb --debug=d,do_not_write_xid diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction-slave.opt deleted file mode 100644 index 627becdbfb5..00000000000 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction.test deleted file mode 100644 index 5700e0fa422..00000000000 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction.test +++ /dev/null @@ -1,131 +0,0 @@ -# Tests that transactions are replicated correctly, with various -# combinations of non-transactional and transactional non-XA tables. -# Also tests that an XA transaction where the master crashes just -# before writing the XID log event is executed correctly. See below -# for implementation details. - -source include/ndb_master-slave.inc; -source include/have_ndb.inc; -source include/have_debug.inc; - -CREATE TABLE tmyisam (a int) ENGINE = MYISAM; -CREATE TABLE tinnodb (a int) ENGINE = INNODB; -CREATE TABLE tndb (a int) ENGINE = NDB; - -SHOW CREATE TABLE tmyisam; -SHOW CREATE TABLE tinnodb; -SHOW CREATE TABLE tndb; - - ---echo ==== Test 1: Non-XA Engines ==== -# Test that everything works fine with non-XA engines. We just try -# all ways to do transactions involving ndb and/or myisam, with -# rollback or commit. - ---echo --- on master --- - -SET AUTOCOMMIT = 1; - -INSERT INTO tndb VALUES (1); -INSERT INTO tmyisam VALUES (1); - -BEGIN; -INSERT INTO tndb VALUES (2); -INSERT INTO tndb VALUES (3); -COMMIT; - -BEGIN; -INSERT INTO tmyisam VALUES (2); -INSERT INTO tmyisam VALUES (3); -COMMIT; - -BEGIN; -INSERT INTO tndb VALUES (4); -INSERT INTO tmyisam VALUES (4); -COMMIT; - -BEGIN; -INSERT INTO tndb VALUES (5); -INSERT INTO tndb VALUES (6); -ROLLBACK; - -BEGIN; -INSERT INTO tmyisam VALUES (5); -INSERT INTO tmyisam VALUES (6); -#--warning 1196 -ROLLBACK; - -BEGIN; -INSERT INTO tndb VALUES (7); -INSERT INTO tmyisam VALUES (7); -#--warning 1196 -ROLLBACK; - -SELECT * FROM tndb ORDER BY a; -SELECT * FROM tmyisam ORDER BY a; - ---echo --- on slave --- ---sync_slave_with_master -SELECT * FROM tndb ORDER BY a; -SELECT * FROM tmyisam ORDER BY a; - - ---echo ==== Test 2: Master crash before writing XID event on XA engine ==== -# We now want to test the following scenario, to verify that BUG#26395 -# has been fixed: - -# "master and slave have a transactional table that uses XA. Master -# has AUTOCOMMIT on and executes a statement (in this case an -# INSERT). Master crashes just before writing the XID event." - -# In this scenario, master will roll back, so slave should not execute -# the statement, and slave should roll back later when master is -# restarted. - -# However, we want the master to be alive so that we are sure it -# replicates the statement to the slave. So in the test case, we must -# therefore not crash the master. Instead, we fake the crash by just -# not writing the XID event to the binlog. This is done by the -# --debug=d,do_not_write_xid flag in the .opt file. - -# So, unlike if the master had crashed, the master *will* execute the -# statement. But the slave should not execute it. Hence, after the -# first test is executed, the expected result on master is a table -# with one row, and on slave a table with no rows. - -# To simulate the slave correctly, we wait until everything up to the -# XID is replicated. We cannot sync_slave_with_master, because that -# would wait for the transaction to end. Instead, we wait for -# "sufficiently long time". Then we stop the slave. - -# Note: since this puts the master binlog in an inconsistent state, -# this should be the last test of the file. - ---echo --- on master --- ---connection master - -INSERT INTO tinnodb VALUES (1); -SELECT * FROM tinnodb ORDER BY a; - ---echo --- on slave --- ---connection slave ---sleep 3 -STOP SLAVE; -source include/wait_for_slave_to_stop.inc; -let $tmp= query_get_value("SHOW SLAVE STATUS", Slave_IO_State, 1); -eval SELECT "$tmp" AS Slave_IO_State; -let $tmp= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); -eval SELECT "$tmp" AS Last_SQL_Error; -let $tmp= query_get_value("SHOW SLAVE STATUS", Last_IO_Error, 1); -eval SELECT "$tmp" AS Last_IO_Error; -SELECT * FROM tinnodb ORDER BY a; - -# Clean up. We cannot do it on master and replicate over, because -# master binlog is in a bad state after last test. So we do it both on -# master and on slave. ---echo --- on master --- -connection master; -DROP TABLE tmyisam, tinnodb, tndb; - -connection slave; -DROP TABLE tmyisam, tinnodb, tndb; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test b/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test index 5067722bb79..543393b980d 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test @@ -4,8 +4,8 @@ -- source include/ndb_master-slave.inc --exec echo Running ndbapi_simple_dual ---exec $NDB_EXAMPLES_DIR/ndbapi_simple_dual/ndbapi_simple_dual $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" $SLAVE_MYSOCK "localhost:$NDBCLUSTER_PORT_SLAVE" >> $NDB_EXAMPLES_OUTPUT +--exec $NDB_EXAMPLES_DIR/ndbapi_simple_dual/ndbapi_simple_dual $MASTER_MYSOCK "$NDB_CONNECTSTRING" $SLAVE_MYSOCK "$NDB_CONNECTSTRING_SLAVE" >> $NDB_EXAMPLES_OUTPUT --exec echo Running mgmapi_logevent ---exec $NDB_EXAMPLES_DIR/mgmapi_logevent/mgmapi_logevent "localhost:$NDBCLUSTER_PORT" "localhost:$NDBCLUSTER_PORT_SLAVE" 1 >> $NDB_EXAMPLES_OUTPUT +--exec $NDB_EXAMPLES_DIR/mgmapi_logevent/mgmapi_logevent "$NDB_CONNECTSTRING" "$NDB_CONNECTSTRING_SLAVE" 1 >> $NDB_EXAMPLES_OUTPUT diff --git a/mysql-test/include/charset_basic.inc b/mysql-test/suite/sys_vars/inc/charset_basic.inc index e3331697f2c..e3331697f2c 100644 --- a/mysql-test/include/charset_basic.inc +++ b/mysql-test/suite/sys_vars/inc/charset_basic.inc diff --git a/mysql-test/include/collation_basic.inc b/mysql-test/suite/sys_vars/inc/collation_basic.inc index be8ae36eeb8..be8ae36eeb8 100644 --- a/mysql-test/include/collation_basic.inc +++ b/mysql-test/suite/sys_vars/inc/collation_basic.inc diff --git a/mysql-test/suite/sys_vars/inc/key_buffer_size_basic.inc b/mysql-test/suite/sys_vars/inc/key_buffer_size_basic.inc index 996a9e712f9..a8fa50a6a23 100644 --- a/mysql-test/suite/sys_vars/inc/key_buffer_size_basic.inc +++ b/mysql-test/suite/sys_vars/inc/key_buffer_size_basic.inc @@ -17,14 +17,14 @@ # * Valid & Invalid values # # * Scope & Access method # # * Data Integrity # +# Modified: Horst Hunger 2008-11-27 # +# Due to OS depending values the check has been changed # +# from concrete values to ranges. # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ############################################################################### -# Changes: # -# 2008-03-06 hhunger Got "lost connections with 5.1.24 # -######################################################################## --source include/load_sysvars.inc @@ -38,8 +38,6 @@ ######################################################################## SET @start_value = @@global.key_buffer_size; -SELECT @start_value; - --echo '#--------------------FN_DYNVARS_055_01------------------------#' ######################################################################## @@ -49,9 +47,7 @@ SELECT @start_value; SET @@global.key_buffer_size = 99; --Error ER_NO_DEFAULT SET @@global.key_buffer_size = DEFAULT; ---echo 'Bug# 34878: This variable has default value according to documentation'; -SELECT @@global.key_buffer_size = @min_key_buffer_size; - +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; --echo '#---------------------FN_DYNVARS_055_02-------------------------#' ############################################### @@ -66,26 +62,25 @@ SELECT @@global.key_buffer_size = @start_value; # Change the value of key_buffer_size to a valid value # ######################################################################## -SET @@global.key_buffer_size = @min_key_buffer_size; -SELECT @@global.key_buffer_size= @min_key_buffer_size; +SET @@global.key_buffer_size = 8 ; +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; --disable_warnings -#Due to "lost connection" +#Due to increasing the runtime significantly and allocating the buffer instantly. #SET @@global.key_buffer_size = 4294967295; --enable_warnings #SELECT @@global.key_buffer_size; SET @@global.key_buffer_size = 1800; -SELECT @@global.key_buffer_size = @min_key_buffer_size; +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SET @@global.key_buffer_size = 65535; SELECT @@global.key_buffer_size; -echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; - --echo '#--------------------FN_DYNVARS_055_04-------------------------#' ########################################################################### # Change the value of key_buffer_size to invalid value # ########################################################################### -# Due to "lost connection" +# Due to increasing the runtime significantly and allocating the buffer instantly +# with a size of 18446744073709551615 bytes with 32bit exec. #SET @@global.key_buffer_size = -1; #SELECT @@global.key_buffer_size; #SET @@global.key_buffer_size = 100000000000; @@ -96,16 +91,14 @@ SELECT @@global.key_buffer_size; #SET @@global.key_buffer_size = -1024; #SELECT @@global.key_buffer_size; SET @@global.key_buffer_size = 4; -SELECT @@global.key_buffer_size = @min_key_buffer_size; ---echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; --Error ER_WRONG_TYPE_FOR_VAR SET @@global.key_buffer_size = ON; -SELECT @@global.key_buffer_size = @min_key_buffer_size; +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; --Error ER_WRONG_TYPE_FOR_VAR SET @@global.key_buffer_size = 'test'; -SELECT @@global.key_buffer_size = @min_key_buffer_size; - +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; --echo '#-------------------FN_DYNVARS_055_05----------------------------#' ########################################################################### @@ -114,8 +107,7 @@ SELECT @@global.key_buffer_size = @min_key_buffer_size; --Error ER_GLOBAL_VARIABLE SET @@session.key_buffer_size = 0; -SELECT @@key_buffer_size = @min_key_buffer_size; - +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; --echo '#----------------------FN_DYNVARS_055_06------------------------#' ############################################################################## @@ -130,17 +122,15 @@ SELECT @@key_buffer_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='key_buffer_size'; - --echo '#---------------------FN_DYNVARS_055_07----------------------#' ################################################################### # Check if TRUE and FALSE values can be used on variable # ################################################################### SET @@global.key_buffer_size = TRUE; -SELECT @@global.key_buffer_size = @min_key_buffer_size; +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SET @@global.key_buffer_size = FALSE; -SELECT @@global.key_buffer_size = @min_key_buffer_size; - +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; --echo '#---------------------FN_DYNVARS_055_08----------------------#' ##################################################################### @@ -150,7 +140,7 @@ SELECT @@global.key_buffer_size = @min_key_buffer_size; # due to differences in contents of the warnings --disable_warnings -SET @@global.key_buffer_size = @min_key_buffer_size; +SET @@global.key_buffer_size = 8 ; SELECT @@key_buffer_size = @@global.key_buffer_size; --enable_warnings @@ -160,8 +150,8 @@ SELECT @@key_buffer_size = @@global.key_buffer_size; ########################################################################## --Error ER_GLOBAL_VARIABLE -SET key_buffer_size = @min_key_buffer_size; -SELECT @@key_buffer_size = @min_key_buffer_size; +SET key_buffer_size = 8 ; +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; --Error ER_PARSE_ERROR SET local.key_buffer_size = 10; --Error ER_UNKNOWN_TABLE @@ -179,9 +169,9 @@ SELECT key_buffer_size = @@session.key_buffer_size; ############################## SET @@global.key_buffer_size = @start_value; -SELECT @@global.key_buffer_size; --enable_warnings ####################################################################### # END OF key_buffer_size TESTS # ####################################################################### + diff --git a/mysql-test/suite/sys_vars/inc/query_cache_size_basic.inc b/mysql-test/suite/sys_vars/inc/query_cache_size_basic.inc index 1a3f9e1efe2..1f8c63c55bb 100644 --- a/mysql-test/suite/sys_vars/inc/query_cache_size_basic.inc +++ b/mysql-test/suite/sys_vars/inc/query_cache_size_basic.inc @@ -36,7 +36,6 @@ ############################################################################### SET @start_value = @@global.query_cache_size; -SELECT @start_value; --echo '#--------------------FN_DYNVARS_133_01------------------------#' ############################################################################### @@ -53,7 +52,7 @@ SELECT @@global.query_cache_size; ############################################### SET @@global.query_cache_size = @start_value; -SELECT @@global.query_cache_size = 0; +SELECT @@global.query_cache_size = @start_value; --echo '#--------------------FN_DYNVARS_133_03------------------------#' ################################################################################ @@ -167,7 +166,6 @@ SELECT query_cache_size = @@session.query_cache_size; ############################## SET @@global.query_cache_size = @start_value; -SELECT @@global.query_cache_size; ######################################################################## # END OF query_cache_size TESTS # diff --git a/mysql-test/suite/sys_vars/inc/query_prealloc_size_basic.inc b/mysql-test/suite/sys_vars/inc/query_prealloc_size_basic.inc index 3a8608736c5..64eb3c4b329 100644 --- a/mysql-test/suite/sys_vars/inc/query_prealloc_size_basic.inc +++ b/mysql-test/suite/sys_vars/inc/query_prealloc_size_basic.inc @@ -74,8 +74,8 @@ SELECT @@session.query_prealloc_size = 8192; SET @@global.query_prealloc_size = 8192; SELECT @@global.query_prealloc_size ; -SET @@global.query_prealloc_size = 4294967295; -SELECT @@global.query_prealloc_size ; +#SET @@global.query_prealloc_size = 4294967295; +#SELECT @@global.query_prealloc_size ; SET @@global.query_prealloc_size = 655354; SELECT @@global.query_prealloc_size ; @@ -89,8 +89,8 @@ SELECT @@global.query_prealloc_size ; SET @@session.query_prealloc_size = 8192; SELECT @@session.query_prealloc_size ; -SET @@session.query_prealloc_size = 4294967295; -SELECT @@session.query_prealloc_size ; +#SET @@session.query_prealloc_size = 4294967295; +#SELECT @@session.query_prealloc_size ; SET @@session.query_prealloc_size = 655345; SELECT @@session.query_prealloc_size ; @@ -106,11 +106,11 @@ SELECT @@session.query_prealloc_size ; SET @@global.query_prealloc_size = 0; SELECT @@global.query_prealloc_size ; -SET @@global.query_prealloc_size = -1024; -SELECT @@global.query_prealloc_size ; +#SET @@global.query_prealloc_size = -1024; +#SELECT @@global.query_prealloc_size ; -SET @@global.query_prealloc_size = 429496729533; -SELECT @@global.query_prealloc_size ; +#SET @@global.query_prealloc_size = 429496729533; +#SELECT @@global.query_prealloc_size ; --Error ER_PARSE_ERROR @@ -137,8 +137,8 @@ SELECT @@global.query_prealloc_size ; SET @@session.query_prealloc_size = 0; SELECT @@session.query_prealloc_size ; -SET @@session.query_prealloc_size = -2; -SELECT @@session.query_prealloc_size ; +#SET @@session.query_prealloc_size = -2; +#SELECT @@session.query_prealloc_size ; --Error ER_PARSE_ERROR diff --git a/mysql-test/suite/sys_vars/inc/sort_buffer_size_basic.inc b/mysql-test/suite/sys_vars/inc/sort_buffer_size_basic.inc index 4dbae7c8847..19d8b442c2c 100644 --- a/mysql-test/suite/sys_vars/inc/sort_buffer_size_basic.inc +++ b/mysql-test/suite/sys_vars/inc/sort_buffer_size_basic.inc @@ -17,9 +17,12 @@ # * Valid & Invalid values # # * Scope & Access method # # * Data Integrity # +# Modified: Horst Hunger, 2008-11-28 # +# disabled warnings as they contain the values of this variable, # +# modified the check of the value only checking a range. # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ############################################################################### @@ -29,7 +32,7 @@ ###################################################################### -# START OF sort_buffer_size TESTS # +# START OF sort_buffer_size TESTS # ###################################################################### @@ -37,65 +40,74 @@ # Save initial value # ############################################################# -# due to difference when running on Windows (bug filed) +# due to differences when running on Windows (Bug#36695) --source include/not_windows.inc +let $kbrange32 = BETWEEN 32776 AND 32999; +let $mbrange2 = BETWEEN 2097116 AND 2100000; + +--disable_warnings + SET @start_global_value = @@global.sort_buffer_size; -SELECT @start_global_value; SET @start_session_value = @@session.sort_buffer_size; -SELECT @start_session_value; - --echo '#--------------------FN_DYNVARS_151_01-------------------------#' ###################################################################### -# Display the DEFAULT value of sort_buffer_size # +# Display the DEFAULT value of sort_buffer_size # ###################################################################### SET @@global.sort_buffer_size = 1000; SET @@global.sort_buffer_size = DEFAULT; -SELECT @@global.sort_buffer_size= 2097144 OR @@global.sort_buffer_size= 2097116; +eval +SELECT @@global.sort_buffer_size $mbrange2; SET @@session.sort_buffer_size = 2000; SET @@session.sort_buffer_size = DEFAULT; -SELECT @@session.sort_buffer_size= 2097144 OR @@session.sort_buffer_size= 2097116; +eval +SELECT @@session.sort_buffer_size $mbrange2; --echo '#--------------------FN_DYNVARS_151_02-------------------------#' ###################################################################### -# Check the DEFAULT value of sort_buffer_size # +# Check the DEFAULT value of sort_buffer_size # ###################################################################### SET @@global.sort_buffer_size = DEFAULT; -SELECT @@global.sort_buffer_size = 2097144 OR @@global.sort_buffer_size= 2097116; +eval +SELECT @@global.sort_buffer_size $mbrange2; SET @@session.sort_buffer_size = DEFAULT; -SELECT @@session.sort_buffer_size = 2097144 OR @@session.sort_buffer_size= 2097116; +eval +SELECT @@session.sort_buffer_size $mbrange2; --echo '#--------------------FN_DYNVARS_151_03-------------------------#' ################################################################################ -# Change the value of sort_buffer_size to a valid value for GLOBAL Scope # +# Change the value of sort_buffer_size to a valid value for GLOBAL Scope # ################################################################################ SET @@global.sort_buffer_size = 32776; -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; +eval +SELECT @@global.sort_buffer_size $kbrange32; SET @@global.sort_buffer_size = 32777; -SELECT @@global.sort_buffer_size= 32777 OR @@global.sort_buffer_size= 32804; +eval +SELECT @@global.sort_buffer_size $kbrange32; SET @@global.sort_buffer_size = 4294967295; SELECT @@global.sort_buffer_size; SET @@global.sort_buffer_size = 4294967294; SELECT @@global.sort_buffer_size; ---echo 'Bug# 34877: Invalid Values are showing in variable on assigning valid values.'; --echo '#--------------------FN_DYNVARS_151_04-------------------------#' ################################################################################### -# Change the value of sort_buffer_size to a valid value for SESSION Scope # +# Change the value of sort_buffer_size to a valid value for SESSION Scope # ################################################################################### SET @@session.sort_buffer_size = 32776; -SELECT @@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804; +eval +SELECT @@session.sort_buffer_size $kbrange32; SET @@session.sort_buffer_size = 32777; -SELECT @@session.sort_buffer_size= 32777 OR @@session.sort_buffer_size= 32804; +eval +SELECT @@session.sort_buffer_size $kbrange32; SET @@session.sort_buffer_size = 4294967295; SELECT @@session.sort_buffer_size; SET @@session.sort_buffer_size = 4294967294; @@ -104,13 +116,15 @@ SELECT @@session.sort_buffer_size; --echo '#------------------FN_DYNVARS_151_05-----------------------#' ################################################################## -# Change the value of sort_buffer_size to an invalid value # +# Change the value of sort_buffer_size to an invalid value # ################################################################## SET @@global.sort_buffer_size = 32775; -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; +eval +SELECT @@global.sort_buffer_size $kbrange32; SET @@global.sort_buffer_size = -1024; -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; +eval +SELECT @@global.sort_buffer_size $kbrange32; SET @@global.sort_buffer_size = 4294967296; SELECT @@global.sort_buffer_size; --Error ER_PARSE_ERROR @@ -121,19 +135,18 @@ SET @@global.sort_buffer_size = test; SELECT @@global.sort_buffer_size; SET @@session.sort_buffer_size = 32775; -SELECT @@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804; +eval +SELECT @@session.sort_buffer_size $kbrange32; SET @@session.sort_buffer_size = -2; -SELECT @@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804; +eval +SELECT @@session.sort_buffer_size $kbrange32; --Error ER_PARSE_ERROR SET @@session.sort_buffer_size = 65530.34.; SET @@session.sort_buffer_size = 4294967296; SELECT @@session.sort_buffer_size; ---echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; --Error ER_WRONG_TYPE_FOR_VAR SET @@session.sort_buffer_size = test; -SELECT @@session.sort_buffer_size; - --echo '#------------------FN_DYNVARS_151_06-----------------------#' #################################################################### @@ -141,14 +154,16 @@ SELECT @@session.sort_buffer_size; #################################################################### -SELECT @@global.sort_buffer_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; +SELECT @@global.sort_buffer_size = VARIABLE_VALUE FROM + INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; --echo '#------------------FN_DYNVARS_151_07-----------------------#' #################################################################### # Check if the value in SESSION Table matches value in variable # #################################################################### -SELECT @@session.sort_buffer_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; +SELECT @@session.sort_buffer_size = VARIABLE_VALUE FROM +INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; --echo '#------------------FN_DYNVARS_151_08-----------------------#' @@ -157,25 +172,24 @@ SELECT @@session.sort_buffer_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSI #################################################################### SET @@global.sort_buffer_size = TRUE; -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; +eval +SELECT @@global.sort_buffer_size $kbrange32; SET @@global.sort_buffer_size = FALSE; -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -echo 'Bug: Errors should be displayed on assigning TRUE/FALSE to variable'; - +eval +SELECT @@global.sort_buffer_size $kbrange32; --echo '#---------------------FN_DYNVARS_151_09----------------------#' #################################################################################### -# Check if accessing variable with and without GLOBAL point to same variable # +# Check if accessing variable with and without GLOBAL point to same variable # #################################################################################### SET @@global.sort_buffer_size = 9000; SELECT @@sort_buffer_size = @@global.sort_buffer_size; - --echo '#---------------------FN_DYNVARS_151_10----------------------#' -######################################################################################################## -# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # -######################################################################################################## +################################################################################################### +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable# +################################################################################################### SET @@sort_buffer_size = 9000; SELECT @@sort_buffer_size = @@local.sort_buffer_size; @@ -184,12 +198,12 @@ SELECT @@local.sort_buffer_size = @@session.sort_buffer_size; --echo '#---------------------FN_DYNVARS_151_11----------------------#' ################################################################################### -# Check if sort_buffer_size can be accessed with and without @@ sign # +# Check if sort_buffer_size can be accessed with and without @@ sign # ################################################################################### SET sort_buffer_size = 9100; -SELECT @sort_buffer_size= 32776 OR @@sort_buffer_size= 32804; -SELECT @@sort_buffer_size; +eval +SELECT @@sort_buffer_size $kbrange32; --Error ER_UNKNOWN_TABLE SELECT local.sort_buffer_size; --Error ER_UNKNOWN_TABLE @@ -203,11 +217,11 @@ SELECT sort_buffer_size = @@session.sort_buffer_size; #################################### SET @@global.sort_buffer_size = @start_global_value; -SELECT @@global.sort_buffer_size; SET @@session.sort_buffer_size = @start_session_value; -SELECT @@session.sort_buffer_size; +--enable_warnings ############################################################# -# END OF sort_buffer_size TESTS # +# END OF sort_buffer_size TESTS # ############################################################# + diff --git a/mysql-test/suite/sys_vars/inc/timestamp_basic.inc b/mysql-test/suite/sys_vars/inc/timestamp_basic.inc index d7ad620ec26..9ef57c97043 100644 --- a/mysql-test/suite/sys_vars/inc/timestamp_basic.inc +++ b/mysql-test/suite/sys_vars/inc/timestamp_basic.inc @@ -18,8 +18,8 @@ # * Scope & Access method # # * Data Integrity # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ############################################################################### @@ -102,9 +102,10 @@ SET @@timestamp = 9999999999999999999999; # Check if the value in SESSION Table matches value in variable # ######################################################################### -SELECT @@timestamp = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.SESSION_VARIABLES -WHERE VARIABLE_NAME='timestamp'; +# disabled due to bug#41584 +#SELECT @@timestamp = VARIABLE_VALUE +#FROM INFORMATION_SCHEMA.SESSION_VARIABLES +#WHERE VARIABLE_NAME='timestamp'; --echo '#---------------------FN_DYNVARS_001_08-------------------------#' ############################################################################# diff --git a/mysql-test/r/auto_commit_basic.result b/mysql-test/suite/sys_vars/r/auto_commit_basic.result index c3643aaa1db..c3643aaa1db 100644 --- a/mysql-test/r/auto_commit_basic.result +++ b/mysql-test/suite/sys_vars/r/auto_commit_basic.result diff --git a/mysql-test/r/auto_increment_increment_basic.result b/mysql-test/suite/sys_vars/r/auto_increment_increment_basic.result index c453d2322cf..c453d2322cf 100644 --- a/mysql-test/r/auto_increment_increment_basic.result +++ b/mysql-test/suite/sys_vars/r/auto_increment_increment_basic.result diff --git a/mysql-test/r/auto_increment_increment_func.result b/mysql-test/suite/sys_vars/r/auto_increment_increment_func.result index f0f1ada6d95..f0f1ada6d95 100644 --- a/mysql-test/r/auto_increment_increment_func.result +++ b/mysql-test/suite/sys_vars/r/auto_increment_increment_func.result diff --git a/mysql-test/r/auto_increment_offset_basic.result b/mysql-test/suite/sys_vars/r/auto_increment_offset_basic.result index b5ccca8ce56..b5ccca8ce56 100644 --- a/mysql-test/r/auto_increment_offset_basic.result +++ b/mysql-test/suite/sys_vars/r/auto_increment_offset_basic.result diff --git a/mysql-test/r/auto_increment_offset_func.result b/mysql-test/suite/sys_vars/r/auto_increment_offset_func.result index 5c953544e73..5c953544e73 100644 --- a/mysql-test/r/auto_increment_offset_func.result +++ b/mysql-test/suite/sys_vars/r/auto_increment_offset_func.result diff --git a/mysql-test/r/autocommit_func.result b/mysql-test/suite/sys_vars/r/autocommit_func.result index 47c2c921022..47c2c921022 100644 --- a/mysql-test/r/autocommit_func.result +++ b/mysql-test/suite/sys_vars/r/autocommit_func.result diff --git a/mysql-test/r/automatic_sp_privileges_basic.result b/mysql-test/suite/sys_vars/r/automatic_sp_privileges_basic.result index b9cf9b5ee80..b9cf9b5ee80 100644 --- a/mysql-test/r/automatic_sp_privileges_basic.result +++ b/mysql-test/suite/sys_vars/r/automatic_sp_privileges_basic.result diff --git a/mysql-test/r/automatic_sp_privileges_func.result b/mysql-test/suite/sys_vars/r/automatic_sp_privileges_func.result index dac956fb091..dac956fb091 100644 --- a/mysql-test/r/automatic_sp_privileges_func.result +++ b/mysql-test/suite/sys_vars/r/automatic_sp_privileges_func.result diff --git a/mysql-test/r/basedir_basic.result b/mysql-test/suite/sys_vars/r/basedir_basic.result index 9b18f08305c..9b18f08305c 100644 --- a/mysql-test/r/basedir_basic.result +++ b/mysql-test/suite/sys_vars/r/basedir_basic.result diff --git a/mysql-test/r/big_tables_basic.result b/mysql-test/suite/sys_vars/r/big_tables_basic.result index 937576a76d3..937576a76d3 100644 --- a/mysql-test/r/big_tables_basic.result +++ b/mysql-test/suite/sys_vars/r/big_tables_basic.result diff --git a/mysql-test/r/binlog_format_basic.result b/mysql-test/suite/sys_vars/r/binlog_format_basic.result index 72ba35cd753..0d76d9686e3 100644 --- a/mysql-test/r/binlog_format_basic.result +++ b/mysql-test/suite/sys_vars/r/binlog_format_basic.result @@ -2,6 +2,7 @@ SELECT @@GLOBAL.binlog_format; @@GLOBAL.binlog_format STATEMENT '#---------------------BS_STVARS_002_01----------------------#' +SET @start_value= @@global.binlog_format; SELECT COUNT(@@GLOBAL.binlog_format); COUNT(@@GLOBAL.binlog_format) 1 @@ -12,19 +13,13 @@ COUNT(@@SESSION.binlog_format) 1 Expected '#---------------------BS_STVARS_002_02----------------------#' SET @@GLOBAL.binlog_format=1; -Expected error 'Read only variable' -Bug: Writeable static variable -SELECT COUNT(@@GLOBAL.binlog_format); -COUNT(@@GLOBAL.binlog_format) -1 -1 Expected +SELECT @@GLOBAL.binlog_format; +@@GLOBAL.binlog_format +STATEMENT SET @@SESSION.binlog_format=1; -Expected error 'Read only variable' -Bug: Writeable static variable -SELECT COUNT(@@SESSION.binlog_format); -COUNT(@@SESSION.binlog_format) -1 -1 Expected +SELECT @@SESSION.binlog_format; +@@SESSION.binlog_format +STATEMENT '#---------------------BS_STVARS_002_03----------------------#' SELECT @@GLOBAL.binlog_format = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES @@ -37,14 +32,14 @@ COUNT(@@GLOBAL.binlog_format) 1 1 Expected SELECT COUNT(VARIABLE_VALUE) -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='binlog_format'; COUNT(VARIABLE_VALUE) 1 1 Expected '#---------------------BS_STVARS_002_04----------------------#' -SELECT @@SESSION.binlog_format = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.SESSION_VARIABLES +SELECT @@SESSION.binlog_format = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='binlog_format'; @@SESSION.binlog_format = VARIABLE_VALUE 1 @@ -54,7 +49,7 @@ COUNT(@@SESSION.binlog_format) 1 1 Expected SELECT COUNT(VARIABLE_VALUE) -FROM INFORMATION_SCHEMA.SESSION_VARIABLES +FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='binlog_format'; COUNT(VARIABLE_VALUE) 1 @@ -76,3 +71,4 @@ SELECT COUNT(@@GLOBAL.binlog_format); COUNT(@@GLOBAL.binlog_format) 1 1 Expected +SET @@global.binlog_format= @start_value; diff --git a/mysql-test/r/character_set_client_basic.result b/mysql-test/suite/sys_vars/r/character_set_client_basic.result index c946d5109a8..c946d5109a8 100644 --- a/mysql-test/r/character_set_client_basic.result +++ b/mysql-test/suite/sys_vars/r/character_set_client_basic.result diff --git a/mysql-test/r/character_set_client_func.result b/mysql-test/suite/sys_vars/r/character_set_client_func.result index 087db21639b..087db21639b 100644 --- a/mysql-test/r/character_set_client_func.result +++ b/mysql-test/suite/sys_vars/r/character_set_client_func.result diff --git a/mysql-test/r/character_set_connection_basic.result b/mysql-test/suite/sys_vars/r/character_set_connection_basic.result index 18697a20fb9..18697a20fb9 100644 --- a/mysql-test/r/character_set_connection_basic.result +++ b/mysql-test/suite/sys_vars/r/character_set_connection_basic.result diff --git a/mysql-test/r/character_set_connection_func.result b/mysql-test/suite/sys_vars/r/character_set_connection_func.result index 2f5d28ec8af..6fc33a4f369 100644 --- a/mysql-test/r/character_set_connection_func.result +++ b/mysql-test/suite/sys_vars/r/character_set_connection_func.result @@ -15,7 +15,7 @@ utf8 '#--------------------FN_DYNVARS_011_02-------------------------#' 'connection default' DROP TABLE IF EXISTS t1; -CREATE TABLE t1(b CHAR(40) character set utf8); +CREATE TABLE t1(b CHAR(40) CHARACTER SET utf8); '--verify that character_set_connection converts character_set_client--' SET @@session.character_set_client = utf8; SET @@session.character_set_results = utf8; @@ -53,3 +53,4 @@ SET @@global.character_set_connection = @global_character_set_connection; SET @@session.character_set_connection = @session_character_set_connection; SET @@session.character_set_client = @session_character_set_client; SET @@session.character_set_results = @session_character_set_results; +DROP TABLE t1; diff --git a/mysql-test/r/character_set_database_basic.result b/mysql-test/suite/sys_vars/r/character_set_database_basic.result index 4380fea4c81..4380fea4c81 100644 --- a/mysql-test/r/character_set_database_basic.result +++ b/mysql-test/suite/sys_vars/r/character_set_database_basic.result diff --git a/mysql-test/r/character_set_database_func.result b/mysql-test/suite/sys_vars/r/character_set_database_func.result index 95b65eacfd2..bc512c73855 100644 --- a/mysql-test/r/character_set_database_func.result +++ b/mysql-test/suite/sys_vars/r/character_set_database_func.result @@ -59,14 +59,14 @@ USE test; CREATE TABLE t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; 'Verify with latin'; SET @@session.character_set_database = latin1; -LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data_ln/charset_utf8.txt' INTO TABLE t1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/charset_utf8.txt' INTO TABLE t1; SELECT count(*) FROM t1 WHERE CHAR_LENGTH(a)>1; count(*) 2433 TRUNCATE TABLE t1; 'Verify with utf8'; SET @@session.character_set_database = utf8; -LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data_ln/charset_utf8.txt' INTO TABLE t1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/charset_utf8.txt' INTO TABLE t1; SELECT count(*) FROM t1 WHERE CHAR_LENGTH(a)>1; count(*) 1 diff --git a/mysql-test/r/character_set_filesystem_basic.result b/mysql-test/suite/sys_vars/r/character_set_filesystem_basic.result index 11f85528593..11f85528593 100644 --- a/mysql-test/r/character_set_filesystem_basic.result +++ b/mysql-test/suite/sys_vars/r/character_set_filesystem_basic.result diff --git a/mysql-test/r/character_set_results_basic.result b/mysql-test/suite/sys_vars/r/character_set_results_basic.result Binary files differindex 71c01a3dc0d..71c01a3dc0d 100644 --- a/mysql-test/r/character_set_results_basic.result +++ b/mysql-test/suite/sys_vars/r/character_set_results_basic.result diff --git a/mysql-test/r/character_set_results_func.result b/mysql-test/suite/sys_vars/r/character_set_results_func.result index d92821fdfa6..d92821fdfa6 100644 --- a/mysql-test/r/character_set_results_func.result +++ b/mysql-test/suite/sys_vars/r/character_set_results_func.result diff --git a/mysql-test/r/character_set_server_basic.result b/mysql-test/suite/sys_vars/r/character_set_server_basic.result index 83545128a76..83545128a76 100644 --- a/mysql-test/r/character_set_server_basic.result +++ b/mysql-test/suite/sys_vars/r/character_set_server_basic.result diff --git a/mysql-test/r/character_set_server_func.result b/mysql-test/suite/sys_vars/r/character_set_server_func.result index 3731f27adae..3731f27adae 100644 --- a/mysql-test/r/character_set_server_func.result +++ b/mysql-test/suite/sys_vars/r/character_set_server_func.result diff --git a/mysql-test/r/character_set_system_basic.result b/mysql-test/suite/sys_vars/r/character_set_system_basic.result index 9f4b68ae861..9f4b68ae861 100644 --- a/mysql-test/r/character_set_system_basic.result +++ b/mysql-test/suite/sys_vars/r/character_set_system_basic.result diff --git a/mysql-test/r/collation_connection_basic.result b/mysql-test/suite/sys_vars/r/collation_connection_basic.result index bc6074e2614..bc6074e2614 100644 --- a/mysql-test/r/collation_connection_basic.result +++ b/mysql-test/suite/sys_vars/r/collation_connection_basic.result diff --git a/mysql-test/r/collation_connection_func.result b/mysql-test/suite/sys_vars/r/collation_connection_func.result index 18f82dc60e1..18f82dc60e1 100644 --- a/mysql-test/r/collation_connection_func.result +++ b/mysql-test/suite/sys_vars/r/collation_connection_func.result diff --git a/mysql-test/r/collation_database_basic.result b/mysql-test/suite/sys_vars/r/collation_database_basic.result index d4375b7c8e4..d4375b7c8e4 100644 --- a/mysql-test/r/collation_database_basic.result +++ b/mysql-test/suite/sys_vars/r/collation_database_basic.result diff --git a/mysql-test/r/collation_database_func.result b/mysql-test/suite/sys_vars/r/collation_database_func.result index dae8677eecf..dae8677eecf 100644 --- a/mysql-test/r/collation_database_func.result +++ b/mysql-test/suite/sys_vars/r/collation_database_func.result diff --git a/mysql-test/r/collation_server_basic.result b/mysql-test/suite/sys_vars/r/collation_server_basic.result index 5e36643a3c9..5e36643a3c9 100644 --- a/mysql-test/r/collation_server_basic.result +++ b/mysql-test/suite/sys_vars/r/collation_server_basic.result diff --git a/mysql-test/r/collation_server_func.result b/mysql-test/suite/sys_vars/r/collation_server_func.result index 98672bc452b..98672bc452b 100644 --- a/mysql-test/r/collation_server_func.result +++ b/mysql-test/suite/sys_vars/r/collation_server_func.result diff --git a/mysql-test/r/completion_type_basic.result b/mysql-test/suite/sys_vars/r/completion_type_basic.result index 93bfe581182..93bfe581182 100644 --- a/mysql-test/r/completion_type_basic.result +++ b/mysql-test/suite/sys_vars/r/completion_type_basic.result diff --git a/mysql-test/r/completion_type_func.result b/mysql-test/suite/sys_vars/r/completion_type_func.result index 282bd1006cd..daee738c10d 100644 --- a/mysql-test/r/completion_type_func.result +++ b/mysql-test/suite/sys_vars/r/completion_type_func.result @@ -1,67 +1,67 @@ -drop table if exists t1; +DROP TABLE IF EXISTS t1; ## Creating new table ## CREATE TABLE t1 ( -id INT NOT NULL auto_increment, +id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (id), -name varchar(30) +name VARCHAR(30) ) ENGINE = INNODB; '#--------------------FN_DYNVARS_017_01-------------------------#' ## Creating new connection ## -INSERT into t1(name) values('Record_1'); +INSERT INTO t1(name) VALUES('Record_1'); SET @@autocommit = 0; -SELECT * from t1; +SELECT * FROM t1; id name 1 Record_1 ## Setting value of variable to 0 ## SET @@session.completion_type = 0; ## Here commit & rollback should work normally ## START TRANSACTION; -SELECT * from t1; +SELECT * FROM t1; id name 1 Record_1 -INSERT into t1(name) values('Record_2'); -INSERT into t1(name) values('Record_3'); -SELECT * from t1; +INSERT INTO t1(name) VALUES('Record_2'); +INSERT INTO t1(name) VALUES('Record_3'); +SELECT * FROM t1; id name 1 Record_1 2 Record_2 3 Record_3 -DELETE FROM t1 where id = 2; -SELECT * from t1; +DELETE FROM t1 WHERE id = 2; +SELECT * FROM t1; id name 1 Record_1 3 Record_3 START TRANSACTION; -SELECT * from t1; +SELECT * FROM t1; id name 1 Record_1 3 Record_3 -INSERT into t1(name) values('Record_4'); -INSERT into t1(name) values('Record_5'); +INSERT INTO t1(name) VALUES('Record_4'); +INSERT INTO t1(name) VALUES('Record_5'); COMMIT; '#--------------------FN_DYNVARS_017_02-------------------------#' SET @@session.completion_type = 2; ## Here commit should work as COMMIT RELEASE ## START TRANSACTION; -SELECT * from t1; +SELECT * FROM t1; id name 1 Record_1 3 Record_3 4 Record_4 5 Record_5 -INSERT into t1(name) values('Record_6'); -INSERT into t1(name) values('Record_7'); +INSERT INTO t1(name) VALUES('Record_6'); +INSERT INTO t1(name) VALUES('Record_7'); COMMIT; ## Inserting rows should give error here because connection should ## ## disconnect after using COMMIT ## -INSERT into t1(name) values('Record_4'); +INSERT INTO t1(name) VALUES('Record_4'); Got one of the listed errors ## Creating new connection test_con2 ## SET @@session.completion_type = 2; ## Inserting rows and using Rollback which should Rollback & release ## START TRANSACTION; -SELECT * from t1; +SELECT * FROM t1; id name 1 Record_1 3 Record_3 @@ -69,8 +69,9 @@ id name 5 Record_5 6 Record_6 7 Record_7 -INSERT into t1(name) values('Record_8'); -INSERT into t1(name) values('Record_9'); +INSERT INTO t1(name) VALUES('Record_8'); +INSERT INTO t1(name) VALUES('Record_9'); ROLLBACK; -INSERT into t1(name) values('Record_4'); +INSERT INTO t1(name) VALUES('Record_4'); Got one of the listed errors +DROP TABLE t1; diff --git a/mysql-test/r/concurrent_insert_basic.result b/mysql-test/suite/sys_vars/r/concurrent_insert_basic.result index e6614ea6abb..e6614ea6abb 100644 --- a/mysql-test/r/concurrent_insert_basic.result +++ b/mysql-test/suite/sys_vars/r/concurrent_insert_basic.result diff --git a/mysql-test/suite/sys_vars/r/concurrent_insert_func.result b/mysql-test/suite/sys_vars/r/concurrent_insert_func.result new file mode 100644 index 00000000000..774775a8287 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/concurrent_insert_func.result @@ -0,0 +1,121 @@ +DROP TABLE IF EXISTS t1; +## Creating new table ## +CREATE TABLE t1 +( +name VARCHAR(30) +); +'#--------------------FN_DYNVARS_018_01-------------------------#' +SET @start_value= @@global.concurrent_insert; +## Setting initial value of variable to 1 ## +SET @@global.concurrent_insert = 1; +INSERT INTO t1(name) VALUES('Record_1'); +INSERT INTO t1(name) VALUES('Record_2'); +INSERT INTO t1(name) VALUES('Record_3'); +## locking table ## +LOCK TABLE t1 READ LOCAL; +## Creating new connection to insert some rows in table ## +connection test_con1; +## New records should come at the end of all rows ## +INSERT INTO t1(name) VALUES('Record_4'); +SELECT * FROM t1; +name +Record_1 +Record_2 +Record_3 +Record_4 +## unlocking tables ## +connection default; +UNLOCK TABLES; +## deleting record to create hole in table ## +DELETE FROM t1 WHERE name ='Record_2'; +'#--------------------FN_DYNVARS_018_02-------------------------#' +LOCK TABLE t1 READ LOCAL; +connection test_con1; +SET @@global.concurrent_insert=1; +## send INSERT which should be blocked until unlock of the table ## +INSERT INTO t1(name) VALUES('Record_7'); +connection default; +## show processlist info and state ## +SELECT state,info FROM INFORMATION_SCHEMA.PROCESSLIST +WHERE state= "Locked" AND info LIKE "INSERT INTO t1%"; +state info +Locked INSERT INTO t1(name) VALUES('Record_7') +## table contents befor UNLOCK ## +SELECT * FROM t1; +name +Record_1 +Record_3 +Record_4 +UNLOCK TABLES; +## table contens after UNLOCK ## +SELECT * FROM t1; +name +Record_1 +Record_7 +Record_3 +Record_4 +INSERT INTO t1(name) VALUES('Record_6'); +connection test_con1; +SELECT * FROM t1; +name +Record_1 +Record_7 +Record_3 +Record_4 +Record_6 +connection default; +'#--------------------FN_DYNVARS_018_03-------------------------#' +## lock table and connect with connection1 ## +LOCK TABLE t1 READ LOCAL; +connection test_con1; +## setting value of concurrent_insert to 2 ## +SET @@global.concurrent_insert=2; +## Inserting record in table, record should go at the end of the table ## +INSERT INTO t1(name) VALUES('Record_5'); +SELECT * FROM t1; +name +Record_1 +Record_7 +Record_3 +Record_4 +Record_6 +Record_5 +SELECT @@concurrent_insert; +@@concurrent_insert +2 +connection default; +## Unlocking table ## +UNLOCK TABLES; +SELECT * FROM t1; +name +Record_1 +Record_7 +Record_3 +Record_4 +Record_6 +Record_5 +## Inserting new row, this should go in the hole ## +INSERT INTO t1(name) VALUES('Record_6'); +SELECT * FROM t1; +name +Record_1 +Record_7 +Record_3 +Record_4 +Record_6 +Record_5 +Record_6 +## connection test_con1 ## +DELETE FROM t1 WHERE name ='Record_3'; +SELECT * FROM t1; +name +Record_1 +Record_7 +Record_4 +Record_6 +Record_5 +Record_6 +## Dropping table ## +DROP TABLE t1; +## Disconnecting connection ## +SET @@global.concurrent_insert= @start_value; diff --git a/mysql-test/r/connect_timeout_basic.result b/mysql-test/suite/sys_vars/r/connect_timeout_basic.result index 7cdd747fc15..7cdd747fc15 100644 --- a/mysql-test/r/connect_timeout_basic.result +++ b/mysql-test/suite/sys_vars/r/connect_timeout_basic.result diff --git a/mysql-test/r/datadir_basic.result b/mysql-test/suite/sys_vars/r/datadir_basic.result index ade6f2873e8..ade6f2873e8 100644 --- a/mysql-test/r/datadir_basic.result +++ b/mysql-test/suite/sys_vars/r/datadir_basic.result diff --git a/mysql-test/r/default_week_format_basic.result b/mysql-test/suite/sys_vars/r/default_week_format_basic.result index d513ef1c41e..d513ef1c41e 100644 --- a/mysql-test/r/default_week_format_basic.result +++ b/mysql-test/suite/sys_vars/r/default_week_format_basic.result diff --git a/mysql-test/r/default_week_format_func.result b/mysql-test/suite/sys_vars/r/default_week_format_func.result index 279a1785255..279a1785255 100644 --- a/mysql-test/r/default_week_format_func.result +++ b/mysql-test/suite/sys_vars/r/default_week_format_func.result diff --git a/mysql-test/r/delay_key_write_basic.result b/mysql-test/suite/sys_vars/r/delay_key_write_basic.result index 100c62ac47e..100c62ac47e 100644 --- a/mysql-test/r/delay_key_write_basic.result +++ b/mysql-test/suite/sys_vars/r/delay_key_write_basic.result diff --git a/mysql-test/r/delay_key_write_func.result b/mysql-test/suite/sys_vars/r/delay_key_write_func.result index ca4e25e08b1..d55cca7ab8e 100644 --- a/mysql-test/r/delay_key_write_func.result +++ b/mysql-test/suite/sys_vars/r/delay_key_write_func.result @@ -1,4 +1,5 @@ '#--------------------FN_DYNVARS_023_01-------------------------#' +SET @start_value= @@global.delay_key_write; SET @@global.delay_key_write = ON; SELECT @@global.delay_key_write; @@global.delay_key_write @@ -28,8 +29,8 @@ Key_writes 9 SHOW STATUS LIKE 'Key_write_requests'; Variable_name Value Key_write_requests 9 -select count(*) from t1; -count(*) +SELECT COUNT(*) FROM t1; +COUNT(*) 9 '----check when delay_key_write is ON---' SET @@global.delay_key_write = ON; @@ -44,8 +45,8 @@ Key_writes 0 SHOW STATUS LIKE 'Key_write_requests'; Variable_name Value Key_write_requests 9 -select count(*) from t1; -count(*) +SELECT COUNT(*) FROM t1; +COUNT(*) 9 '----check when delay_key_write is ALL---' SET @@global.delay_key_write = ALL; @@ -60,8 +61,9 @@ Key_writes 0 SHOW STATUS LIKE 'Key_write_requests'; Variable_name Value Key_write_requests 9 -select count(*) from t1; -count(*) +SELECT COUNT(*) FROM t1; +COUNT(*) 9 DROP PROCEDURE sp_addRecords; DROP TABLE t1; +SET @@global.delay_key_write= @start_value; diff --git a/mysql-test/r/delayed_insert_limit_func.result b/mysql-test/suite/sys_vars/r/delayed_insert_limit_func.result index d7129d24498..d7129d24498 100644 --- a/mysql-test/r/delayed_insert_limit_func.result +++ b/mysql-test/suite/sys_vars/r/delayed_insert_limit_func.result diff --git a/mysql-test/r/delayed_insert_timeout_basic.result b/mysql-test/suite/sys_vars/r/delayed_insert_timeout_basic.result index 4049907eb80..4049907eb80 100644 --- a/mysql-test/r/delayed_insert_timeout_basic.result +++ b/mysql-test/suite/sys_vars/r/delayed_insert_timeout_basic.result diff --git a/mysql-test/r/div_precision_increment_basic.result b/mysql-test/suite/sys_vars/r/div_precision_increment_basic.result index d0311afa681..d0311afa681 100644 --- a/mysql-test/r/div_precision_increment_basic.result +++ b/mysql-test/suite/sys_vars/r/div_precision_increment_basic.result diff --git a/mysql-test/r/div_precision_increment_func.result b/mysql-test/suite/sys_vars/r/div_precision_increment_func.result index eb1fc7ae3a7..eb1fc7ae3a7 100644 --- a/mysql-test/r/div_precision_increment_func.result +++ b/mysql-test/suite/sys_vars/r/div_precision_increment_func.result diff --git a/mysql-test/r/engine_condition_pushdown_basic.result b/mysql-test/suite/sys_vars/r/engine_condition_pushdown_basic.result index 7073066c2f1..7073066c2f1 100644 --- a/mysql-test/r/engine_condition_pushdown_basic.result +++ b/mysql-test/suite/sys_vars/r/engine_condition_pushdown_basic.result diff --git a/mysql-test/r/error_count_basic.result b/mysql-test/suite/sys_vars/r/error_count_basic.result index ea48b7d5b73..ea48b7d5b73 100644 --- a/mysql-test/r/error_count_basic.result +++ b/mysql-test/suite/sys_vars/r/error_count_basic.result diff --git a/mysql-test/r/event_scheduler_basic.result b/mysql-test/suite/sys_vars/r/event_scheduler_basic.result index 8042187d39d..8042187d39d 100644 --- a/mysql-test/r/event_scheduler_basic.result +++ b/mysql-test/suite/sys_vars/r/event_scheduler_basic.result diff --git a/mysql-test/r/event_scheduler_func.result b/mysql-test/suite/sys_vars/r/event_scheduler_func.result index 8da942e919c..8da942e919c 100644 --- a/mysql-test/r/event_scheduler_func.result +++ b/mysql-test/suite/sys_vars/r/event_scheduler_func.result diff --git a/mysql-test/r/expire_logs_days_basic.result b/mysql-test/suite/sys_vars/r/expire_logs_days_basic.result index 66aa5fa42a5..66aa5fa42a5 100644 --- a/mysql-test/r/expire_logs_days_basic.result +++ b/mysql-test/suite/sys_vars/r/expire_logs_days_basic.result diff --git a/mysql-test/r/flush_basic.result b/mysql-test/suite/sys_vars/r/flush_basic.result index 259f8f929a1..259f8f929a1 100644 --- a/mysql-test/r/flush_basic.result +++ b/mysql-test/suite/sys_vars/r/flush_basic.result diff --git a/mysql-test/r/foreign_key_checks_basic.result b/mysql-test/suite/sys_vars/r/foreign_key_checks_basic.result index e09e680fe99..e09e680fe99 100644 --- a/mysql-test/r/foreign_key_checks_basic.result +++ b/mysql-test/suite/sys_vars/r/foreign_key_checks_basic.result diff --git a/mysql-test/r/foreign_key_checks_func.result b/mysql-test/suite/sys_vars/r/foreign_key_checks_func.result index c2898293f83..c2898293f83 100644 --- a/mysql-test/r/foreign_key_checks_func.result +++ b/mysql-test/suite/sys_vars/r/foreign_key_checks_func.result diff --git a/mysql-test/r/ft_boolean_syntax_basic.result b/mysql-test/suite/sys_vars/r/ft_boolean_syntax_basic.result index 94a052172bb..94a052172bb 100644 --- a/mysql-test/r/ft_boolean_syntax_basic.result +++ b/mysql-test/suite/sys_vars/r/ft_boolean_syntax_basic.result diff --git a/mysql-test/r/ft_boolean_syntax_func.result b/mysql-test/suite/sys_vars/r/ft_boolean_syntax_func.result index 4a3159c77c3..4a3159c77c3 100644 --- a/mysql-test/r/ft_boolean_syntax_func.result +++ b/mysql-test/suite/sys_vars/r/ft_boolean_syntax_func.result diff --git a/mysql-test/r/general_log_basic.result b/mysql-test/suite/sys_vars/r/general_log_basic.result index 18a5fde45c0..18a5fde45c0 100644 --- a/mysql-test/r/general_log_basic.result +++ b/mysql-test/suite/sys_vars/r/general_log_basic.result diff --git a/mysql-test/r/general_log_file_basic.result b/mysql-test/suite/sys_vars/r/general_log_file_basic.result index 6847d92688e..48a8d90b55e 100644 --- a/mysql-test/r/general_log_file_basic.result +++ b/mysql-test/suite/sys_vars/r/general_log_file_basic.result @@ -6,7 +6,7 @@ test.log SET @@global.general_log_file = DEFAULT; SELECT RIGHT(@@global.general_log_file,10) AS log_file; log_file -master.log +mysqld.log '#--------------------FN_DYNVARS_004_02------------------------#' SET @@global.general_log_file = mytest.log; SET @@global.general_log_file = 12; @@ -17,3 +17,4 @@ FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='general_log_file'; @@global.general_log_file = VARIABLE_VALUE 1 +SET @@global.general_log_file= @start_value; diff --git a/mysql-test/r/general_log_file_func.result b/mysql-test/suite/sys_vars/r/general_log_file_func.result index 42ef723e644..482a03c1a97 100644 --- a/mysql-test/r/general_log_file_func.result +++ b/mysql-test/suite/sys_vars/r/general_log_file_func.result @@ -1,8 +1,8 @@ -drop table if exists t1; +DROP TABLE IF EXISTS t1; ## Creating new table ## CREATE TABLE t1 ( -id INT NOT NULL auto_increment, +id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (id), name VARCHAR(30) ); @@ -10,10 +10,10 @@ name VARCHAR(30) SELECT @@general_log_file; @@general_log_file mysql-test.log -INSERT into t1(name) values('Record_1'); -INSERT into t1(name) values('Record_2'); -INSERT into t1(name) values('Record_3'); -INSERT into t1(name) values('Record_4'); +INSERT INTO t1(name) VALUES('Record_1'); +INSERT INTO t1(name) VALUES('Record_2'); +INSERT INTO t1(name) VALUES('Record_3'); +INSERT INTO t1(name) VALUES('Record_4'); ## Verifying general log file ## ## Dropping table ## DROP TABLE t1; diff --git a/mysql-test/r/general_log_func.result b/mysql-test/suite/sys_vars/r/general_log_func.result index 3bbd93f7207..39ba90265d5 100644 --- a/mysql-test/r/general_log_func.result +++ b/mysql-test/suite/sys_vars/r/general_log_func.result @@ -25,8 +25,12 @@ SELECT @@general_log; ## Inserting some Records & Verifying output in log ## INSERT into t1(name) values('Record_3'); INSERT into t1(name) values('Record_4'); -## There should be no difference, case should pass ## -## This case is failing which shows that mysql is writing in general ## -## log when we set general_log to ON ## +## There should be a difference ## +SET @@global.max_allowed_packet= 1024*1024*1024; +SET @orig_file= load_file('MYSQLD_LOGFILE.orig'); +SET @copy_file= load_file('MYSQLD_LOGFILE.copy'); +SELECT STRCMP(@orig_file, @copy_file); +STRCMP(@orig_file, @copy_file) +1 ## Dropping tables ## DROP TABLE t1; diff --git a/mysql-test/r/group_concat_max_len_basic.result b/mysql-test/suite/sys_vars/r/group_concat_max_len_basic.result index 5704f00c014..5704f00c014 100644 --- a/mysql-test/r/group_concat_max_len_basic.result +++ b/mysql-test/suite/sys_vars/r/group_concat_max_len_basic.result diff --git a/mysql-test/r/group_concat_max_len_func.result b/mysql-test/suite/sys_vars/r/group_concat_max_len_func.result index 52d67b8d274..52d67b8d274 100644 --- a/mysql-test/r/group_concat_max_len_func.result +++ b/mysql-test/suite/sys_vars/r/group_concat_max_len_func.result diff --git a/mysql-test/r/have_compress_basic.result b/mysql-test/suite/sys_vars/r/have_compress_basic.result index 9b48d0c4dff..9b48d0c4dff 100644 --- a/mysql-test/r/have_compress_basic.result +++ b/mysql-test/suite/sys_vars/r/have_compress_basic.result diff --git a/mysql-test/r/have_crypt_basic.result b/mysql-test/suite/sys_vars/r/have_crypt_basic.result index 3a3c221290b..3a3c221290b 100644 --- a/mysql-test/r/have_crypt_basic.result +++ b/mysql-test/suite/sys_vars/r/have_crypt_basic.result diff --git a/mysql-test/r/have_csv_basic.result b/mysql-test/suite/sys_vars/r/have_csv_basic.result index 3427d633f98..3427d633f98 100644 --- a/mysql-test/r/have_csv_basic.result +++ b/mysql-test/suite/sys_vars/r/have_csv_basic.result diff --git a/mysql-test/r/have_dynamic_loading_basic.result b/mysql-test/suite/sys_vars/r/have_dynamic_loading_basic.result index fba43958a69..fba43958a69 100644 --- a/mysql-test/r/have_dynamic_loading_basic.result +++ b/mysql-test/suite/sys_vars/r/have_dynamic_loading_basic.result diff --git a/mysql-test/r/have_geometry_basic.result b/mysql-test/suite/sys_vars/r/have_geometry_basic.result index 1d5a379c7bc..1d5a379c7bc 100644 --- a/mysql-test/r/have_geometry_basic.result +++ b/mysql-test/suite/sys_vars/r/have_geometry_basic.result diff --git a/mysql-test/r/have_innodb_basic.result b/mysql-test/suite/sys_vars/r/have_innodb_basic.result index 017512f3ae0..017512f3ae0 100644 --- a/mysql-test/r/have_innodb_basic.result +++ b/mysql-test/suite/sys_vars/r/have_innodb_basic.result diff --git a/mysql-test/r/have_ndbcluster_basic.result b/mysql-test/suite/sys_vars/r/have_ndbcluster_basic.result index 1b662311072..1b662311072 100644 --- a/mysql-test/r/have_ndbcluster_basic.result +++ b/mysql-test/suite/sys_vars/r/have_ndbcluster_basic.result diff --git a/mysql-test/r/have_openssl_basic.result b/mysql-test/suite/sys_vars/r/have_openssl_basic.result index 1fce883a02f..1fce883a02f 100644 --- a/mysql-test/r/have_openssl_basic.result +++ b/mysql-test/suite/sys_vars/r/have_openssl_basic.result diff --git a/mysql-test/r/have_partitioning_basic.result b/mysql-test/suite/sys_vars/r/have_partitioning_basic.result index 8a18288a3ec..8a18288a3ec 100644 --- a/mysql-test/r/have_partitioning_basic.result +++ b/mysql-test/suite/sys_vars/r/have_partitioning_basic.result diff --git a/mysql-test/r/have_query_cache_basic.result b/mysql-test/suite/sys_vars/r/have_query_cache_basic.result index 4baca716698..4baca716698 100644 --- a/mysql-test/r/have_query_cache_basic.result +++ b/mysql-test/suite/sys_vars/r/have_query_cache_basic.result diff --git a/mysql-test/r/have_rtree_keys_basic.result b/mysql-test/suite/sys_vars/r/have_rtree_keys_basic.result index 7d34f1faaed..7d34f1faaed 100644 --- a/mysql-test/r/have_rtree_keys_basic.result +++ b/mysql-test/suite/sys_vars/r/have_rtree_keys_basic.result diff --git a/mysql-test/r/have_ssl_basic.result b/mysql-test/suite/sys_vars/r/have_ssl_basic.result index a425363c03c..a425363c03c 100644 --- a/mysql-test/r/have_ssl_basic.result +++ b/mysql-test/suite/sys_vars/r/have_ssl_basic.result diff --git a/mysql-test/r/have_symlink_basic.result b/mysql-test/suite/sys_vars/r/have_symlink_basic.result index 999cbb66519..999cbb66519 100644 --- a/mysql-test/r/have_symlink_basic.result +++ b/mysql-test/suite/sys_vars/r/have_symlink_basic.result diff --git a/mysql-test/r/hostname_basic.result b/mysql-test/suite/sys_vars/r/hostname_basic.result index c4357a4fbb4..c4357a4fbb4 100644 --- a/mysql-test/r/hostname_basic.result +++ b/mysql-test/suite/sys_vars/r/hostname_basic.result diff --git a/mysql-test/r/identity_basic.result b/mysql-test/suite/sys_vars/r/identity_basic.result index 60f3edcc030..60f3edcc030 100644 --- a/mysql-test/r/identity_basic.result +++ b/mysql-test/suite/sys_vars/r/identity_basic.result diff --git a/mysql-test/r/identity_func.result b/mysql-test/suite/sys_vars/r/identity_func.result index ba430e72a1f..ba430e72a1f 100644 --- a/mysql-test/r/identity_func.result +++ b/mysql-test/suite/sys_vars/r/identity_func.result diff --git a/mysql-test/r/init_connect_basic.result b/mysql-test/suite/sys_vars/r/init_connect_basic.result index 58f7a9d2ccd..58f7a9d2ccd 100644 --- a/mysql-test/r/init_connect_basic.result +++ b/mysql-test/suite/sys_vars/r/init_connect_basic.result diff --git a/mysql-test/r/init_slave_basic.result b/mysql-test/suite/sys_vars/r/init_slave_basic.result index 87272f1489b..87272f1489b 100644 --- a/mysql-test/r/init_slave_basic.result +++ b/mysql-test/suite/sys_vars/r/init_slave_basic.result diff --git a/mysql-test/r/innodb_additional_mem_pool_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_additional_mem_pool_size_basic.result index fb062d62bc6..fb062d62bc6 100644 --- a/mysql-test/r/innodb_additional_mem_pool_size_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_additional_mem_pool_size_basic.result diff --git a/mysql-test/r/innodb_autoextend_increment_basic.result b/mysql-test/suite/sys_vars/r/innodb_autoextend_increment_basic.result index dafc71fd25d..69a8b6cc430 100644 --- a/mysql-test/r/innodb_autoextend_increment_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_autoextend_increment_basic.result @@ -1,7 +1,4 @@ SET @global_start_value = @@global.innodb_autoextend_increment ; -SELECT @global_start_value; -@global_start_value -8 '#--------------------FN_DYNVARS_046_01------------------------#' SET @@global.innodb_autoextend_increment = 0; Warnings: @@ -57,16 +54,16 @@ SELECT @@global.innodb_autoextend_increment; @@global.innodb_autoextend_increment 1000 '#----------------------FN_DYNVARS_046_05------------------------#' -SELECT @@global.innodb_autoextend_increment = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +SELECT @@global.innodb_autoextend_increment = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_autoextend_increment '; @@global.innodb_autoextend_increment = VARIABLE_VALUE 1 SELECT @@global.innodb_autoextend_increment ; @@global.innodb_autoextend_increment 1000 -SELECT VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_autoextend_increment '; VARIABLE_VALUE 1000 @@ -92,3 +89,4 @@ Warning 1292 Truncated incorrect autoextend_increment value: '0' SELECT @@global.innodb_autoextend_increment ; @@global.innodb_autoextend_increment 1 +SET @@global.innodb_autoextend_increment = @global_start_value; diff --git a/mysql-test/r/innodb_autoinc_lock_mode_basic.result b/mysql-test/suite/sys_vars/r/innodb_autoinc_lock_mode_basic.result index 9188cf07417..9188cf07417 100644 --- a/mysql-test/r/innodb_autoinc_lock_mode_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_autoinc_lock_mode_basic.result diff --git a/mysql-test/r/innodb_autoinc_lock_mode_func.result b/mysql-test/suite/sys_vars/r/innodb_autoinc_lock_mode_func.result index 4c594558a6f..f8082cfaedb 100644 --- a/mysql-test/r/innodb_autoinc_lock_mode_func.result +++ b/mysql-test/suite/sys_vars/r/innodb_autoinc_lock_mode_func.result @@ -9,14 +9,15 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1( a INT AUTO_INCREMENT PRIMARY KEY, b CHAR -)ENGINE=INNODB, AUTO_INCREMENT=100; +) ENGINE=INNODB, AUTO_INCREMENT=100; INSERT INTO t1 (a,b) VALUES (5,'a'), (NULL,'b'), (1,'c'), (NULL,'d'); INSERT INTO t1 (a,b) VALUES (NULL,'e'); 'the new auto incremented value should be 104' -SELECT * from t1; +SELECT * FROM t1; a b 1 c 5 a 100 b 101 d 104 e +DROP TABLE t1; diff --git a/mysql-test/r/innodb_buffer_pool_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_size_basic.result index 27e6cae41ef..27e6cae41ef 100644 --- a/mysql-test/r/innodb_buffer_pool_size_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_size_basic.result diff --git a/mysql-test/r/innodb_checksums_basic.result b/mysql-test/suite/sys_vars/r/innodb_checksums_basic.result index ac4bed60eb5..ac4bed60eb5 100644 --- a/mysql-test/r/innodb_checksums_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_checksums_basic.result diff --git a/mysql-test/r/innodb_commit_concurrency_basic.result b/mysql-test/suite/sys_vars/r/innodb_commit_concurrency_basic.result index 301016d4362..301016d4362 100644 --- a/mysql-test/r/innodb_commit_concurrency_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_commit_concurrency_basic.result diff --git a/mysql-test/r/innodb_data_file_path_basic.result b/mysql-test/suite/sys_vars/r/innodb_data_file_path_basic.result index 8904c0dcac4..8904c0dcac4 100644 --- a/mysql-test/r/innodb_data_file_path_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_data_file_path_basic.result diff --git a/mysql-test/r/innodb_data_home_dir_basic.result b/mysql-test/suite/sys_vars/r/innodb_data_home_dir_basic.result index e4bdd79b7c3..e4bdd79b7c3 100644 --- a/mysql-test/r/innodb_data_home_dir_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_data_home_dir_basic.result diff --git a/mysql-test/r/innodb_doublewrite_basic.result b/mysql-test/suite/sys_vars/r/innodb_doublewrite_basic.result index 6062399e8b8..6062399e8b8 100644 --- a/mysql-test/r/innodb_doublewrite_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_doublewrite_basic.result diff --git a/mysql-test/r/innodb_fast_shutdown_basic.result b/mysql-test/suite/sys_vars/r/innodb_fast_shutdown_basic.result index adbfb6ec867..4b923f4bdd2 100644 --- a/mysql-test/r/innodb_fast_shutdown_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_fast_shutdown_basic.result @@ -93,14 +93,14 @@ ERROR HY000: Variable 'innodb_fast_shutdown' is a GLOBAL variable and should be SET @@local.innodb_fast_shutdown = 0; ERROR HY000: Variable 'innodb_fast_shutdown' is a GLOBAL variable and should be set with SET GLOBAL '#----------------------FN_DYNVARS_042_06------------------------#' -SELECT count(VARIABLE_VALUE) AS res_is_0 -FROM INFORMATION_SCHEMA.SESSION_VARIABLES +SELECT count(VARIABLE_VALUE) AS res_is_0 +FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fast_shutdown'; res_is_0 1 '#----------------------FN_DYNVARS_042_07------------------------#' SELECT @@global.innodb_fast_shutdown = -VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_fast_shutdown'; @@global.innodb_fast_shutdown = VARIABLE_VALUE @@ -125,3 +125,7 @@ SET @@global.innodb_fast_shutdown = FALSE; SELECT @@global.innodb_fast_shutdown; @@global.innodb_fast_shutdown 0 +SET @@global.innodb_fast_shutdown = @global_start_value; +SELECT @@global.innodb_fast_shutdown; +@@global.innodb_fast_shutdown +1 diff --git a/mysql-test/r/innodb_file_io_threads_basic.result b/mysql-test/suite/sys_vars/r/innodb_file_io_threads_basic.result index 4c1c3ae8d54..4c1c3ae8d54 100644 --- a/mysql-test/r/innodb_file_io_threads_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_file_io_threads_basic.result diff --git a/mysql-test/r/innodb_file_per_table_basic.result b/mysql-test/suite/sys_vars/r/innodb_file_per_table_basic.result index 77595639400..77595639400 100644 --- a/mysql-test/r/innodb_file_per_table_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_file_per_table_basic.result diff --git a/mysql-test/r/innodb_flush_log_at_trx_commit_basic.result b/mysql-test/suite/sys_vars/r/innodb_flush_log_at_trx_commit_basic.result index da9f5ad3994..da9f5ad3994 100644 --- a/mysql-test/r/innodb_flush_log_at_trx_commit_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_flush_log_at_trx_commit_basic.result diff --git a/mysql-test/r/innodb_flush_method_basic.result b/mysql-test/suite/sys_vars/r/innodb_flush_method_basic.result index 8c8924cdd86..8c8924cdd86 100644 --- a/mysql-test/r/innodb_flush_method_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_flush_method_basic.result diff --git a/mysql-test/r/innodb_force_recovery_basic.result b/mysql-test/suite/sys_vars/r/innodb_force_recovery_basic.result index d3dcb525c7f..d3dcb525c7f 100644 --- a/mysql-test/r/innodb_force_recovery_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_force_recovery_basic.result diff --git a/mysql-test/r/innodb_lock_wait_timeout_basic.result b/mysql-test/suite/sys_vars/r/innodb_lock_wait_timeout_basic.result index ce46861b760..ce46861b760 100644 --- a/mysql-test/r/innodb_lock_wait_timeout_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_lock_wait_timeout_basic.result diff --git a/mysql-test/r/innodb_locks_unsafe_for_binlog_basic.result b/mysql-test/suite/sys_vars/r/innodb_locks_unsafe_for_binlog_basic.result index a5967d28913..a5967d28913 100644 --- a/mysql-test/r/innodb_locks_unsafe_for_binlog_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_locks_unsafe_for_binlog_basic.result diff --git a/mysql-test/r/innodb_log_buffer_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_log_buffer_size_basic.result index d926addd1bd..d926addd1bd 100644 --- a/mysql-test/r/innodb_log_buffer_size_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_log_buffer_size_basic.result diff --git a/mysql-test/r/innodb_log_file_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_log_file_size_basic.result index 119e95df1e1..119e95df1e1 100644 --- a/mysql-test/r/innodb_log_file_size_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_log_file_size_basic.result diff --git a/mysql-test/r/innodb_log_files_in_group_basic.result b/mysql-test/suite/sys_vars/r/innodb_log_files_in_group_basic.result index 1191ef010f8..1191ef010f8 100644 --- a/mysql-test/r/innodb_log_files_in_group_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_log_files_in_group_basic.result diff --git a/mysql-test/r/innodb_log_group_home_dir_basic.result b/mysql-test/suite/sys_vars/r/innodb_log_group_home_dir_basic.result index c7fbd2d958f..c7fbd2d958f 100644 --- a/mysql-test/r/innodb_log_group_home_dir_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_log_group_home_dir_basic.result diff --git a/mysql-test/r/innodb_max_dirty_pages_pct_basic.result b/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_basic.result index 6c52f79f9ad..6c52f79f9ad 100644 --- a/mysql-test/r/innodb_max_dirty_pages_pct_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_basic.result diff --git a/mysql-test/r/innodb_max_dirty_pages_pct_func.result b/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_func.result index 4f6d42fb716..d46c0d4a70a 100644 --- a/mysql-test/r/innodb_max_dirty_pages_pct_func.result +++ b/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_func.result @@ -1,13 +1,12 @@ +SET @start_value= @@global.innodb_max_dirty_pages_pct; '#--------------------FN_DYNVARS_044_02-------------------------#' SET @@global.innodb_max_dirty_pages_pct = 80; 'connect (con1,localhost,root,,,,)' -'connection con1' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct 80 SET @@global.innodb_max_dirty_pages_pct = 70; 'connect (con2,localhost,root,,,,)' -'connection con2' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct 70 @@ -19,7 +18,6 @@ FLUSH STATUS; CALL add_until(10); FLUSH TABLES; CALL add_records(500); -'--sleep 5' 'We expect dirty pages pct to be BELOW_MAX' CALL check_pct(10); PCT_VALUE @@ -28,3 +26,5 @@ DROP PROCEDURE add_records; DROP PROCEDURE add_until; DROP PROCEDURE check_pct; DROP FUNCTION dirty_pct; +DROP TABLE t1; +SET @@global.innodb_max_dirty_pages_pct= @start_value; diff --git a/mysql-test/r/innodb_mirrored_log_groups_basic.result b/mysql-test/suite/sys_vars/r/innodb_mirrored_log_groups_basic.result index 1645d8163ae..1645d8163ae 100644 --- a/mysql-test/r/innodb_mirrored_log_groups_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_mirrored_log_groups_basic.result diff --git a/mysql-test/r/innodb_open_files_basic.result b/mysql-test/suite/sys_vars/r/innodb_open_files_basic.result index eac2234270a..eac2234270a 100644 --- a/mysql-test/r/innodb_open_files_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_open_files_basic.result diff --git a/mysql-test/r/innodb_rollback_on_timeout_basic.result b/mysql-test/suite/sys_vars/r/innodb_rollback_on_timeout_basic.result index 6887166fae6..6887166fae6 100644 --- a/mysql-test/r/innodb_rollback_on_timeout_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_rollback_on_timeout_basic.result diff --git a/mysql-test/r/innodb_support_xa_basic.result b/mysql-test/suite/sys_vars/r/innodb_support_xa_basic.result index dcd6f498d56..dcd6f498d56 100644 --- a/mysql-test/r/innodb_support_xa_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_support_xa_basic.result diff --git a/mysql-test/r/innodb_support_xa_func.result b/mysql-test/suite/sys_vars/r/innodb_support_xa_func.result index 9036794d636..9036794d636 100644 --- a/mysql-test/r/innodb_support_xa_func.result +++ b/mysql-test/suite/sys_vars/r/innodb_support_xa_func.result diff --git a/mysql-test/r/innodb_table_locks_basic.result b/mysql-test/suite/sys_vars/r/innodb_table_locks_basic.result index 14aa995273b..14aa995273b 100644 --- a/mysql-test/r/innodb_table_locks_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_table_locks_basic.result diff --git a/mysql-test/r/innodb_table_locks_func.result b/mysql-test/suite/sys_vars/r/innodb_table_locks_func.result index 22a52ce17fd..824d196d295 100644 --- a/mysql-test/r/innodb_table_locks_func.result +++ b/mysql-test/suite/sys_vars/r/innodb_table_locks_func.result @@ -1,4 +1,8 @@ '#--------------------FN_DYNVARS_048_01-------------------------#' +SET @start_value= @@global.innodb_table_locks; +SELECT @start_value; +@start_value +1 SET @@global.innodb_table_locks = OFF; 'connect (con1,localhost,root,,,,)' 'connection con1' @@ -30,3 +34,7 @@ COMMIT; 'CONNECTION con2' UNLOCK tables; DROP TABLE t1; +SET @@global.innodb_table_locks= @start_value; +SELECT @@global.innodb_table_locks; +@@global.innodb_table_locks +1 diff --git a/mysql-test/r/innodb_thread_concurrency_basic.result b/mysql-test/suite/sys_vars/r/innodb_thread_concurrency_basic.result index 65a79fecd97..65a79fecd97 100644 --- a/mysql-test/r/innodb_thread_concurrency_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_thread_concurrency_basic.result diff --git a/mysql-test/r/innodb_thread_sleep_delay_basic.result b/mysql-test/suite/sys_vars/r/innodb_thread_sleep_delay_basic.result index 979bfd930ca..979bfd930ca 100644 --- a/mysql-test/r/innodb_thread_sleep_delay_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_thread_sleep_delay_basic.result diff --git a/mysql-test/r/insert_id_basic.result b/mysql-test/suite/sys_vars/r/insert_id_basic.result index 47dd759ff44..47dd759ff44 100644 --- a/mysql-test/r/insert_id_basic.result +++ b/mysql-test/suite/sys_vars/r/insert_id_basic.result diff --git a/mysql-test/r/insert_id_func.result b/mysql-test/suite/sys_vars/r/insert_id_func.result index f03b3ea4851..f03b3ea4851 100644 --- a/mysql-test/r/insert_id_func.result +++ b/mysql-test/suite/sys_vars/r/insert_id_func.result diff --git a/mysql-test/r/interactive_timeout_basic.result b/mysql-test/suite/sys_vars/r/interactive_timeout_basic.result index 0777596db07..0777596db07 100644 --- a/mysql-test/r/interactive_timeout_basic.result +++ b/mysql-test/suite/sys_vars/r/interactive_timeout_basic.result diff --git a/mysql-test/r/interactive_timeout_func.result b/mysql-test/suite/sys_vars/r/interactive_timeout_func.result index b97f7c90908..b97f7c90908 100644 --- a/mysql-test/r/interactive_timeout_func.result +++ b/mysql-test/suite/sys_vars/r/interactive_timeout_func.result diff --git a/mysql-test/suite/sys_vars/r/join_buffer_size_basic_32.result b/mysql-test/suite/sys_vars/r/join_buffer_size_basic_32.result index fc3061d2f59..e3016a2b22c 100644 --- a/mysql-test/suite/sys_vars/r/join_buffer_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/join_buffer_size_basic_32.result @@ -42,6 +42,8 @@ SELECT @@global.join_buffer_size; @@global.join_buffer_size 65536 SET @@global.join_buffer_size = 4294967295; +Warnings: +Warning 1292 Truncated incorrect join_buffer_size value: '4294967295' SELECT @@global.join_buffer_size; @@global.join_buffer_size 4294963200 @@ -58,6 +60,8 @@ SELECT @@session.join_buffer_size; @@session.join_buffer_size 65536 SET @@session.join_buffer_size = 4294967295; +Warnings: +Warning 1292 Truncated incorrect join_buffer_size value: '4294967295' SELECT @@session.join_buffer_size; @@session.join_buffer_size 4294963200 diff --git a/mysql-test/r/keep_files_on_create_basic.result b/mysql-test/suite/sys_vars/r/keep_files_on_create_basic.result index f782ee3b078..f782ee3b078 100644 --- a/mysql-test/r/keep_files_on_create_basic.result +++ b/mysql-test/suite/sys_vars/r/keep_files_on_create_basic.result diff --git a/mysql-test/suite/sys_vars/r/key_buffer_size_basic_32.result b/mysql-test/suite/sys_vars/r/key_buffer_size_basic_32.result index 981988a1d4d..51c4f841205 100644 --- a/mysql-test/suite/sys_vars/r/key_buffer_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/key_buffer_size_basic_32.result @@ -1,14 +1,10 @@ SET @start_value = @@global.key_buffer_size; -SELECT @start_value; -@start_value -1048576 '#--------------------FN_DYNVARS_055_01------------------------#' SET @@global.key_buffer_size = 99; SET @@global.key_buffer_size = DEFAULT; ERROR 42000: Variable 'key_buffer_size' doesn't have a default value -'Bug# 34878: This variable has default value according to documentation'; -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 '#---------------------FN_DYNVARS_055_02-------------------------#' SET @@global.key_buffer_size = @start_value; @@ -16,21 +12,20 @@ SELECT @@global.key_buffer_size = @start_value; @@global.key_buffer_size = @start_value 1 '#--------------------FN_DYNVARS_055_03------------------------#' -SET @@global.key_buffer_size = @min_key_buffer_size; -SELECT @@global.key_buffer_size= @min_key_buffer_size; -@@global.key_buffer_size= @min_key_buffer_size +SET @@global.key_buffer_size = 8 ; +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 SET @@global.key_buffer_size = 1800; Warnings: Warning 1292 Truncated incorrect key_buffer_size value: '1800' -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 SET @@global.key_buffer_size = 65535; SELECT @@global.key_buffer_size; @@global.key_buffer_size 61440 -'Bug # 34837: Errors are not coming on assigning invalid values to variable' '#--------------------FN_DYNVARS_055_04-------------------------#' SET @@global.key_buffer_size = 10000.01; ERROR 42000: Incorrect argument type to variable 'key_buffer_size' @@ -40,25 +35,24 @@ SELECT @@global.key_buffer_size; SET @@global.key_buffer_size = 4; Warnings: Warning 1292 Truncated incorrect key_buffer_size value: '4' -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 -'Bug # 34837: Errors are not coming on assigning invalid values to variable'; SET @@global.key_buffer_size = ON; ERROR 42000: Incorrect argument type to variable 'key_buffer_size' -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 SET @@global.key_buffer_size = 'test'; ERROR 42000: Incorrect argument type to variable 'key_buffer_size' -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 '#-------------------FN_DYNVARS_055_05----------------------------#' SET @@session.key_buffer_size = 0; ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable and should be set with SET GLOBAL -SELECT @@key_buffer_size = @min_key_buffer_size; -@@key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 '#----------------------FN_DYNVARS_055_06------------------------#' SELECT @@global.key_buffer_size = VARIABLE_VALUE @@ -75,25 +69,25 @@ WHERE VARIABLE_NAME='key_buffer_size'; SET @@global.key_buffer_size = TRUE; Warnings: Warning 1292 Truncated incorrect key_buffer_size value: '1' -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 SET @@global.key_buffer_size = FALSE; Warnings: Warning 1438 Cannot drop default keycache -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 '#---------------------FN_DYNVARS_055_08----------------------#' -SET @@global.key_buffer_size = @min_key_buffer_size; +SET @@global.key_buffer_size = 8 ; SELECT @@key_buffer_size = @@global.key_buffer_size; @@key_buffer_size = @@global.key_buffer_size 1 '#---------------------FN_DYNVARS_055_09----------------------#' -SET key_buffer_size = @min_key_buffer_size; +SET key_buffer_size = 8 ; ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable and should be set with SET GLOBAL -SELECT @@key_buffer_size = @min_key_buffer_size; -@@key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 SET local.key_buffer_size = 10; 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 'key_buffer_size = 10' at line 1 @@ -106,6 +100,3 @@ ERROR 42S02: Unknown table 'global' in field list SELECT key_buffer_size = @@session.key_buffer_size; ERROR 42S22: Unknown column 'key_buffer_size' in 'field list' SET @@global.key_buffer_size = @start_value; -SELECT @@global.key_buffer_size; -@@global.key_buffer_size -1048576 diff --git a/mysql-test/suite/sys_vars/r/key_buffer_size_basic_64.result b/mysql-test/suite/sys_vars/r/key_buffer_size_basic_64.result index 981988a1d4d..51c4f841205 100644 --- a/mysql-test/suite/sys_vars/r/key_buffer_size_basic_64.result +++ b/mysql-test/suite/sys_vars/r/key_buffer_size_basic_64.result @@ -1,14 +1,10 @@ SET @start_value = @@global.key_buffer_size; -SELECT @start_value; -@start_value -1048576 '#--------------------FN_DYNVARS_055_01------------------------#' SET @@global.key_buffer_size = 99; SET @@global.key_buffer_size = DEFAULT; ERROR 42000: Variable 'key_buffer_size' doesn't have a default value -'Bug# 34878: This variable has default value according to documentation'; -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 '#---------------------FN_DYNVARS_055_02-------------------------#' SET @@global.key_buffer_size = @start_value; @@ -16,21 +12,20 @@ SELECT @@global.key_buffer_size = @start_value; @@global.key_buffer_size = @start_value 1 '#--------------------FN_DYNVARS_055_03------------------------#' -SET @@global.key_buffer_size = @min_key_buffer_size; -SELECT @@global.key_buffer_size= @min_key_buffer_size; -@@global.key_buffer_size= @min_key_buffer_size +SET @@global.key_buffer_size = 8 ; +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 SET @@global.key_buffer_size = 1800; Warnings: Warning 1292 Truncated incorrect key_buffer_size value: '1800' -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 SET @@global.key_buffer_size = 65535; SELECT @@global.key_buffer_size; @@global.key_buffer_size 61440 -'Bug # 34837: Errors are not coming on assigning invalid values to variable' '#--------------------FN_DYNVARS_055_04-------------------------#' SET @@global.key_buffer_size = 10000.01; ERROR 42000: Incorrect argument type to variable 'key_buffer_size' @@ -40,25 +35,24 @@ SELECT @@global.key_buffer_size; SET @@global.key_buffer_size = 4; Warnings: Warning 1292 Truncated incorrect key_buffer_size value: '4' -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 -'Bug # 34837: Errors are not coming on assigning invalid values to variable'; SET @@global.key_buffer_size = ON; ERROR 42000: Incorrect argument type to variable 'key_buffer_size' -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 SET @@global.key_buffer_size = 'test'; ERROR 42000: Incorrect argument type to variable 'key_buffer_size' -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 '#-------------------FN_DYNVARS_055_05----------------------------#' SET @@session.key_buffer_size = 0; ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable and should be set with SET GLOBAL -SELECT @@key_buffer_size = @min_key_buffer_size; -@@key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 '#----------------------FN_DYNVARS_055_06------------------------#' SELECT @@global.key_buffer_size = VARIABLE_VALUE @@ -75,25 +69,25 @@ WHERE VARIABLE_NAME='key_buffer_size'; SET @@global.key_buffer_size = TRUE; Warnings: Warning 1292 Truncated incorrect key_buffer_size value: '1' -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 SET @@global.key_buffer_size = FALSE; Warnings: Warning 1438 Cannot drop default keycache -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 '#---------------------FN_DYNVARS_055_08----------------------#' -SET @@global.key_buffer_size = @min_key_buffer_size; +SET @@global.key_buffer_size = 8 ; SELECT @@key_buffer_size = @@global.key_buffer_size; @@key_buffer_size = @@global.key_buffer_size 1 '#---------------------FN_DYNVARS_055_09----------------------#' -SET key_buffer_size = @min_key_buffer_size; +SET key_buffer_size = 8 ; ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable and should be set with SET GLOBAL -SELECT @@key_buffer_size = @min_key_buffer_size; -@@key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 SET local.key_buffer_size = 10; 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 'key_buffer_size = 10' at line 1 @@ -106,6 +100,3 @@ ERROR 42S02: Unknown table 'global' in field list SELECT key_buffer_size = @@session.key_buffer_size; ERROR 42S22: Unknown column 'key_buffer_size' in 'field list' SET @@global.key_buffer_size = @start_value; -SELECT @@global.key_buffer_size; -@@global.key_buffer_size -1048576 diff --git a/mysql-test/suite/sys_vars/r/key_buffer_size_func.result b/mysql-test/suite/sys_vars/r/key_buffer_size_func.result new file mode 100644 index 00000000000..d5b79c260a0 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/key_buffer_size_func.result @@ -0,0 +1,61 @@ +DROP TABLE IF EXISTS t1; +## Creating new table t1 ## +CREATE TABLE t1 +( +id INT NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id), +rollno INT NOT NULL, +name VARCHAR(30) +); +SET @start_value= @@global.key_buffer_size; +FLUSH STATUS; +'#--------------------FN_DYNVARS_055_01-------------------------#' +## Setting initial value of variable to 131072 ## +SET @@global.key_buffer_size = 131072; +## Creating two new connections ## +'#--------------------FN_DYNVARS_055_02-------------------------#' +## Connecting with connection test_con1 ## +SELECT @@global.key_buffer_size; +@@global.key_buffer_size +131072 +## Inserting some rows in table ## +INSERT INTO t1(rollno, name) VALUES(1, 'Record_1'); +INSERT INTO t1(rollno, name) VALUES(2, 'Record_2'); +INSERT INTO t1(rollno, name) VALUES(1, 'Record_3'); +INSERT INTO t1(rollno, name) VALUES(3, 'Record_4'); +INSERT INTO t1(rollno, name) VALUES(1, 'Record_5'); +INSERT INTO t1(rollno, name) VALUES(3, 'Record_6'); +INSERT INTO t1(rollno, name) VALUES(4, 'Record_7'); +INSERT INTO t1(rollno, name) VALUES(4, 'Record_8'); +INSERT INTO t1(rollno, name) VALUES(4, 'Record_9'); +INSERT INTO t1(rollno, name) VALUES(4, 'Record_10'); +## Key_reads must be zero (no disk access) ## +show status like 'Key_reads'; +Variable_name Value +Key_reads 0 +## Switching to connection test_con2 ## +## Key_reads must be zero (no disk access) ## +show status like 'Key_reads'; +Variable_name Value +Key_reads 0 +SET @@global.key_buffer_size = 36; +## Connecting with connection test_con1 ## +## Inserting some rows in table ## +INSERT INTO t1(rollno, name) VALUES(5, 'Record_11'); +INSERT INTO t1(rollno, name) VALUES(6, 'Record_12'); +INSERT INTO t1(rollno, name) VALUES(5, 'Record_13'); +INSERT INTO t1(rollno, name) VALUES(7, 'Record_14'); +INSERT INTO t1(rollno, name) VALUES(5, 'Record_15'); +INSERT INTO t1(rollno, name) VALUES(7, 'Record_16'); +INSERT INTO t1(rollno, name) VALUES(8, 'Record_17'); +INSERT INTO t1(rollno, name) VALUES(8, 'Record_18'); +INSERT INTO t1(rollno, name) VALUES(8, 'Record_19'); +INSERT INTO t1(rollno, name) VALUES(8, 'Record_20'); +## Key_reads must be zero (no disk access) ## +show status like 'Key_reads'; +Variable_name Value +Key_reads 10 +## Dropping table ## +DROP TABLE IF EXISTS t1; +## Disconnecting both the connections ## +SET @@global.key_buffer_size= @start_value; diff --git a/mysql-test/r/last_insert_id_func.result b/mysql-test/suite/sys_vars/r/last_insert_id_func.result index 2f07aeeec05..2f07aeeec05 100644 --- a/mysql-test/r/last_insert_id_func.result +++ b/mysql-test/suite/sys_vars/r/last_insert_id_func.result diff --git a/mysql-test/r/lc_time_names_basic.result b/mysql-test/suite/sys_vars/r/lc_time_names_basic.result index 36f3c45f0da..36f3c45f0da 100644 --- a/mysql-test/r/lc_time_names_basic.result +++ b/mysql-test/suite/sys_vars/r/lc_time_names_basic.result diff --git a/mysql-test/r/lc_time_names_func.result b/mysql-test/suite/sys_vars/r/lc_time_names_func.result index 703aa65a6be..703aa65a6be 100644 --- a/mysql-test/r/lc_time_names_func.result +++ b/mysql-test/suite/sys_vars/r/lc_time_names_func.result diff --git a/mysql-test/r/license_basic.result b/mysql-test/suite/sys_vars/r/license_basic.result index 1f92e595020..1f92e595020 100644 --- a/mysql-test/r/license_basic.result +++ b/mysql-test/suite/sys_vars/r/license_basic.result diff --git a/mysql-test/r/local_infile_basic.result b/mysql-test/suite/sys_vars/r/local_infile_basic.result index 5f4c215719a..5f4c215719a 100644 --- a/mysql-test/r/local_infile_basic.result +++ b/mysql-test/suite/sys_vars/r/local_infile_basic.result diff --git a/mysql-test/r/local_infile_func.result b/mysql-test/suite/sys_vars/r/local_infile_func.result index 52b922bc6d9..66a1e5544fb 100644 --- a/mysql-test/r/local_infile_func.result +++ b/mysql-test/suite/sys_vars/r/local_infile_func.result @@ -18,7 +18,7 @@ SET @@global.local_infile = 1; DROP TABLE IF EXISTS t1; create table t1(a int); LOAD DATA LOCAL INFILE -'MYSQLTEST_VARDIR/std_data_ln/numbers.txt' INTO TABLE test.t1; +'MYSQLTEST_VARDIR/std_data/numbers.txt' INTO TABLE test.t1; SELECT count(*) from t1; count(*) 9 @@ -27,7 +27,7 @@ SET @@global.local_infile = 0; DROP TABLE IF EXISTS t1; create table t1(a int); LOAD DATA LOCAL INFILE -'MYSQLTEST_VARDIR/std_data_ln/numbers.txt' INTO TABLE test.t1; +'MYSQLTEST_VARDIR/std_data/numbers.txt' INTO TABLE test.t1; ERROR 42000: The used command is not allowed with this MySQL version SELECT count(*) from t1; count(*) diff --git a/mysql-test/r/log_basic.result b/mysql-test/suite/sys_vars/r/log_basic.result index edda72fa91e..18a12b72437 100644 --- a/mysql-test/r/log_basic.result +++ b/mysql-test/suite/sys_vars/r/log_basic.result @@ -1,4 +1,5 @@ '#--------------------FN_DYNVARS_062_01------------------#' +SET @start_log= @@global.log; SELECT @@global.log AS INIT_VALUE; INIT_VALUE 1 @@ -10,8 +11,11 @@ SET global general_log = 0; 'Bug# 34832: log is a system but it is not accessible using SET @@global.log;' 'SET GLOBAL log; and SELECT @@global.log. SHOW VARIABLES shows the value of log.' '#--------------------FN_DYNVARS_062_02-------------------------#' -SELECT VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='log'; VARIABLE_VALUE OFF +SET @@global.log= @start_log; +Warnings: +Warning 1287 The syntax '@@log' is deprecated and will be removed in MySQL 7.0. Please use '@@general_log' instead diff --git a/mysql-test/r/log_bin_trust_function_creators_basic.result b/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_basic.result index 40dc0e217c4..40dc0e217c4 100644 --- a/mysql-test/r/log_bin_trust_function_creators_basic.result +++ b/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_basic.result diff --git a/mysql-test/r/log_bin_trust_function_creators_func.result b/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_func.result index e109b53a8e7..33443df5ae4 100644 --- a/mysql-test/r/log_bin_trust_function_creators_func.result +++ b/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_func.result @@ -1,28 +1,42 @@ drop table if exists t1; '#--------------------FN_DYNVARS_063_01-------------------------#' +SET @start_value= @@global.log_bin_trust_function_creators; ## Creating new user tt ## -CREATE user tt@localhost; +CREATE USER tt@localhost; ## Setting value of variable to 0 ## SET @@global.log_bin_trust_function_creators = 0; ## Creating new table t2 ## -create table t2 (a INT); +CREATE TABLE t2 (a INT); ## Creating & connecting with new connection test_con1 ## SELECT @@log_bin_trust_function_creators; @@log_bin_trust_function_creators 0 -SELECT @@sql_log_bin; -@@sql_log_bin -1 -## Creating new function f1 ## +## Creating new function f1 fails because no DETERMINISTIC ### CREATE FUNCTION f1(a INT) RETURNS INT BEGIN -IF (a < 3) THEN +IF (a < 3) THEN +INSERT INTO t2 VALUES (a); +END IF; +RETURN 1; +END| +ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) +## Creating new function f1 fails because non-super user ## +CREATE FUNCTION f1(a INT) RETURNS INT DETERMINISTIC +BEGIN +IF (a < 3) THEN +INSERT INTO t2 VALUES (a); +END IF; +RETURN 1; +END| +ERROR HY000: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) +## Creating new function f1 succeeds ## +CREATE FUNCTION f1(a INT) RETURNS INT DETERMINISTIC +BEGIN +IF (a < 3) THEN INSERT INTO t2 VALUES (a); END IF; RETURN 1; END| -'Bug: Create Function should give error here because non-super user'; -'is creating function here'; ## Creating new table t1 ## CREATE TABLE t1 (a INT); ## Inserting some records in t1 ## @@ -33,8 +47,8 @@ f1(a) 1 1 ## Dropping function f1 & table t1 ## -drop function f1; -drop table t1; +DROP FUNCTION f1; +DROP TABLE t1; '#--------------------FN_DYNVARS_063_02-------------------------#' ## Switching to default connection ## ## Setting value of variable to 1 ## @@ -50,7 +64,7 @@ SELECT @@sql_log_bin; ## Creating new function f1 ## CREATE FUNCTION f1(a INT) RETURNS INT BEGIN -IF (a < 3) THEN +IF (a < 3) THEN INSERT INTO t2 VALUES (a); END IF; RETURN 1; @@ -65,7 +79,9 @@ f1(a) 1 1 ## Dropping function f1 ## -drop function f1; +DROP FUNCTION f1; ## Dropping table t1 & t2 ## -drop table t1,t2; -## Disconnecting both the connections ## +DROP TABLE t1,t2; +## Disconnecting test_con2## +DROP USER tt@localhost; +SET @@global.log_bin_trust_function_creators= @start_value; diff --git a/mysql-test/r/log_bin_trust_routine_creators_basic.result b/mysql-test/suite/sys_vars/r/log_bin_trust_routine_creators_basic.result index cfcbcddfca3..cfcbcddfca3 100644 --- a/mysql-test/r/log_bin_trust_routine_creators_basic.result +++ b/mysql-test/suite/sys_vars/r/log_bin_trust_routine_creators_basic.result diff --git a/mysql-test/r/log_output_basic.result b/mysql-test/suite/sys_vars/r/log_output_basic.result index 481d5862074..481d5862074 100644 --- a/mysql-test/r/log_output_basic.result +++ b/mysql-test/suite/sys_vars/r/log_output_basic.result diff --git a/mysql-test/r/log_output_func.result b/mysql-test/suite/sys_vars/r/log_output_func.result index 060f930a161..060f930a161 100644 --- a/mysql-test/r/log_output_func.result +++ b/mysql-test/suite/sys_vars/r/log_output_func.result diff --git a/mysql-test/suite/sys_vars/r/log_queries_not_using_indexes_basic.result b/mysql-test/suite/sys_vars/r/log_queries_not_using_indexes_basic.result new file mode 100644 index 00000000000..b19b11a4209 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/log_queries_not_using_indexes_basic.result @@ -0,0 +1,104 @@ +SET @start_value= @@global.log_queries_not_using_indexes; +SET @@global.log_queries_not_using_indexes= DEFAULT; +SELECT @@global.log_queries_not_using_indexes; +@@global.log_queries_not_using_indexes +0 +SET @@global.log_queries_not_using_indexes= TRUE; +SELECT @@global.log_queries_not_using_indexes; +@@global.log_queries_not_using_indexes +1 +SET @@global.log_queries_not_using_indexes= true; +SELECT @@global.log_queries_not_using_indexes; +@@global.log_queries_not_using_indexes +1 +SET @@global.log_queries_not_using_indexes= 0; +SELECT @@global.log_queries_not_using_indexes; +@@global.log_queries_not_using_indexes +0 +SET @@global.log_queries_not_using_indexes= 1; +SELECT @@global.log_queries_not_using_indexes; +@@global.log_queries_not_using_indexes +1 +SET @goodvar= TRUE; +SET @@global.log_queries_not_using_indexes= @goodvar; +SELECT @@global.log_queries_not_using_indexes; +@@global.log_queries_not_using_indexes +1 +SET GLOBAL log_queries_not_using_indexes= DEFAULT; +SELECT @@global.log_queries_not_using_indexes; +@@global.log_queries_not_using_indexes +0 +SET GLOBAL log_queries_not_using_indexes= ON; +SELECT @@global.log_queries_not_using_indexes; +@@global.log_queries_not_using_indexes +1 +SET GLOBAL log_queries_not_using_indexes= OFF; +SELECT @@global.log_queries_not_using_indexes; +@@global.log_queries_not_using_indexes +0 +SET GLOBAL log_queries_not_using_indexes= -0; +SELECT @@global.log_queries_not_using_indexes; +@@global.log_queries_not_using_indexes +0 +SET GLOBAL log_queries_not_using_indexes= 0.00; +SELECT @@global.log_queries_not_using_indexes; +@@global.log_queries_not_using_indexes +0 +SET GLOBAL log_queries_not_using_indexes= -0.0; +SELECT @@global.log_queries_not_using_indexes; +@@global.log_queries_not_using_indexes +0 +SET GLOBAL log_queries_not_using_indexes= 001.00; +SELECT @@global.log_queries_not_using_indexes; +@@global.log_queries_not_using_indexes +1 +SET GLOBAL log_queries_not_using_indexes= +1.0; +SELECT @@global.log_queries_not_using_indexes; +@@global.log_queries_not_using_indexes +1 +SET GLOBAL log_queries_not_using_indexes= +0; +SELECT @@global.log_queries_not_using_indexes; +@@global.log_queries_not_using_indexes +0 +SET GLOBAL log_queries_not_using_indexes= +0.000000; +SELECT @@global.log_queries_not_using_indexes; +@@global.log_queries_not_using_indexes +0 +SET GLOBAL log_queries_not_using_indexes= 0000.00000; +SELECT @@global.log_queries_not_using_indexes; +@@global.log_queries_not_using_indexes +0 +SET GLOBAL log_queries_not_using_indexes= .0; +SELECT @@global.log_queries_not_using_indexes; +@@global.log_queries_not_using_indexes +0 +SET @@global.log_queries_not_using_indexes= 'DEFAULT'; +ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of 'DEFAULT' +SET @@global.log_queries_not_using_indexes= 'true'; +ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of 'true' +SET @@global.log_queries_not_using_indexes= BLABLA; +ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of 'BLABLA' +SET @@global.log_queries_not_using_indexes= 25; +ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of '25' +SET @@global.log_queries_not_using_indexes= 12.34; +ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of '12' +SET GLOBAL log_queries_not_using_indexes= -1; +ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of '-1' +SET @badvar= 'true'; +SET @@global.log_queries_not_using_indexes= @badvar; +ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of 'true' +SET GLOBAL log_queries_not_using_indexes= 'DEFAULT'; +ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of 'DEFAULT' +SET log_queries_not_using_indexes= TRUE; +ERROR HY000: Variable 'log_queries_not_using_indexes' is a GLOBAL variable and should be set with SET GLOBAL +SET SESSION log_queries_not_using_indexes= TRUE; +ERROR HY000: Variable 'log_queries_not_using_indexes' is a GLOBAL variable and should be set with SET GLOBAL +SET @@session.log_queries_not_using_indexes= TRUE; +ERROR HY000: Variable 'log_queries_not_using_indexes' is a GLOBAL variable and should be set with SET GLOBAL +SET LOCAL log_queries_not_using_indexes= TRUE; +ERROR HY000: Variable 'log_queries_not_using_indexes' is a GLOBAL variable and should be set with SET GLOBAL +SET @@global log_queries_not_using_indexes= TRUE; +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 'log_queries_not_using_indexes= TRUE' at line 1 +SET @@SESSION log_queries_not_using_indexes= TRUE; +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 'log_queries_not_using_indexes= TRUE' at line 1 +SET @@global.log_queries_not_using_indexes= @start_value; diff --git a/mysql-test/suite/sys_vars/r/log_warnings_basic_32.result b/mysql-test/suite/sys_vars/r/log_warnings_basic_32.result index 702e95b1383..900bb487706 100644 --- a/mysql-test/suite/sys_vars/r/log_warnings_basic_32.result +++ b/mysql-test/suite/sys_vars/r/log_warnings_basic_32.result @@ -71,7 +71,7 @@ SELECT @@session.log_warnings; '#------------------FN_DYNVARS_067_05-----------------------#' SET @@global.log_warnings = 100000000000; Warnings: -Warning 1292 Truncated incorrect log-warnings value: '100000000000' +Warning 1292 Truncated incorrect log_warnings value: '100000000000' SELECT @@global.log_warnings; @@global.log_warnings 4294967295 @@ -91,7 +91,7 @@ SELECT @@global.log_warnings; 0 SET @@session.log_warnings = 100000000000; Warnings: -Warning 1292 Truncated incorrect log-warnings value: '100000000000' +Warning 1292 Truncated incorrect log_warnings value: '100000000000' SELECT @@session.log_warnings; @@session.log_warnings 4294967295 diff --git a/mysql-test/r/long_query_time_basic.result b/mysql-test/suite/sys_vars/r/long_query_time_basic.result index b44500dc1e2..b44500dc1e2 100644 --- a/mysql-test/r/long_query_time_basic.result +++ b/mysql-test/suite/sys_vars/r/long_query_time_basic.result diff --git a/mysql-test/r/low_priority_updates_basic.result b/mysql-test/suite/sys_vars/r/low_priority_updates_basic.result index 87b30814837..87b30814837 100644 --- a/mysql-test/r/low_priority_updates_basic.result +++ b/mysql-test/suite/sys_vars/r/low_priority_updates_basic.result diff --git a/mysql-test/r/max_allowed_packet_basic.result b/mysql-test/suite/sys_vars/r/max_allowed_packet_basic.result index 0745d5a36e1..0745d5a36e1 100644 --- a/mysql-test/r/max_allowed_packet_basic.result +++ b/mysql-test/suite/sys_vars/r/max_allowed_packet_basic.result diff --git a/mysql-test/r/max_allowed_packet_func.result b/mysql-test/suite/sys_vars/r/max_allowed_packet_func.result index 43da24fa280..0d682b65aea 100644 --- a/mysql-test/r/max_allowed_packet_func.result +++ b/mysql-test/suite/sys_vars/r/max_allowed_packet_func.result @@ -1,4 +1,5 @@ -1048576 +SET @start_max_allowed_packet= @@global.max_allowed_packet; +SET @start_value= @@global.net_buffer_length; drop table if exists t1; ## Creating new table t1 ## CREATE TABLE t1 @@ -20,7 +21,7 @@ SELECT @@session.net_buffer_length; @@session.net_buffer_length 16384 '#--------------------FN_DYNVARS_070_02-------------------------#' -## Setting value of max_allowed packet and net_buffer_length to 1024 ## +## Setting value of max_allowed packet and net_buffer_length to 1024 ## SET @@global.max_allowed_packet = 1024; SET @@global.net_buffer_length = 1024; SELECT @@global.max_allowed_packet; @@ -30,9 +31,8 @@ SELECT @@global.net_buffer_length; @@global.net_buffer_length 1024 ## Creating new connection test_con1 ## -## Inserting and fetching data of length greater than 1024 ## +## Inserting and fetching data of length greater than 1024 ## INSERT into t1(name) values("aaassssssssddddddddffffffgggggggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk"); drop table t1; -SET @@global.max_allowed_packet = 1048576; -## Server disconnects after this case and error occurs that Server ## -## has gone away ## +SET @@global.max_allowed_packet= @start_max_allowed_packet; +SET @@global.net_buffer_length= @start_value; diff --git a/mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic_32.result b/mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic_32.result index 1dbeb50ff90..a594295c0f5 100644 --- a/mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic_32.result @@ -1,7 +1,7 @@ SET @start_value = @@global.max_binlog_cache_size; SELECT @start_value; @start_value -4294967295 +4294963200 '#--------------------FN_DYNVARS_072_01------------------------#' SET @@global.max_binlog_cache_size = 5000; SET @@global.max_binlog_cache_size = DEFAULT; diff --git a/mysql-test/r/max_binlog_cache_size_func.result b/mysql-test/suite/sys_vars/r/max_binlog_cache_size_func.result index 50c9e8e935d..50c9e8e935d 100644 --- a/mysql-test/r/max_binlog_cache_size_func.result +++ b/mysql-test/suite/sys_vars/r/max_binlog_cache_size_func.result diff --git a/mysql-test/r/max_binlog_size_basic.result b/mysql-test/suite/sys_vars/r/max_binlog_size_basic.result index 291b687f76c..291b687f76c 100644 --- a/mysql-test/r/max_binlog_size_basic.result +++ b/mysql-test/suite/sys_vars/r/max_binlog_size_basic.result diff --git a/mysql-test/r/max_connections_basic.result b/mysql-test/suite/sys_vars/r/max_connections_basic.result index ccedff01c54..ccedff01c54 100644 --- a/mysql-test/r/max_connections_basic.result +++ b/mysql-test/suite/sys_vars/r/max_connections_basic.result diff --git a/mysql-test/r/max_delayed_threads_basic.result b/mysql-test/suite/sys_vars/r/max_delayed_threads_basic.result index e0b2a3ee1cd..e0b2a3ee1cd 100644 --- a/mysql-test/r/max_delayed_threads_basic.result +++ b/mysql-test/suite/sys_vars/r/max_delayed_threads_basic.result diff --git a/mysql-test/r/max_error_count_basic.result b/mysql-test/suite/sys_vars/r/max_error_count_basic.result index 2046a5e9dfa..2046a5e9dfa 100644 --- a/mysql-test/r/max_error_count_basic.result +++ b/mysql-test/suite/sys_vars/r/max_error_count_basic.result diff --git a/mysql-test/r/max_insert_delayed_threads_basic.result b/mysql-test/suite/sys_vars/r/max_insert_delayed_threads_basic.result index 31c1fcec396..31c1fcec396 100644 --- a/mysql-test/r/max_insert_delayed_threads_basic.result +++ b/mysql-test/suite/sys_vars/r/max_insert_delayed_threads_basic.result diff --git a/mysql-test/r/max_join_size_func.result b/mysql-test/suite/sys_vars/r/max_join_size_func.result index bf535579433..bf535579433 100644 --- a/mysql-test/r/max_join_size_func.result +++ b/mysql-test/suite/sys_vars/r/max_join_size_func.result diff --git a/mysql-test/r/max_length_for_sort_data_basic.result b/mysql-test/suite/sys_vars/r/max_length_for_sort_data_basic.result index 3edd3e86262..3edd3e86262 100644 --- a/mysql-test/r/max_length_for_sort_data_basic.result +++ b/mysql-test/suite/sys_vars/r/max_length_for_sort_data_basic.result diff --git a/mysql-test/r/max_prepared_stmt_count_basic.result b/mysql-test/suite/sys_vars/r/max_prepared_stmt_count_basic.result index ebc7da8c7f8..ebc7da8c7f8 100644 --- a/mysql-test/r/max_prepared_stmt_count_basic.result +++ b/mysql-test/suite/sys_vars/r/max_prepared_stmt_count_basic.result diff --git a/mysql-test/r/max_prepared_stmt_count_func.result b/mysql-test/suite/sys_vars/r/max_prepared_stmt_count_func.result index 562ef63f811..562ef63f811 100644 --- a/mysql-test/r/max_prepared_stmt_count_func.result +++ b/mysql-test/suite/sys_vars/r/max_prepared_stmt_count_func.result diff --git a/mysql-test/r/max_relay_log_size_basic.result b/mysql-test/suite/sys_vars/r/max_relay_log_size_basic.result index c0042f497ad..c0042f497ad 100644 --- a/mysql-test/r/max_relay_log_size_basic.result +++ b/mysql-test/suite/sys_vars/r/max_relay_log_size_basic.result diff --git a/mysql-test/r/max_seeks_for_key_func.result b/mysql-test/suite/sys_vars/r/max_seeks_for_key_func.result index b4c863af17b..5a2441276ec 100644 --- a/mysql-test/r/max_seeks_for_key_func.result +++ b/mysql-test/suite/sys_vars/r/max_seeks_for_key_func.result @@ -1,8 +1,9 @@ -drop table if exists t1; +DROP TABLE IF EXISTS t1; CREATE TABLE t1 -(a int auto_increment primary key, -b char(20) +(a INT AUTO_INCREMENT PRIMARY KEY, +b CHAR(20) ); +SET @start_value= @@global.max_seeks_for_key; '#--------------------FN_DYNVARS_084_01-------------------------#' SELECT @@global.max_seeks_for_key = 10; @@global.max_seeks_for_key = 10 @@ -14,8 +15,8 @@ SET @@global.max_seeks_for_key = 20; SELECT @@global.max_seeks_for_key; @@global.max_seeks_for_key 20 -INSERT into t1(b) values("AREc"); -explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; +INSERT INTO t1(b) VALUES("AREc"); +EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 1 SIMPLE t2 system NULL NULL NULL NULL 1 @@ -23,9 +24,9 @@ SET @@session.max_seeks_for_key = 2; SELECT @@session.max_seeks_for_key; @@session.max_seeks_for_key 2 -INSERT into t1(b) values("BREc"); -INSERT into t1(b) values("CRec"); -explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; +INSERT INTO t1(b) VALUES("BREc"); +INSERT INTO t1(b) VALUES("CRec"); +EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer @@ -40,8 +41,8 @@ SET @@global.max_seeks_for_key = 20; SELECT @@global.max_seeks_for_key; @@global.max_seeks_for_key 20 -INSERT into t1(b) values("AREc"); -explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; +INSERT INTO t1(b) VALUES("AREc"); +EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where; Using join buffer @@ -49,27 +50,28 @@ SET @@session.max_seeks_for_key = 2; SELECT @@session.max_seeks_for_key; @@session.max_seeks_for_key 2 -INSERT into t1(b) values("BREc"); -INSERT into t1(b) values("CRec"); -explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; +INSERT INTO t1(b) VALUES("BREc"); +INSERT INTO t1(b) VALUES("CRec"); +EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 6 1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer -INSERT INTO t1 values(null,"test"); +INSERT INTO t1 VALUES(null,"test"); INSERT INTO t1 VALUES (null,"a"),(null,"a"),(null,"a"), (null,"a"),(null,"a"),(null,"a"),(null,"a"), (null,"a"),(null,"a"),(null,"a"); -explain SELECT STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; +EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 17 1 SIMPLE t2 ALL NULL NULL NULL NULL 17 Using where; Using join buffer -analyze table t1; +ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK SET MAX_SEEKS_FOR_KEY=1; -explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; +EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 17 1 SIMPLE t2 ALL NULL NULL NULL NULL 17 Using where; Using join buffer SET MAX_SEEKS_FOR_KEY=DEFAULT; -drop table t1; +DROP TABLE t1; +SET @@global.max_seeks_for_key= @start_value; diff --git a/mysql-test/r/max_sort_length_basic.result b/mysql-test/suite/sys_vars/r/max_sort_length_basic.result index 73dd31ea4e7..73dd31ea4e7 100644 --- a/mysql-test/r/max_sort_length_basic.result +++ b/mysql-test/suite/sys_vars/r/max_sort_length_basic.result diff --git a/mysql-test/r/max_sort_length_func.result b/mysql-test/suite/sys_vars/r/max_sort_length_func.result index 04f5aa7f4f1..9254f1fadd7 100644 --- a/mysql-test/r/max_sort_length_func.result +++ b/mysql-test/suite/sys_vars/r/max_sort_length_func.result @@ -1,3 +1,4 @@ +SET @start_value= @@global.max_sort_length; SET @session_max_sort_length = @@Session.max_sort_length; DROP TABLE IF EXISTS t; ** creating tables ** @@ -296,3 +297,4 @@ SET @@SESSION.max_sort_length = @session_max_sort_length; DROP TABLE IF EXISTS t; DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; +SET @@global.max_sort_length= @start_value; diff --git a/mysql-test/r/max_sp_recursion_depth_basic.result b/mysql-test/suite/sys_vars/r/max_sp_recursion_depth_basic.result index 8c79f3c5fc7..8c79f3c5fc7 100644 --- a/mysql-test/r/max_sp_recursion_depth_basic.result +++ b/mysql-test/suite/sys_vars/r/max_sp_recursion_depth_basic.result diff --git a/mysql-test/r/max_sp_recursion_depth_func.result b/mysql-test/suite/sys_vars/r/max_sp_recursion_depth_func.result index 59d88440f53..59d88440f53 100644 --- a/mysql-test/r/max_sp_recursion_depth_func.result +++ b/mysql-test/suite/sys_vars/r/max_sp_recursion_depth_func.result diff --git a/mysql-test/r/max_user_connections_basic.result b/mysql-test/suite/sys_vars/r/max_user_connections_basic.result index 3250b2f03ea..3250b2f03ea 100644 --- a/mysql-test/r/max_user_connections_basic.result +++ b/mysql-test/suite/sys_vars/r/max_user_connections_basic.result diff --git a/mysql-test/r/max_user_connections_func.result b/mysql-test/suite/sys_vars/r/max_user_connections_func.result index 2ff2ac82ce7..2ff2ac82ce7 100644 --- a/mysql-test/r/max_user_connections_func.result +++ b/mysql-test/suite/sys_vars/r/max_user_connections_func.result diff --git a/mysql-test/r/myisam_data_pointer_size_basic.result b/mysql-test/suite/sys_vars/r/myisam_data_pointer_size_basic.result index d2b0bebe029..d2b0bebe029 100644 --- a/mysql-test/r/myisam_data_pointer_size_basic.result +++ b/mysql-test/suite/sys_vars/r/myisam_data_pointer_size_basic.result diff --git a/mysql-test/r/myisam_data_pointer_size_func.result b/mysql-test/suite/sys_vars/r/myisam_data_pointer_size_func.result index f32e25c7427..82d9a7dad66 100644 --- a/mysql-test/r/myisam_data_pointer_size_func.result +++ b/mysql-test/suite/sys_vars/r/myisam_data_pointer_size_func.result @@ -1,4 +1,5 @@ '#--------------------FN_DYNVARS_093_01-------------------------#' +SET @start_value= @@global.myisam_data_pointer_size; SET @@global.myisam_data_pointer_size = 2; 'connect (con1,localhost,root,,,,)' 'connection con1' @@ -40,3 +41,4 @@ count(*) 65536 DROP PROCEDURE sp_addRec; DROP TABLE t1; +SET @@global.myisam_data_pointer_size= @start_value; diff --git a/mysql-test/suite/sys_vars/r/myisam_max_sort_file_size_basic_32.result b/mysql-test/suite/sys_vars/r/myisam_max_sort_file_size_basic_32.result index 64d1168685c..7467537eaba 100644 --- a/mysql-test/suite/sys_vars/r/myisam_max_sort_file_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/myisam_max_sort_file_size_basic_32.result @@ -1,7 +1,7 @@ SET @start_global_value = @@global.myisam_max_sort_file_size; SELECT @start_global_value; @start_global_value -2147483647 +2146435072 '#--------------------FN_DYNVARS_094_01-------------------------#' SET @@global.myisam_max_sort_file_size = 500000; SET @@global.myisam_max_sort_file_size = DEFAULT; diff --git a/mysql-test/r/myisam_sort_buffer_size_basic.result b/mysql-test/suite/sys_vars/r/myisam_sort_buffer_size_basic.result index 74d2fb3ec86..74d2fb3ec86 100644 --- a/mysql-test/r/myisam_sort_buffer_size_basic.result +++ b/mysql-test/suite/sys_vars/r/myisam_sort_buffer_size_basic.result diff --git a/mysql-test/r/myisam_stats_method_basic.result b/mysql-test/suite/sys_vars/r/myisam_stats_method_basic.result index 3272ef6e538..3272ef6e538 100644 --- a/mysql-test/r/myisam_stats_method_basic.result +++ b/mysql-test/suite/sys_vars/r/myisam_stats_method_basic.result diff --git a/mysql-test/r/myisam_stats_method_func.result b/mysql-test/suite/sys_vars/r/myisam_stats_method_func.result index ace6887cc90..55d91b7417d 100644 --- a/mysql-test/r/myisam_stats_method_func.result +++ b/mysql-test/suite/sys_vars/r/myisam_stats_method_func.result @@ -1,4 +1,5 @@ '#--------------------FN_DYNVARS_097_01-------------------------#' +SET @start_value = @@global.myisam_stats_method; SET @@global.myisam_stats_method = nulls_equal; 'connect (con1,localhost,root,,,,)' 'connection con1' @@ -11,11 +12,11 @@ nulls_equal '#--------------------FN_DYNVARS_097_02-------------------------#' 'connection default' DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (a int, key (a)); +CREATE TABLE t1 (a INT, KEY (a)); INSERT INTO t1 VALUES (0),(1),(2),(3),(4); INSERT INTO t1 SELECT NULL FROM t1; 'default: NULLs considered unequal' -SET myisam_stats_method=nulls_unequal; +SET myisam_stats_method = nulls_unequal; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK @@ -23,7 +24,7 @@ SHOW INDEX FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 1 a 1 a A 10 NULL NULL YES BTREE INSERT INTO t1 VALUES (11); -DELETE FROM t1 WHERE a=11; +DELETE FROM t1 WHERE a = 11; CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -31,9 +32,9 @@ SHOW INDEX FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 1 a 1 a A 10 NULL NULL YES BTREE 'Set nulls to be equal' -SET myisam_stats_method=nulls_equal; +SET myisam_stats_method = nulls_equal; INSERT INTO t1 VALUES (11); -DELETE FROM t1 WHERE a=11; +DELETE FROM t1 WHERE a = 11; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK @@ -41,7 +42,7 @@ SHOW INDEX FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 1 a 1 a A 5 NULL NULL YES BTREE INSERT INTO t1 VALUES (11); -DELETE FROM t1 WHERE a=11; +DELETE FROM t1 WHERE a = 11; CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -49,14 +50,14 @@ SHOW INDEX FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 1 a 1 a A 5 NULL NULL YES BTREE 'Set nulls to be ignored' -SET myisam_stats_method=nulls_ignored; -SHOW variables LIKE 'myisam_stats_method'; +SET myisam_stats_method = nulls_ignored; +SHOW VARIABLES LIKE 'myisam_stats_method'; Variable_name Value myisam_stats_method nulls_ignored -drop TABLE t1; +DROP TABLE t1; CREATE TABLE t1 ( -a char(3), b char(4), c char(5), d char(6), -key(a,b,c,d) +a CHAR(3), b CHAR(4), c CHAR(5), d CHAR(6), +KEY(a,b,c,d) ); INSERT INTO t1 VALUES ('bcd','def1', NULL, 'zz'); INSERT INTO t1 VALUES ('bcd','def2', NULL, 'zz'); @@ -81,5 +82,6 @@ t1 1 a 1 a A 0 NULL NULL YES BTREE t1 1 a 2 b A 0 NULL NULL YES BTREE t1 1 a 3 c A 0 NULL NULL YES BTREE t1 1 a 4 d A 0 NULL NULL YES BTREE -SET myisam_stats_method=DEFAULT; +SET myisam_stats_method = DEFAULT; DROP TABLE t1; +SET @@global.myisam_stats_method= @start_value; diff --git a/mysql-test/r/myisam_use_mmap_basic.result b/mysql-test/suite/sys_vars/r/myisam_use_mmap_basic.result index c0f92acb983..c0f92acb983 100644 --- a/mysql-test/r/myisam_use_mmap_basic.result +++ b/mysql-test/suite/sys_vars/r/myisam_use_mmap_basic.result diff --git a/mysql-test/r/ndb_log_update_as_write_basic.result b/mysql-test/suite/sys_vars/r/ndb_log_update_as_write_basic.result index 6353fba2b7c..6353fba2b7c 100644 --- a/mysql-test/r/ndb_log_update_as_write_basic.result +++ b/mysql-test/suite/sys_vars/r/ndb_log_update_as_write_basic.result diff --git a/mysql-test/r/ndb_log_updated_only_basic.result b/mysql-test/suite/sys_vars/r/ndb_log_updated_only_basic.result index 38abb7cc263..38abb7cc263 100644 --- a/mysql-test/r/ndb_log_updated_only_basic.result +++ b/mysql-test/suite/sys_vars/r/ndb_log_updated_only_basic.result diff --git a/mysql-test/r/net_buffer_length_basic.result b/mysql-test/suite/sys_vars/r/net_buffer_length_basic.result index be7e9082332..be7e9082332 100644 --- a/mysql-test/r/net_buffer_length_basic.result +++ b/mysql-test/suite/sys_vars/r/net_buffer_length_basic.result diff --git a/mysql-test/r/net_read_timeout_basic.result b/mysql-test/suite/sys_vars/r/net_read_timeout_basic.result index 90a6ef72718..90a6ef72718 100644 --- a/mysql-test/r/net_read_timeout_basic.result +++ b/mysql-test/suite/sys_vars/r/net_read_timeout_basic.result diff --git a/mysql-test/r/net_write_timeout_basic.result b/mysql-test/suite/sys_vars/r/net_write_timeout_basic.result index 35a2cf069e3..35a2cf069e3 100644 --- a/mysql-test/r/net_write_timeout_basic.result +++ b/mysql-test/suite/sys_vars/r/net_write_timeout_basic.result diff --git a/mysql-test/r/new_basic.result b/mysql-test/suite/sys_vars/r/new_basic.result index b36e540ddd9..b36e540ddd9 100644 --- a/mysql-test/r/new_basic.result +++ b/mysql-test/suite/sys_vars/r/new_basic.result diff --git a/mysql-test/r/old_passwords_basic.result b/mysql-test/suite/sys_vars/r/old_passwords_basic.result index ecf23ab302b..ecf23ab302b 100644 --- a/mysql-test/r/old_passwords_basic.result +++ b/mysql-test/suite/sys_vars/r/old_passwords_basic.result diff --git a/mysql-test/r/old_passwords_func.result b/mysql-test/suite/sys_vars/r/old_passwords_func.result index eebee9f4852..eebee9f4852 100644 --- a/mysql-test/r/old_passwords_func.result +++ b/mysql-test/suite/sys_vars/r/old_passwords_func.result diff --git a/mysql-test/r/optimizer_prune_level_basic.result b/mysql-test/suite/sys_vars/r/optimizer_prune_level_basic.result index 46fe70c40d0..46fe70c40d0 100644 --- a/mysql-test/r/optimizer_prune_level_basic.result +++ b/mysql-test/suite/sys_vars/r/optimizer_prune_level_basic.result diff --git a/mysql-test/r/optimizer_search_depth_basic.result b/mysql-test/suite/sys_vars/r/optimizer_search_depth_basic.result index 9c26339839e..9c26339839e 100644 --- a/mysql-test/r/optimizer_search_depth_basic.result +++ b/mysql-test/suite/sys_vars/r/optimizer_search_depth_basic.result diff --git a/mysql-test/r/preload_buffer_size_basic.result b/mysql-test/suite/sys_vars/r/preload_buffer_size_basic.result index 775b670d3bc..775b670d3bc 100644 --- a/mysql-test/r/preload_buffer_size_basic.result +++ b/mysql-test/suite/sys_vars/r/preload_buffer_size_basic.result diff --git a/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic_32.result b/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic_32.result index 3b7f06c8f81..32b9371977c 100644 --- a/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic_32.result @@ -36,10 +36,14 @@ SELECT @@global.query_alloc_block_size; @@global.query_alloc_block_size 1024 SET @@global.query_alloc_block_size = 4294967295; +Warnings: +Warning 1292 Truncated incorrect query_alloc_block_size value: '4294967295' SELECT @@global.query_alloc_block_size; @@global.query_alloc_block_size 4294966272 SET @@global.query_alloc_block_size = 4294967294; +Warnings: +Warning 1292 Truncated incorrect query_alloc_block_size value: '4294967294' SELECT @@global.query_alloc_block_size; @@global.query_alloc_block_size 4294966272 @@ -58,10 +62,14 @@ SELECT @@session.query_alloc_block_size; @@session.query_alloc_block_size 1024 SET @@session.query_alloc_block_size = 4294967295; +Warnings: +Warning 1292 Truncated incorrect query_alloc_block_size value: '4294967295' SELECT @@session.query_alloc_block_size; @@session.query_alloc_block_size 4294966272 SET @@session.query_alloc_block_size = 4294967294; +Warnings: +Warning 1292 Truncated incorrect query_alloc_block_size value: '4294967294' SELECT @@session.query_alloc_block_size; @@session.query_alloc_block_size 4294966272 diff --git a/mysql-test/r/query_cache_limit_func.result b/mysql-test/suite/sys_vars/r/query_cache_limit_func.result index e54884cd5c3..bbbb273428a 100644 --- a/mysql-test/r/query_cache_limit_func.result +++ b/mysql-test/suite/sys_vars/r/query_cache_limit_func.result @@ -1,6 +1,8 @@ ** Setup ** SET @global_query_cache_limit = @@global.query_cache_limit; +SET @global_query_cache_size = @@global.query_cache_size; +SET @global_query_cache_type = @@global.query_cache_type; ** warnings ** DROP TABLE IF EXISTS t; ** creating table ** @@ -48,7 +50,7 @@ Qcache_queries_in_cache 1 FLUSH STATUS; RESET QUERY CACHE; ** set cache limit ** -SET @@GLOBAL.query_cache_limit=0; +SET @@GLOBAL.query_cache_limit = 0; ** fetching results ** SELECT * FROM t; id c @@ -67,7 +69,7 @@ Qcache_queries_in_cache 0 0 Expected '#---------------------FN_DYNVARS_132_03----------------------#' ** set cache limit ** -SET @@GLOBAL.query_cache_limit=DEFAULT; +SET @@GLOBAL.query_cache_limit = DEFAULT; ** Reset cache values ** FLUSH STATUS; RESET QUERY CACHE; @@ -86,7 +88,7 @@ SHOW STATUS LIKE 'Qcache_queries_in_cache'; Variable_name Value Qcache_queries_in_cache 1 1 Expected -SET @@GLOBAL.query_cache_limit=0; +SET @@GLOBAL.query_cache_limit = 0; SHOW STATUS LIKE 'Qcache_not_cached'; Variable_name Value Qcache_not_cached 0 @@ -112,4 +114,6 @@ Variable_name Value Qcache_queries_in_cache 1 1 Expected SET @@GLOBAL.query_cache_limit = @global_query_cache_limit; +SET GLOBAL query_cache_size = @global_query_cache_size; +SET GLOBAL query_cache_type = @global_query_cache_type; DROP TABLE IF EXISTS t; diff --git a/mysql-test/suite/sys_vars/r/query_cache_size_basic_32.result b/mysql-test/suite/sys_vars/r/query_cache_size_basic_32.result index 1af70b3af84..1793726b2f1 100644 --- a/mysql-test/suite/sys_vars/r/query_cache_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/query_cache_size_basic_32.result @@ -1,7 +1,4 @@ SET @start_value = @@global.query_cache_size; -SELECT @start_value; -@start_value -0 '#--------------------FN_DYNVARS_133_01------------------------#' SET @@global.query_cache_size = 99; SET @@global.query_cache_size = DEFAULT; @@ -10,8 +7,8 @@ SELECT @@global.query_cache_size; 0 '#---------------------FN_DYNVARS_133_02-------------------------#' SET @@global.query_cache_size = @start_value; -SELECT @@global.query_cache_size = 0; -@@global.query_cache_size = 0 +SELECT @@global.query_cache_size = @start_value; +@@global.query_cache_size = @start_value 1 '#--------------------FN_DYNVARS_133_03------------------------#' SET @@global.query_cache_size = 0; @@ -133,6 +130,3 @@ ERROR 42S02: Unknown table 'global' in field list SELECT query_cache_size = @@session.query_cache_size; ERROR 42S22: Unknown column 'query_cache_size' in 'field list' SET @@global.query_cache_size = @start_value; -SELECT @@global.query_cache_size; -@@global.query_cache_size -0 diff --git a/mysql-test/suite/sys_vars/r/query_cache_size_basic_64.result b/mysql-test/suite/sys_vars/r/query_cache_size_basic_64.result index 0d67eec1ccc..0cc508b169e 100644 --- a/mysql-test/suite/sys_vars/r/query_cache_size_basic_64.result +++ b/mysql-test/suite/sys_vars/r/query_cache_size_basic_64.result @@ -1,7 +1,4 @@ SET @start_value = @@global.query_cache_size; -SELECT @start_value; -@start_value -0 '#--------------------FN_DYNVARS_133_01------------------------#' SET @@global.query_cache_size = 99; SET @@global.query_cache_size = DEFAULT; @@ -10,8 +7,8 @@ SELECT @@global.query_cache_size; 0 '#---------------------FN_DYNVARS_133_02-------------------------#' SET @@global.query_cache_size = @start_value; -SELECT @@global.query_cache_size = 0; -@@global.query_cache_size = 0 +SELECT @@global.query_cache_size = @start_value; +@@global.query_cache_size = @start_value 1 '#--------------------FN_DYNVARS_133_03------------------------#' SET @@global.query_cache_size = 0; @@ -129,6 +126,3 @@ ERROR 42S02: Unknown table 'global' in field list SELECT query_cache_size = @@session.query_cache_size; ERROR 42S22: Unknown column 'query_cache_size' in 'field list' SET @@global.query_cache_size = @start_value; -SELECT @@global.query_cache_size; -@@global.query_cache_size -0 diff --git a/mysql-test/r/query_cache_type_basic.result b/mysql-test/suite/sys_vars/r/query_cache_type_basic.result index 101853daa80..101853daa80 100644 --- a/mysql-test/r/query_cache_type_basic.result +++ b/mysql-test/suite/sys_vars/r/query_cache_type_basic.result diff --git a/mysql-test/r/query_cache_type_func.result b/mysql-test/suite/sys_vars/r/query_cache_type_func.result index 94c31804248..af121244572 100644 --- a/mysql-test/r/query_cache_type_func.result +++ b/mysql-test/suite/sys_vars/r/query_cache_type_func.result @@ -4,6 +4,7 @@ ** Connection con0 ** SET @start_global_value = @@GLOBAL.query_cache_type; SET @start_session_value = @@SESSION.query_cache_type; +SET @start_query_cache_size= @@global.query_cache_size; CREATE TABLE t1(id int, value varchar(10)); INSERT INTO t1 VALUES(1, 'val1'); INSERT INTO t1 VALUES(2, 'val2'); @@ -216,6 +217,7 @@ Disconnecting con1,con2,con3 ** Connection con0 ** SET @@GLOBAL.query_cache_type = @start_global_value; SET @@SESSION.query_cache_type = @start_session_value; +SET GLOBAL query_cache_size = @start_query_cache_size; DROP TABLE t1; DROP PROCEDURE testProcHit; Disconnecting con0 diff --git a/mysql-test/r/query_cache_wlock_invalidate_basic.result b/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_basic.result index bff07741656..bff07741656 100644 --- a/mysql-test/r/query_cache_wlock_invalidate_basic.result +++ b/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_basic.result diff --git a/mysql-test/r/query_cache_wlock_invalidate_func.result b/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result index 71ee11a5235..71ee11a5235 100644 --- a/mysql-test/r/query_cache_wlock_invalidate_func.result +++ b/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result diff --git a/mysql-test/suite/sys_vars/r/query_prealloc_size_basic_32.result b/mysql-test/suite/sys_vars/r/query_prealloc_size_basic_32.result index cd5f1727d41..a16c56f95c5 100644 --- a/mysql-test/suite/sys_vars/r/query_prealloc_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/query_prealloc_size_basic_32.result @@ -35,10 +35,6 @@ SET @@global.query_prealloc_size = 8192; SELECT @@global.query_prealloc_size ; @@global.query_prealloc_size 8192 -SET @@global.query_prealloc_size = 4294967295; -SELECT @@global.query_prealloc_size ; -@@global.query_prealloc_size -4294966272 SET @@global.query_prealloc_size = 655354; SELECT @@global.query_prealloc_size ; @@global.query_prealloc_size @@ -48,10 +44,6 @@ SET @@session.query_prealloc_size = 8192; SELECT @@session.query_prealloc_size ; @@session.query_prealloc_size 8192 -SET @@session.query_prealloc_size = 4294967295; -SELECT @@session.query_prealloc_size ; -@@session.query_prealloc_size -4294966272 SET @@session.query_prealloc_size = 655345; SELECT @@session.query_prealloc_size ; @@session.query_prealloc_size @@ -63,50 +55,32 @@ Warning 1292 Truncated incorrect query_prealloc_size value: '0' SELECT @@global.query_prealloc_size ; @@global.query_prealloc_size 8192 -SET @@global.query_prealloc_size = -1024; -Warnings: -Warning 1292 Truncated incorrect query_prealloc_size value: '0' -SELECT @@global.query_prealloc_size ; -@@global.query_prealloc_size -8192 -SET @@global.query_prealloc_size = 429496729533; -Warnings: -Warning 1292 Truncated incorrect query_prealloc_size value: '429496729533' -SELECT @@global.query_prealloc_size ; -@@global.query_prealloc_size -4294966272 SET @@global.query_prealloc_size = 65530.34.; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1 SELECT @@global.query_prealloc_size ; @@global.query_prealloc_size -4294966272 +8192 SET @@global.query_prealloc_size = test; ERROR 42000: Incorrect argument type to variable 'query_prealloc_size' SELECT @@global.query_prealloc_size ; @@global.query_prealloc_size -4294966272 +8192 SET @@global.query_prealloc_size = "test"; ERROR 42000: Incorrect argument type to variable 'query_prealloc_size' SELECT @@global.query_prealloc_size ; @@global.query_prealloc_size -4294966272 +8192 SET @@global.query_prealloc_size = 'test'; ERROR 42000: Incorrect argument type to variable 'query_prealloc_size' SELECT @@global.query_prealloc_size ; @@global.query_prealloc_size -4294966272 +8192 SET @@global.query_prealloc_size = ON; ERROR 42000: Incorrect argument type to variable 'query_prealloc_size' SELECT @@global.query_prealloc_size ; @@global.query_prealloc_size -4294966272 -SET @@session.query_prealloc_size = 0; -Warnings: -Warning 1292 Truncated incorrect query_prealloc_size value: '0' -SELECT @@session.query_prealloc_size ; -@@session.query_prealloc_size 8192 -SET @@session.query_prealloc_size = -2; +SET @@session.query_prealloc_size = 0; Warnings: Warning 1292 Truncated incorrect query_prealloc_size value: '0' SELECT @@session.query_prealloc_size ; diff --git a/mysql-test/r/query_prealloc_size_func.result b/mysql-test/suite/sys_vars/r/query_prealloc_size_func.result index c77586f2fc4..4f7a8d18f32 100644 --- a/mysql-test/r/query_prealloc_size_func.result +++ b/mysql-test/suite/sys_vars/r/query_prealloc_size_func.result @@ -1,17 +1,18 @@ ** Setup ** -CREATE TABLE t1 (id int auto_increment primary key, val text(200)); -INSERT INTO t1 values(NULL,'a'); -INSERT INTO t1 values(NULL,'b'); -INSERT INTO t1 values(NULL,'c'); -INSERT INTO t1 values(NULL,'d'); +SET @start_value = @@global.query_prealloc_size; +CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY, val TEXT(200)); +INSERT INTO t1 VALUES(NULL,'a'); +INSERT INTO t1 VALUES(NULL,'b'); +INSERT INTO t1 VALUES(NULL,'c'); +INSERT INTO t1 VALUES(NULL,'d'); SELECT * FROM t1 ORDER BY val; id val 1 a 2 b 3 c 4 d -SET SESSION query_prealloc_size = 8192; +SET SESSION query_prealloc_size = 8192; '#----------------------------FN_DYNVARS_137_05-----------------#' SET GLOBAL query_prealloc_size = 8192; SELECT @@SESSION.query_prealloc_size; @@ -36,3 +37,5 @@ SELECT @@GLOBAL.query_prealloc_size; @@GLOBAL.query_prealloc_size 8192 Expected Value : 8192; +DROP TABLE t1; +SET @@global.query_prealloc_size = @start_value; diff --git a/mysql-test/suite/sys_vars/r/range_alloc_block_size_basic_32.result b/mysql-test/suite/sys_vars/r/range_alloc_block_size_basic_32.result index 93441448d90..95e22dfcf14 100644 --- a/mysql-test/suite/sys_vars/r/range_alloc_block_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/range_alloc_block_size_basic_32.result @@ -39,10 +39,14 @@ SELECT @@global.range_alloc_block_size; 4096 'Bug# 34877: Invalid Values are coming in variable on assigning valid values'; SET @@global.range_alloc_block_size = 4294967295; +Warnings: +Warning 1292 Truncated incorrect range_alloc_block_size value: '4294967295' SELECT @@global.range_alloc_block_size; @@global.range_alloc_block_size 4294966272 SET @@global.range_alloc_block_size = 4294967294; +Warnings: +Warning 1292 Truncated incorrect range_alloc_block_size value: '4294967294' SELECT @@global.range_alloc_block_size; @@global.range_alloc_block_size 4294966272 @@ -55,10 +59,14 @@ SELECT @@session.range_alloc_block_size; @@session.range_alloc_block_size 4096 SET @@session.range_alloc_block_size = 4294967295; +Warnings: +Warning 1292 Truncated incorrect range_alloc_block_size value: '4294967295' SELECT @@session.range_alloc_block_size; @@session.range_alloc_block_size 4294966272 SET @@session.range_alloc_block_size = 4294967294; +Warnings: +Warning 1292 Truncated incorrect range_alloc_block_size value: '4294967294' SELECT @@session.range_alloc_block_size; @@session.range_alloc_block_size 4294966272 diff --git a/mysql-test/r/read_buffer_size_basic.result b/mysql-test/suite/sys_vars/r/read_buffer_size_basic.result index 799f7b56235..3c007dc1515 100644 --- a/mysql-test/r/read_buffer_size_basic.result +++ b/mysql-test/suite/sys_vars/r/read_buffer_size_basic.result @@ -86,6 +86,8 @@ SELECT @@global.read_buffer_size= 8200 OR @@global.read_buffer_size= 8228 ; @@global.read_buffer_size= 8200 OR @@global.read_buffer_size= 8228 1 SET @@global.read_buffer_size = 2147479553; +Warnings: +Warning 1292 Truncated incorrect read_buffer_size value: '2147479553' SELECT @@global.read_buffer_size; @@global.read_buffer_size 2147479552 @@ -114,6 +116,8 @@ SELECT @@session.read_buffer_size= 8200 OR @@session.read_buffer_size= 8228 ; SET @@session.read_buffer_size = 65530.34.; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1 SET @@session.read_buffer_size = 2147479553; +Warnings: +Warning 1292 Truncated incorrect read_buffer_size value: '2147479553' SELECT @@session.read_buffer_size; @@session.read_buffer_size 2147479552 diff --git a/mysql-test/r/read_only_basic.result b/mysql-test/suite/sys_vars/r/read_only_basic.result index ac153fa337c..ac153fa337c 100644 --- a/mysql-test/r/read_only_basic.result +++ b/mysql-test/suite/sys_vars/r/read_only_basic.result diff --git a/mysql-test/r/read_only_func.result b/mysql-test/suite/sys_vars/r/read_only_func.result index 35b42d468d6..35b42d468d6 100644 --- a/mysql-test/r/read_only_func.result +++ b/mysql-test/suite/sys_vars/r/read_only_func.result diff --git a/mysql-test/r/read_rnd_buffer_size_basic.result b/mysql-test/suite/sys_vars/r/read_rnd_buffer_size_basic.result index c51b0591054..c6440ac032e 100644 --- a/mysql-test/r/read_rnd_buffer_size_basic.result +++ b/mysql-test/suite/sys_vars/r/read_rnd_buffer_size_basic.result @@ -88,6 +88,8 @@ SELECT @@global.read_rnd_buffer_size= 8200 OR @@global.read_rnd_buffer_size= 822 @@global.read_rnd_buffer_size= 8200 OR @@global.read_rnd_buffer_size= 8228 1 SET @@global.read_rnd_buffer_size = 2147479553; +Warnings: +Warning 1292 Truncated incorrect read_rnd_buffer_size value: '2147479553' SELECT @@global.read_rnd_buffer_size; @@global.read_rnd_buffer_size 2147479552 @@ -116,6 +118,8 @@ SELECT @@session.read_rnd_buffer_size= 8200 OR @@session.read_rnd_buffer_size= 8 SET @@session.read_rnd_buffer_size = 65530.34.; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1 SET @@session.read_rnd_buffer_size = 2147479553; +Warnings: +Warning 1292 Truncated incorrect read_rnd_buffer_size value: '2147479553' SELECT @@session.read_rnd_buffer_size; @@session.read_rnd_buffer_size 2147479552 diff --git a/mysql-test/r/relay_log_purge_basic.result b/mysql-test/suite/sys_vars/r/relay_log_purge_basic.result index 6f938c5265f..6f938c5265f 100644 --- a/mysql-test/r/relay_log_purge_basic.result +++ b/mysql-test/suite/sys_vars/r/relay_log_purge_basic.result diff --git a/mysql-test/suite/sys_vars/r/rpl_init_slave_func.result b/mysql-test/suite/sys_vars/r/rpl_init_slave_func.result new file mode 100644 index 00000000000..0d1f4d483d8 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/rpl_init_slave_func.result @@ -0,0 +1,46 @@ +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; +connection slave +SET @start_max_connections= @@global.max_connections; +SET @start_init_slave= @@global.init_slave; +SET @@global.init_slave = 'SET @@global.max_connections = @@global.max_connections + 1'; +DROP TABLE IF EXISTS t1; +CREATE TEMPORARY TABLE t1 AS SELECT @@global.init_slave AS my_column; +DESCRIBE t1; +Field Type Null Key Default Extra +my_column longtext NO NULL +DROP TABLE t1; +SELECT @@global.init_slave = 'SET @@global.max_connections = @@global.max_connections + 1'; +@@global.init_slave = 'SET @@global.max_connections = @@global.max_connections + 1' +1 +Expect 1 +SELECT @@global.max_connections= @start_max_connections; +@@global.max_connections= @start_max_connections +1 +Expect 1 +STOP SLAVE; +RESET MASTER; +RESET SLAVE; +START SLAVE; +SELECT @@global.max_connections = @start_max_connections + 1; +@@global.max_connections = @start_max_connections + 1 +1 +Expect 1 +SET @@global.init_slave = "SET @a=5"; +STOP SLAVE; +RESET MASTER; +RESET SLAVE; +START SLAVE; +SHOW VARIABLES LIKE 'init_slave'; +Variable_name Value +init_slave SET @a=5 +SELECT @a; +@a +NULL +Expect NULL +SET @@global.max_connections= @start_max_connections; +SET @@global.init_slave= @start_init_slave; diff --git a/mysql-test/r/rpl_max_binlog_size_func.result b/mysql-test/suite/sys_vars/r/rpl_max_binlog_size_func.result index 08c1ea407fd..0d0a1ae03c4 100644 --- a/mysql-test/r/rpl_max_binlog_size_func.result +++ b/mysql-test/suite/sys_vars/r/rpl_max_binlog_size_func.result @@ -1,5 +1,8 @@ DROP TABLE IF EXISTS t1; '--- check if log file is rotated after 4096 bytes ----' +SET @saved_max_binlog_size= @@global.max_binlog_size; SET @@global.max_binlog_size = 4096; CREATE TABLE t1(a CHAR(5)); 'mylog.000002 exists' +SET @@global.max_binlog_size= @saved_max_binlog_size; +DROP TABLE t1; diff --git a/mysql-test/r/secure_auth_basic.result b/mysql-test/suite/sys_vars/r/secure_auth_basic.result index b8a903ba420..b8a903ba420 100644 --- a/mysql-test/r/secure_auth_basic.result +++ b/mysql-test/suite/sys_vars/r/secure_auth_basic.result diff --git a/mysql-test/r/secure_auth_func.result b/mysql-test/suite/sys_vars/r/secure_auth_func.result index f7e24e3f043..f7e24e3f043 100644 --- a/mysql-test/r/secure_auth_func.result +++ b/mysql-test/suite/sys_vars/r/secure_auth_func.result diff --git a/mysql-test/r/slave_allow_batching_basic.result b/mysql-test/suite/sys_vars/r/slave_allow_batching_basic.result index 186cfbc8f0f..186cfbc8f0f 100644 --- a/mysql-test/r/slave_allow_batching_basic.result +++ b/mysql-test/suite/sys_vars/r/slave_allow_batching_basic.result diff --git a/mysql-test/r/slave_compressed_protocol_basic.result b/mysql-test/suite/sys_vars/r/slave_compressed_protocol_basic.result index 3f2d9d2fb3f..3f2d9d2fb3f 100644 --- a/mysql-test/r/slave_compressed_protocol_basic.result +++ b/mysql-test/suite/sys_vars/r/slave_compressed_protocol_basic.result diff --git a/mysql-test/r/slave_exec_mode_basic.result b/mysql-test/suite/sys_vars/r/slave_exec_mode_basic.result index aeb73196733..aeb73196733 100644 --- a/mysql-test/r/slave_exec_mode_basic.result +++ b/mysql-test/suite/sys_vars/r/slave_exec_mode_basic.result diff --git a/mysql-test/r/slave_net_timeout_basic.result b/mysql-test/suite/sys_vars/r/slave_net_timeout_basic.result index d672d0152d7..7903d7f8215 100644 --- a/mysql-test/r/slave_net_timeout_basic.result +++ b/mysql-test/suite/sys_vars/r/slave_net_timeout_basic.result @@ -1,7 +1,7 @@ SET @start_global_value = @@global.slave_net_timeout; SELECT @start_global_value; @start_global_value -3600 +120 '#--------------------FN_DYNVARS_146_01-------------------------#' SET @@global.slave_net_timeout = 500000; SET @@global.slave_net_timeout = DEFAULT; @@ -124,4 +124,4 @@ SET global slave_net_timeout = 99; SET @@global.slave_net_timeout = @start_global_value; SELECT @@global.slave_net_timeout; @@global.slave_net_timeout -3600 +120 diff --git a/mysql-test/r/slow_launch_time_basic.result b/mysql-test/suite/sys_vars/r/slow_launch_time_basic.result index c42942fba1a..c42942fba1a 100644 --- a/mysql-test/r/slow_launch_time_basic.result +++ b/mysql-test/suite/sys_vars/r/slow_launch_time_basic.result diff --git a/mysql-test/r/slow_launch_time_func.result b/mysql-test/suite/sys_vars/r/slow_launch_time_func.result index 7665166ff29..7665166ff29 100644 --- a/mysql-test/r/slow_launch_time_func.result +++ b/mysql-test/suite/sys_vars/r/slow_launch_time_func.result diff --git a/mysql-test/r/slow_query_log_basic.result b/mysql-test/suite/sys_vars/r/slow_query_log_basic.result index 716309aeaff..716309aeaff 100644 --- a/mysql-test/r/slow_query_log_basic.result +++ b/mysql-test/suite/sys_vars/r/slow_query_log_basic.result diff --git a/mysql-test/r/slow_query_log_file_basic.result b/mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result index a62f3e21ef2..925f940a5c4 100644 --- a/mysql-test/r/slow_query_log_file_basic.result +++ b/mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result @@ -1,12 +1,9 @@ SET @start_value = @@global.slow_query_log_file; -SELECT @start_value; -@start_value -slowtest.log '#---------------------FN_DYNVARS_004_01-------------------------#' SET @@global.slow_query_log_file = DEFAULT; SELECT RIGHT(@@global.slow_query_log_file,15); RIGHT(@@global.slow_query_log_file,15) -master-slow.log +mysqld-slow.log '#--------------------FN_DYNVARS_004_02------------------------#' SET @@global.slow_query_log_file = mytest.log; SET @@global.slow_query_log_file = 12; @@ -17,3 +14,4 @@ FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slow_query_log_file'; @@global.slow_query_log_file = VARIABLE_VALUE 1 +SET @@global.slow_query_log_file= @start_value; diff --git a/mysql-test/r/slow_query_log_file_func.result b/mysql-test/suite/sys_vars/r/slow_query_log_file_func.result index 4b7a49c6f0b..201b33c8edb 100644 --- a/mysql-test/r/slow_query_log_file_func.result +++ b/mysql-test/suite/sys_vars/r/slow_query_log_file_func.result @@ -1,3 +1,3 @@ '#--------------------FN_DYNVARS_018_01-------------------------#' -## --file_exists var/master-data/my_slow_test.log ## +## Checking if my_slow_test.log exists in servers datadir ## ## This case should pass because we have set this filename in opt file ## diff --git a/mysql-test/r/slow_query_log_func.result b/mysql-test/suite/sys_vars/r/slow_query_log_func.result index 83edb4c187e..83edb4c187e 100644 --- a/mysql-test/r/slow_query_log_func.result +++ b/mysql-test/suite/sys_vars/r/slow_query_log_func.result diff --git a/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_32.result b/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_32.result index 09a1fe59046..9d3eadcc26f 100644 --- a/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_32.result @@ -1,47 +1,33 @@ SET @start_global_value = @@global.sort_buffer_size; -SELECT @start_global_value; -@start_global_value -262144 SET @start_session_value = @@session.sort_buffer_size; -SELECT @start_session_value; -@start_session_value -262144 '#--------------------FN_DYNVARS_151_01-------------------------#' SET @@global.sort_buffer_size = 1000; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '1000' SET @@global.sort_buffer_size = DEFAULT; -SELECT @@global.sort_buffer_size= 2097144 OR @@global.sort_buffer_size= 2097116; -@@global.sort_buffer_size= 2097144 OR @@global.sort_buffer_size= 2097116 +SELECT @@global.sort_buffer_size BETWEEN 2097116 AND 2100000; +@@global.sort_buffer_size BETWEEN 2097116 AND 2100000 1 SET @@session.sort_buffer_size = 2000; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '2000' SET @@session.sort_buffer_size = DEFAULT; -SELECT @@session.sort_buffer_size= 2097144 OR @@session.sort_buffer_size= 2097116; -@@session.sort_buffer_size= 2097144 OR @@session.sort_buffer_size= 2097116 +SELECT @@session.sort_buffer_size BETWEEN 2097116 AND 2100000; +@@session.sort_buffer_size BETWEEN 2097116 AND 2100000 1 '#--------------------FN_DYNVARS_151_02-------------------------#' SET @@global.sort_buffer_size = DEFAULT; -SELECT @@global.sort_buffer_size = 2097144 OR @@global.sort_buffer_size= 2097116; -@@global.sort_buffer_size = 2097144 OR @@global.sort_buffer_size= 2097116 +SELECT @@global.sort_buffer_size BETWEEN 2097116 AND 2100000; +@@global.sort_buffer_size BETWEEN 2097116 AND 2100000 1 SET @@session.sort_buffer_size = DEFAULT; -SELECT @@session.sort_buffer_size = 2097144 OR @@session.sort_buffer_size= 2097116; -@@session.sort_buffer_size = 2097144 OR @@session.sort_buffer_size= 2097116 +SELECT @@session.sort_buffer_size BETWEEN 2097116 AND 2100000; +@@session.sort_buffer_size BETWEEN 2097116 AND 2100000 1 '#--------------------FN_DYNVARS_151_03-------------------------#' SET @@global.sort_buffer_size = 32776; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32776' -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@global.sort_buffer_size = 32777; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32777' -SELECT @@global.sort_buffer_size= 32777 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32777 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@global.sort_buffer_size = 4294967295; SELECT @@global.sort_buffer_size; @@ -51,19 +37,14 @@ SET @@global.sort_buffer_size = 4294967294; SELECT @@global.sort_buffer_size; @@global.sort_buffer_size 4294967294 -'Bug# 34877: Invalid Values are showing in variable on assigning valid values.'; '#--------------------FN_DYNVARS_151_04-------------------------#' SET @@session.sort_buffer_size = 32776; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32776' -SELECT @@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804; -@@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804 +SELECT @@session.sort_buffer_size BETWEEN 32776 AND 32999; +@@session.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@session.sort_buffer_size = 32777; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32777' -SELECT @@session.sort_buffer_size= 32777 OR @@session.sort_buffer_size= 32804; -@@session.sort_buffer_size= 32777 OR @@session.sort_buffer_size= 32804 +SELECT @@session.sort_buffer_size BETWEEN 32776 AND 32999; +@@session.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@session.sort_buffer_size = 4294967295; SELECT @@session.sort_buffer_size; @@ -75,20 +56,14 @@ SELECT @@session.sort_buffer_size; 4294967294 '#------------------FN_DYNVARS_151_05-----------------------#' SET @@global.sort_buffer_size = 32775; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32775' -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@global.sort_buffer_size = -1024; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '0' -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@global.sort_buffer_size = 4294967296; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '4294967296' SELECT @@global.sort_buffer_size; @@global.sort_buffer_size 4294967295 @@ -103,64 +78,47 @@ SELECT @@global.sort_buffer_size; @@global.sort_buffer_size 4294967295 SET @@session.sort_buffer_size = 32775; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32775' -SELECT @@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804; -@@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804 +SELECT @@session.sort_buffer_size BETWEEN 32776 AND 32999; +@@session.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@session.sort_buffer_size = -2; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '0' -SELECT @@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804; -@@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804 +SELECT @@session.sort_buffer_size BETWEEN 32776 AND 32999; +@@session.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@session.sort_buffer_size = 65530.34.; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1 SET @@session.sort_buffer_size = 4294967296; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '4294967296' SELECT @@session.sort_buffer_size; @@session.sort_buffer_size 4294967295 -'Bug # 34837: Errors are not coming on assigning invalid values to variable'; SET @@session.sort_buffer_size = test; ERROR 42000: Incorrect argument type to variable 'sort_buffer_size' -SELECT @@session.sort_buffer_size; -@@session.sort_buffer_size -4294967295 '#------------------FN_DYNVARS_151_06-----------------------#' -SELECT @@global.sort_buffer_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; +SELECT @@global.sort_buffer_size = VARIABLE_VALUE FROM +INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; @@global.sort_buffer_size = VARIABLE_VALUE 1 '#------------------FN_DYNVARS_151_07-----------------------#' -SELECT @@session.sort_buffer_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; +SELECT @@session.sort_buffer_size = VARIABLE_VALUE FROM +INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; @@session.sort_buffer_size = VARIABLE_VALUE 1 '#------------------FN_DYNVARS_151_08-----------------------#' SET @@global.sort_buffer_size = TRUE; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '1' -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@global.sort_buffer_size = FALSE; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '0' -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 -'Bug: Errors should be displayed on assigning TRUE/FALSE to variable' '#---------------------FN_DYNVARS_151_09----------------------#' SET @@global.sort_buffer_size = 9000; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '9000' SELECT @@sort_buffer_size = @@global.sort_buffer_size; @@sort_buffer_size = @@global.sort_buffer_size 0 '#---------------------FN_DYNVARS_151_10----------------------#' SET @@sort_buffer_size = 9000; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '9000' SELECT @@sort_buffer_size = @@local.sort_buffer_size; @@sort_buffer_size = @@local.sort_buffer_size 1 @@ -169,14 +127,9 @@ SELECT @@local.sort_buffer_size = @@session.sort_buffer_size; 1 '#---------------------FN_DYNVARS_151_11----------------------#' SET sort_buffer_size = 9100; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '9100' -SELECT @sort_buffer_size= 32776 OR @@sort_buffer_size= 32804; -@sort_buffer_size= 32776 OR @@sort_buffer_size= 32804 -1 -SELECT @@sort_buffer_size; -@@sort_buffer_size -32804 +SELECT @@sort_buffer_size BETWEEN 32776 AND 32999; +@@sort_buffer_size BETWEEN 32776 AND 32999 +1 SELECT local.sort_buffer_size; ERROR 42S02: Unknown table 'local' in field list SELECT session.sort_buffer_size; @@ -184,10 +137,4 @@ ERROR 42S02: Unknown table 'session' in field list SELECT sort_buffer_size = @@session.sort_buffer_size; ERROR 42S22: Unknown column 'sort_buffer_size' in 'field list' SET @@global.sort_buffer_size = @start_global_value; -SELECT @@global.sort_buffer_size; -@@global.sort_buffer_size -262144 SET @@session.sort_buffer_size = @start_session_value; -SELECT @@session.sort_buffer_size; -@@session.sort_buffer_size -262144 diff --git a/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_64.result b/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_64.result index e9bd14abc67..c993c8a0a88 100644 --- a/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_64.result +++ b/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_64.result @@ -1,47 +1,33 @@ SET @start_global_value = @@global.sort_buffer_size; -SELECT @start_global_value; -@start_global_value -262144 SET @start_session_value = @@session.sort_buffer_size; -SELECT @start_session_value; -@start_session_value -262144 '#--------------------FN_DYNVARS_151_01-------------------------#' SET @@global.sort_buffer_size = 1000; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '1000' SET @@global.sort_buffer_size = DEFAULT; -SELECT @@global.sort_buffer_size= 2097144 OR @@global.sort_buffer_size= 2097116; -@@global.sort_buffer_size= 2097144 OR @@global.sort_buffer_size= 2097116 +SELECT @@global.sort_buffer_size BETWEEN 2097116 AND 2100000; +@@global.sort_buffer_size BETWEEN 2097116 AND 2100000 1 SET @@session.sort_buffer_size = 2000; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '2000' SET @@session.sort_buffer_size = DEFAULT; -SELECT @@session.sort_buffer_size= 2097144 OR @@session.sort_buffer_size= 2097116; -@@session.sort_buffer_size= 2097144 OR @@session.sort_buffer_size= 2097116 +SELECT @@session.sort_buffer_size BETWEEN 2097116 AND 2100000; +@@session.sort_buffer_size BETWEEN 2097116 AND 2100000 1 '#--------------------FN_DYNVARS_151_02-------------------------#' SET @@global.sort_buffer_size = DEFAULT; -SELECT @@global.sort_buffer_size = 2097144 OR @@global.sort_buffer_size= 2097116; -@@global.sort_buffer_size = 2097144 OR @@global.sort_buffer_size= 2097116 +SELECT @@global.sort_buffer_size BETWEEN 2097116 AND 2100000; +@@global.sort_buffer_size BETWEEN 2097116 AND 2100000 1 SET @@session.sort_buffer_size = DEFAULT; -SELECT @@session.sort_buffer_size = 2097144 OR @@session.sort_buffer_size= 2097116; -@@session.sort_buffer_size = 2097144 OR @@session.sort_buffer_size= 2097116 +SELECT @@session.sort_buffer_size BETWEEN 2097116 AND 2100000; +@@session.sort_buffer_size BETWEEN 2097116 AND 2100000 1 '#--------------------FN_DYNVARS_151_03-------------------------#' SET @@global.sort_buffer_size = 32776; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32776' -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@global.sort_buffer_size = 32777; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32777' -SELECT @@global.sort_buffer_size= 32777 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32777 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@global.sort_buffer_size = 4294967295; SELECT @@global.sort_buffer_size; @@ -51,19 +37,14 @@ SET @@global.sort_buffer_size = 4294967294; SELECT @@global.sort_buffer_size; @@global.sort_buffer_size 4294967294 -'Bug# 34877: Invalid Values are showing in variable on assigning valid values.'; '#--------------------FN_DYNVARS_151_04-------------------------#' SET @@session.sort_buffer_size = 32776; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32776' -SELECT @@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804; -@@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804 +SELECT @@session.sort_buffer_size BETWEEN 32776 AND 32999; +@@session.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@session.sort_buffer_size = 32777; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32777' -SELECT @@session.sort_buffer_size= 32777 OR @@session.sort_buffer_size= 32804; -@@session.sort_buffer_size= 32777 OR @@session.sort_buffer_size= 32804 +SELECT @@session.sort_buffer_size BETWEEN 32776 AND 32999; +@@session.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@session.sort_buffer_size = 4294967295; SELECT @@session.sort_buffer_size; @@ -75,16 +56,12 @@ SELECT @@session.sort_buffer_size; 4294967294 '#------------------FN_DYNVARS_151_05-----------------------#' SET @@global.sort_buffer_size = 32775; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32775' -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@global.sort_buffer_size = -1024; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '0' -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@global.sort_buffer_size = 4294967296; SELECT @@global.sort_buffer_size; @@ -101,16 +78,12 @@ SELECT @@global.sort_buffer_size; @@global.sort_buffer_size 4294967296 SET @@session.sort_buffer_size = 32775; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32775' -SELECT @@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804; -@@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804 +SELECT @@session.sort_buffer_size BETWEEN 32776 AND 32999; +@@session.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@session.sort_buffer_size = -2; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '0' -SELECT @@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804; -@@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804 +SELECT @@session.sort_buffer_size BETWEEN 32776 AND 32999; +@@session.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@session.sort_buffer_size = 65530.34.; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1 @@ -118,45 +91,34 @@ SET @@session.sort_buffer_size = 4294967296; SELECT @@session.sort_buffer_size; @@session.sort_buffer_size 4294967296 -'Bug # 34837: Errors are not coming on assigning invalid values to variable'; SET @@session.sort_buffer_size = test; ERROR 42000: Incorrect argument type to variable 'sort_buffer_size' -SELECT @@session.sort_buffer_size; -@@session.sort_buffer_size -4294967296 '#------------------FN_DYNVARS_151_06-----------------------#' -SELECT @@global.sort_buffer_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; +SELECT @@global.sort_buffer_size = VARIABLE_VALUE FROM +INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; @@global.sort_buffer_size = VARIABLE_VALUE 1 '#------------------FN_DYNVARS_151_07-----------------------#' -SELECT @@session.sort_buffer_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; +SELECT @@session.sort_buffer_size = VARIABLE_VALUE FROM +INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; @@session.sort_buffer_size = VARIABLE_VALUE 1 '#------------------FN_DYNVARS_151_08-----------------------#' SET @@global.sort_buffer_size = TRUE; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '1' -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@global.sort_buffer_size = FALSE; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '0' -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 -'Bug: Errors should be displayed on assigning TRUE/FALSE to variable' '#---------------------FN_DYNVARS_151_09----------------------#' SET @@global.sort_buffer_size = 9000; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '9000' SELECT @@sort_buffer_size = @@global.sort_buffer_size; @@sort_buffer_size = @@global.sort_buffer_size 0 '#---------------------FN_DYNVARS_151_10----------------------#' SET @@sort_buffer_size = 9000; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '9000' SELECT @@sort_buffer_size = @@local.sort_buffer_size; @@sort_buffer_size = @@local.sort_buffer_size 1 @@ -165,14 +127,9 @@ SELECT @@local.sort_buffer_size = @@session.sort_buffer_size; 1 '#---------------------FN_DYNVARS_151_11----------------------#' SET sort_buffer_size = 9100; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '9100' -SELECT @sort_buffer_size= 32776 OR @@sort_buffer_size= 32804; -@sort_buffer_size= 32776 OR @@sort_buffer_size= 32804 -1 -SELECT @@sort_buffer_size; -@@sort_buffer_size -32804 +SELECT @@sort_buffer_size BETWEEN 32776 AND 32999; +@@sort_buffer_size BETWEEN 32776 AND 32999 +1 SELECT local.sort_buffer_size; ERROR 42S02: Unknown table 'local' in field list SELECT session.sort_buffer_size; @@ -180,10 +137,4 @@ ERROR 42S02: Unknown table 'session' in field list SELECT sort_buffer_size = @@session.sort_buffer_size; ERROR 42S22: Unknown column 'sort_buffer_size' in 'field list' SET @@global.sort_buffer_size = @start_global_value; -SELECT @@global.sort_buffer_size; -@@global.sort_buffer_size -262144 SET @@session.sort_buffer_size = @start_session_value; -SELECT @@session.sort_buffer_size; -@@session.sort_buffer_size -262144 diff --git a/mysql-test/r/sql_auto_is_null_basic.result b/mysql-test/suite/sys_vars/r/sql_auto_is_null_basic.result index b3a3eecd93a..b3a3eecd93a 100644 --- a/mysql-test/r/sql_auto_is_null_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_auto_is_null_basic.result diff --git a/mysql-test/r/sql_big_selects_basic.result b/mysql-test/suite/sys_vars/r/sql_big_selects_basic.result index 1171382380d..1171382380d 100644 --- a/mysql-test/r/sql_big_selects_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_big_selects_basic.result diff --git a/mysql-test/r/sql_big_selects_func.result b/mysql-test/suite/sys_vars/r/sql_big_selects_func.result index fc7e1f32e00..fc7e1f32e00 100644 --- a/mysql-test/r/sql_big_selects_func.result +++ b/mysql-test/suite/sys_vars/r/sql_big_selects_func.result diff --git a/mysql-test/r/sql_big_tables_basic.result b/mysql-test/suite/sys_vars/r/sql_big_tables_basic.result index bce14b2aba2..bce14b2aba2 100644 --- a/mysql-test/r/sql_big_tables_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_big_tables_basic.result diff --git a/mysql-test/r/sql_big_tables_func.result b/mysql-test/suite/sys_vars/r/sql_big_tables_func.result index 9b707e439ef..9b707e439ef 100644 --- a/mysql-test/r/sql_big_tables_func.result +++ b/mysql-test/suite/sys_vars/r/sql_big_tables_func.result diff --git a/mysql-test/r/sql_buffer_result_basic.result b/mysql-test/suite/sys_vars/r/sql_buffer_result_basic.result index d03b688dbe6..d03b688dbe6 100644 --- a/mysql-test/r/sql_buffer_result_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_buffer_result_basic.result diff --git a/mysql-test/r/sql_buffer_result_func.result b/mysql-test/suite/sys_vars/r/sql_buffer_result_func.result index 38d7f7ecc0a..38d7f7ecc0a 100644 --- a/mysql-test/r/sql_buffer_result_func.result +++ b/mysql-test/suite/sys_vars/r/sql_buffer_result_func.result diff --git a/mysql-test/r/sql_log_bin_basic.result b/mysql-test/suite/sys_vars/r/sql_log_bin_basic.result index 4e37c2079d6..4e37c2079d6 100644 --- a/mysql-test/r/sql_log_bin_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_log_bin_basic.result diff --git a/mysql-test/r/sql_log_off_basic.result b/mysql-test/suite/sys_vars/r/sql_log_off_basic.result index 03846cb6ce8..03846cb6ce8 100644 --- a/mysql-test/r/sql_log_off_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_log_off_basic.result diff --git a/mysql-test/r/sql_log_off_func.result b/mysql-test/suite/sys_vars/r/sql_log_off_func.result index e51860534f1..e51860534f1 100644 --- a/mysql-test/r/sql_log_off_func.result +++ b/mysql-test/suite/sys_vars/r/sql_log_off_func.result diff --git a/mysql-test/r/sql_low_priority_updates_basic.result b/mysql-test/suite/sys_vars/r/sql_low_priority_updates_basic.result index 6a09e6720b3..6a09e6720b3 100644 --- a/mysql-test/r/sql_low_priority_updates_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_low_priority_updates_basic.result diff --git a/mysql-test/r/sql_low_priority_updates_func.result b/mysql-test/suite/sys_vars/r/sql_low_priority_updates_func.result index f0874ae7414..f0874ae7414 100644 --- a/mysql-test/r/sql_low_priority_updates_func.result +++ b/mysql-test/suite/sys_vars/r/sql_low_priority_updates_func.result diff --git a/mysql-test/r/sql_max_join_size_func.result b/mysql-test/suite/sys_vars/r/sql_max_join_size_func.result index 0e406f6611e..0e406f6611e 100644 --- a/mysql-test/r/sql_max_join_size_func.result +++ b/mysql-test/suite/sys_vars/r/sql_max_join_size_func.result diff --git a/mysql-test/r/sql_mode_basic.result b/mysql-test/suite/sys_vars/r/sql_mode_basic.result index 78a9f179824..78a9f179824 100644 --- a/mysql-test/r/sql_mode_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_mode_basic.result diff --git a/mysql-test/r/sql_mode_func.result b/mysql-test/suite/sys_vars/r/sql_mode_func.result index dbf0db4e1ad..dbf0db4e1ad 100644 --- a/mysql-test/r/sql_mode_func.result +++ b/mysql-test/suite/sys_vars/r/sql_mode_func.result diff --git a/mysql-test/r/sql_notes_basic.result b/mysql-test/suite/sys_vars/r/sql_notes_basic.result index 5dd792d8ede..5dd792d8ede 100644 --- a/mysql-test/r/sql_notes_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_notes_basic.result diff --git a/mysql-test/r/sql_notes_func.result b/mysql-test/suite/sys_vars/r/sql_notes_func.result index 87c4ecb8431..87c4ecb8431 100644 --- a/mysql-test/r/sql_notes_func.result +++ b/mysql-test/suite/sys_vars/r/sql_notes_func.result diff --git a/mysql-test/r/sql_quote_show_create_basic.result b/mysql-test/suite/sys_vars/r/sql_quote_show_create_basic.result index 2550f2d1057..2550f2d1057 100644 --- a/mysql-test/r/sql_quote_show_create_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_quote_show_create_basic.result diff --git a/mysql-test/r/sql_quote_show_create_func.result b/mysql-test/suite/sys_vars/r/sql_quote_show_create_func.result index 9c1e751eef2..9c1e751eef2 100644 --- a/mysql-test/r/sql_quote_show_create_func.result +++ b/mysql-test/suite/sys_vars/r/sql_quote_show_create_func.result diff --git a/mysql-test/r/sql_safe_updates_basic.result b/mysql-test/suite/sys_vars/r/sql_safe_updates_basic.result index 539b38bb1fe..539b38bb1fe 100644 --- a/mysql-test/r/sql_safe_updates_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_safe_updates_basic.result diff --git a/mysql-test/r/sql_safe_updates_func.result b/mysql-test/suite/sys_vars/r/sql_safe_updates_func.result index cf8d613b683..cf8d613b683 100644 --- a/mysql-test/r/sql_safe_updates_func.result +++ b/mysql-test/suite/sys_vars/r/sql_safe_updates_func.result diff --git a/mysql-test/r/sql_select_limit_func.result b/mysql-test/suite/sys_vars/r/sql_select_limit_func.result index 893816e6f0f..893816e6f0f 100644 --- a/mysql-test/r/sql_select_limit_func.result +++ b/mysql-test/suite/sys_vars/r/sql_select_limit_func.result diff --git a/mysql-test/r/sql_slave_skip_counter_basic.result b/mysql-test/suite/sys_vars/r/sql_slave_skip_counter_basic.result index 9ceef325483..9ceef325483 100644 --- a/mysql-test/r/sql_slave_skip_counter_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_slave_skip_counter_basic.result diff --git a/mysql-test/r/sql_warnings_basic.result b/mysql-test/suite/sys_vars/r/sql_warnings_basic.result index 46907c0ced8..46907c0ced8 100644 --- a/mysql-test/r/sql_warnings_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_warnings_basic.result diff --git a/mysql-test/r/sql_warnings_func.result b/mysql-test/suite/sys_vars/r/sql_warnings_func.result index 8b723cf8be3..8b723cf8be3 100644 --- a/mysql-test/r/sql_warnings_func.result +++ b/mysql-test/suite/sys_vars/r/sql_warnings_func.result diff --git a/mysql-test/r/ssl_ca_basic.result b/mysql-test/suite/sys_vars/r/ssl_ca_basic.result index 618c5558c3e..618c5558c3e 100644 --- a/mysql-test/r/ssl_ca_basic.result +++ b/mysql-test/suite/sys_vars/r/ssl_ca_basic.result diff --git a/mysql-test/r/ssl_capath_basic.result b/mysql-test/suite/sys_vars/r/ssl_capath_basic.result index 3d161392917..3d161392917 100644 --- a/mysql-test/r/ssl_capath_basic.result +++ b/mysql-test/suite/sys_vars/r/ssl_capath_basic.result diff --git a/mysql-test/r/ssl_cert_basic.result b/mysql-test/suite/sys_vars/r/ssl_cert_basic.result index 1571730a653..1571730a653 100644 --- a/mysql-test/r/ssl_cert_basic.result +++ b/mysql-test/suite/sys_vars/r/ssl_cert_basic.result diff --git a/mysql-test/r/ssl_cipher_basic.result b/mysql-test/suite/sys_vars/r/ssl_cipher_basic.result index df0fc8b5aad..df0fc8b5aad 100644 --- a/mysql-test/r/ssl_cipher_basic.result +++ b/mysql-test/suite/sys_vars/r/ssl_cipher_basic.result diff --git a/mysql-test/r/ssl_key_basic.result b/mysql-test/suite/sys_vars/r/ssl_key_basic.result index 0869a2915e3..0869a2915e3 100644 --- a/mysql-test/r/ssl_key_basic.result +++ b/mysql-test/suite/sys_vars/r/ssl_key_basic.result diff --git a/mysql-test/r/storage_engine_basic.result b/mysql-test/suite/sys_vars/r/storage_engine_basic.result index 8d621ac5599..8d621ac5599 100644 --- a/mysql-test/r/storage_engine_basic.result +++ b/mysql-test/suite/sys_vars/r/storage_engine_basic.result diff --git a/mysql-test/r/sync_frm_basic.result b/mysql-test/suite/sys_vars/r/sync_frm_basic.result index 2467ea15e7c..2467ea15e7c 100644 --- a/mysql-test/r/sync_frm_basic.result +++ b/mysql-test/suite/sys_vars/r/sync_frm_basic.result diff --git a/mysql-test/r/system_time_zone_basic.result b/mysql-test/suite/sys_vars/r/system_time_zone_basic.result index c398e5bd93b..c398e5bd93b 100644 --- a/mysql-test/r/system_time_zone_basic.result +++ b/mysql-test/suite/sys_vars/r/system_time_zone_basic.result diff --git a/mysql-test/r/table_definition_cache_basic.result b/mysql-test/suite/sys_vars/r/table_definition_cache_basic.result index 5f0e1960358..5f0e1960358 100644 --- a/mysql-test/r/table_definition_cache_basic.result +++ b/mysql-test/suite/sys_vars/r/table_definition_cache_basic.result diff --git a/mysql-test/r/table_lock_wait_timeout_basic.result b/mysql-test/suite/sys_vars/r/table_lock_wait_timeout_basic.result index 13771980188..13771980188 100644 --- a/mysql-test/r/table_lock_wait_timeout_basic.result +++ b/mysql-test/suite/sys_vars/r/table_lock_wait_timeout_basic.result diff --git a/mysql-test/r/table_open_cache_basic.result b/mysql-test/suite/sys_vars/r/table_open_cache_basic.result index ca02d32386f..ca02d32386f 100644 --- a/mysql-test/r/table_open_cache_basic.result +++ b/mysql-test/suite/sys_vars/r/table_open_cache_basic.result diff --git a/mysql-test/r/thread_cache_size_func.result b/mysql-test/suite/sys_vars/r/thread_cache_size_func.result index f808e28a512..f808e28a512 100644 --- a/mysql-test/r/thread_cache_size_func.result +++ b/mysql-test/suite/sys_vars/r/thread_cache_size_func.result diff --git a/mysql-test/r/thread_handling_basic.result b/mysql-test/suite/sys_vars/r/thread_handling_basic.result index f5a333ac033..f5a333ac033 100644 --- a/mysql-test/r/thread_handling_basic.result +++ b/mysql-test/suite/sys_vars/r/thread_handling_basic.result diff --git a/mysql-test/r/time_zone_basic.result b/mysql-test/suite/sys_vars/r/time_zone_basic.result index e7d419f28b5..e7d419f28b5 100644 --- a/mysql-test/r/time_zone_basic.result +++ b/mysql-test/suite/sys_vars/r/time_zone_basic.result diff --git a/mysql-test/r/time_zone_func.result b/mysql-test/suite/sys_vars/r/time_zone_func.result index 2153a3f58ff..2153a3f58ff 100644 --- a/mysql-test/r/time_zone_func.result +++ b/mysql-test/suite/sys_vars/r/time_zone_func.result diff --git a/mysql-test/r/timed_mutexes_basic.result b/mysql-test/suite/sys_vars/r/timed_mutexes_basic.result index d8bd2cd975f..d8bd2cd975f 100644 --- a/mysql-test/r/timed_mutexes_basic.result +++ b/mysql-test/suite/sys_vars/r/timed_mutexes_basic.result diff --git a/mysql-test/suite/sys_vars/r/timestamp_basic_32.result b/mysql-test/suite/sys_vars/r/timestamp_basic_32.result index cc4f0324c0f..a8be2201e68 100644 --- a/mysql-test/suite/sys_vars/r/timestamp_basic_32.result +++ b/mysql-test/suite/sys_vars/r/timestamp_basic_32.result @@ -35,11 +35,6 @@ ERROR 42000: Incorrect argument type to variable 'timestamp' SET @@timestamp = 9999999999999999999999; ERROR 42000: Incorrect argument type to variable 'timestamp' '#----------------------FN_DYNVARS_001_06------------------------#' -SELECT @@timestamp = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.SESSION_VARIABLES -WHERE VARIABLE_NAME='timestamp'; -@@timestamp = VARIABLE_VALUE -1 '#---------------------FN_DYNVARS_001_08-------------------------#' SET @@timestamp = OFF; ERROR 42000: Incorrect argument type to variable 'timestamp' diff --git a/mysql-test/suite/sys_vars/r/timestamp_basic_64.result b/mysql-test/suite/sys_vars/r/timestamp_basic_64.result index df877cd455b..824a3ea5529 100644 --- a/mysql-test/suite/sys_vars/r/timestamp_basic_64.result +++ b/mysql-test/suite/sys_vars/r/timestamp_basic_64.result @@ -35,11 +35,6 @@ ERROR 42000: Incorrect argument type to variable 'timestamp' SET @@timestamp = 9999999999999999999999; ERROR 42000: Incorrect argument type to variable 'timestamp' '#----------------------FN_DYNVARS_001_06------------------------#' -SELECT @@timestamp = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.SESSION_VARIABLES -WHERE VARIABLE_NAME='timestamp'; -@@timestamp = VARIABLE_VALUE -1 '#---------------------FN_DYNVARS_001_08-------------------------#' SET @@timestamp = OFF; ERROR 42000: Incorrect argument type to variable 'timestamp' diff --git a/mysql-test/r/timestamp_func.result b/mysql-test/suite/sys_vars/r/timestamp_func.result index 1b49331c069..1b49331c069 100644 --- a/mysql-test/r/timestamp_func.result +++ b/mysql-test/suite/sys_vars/r/timestamp_func.result diff --git a/mysql-test/r/timestamp_sysdate_is_now_func.result b/mysql-test/suite/sys_vars/r/timestamp_sysdate_is_now_func.result index e24ff2e962a..e24ff2e962a 100644 --- a/mysql-test/r/timestamp_sysdate_is_now_func.result +++ b/mysql-test/suite/sys_vars/r/timestamp_sysdate_is_now_func.result diff --git a/mysql-test/suite/sys_vars/r/tmp_table_size_basic_32.result b/mysql-test/suite/sys_vars/r/tmp_table_size_basic.result index aeafd95ed55..3b4099d30ae 100644 --- a/mysql-test/suite/sys_vars/r/tmp_table_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/tmp_table_size_basic.result @@ -1,39 +1,21 @@ SET @start_global_value = @@global.tmp_table_size; -SELECT @start_global_value; -@start_global_value -16777216 SET @start_session_value = @@session.tmp_table_size; -SELECT @start_session_value; -@start_session_value -16777216 -'Bug# 34876: This variable has invalid default value as compared to documentation'; '#--------------------FN_DYNVARS_005_01-------------------------#' SET @@global.tmp_table_size = 100; Warnings: Warning 1292 Truncated incorrect tmp_table_size value: '100' SET @@global.tmp_table_size = DEFAULT; -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -16777216 -'Bug# 34876: This variable has invalid default value as compared to documentation'; SET @@session.tmp_table_size = 200; Warnings: Warning 1292 Truncated incorrect tmp_table_size value: '200' SET @@session.tmp_table_size = DEFAULT; -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -16777216 -'Bug# 34876: This variable has invalid default value as compared to documentation'; '#--------------------FN_DYNVARS_005_02-------------------------#' -SET @@global.tmp_table_size = DEFAULT; -SELECT @@global.tmp_table_size = 33554432; -@@global.tmp_table_size = 33554432 -0 -SET @@session.tmp_table_size = DEFAULT; -SELECT @@session.tmp_table_size = 33554432; -@@session.tmp_table_size = 33554432 -0 -'Bug# 34876: This variable has invalid default value as compared to documentation'; +SELECT @@global.tmp_table_size >= 16777216; +@@global.tmp_table_size >= 16777216 +1 +SELECT @@session.tmp_table_size >= 16777216; +@@session.tmp_table_size >= 16777216 +1 '#--------------------FN_DYNVARS_005_03-------------------------#' SET @@global.tmp_table_size = 1024; SELECT @@global.tmp_table_size; @@ -52,7 +34,7 @@ SET @@session.tmp_table_size = 1024; SELECT @@session.tmp_table_size; @@session.tmp_table_size 1024 -SET @@session.tmp_table_size =4294967295; +SET @@session.tmp_table_size = 4294967295; SELECT @@session.tmp_table_size; @@session.tmp_table_size 4294967295 @@ -79,7 +61,6 @@ Warning 1292 Truncated incorrect tmp_table_size value: '1000' SELECT @@global.tmp_table_size; @@global.tmp_table_size 1024 -'Bug # 34837: Errors are not coming on assigning invalid values to variable'; SET @@global.tmp_table_size = ON; ERROR 42000: Incorrect argument type to variable 'tmp_table_size' SET @@global.tmp_table_size = OFF; @@ -96,7 +77,6 @@ Warning 1292 Truncated incorrect tmp_table_size value: '0' SELECT @@global.tmp_table_size; @@global.tmp_table_size 1024 -'Bug:Error should be shown that variable is numeric and can not assigned boolean value'; SET @@global.tmp_table_size = 65530.34; ERROR 42000: Incorrect argument type to variable 'tmp_table_size' SET @@global.tmp_table_size ="Test"; @@ -120,18 +100,18 @@ SELECT @@session.tmp_table_size; SET @@session.tmp_table_size = "Test"; ERROR 42000: Incorrect argument type to variable 'tmp_table_size' SET @@session.tmp_table_size = 12345678901; -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -4294967295 +SELECT @@session.tmp_table_size IN (12345678901,4294967295); +@@session.tmp_table_size IN (12345678901,4294967295) +1 '#------------------FN_DYNVARS_005_06-----------------------#' -SELECT @@global.tmp_table_size = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +SELECT @@global.tmp_table_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='tmp_table_size'; @@global.tmp_table_size = VARIABLE_VALUE 1 '#------------------FN_DYNVARS_005_07-----------------------#' -SELECT @@session.tmp_table_size = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.SESSION_VARIABLES +SELECT @@session.tmp_table_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='tmp_table_size'; @@session.tmp_table_size = VARIABLE_VALUE 1 @@ -163,10 +143,4 @@ ERROR 42S02: Unknown table 'global' in field list SELECT tmp_table_size = @@session.tmp_table_size; ERROR 42S22: Unknown column 'tmp_table_size' in 'field list' SET @@global.tmp_table_size = @start_global_value; -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -16777216 SET @@session.tmp_table_size = @start_session_value; -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -16777216 diff --git a/mysql-test/suite/sys_vars/r/tmp_table_size_basic_64.result b/mysql-test/suite/sys_vars/r/tmp_table_size_basic_64.result deleted file mode 100644 index 837b90fc143..00000000000 --- a/mysql-test/suite/sys_vars/r/tmp_table_size_basic_64.result +++ /dev/null @@ -1,172 +0,0 @@ -SET @start_global_value = @@global.tmp_table_size; -SELECT @start_global_value; -@start_global_value -16777216 -SET @start_session_value = @@session.tmp_table_size; -SELECT @start_session_value; -@start_session_value -16777216 -'Bug# 34876: This variable has invalid default value as compared to documentation'; -'#--------------------FN_DYNVARS_005_01-------------------------#' -SET @@global.tmp_table_size = 100; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '100' -SET @@global.tmp_table_size = DEFAULT; -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -16777216 -'Bug# 34876: This variable has invalid default value as compared to documentation'; -SET @@session.tmp_table_size = 200; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '200' -SET @@session.tmp_table_size = DEFAULT; -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -16777216 -'Bug# 34876: This variable has invalid default value as compared to documentation'; -'#--------------------FN_DYNVARS_005_02-------------------------#' -SET @@global.tmp_table_size = DEFAULT; -SELECT @@global.tmp_table_size = 33554432; -@@global.tmp_table_size = 33554432 -0 -SET @@session.tmp_table_size = DEFAULT; -SELECT @@session.tmp_table_size = 33554432; -@@session.tmp_table_size = 33554432 -0 -'Bug# 34876: This variable has invalid default value as compared to documentation'; -'#--------------------FN_DYNVARS_005_03-------------------------#' -SET @@global.tmp_table_size = 1024; -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -1024 -SET @@global.tmp_table_size = 60020; -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -60020 -SET @@global.tmp_table_size = 4294967295; -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -4294967295 -'#--------------------FN_DYNVARS_005_04-------------------------#' -SET @@session.tmp_table_size = 1024; -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -1024 -SET @@session.tmp_table_size =4294967295; -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -4294967295 -SET @@session.tmp_table_size = 65535; -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -65535 -'#------------------FN_DYNVARS_005_05-----------------------#' -SET @@global.tmp_table_size = 0; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '0' -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -1024 -SET @@global.tmp_table_size = -1024; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '0' -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -1024 -SET @@global.tmp_table_size = 1000; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '1000' -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -1024 -'Bug # 34837: Errors are not coming on assigning invalid values to variable'; -SET @@global.tmp_table_size = ON; -ERROR 42000: Incorrect argument type to variable 'tmp_table_size' -SET @@global.tmp_table_size = OFF; -ERROR 42000: Incorrect argument type to variable 'tmp_table_size' -SET @@global.tmp_table_size = True; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '1' -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -1024 -SET @@global.tmp_table_size = False; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '0' -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -1024 -'Bug:Error should be shown that variable is numeric and can not assigned boolean value'; -SET @@global.tmp_table_size = 65530.34; -ERROR 42000: Incorrect argument type to variable 'tmp_table_size' -SET @@global.tmp_table_size ="Test"; -ERROR 42000: Incorrect argument type to variable 'tmp_table_size' -SET @@session.tmp_table_size = ON; -ERROR 42000: Incorrect argument type to variable 'tmp_table_size' -SET @@session.tmp_table_size = OFF; -ERROR 42000: Incorrect argument type to variable 'tmp_table_size' -SET @@session.tmp_table_size = True; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '1' -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -1024 -SET @@session.tmp_table_size = False; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '0' -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -1024 -SET @@session.tmp_table_size = "Test"; -ERROR 42000: Incorrect argument type to variable 'tmp_table_size' -SET @@session.tmp_table_size = 12345678901; -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -12345678901 -'#------------------FN_DYNVARS_005_06-----------------------#' -SELECT @@global.tmp_table_size = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='tmp_table_size'; -@@global.tmp_table_size = VARIABLE_VALUE -1 -'#------------------FN_DYNVARS_005_07-----------------------#' -SELECT @@session.tmp_table_size = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.SESSION_VARIABLES -WHERE VARIABLE_NAME='tmp_table_size'; -@@session.tmp_table_size = VARIABLE_VALUE -1 -'#---------------------FN_DYNVARS_001_09----------------------#' -SET @@global.tmp_table_size = 1024; -SET @@tmp_table_size = 4294967295; -SELECT @@tmp_table_size = @@global.tmp_table_size; -@@tmp_table_size = @@global.tmp_table_size -0 -'#---------------------FN_DYNVARS_001_10----------------------#' -SET @@tmp_table_size = 100; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '100' -SELECT @@tmp_table_size = @@local.tmp_table_size; -@@tmp_table_size = @@local.tmp_table_size -1 -SELECT @@local.tmp_table_size = @@session.tmp_table_size; -@@local.tmp_table_size = @@session.tmp_table_size -1 -'#---------------------FN_DYNVARS_001_11----------------------#' -SET tmp_table_size = 1027; -SELECT @@tmp_table_size; -@@tmp_table_size -1027 -SELECT local.tmp_table_size; -ERROR 42S02: Unknown table 'local' in field list -SELECT global.tmp_table_size; -ERROR 42S02: Unknown table 'global' in field list -SELECT tmp_table_size = @@session.tmp_table_size; -ERROR 42S22: Unknown column 'tmp_table_size' in 'field list' -SET @@global.tmp_table_size = @start_global_value; -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -16777216 -SET @@session.tmp_table_size = @start_session_value; -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -16777216 diff --git a/mysql-test/r/tmpdir_basic.result b/mysql-test/suite/sys_vars/r/tmpdir_basic.result index 613cc8ec3cd..613cc8ec3cd 100644 --- a/mysql-test/r/tmpdir_basic.result +++ b/mysql-test/suite/sys_vars/r/tmpdir_basic.result diff --git a/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic_32.result b/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic_32.result index 706d7802ed3..4aaf67c4064 100644 --- a/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic_32.result @@ -40,6 +40,8 @@ SELECT @@global.transaction_alloc_block_size; @@global.transaction_alloc_block_size 59392 SET @@global.transaction_alloc_block_size = 4294967295; +Warnings: +Warning 1292 Truncated incorrect transaction_alloc_block_size value: '4294967295' SELECT @@global.transaction_alloc_block_size; @@global.transaction_alloc_block_size 4294966272 @@ -50,6 +52,8 @@ SELECT @@session.transaction_alloc_block_size; @@session.transaction_alloc_block_size 1024 SET @@session.transaction_alloc_block_size =4294967295; +Warnings: +Warning 1292 Truncated incorrect transaction_alloc_block_size value: '4294967295' SELECT @@session.transaction_alloc_block_size; @@session.transaction_alloc_block_size 4294966272 @@ -146,6 +150,8 @@ WHERE VARIABLE_NAME='transaction_alloc_block_size'; '#---------------------FN_DYNVARS_001_08----------------------#' SET @@transaction_alloc_block_size = 1024; SET @@global.transaction_alloc_block_size = 4294967295; +Warnings: +Warning 1292 Truncated incorrect transaction_alloc_block_size value: '4294967295' SELECT @@transaction_alloc_block_size = @@global.transaction_alloc_block_size; @@transaction_alloc_block_size = @@global.transaction_alloc_block_size 0 diff --git a/mysql-test/r/tx_isolation_basic.result b/mysql-test/suite/sys_vars/r/tx_isolation_basic.result index d487a6d92a8..d487a6d92a8 100644 --- a/mysql-test/r/tx_isolation_basic.result +++ b/mysql-test/suite/sys_vars/r/tx_isolation_basic.result diff --git a/mysql-test/r/tx_isolation_func.result b/mysql-test/suite/sys_vars/r/tx_isolation_func.result index 2242525f14b..2242525f14b 100644 --- a/mysql-test/r/tx_isolation_func.result +++ b/mysql-test/suite/sys_vars/r/tx_isolation_func.result diff --git a/mysql-test/r/unique_checks_basic.result b/mysql-test/suite/sys_vars/r/unique_checks_basic.result index cc22c1c7f98..cc22c1c7f98 100644 --- a/mysql-test/r/unique_checks_basic.result +++ b/mysql-test/suite/sys_vars/r/unique_checks_basic.result diff --git a/mysql-test/r/updatable_views_with_limit_basic.result b/mysql-test/suite/sys_vars/r/updatable_views_with_limit_basic.result index e2eebbd7a2c..e2eebbd7a2c 100644 --- a/mysql-test/r/updatable_views_with_limit_basic.result +++ b/mysql-test/suite/sys_vars/r/updatable_views_with_limit_basic.result diff --git a/mysql-test/r/updatable_views_with_limit_func.result b/mysql-test/suite/sys_vars/r/updatable_views_with_limit_func.result index 0fdd4cbbb1b..0fdd4cbbb1b 100644 --- a/mysql-test/r/updatable_views_with_limit_func.result +++ b/mysql-test/suite/sys_vars/r/updatable_views_with_limit_func.result diff --git a/mysql-test/r/version_basic.result b/mysql-test/suite/sys_vars/r/version_basic.result index 01710426ac9..01710426ac9 100644 --- a/mysql-test/r/version_basic.result +++ b/mysql-test/suite/sys_vars/r/version_basic.result diff --git a/mysql-test/r/version_comment_basic.result b/mysql-test/suite/sys_vars/r/version_comment_basic.result index 5ef4bdbdd87..5ef4bdbdd87 100644 --- a/mysql-test/r/version_comment_basic.result +++ b/mysql-test/suite/sys_vars/r/version_comment_basic.result diff --git a/mysql-test/r/version_compile_machine_basic.result b/mysql-test/suite/sys_vars/r/version_compile_machine_basic.result index eb239041929..eb239041929 100644 --- a/mysql-test/r/version_compile_machine_basic.result +++ b/mysql-test/suite/sys_vars/r/version_compile_machine_basic.result diff --git a/mysql-test/r/version_compile_os_basic.result b/mysql-test/suite/sys_vars/r/version_compile_os_basic.result index 64dcb761ae1..64dcb761ae1 100644 --- a/mysql-test/r/version_compile_os_basic.result +++ b/mysql-test/suite/sys_vars/r/version_compile_os_basic.result diff --git a/mysql-test/r/wait_timeout_func.result b/mysql-test/suite/sys_vars/r/wait_timeout_func.result index 01b4a71df87..01b4a71df87 100644 --- a/mysql-test/r/wait_timeout_func.result +++ b/mysql-test/suite/sys_vars/r/wait_timeout_func.result diff --git a/mysql-test/r/warning_count_basic.result b/mysql-test/suite/sys_vars/r/warning_count_basic.result index 0ce85c7bbf9..0ce85c7bbf9 100644 --- a/mysql-test/r/warning_count_basic.result +++ b/mysql-test/suite/sys_vars/r/warning_count_basic.result diff --git a/mysql-test/t/auto_commit_basic.test b/mysql-test/suite/sys_vars/t/auto_commit_basic.test index 0ea070ded59..0ea070ded59 100644 --- a/mysql-test/t/auto_commit_basic.test +++ b/mysql-test/suite/sys_vars/t/auto_commit_basic.test diff --git a/mysql-test/t/auto_increment_increment_basic.test b/mysql-test/suite/sys_vars/t/auto_increment_increment_basic.test index 4acfb8f503b..4acfb8f503b 100644 --- a/mysql-test/t/auto_increment_increment_basic.test +++ b/mysql-test/suite/sys_vars/t/auto_increment_increment_basic.test diff --git a/mysql-test/t/auto_increment_increment_func.test b/mysql-test/suite/sys_vars/t/auto_increment_increment_func.test index 7822775fb35..7822775fb35 100644 --- a/mysql-test/t/auto_increment_increment_func.test +++ b/mysql-test/suite/sys_vars/t/auto_increment_increment_func.test diff --git a/mysql-test/t/auto_increment_offset_basic.test b/mysql-test/suite/sys_vars/t/auto_increment_offset_basic.test index a98fd6467ad..a98fd6467ad 100644 --- a/mysql-test/t/auto_increment_offset_basic.test +++ b/mysql-test/suite/sys_vars/t/auto_increment_offset_basic.test diff --git a/mysql-test/t/auto_increment_offset_func.test b/mysql-test/suite/sys_vars/t/auto_increment_offset_func.test index 7e1668452cc..7e1668452cc 100644 --- a/mysql-test/t/auto_increment_offset_func.test +++ b/mysql-test/suite/sys_vars/t/auto_increment_offset_func.test diff --git a/mysql-test/t/autocommit_func-master.opt b/mysql-test/suite/sys_vars/t/autocommit_func-master.opt index 627becdbfb5..627becdbfb5 100644 --- a/mysql-test/t/autocommit_func-master.opt +++ b/mysql-test/suite/sys_vars/t/autocommit_func-master.opt diff --git a/mysql-test/t/autocommit_func.test b/mysql-test/suite/sys_vars/t/autocommit_func.test index 07e15ce40da..07e15ce40da 100644 --- a/mysql-test/t/autocommit_func.test +++ b/mysql-test/suite/sys_vars/t/autocommit_func.test diff --git a/mysql-test/t/automatic_sp_privileges_basic.test b/mysql-test/suite/sys_vars/t/automatic_sp_privileges_basic.test index 74da0904454..74da0904454 100644 --- a/mysql-test/t/automatic_sp_privileges_basic.test +++ b/mysql-test/suite/sys_vars/t/automatic_sp_privileges_basic.test diff --git a/mysql-test/t/automatic_sp_privileges_func.test b/mysql-test/suite/sys_vars/t/automatic_sp_privileges_func.test index ae5edbb078e..ae5edbb078e 100644 --- a/mysql-test/t/automatic_sp_privileges_func.test +++ b/mysql-test/suite/sys_vars/t/automatic_sp_privileges_func.test diff --git a/mysql-test/t/basedir_basic.test b/mysql-test/suite/sys_vars/t/basedir_basic.test index 480e46ca8a0..480e46ca8a0 100644 --- a/mysql-test/t/basedir_basic.test +++ b/mysql-test/suite/sys_vars/t/basedir_basic.test diff --git a/mysql-test/t/big_tables_basic.test b/mysql-test/suite/sys_vars/t/big_tables_basic.test index 8665895bb19..8665895bb19 100644 --- a/mysql-test/t/big_tables_basic.test +++ b/mysql-test/suite/sys_vars/t/big_tables_basic.test diff --git a/mysql-test/t/binlog_format_basic.test b/mysql-test/suite/sys_vars/t/binlog_format_basic.test index 819ad047c1b..cd2b772fcb1 100644 --- a/mysql-test/t/binlog_format_basic.test +++ b/mysql-test/suite/sys_vars/t/binlog_format_basic.test @@ -1,5 +1,3 @@ - - ################## mysql-test\t\binlog_format_basic.test ###################### # # # Variable Name: binlog_format # @@ -17,8 +15,8 @@ # * Value Check # # * Scope Check # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ############################################################################### @@ -33,6 +31,8 @@ SELECT @@GLOBAL.binlog_format; #################################################################### # Displaying default value # #################################################################### +SET @start_value= @@global.binlog_format; + SELECT COUNT(@@GLOBAL.binlog_format); --echo 1 Expected @@ -43,24 +43,11 @@ SELECT COUNT(@@SESSION.binlog_format); #################################################################### # Check if Value can set # #################################################################### - -#--error ER_INCORRECT_GLOBAL_LOCAL_VAR SET @@GLOBAL.binlog_format=1; ---echo Expected error 'Read only variable' ---echo Bug: Writeable static variable -SELECT COUNT(@@GLOBAL.binlog_format); ---echo 1 Expected - - +SELECT @@GLOBAL.binlog_format; -#--error ER_INCORRECT_GLOBAL_LOCAL_VAR SET @@SESSION.binlog_format=1; ---echo Expected error 'Read only variable' ---echo Bug: Writeable static variable -SELECT COUNT(@@SESSION.binlog_format); ---echo 1 Expected - - +SELECT @@SESSION.binlog_format; --echo '#---------------------BS_STVARS_002_03----------------------#' ################################################################# @@ -76,7 +63,7 @@ SELECT COUNT(@@GLOBAL.binlog_format); --echo 1 Expected SELECT COUNT(VARIABLE_VALUE) -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='binlog_format'; --echo 1 Expected @@ -86,8 +73,8 @@ WHERE VARIABLE_NAME='binlog_format'; # Check if the value in SESSION Table matches value in variable # ################################################################# -SELECT @@SESSION.binlog_format = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.SESSION_VARIABLES +SELECT @@SESSION.binlog_format = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='binlog_format'; --echo 1 Expected @@ -95,13 +82,11 @@ SELECT COUNT(@@SESSION.binlog_format); --echo 1 Expected SELECT COUNT(VARIABLE_VALUE) -FROM INFORMATION_SCHEMA.SESSION_VARIABLES +FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='binlog_format'; --echo 1 Expected - - --echo '#---------------------BS_STVARS_002_05----------------------#' ################################################################################ # Check if binlog_format can be accessed with and without @@ sign # @@ -116,5 +101,5 @@ SELECT COUNT(@@SESSION.binlog_format); SELECT COUNT(@@GLOBAL.binlog_format); --echo 1 Expected - +SET @@global.binlog_format= @start_value; diff --git a/mysql-test/t/character_set_client_basic.test b/mysql-test/suite/sys_vars/t/character_set_client_basic.test index 69e4c07dcd8..177a663c112 100644 --- a/mysql-test/t/character_set_client_basic.test +++ b/mysql-test/suite/sys_vars/t/character_set_client_basic.test @@ -207,7 +207,7 @@ SELECT @@character_set_client; let charset_variable = @@global.character_set_client; ---source include/charset_basic.inc +--source suite/sys_vars/inc/charset_basic.inc --echo '#--------------------FN_DYNVARS_010_08-------------------------#' ################################################################################ diff --git a/mysql-test/t/character_set_client_func.test b/mysql-test/suite/sys_vars/t/character_set_client_func.test index 19994672fa4..19994672fa4 100644 --- a/mysql-test/t/character_set_client_func.test +++ b/mysql-test/suite/sys_vars/t/character_set_client_func.test diff --git a/mysql-test/t/character_set_connection_basic.test b/mysql-test/suite/sys_vars/t/character_set_connection_basic.test index 509f8d0d346..5e28d43ce3e 100644 --- a/mysql-test/t/character_set_connection_basic.test +++ b/mysql-test/suite/sys_vars/t/character_set_connection_basic.test @@ -122,7 +122,7 @@ SET @@character_set_connection = utf8 + latin2; ############################################################################## let charset_variable = @@session.character_set_connection; ---source include/charset_basic.inc +--source suite/sys_vars/inc/charset_basic.inc --echo '#--------------------FN_DYNVARS_011_07-------------------------#' @@ -131,7 +131,7 @@ let charset_variable = @@session.character_set_connection; ############################################################################## let charset_variable = @@global.character_set_connection; ---source include/charset_basic.inc +--source suite/sys_vars/inc/charset_basic.inc --echo '#--------------------FN_DYNVARS_011_08-------------------------#' diff --git a/mysql-test/t/character_set_connection_func.test b/mysql-test/suite/sys_vars/t/character_set_connection_func.test index 04883b66544..11a8e311fd1 100644 --- a/mysql-test/t/character_set_connection_func.test +++ b/mysql-test/suite/sys_vars/t/character_set_connection_func.test @@ -14,14 +14,14 @@ # Description: Test Cases of Dynamic System Variable character_set_connection # # that checks the behavior of this variable # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ############################################################################### --echo '#--------------------FN_DYNVARS_011_01-------------------------#' ########################################################################## -# Check if setting character_set_connection is changed in new connection # +# Check if setting character_set_connection is changed in new connection # ########################################################################## #save @@ -35,7 +35,7 @@ SET @@global.character_set_connection = utf8; --echo 'connect (con1,localhost,root,,,,)' connect (con1,localhost,root,,,,); --echo 'connection con1' -connection con1; +connection con1; SELECT @@global.character_set_connection; SELECT @@session.character_set_connection; disconnect con1; @@ -51,7 +51,7 @@ connection default; --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings -CREATE TABLE t1(b CHAR(40) character set utf8); +CREATE TABLE t1(b CHAR(40) CHARACTER SET utf8); #============================================================================== --echo '--verify that character_set_connection converts character_set_client--' #============================================================================== @@ -90,13 +90,16 @@ INSERT INTO t1 VALUES('ÐЂЃЄ'); SELECT * FROM t1; TRUNCATE TABLE t1; -#restore -#save + +# Cleanup SET @@global.character_set_connection = @global_character_set_connection; SET @@session.character_set_connection = @session_character_set_connection; SET @@session.character_set_client = @session_character_set_client; SET @@session.character_set_results = @session_character_set_results; +DROP TABLE t1; + ############################################################# # End of functionality Testing for character_set_connection # ############################################################# + diff --git a/mysql-test/t/character_set_database_basic.test b/mysql-test/suite/sys_vars/t/character_set_database_basic.test index 9690fb84b5a..08069c00ae0 100644 --- a/mysql-test/t/character_set_database_basic.test +++ b/mysql-test/suite/sys_vars/t/character_set_database_basic.test @@ -121,7 +121,7 @@ SET @@character_set_database = utf8 + latin2; ############################################################################# let charset_variable = @@session.character_set_database; ---source include/charset_basic.inc +--source suite/sys_vars/inc/charset_basic.inc --echo '#--------------------FN_DYNVARS_012_07-------------------------#' @@ -130,7 +130,7 @@ let charset_variable = @@session.character_set_database; ############################################################################## let charset_variable = @@global.character_set_database; ---source include/charset_basic.inc +--source suite/sys_vars/inc/charset_basic.inc --echo '#--------------------FN_DYNVARS_012_08-------------------------#' diff --git a/mysql-test/t/character_set_database_func.test b/mysql-test/suite/sys_vars/t/character_set_database_func.test index b2d2d017d64..88c77ef8c51 100644 --- a/mysql-test/t/character_set_database_func.test +++ b/mysql-test/suite/sys_vars/t/character_set_database_func.test @@ -92,14 +92,14 @@ CREATE TABLE t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; --echo 'Verify with latin'; SET @@session.character_set_database = latin1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data_ln/charset_utf8.txt' INTO TABLE t1; +eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data/charset_utf8.txt' INTO TABLE t1; SELECT count(*) FROM t1 WHERE CHAR_LENGTH(a)>1; TRUNCATE TABLE t1; --echo 'Verify with utf8'; SET @@session.character_set_database = utf8; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data_ln/charset_utf8.txt' INTO TABLE t1; +eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data/charset_utf8.txt' INTO TABLE t1; SELECT count(*) FROM t1 WHERE CHAR_LENGTH(a)>1; --disable_warnings diff --git a/mysql-test/t/character_set_filesystem_basic.test b/mysql-test/suite/sys_vars/t/character_set_filesystem_basic.test index 0117145a06b..3ba9c269a84 100644 --- a/mysql-test/t/character_set_filesystem_basic.test +++ b/mysql-test/suite/sys_vars/t/character_set_filesystem_basic.test @@ -121,7 +121,7 @@ SET @@character_set_filesystem = utf8 + latin2; ############################################################################### let charset_variable = @@session.character_set_filesystem; ---source include/charset_basic.inc +--source suite/sys_vars/inc/charset_basic.inc --echo '#--------------------FN_DYNVARS_008_07-------------------------#' @@ -130,7 +130,7 @@ let charset_variable = @@session.character_set_filesystem; ############################################################################## let charset_variable = @@global.character_set_filesystem; ---source include/charset_basic.inc +--source suite/sys_vars/inc/charset_basic.inc --echo '#--------------------FN_DYNVARS_008_08-------------------------#' diff --git a/mysql-test/t/character_set_filesystem_func-master.opt b/mysql-test/suite/sys_vars/t/character_set_filesystem_func-master.opt index 52a49182a53..52a49182a53 100644 --- a/mysql-test/t/character_set_filesystem_func-master.opt +++ b/mysql-test/suite/sys_vars/t/character_set_filesystem_func-master.opt diff --git a/mysql-test/t/character_set_results_basic.test b/mysql-test/suite/sys_vars/t/character_set_results_basic.test index aae05c824d1..98635c00287 100644 --- a/mysql-test/t/character_set_results_basic.test +++ b/mysql-test/suite/sys_vars/t/character_set_results_basic.test @@ -121,7 +121,7 @@ SET @@character_set_results = utf8 + latin2; ############################################################################## let charset_variable = @@session.character_set_results; ---source include/charset_basic.inc +--source suite/sys_vars/inc/charset_basic.inc --echo '#--------------------FN_DYNVARS_013_07-------------------------#' @@ -130,7 +130,7 @@ let charset_variable = @@session.character_set_results; ############################################################################### let charset_variable = @@global.character_set_results; ---source include/charset_basic.inc +--source suite/sys_vars/inc/charset_basic.inc --echo '#--------------------FN_DYNVARS_013_08-------------------------#' diff --git a/mysql-test/t/character_set_results_func.test b/mysql-test/suite/sys_vars/t/character_set_results_func.test index df7437f225f..df7437f225f 100644 --- a/mysql-test/t/character_set_results_func.test +++ b/mysql-test/suite/sys_vars/t/character_set_results_func.test diff --git a/mysql-test/t/character_set_server_basic.test b/mysql-test/suite/sys_vars/t/character_set_server_basic.test index 2b3c078363a..21eb3fb36dc 100644 --- a/mysql-test/t/character_set_server_basic.test +++ b/mysql-test/suite/sys_vars/t/character_set_server_basic.test @@ -123,7 +123,7 @@ SET @@character_set_server = utf8 + latin2; let charset_variable = @@session.character_set_server; ---source include/charset_basic.inc +--source suite/sys_vars/inc/charset_basic.inc --echo '#--------------------FN_DYNVARS_009_07-------------------------#' @@ -132,7 +132,7 @@ let charset_variable = @@session.character_set_server; ############################################################################### let charset_variable = @@global.character_set_server; ---source include/charset_basic.inc +--source suite/sys_vars/inc/charset_basic.inc --echo '#--------------------FN_DYNVARS_009_08-------------------------#' diff --git a/mysql-test/t/character_set_server_func.test b/mysql-test/suite/sys_vars/t/character_set_server_func.test index c17568c35ea..c17568c35ea 100644 --- a/mysql-test/t/character_set_server_func.test +++ b/mysql-test/suite/sys_vars/t/character_set_server_func.test diff --git a/mysql-test/t/character_set_system_basic.test b/mysql-test/suite/sys_vars/t/character_set_system_basic.test index 9d59b313efc..9d59b313efc 100644 --- a/mysql-test/t/character_set_system_basic.test +++ b/mysql-test/suite/sys_vars/t/character_set_system_basic.test diff --git a/mysql-test/t/collation_connection_basic.test b/mysql-test/suite/sys_vars/t/collation_connection_basic.test index f3544dd306e..bf82ea321b7 100644 --- a/mysql-test/t/collation_connection_basic.test +++ b/mysql-test/suite/sys_vars/t/collation_connection_basic.test @@ -122,7 +122,7 @@ SET @@collation_connection = latin7_general_ci + latin7_general_cs; ############################################################################### let collation_variable = @@session.collation_connection; ---source include/collation_basic.inc +--source suite/sys_vars/inc/collation_basic.inc --echo '#--------------------FN_DYNVARS_015_07-------------------------#' @@ -131,7 +131,7 @@ let collation_variable = @@session.collation_connection; ############################################################################### let collation_variable = @@global.collation_connection; ---source include/collation_basic.inc +--source suite/sys_vars/inc/collation_basic.inc --echo '#--------------------FN_DYNVARS_015_08-------------------------#' diff --git a/mysql-test/t/collation_connection_func.test b/mysql-test/suite/sys_vars/t/collation_connection_func.test index bdb2efd9959..bdb2efd9959 100644 --- a/mysql-test/t/collation_connection_func.test +++ b/mysql-test/suite/sys_vars/t/collation_connection_func.test diff --git a/mysql-test/t/collation_database_basic.test b/mysql-test/suite/sys_vars/t/collation_database_basic.test index c130e276084..557f32b86a0 100644 --- a/mysql-test/t/collation_database_basic.test +++ b/mysql-test/suite/sys_vars/t/collation_database_basic.test @@ -121,7 +121,7 @@ SET @@collation_database = latin7_general_ci + latin7_general_cs; ########################################################################### let collation_variable = @@session.collation_database; ---source include/collation_basic.inc +--source suite/sys_vars/inc/collation_basic.inc --echo '#--------------------FN_DYNVARS_016_07-------------------------#' @@ -130,7 +130,7 @@ let collation_variable = @@session.collation_database; ############################################################################### let collation_variable = @@global.collation_database; ---source include/collation_basic.inc +--source suite/sys_vars/inc/collation_basic.inc --echo '#--------------------FN_DYNVARS_016_08-------------------------#' diff --git a/mysql-test/t/collation_database_func.test b/mysql-test/suite/sys_vars/t/collation_database_func.test index ba8fc5a3d5e..ba8fc5a3d5e 100644 --- a/mysql-test/t/collation_database_func.test +++ b/mysql-test/suite/sys_vars/t/collation_database_func.test diff --git a/mysql-test/t/collation_server_basic.test b/mysql-test/suite/sys_vars/t/collation_server_basic.test index c4b469007e5..a8af13c13ae 100644 --- a/mysql-test/t/collation_server_basic.test +++ b/mysql-test/suite/sys_vars/t/collation_server_basic.test @@ -121,7 +121,7 @@ SET @@collation_server = latin7_general_ci + latin7_general_cs; ############################################################################## let collation_variable = @@session.collation_server; ---source include/collation_basic.inc +--source suite/sys_vars/inc/collation_basic.inc --echo '#--------------------FN_DYNVARS_014_07-------------------------#' @@ -130,7 +130,7 @@ let collation_variable = @@session.collation_server; ############################################################################# let collation_variable = @@global.collation_server; ---source include/collation_basic.inc +--source suite/sys_vars/inc/collation_basic.inc --echo '#--------------------FN_DYNVARS_014_08-------------------------#' diff --git a/mysql-test/t/collation_server_func.test b/mysql-test/suite/sys_vars/t/collation_server_func.test index 045cb5cf720..045cb5cf720 100644 --- a/mysql-test/t/collation_server_func.test +++ b/mysql-test/suite/sys_vars/t/collation_server_func.test diff --git a/mysql-test/t/completion_type_basic.test b/mysql-test/suite/sys_vars/t/completion_type_basic.test index 7ffc1aa593b..7ffc1aa593b 100644 --- a/mysql-test/t/completion_type_basic.test +++ b/mysql-test/suite/sys_vars/t/completion_type_basic.test diff --git a/mysql-test/t/completion_type_func-master.opt b/mysql-test/suite/sys_vars/t/completion_type_func-master.opt index 627becdbfb5..627becdbfb5 100644 --- a/mysql-test/t/completion_type_func-master.opt +++ b/mysql-test/suite/sys_vars/t/completion_type_func-master.opt diff --git a/mysql-test/t/completion_type_func.test b/mysql-test/suite/sys_vars/t/completion_type_func.test index 4f1ebf6700b..ed0f04c37b4 100644 --- a/mysql-test/t/completion_type_func.test +++ b/mysql-test/suite/sys_vars/t/completion_type_func.test @@ -1,4 +1,4 @@ -############## mysql-test\t\completion_type_func.test ######################### +############## mysql-test\t\completion_type_func.test ########################## # # # Variable Name: completion_type # # Scope: GLOBAL & SESSION # @@ -12,7 +12,7 @@ # Author: Salman Rawala # # # # Description: Test Cases of Dynamic System Variable "completion_type" # -# that checks functinality of this variable # +# that checks functionality of this variable # # # # Reference: http://dev.mysql.com/doc/refman/5.1/en/ # # server-system-variables.html#option_mysqld_completion_type # @@ -22,7 +22,7 @@ --source include/have_innodb.inc --disable_warnings -drop table if exists t1; +DROP TABLE IF EXISTS t1; --enable_warnings ######################### @@ -32,62 +32,62 @@ drop table if exists t1; --echo ## Creating new table ## CREATE TABLE t1 ( -id INT NOT NULL auto_increment, +id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (id), -name varchar(30) +name VARCHAR(30) ) ENGINE = INNODB; --echo '#--------------------FN_DYNVARS_017_01-------------------------#' ######################################################### -# Setting initial value of completion_type to zero # +# Setting initial value of completion_type to zero # ######################################################### --echo ## Creating new connection ## connect (test_con1,localhost,root,,); connection test_con1; -INSERT into t1(name) values('Record_1'); +INSERT INTO t1(name) VALUES('Record_1'); SET @@autocommit = 0; -SELECT * from t1; +SELECT * FROM t1; --echo ## Setting value of variable to 0 ## SET @@session.completion_type = 0; --echo ## Here commit & rollback should work normally ## START TRANSACTION; -SELECT * from t1; -INSERT into t1(name) values('Record_2'); -INSERT into t1(name) values('Record_3'); -SELECT * from t1; -DELETE FROM t1 where id = 2; -SELECT * from t1; +SELECT * FROM t1; +INSERT INTO t1(name) VALUES('Record_2'); +INSERT INTO t1(name) VALUES('Record_3'); +SELECT * FROM t1; +DELETE FROM t1 WHERE id = 2; +SELECT * FROM t1; START TRANSACTION; -SELECT * from t1; -INSERT into t1(name) values('Record_4'); -INSERT into t1(name) values('Record_5'); +SELECT * FROM t1; +INSERT INTO t1(name) VALUES('Record_4'); +INSERT INTO t1(name) VALUES('Record_5'); COMMIT; --echo '#--------------------FN_DYNVARS_017_02-------------------------#' ######################################################### -# Setting initial value of completion_type to 2 # +# Setting initial value of completion_type to 2 # ######################################################### SET @@session.completion_type = 2; --echo ## Here commit should work as COMMIT RELEASE ## START TRANSACTION; -SELECT * from t1; -INSERT into t1(name) values('Record_6'); -INSERT into t1(name) values('Record_7'); +SELECT * FROM t1; +INSERT INTO t1(name) VALUES('Record_6'); +INSERT INTO t1(name) VALUES('Record_7'); COMMIT; --echo ## Inserting rows should give error here because connection should ## --echo ## disconnect after using COMMIT ## --Error 2006,2013,1053 -INSERT into t1(name) values('Record_4'); +INSERT INTO t1(name) VALUES('Record_4'); --echo ## Creating new connection test_con2 ## connect (test_con2,localhost,root,,); @@ -96,11 +96,17 @@ SET @@session.completion_type = 2; --echo ## Inserting rows and using Rollback which should Rollback & release ## START TRANSACTION; -SELECT * from t1; -INSERT into t1(name) values('Record_8'); -INSERT into t1(name) values('Record_9'); +SELECT * FROM t1; +INSERT INTO t1(name) VALUES('Record_8'); +INSERT INTO t1(name) VALUES('Record_9'); ROLLBACK; --Error 2006,2013,1053 -INSERT into t1(name) values('Record_4'); +INSERT INTO t1(name) VALUES('Record_4'); + +connection default; +disconnect test_con1; +disconnect test_con2; + +DROP TABLE t1; diff --git a/mysql-test/t/concurrent_insert_basic.test b/mysql-test/suite/sys_vars/t/concurrent_insert_basic.test index bc401ef22a3..bc401ef22a3 100644 --- a/mysql-test/t/concurrent_insert_basic.test +++ b/mysql-test/suite/sys_vars/t/concurrent_insert_basic.test diff --git a/mysql-test/t/concurrent_insert_func.test b/mysql-test/suite/sys_vars/t/concurrent_insert_func.test index e6ea7c4304b..cdeb76d9cac 100644 --- a/mysql-test/t/concurrent_insert_func.test +++ b/mysql-test/suite/sys_vars/t/concurrent_insert_func.test @@ -14,14 +14,15 @@ # Description: Test Cases of Dynamic System Variable "concurrent_insert" # # that checks functionality of this variable # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html#option_mysqld_concurrent_insert # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ################################################################################ +--source include/not_embedded.inc --disable_warnings -drop table if exists t1; +DROP TABLE IF EXISTS t1; --enable_warnings ######################### @@ -31,110 +32,131 @@ drop table if exists t1; --echo ## Creating new table ## CREATE TABLE t1 ( -name varchar(30) +name VARCHAR(30) ); --echo '#--------------------FN_DYNVARS_018_01-------------------------#' #################################################################### -# Setting initial value of concurrent_insert to 1 -# concurrent_insert = 1 means Enables concurrent insert +# Setting initial value of concurrent_insert to 1 +# concurrent_insert = 1 means Enables concurrent insert # for MyISAM tables that don't have holes #################################################################### +SET @start_value= @@global.concurrent_insert; + --echo ## Setting initial value of variable to 1 ## SET @@global.concurrent_insert = 1; -INSERT into t1(name) values('Record_1'); -INSERT into t1(name) values('Record_2'); -INSERT into t1(name) values('Record_3'); +INSERT INTO t1(name) VALUES('Record_1'); +INSERT INTO t1(name) VALUES('Record_2'); +INSERT INTO t1(name) VALUES('Record_3'); --echo ## locking table ## -lock table t1 read local; +LOCK TABLE t1 READ LOCAL; ---echo ## Creating new connection to insert some rows in table ## +--echo ## Creating new connection to insert some rows in table ## connect (test_con1,localhost,root,,); +--echo connection test_con1; connection test_con1; --echo ## New records should come at the end of all rows ## -INSERT into t1(name) values('Record_4'); -SELECT * from t1; +INSERT INTO t1(name) VALUES('Record_4'); +SELECT * FROM t1; --echo ## unlocking tables ## +--echo connection default; connection default; -unlock tables; +UNLOCK TABLES; ---echo ## deleting record to create hole in table ## -DELETE from t1 where name ='Record_2'; +--echo ## deleting record to create hole in table ## +DELETE FROM t1 WHERE name ='Record_2'; --echo '#--------------------FN_DYNVARS_018_02-------------------------#' #################################################################### -# Setting initial value of concurrent_insert to 1 -# concurrent_insert = 1 and trying to insert some values +# Setting initial value of concurrent_insert to 1 +# concurrent_insert = 1 and trying to insert some values # in MyISAM tables that have holes #################################################################### - # lock table and connect with connection1 -#lock table t1 read local; -#connection test_con1; +LOCK TABLE t1 READ LOCAL; +--echo connection test_con1; +connection test_con1; # setting value of concurrent_insert to 1 -#SET @@global.concurrent_insert=1; - -#INSERT into t1(name) values('Record_7'); -#SELECT * from t1; - -#connection default; -#unlock tables; - -#SELECT * from t1; -#INSERT into t1(name) values('Record_6'); - -# On inserting rows in hole while the value of concurrent_insert is 1 -# MySQL server hangs. +SET @@global.concurrent_insert=1; +--echo ## send INSERT which should be blocked until unlock of the table ## +send +INSERT INTO t1(name) VALUES('Record_7'); +--echo connection default; +connection default; +# wait until INSERT will be locked (low performance) +let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST + WHERE state= "Locked" AND info LIKE "INSERT INTO t1%"; +--source include/wait_condition.inc + +--echo ## show processlist info and state ## +SELECT state,info FROM INFORMATION_SCHEMA.PROCESSLIST +WHERE state= "Locked" AND info LIKE "INSERT INTO t1%"; +--echo ## table contents befor UNLOCK ## +SELECT * FROM t1; +UNLOCK TABLES; +--echo ## table contens after UNLOCK ## +SELECT * FROM t1; +INSERT INTO t1(name) VALUES('Record_6'); + +--echo connection test_con1; +connection test_con1; +# to complete the send above^ +reap; +SELECT * FROM t1; +--echo connection default; +connection default; --echo '#--------------------FN_DYNVARS_018_03-------------------------#' -############################################################################### +################################################################################ # Setting value of concurrent_insert to 2 to verify values after inserting # it into table with holes -# concurrent_insert = 2 means Enables concurrent insert +# concurrent_insert = 2 means Enables concurrent insert # for MyISAM tables that have holes but inserts values at the end of all rows -############################################################################### +################################################################################ --echo ## lock table and connect with connection1 ## -lock table t1 read local; +LOCK TABLE t1 READ LOCAL; +--echo connection test_con1; connection test_con1; - --echo ## setting value of concurrent_insert to 2 ## SET @@global.concurrent_insert=2; --echo ## Inserting record in table, record should go at the end of the table ## -INSERT into t1(name) values('Record_5'); -SELECT * from t1; +INSERT INTO t1(name) VALUES('Record_5'); +SELECT * FROM t1; SELECT @@concurrent_insert; ---echo ## Switching to default connection ## +--echo connection default; connection default; --echo ## Unlocking table ## -unlock tables; +UNLOCK TABLES; -SELECT * from t1; +SELECT * FROM t1; --echo ## Inserting new row, this should go in the hole ## -INSERT into t1(name) values('Record_6'); -SELECT * from t1; +INSERT INTO t1(name) VALUES('Record_6'); +SELECT * FROM t1; --echo ## connection test_con1 ## -DELETE from t1 where name ='Record_3'; -SELECT * from t1; +DELETE FROM t1 WHERE name ='Record_3'; +SELECT * FROM t1; --echo ## Dropping table ## -DROP table t1; +DROP TABLE t1; --echo ## Disconnecting connection ## disconnect test_con1; +SET @@global.concurrent_insert= @start_value; + diff --git a/mysql-test/t/connect_timeout_basic.test b/mysql-test/suite/sys_vars/t/connect_timeout_basic.test index 095c85f8295..095c85f8295 100644 --- a/mysql-test/t/connect_timeout_basic.test +++ b/mysql-test/suite/sys_vars/t/connect_timeout_basic.test diff --git a/mysql-test/t/datadir_basic.test b/mysql-test/suite/sys_vars/t/datadir_basic.test index 7fae68fa55e..7fae68fa55e 100644 --- a/mysql-test/t/datadir_basic.test +++ b/mysql-test/suite/sys_vars/t/datadir_basic.test diff --git a/mysql-test/t/default_week_format_basic.test b/mysql-test/suite/sys_vars/t/default_week_format_basic.test index d8b4a09541f..d8b4a09541f 100644 --- a/mysql-test/t/default_week_format_basic.test +++ b/mysql-test/suite/sys_vars/t/default_week_format_basic.test diff --git a/mysql-test/t/default_week_format_func.test b/mysql-test/suite/sys_vars/t/default_week_format_func.test index c80c49b39fb..c80c49b39fb 100644 --- a/mysql-test/t/default_week_format_func.test +++ b/mysql-test/suite/sys_vars/t/default_week_format_func.test diff --git a/mysql-test/t/delay_key_write_basic.test b/mysql-test/suite/sys_vars/t/delay_key_write_basic.test index faa1cb3cc6e..faa1cb3cc6e 100644 --- a/mysql-test/t/delay_key_write_basic.test +++ b/mysql-test/suite/sys_vars/t/delay_key_write_basic.test diff --git a/mysql-test/t/delay_key_write_func-master.opt b/mysql-test/suite/sys_vars/t/delay_key_write_func-master.opt index a449c0fb964..a449c0fb964 100644 --- a/mysql-test/t/delay_key_write_func-master.opt +++ b/mysql-test/suite/sys_vars/t/delay_key_write_func-master.opt diff --git a/mysql-test/t/delay_key_write_func.test b/mysql-test/suite/sys_vars/t/delay_key_write_func.test index 3c0319be427..a44b37653d2 100644 --- a/mysql-test/t/delay_key_write_func.test +++ b/mysql-test/suite/sys_vars/t/delay_key_write_func.test @@ -14,16 +14,17 @@ # Description: Test Cases of Dynamic System Variable delay_key_write # # that checks the behavior of this variable # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ############################################################################### --echo '#--------------------FN_DYNVARS_023_01-------------------------#' ####################################################################### -# Check if setting delay_key_write is changed in every new connection # +# Check if setting delay_key_write is changed in every new connection # ####################################################################### +SET @start_value= @@global.delay_key_write; SET @@global.delay_key_write = ON; SELECT @@global.delay_key_write; @@ -51,11 +52,11 @@ SELECT @@global.delay_key_write AS res_is_ALL; --disable_query_log DELIMITER //; CREATE PROCEDURE sp_addRecords (IN var1 INT,IN var2 INT) -BEGIN - WHILE (var1 < var2) DO - INSERT INTO t1 VALUES(var1,REPEAT('MYSQL',10),100000.0/var1); - SET var1=var1+1; - END WHILE; +BEGIN + WHILE (var1 < var2) DO + INSERT INTO t1 VALUES(var1,REPEAT('MYSQL',10),100000.0/var1); + SET var1=var1+1; + END WHILE; END// DELIMITER ;// --enable_query_log @@ -77,7 +78,7 @@ CREATE TABLE t1( a INT PRIMARY KEY, b VARCHAR(512), c DOUBLE -)delay_key_write = 1; +) DELAY_KEY_WRITE = 1; --enable_query_log @@ -88,7 +89,7 @@ CALL sp_addRecords(1,10); SHOW STATUS LIKE 'Key_reads'; SHOW STATUS LIKE 'Key_writes'; SHOW STATUS LIKE 'Key_write_requests'; -select count(*) from t1; +SELECT COUNT(*) FROM t1; #============================================================================== --echo '----check when delay_key_write is ON---' @@ -105,7 +106,7 @@ CREATE TABLE t1( a INT PRIMARY KEY, b VARCHAR(512), c DOUBLE -)delay_key_write = 1; +) DELAY_KEY_WRITE = 1; --enable_query_log FLUSH STATUS; @@ -114,7 +115,7 @@ CALL sp_addRecords(1,10); SHOW STATUS LIKE 'Key_reads'; SHOW STATUS LIKE 'Key_writes'; SHOW STATUS LIKE 'Key_write_requests'; -select count(*) from t1; +SELECT COUNT(*) FROM t1; #============================================================================== --echo '----check when delay_key_write is ALL---' @@ -130,7 +131,7 @@ CREATE TABLE t1( a INT PRIMARY KEY, b VARCHAR(512), c DOUBLE -)delay_key_write = 0; +) DELAY_KEY_WRITE = 0; --enable_query_log FLUSH STATUS; @@ -139,11 +140,16 @@ CALL sp_addRecords(1,10); SHOW STATUS LIKE 'Key_reads'; SHOW STATUS LIKE 'Key_writes'; SHOW STATUS LIKE 'Key_write_requests'; -select count(*) from t1; +SELECT COUNT(*) FROM t1; DROP PROCEDURE sp_addRecords; DROP TABLE t1; +disconnect user1; + +connection default; +SET @@global.delay_key_write= @start_value; #################################################### # End of functionality testing for delay_key_write # #################################################### + diff --git a/mysql-test/t/delayed_insert_limit_func.test b/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test index 97e1f2daed1..97e1f2daed1 100644 --- a/mysql-test/t/delayed_insert_limit_func.test +++ b/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test diff --git a/mysql-test/t/delayed_insert_timeout_basic.test b/mysql-test/suite/sys_vars/t/delayed_insert_timeout_basic.test index 8bad6b2dfe6..8bad6b2dfe6 100644 --- a/mysql-test/t/delayed_insert_timeout_basic.test +++ b/mysql-test/suite/sys_vars/t/delayed_insert_timeout_basic.test diff --git a/mysql-test/t/div_precision_increment_basic.test b/mysql-test/suite/sys_vars/t/div_precision_increment_basic.test index 40497e829df..40497e829df 100644 --- a/mysql-test/t/div_precision_increment_basic.test +++ b/mysql-test/suite/sys_vars/t/div_precision_increment_basic.test diff --git a/mysql-test/t/div_precision_increment_func.test b/mysql-test/suite/sys_vars/t/div_precision_increment_func.test index aebca88abf9..aebca88abf9 100644 --- a/mysql-test/t/div_precision_increment_func.test +++ b/mysql-test/suite/sys_vars/t/div_precision_increment_func.test diff --git a/mysql-test/t/engine_condition_pushdown_basic.test b/mysql-test/suite/sys_vars/t/engine_condition_pushdown_basic.test index ee781159d6a..ee781159d6a 100644 --- a/mysql-test/t/engine_condition_pushdown_basic.test +++ b/mysql-test/suite/sys_vars/t/engine_condition_pushdown_basic.test diff --git a/mysql-test/t/error_count_basic.test b/mysql-test/suite/sys_vars/t/error_count_basic.test index 14001874c22..14001874c22 100644 --- a/mysql-test/t/error_count_basic.test +++ b/mysql-test/suite/sys_vars/t/error_count_basic.test diff --git a/mysql-test/t/event_scheduler_basic.test b/mysql-test/suite/sys_vars/t/event_scheduler_basic.test index f7045651613..f7045651613 100644 --- a/mysql-test/t/event_scheduler_basic.test +++ b/mysql-test/suite/sys_vars/t/event_scheduler_basic.test diff --git a/mysql-test/t/event_scheduler_func.test b/mysql-test/suite/sys_vars/t/event_scheduler_func.test index f727b2b6833..f727b2b6833 100644 --- a/mysql-test/t/event_scheduler_func.test +++ b/mysql-test/suite/sys_vars/t/event_scheduler_func.test diff --git a/mysql-test/t/expire_logs_days_basic.test b/mysql-test/suite/sys_vars/t/expire_logs_days_basic.test index 02448d1fd11..02448d1fd11 100644 --- a/mysql-test/t/expire_logs_days_basic.test +++ b/mysql-test/suite/sys_vars/t/expire_logs_days_basic.test diff --git a/mysql-test/t/flush_basic.test b/mysql-test/suite/sys_vars/t/flush_basic.test index f5f6665562e..f5f6665562e 100644 --- a/mysql-test/t/flush_basic.test +++ b/mysql-test/suite/sys_vars/t/flush_basic.test diff --git a/mysql-test/t/foreign_key_checks_basic.test b/mysql-test/suite/sys_vars/t/foreign_key_checks_basic.test index 54d94aca971..54d94aca971 100644 --- a/mysql-test/t/foreign_key_checks_basic.test +++ b/mysql-test/suite/sys_vars/t/foreign_key_checks_basic.test diff --git a/mysql-test/t/foreign_key_checks_func.test b/mysql-test/suite/sys_vars/t/foreign_key_checks_func.test index 4d2c63bbce6..4d2c63bbce6 100644 --- a/mysql-test/t/foreign_key_checks_func.test +++ b/mysql-test/suite/sys_vars/t/foreign_key_checks_func.test diff --git a/mysql-test/t/ft_boolean_syntax_basic.test b/mysql-test/suite/sys_vars/t/ft_boolean_syntax_basic.test index 4117605c452..4117605c452 100644 --- a/mysql-test/t/ft_boolean_syntax_basic.test +++ b/mysql-test/suite/sys_vars/t/ft_boolean_syntax_basic.test diff --git a/mysql-test/t/ft_boolean_syntax_func.test b/mysql-test/suite/sys_vars/t/ft_boolean_syntax_func.test index 4ea28b015cb..4ea28b015cb 100644 --- a/mysql-test/t/ft_boolean_syntax_func.test +++ b/mysql-test/suite/sys_vars/t/ft_boolean_syntax_func.test diff --git a/mysql-test/t/general_log_basic.test b/mysql-test/suite/sys_vars/t/general_log_basic.test index 82f3be45bc9..82f3be45bc9 100644 --- a/mysql-test/t/general_log_basic.test +++ b/mysql-test/suite/sys_vars/t/general_log_basic.test diff --git a/mysql-test/t/general_log_file_basic-master.opt b/mysql-test/suite/sys_vars/t/general_log_file_basic-master.opt index 8482f8cbbc3..8482f8cbbc3 100644 --- a/mysql-test/t/general_log_file_basic-master.opt +++ b/mysql-test/suite/sys_vars/t/general_log_file_basic-master.opt diff --git a/mysql-test/t/general_log_file_basic.test b/mysql-test/suite/sys_vars/t/general_log_file_basic.test index 639e6619ef9..014108f88d2 100644 --- a/mysql-test/t/general_log_file_basic.test +++ b/mysql-test/suite/sys_vars/t/general_log_file_basic.test @@ -10,6 +10,7 @@ # # # Creation Date: 2008-03-16 # # Author: Salman Rawala # +# Modified: HHunger 2008-09-11 Set system variable back to the start value # # # # Description: Test Cases of Dynamic System Variable "general_log_file" # # that checks behavior of this variable in the following ways # @@ -18,8 +19,8 @@ # * Scope & Access method # # * Data Integrity # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html#option_mysqld_general_log_file # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ################################################################################ @@ -67,7 +68,9 @@ SELECT @@global.general_log_file = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='general_log_file'; +SET @@global.general_log_file= @start_value; ##################################################### # END OF general_log_file TESTS # ##################################################### + diff --git a/mysql-test/t/general_log_file_func-master.opt b/mysql-test/suite/sys_vars/t/general_log_file_func-master.opt index 3652d715f5f..3652d715f5f 100644 --- a/mysql-test/t/general_log_file_func-master.opt +++ b/mysql-test/suite/sys_vars/t/general_log_file_func-master.opt diff --git a/mysql-test/t/general_log_file_func.test b/mysql-test/suite/sys_vars/t/general_log_file_func.test index eeea3f75d26..1a73a4a5eaa 100644 --- a/mysql-test/t/general_log_file_func.test +++ b/mysql-test/suite/sys_vars/t/general_log_file_func.test @@ -21,7 +21,7 @@ --disable_warnings -drop table if exists t1; +DROP TABLE IF EXISTS t1; --enable_warnings ######################### @@ -31,7 +31,7 @@ drop table if exists t1; --echo ## Creating new table ## CREATE TABLE t1 ( -id INT NOT NULL auto_increment, +id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (id), name VARCHAR(30) ); @@ -40,18 +40,17 @@ name VARCHAR(30) #################################################################### # Verifying general log as we have initialized in opt file # #################################################################### - - SELECT @@general_log_file; -INSERT into t1(name) values('Record_1'); -INSERT into t1(name) values('Record_2'); -INSERT into t1(name) values('Record_3'); -INSERT into t1(name) values('Record_4'); +INSERT INTO t1(name) VALUES('Record_1'); +INSERT INTO t1(name) VALUES('Record_2'); +INSERT INTO t1(name) VALUES('Record_3'); +INSERT INTO t1(name) VALUES('Record_4'); --echo ## Verifying general log file ## ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---file_exists $MYSQLTEST_VARDIR/master-data/mysql-test.log +let $MYSQLD_DATADIR= `select @@datadir`; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--file_exists $MYSQLD_DATADIR/mysql-test.log --echo ## Dropping table ## DROP TABLE t1; diff --git a/mysql-test/t/general_log_func.test b/mysql-test/suite/sys_vars/t/general_log_func.test index 39ce964a105..24d535e88e5 100644 --- a/mysql-test/t/general_log_func.test +++ b/mysql-test/suite/sys_vars/t/general_log_func.test @@ -46,17 +46,17 @@ name VARCHAR(30) SET @@global.general_log = OFF; SELECT @@general_log; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---copy_file $MYSQLTEST_VARDIR/log/master.log $MYSQLTEST_VARDIR/log/master-test.log + +let $MYSQLD_LOGFILE= `select @@global.general_log_file`; +--copy_file $MYSQLD_LOGFILE $MYSQLD_LOGFILE.copy --echo ## Inserting some Records & Verifying output in log ## INSERT into t1(name) values('Record_1'); INSERT into t1(name) values('Record_2'); --echo ## There should be no difference, case should pass ## ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---diff_files $MYSQLTEST_VARDIR/log/master.log $MYSQLTEST_VARDIR/log/master-test.log - +--diff_files $MYSQLD_LOGFILE $MYSQLD_LOGFILE.copy +--remove_file $MYSQLD_LOGFILE.copy --echo '#--------------------FN_DYNVARS_018_01-------------------------#' #################################################################### @@ -68,19 +68,25 @@ INSERT into t1(name) values('Record_2'); SET @@global.general_log = ON; SELECT @@general_log; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---copy_file $MYSQLTEST_VARDIR/log/master.log $MYSQLTEST_VARDIR/log/master-test-1.log +--copy_file $MYSQLD_LOGFILE $MYSQLD_LOGFILE.copy +--chmod 0777 $MYSQLD_LOGFILE.copy --echo ## Inserting some Records & Verifying output in log ## INSERT into t1(name) values('Record_3'); INSERT into t1(name) values('Record_4'); - ---echo ## There should be no difference, case should pass ## -#--diff_files var/log/master.log var/log/master-test-1.log - ---echo ## This case is failing which shows that mysql is writing in general ## ---echo ## log when we set general_log to ON ## +--copy_file $MYSQLD_LOGFILE $MYSQLD_LOGFILE.orig +--chmod 0777 $MYSQLD_LOGFILE.orig + +--echo ## There should be a difference ## +SET @@global.max_allowed_packet= 1024*1024*1024; +--replace_result $MYSQLD_LOGFILE MYSQLD_LOGFILE +eval SET @orig_file= load_file('$MYSQLD_LOGFILE.orig'); +--replace_result $MYSQLD_LOGFILE MYSQLD_LOGFILE +eval SET @copy_file= load_file('$MYSQLD_LOGFILE.copy'); +eval SELECT STRCMP(@orig_file, @copy_file); +--remove_file $MYSQLD_LOGFILE.copy +--remove_file $MYSQLD_LOGFILE.orig --echo ## Dropping tables ## DROP TABLE t1; diff --git a/mysql-test/t/group_concat_max_len_basic.test b/mysql-test/suite/sys_vars/t/group_concat_max_len_basic.test index 1bc707f4b5d..1bc707f4b5d 100644 --- a/mysql-test/t/group_concat_max_len_basic.test +++ b/mysql-test/suite/sys_vars/t/group_concat_max_len_basic.test diff --git a/mysql-test/t/group_concat_max_len_func.test b/mysql-test/suite/sys_vars/t/group_concat_max_len_func.test index 29a4ff5becb..29a4ff5becb 100644 --- a/mysql-test/t/group_concat_max_len_func.test +++ b/mysql-test/suite/sys_vars/t/group_concat_max_len_func.test diff --git a/mysql-test/t/have_compress_basic.test b/mysql-test/suite/sys_vars/t/have_compress_basic.test index f704ae67a1c..f704ae67a1c 100644 --- a/mysql-test/t/have_compress_basic.test +++ b/mysql-test/suite/sys_vars/t/have_compress_basic.test diff --git a/mysql-test/t/have_crypt_basic.test b/mysql-test/suite/sys_vars/t/have_crypt_basic.test index 7ca193d83bd..7ca193d83bd 100644 --- a/mysql-test/t/have_crypt_basic.test +++ b/mysql-test/suite/sys_vars/t/have_crypt_basic.test diff --git a/mysql-test/t/have_csv_basic.test b/mysql-test/suite/sys_vars/t/have_csv_basic.test index 12081ff270e..12081ff270e 100644 --- a/mysql-test/t/have_csv_basic.test +++ b/mysql-test/suite/sys_vars/t/have_csv_basic.test diff --git a/mysql-test/t/have_dynamic_loading_basic.test b/mysql-test/suite/sys_vars/t/have_dynamic_loading_basic.test index 3e13664752a..3e13664752a 100644 --- a/mysql-test/t/have_dynamic_loading_basic.test +++ b/mysql-test/suite/sys_vars/t/have_dynamic_loading_basic.test diff --git a/mysql-test/t/have_geometry_basic.test b/mysql-test/suite/sys_vars/t/have_geometry_basic.test index 3ec0690bd16..3ec0690bd16 100644 --- a/mysql-test/t/have_geometry_basic.test +++ b/mysql-test/suite/sys_vars/t/have_geometry_basic.test diff --git a/mysql-test/t/have_innodb_basic.test b/mysql-test/suite/sys_vars/t/have_innodb_basic.test index 9ae1bb0d443..9ae1bb0d443 100644 --- a/mysql-test/t/have_innodb_basic.test +++ b/mysql-test/suite/sys_vars/t/have_innodb_basic.test diff --git a/mysql-test/t/have_ndbcluster_basic.test b/mysql-test/suite/sys_vars/t/have_ndbcluster_basic.test index 1ac341ff62e..1ac341ff62e 100644 --- a/mysql-test/t/have_ndbcluster_basic.test +++ b/mysql-test/suite/sys_vars/t/have_ndbcluster_basic.test diff --git a/mysql-test/t/have_openssl_basic.test b/mysql-test/suite/sys_vars/t/have_openssl_basic.test index 037c8f4cbe6..037c8f4cbe6 100644 --- a/mysql-test/t/have_openssl_basic.test +++ b/mysql-test/suite/sys_vars/t/have_openssl_basic.test diff --git a/mysql-test/t/have_partitioning_basic.test b/mysql-test/suite/sys_vars/t/have_partitioning_basic.test index b37abdb1498..b37abdb1498 100644 --- a/mysql-test/t/have_partitioning_basic.test +++ b/mysql-test/suite/sys_vars/t/have_partitioning_basic.test diff --git a/mysql-test/t/have_query_cache_basic.test b/mysql-test/suite/sys_vars/t/have_query_cache_basic.test index 1c32300dec9..1c32300dec9 100644 --- a/mysql-test/t/have_query_cache_basic.test +++ b/mysql-test/suite/sys_vars/t/have_query_cache_basic.test diff --git a/mysql-test/t/have_rtree_keys_basic.test b/mysql-test/suite/sys_vars/t/have_rtree_keys_basic.test index 493c45530a6..493c45530a6 100644 --- a/mysql-test/t/have_rtree_keys_basic.test +++ b/mysql-test/suite/sys_vars/t/have_rtree_keys_basic.test diff --git a/mysql-test/t/have_ssl_basic.test b/mysql-test/suite/sys_vars/t/have_ssl_basic.test index c92219d2252..c92219d2252 100644 --- a/mysql-test/t/have_ssl_basic.test +++ b/mysql-test/suite/sys_vars/t/have_ssl_basic.test diff --git a/mysql-test/t/have_symlink_basic.test b/mysql-test/suite/sys_vars/t/have_symlink_basic.test index 924da7c7a9f..924da7c7a9f 100644 --- a/mysql-test/t/have_symlink_basic.test +++ b/mysql-test/suite/sys_vars/t/have_symlink_basic.test diff --git a/mysql-test/t/hostname_basic.test b/mysql-test/suite/sys_vars/t/hostname_basic.test index 9f1dff756e2..9f1dff756e2 100644 --- a/mysql-test/t/hostname_basic.test +++ b/mysql-test/suite/sys_vars/t/hostname_basic.test diff --git a/mysql-test/t/identity_basic.test b/mysql-test/suite/sys_vars/t/identity_basic.test index fa5fc807414..fa5fc807414 100644 --- a/mysql-test/t/identity_basic.test +++ b/mysql-test/suite/sys_vars/t/identity_basic.test diff --git a/mysql-test/t/identity_func-master.opt b/mysql-test/suite/sys_vars/t/identity_func-master.opt index 66f581b56d0..66f581b56d0 100644 --- a/mysql-test/t/identity_func-master.opt +++ b/mysql-test/suite/sys_vars/t/identity_func-master.opt diff --git a/mysql-test/t/identity_func.test b/mysql-test/suite/sys_vars/t/identity_func.test index ff93607a2cd..ff93607a2cd 100644 --- a/mysql-test/t/identity_func.test +++ b/mysql-test/suite/sys_vars/t/identity_func.test diff --git a/mysql-test/t/init_connect_basic.test b/mysql-test/suite/sys_vars/t/init_connect_basic.test index 8557dfbf4fc..8557dfbf4fc 100644 --- a/mysql-test/t/init_connect_basic.test +++ b/mysql-test/suite/sys_vars/t/init_connect_basic.test diff --git a/mysql-test/t/init_slave_basic.test b/mysql-test/suite/sys_vars/t/init_slave_basic.test index b137a525090..b137a525090 100644 --- a/mysql-test/t/init_slave_basic.test +++ b/mysql-test/suite/sys_vars/t/init_slave_basic.test diff --git a/mysql-test/t/innodb_additional_mem_pool_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_additional_mem_pool_size_basic.test index ffb1046ed32..ffb1046ed32 100644 --- a/mysql-test/t/innodb_additional_mem_pool_size_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_additional_mem_pool_size_basic.test diff --git a/mysql-test/t/innodb_autoextend_increment_basic.test b/mysql-test/suite/sys_vars/t/innodb_autoextend_increment_basic.test index 86f8c7aa7a4..eb208e7197f 100644 --- a/mysql-test/t/innodb_autoextend_increment_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_autoextend_increment_basic.test @@ -1,99 +1,87 @@ -################# mysql-test\t\innodb_autoextend_increment _basic.test ################### -# # -# Variable Name: innodb_autoextend_increment # -# Scope: GLOBAL # -# Access Type: Dynamic # -# Data Type: Numeric # -# Default Value: 8 # -# Range: 0,1 # -# # -# # -# Creation Date: 2008-02-07 # -# Author: Rizwan # -# # -#Description:Test Cases of Dynamic System Variable innodb_autoextend_increment# -# that checks the behavior of this variable in the following ways # -# * Default Value # -# * Valid & Invalid values # -# * Scope & Access method # -# * Data Integrity # -# # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # -# # -############################################################################### +################# mysql-test\t\innodb_autoextend_increment _basic.test ########### +# # +# Variable Name: innodb_autoextend_increment # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 8 # +# Range: 0,1 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: # +# Test Cases of Dynamic System Variable innodb_autoextend_increment that # +# checks the behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +################################################################################## --source include/have_innodb.inc --source include/load_sysvars.inc -######################################################################## +######################################################################## # START OF innodb_autoextend_increment TESTS # -######################################################################## +######################################################################## -################################################################################ -# Saving initial value of innodb_autoextend_increment in a temporary variable# -################################################################################ +############################################################################### +# Saving initial value of innodb_autoextend_increment in a temporary variable # +############################################################################### SET @global_start_value = @@global.innodb_autoextend_increment ; -SELECT @global_start_value; - - --echo '#--------------------FN_DYNVARS_046_01------------------------#' -######################################################################## +######################################################################## # Display the DEFAULT value of innodb_autoextend_increment # -######################################################################## - - +######################################################################## SET @@global.innodb_autoextend_increment = 0; SET @@global.innodb_autoextend_increment = DEFAULT; SELECT @@global.innodb_autoextend_increment ; --echo '#---------------------FN_DYNVARS_046_02-------------------------#' -#################################################################################### +#################################################################################### # Check if innodb_autoextend_increment can be accessed with and without @@ sign # -#################################################################################### +#################################################################################### --Error ER_GLOBAL_VARIABLE SET innodb_autoextend_increment = 1; SELECT @@innodb_autoextend_increment ; - --Error ER_UNKNOWN_TABLE SELECT local.innodb_autoextend_increment ; - SET global innodb_autoextend_increment = 0; SELECT @@global.innodb_autoextend_increment ; --echo '#--------------------FN_DYNVARS_046_03------------------------#' -########################################################################## -# change the value of innodb_autoextend_increment to a valid value # -########################################################################## - - +########################################################################## +# change the value of innodb_autoextend_increment to a valid value # +########################################################################## SET @@global.innodb_autoextend_increment = 1; SELECT @@global.innodb_autoextend_increment ; SET @@global.innodb_autoextend_increment = 1000; SELECT @@global.innodb_autoextend_increment ; ---echo '#--------------------FN_DYNVARS_046_04-------------------------#' -########################################################################### -# Change the value of innodb_autoextend_increment to invalid value # -########################################################################### - - +--echo '#--------------------FN_DYNVARS_046_04-------------------------#' +########################################################################### +# Change the value of innodb_autoextend_increment to invalid value # +########################################################################### SET @@global.innodb_autoextend_increment = -1; SELECT @@global.innodb_autoextend_increment; - --Error ER_WRONG_TYPE_FOR_VAR SET @@global.innodb_autoextend_increment = "T"; SELECT @@global.innodb_autoextend_increment; @@ -102,31 +90,28 @@ SELECT @@global.innodb_autoextend_increment; SET @@global.innodb_autoextend_increment = "Y"; SELECT @@global.innodb_autoextend_increment; - SET @@global.innodb_autoextend_increment = 1001; SELECT @@global.innodb_autoextend_increment; - - --echo '#----------------------FN_DYNVARS_046_05------------------------#' -######################################################################### +######################################################################### # Check if the value in GLOBAL Table matches value in variable # ######################################################################### -SELECT @@global.innodb_autoextend_increment = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +SELECT @@global.innodb_autoextend_increment = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_autoextend_increment '; SELECT @@global.innodb_autoextend_increment ; -SELECT VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_autoextend_increment '; --echo '#---------------------FN_DYNVARS_046_06-------------------------#' -################################################################### +################################################################### # Check if ON and OFF values can be used on variable # -################################################################### +################################################################### --ERROR ER_WRONG_TYPE_FOR_VAR SET @@global.innodb_autoextend_increment = OFF; @@ -136,25 +121,25 @@ SELECT @@global.innodb_autoextend_increment ; SET @@global.innodb_autoextend_increment = ON; SELECT @@global.innodb_autoextend_increment ; + --echo '#---------------------FN_DYNVARS_046_07----------------------#' -################################################################### +################################################################### # Check if TRUE and FALSE values can be used on variable # -################################################################### - +################################################################### SET @@global.innodb_autoextend_increment = TRUE; SELECT @@global.innodb_autoextend_increment ; SET @@global.innodb_autoextend_increment = FALSE; SELECT @@global.innodb_autoextend_increment ; -############################## + +############################## # Restore initial value # ############################## +SET @@global.innodb_autoextend_increment = @global_start_value; -#SET @@global.innodb_autoextend_increment = @global_start_value; -#SELECT @@global.innodb_autoextend_increment ; - ############################################################### -# END OF innodb_autoextend_increment TESTS # -############################################################### +# END OF innodb_autoextend_increment TESTS # +############################################################### + diff --git a/mysql-test/t/innodb_autoinc_lock_mode_basic.test b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_basic.test index 5b6fa943bbe..5b6fa943bbe 100644 --- a/mysql-test/t/innodb_autoinc_lock_mode_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_basic.test diff --git a/mysql-test/t/innodb_autoinc_lock_mode_func-master.opt b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func-master.opt index ab9fcb75678..ab9fcb75678 100644 --- a/mysql-test/t/innodb_autoinc_lock_mode_func-master.opt +++ b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func-master.opt diff --git a/mysql-test/t/innodb_autoinc_lock_mode_func.test b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test index 1ff7868ce87..89c1c80a6dc 100644 --- a/mysql-test/t/innodb_autoinc_lock_mode_func.test +++ b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test @@ -11,11 +11,12 @@ # Creation Date: 2008-03-08 # # Author: Rizwan Maredia # # # -#Description:Test Cases of Dynamic System Variable innodb_autoextend_increment# -# that checks the behavior of this variable # +# Description: # +# Test Cases of Dynamic System Variable innodb_autoextend_increment that # +# checks the behavior of this variable # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ############################################################################### @@ -43,12 +44,14 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1( a INT AUTO_INCREMENT PRIMARY KEY, b CHAR -)ENGINE=INNODB, AUTO_INCREMENT=100; +) ENGINE=INNODB, AUTO_INCREMENT=100; INSERT INTO t1 (a,b) VALUES (5,'a'), (NULL,'b'), (1,'c'), (NULL,'d'); INSERT INTO t1 (a,b) VALUES (NULL,'e'); --echo 'the new auto incremented value should be 104' -SELECT * from t1; +SELECT * FROM t1; + +DROP TABLE t1; ############################################################### # End of functionality Testing for innodb_autoinc_lock_mode # diff --git a/mysql-test/t/innodb_buffer_pool_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test index 190b2d19bc4..190b2d19bc4 100644 --- a/mysql-test/t/innodb_buffer_pool_size_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test diff --git a/mysql-test/t/innodb_checksums_basic.test b/mysql-test/suite/sys_vars/t/innodb_checksums_basic.test index 89daad9ce0a..89daad9ce0a 100644 --- a/mysql-test/t/innodb_checksums_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_checksums_basic.test diff --git a/mysql-test/t/innodb_commit_concurrency_basic.test b/mysql-test/suite/sys_vars/t/innodb_commit_concurrency_basic.test index 1ef69e34999..1ef69e34999 100644 --- a/mysql-test/t/innodb_commit_concurrency_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_commit_concurrency_basic.test diff --git a/mysql-test/t/innodb_data_file_path_basic.test b/mysql-test/suite/sys_vars/t/innodb_data_file_path_basic.test index 1d88c47b1bb..1d88c47b1bb 100644 --- a/mysql-test/t/innodb_data_file_path_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_data_file_path_basic.test diff --git a/mysql-test/t/innodb_data_home_dir_basic.test b/mysql-test/suite/sys_vars/t/innodb_data_home_dir_basic.test index f3b02edf83b..f3b02edf83b 100644 --- a/mysql-test/t/innodb_data_home_dir_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_data_home_dir_basic.test diff --git a/mysql-test/t/innodb_doublewrite_basic.test b/mysql-test/suite/sys_vars/t/innodb_doublewrite_basic.test index 4a0460bb4bc..4a0460bb4bc 100644 --- a/mysql-test/t/innodb_doublewrite_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_doublewrite_basic.test diff --git a/mysql-test/t/innodb_fast_shutdown_basic.test b/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test index 5e108708716..7de63332844 100644 --- a/mysql-test/t/innodb_fast_shutdown_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test @@ -9,54 +9,51 @@ # # # # # Creation Date: 2008-02-20 # -# Author: Sharique Abdullah # +# Author: Sharique Abdullah # # # -# Description: Test Cases of Dynamic System Variable innodb_fast_shutdown # -# that checks the behavior of this variable in the following ways# +# Description: # +# Test Cases of Dynamic System Variable innodb_fast_shutdown that checks # +# the behavior of this variable in the following ways # # * Default Value # # * Valid & Invalid values # # * Scope & Access method # # * Data Integrity # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ############################################################################### --source include/have_innodb.inc --source include/load_sysvars.inc -######################################################################## +######################################################################## # START OF innodb_fast_shutdown TESTS # -######################################################################## +######################################################################## -############################################################################## +############################################################################## # Saving initial value of innodb_fast_shutdown in a temporary variable # -############################################################################## - - +############################################################################## SET @global_start_value = @@global.innodb_fast_shutdown; SELECT @@global.innodb_fast_shutdown; - + --echo '#--------------------FN_DYNVARS_042_01------------------------#' -######################################################################## +######################################################################## # Display the DEFAULT value of innodb_fast_shutdown # -######################################################################## +######################################################################## SET @@global.innodb_fast_shutdown = 0; SET @@global.innodb_fast_shutdown = DEFAULT; SELECT @@global.innodb_fast_shutdown; - --echo '#---------------------FN_DYNVARS_042_02-------------------------#' -############################################################################# +############################################################################# # Check if innodb_fast_shutdown can be accessed with and without @@ sign # -############################################################################# - +############################################################################# --ERROR ER_GLOBAL_VARIABLE SET innodb_fast_shutdown = 1; @@ -70,25 +67,26 @@ SELECT @@global.innodb_fast_shutdown; --echo '#--------------------FN_DYNVARS_042_03------------------------#' -######################################################################## -# Change the value of innodb_fast_shutdown to a valid value # -######################################################################## +########################################################################## +# Change the value of innodb_fast_shutdown to a valid value # +########################################################################## SET @@global.innodb_fast_shutdown = 0; SELECT @@global.innodb_fast_shutdown; SET @@global.innodb_fast_shutdown = 1; SELECT @@global.innodb_fast_shutdown; -## a value of 2 is used to just flush logs and then shutdown cold. Not supported on Netware +## A value of 2 is used to just flush logs and then shutdown cold. +## Not supported on Netware SET @@global.innodb_fast_shutdown = 2; SELECT @@global.innodb_fast_shutdown; + --echo '#--------------------FN_DYNVARS_042_04-------------------------#' -########################################################################### +########################################################################### # Change the value of innodb_fast_shutdown to invalid value # -########################################################################### - +########################################################################### SET @@global.innodb_fast_shutdown = -1; SELECT @@global.innodb_fast_shutdown; @@ -121,11 +119,10 @@ SET @@global.innodb_fast_shutdown = "0"; SELECT @@global.innodb_fast_shutdown; - --echo '#-------------------FN_DYNVARS_042_05----------------------------#' -########################################################################### +########################################################################### # Test if accessing session innodb_fast_shutdown gives error # -########################################################################### +########################################################################### --Error ER_GLOBAL_VARIABLE SET @@session.innodb_fast_shutdown = 0; @@ -136,32 +133,30 @@ SET @@innodb_fast_shutdown = 0; SET @@local.innodb_fast_shutdown = 0; - --echo '#----------------------FN_DYNVARS_042_06------------------------#' -######################################################################### +######################################################################### # Check if the value in SESSION Table contains variable value # ######################################################################### -SELECT count(VARIABLE_VALUE) AS res_is_0 -FROM INFORMATION_SCHEMA.SESSION_VARIABLES +SELECT count(VARIABLE_VALUE) AS res_is_0 +FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fast_shutdown'; --echo '#----------------------FN_DYNVARS_042_07------------------------#' -######################################################################### -# Check if the value in GLOBAL Table matches value in variable # +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # ######################################################################### SELECT @@global.innodb_fast_shutdown = -VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_fast_shutdown'; --echo '#---------------------FN_DYNVARS_042_08-------------------------#' -################################################################### +################################################################### # Check if ON and OFF values can be used on variable # -################################################################### - +################################################################### --Error ER_WRONG_TYPE_FOR_VAR SET @@global.innodb_fast_shutdown = OFF; @@ -171,23 +166,25 @@ SELECT @@global.innodb_fast_shutdown; SET @@global.innodb_fast_shutdown = ON; SELECT @@global.innodb_fast_shutdown; + --echo '#---------------------FN_DYNVARS_042_09----------------------#' -################################################################### +################################################################### # Check if TRUE and FALSE values can be used on variable # -################################################################### +################################################################### SET @@global.innodb_fast_shutdown = TRUE; SELECT @@global.innodb_fast_shutdown; SET @@global.innodb_fast_shutdown = FALSE; SELECT @@global.innodb_fast_shutdown; -############################## + +############################## # Restore initial value # ############################## -#SET @@innodb_fast_shutdown = @global_start_value; -#SELECT @@innodb_fast_shutdown; +SET @@global.innodb_fast_shutdown = @global_start_value; +SELECT @@global.innodb_fast_shutdown; -######################################################################## +######################################################################## # END OF innodb_fast_shutdown TESTS # -######################################################################## +######################################################################## diff --git a/mysql-test/t/innodb_file_io_threads_basic.test b/mysql-test/suite/sys_vars/t/innodb_file_io_threads_basic.test index 8e09c75ded6..8e09c75ded6 100644 --- a/mysql-test/t/innodb_file_io_threads_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_file_io_threads_basic.test diff --git a/mysql-test/t/innodb_file_per_table_basic.test b/mysql-test/suite/sys_vars/t/innodb_file_per_table_basic.test index bc0e34c484e..bc0e34c484e 100644 --- a/mysql-test/t/innodb_file_per_table_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_file_per_table_basic.test diff --git a/mysql-test/t/innodb_flush_log_at_trx_commit_basic.test b/mysql-test/suite/sys_vars/t/innodb_flush_log_at_trx_commit_basic.test index 90da929d199..90da929d199 100644 --- a/mysql-test/t/innodb_flush_log_at_trx_commit_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_flush_log_at_trx_commit_basic.test diff --git a/mysql-test/t/innodb_flush_method_basic.test b/mysql-test/suite/sys_vars/t/innodb_flush_method_basic.test index 531df4a2464..531df4a2464 100644 --- a/mysql-test/t/innodb_flush_method_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_flush_method_basic.test diff --git a/mysql-test/t/innodb_force_recovery_basic.test b/mysql-test/suite/sys_vars/t/innodb_force_recovery_basic.test index f5aa769f09f..f5aa769f09f 100644 --- a/mysql-test/t/innodb_force_recovery_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_force_recovery_basic.test diff --git a/mysql-test/t/innodb_lock_wait_timeout_basic.test b/mysql-test/suite/sys_vars/t/innodb_lock_wait_timeout_basic.test index ed31fc9eb6b..ed31fc9eb6b 100644 --- a/mysql-test/t/innodb_lock_wait_timeout_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_lock_wait_timeout_basic.test diff --git a/mysql-test/t/innodb_locks_unsafe_for_binlog_basic.test b/mysql-test/suite/sys_vars/t/innodb_locks_unsafe_for_binlog_basic.test index 63835113770..63835113770 100644 --- a/mysql-test/t/innodb_locks_unsafe_for_binlog_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_locks_unsafe_for_binlog_basic.test diff --git a/mysql-test/t/innodb_log_buffer_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_log_buffer_size_basic.test index 74c1aeab87a..74c1aeab87a 100644 --- a/mysql-test/t/innodb_log_buffer_size_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_log_buffer_size_basic.test diff --git a/mysql-test/t/innodb_log_file_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_log_file_size_basic.test index 08925b73957..08925b73957 100644 --- a/mysql-test/t/innodb_log_file_size_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_log_file_size_basic.test diff --git a/mysql-test/t/innodb_log_files_in_group_basic.test b/mysql-test/suite/sys_vars/t/innodb_log_files_in_group_basic.test index 67978efe76a..67978efe76a 100644 --- a/mysql-test/t/innodb_log_files_in_group_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_log_files_in_group_basic.test diff --git a/mysql-test/t/innodb_log_group_home_dir_basic.test b/mysql-test/suite/sys_vars/t/innodb_log_group_home_dir_basic.test index 7e3969c6bd7..7e3969c6bd7 100644 --- a/mysql-test/t/innodb_log_group_home_dir_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_log_group_home_dir_basic.test diff --git a/mysql-test/t/innodb_max_dirty_pages_pct_basic.test b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_basic.test index 830617866ca..830617866ca 100644 --- a/mysql-test/t/innodb_max_dirty_pages_pct_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_basic.test diff --git a/mysql-test/t/innodb_max_dirty_pages_pct_func.test b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test index 5d7b9754843..52ebc2f4c49 100644 --- a/mysql-test/t/innodb_max_dirty_pages_pct_func.test +++ b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test @@ -11,31 +11,31 @@ # Creation Date: 2008-03-08 # # Author: Rizwan # # # -#Description: Test Cases of Dynamic System Variable innodb_max_dirty_pages_pct# -# that checks the behavior of this variable # +# Description: # +# Test cases of Dynamic System Variable innodb_max_dirty_pages_pct that # +# checks the behavior of this variable # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ############################################################################### --source include/have_innodb.inc + +SET @start_value= @@global.innodb_max_dirty_pages_pct; + --echo '#--------------------FN_DYNVARS_044_02-------------------------#' -########################################################################### -# Check if setting innodb_max_dirty_pages_pct is changed in new connection# -########################################################################### +############################################################################ +# Check if setting innodb_max_dirty_pages_pct is changed in new connection # +############################################################################ SET @@global.innodb_max_dirty_pages_pct = 80; --echo 'connect (con1,localhost,root,,,,)' connect (con1,localhost,root,,,,); ---echo 'connection con1' -connection con1; SELECT @@global.innodb_max_dirty_pages_pct; SET @@global.innodb_max_dirty_pages_pct = 70; --echo 'connect (con2,localhost,root,,,,)' connect (con2,localhost,root,,,,); ---echo 'connection con2' -connection con2; SELECT @@global.innodb_max_dirty_pages_pct; disconnect con2; disconnect con1; @@ -58,6 +58,11 @@ DROP FUNCTION IF EXISTS dirty_pct; DROP TABLE IF EXISTS t1; --enable_warnings +CREATE TABLE t1( +a INT AUTO_INCREMENT PRIMARY KEY, +b CHAR(200) +)ENGINE=INNODB; + DELIMITER //; CREATE PROCEDURE add_records(IN NUM INT) BEGIN @@ -74,21 +79,21 @@ BEGIN DECLARE res DECIMAL(20,17); DECLARE a1,b1 VARCHAR(256); DECLARE a2,b2 VARCHAR(256); - DECLARE dirty CURSOR FOR SELECT * FROM information_schema.global_status + DECLARE dirty CURSOR FOR SELECT * FROM information_schema.global_status WHERE variable_name LIKE 'Innodb_buffer_pool_pages_dirty' - UNION SELECT * FROM information_schema.session_status + UNION SELECT * FROM information_schema.session_status WHERE variable_name LIKE 'Innodb_buffer_pool_pages_dirty'; DECLARE total CURSOR FOR SELECT * FROM information_schema.global_status WHERE variable_name LIKE 'Innodb_buffer_pool_pages_total' UNION SELECT * FROM information_schema.session_status WHERE variable_name LIKE 'Innodb_buffer_pool_pages_total'; - + OPEN dirty; OPEN total; FETCH dirty INTO a1, b1; FETCH total INTO a2, b2; - + SET res = ( CONVERT(b1,DECIMAL)*100)/CONVERT(b2,DECIMAL); CLOSE dirty; @@ -102,7 +107,7 @@ BEGIN SET pct = dirty_pct(); SET last = 0; - WHILE (pct<NUM and pct<100) DO + WHILE (pct>NUM and pct<100) DO CALL add_records(500); SET pct = dirty_pct(); IF (pct<last) THEN @@ -124,11 +129,6 @@ END// DELIMITER ;// -CREATE TABLE t1( -a INT AUTO_INCREMENT PRIMARY KEY, -b CHAR(200) -)ENGINE=INNODB; - --enable_query_log #========================================================== @@ -139,24 +139,28 @@ SET @@global.innodb_max_dirty_pages_pct = 10; FLUSH STATUS; -# add rows until dirty pages pct is less than this value +# Add rows until dirty pages pct is less than this value CALL add_until(10); -# give server some time to flush dirty pages +# Give the server some time to flush dirty pages FLUSH TABLES; CALL add_records(500); ---echo '--sleep 5' ---sleep 5 + +# Execute dirty_pct (wait) until dirty pages < 10% +# Use polling to execute dirty_pct ina loop +let $wait_condition= SELECT dirty_pct() < 10; +--source include/wait_condition.inc --echo 'We expect dirty pages pct to be BELOW_MAX' CALL check_pct(10); -#SHOW STATUS LIKE 'innodb%'; - DROP PROCEDURE add_records; DROP PROCEDURE add_until; DROP PROCEDURE check_pct; DROP FUNCTION dirty_pct; +DROP TABLE t1; + +SET @@global.innodb_max_dirty_pages_pct= @start_value; ################################################################## # End of functionality Testing for innodb_max_dirty_pages_pct # diff --git a/mysql-test/t/innodb_mirrored_log_groups_basic.test b/mysql-test/suite/sys_vars/t/innodb_mirrored_log_groups_basic.test index 6edb07ac39f..6edb07ac39f 100644 --- a/mysql-test/t/innodb_mirrored_log_groups_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_mirrored_log_groups_basic.test diff --git a/mysql-test/t/innodb_open_files_basic.test b/mysql-test/suite/sys_vars/t/innodb_open_files_basic.test index c55b7e55937..c55b7e55937 100644 --- a/mysql-test/t/innodb_open_files_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_open_files_basic.test diff --git a/mysql-test/t/innodb_rollback_on_timeout_basic.test b/mysql-test/suite/sys_vars/t/innodb_rollback_on_timeout_basic.test index c33e0fa1b75..c33e0fa1b75 100644 --- a/mysql-test/t/innodb_rollback_on_timeout_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_rollback_on_timeout_basic.test diff --git a/mysql-test/t/innodb_support_xa_basic.test b/mysql-test/suite/sys_vars/t/innodb_support_xa_basic.test index 6da3e68ebdf..6da3e68ebdf 100644 --- a/mysql-test/t/innodb_support_xa_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_support_xa_basic.test diff --git a/mysql-test/t/innodb_support_xa_func.test b/mysql-test/suite/sys_vars/t/innodb_support_xa_func.test index f1b6fe84fe1..f1b6fe84fe1 100644 --- a/mysql-test/t/innodb_support_xa_func.test +++ b/mysql-test/suite/sys_vars/t/innodb_support_xa_func.test diff --git a/mysql-test/t/innodb_table_locks_basic.test b/mysql-test/suite/sys_vars/t/innodb_table_locks_basic.test index 35961c43a7f..35961c43a7f 100644 --- a/mysql-test/t/innodb_table_locks_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_table_locks_basic.test diff --git a/mysql-test/t/innodb_table_locks_func.test b/mysql-test/suite/sys_vars/t/innodb_table_locks_func.test index d233a2a5240..6638a20c926 100644 --- a/mysql-test/t/innodb_table_locks_func.test +++ b/mysql-test/suite/sys_vars/t/innodb_table_locks_func.test @@ -14,8 +14,8 @@ # Description: Test Cases of Dynamic System Variable innodb_table_locks # # that checks the behavior of this variable # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ############################################################################### @@ -24,9 +24,12 @@ --echo '#--------------------FN_DYNVARS_048_01-------------------------#' #################################################################### -# Check if setting innodb_table_locks is changed in new connection # +# Check if setting innodb_table_locks is changed in new connection # #################################################################### +SET @start_value= @@global.innodb_table_locks; +SELECT @start_value; + SET @@global.innodb_table_locks = OFF; --echo 'connect (con1,localhost,root,,,,)' connect (con1,localhost,root,,,,); @@ -80,6 +83,9 @@ UNLOCK tables; DROP TABLE t1; disconnect con2; +connection default; +SET @@global.innodb_table_locks= @start_value; +SELECT @@global.innodb_table_locks; ########################################################## # End of functionality Testing for innodb_table_locks # diff --git a/mysql-test/t/innodb_thread_concurrency_basic.test b/mysql-test/suite/sys_vars/t/innodb_thread_concurrency_basic.test index 40ce09ce4db..40ce09ce4db 100644 --- a/mysql-test/t/innodb_thread_concurrency_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_thread_concurrency_basic.test diff --git a/mysql-test/t/insert_id_basic.test b/mysql-test/suite/sys_vars/t/insert_id_basic.test index cfae87095bc..cfae87095bc 100644 --- a/mysql-test/t/insert_id_basic.test +++ b/mysql-test/suite/sys_vars/t/insert_id_basic.test diff --git a/mysql-test/t/insert_id_func.test b/mysql-test/suite/sys_vars/t/insert_id_func.test index d7103f806bd..d7103f806bd 100644 --- a/mysql-test/t/insert_id_func.test +++ b/mysql-test/suite/sys_vars/t/insert_id_func.test diff --git a/mysql-test/t/interactive_timeout_basic.test b/mysql-test/suite/sys_vars/t/interactive_timeout_basic.test index 0c1a6716348..0c1a6716348 100644 --- a/mysql-test/t/interactive_timeout_basic.test +++ b/mysql-test/suite/sys_vars/t/interactive_timeout_basic.test diff --git a/mysql-test/t/interactive_timeout_func.test b/mysql-test/suite/sys_vars/t/interactive_timeout_func.test index e3a210bf508..e3a210bf508 100644 --- a/mysql-test/t/interactive_timeout_func.test +++ b/mysql-test/suite/sys_vars/t/interactive_timeout_func.test diff --git a/mysql-test/t/keep_files_on_create_basic.test b/mysql-test/suite/sys_vars/t/keep_files_on_create_basic.test index a855f56c863..a855f56c863 100644 --- a/mysql-test/t/keep_files_on_create_basic.test +++ b/mysql-test/suite/sys_vars/t/keep_files_on_create_basic.test diff --git a/mysql-test/t/key_buffer_size_func.test b/mysql-test/suite/sys_vars/t/key_buffer_size_func.test index 05c591678dc..8ee305a3ac1 100644 --- a/mysql-test/t/key_buffer_size_func.test +++ b/mysql-test/suite/sys_vars/t/key_buffer_size_func.test @@ -14,13 +14,13 @@ # Description: Test Cases of Dynamic System Variable key_buffer_size # # that checks the functionality of this variable # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ############################################################################### --disable_warnings -drop table if exists t1; +DROP TABLE IF EXISTS t1; --enable_warnings ######################### @@ -30,12 +30,14 @@ drop table if exists t1; --echo ## Creating new table t1 ## CREATE TABLE t1 ( -id INT NOT NULL auto_increment, +id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (id), -rollno int NOT NULL, +rollno INT NOT NULL, name VARCHAR(30) ); +SET @start_value= @@global.key_buffer_size; + FLUSH STATUS; --echo '#--------------------FN_DYNVARS_055_01-------------------------#' @@ -64,37 +66,60 @@ SELECT @@global.key_buffer_size; --echo ## Inserting some rows in table ## -INSERT into t1(rollno, name) values(1, 'Record_1'); -INSERT into t1(rollno, name) values(2, 'Record_2'); -INSERT into t1(rollno, name) values(1, 'Record_3'); -INSERT into t1(rollno, name) values(3, 'Record_4'); -INSERT into t1(rollno, name) values(1, 'Record_5'); -INSERT into t1(rollno, name) values(3, 'Record_6'); -INSERT into t1(rollno, name) values(4, 'Record_7'); -INSERT into t1(rollno, name) values(4, 'Record_8'); -INSERT into t1(rollno, name) values(4, 'Record_9'); -INSERT into t1(rollno, name) values(4, 'Record_10'); - ---echo ## Verifying status of reading & writing variables ## -# Disabled due to differences in results -#show status like 'Key%'; +INSERT INTO t1(rollno, name) VALUES(1, 'Record_1'); +INSERT INTO t1(rollno, name) VALUES(2, 'Record_2'); +INSERT INTO t1(rollno, name) VALUES(1, 'Record_3'); +INSERT INTO t1(rollno, name) VALUES(3, 'Record_4'); +INSERT INTO t1(rollno, name) VALUES(1, 'Record_5'); +INSERT INTO t1(rollno, name) VALUES(3, 'Record_6'); +INSERT INTO t1(rollno, name) VALUES(4, 'Record_7'); +INSERT INTO t1(rollno, name) VALUES(4, 'Record_8'); +INSERT INTO t1(rollno, name) VALUES(4, 'Record_9'); +INSERT INTO t1(rollno, name) VALUES(4, 'Record_10'); + +--echo ## Key_reads must be zero (no disk access) ## +show status like 'Key_reads'; --echo ## Switching to connection test_con2 ## connection test_con2; ---echo ## Verifying status of reading & writing variables ## -# Disabled due to differences in results -#show status like 'Key%'; +--echo ## Key_reads must be zero (no disk access) ## +show status like 'Key_reads'; + +CONNECTION default; +--disable_warnings +SET @@global.key_buffer_size = 36; +--enable_warnings + +--echo ## Connecting with connection test_con1 ## +CONNECTION test_con1; + +--echo ## Inserting some rows in table ## +INSERT INTO t1(rollno, name) VALUES(5, 'Record_11'); +INSERT INTO t1(rollno, name) VALUES(6, 'Record_12'); +INSERT INTO t1(rollno, name) VALUES(5, 'Record_13'); +INSERT INTO t1(rollno, name) VALUES(7, 'Record_14'); +INSERT INTO t1(rollno, name) VALUES(5, 'Record_15'); +INSERT INTO t1(rollno, name) VALUES(7, 'Record_16'); +INSERT INTO t1(rollno, name) VALUES(8, 'Record_17'); +INSERT INTO t1(rollno, name) VALUES(8, 'Record_18'); +INSERT INTO t1(rollno, name) VALUES(8, 'Record_19'); +INSERT INTO t1(rollno, name) VALUES(8, 'Record_20'); + +--echo ## Key_reads must be zero (no disk access) ## +show status like 'Key_reads'; ############################################################ # Disconnecting all connection & dropping table # ############################################################ --echo ## Dropping table ## -DROP table if exists t1; +DROP TABLE IF EXISTS t1; --echo ## Disconnecting both the connections ## DISCONNECT test_con2; DISCONNECT test_con1; +connection default; +SET @@global.key_buffer_size= @start_value; diff --git a/mysql-test/t/last_insert_id_func-master.opt b/mysql-test/suite/sys_vars/t/last_insert_id_func-master.opt index 66f581b56d0..66f581b56d0 100644 --- a/mysql-test/t/last_insert_id_func-master.opt +++ b/mysql-test/suite/sys_vars/t/last_insert_id_func-master.opt diff --git a/mysql-test/t/last_insert_id_func.test b/mysql-test/suite/sys_vars/t/last_insert_id_func.test index 2309c539bd9..2309c539bd9 100644 --- a/mysql-test/t/last_insert_id_func.test +++ b/mysql-test/suite/sys_vars/t/last_insert_id_func.test diff --git a/mysql-test/t/lc_time_names_basic.test b/mysql-test/suite/sys_vars/t/lc_time_names_basic.test index d0aa0c56937..d0aa0c56937 100644 --- a/mysql-test/t/lc_time_names_basic.test +++ b/mysql-test/suite/sys_vars/t/lc_time_names_basic.test diff --git a/mysql-test/t/lc_time_names_func.test b/mysql-test/suite/sys_vars/t/lc_time_names_func.test index 2c86a597773..2c86a597773 100644 --- a/mysql-test/t/lc_time_names_func.test +++ b/mysql-test/suite/sys_vars/t/lc_time_names_func.test diff --git a/mysql-test/t/license_basic.test b/mysql-test/suite/sys_vars/t/license_basic.test index e0c761dc5a5..e0c761dc5a5 100644 --- a/mysql-test/t/license_basic.test +++ b/mysql-test/suite/sys_vars/t/license_basic.test diff --git a/mysql-test/t/local_infile_basic.test b/mysql-test/suite/sys_vars/t/local_infile_basic.test index 63f6b0fdb91..63f6b0fdb91 100644 --- a/mysql-test/t/local_infile_basic.test +++ b/mysql-test/suite/sys_vars/t/local_infile_basic.test diff --git a/mysql-test/t/local_infile_func.test b/mysql-test/suite/sys_vars/t/local_infile_func.test index 166149ad9aa..00013f779a7 100644 --- a/mysql-test/t/local_infile_func.test +++ b/mysql-test/suite/sys_vars/t/local_infile_func.test @@ -64,7 +64,7 @@ create table t1(a int); --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval LOAD DATA LOCAL INFILE -'$MYSQLTEST_VARDIR/std_data_ln/numbers.txt' INTO TABLE test.t1; +'$MYSQLTEST_VARDIR/std_data/numbers.txt' INTO TABLE test.t1; SELECT count(*) from t1; @@ -81,7 +81,7 @@ create table t1(a int); --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --Error ER_NOT_ALLOWED_COMMAND eval LOAD DATA LOCAL INFILE -'$MYSQLTEST_VARDIR/std_data_ln/numbers.txt' INTO TABLE test.t1; +'$MYSQLTEST_VARDIR/std_data/numbers.txt' INTO TABLE test.t1; SELECT count(*) from t1; diff --git a/mysql-test/t/log_basic.test b/mysql-test/suite/sys_vars/t/log_basic.test index b9a64f8981b..98e99fa4e4f 100644 --- a/mysql-test/t/log_basic.test +++ b/mysql-test/suite/sys_vars/t/log_basic.test @@ -1,6 +1,6 @@ ###################### mysql-test\t\log_basic.test ############################ # # -# Variable Name: log_basic # +# Variable Name: log_basic # # Scope: GLOBAL # # Access Type: Dynamic # # Data Type: string # @@ -11,15 +11,16 @@ # Creation Date: 2008-02-07 # # Author: Rizwan # # # -# Description: Test Cases of Dynamic System Variable log # -# that checks the behavior of this variable in the following ways# +# Description: # +# Test Cases of Dynamic System Variable log that checks the behavior of # +# this variable in the following ways # # * Default Value # # * Valid & Invalid values # # * Scope & Access method # # * Data Integrity # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ############################################################################### @@ -34,6 +35,8 @@ # Accessing variable # ############################################################# +SET @start_log= @@global.log; + SELECT @@global.log AS INIT_VALUE; SELECT @@log AS INIT_VALUE; @@ -47,14 +50,17 @@ SET global general_log = 0; --echo '#--------------------FN_DYNVARS_062_02-------------------------#' -################################################################################### -# Check if the value in GLOBAL Table matches value in variable # -################################################################################### +################################################################################ +# Check if the value in GLOBAL Table matches value in variable # +################################################################################ # We can only access log value from information schema global_variables table -SELECT VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='log'; +SET @@global.log= @start_log; + ############################################ # END OF log TESTS # ############################################ + diff --git a/mysql-test/t/log_bin_trust_function_creators_basic.test b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_basic.test index 3b8b43e1354..3b8b43e1354 100644 --- a/mysql-test/t/log_bin_trust_function_creators_basic.test +++ b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_basic.test diff --git a/mysql-test/t/log_bin_trust_function_creators_func.test b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_func.test index db91128b225..0168114b11b 100644 --- a/mysql-test/t/log_bin_trust_function_creators_func.test +++ b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_func.test @@ -20,6 +20,8 @@ # # ############################################################################### +source include/have_log_bin.inc; + --disable_warnings drop table if exists t1; --enable_warnings @@ -30,36 +32,59 @@ drop table if exists t1; # Setting initial value of variable to 0 and verifying whether user # is allowed to create function or not. ######################################################################## +SET @start_value= @@global.log_bin_trust_function_creators; --echo ## Creating new user tt ## -CREATE user tt@localhost; +CREATE USER tt@localhost; --echo ## Setting value of variable to 0 ## SET @@global.log_bin_trust_function_creators = 0; --echo ## Creating new table t2 ## -create table t2 (a INT); +CREATE TABLE t2 (a INT); --echo ## Creating & connecting with new connection test_con1 ## connect (test_con1,localhost,tt,,); connection test_con1; SELECT @@log_bin_trust_function_creators; -SELECT @@sql_log_bin; ---echo ## Creating new function f1 ## +--echo ## Creating new function f1 fails because no DETERMINISTIC ### delimiter |; +--error ER_BINLOG_UNSAFE_ROUTINE CREATE FUNCTION f1(a INT) RETURNS INT BEGIN - IF (a < 3) THEN + IF (a < 3) THEN + INSERT INTO t2 VALUES (a); + END IF; + RETURN 1; +END| +delimiter ;| + +--echo ## Creating new function f1 fails because non-super user ## +delimiter |; +--error ER_BINLOG_CREATE_ROUTINE_NEED_SUPER +CREATE FUNCTION f1(a INT) RETURNS INT DETERMINISTIC +BEGIN + IF (a < 3) THEN INSERT INTO t2 VALUES (a); END IF; RETURN 1; END| delimiter ;| ---echo 'Bug: Create Function should give error here because non-super user'; ---echo 'is creating function here'; +connection default; + +--echo ## Creating new function f1 succeeds ## +delimiter |; +CREATE FUNCTION f1(a INT) RETURNS INT DETERMINISTIC +BEGIN + IF (a < 3) THEN + INSERT INTO t2 VALUES (a); + END IF; + RETURN 1; +END| +delimiter ;| --echo ## Creating new table t1 ## CREATE TABLE t1 (a INT); @@ -69,8 +94,8 @@ INSERT INTO t1 VALUES (1),(2),(3); SELECT f1(a) FROM t1; --echo ## Dropping function f1 & table t1 ## -drop function f1; -drop table t1; +DROP FUNCTION f1; +DROP TABLE t1; --echo '#--------------------FN_DYNVARS_063_02-------------------------#' ######################################################################## @@ -96,7 +121,7 @@ SELECT @@sql_log_bin; delimiter |; CREATE FUNCTION f1(a INT) RETURNS INT BEGIN - IF (a < 3) THEN + IF (a < 3) THEN INSERT INTO t2 VALUES (a); END IF; RETURN 1; @@ -111,11 +136,16 @@ INSERT INTO t1 VALUES (1),(2),(3); SELECT f1(a) FROM t1; --echo ## Dropping function f1 ## -drop function f1; +DROP FUNCTION f1; --echo ## Dropping table t1 & t2 ## -drop table t1,t2; +DROP TABLE t1,t2; ---echo ## Disconnecting both the connections ## +--echo ## Disconnecting test_con2## disconnect test_con2; +connection default; + +DROP USER tt@localhost; +SET @@global.log_bin_trust_function_creators= @start_value; + diff --git a/mysql-test/t/log_bin_trust_routine_creators_basic.test b/mysql-test/suite/sys_vars/t/log_bin_trust_routine_creators_basic.test index 1d44c77b1a7..1d44c77b1a7 100644 --- a/mysql-test/t/log_bin_trust_routine_creators_basic.test +++ b/mysql-test/suite/sys_vars/t/log_bin_trust_routine_creators_basic.test diff --git a/mysql-test/t/log_output_basic.test b/mysql-test/suite/sys_vars/t/log_output_basic.test index 45998e85480..45998e85480 100644 --- a/mysql-test/t/log_output_basic.test +++ b/mysql-test/suite/sys_vars/t/log_output_basic.test diff --git a/mysql-test/t/log_output_func.test b/mysql-test/suite/sys_vars/t/log_output_func.test index 007c4f38659..007c4f38659 100644 --- a/mysql-test/t/log_output_func.test +++ b/mysql-test/suite/sys_vars/t/log_output_func.test diff --git a/mysql-test/suite/sys_vars/t/log_queries_not_using_indexes_basic.test b/mysql-test/suite/sys_vars/t/log_queries_not_using_indexes_basic.test new file mode 100644 index 00000000000..f1152c07176 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/log_queries_not_using_indexes_basic.test @@ -0,0 +1,132 @@ +################## mysql-test\t\log_queries_not_using_indexes_basic.test ###### +# # +# Variable Name: log_queries_not_using_indexes # +# Scope: Global # +# Access Type: Static # +# Data Type: # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# Description:Test Cases of Dynamic System Variable # +# log_queries_not_using_indexes # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + +SET @start_value= @@global.log_queries_not_using_indexes; + +#################################################################### +# Valid values for boolean # +#################################################################### +SET @@global.log_queries_not_using_indexes= DEFAULT; +SELECT @@global.log_queries_not_using_indexes; + +SET @@global.log_queries_not_using_indexes= TRUE; +SELECT @@global.log_queries_not_using_indexes; + +SET @@global.log_queries_not_using_indexes= true; +SELECT @@global.log_queries_not_using_indexes; + +SET @@global.log_queries_not_using_indexes= 0; +SELECT @@global.log_queries_not_using_indexes; + +SET @@global.log_queries_not_using_indexes= 1; +SELECT @@global.log_queries_not_using_indexes; + +SET @goodvar= TRUE; +SET @@global.log_queries_not_using_indexes= @goodvar; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= DEFAULT; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= ON; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= OFF; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= -0; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= 0.00; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= -0.0; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= 001.00; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= +1.0; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= +0; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= +0.000000; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= 0000.00000; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= .0; +SELECT @@global.log_queries_not_using_indexes; + +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_queries_not_using_indexes= 'DEFAULT'; + +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_queries_not_using_indexes= 'true'; + +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_queries_not_using_indexes= BLABLA; + +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_queries_not_using_indexes= 25; + +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_queries_not_using_indexes= 12.34; + +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL log_queries_not_using_indexes= -1; + +SET @badvar= 'true'; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_queries_not_using_indexes= @badvar; + +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL log_queries_not_using_indexes= 'DEFAULT'; + +--error ER_GLOBAL_VARIABLE +SET log_queries_not_using_indexes= TRUE; + +--error ER_GLOBAL_VARIABLE +SET SESSION log_queries_not_using_indexes= TRUE; + +--error ER_GLOBAL_VARIABLE +SET @@session.log_queries_not_using_indexes= TRUE; + +--error ER_GLOBAL_VARIABLE +SET LOCAL log_queries_not_using_indexes= TRUE; + +--error ER_PARSE_ERROR +SET @@global log_queries_not_using_indexes= TRUE; + +--error ER_PARSE_ERROR +SET @@SESSION log_queries_not_using_indexes= TRUE; + + +SET @@global.log_queries_not_using_indexes= @start_value; + diff --git a/mysql-test/t/long_query_time_basic.test b/mysql-test/suite/sys_vars/t/long_query_time_basic.test index c21e0a751c1..c21e0a751c1 100644 --- a/mysql-test/t/long_query_time_basic.test +++ b/mysql-test/suite/sys_vars/t/long_query_time_basic.test diff --git a/mysql-test/t/low_priority_updates_basic.test b/mysql-test/suite/sys_vars/t/low_priority_updates_basic.test index 0ce4ee8f921..0ce4ee8f921 100644 --- a/mysql-test/t/low_priority_updates_basic.test +++ b/mysql-test/suite/sys_vars/t/low_priority_updates_basic.test diff --git a/mysql-test/t/max_allowed_packet_basic.test b/mysql-test/suite/sys_vars/t/max_allowed_packet_basic.test index 8be0e5f670e..8be0e5f670e 100644 --- a/mysql-test/t/max_allowed_packet_basic.test +++ b/mysql-test/suite/sys_vars/t/max_allowed_packet_basic.test diff --git a/mysql-test/t/max_allowed_packet_func.test b/mysql-test/suite/sys_vars/t/max_allowed_packet_func.test index 8437d480a37..0cfbeb4de5f 100644 --- a/mysql-test/t/max_allowed_packet_func.test +++ b/mysql-test/suite/sys_vars/t/max_allowed_packet_func.test @@ -14,16 +14,16 @@ # Description: Test Cases of Dynamic System Variable max_allowed_packet # # that checks the functionality of this variable # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ############################################################################### #due to lost connection on win64 --source include/not_windows.inc -let $start_global_value = `SELECT @@global.max_allowed_packet`; ---echo $start_global_value +SET @start_max_allowed_packet= @@global.max_allowed_packet; +SET @start_value= @@global.net_buffer_length; --disable_warnings drop table if exists t1; @@ -60,10 +60,10 @@ SELECT @@session.net_buffer_length; --echo '#--------------------FN_DYNVARS_070_02-------------------------#' ############################################################################### # Setting value of max_allowed_packet to 1024 at global level and -# verifying its behavior after inserting data greater than 1024 bytes +# verifying its behavior after inserting data greater than 1024 bytes ############################################################################### ---echo ## Setting value of max_allowed packet and net_buffer_length to 1024 ## +--echo ## Setting value of max_allowed packet and net_buffer_length to 1024 ## SET @@global.max_allowed_packet = 1024; SET @@global.net_buffer_length = 1024; SELECT @@global.max_allowed_packet; @@ -73,16 +73,13 @@ SELECT @@global.net_buffer_length; connect (test_con1,localhost,root,,); connection test_con1; ---echo ## Inserting and fetching data of length greater than 1024 ## +--echo ## Inserting and fetching data of length greater than 1024 ## --Error 0,ER_NET_PACKET_TOO_LARGE INSERT into t1(name) values("aaassssssssddddddddffffffgggggggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk"); disconnect test_con1; connection default; drop table t1; -eval SET @@global.max_allowed_packet = $start_global_value; - ---echo ## Server disconnects after this case and error occurs that Server ## ---echo ## has gone away ## - +SET @@global.max_allowed_packet= @start_max_allowed_packet; +SET @@global.net_buffer_length= @start_value; diff --git a/mysql-test/t/max_binlog_cache_size_func-master.opt b/mysql-test/suite/sys_vars/t/max_binlog_cache_size_func-master.opt index 6e00d7157d6..6e00d7157d6 100644 --- a/mysql-test/t/max_binlog_cache_size_func-master.opt +++ b/mysql-test/suite/sys_vars/t/max_binlog_cache_size_func-master.opt diff --git a/mysql-test/t/max_binlog_size_basic.test b/mysql-test/suite/sys_vars/t/max_binlog_size_basic.test index 11d01b5c10f..11d01b5c10f 100644 --- a/mysql-test/t/max_binlog_size_basic.test +++ b/mysql-test/suite/sys_vars/t/max_binlog_size_basic.test diff --git a/mysql-test/t/max_connections_basic.test b/mysql-test/suite/sys_vars/t/max_connections_basic.test index ffc964db28f..ffc964db28f 100644 --- a/mysql-test/t/max_connections_basic.test +++ b/mysql-test/suite/sys_vars/t/max_connections_basic.test diff --git a/mysql-test/t/max_delayed_threads_basic.test b/mysql-test/suite/sys_vars/t/max_delayed_threads_basic.test index dc908c8396b..dc908c8396b 100644 --- a/mysql-test/t/max_delayed_threads_basic.test +++ b/mysql-test/suite/sys_vars/t/max_delayed_threads_basic.test diff --git a/mysql-test/t/max_error_count_basic.test b/mysql-test/suite/sys_vars/t/max_error_count_basic.test index 2b1e12843cf..2b1e12843cf 100644 --- a/mysql-test/t/max_error_count_basic.test +++ b/mysql-test/suite/sys_vars/t/max_error_count_basic.test diff --git a/mysql-test/t/max_insert_delayed_threads_basic.test b/mysql-test/suite/sys_vars/t/max_insert_delayed_threads_basic.test index d165ddc11fe..d165ddc11fe 100644 --- a/mysql-test/t/max_insert_delayed_threads_basic.test +++ b/mysql-test/suite/sys_vars/t/max_insert_delayed_threads_basic.test diff --git a/mysql-test/t/max_join_size_func.test b/mysql-test/suite/sys_vars/t/max_join_size_func.test index 0ea0d77bcd6..0ea0d77bcd6 100644 --- a/mysql-test/t/max_join_size_func.test +++ b/mysql-test/suite/sys_vars/t/max_join_size_func.test diff --git a/mysql-test/t/max_length_for_sort_data_basic.test b/mysql-test/suite/sys_vars/t/max_length_for_sort_data_basic.test index 682e14146d7..682e14146d7 100644 --- a/mysql-test/t/max_length_for_sort_data_basic.test +++ b/mysql-test/suite/sys_vars/t/max_length_for_sort_data_basic.test diff --git a/mysql-test/t/max_prepared_stmt_count_basic.test b/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_basic.test index 2206a388abb..2206a388abb 100644 --- a/mysql-test/t/max_prepared_stmt_count_basic.test +++ b/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_basic.test diff --git a/mysql-test/t/max_prepared_stmt_count_func.test b/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_func.test index 6617c4ad2ea..6617c4ad2ea 100644 --- a/mysql-test/t/max_prepared_stmt_count_func.test +++ b/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_func.test diff --git a/mysql-test/t/max_relay_log_size_basic.test b/mysql-test/suite/sys_vars/t/max_relay_log_size_basic.test index b780aa2b444..b780aa2b444 100644 --- a/mysql-test/t/max_relay_log_size_basic.test +++ b/mysql-test/suite/sys_vars/t/max_relay_log_size_basic.test diff --git a/mysql-test/t/max_seeks_for_key_func.test b/mysql-test/suite/sys_vars/t/max_seeks_for_key_func.test index cdabd43328f..d49382b9f4f 100644 --- a/mysql-test/t/max_seeks_for_key_func.test +++ b/mysql-test/suite/sys_vars/t/max_seeks_for_key_func.test @@ -1,11 +1,7 @@ - - - -#Test for max_seeks_for_key# - +# Test for max_seeks_for_key # --disable_warnings -drop table if exists t1; +DROP TABLE IF EXISTS t1; --enable_warnings @@ -14,11 +10,11 @@ drop table if exists t1; ######################### CREATE TABLE t1 -(a int auto_increment primary key, -b char(20) +(a INT AUTO_INCREMENT PRIMARY KEY, +b CHAR(20) ); - +SET @start_value= @@global.max_seeks_for_key; --echo '#--------------------FN_DYNVARS_084_01-------------------------#' ########################################################## @@ -35,15 +31,15 @@ SELECT @@session.max_seeks_for_key = 10; # Setting global value of variable and inserting data in table SET @@global.max_seeks_for_key = 20; SELECT @@global.max_seeks_for_key; -INSERT into t1(b) values("AREc"); -explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; +INSERT INTO t1(b) VALUES("AREc"); +EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; # Setting session value of variable and inserting data in table SET @@session.max_seeks_for_key = 2; SELECT @@session.max_seeks_for_key; -INSERT into t1(b) values("BREc"); -INSERT into t1(b) values("CRec"); -explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; +INSERT INTO t1(b) VALUES("BREc"); +INSERT INTO t1(b) VALUES("CRec"); +EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; --echo '#--------------------FN_DYNVARS_084_02-------------------------#' @@ -63,31 +59,26 @@ SELECT @@session.max_seeks_for_key = 10; # Setting global value of variable and inserting data in table SET @@global.max_seeks_for_key = 20; SELECT @@global.max_seeks_for_key; -INSERT into t1(b) values("AREc"); -explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; +INSERT INTO t1(b) VALUES("AREc"); +EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; # Setting session value of variable and inserting data in table SET @@session.max_seeks_for_key = 2; SELECT @@session.max_seeks_for_key; -INSERT into t1(b) values("BREc"); -INSERT into t1(b) values("CRec"); -explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; - +INSERT INTO t1(b) VALUES("BREc"); +INSERT INTO t1(b) VALUES("CRec"); +EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; - - - - -##################################################### +###################################################### # Inserting values in table t and analyzing table # -##################################################### +###################################################### -INSERT INTO t1 values(null,"test"); +INSERT INTO t1 VALUES(null,"test"); INSERT INTO t1 VALUES (null,"a"),(null,"a"),(null,"a"), (null,"a"),(null,"a"),(null,"a"),(null,"a"), (null,"a"),(null,"a"),(null,"a"); -explain SELECT STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; -analyze table t1; +EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; +ANALYZE TABLE t1; ################################################################### # Setting new value for max_seeks_for_key and anaylyzing table # @@ -96,9 +87,14 @@ analyze table t1; SET MAX_SEEKS_FOR_KEY=1; -explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; +EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; SET MAX_SEEKS_FOR_KEY=DEFAULT; -drop table t1; +connection default; +disconnect test_con1; +disconnect test_con2; + +DROP TABLE t1; +SET @@global.max_seeks_for_key= @start_value; diff --git a/mysql-test/t/max_sort_length_basic.test b/mysql-test/suite/sys_vars/t/max_sort_length_basic.test index 1198d7b1851..1198d7b1851 100644 --- a/mysql-test/t/max_sort_length_basic.test +++ b/mysql-test/suite/sys_vars/t/max_sort_length_basic.test diff --git a/mysql-test/t/max_sort_length_func.test b/mysql-test/suite/sys_vars/t/max_sort_length_func.test index e3197653f0d..74642a10861 100644 --- a/mysql-test/t/max_sort_length_func.test +++ b/mysql-test/suite/sys_vars/t/max_sort_length_func.test @@ -9,14 +9,14 @@ # # # # # Creation Date: 2008-03-02 # -# Author: Sharique Abdullah # +# Author: Sharique Abdullah # # # -# Description: Test Cases of Dynamic System Variable max_prepared_stmt_count_fn# +# Description: Test Cases of Dynamic System Variable max_sort_length # # that checks behavior of this variable in the following ways # # * Functionality based on different values # # # -#Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html# -# option_mysqld_max_sort_length # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ################################################################################ @@ -24,6 +24,8 @@ # Setup # +SET @start_value= @@global.max_sort_length; + SET @session_max_sort_length = @@Session.max_sort_length; @@ -186,7 +188,7 @@ SELECT c from t ORDER BY c, id; #Check if sorting is applied on BLOB type # ########################################### --echo Testing type BLOB -## Setting global value of variable and inserting data in table +# Setting global value of variable and inserting data in table SET @@global.max_sort_length = 30; SELECT @@global.max_sort_length; INSERT INTO t1 set c = repeat('x',29); @@ -211,7 +213,7 @@ SELECT c from t1 ORDER BY c, id; #Check if sorting is applied on CHAR type # ########################################### --echo Testing type CHAR -## Setting global value of variable and inserting data in table +# Setting global value of variable and inserting data in table SET @@global.max_sort_length = 30; SELECT @@global.max_sort_length; INSERT INTO t2 set c = repeat('x',29); @@ -251,3 +253,5 @@ DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; --enable_warnings +SET @@global.max_sort_length= @start_value; + diff --git a/mysql-test/t/max_sp_recursion_depth_basic.test b/mysql-test/suite/sys_vars/t/max_sp_recursion_depth_basic.test index 8089951c8a2..8089951c8a2 100644 --- a/mysql-test/t/max_sp_recursion_depth_basic.test +++ b/mysql-test/suite/sys_vars/t/max_sp_recursion_depth_basic.test diff --git a/mysql-test/t/max_sp_recursion_depth_func.test b/mysql-test/suite/sys_vars/t/max_sp_recursion_depth_func.test index ab43536457b..ab43536457b 100644 --- a/mysql-test/t/max_sp_recursion_depth_func.test +++ b/mysql-test/suite/sys_vars/t/max_sp_recursion_depth_func.test diff --git a/mysql-test/t/max_user_connections_basic.test b/mysql-test/suite/sys_vars/t/max_user_connections_basic.test index eb231bd8076..eb231bd8076 100644 --- a/mysql-test/t/max_user_connections_basic.test +++ b/mysql-test/suite/sys_vars/t/max_user_connections_basic.test diff --git a/mysql-test/t/max_user_connections_func.test b/mysql-test/suite/sys_vars/t/max_user_connections_func.test index 841a630c5ce..841a630c5ce 100644 --- a/mysql-test/t/max_user_connections_func.test +++ b/mysql-test/suite/sys_vars/t/max_user_connections_func.test diff --git a/mysql-test/t/myisam_data_pointer_size_basic.test b/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_basic.test index d151c6000b8..d151c6000b8 100644 --- a/mysql-test/t/myisam_data_pointer_size_basic.test +++ b/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_basic.test diff --git a/mysql-test/t/myisam_data_pointer_size_func.test b/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func.test index 36ad31acf6c..37dd3a5a297 100644 --- a/mysql-test/t/myisam_data_pointer_size_func.test +++ b/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func.test @@ -14,16 +14,17 @@ # Description: Test Cases of Dynamic System Variable myisam_data_pointer_size # # that checks the behavior of this variable # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ################################################################################ --echo '#--------------------FN_DYNVARS_093_01-------------------------#' ############################################################################### -# Check if setting myisam_data_pointer_size is changed in every new connection# +# Check if setting myisam_data_pointer_size is changed in every new connection# ############################################################################### +SET @start_value= @@global.myisam_data_pointer_size; SET @@global.myisam_data_pointer_size = 2; # con1 will be default connection from now on --echo 'connect (con1,localhost,root,,,,)' @@ -48,7 +49,6 @@ disconnect con2; --echo 'connection con1' connection con1; - #=========================================================== # Checking myisam_data_pointer_size is 2 #=========================================================== @@ -59,10 +59,7 @@ DROP PROCEDURE IF EXISTS sp_addRec; DROP TABLE IF EXISTS t1; --enable_warnings - - DELIMITER //; - CREATE PROCEDURE sp_addRec(IN count INT) BEGIN WHILE (count>0) DO @@ -70,7 +67,6 @@ BEGIN SET count = count -1; END WHILE; END // - DELIMITER ;// # setting 2 will allow data pointer to access files with size < 65536 @@ -105,6 +101,8 @@ SELECT count(*) from t1; DROP PROCEDURE sp_addRec; DROP TABLE t1; +connection default; +SET @@global.myisam_data_pointer_size= @start_value; ################################################################ # End of functionality Testing for myisam_data_pointer_size # ################################################################ diff --git a/mysql-test/t/myisam_stats_method_basic.test b/mysql-test/suite/sys_vars/t/myisam_stats_method_basic.test index 0045842269b..0045842269b 100644 --- a/mysql-test/t/myisam_stats_method_basic.test +++ b/mysql-test/suite/sys_vars/t/myisam_stats_method_basic.test diff --git a/mysql-test/t/myisam_stats_method_func.test b/mysql-test/suite/sys_vars/t/myisam_stats_method_func.test index 8b47015ba87..a317f8d93da 100644 --- a/mysql-test/t/myisam_stats_method_func.test +++ b/mysql-test/suite/sys_vars/t/myisam_stats_method_func.test @@ -14,16 +14,18 @@ # Description: Test Cases of Dynamic System Variable myisam_stats_method # # that checks the behavior of this variable # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ############################################################################### --echo '#--------------------FN_DYNVARS_097_01-------------------------#' ##################################################################### -# Check if Setting myisam_stats_method is changed in new connection # +# Check if Setting myisam_stats_method is changed in new connection # ##################################################################### +SET @start_value = @@global.myisam_stats_method; + SET @@global.myisam_stats_method = nulls_equal; --echo 'connect (con1,localhost,root,,,,)' connect (con1,localhost,root,,,,); @@ -45,19 +47,19 @@ connection default; DROP TABLE IF EXISTS t1; --enable_warnings -CREATE TABLE t1 (a int, key (a)); +CREATE TABLE t1 (a INT, KEY (a)); INSERT INTO t1 VALUES (0),(1),(2),(3),(4); INSERT INTO t1 SELECT NULL FROM t1; #======================================= --echo 'default: NULLs considered unequal' #======================================= -SET myisam_stats_method=nulls_unequal; +SET myisam_stats_method = nulls_unequal; ANALYZE TABLE t1; SHOW INDEX FROM t1; INSERT INTO t1 VALUES (11); -DELETE FROM t1 WHERE a=11; +DELETE FROM t1 WHERE a = 11; CHECK TABLE t1; SHOW INDEX FROM t1; @@ -65,14 +67,14 @@ SHOW INDEX FROM t1; #===================================== --echo 'Set nulls to be equal' #===================================== -SET myisam_stats_method=nulls_equal; +SET myisam_stats_method = nulls_equal; INSERT INTO t1 VALUES (11); -DELETE FROM t1 WHERE a=11; -ANALYZE TABLE t1; +DELETE FROM t1 WHERE a = 11; +ANALYZE TABLE t1; SHOW INDEX FROM t1; INSERT INTO t1 VALUES (11); -DELETE FROM t1 WHERE a=11; +DELETE FROM t1 WHERE a = 11; CHECK TABLE t1; SHOW INDEX FROM t1; @@ -80,13 +82,13 @@ SHOW INDEX FROM t1; --echo 'Set nulls to be ignored' #===================================== -SET myisam_stats_method=nulls_ignored; -SHOW variables LIKE 'myisam_stats_method'; -drop TABLE t1; +SET myisam_stats_method = nulls_ignored; +SHOW VARIABLES LIKE 'myisam_stats_method'; +DROP TABLE t1; CREATE TABLE t1 ( - a char(3), b char(4), c char(5), d char(6), - key(a,b,c,d) + a CHAR(3), b CHAR(4), c CHAR(5), d CHAR(6), + KEY(a,b,c,d) ); INSERT INTO t1 VALUES ('bcd','def1', NULL, 'zz'); INSERT INTO t1 VALUES ('bcd','def2', NULL, 'zz'); @@ -98,9 +100,12 @@ DELETE FROM t1; ANALYZE TABLE t1; SHOW INDEX FROM t1; -SET myisam_stats_method=DEFAULT; +SET myisam_stats_method = DEFAULT; DROP TABLE t1; +SET @@global.myisam_stats_method= @start_value; + ######################################################## # End of functionality Testing for myisam_stats_method # ######################################################## + diff --git a/mysql-test/t/myisam_use_mmap_basic.test b/mysql-test/suite/sys_vars/t/myisam_use_mmap_basic.test index d2cc39cfea7..d2cc39cfea7 100644 --- a/mysql-test/t/myisam_use_mmap_basic.test +++ b/mysql-test/suite/sys_vars/t/myisam_use_mmap_basic.test diff --git a/mysql-test/t/ndb_log_update_as_write_basic.test b/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test index 0b9d3ada158..0b9d3ada158 100644 --- a/mysql-test/t/ndb_log_update_as_write_basic.test +++ b/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test diff --git a/mysql-test/t/ndb_log_updated_only_basic.test b/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test index 85b76cc88a4..85b76cc88a4 100644 --- a/mysql-test/t/ndb_log_updated_only_basic.test +++ b/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test diff --git a/mysql-test/t/net_buffer_length_basic.test b/mysql-test/suite/sys_vars/t/net_buffer_length_basic.test index 6e1e0559c61..6e1e0559c61 100644 --- a/mysql-test/t/net_buffer_length_basic.test +++ b/mysql-test/suite/sys_vars/t/net_buffer_length_basic.test diff --git a/mysql-test/t/net_read_timeout_basic.test b/mysql-test/suite/sys_vars/t/net_read_timeout_basic.test index f0d32302e4f..f0d32302e4f 100644 --- a/mysql-test/t/net_read_timeout_basic.test +++ b/mysql-test/suite/sys_vars/t/net_read_timeout_basic.test diff --git a/mysql-test/t/net_write_timeout_basic.test b/mysql-test/suite/sys_vars/t/net_write_timeout_basic.test index 84c682561e3..84c682561e3 100644 --- a/mysql-test/t/net_write_timeout_basic.test +++ b/mysql-test/suite/sys_vars/t/net_write_timeout_basic.test diff --git a/mysql-test/t/new_basic.test b/mysql-test/suite/sys_vars/t/new_basic.test index b1d12c9a4de..b1d12c9a4de 100644 --- a/mysql-test/t/new_basic.test +++ b/mysql-test/suite/sys_vars/t/new_basic.test diff --git a/mysql-test/t/old_passwords_basic.test b/mysql-test/suite/sys_vars/t/old_passwords_basic.test index b78ac9ca9b8..b78ac9ca9b8 100644 --- a/mysql-test/t/old_passwords_basic.test +++ b/mysql-test/suite/sys_vars/t/old_passwords_basic.test diff --git a/mysql-test/t/old_passwords_func.test b/mysql-test/suite/sys_vars/t/old_passwords_func.test index 2707fc3ab6d..2707fc3ab6d 100644 --- a/mysql-test/t/old_passwords_func.test +++ b/mysql-test/suite/sys_vars/t/old_passwords_func.test diff --git a/mysql-test/t/optimizer_prune_level_basic.test b/mysql-test/suite/sys_vars/t/optimizer_prune_level_basic.test index 58c074d7d5e..58c074d7d5e 100644 --- a/mysql-test/t/optimizer_prune_level_basic.test +++ b/mysql-test/suite/sys_vars/t/optimizer_prune_level_basic.test diff --git a/mysql-test/t/optimizer_search_depth_basic.test b/mysql-test/suite/sys_vars/t/optimizer_search_depth_basic.test index 42548c59d40..42548c59d40 100644 --- a/mysql-test/t/optimizer_search_depth_basic.test +++ b/mysql-test/suite/sys_vars/t/optimizer_search_depth_basic.test diff --git a/mysql-test/t/preload_buffer_size_basic.test b/mysql-test/suite/sys_vars/t/preload_buffer_size_basic.test index 48b1e32676a..48b1e32676a 100644 --- a/mysql-test/t/preload_buffer_size_basic.test +++ b/mysql-test/suite/sys_vars/t/preload_buffer_size_basic.test diff --git a/mysql-test/t/query_cache_limit_func.test b/mysql-test/suite/sys_vars/t/query_cache_limit_func.test index 8dd5cf42d3d..e90a0e6adda 100644 --- a/mysql-test/t/query_cache_limit_func.test +++ b/mysql-test/suite/sys_vars/t/query_cache_limit_func.test @@ -9,14 +9,14 @@ # # # # # Creation Date: 2008-03-02 # -# Author: Sharique Abdullah # +# Author: Sharique Abdullah # # # # Description: Test Cases of Dynamic System Variable "Query_cache_limit" # # that checks behavior of this variable in the following ways # # * Functionality based on different values # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en # -# /server-system-variables.html#option_mysqld_Query_cache_limit # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ############################################################################### @@ -28,6 +28,8 @@ # SET @global_query_cache_limit = @@global.query_cache_limit; +SET @global_query_cache_size = @@global.query_cache_size; +SET @global_query_cache_type = @@global.query_cache_type; --echo ** warnings ** --disable_warnings @@ -105,7 +107,7 @@ RESET QUERY CACHE; #set cache limit --echo ** set cache limit ** -SET @@GLOBAL.query_cache_limit=0; +SET @@GLOBAL.query_cache_limit = 0; #fetching results# --echo ** fetching results ** @@ -113,7 +115,6 @@ SELECT * FROM t; # Check status after setting value# --echo ** Check status after setting value ** -#let $newcachevalue1= query_get_value(SHOW STATUS LIKE 'Qcache_queries_in_cache', Value, 1); SHOW STATUS LIKE 'Qcache_not_cached'; --echo 1 Expected SHOW STATUS LIKE 'Qcache_queries_in_cache'; @@ -127,7 +128,7 @@ SHOW STATUS LIKE 'Qcache_queries_in_cache'; #set cache limit to default --echo ** set cache limit ** -SET @@GLOBAL.query_cache_limit=DEFAULT; +SET @@GLOBAL.query_cache_limit = DEFAULT; # Reset cache & flush status --echo ** Reset cache values ** @@ -143,7 +144,7 @@ SHOW STATUS LIKE 'Qcache_not_cached'; SHOW STATUS LIKE 'Qcache_queries_in_cache'; --echo 1 Expected -SET @@GLOBAL.query_cache_limit=0; +SET @@GLOBAL.query_cache_limit = 0; SHOW STATUS LIKE 'Qcache_not_cached'; --echo 0 Expected @@ -167,7 +168,10 @@ SHOW STATUS LIKE 'Qcache_queries_in_cache'; # SET @@GLOBAL.query_cache_limit = @global_query_cache_limit; +SET GLOBAL query_cache_size = @global_query_cache_size; +SET GLOBAL query_cache_type = @global_query_cache_type; --disable_warnings DROP TABLE IF EXISTS t; --enable_warnings + diff --git a/mysql-test/t/query_cache_type_basic.test b/mysql-test/suite/sys_vars/t/query_cache_type_basic.test index ba7e26a3065..ba7e26a3065 100644 --- a/mysql-test/t/query_cache_type_basic.test +++ b/mysql-test/suite/sys_vars/t/query_cache_type_basic.test diff --git a/mysql-test/t/query_cache_type_func.test b/mysql-test/suite/sys_vars/t/query_cache_type_func.test index 64f332eb7c0..4679d1ec339 100644 --- a/mysql-test/t/query_cache_type_func.test +++ b/mysql-test/suite/sys_vars/t/query_cache_type_func.test @@ -14,8 +14,8 @@ # Description: Test Cases of Dynamic System Variable "query_cache_type" # # that checks behavior of this variable in the following ways # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html#option_mysqld_query_cache_type # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ############################################################################### @@ -36,6 +36,7 @@ connection con0; SET @start_global_value = @@GLOBAL.query_cache_type; SET @start_session_value = @@SESSION.query_cache_type; +SET @start_query_cache_size= @@global.query_cache_size; # # Creating test table @@ -305,6 +306,7 @@ connection con0; SET @@GLOBAL.query_cache_type = @start_global_value; SET @@SESSION.query_cache_type = @start_session_value; +SET GLOBAL query_cache_size = @start_query_cache_size; DROP TABLE t1; @@ -312,3 +314,4 @@ DROP PROCEDURE testProcHit; --echo Disconnecting con0 disconnect con0; + diff --git a/mysql-test/t/query_cache_wlock_invalidate_basic.test b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_basic.test index f253c1b4f43..f253c1b4f43 100644 --- a/mysql-test/t/query_cache_wlock_invalidate_basic.test +++ b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_basic.test diff --git a/mysql-test/t/query_cache_wlock_invalidate_func.test b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test index 83b0c446b28..83b0c446b28 100644 --- a/mysql-test/t/query_cache_wlock_invalidate_func.test +++ b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test diff --git a/mysql-test/t/query_prealloc_size_func.test b/mysql-test/suite/sys_vars/t/query_prealloc_size_func.test index 4f1e3e63e16..7267b9e317e 100644 --- a/mysql-test/t/query_prealloc_size_func.test +++ b/mysql-test/suite/sys_vars/t/query_prealloc_size_func.test @@ -1,32 +1,32 @@ ############# mysql-test\t\query_prealloc_size_func.test ###################### -# # -# Variable Name: query_prealloc_size # -# Scope: GLOBAL & SESSION # -# Access Type: Dynamic # -# Data Type: integer # -# Default Value: 8192 # -# Values: 8192-4294967295 # -# # -# # -# Creation Date: 2008-02-22 # -# Author: Sharique Abdullah # -# # -# Description: Test Cases of Dynamic System Variable "query_prealloc_size" # -# that checks behavior of this variable in the following ways # -# * Default Value # -# * Valid & Invalid values # -# * Scope & Access method # -# * Cache behaviors # -# # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html#option_mysqld_query_prealloc_size # -# # +# # +# Variable Name: query_prealloc_size # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: integer # +# Default Value: 8192 # +# Values: 8192-4294967295 # +# # +# # +# Creation Date: 2008-02-22 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "query_prealloc_size" # +# that checks behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Cache behaviors # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # ############################################################################### --echo ** Setup ** ---echo +--echo # # Setup # @@ -35,16 +35,18 @@ # Save initial value # -CREATE TABLE t1 (id int auto_increment primary key, val text(200)); +SET @start_value = @@global.query_prealloc_size; -INSERT INTO t1 values(NULL,'a'); -INSERT INTO t1 values(NULL,'b'); -INSERT INTO t1 values(NULL,'c'); -INSERT INTO t1 values(NULL,'d'); +CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY, val TEXT(200)); + +INSERT INTO t1 VALUES(NULL,'a'); +INSERT INTO t1 VALUES(NULL,'b'); +INSERT INTO t1 VALUES(NULL,'c'); +INSERT INTO t1 VALUES(NULL,'d'); SELECT * FROM t1 ORDER BY val; -SET SESSION query_prealloc_size = 8192; +SET SESSION query_prealloc_size = 8192; --echo '#----------------------------FN_DYNVARS_137_05-----------------#' @@ -84,3 +86,7 @@ connection default; disconnect con_int1; disconnect con_int2; +DROP TABLE t1; + +SET @@global.query_prealloc_size = @start_value; + diff --git a/mysql-test/t/read_buffer_size_basic.test b/mysql-test/suite/sys_vars/t/read_buffer_size_basic.test index 405bb9da6d8..405bb9da6d8 100644 --- a/mysql-test/t/read_buffer_size_basic.test +++ b/mysql-test/suite/sys_vars/t/read_buffer_size_basic.test diff --git a/mysql-test/t/read_only_basic.test b/mysql-test/suite/sys_vars/t/read_only_basic.test index 917842256b1..917842256b1 100644 --- a/mysql-test/t/read_only_basic.test +++ b/mysql-test/suite/sys_vars/t/read_only_basic.test diff --git a/mysql-test/t/read_only_func.test b/mysql-test/suite/sys_vars/t/read_only_func.test index c8fb932544b..c8fb932544b 100644 --- a/mysql-test/t/read_only_func.test +++ b/mysql-test/suite/sys_vars/t/read_only_func.test diff --git a/mysql-test/t/read_rnd_buffer_size_basic.test b/mysql-test/suite/sys_vars/t/read_rnd_buffer_size_basic.test index e3d2a4b89f7..e3d2a4b89f7 100644 --- a/mysql-test/t/read_rnd_buffer_size_basic.test +++ b/mysql-test/suite/sys_vars/t/read_rnd_buffer_size_basic.test diff --git a/mysql-test/t/relay_log_purge_basic.test b/mysql-test/suite/sys_vars/t/relay_log_purge_basic.test index 7e4d6a51440..7e4d6a51440 100644 --- a/mysql-test/t/relay_log_purge_basic.test +++ b/mysql-test/suite/sys_vars/t/relay_log_purge_basic.test diff --git a/mysql-test/suite/sys_vars/t/rpl_init_slave_func.test b/mysql-test/suite/sys_vars/t/rpl_init_slave_func.test new file mode 100644 index 00000000000..f17cc1289b1 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/rpl_init_slave_func.test @@ -0,0 +1,102 @@ +###################### mysql-test\t\init_slave_func.test ##################### +# # +# Variable Name: init_slave # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: # +# Range: # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan # +# Modified: HHunger 2008-09-29 Fixed the bug by inserting the usual wait and # +# SQL-Satements to control master and slave, # +# deleted the sleep and made improvements like: # +# - Replaced the opt file by dynamic variables, # +# - Made the tests independant of the initial # +# values of the global variables, # +# - Reduced the test to the needed test case to # +# save run time, # +# - Beautification. # +# # +# Description: Test Cases of Dynamic System Variable init_slave # +# that checks the behavior of this variable # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + +source include/master-slave.inc; +--echo connection slave +connection slave; +# +# save the current values + +SET @start_max_connections= @@global.max_connections; +SET @start_init_slave= @@global.init_slave; + +# setting of a global value with an effect on the next start of the slave server +# check that @@global.init_slave could be set +let $my_init_slave= + 'SET @@global.max_connections = @@global.max_connections + 1'; +eval SET @@global.init_slave = $my_init_slave; + +# show the data type of the variable +--disable_warnings +DROP TABLE IF EXISTS t1; +CREATE TEMPORARY TABLE t1 AS SELECT @@global.init_slave AS my_column; +--enable_warnings +DESCRIBE t1; +DROP TABLE t1; +# +# check that the new setting of @@global.init_slave becomes immediately visible +eval SELECT @@global.init_slave = $my_init_slave; +--echo Expect 1 +# wait for the slave threads have set the global variable. +let $wait_timeout= 90; +let $wait_condition= SELECT @@global.max_connections = @start_max_connections; +--source include/wait_condition_sp.inc +# check that the action in init_slave does not happen immediately +SELECT @@global.max_connections= @start_max_connections; +--echo Expect 1 +# +# reset of the server +STOP SLAVE; +--wait_for_slave_to_stop +RESET MASTER; +RESET SLAVE; +START SLAVE; +source include/wait_for_slave_to_start.inc; +# +# wait for the slave threads have set the global variable. +let $wait_timeout= 90; +let $wait_condition= SELECT @@global.max_connections = @start_max_connections + 1; +--source include/wait_condition_sp.inc +# check that the action in init_slave was executed and had the intended effect +SELECT @@global.max_connections = @start_max_connections + 1; +--echo Expect 1 +# +# Setting a variable(which is local to a session) and must not be visible +SET @@global.init_slave = "SET @a=5"; +# +STOP SLAVE; +--wait_for_slave_to_stop +RESET MASTER; +RESET SLAVE; +START SLAVE; +source include/wait_for_slave_to_start.inc; +# +SHOW VARIABLES LIKE 'init_slave'; +# expect NULL +SELECT @a; +--echo Expect NULL +# +# Clean up +SET @@global.max_connections= @start_max_connections; +SET @@global.init_slave= @start_init_slave; +################################################## +# End of functionality Testing for init_slave # +################################################## + diff --git a/mysql-test/t/rpl_max_binlog_size_func-master.opt b/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func-master.opt index bff213dfb0b..bff213dfb0b 100644 --- a/mysql-test/t/rpl_max_binlog_size_func-master.opt +++ b/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func-master.opt diff --git a/mysql-test/t/rpl_max_binlog_size_func.test b/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test index df22b253009..c00db582deb 100644 --- a/mysql-test/t/rpl_max_binlog_size_func.test +++ b/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test @@ -12,6 +12,7 @@ DROP TABLE IF EXISTS t1; --echo '--- check if log file is rotated after 4096 bytes ----' #============================================================== +SET @saved_max_binlog_size= @@global.max_binlog_size; SET @@global.max_binlog_size = 4096; CREATE TABLE t1(a CHAR(5)); @@ -27,11 +28,16 @@ dec $a; --sleep 2 # if log file is not created then this will fail ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---file_exists $MYSQLTEST_VARDIR/master-data/mylog.000002 +let $MYSQLD_DATADIR=`select @@datadir`; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--file_exists $MYSQLD_DATADIR/mylog.000002 --echo 'mylog.000002 exists' +SET @@global.max_binlog_size= @saved_max_binlog_size; + +DROP TABLE t1; + ############################################################################### # End of functionality testing for max_binlog_size # ############################################################################### diff --git a/mysql-test/t/secure_auth_basic.test b/mysql-test/suite/sys_vars/t/secure_auth_basic.test index b52f219097b..b52f219097b 100644 --- a/mysql-test/t/secure_auth_basic.test +++ b/mysql-test/suite/sys_vars/t/secure_auth_basic.test diff --git a/mysql-test/t/secure_auth_func-master.opt b/mysql-test/suite/sys_vars/t/secure_auth_func-master.opt index 38ba956df15..38ba956df15 100644 --- a/mysql-test/t/secure_auth_func-master.opt +++ b/mysql-test/suite/sys_vars/t/secure_auth_func-master.opt diff --git a/mysql-test/t/secure_auth_func.test b/mysql-test/suite/sys_vars/t/secure_auth_func.test index 10dc383035d..10dc383035d 100644 --- a/mysql-test/t/secure_auth_func.test +++ b/mysql-test/suite/sys_vars/t/secure_auth_func.test diff --git a/mysql-test/t/slave_allow_batching_basic.test b/mysql-test/suite/sys_vars/t/slave_allow_batching_basic.test index cf31917933a..cf31917933a 100644 --- a/mysql-test/t/slave_allow_batching_basic.test +++ b/mysql-test/suite/sys_vars/t/slave_allow_batching_basic.test diff --git a/mysql-test/t/slave_compressed_protocol_basic.test b/mysql-test/suite/sys_vars/t/slave_compressed_protocol_basic.test index 29a3227a8f5..29a3227a8f5 100644 --- a/mysql-test/t/slave_compressed_protocol_basic.test +++ b/mysql-test/suite/sys_vars/t/slave_compressed_protocol_basic.test diff --git a/mysql-test/t/slave_exec_mode_basic.test b/mysql-test/suite/sys_vars/t/slave_exec_mode_basic.test index 5c5b4e7da1b..5c5b4e7da1b 100644 --- a/mysql-test/t/slave_exec_mode_basic.test +++ b/mysql-test/suite/sys_vars/t/slave_exec_mode_basic.test diff --git a/mysql-test/t/slave_net_timeout_basic.test b/mysql-test/suite/sys_vars/t/slave_net_timeout_basic.test index 5662eec3957..5662eec3957 100644 --- a/mysql-test/t/slave_net_timeout_basic.test +++ b/mysql-test/suite/sys_vars/t/slave_net_timeout_basic.test diff --git a/mysql-test/t/slow_launch_time_basic.test b/mysql-test/suite/sys_vars/t/slow_launch_time_basic.test index 6289a91abb3..6289a91abb3 100644 --- a/mysql-test/t/slow_launch_time_basic.test +++ b/mysql-test/suite/sys_vars/t/slow_launch_time_basic.test diff --git a/mysql-test/t/slow_launch_time_func.test b/mysql-test/suite/sys_vars/t/slow_launch_time_func.test index c9a7d28bb8a..c9a7d28bb8a 100644 --- a/mysql-test/t/slow_launch_time_func.test +++ b/mysql-test/suite/sys_vars/t/slow_launch_time_func.test diff --git a/mysql-test/t/slow_query_log_basic.test b/mysql-test/suite/sys_vars/t/slow_query_log_basic.test index 3a1b2fbd9e7..3a1b2fbd9e7 100644 --- a/mysql-test/t/slow_query_log_basic.test +++ b/mysql-test/suite/sys_vars/t/slow_query_log_basic.test diff --git a/mysql-test/t/slow_query_log_file_basic-master.opt b/mysql-test/suite/sys_vars/t/slow_query_log_file_basic-master.opt index 2b6ac309d6c..2b6ac309d6c 100644 --- a/mysql-test/t/slow_query_log_file_basic-master.opt +++ b/mysql-test/suite/sys_vars/t/slow_query_log_file_basic-master.opt diff --git a/mysql-test/t/slow_query_log_file_basic.test b/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test index 2620cd5eabc..9125b686cad 100644 --- a/mysql-test/t/slow_query_log_file_basic.test +++ b/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test @@ -10,6 +10,7 @@ # # # Creation Date: 2008-03-16 # # Author: Salman Rawala # +# Modified: HHunger 2008-09-11 set system var back to start value # # # # Description: Test Cases of Dynamic System Variable "slow_query_log_file" # # that checks behavior of this variable in the following ways # @@ -18,8 +19,8 @@ # * Scope & Access method # # * Data Integrity # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html#option_mysqld_slow_query_log_file # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # ################################################################################ @@ -35,8 +36,6 @@ ########################################################################### SET @start_value = @@global.slow_query_log_file; -SELECT @start_value; - --echo '#---------------------FN_DYNVARS_004_01-------------------------#' ############################################### @@ -66,7 +65,8 @@ SELECT @@global.slow_query_log_file = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slow_query_log_file'; - +SET @@global.slow_query_log_file= @start_value; ##################################################### # END OF slow_query_log_file TESTS # ##################################################### + diff --git a/mysql-test/t/slow_query_log_file_func-master.opt b/mysql-test/suite/sys_vars/t/slow_query_log_file_func-master.opt index e866f016022..e866f016022 100644 --- a/mysql-test/t/slow_query_log_file_func-master.opt +++ b/mysql-test/suite/sys_vars/t/slow_query_log_file_func-master.opt diff --git a/mysql-test/t/slow_query_log_file_func.test b/mysql-test/suite/sys_vars/t/slow_query_log_file_func.test index 519932b34b0..32420fc294a 100644 --- a/mysql-test/t/slow_query_log_file_func.test +++ b/mysql-test/suite/sys_vars/t/slow_query_log_file_func.test @@ -25,8 +25,9 @@ # Verifying log file after setting it in opt file # #################################################################### ---echo ## --file_exists var/master-data/my_slow_test.log ## ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---file_exists $MYSQLTEST_VARDIR/master-data/my_slow_test.log +let $MYSQLD_DATADIR= `select @@datadir`; +--echo ## Checking if my_slow_test.log exists in servers datadir ## +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--file_exists $MYSQLD_DATADIR/my_slow_test.log --echo ## This case should pass because we have set this filename in opt file ## diff --git a/mysql-test/t/slow_query_log_func.test b/mysql-test/suite/sys_vars/t/slow_query_log_func.test index 9bcbeb14fd7..9bcbeb14fd7 100644 --- a/mysql-test/t/slow_query_log_func.test +++ b/mysql-test/suite/sys_vars/t/slow_query_log_func.test diff --git a/mysql-test/t/sql_auto_is_null_basic.test b/mysql-test/suite/sys_vars/t/sql_auto_is_null_basic.test index a843b88bf85..a843b88bf85 100644 --- a/mysql-test/t/sql_auto_is_null_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_auto_is_null_basic.test diff --git a/mysql-test/t/sql_big_selects_basic.test b/mysql-test/suite/sys_vars/t/sql_big_selects_basic.test index dd83a19230a..dd83a19230a 100644 --- a/mysql-test/t/sql_big_selects_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_big_selects_basic.test diff --git a/mysql-test/t/sql_big_selects_func.test b/mysql-test/suite/sys_vars/t/sql_big_selects_func.test index 4aefda5e15e..4aefda5e15e 100644 --- a/mysql-test/t/sql_big_selects_func.test +++ b/mysql-test/suite/sys_vars/t/sql_big_selects_func.test diff --git a/mysql-test/t/sql_big_tables_basic.test b/mysql-test/suite/sys_vars/t/sql_big_tables_basic.test index 4e3dbdc9504..4e3dbdc9504 100644 --- a/mysql-test/t/sql_big_tables_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_big_tables_basic.test diff --git a/mysql-test/t/sql_big_tables_func.test b/mysql-test/suite/sys_vars/t/sql_big_tables_func.test index 5f919fac2c7..5f919fac2c7 100644 --- a/mysql-test/t/sql_big_tables_func.test +++ b/mysql-test/suite/sys_vars/t/sql_big_tables_func.test diff --git a/mysql-test/t/sql_buffer_result_basic.test b/mysql-test/suite/sys_vars/t/sql_buffer_result_basic.test index f5a5e323fc4..f5a5e323fc4 100644 --- a/mysql-test/t/sql_buffer_result_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_buffer_result_basic.test diff --git a/mysql-test/t/sql_buffer_result_func.test b/mysql-test/suite/sys_vars/t/sql_buffer_result_func.test index 4530545b8f0..4530545b8f0 100644 --- a/mysql-test/t/sql_buffer_result_func.test +++ b/mysql-test/suite/sys_vars/t/sql_buffer_result_func.test diff --git a/mysql-test/t/sql_log_bin_basic.test b/mysql-test/suite/sys_vars/t/sql_log_bin_basic.test index 0f6d9e1e126..0f6d9e1e126 100644 --- a/mysql-test/t/sql_log_bin_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_log_bin_basic.test diff --git a/mysql-test/t/sql_log_off_basic.test b/mysql-test/suite/sys_vars/t/sql_log_off_basic.test index bcf9e87c1dd..bcf9e87c1dd 100644 --- a/mysql-test/t/sql_log_off_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_log_off_basic.test diff --git a/mysql-test/t/sql_log_off_func.test b/mysql-test/suite/sys_vars/t/sql_log_off_func.test index fb06a12b264..fb06a12b264 100644 --- a/mysql-test/t/sql_log_off_func.test +++ b/mysql-test/suite/sys_vars/t/sql_log_off_func.test diff --git a/mysql-test/t/sql_low_priority_updates_basic.test b/mysql-test/suite/sys_vars/t/sql_low_priority_updates_basic.test index 499723b636d..499723b636d 100644 --- a/mysql-test/t/sql_low_priority_updates_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_low_priority_updates_basic.test diff --git a/mysql-test/t/sql_low_priority_updates_func.test b/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test index 6ff684af6cd..6ff684af6cd 100644 --- a/mysql-test/t/sql_low_priority_updates_func.test +++ b/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test diff --git a/mysql-test/t/sql_max_join_size_func.test b/mysql-test/suite/sys_vars/t/sql_max_join_size_func.test index 17b7d911b94..17b7d911b94 100644 --- a/mysql-test/t/sql_max_join_size_func.test +++ b/mysql-test/suite/sys_vars/t/sql_max_join_size_func.test diff --git a/mysql-test/t/sql_mode_basic.test b/mysql-test/suite/sys_vars/t/sql_mode_basic.test index 24f1e8aefcb..24f1e8aefcb 100644 --- a/mysql-test/t/sql_mode_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_mode_basic.test diff --git a/mysql-test/t/sql_mode_func.test b/mysql-test/suite/sys_vars/t/sql_mode_func.test index 5bb804c26da..5bb804c26da 100644 --- a/mysql-test/t/sql_mode_func.test +++ b/mysql-test/suite/sys_vars/t/sql_mode_func.test diff --git a/mysql-test/t/sql_notes_basic.test b/mysql-test/suite/sys_vars/t/sql_notes_basic.test index 984dca34e46..984dca34e46 100644 --- a/mysql-test/t/sql_notes_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_notes_basic.test diff --git a/mysql-test/t/sql_notes_func.test b/mysql-test/suite/sys_vars/t/sql_notes_func.test index f7c521d3736..f7c521d3736 100644 --- a/mysql-test/t/sql_notes_func.test +++ b/mysql-test/suite/sys_vars/t/sql_notes_func.test diff --git a/mysql-test/t/sql_quote_show_create_basic.test b/mysql-test/suite/sys_vars/t/sql_quote_show_create_basic.test index 1919b3ee642..1919b3ee642 100644 --- a/mysql-test/t/sql_quote_show_create_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_quote_show_create_basic.test diff --git a/mysql-test/t/sql_quote_show_create_func.test b/mysql-test/suite/sys_vars/t/sql_quote_show_create_func.test index 6350771a0da..6350771a0da 100644 --- a/mysql-test/t/sql_quote_show_create_func.test +++ b/mysql-test/suite/sys_vars/t/sql_quote_show_create_func.test diff --git a/mysql-test/t/sql_safe_updates_basic.test b/mysql-test/suite/sys_vars/t/sql_safe_updates_basic.test index 489b42949a0..489b42949a0 100644 --- a/mysql-test/t/sql_safe_updates_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_safe_updates_basic.test diff --git a/mysql-test/t/sql_safe_updates_func.test b/mysql-test/suite/sys_vars/t/sql_safe_updates_func.test index a8ce3a8d0f7..a8ce3a8d0f7 100644 --- a/mysql-test/t/sql_safe_updates_func.test +++ b/mysql-test/suite/sys_vars/t/sql_safe_updates_func.test diff --git a/mysql-test/t/sql_select_limit_func.test b/mysql-test/suite/sys_vars/t/sql_select_limit_func.test index ed582949aa0..ed582949aa0 100644 --- a/mysql-test/t/sql_select_limit_func.test +++ b/mysql-test/suite/sys_vars/t/sql_select_limit_func.test diff --git a/mysql-test/t/sql_slave_skip_counter_basic.test b/mysql-test/suite/sys_vars/t/sql_slave_skip_counter_basic.test index e7d9098aee9..e7d9098aee9 100644 --- a/mysql-test/t/sql_slave_skip_counter_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_slave_skip_counter_basic.test diff --git a/mysql-test/t/sql_warnings_basic.test b/mysql-test/suite/sys_vars/t/sql_warnings_basic.test index f740403ceda..f740403ceda 100644 --- a/mysql-test/t/sql_warnings_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_warnings_basic.test diff --git a/mysql-test/t/sql_warnings_func.test b/mysql-test/suite/sys_vars/t/sql_warnings_func.test index e7705d1f146..e7705d1f146 100644 --- a/mysql-test/t/sql_warnings_func.test +++ b/mysql-test/suite/sys_vars/t/sql_warnings_func.test diff --git a/mysql-test/t/ssl_ca_basic.test b/mysql-test/suite/sys_vars/t/ssl_ca_basic.test index c369f1f0894..c369f1f0894 100644 --- a/mysql-test/t/ssl_ca_basic.test +++ b/mysql-test/suite/sys_vars/t/ssl_ca_basic.test diff --git a/mysql-test/t/ssl_capath_basic.test b/mysql-test/suite/sys_vars/t/ssl_capath_basic.test index c32b572fb1b..c32b572fb1b 100644 --- a/mysql-test/t/ssl_capath_basic.test +++ b/mysql-test/suite/sys_vars/t/ssl_capath_basic.test diff --git a/mysql-test/t/ssl_cert_basic.test b/mysql-test/suite/sys_vars/t/ssl_cert_basic.test index c3b69bd495f..c3b69bd495f 100644 --- a/mysql-test/t/ssl_cert_basic.test +++ b/mysql-test/suite/sys_vars/t/ssl_cert_basic.test diff --git a/mysql-test/t/ssl_cipher_basic.test b/mysql-test/suite/sys_vars/t/ssl_cipher_basic.test index 425f7aae442..425f7aae442 100644 --- a/mysql-test/t/ssl_cipher_basic.test +++ b/mysql-test/suite/sys_vars/t/ssl_cipher_basic.test diff --git a/mysql-test/t/ssl_key_basic.test b/mysql-test/suite/sys_vars/t/ssl_key_basic.test index 4616f281c27..4616f281c27 100644 --- a/mysql-test/t/ssl_key_basic.test +++ b/mysql-test/suite/sys_vars/t/ssl_key_basic.test diff --git a/mysql-test/t/storage_engine_basic-master.opt b/mysql-test/suite/sys_vars/t/storage_engine_basic-master.opt index 627becdbfb5..627becdbfb5 100644 --- a/mysql-test/t/storage_engine_basic-master.opt +++ b/mysql-test/suite/sys_vars/t/storage_engine_basic-master.opt diff --git a/mysql-test/t/storage_engine_basic.test b/mysql-test/suite/sys_vars/t/storage_engine_basic.test index 689afcd1010..689afcd1010 100644 --- a/mysql-test/t/storage_engine_basic.test +++ b/mysql-test/suite/sys_vars/t/storage_engine_basic.test diff --git a/mysql-test/t/sync_frm_basic.test b/mysql-test/suite/sys_vars/t/sync_frm_basic.test index af268fd2c44..af268fd2c44 100644 --- a/mysql-test/t/sync_frm_basic.test +++ b/mysql-test/suite/sys_vars/t/sync_frm_basic.test diff --git a/mysql-test/t/system_time_zone_basic.test b/mysql-test/suite/sys_vars/t/system_time_zone_basic.test index 0dfc850d227..0dfc850d227 100644 --- a/mysql-test/t/system_time_zone_basic.test +++ b/mysql-test/suite/sys_vars/t/system_time_zone_basic.test diff --git a/mysql-test/t/table_definition_cache_basic.test b/mysql-test/suite/sys_vars/t/table_definition_cache_basic.test index 63296590511..63296590511 100644 --- a/mysql-test/t/table_definition_cache_basic.test +++ b/mysql-test/suite/sys_vars/t/table_definition_cache_basic.test diff --git a/mysql-test/t/table_lock_wait_timeout_basic.test b/mysql-test/suite/sys_vars/t/table_lock_wait_timeout_basic.test index 43186c70874..43186c70874 100644 --- a/mysql-test/t/table_lock_wait_timeout_basic.test +++ b/mysql-test/suite/sys_vars/t/table_lock_wait_timeout_basic.test diff --git a/mysql-test/t/table_open_cache_basic.test b/mysql-test/suite/sys_vars/t/table_open_cache_basic.test index 23f60bde00a..23f60bde00a 100644 --- a/mysql-test/t/table_open_cache_basic.test +++ b/mysql-test/suite/sys_vars/t/table_open_cache_basic.test diff --git a/mysql-test/t/thread_cache_size_func.test b/mysql-test/suite/sys_vars/t/thread_cache_size_func.test index fe9f4242c0d..fe9f4242c0d 100644 --- a/mysql-test/t/thread_cache_size_func.test +++ b/mysql-test/suite/sys_vars/t/thread_cache_size_func.test diff --git a/mysql-test/t/thread_handling_basic.test b/mysql-test/suite/sys_vars/t/thread_handling_basic.test index bcad003ce93..bcad003ce93 100644 --- a/mysql-test/t/thread_handling_basic.test +++ b/mysql-test/suite/sys_vars/t/thread_handling_basic.test diff --git a/mysql-test/t/time_zone_basic.test b/mysql-test/suite/sys_vars/t/time_zone_basic.test index 32616e97534..32616e97534 100644 --- a/mysql-test/t/time_zone_basic.test +++ b/mysql-test/suite/sys_vars/t/time_zone_basic.test diff --git a/mysql-test/t/time_zone_func.test b/mysql-test/suite/sys_vars/t/time_zone_func.test index 1d9bc954d8a..1d9bc954d8a 100644 --- a/mysql-test/t/time_zone_func.test +++ b/mysql-test/suite/sys_vars/t/time_zone_func.test diff --git a/mysql-test/t/timed_mutexes_basic.test b/mysql-test/suite/sys_vars/t/timed_mutexes_basic.test index b0eb41afb49..b0eb41afb49 100644 --- a/mysql-test/t/timed_mutexes_basic.test +++ b/mysql-test/suite/sys_vars/t/timed_mutexes_basic.test diff --git a/mysql-test/t/timestamp_func.test b/mysql-test/suite/sys_vars/t/timestamp_func.test index e119f1b6253..e119f1b6253 100644 --- a/mysql-test/t/timestamp_func.test +++ b/mysql-test/suite/sys_vars/t/timestamp_func.test diff --git a/mysql-test/t/timestamp_sysdate_is_now_func-master.opt b/mysql-test/suite/sys_vars/t/timestamp_sysdate_is_now_func-master.opt index 97a58d28032..97a58d28032 100644 --- a/mysql-test/t/timestamp_sysdate_is_now_func-master.opt +++ b/mysql-test/suite/sys_vars/t/timestamp_sysdate_is_now_func-master.opt diff --git a/mysql-test/t/timestamp_sysdate_is_now_func.test b/mysql-test/suite/sys_vars/t/timestamp_sysdate_is_now_func.test index 7ca3b4cddac..7ca3b4cddac 100644 --- a/mysql-test/t/timestamp_sysdate_is_now_func.test +++ b/mysql-test/suite/sys_vars/t/timestamp_sysdate_is_now_func.test diff --git a/mysql-test/suite/sys_vars/inc/tmp_table_size_basic.inc b/mysql-test/suite/sys_vars/t/tmp_table_size_basic.test index 7f69bcd1f8c..c2ff51d50ca 100644 --- a/mysql-test/suite/sys_vars/inc/tmp_table_size_basic.inc +++ b/mysql-test/suite/sys_vars/t/tmp_table_size_basic.test @@ -1,27 +1,29 @@ -############## mysql-test\t\tmp_table_size_basic.test ######################### -# # -# Variable Name: tmp_table_size # -# Scope: GLOBAL | SESSION # -# Access Type: Dynamic # -# Data Type: numeric # -# Default Value: 33554432 # -# Range: 1024-4294967295 # -# # -# # -# Creation Date: 2008-02-13 # -# Author: Salman # -# # -# Description: Test Cases of Dynamic System Variable tmp_table_size # -# that checks the behavior of this variable in the following ways# -# * Default Value # -# * Valid & Invalid values # -# * Scope & Access method # -# * Data Integrity # -# # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html#option_mysqld_tmp_table_size # -# # -############################################################################### +########################### tmp_table_size_basic.test ########################## +# # +# Variable Name: tmp_table_size # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: system dependend # +# Range: 1024-system dependend # +# # +# # +# Creation Date: 2008-02-13 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable tmp_table_size # +# that checks the behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# Modified: 2008-12-04 HHunger # +# removed the differences between 64 and 32 bit platforms # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +################################################################################ --source include/load_sysvars.inc @@ -29,17 +31,12 @@ # START OF tmp_table_size TESTS # ############################################################## - ############################################################# # Save initial value # ############################################################# SET @start_global_value = @@global.tmp_table_size; -SELECT @start_global_value; SET @start_session_value = @@session.tmp_table_size; -SELECT @start_session_value; - ---echo 'Bug# 34876: This variable has invalid default value as compared to documentation'; --echo '#--------------------FN_DYNVARS_005_01-------------------------#' ############################################################## @@ -48,27 +45,19 @@ SELECT @start_session_value; SET @@global.tmp_table_size = 100; SET @@global.tmp_table_size = DEFAULT; -SELECT @@global.tmp_table_size; ---echo 'Bug# 34876: This variable has invalid default value as compared to documentation'; SET @@session.tmp_table_size = 200; SET @@session.tmp_table_size = DEFAULT; -SELECT @@session.tmp_table_size; ---echo 'Bug# 34876: This variable has invalid default value as compared to documentation'; - --echo '#--------------------FN_DYNVARS_005_02-------------------------#' ######################################################################## -# Check the DEFAULT value of tmp_table_size # +# Check the DEFAULT value of tmp_table_size # ######################################################################## +# The DEFAULT value is system dependend. +# Therefore we have only a plausibility check here +SELECT @@global.tmp_table_size >= 16777216; -SET @@global.tmp_table_size = DEFAULT; -SELECT @@global.tmp_table_size = 33554432; - -SET @@session.tmp_table_size = DEFAULT; -SELECT @@session.tmp_table_size = 33554432; - ---echo 'Bug# 34876: This variable has invalid default value as compared to documentation'; +SELECT @@session.tmp_table_size >= 16777216; --echo '#--------------------FN_DYNVARS_005_03-------------------------#' ######################################################################## @@ -87,11 +76,11 @@ SELECT @@global.tmp_table_size; ######################################################################### # Change the value of tmp_table_size to a valid value for SESSION Scope # ######################################################################### - + SET @@session.tmp_table_size = 1024; SELECT @@session.tmp_table_size; -SET @@session.tmp_table_size =4294967295; +SET @@session.tmp_table_size = 4294967295; SELECT @@session.tmp_table_size; SET @@session.tmp_table_size = 65535; SELECT @@session.tmp_table_size; @@ -111,37 +100,28 @@ SELECT @@global.tmp_table_size; SET @@global.tmp_table_size = 1000; SELECT @@global.tmp_table_size; ---echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; - - --- Error ER_WRONG_TYPE_FOR_VAR +--Error ER_WRONG_TYPE_FOR_VAR SET @@global.tmp_table_size = ON; - --- Error ER_WRONG_TYPE_FOR_VAR +--Error ER_WRONG_TYPE_FOR_VAR SET @@global.tmp_table_size = OFF; - SET @@global.tmp_table_size = True; SELECT @@global.tmp_table_size; SET @@global.tmp_table_size = False; SELECT @@global.tmp_table_size; ---echo 'Bug:Error should be shown that variable is numeric and can not assigned boolean value'; - --- Error ER_WRONG_TYPE_FOR_VAR +--Error ER_WRONG_TYPE_FOR_VAR SET @@global.tmp_table_size = 65530.34; --- Error ER_WRONG_TYPE_FOR_VAR +--Error ER_WRONG_TYPE_FOR_VAR SET @@global.tmp_table_size ="Test"; - --- Error ER_WRONG_TYPE_FOR_VAR +--Error ER_WRONG_TYPE_FOR_VAR SET @@session.tmp_table_size = ON; - --- Error ER_WRONG_TYPE_FOR_VAR +--Error ER_WRONG_TYPE_FOR_VAR SET @@session.tmp_table_size = OFF; SET @@session.tmp_table_size = True; @@ -150,21 +130,21 @@ SELECT @@session.tmp_table_size; SET @@session.tmp_table_size = False; SELECT @@session.tmp_table_size; --- Error ER_WRONG_TYPE_FOR_VAR +--Error ER_WRONG_TYPE_FOR_VAR SET @@session.tmp_table_size = "Test"; SET @@session.tmp_table_size = 12345678901; -SELECT @@session.tmp_table_size; +# With a 64 bit mysqld:12345678901,with a 32 bit mysqld: 4294967295 +SELECT @@session.tmp_table_size IN (12345678901,4294967295); --echo '#------------------FN_DYNVARS_005_06-----------------------#' #################################################################### # Check if the value in GLOBAL Table matches value in variable # #################################################################### - -SELECT @@global.tmp_table_size = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +SELECT @@global.tmp_table_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='tmp_table_size'; --echo '#------------------FN_DYNVARS_005_07-----------------------#' @@ -172,13 +152,10 @@ WHERE VARIABLE_NAME='tmp_table_size'; # Check if the value in SESSION Table matches value in variable # #################################################################### -SELECT @@session.tmp_table_size = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.SESSION_VARIABLES +SELECT @@session.tmp_table_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='tmp_table_size'; - - - --echo '#---------------------FN_DYNVARS_001_09----------------------#' ######################################################################## # Check if global and session variables are independent of each other # @@ -216,16 +193,12 @@ SELECT global.tmp_table_size; --Error ER_BAD_FIELD_ERROR SELECT tmp_table_size = @@session.tmp_table_size; - #################################### # Restore initial value # #################################### SET @@global.tmp_table_size = @start_global_value; -SELECT @@global.tmp_table_size; SET @@session.tmp_table_size = @start_session_value; -SELECT @@session.tmp_table_size; - ################################################### # END OF tmp_table_size TESTS # diff --git a/mysql-test/suite/sys_vars/t/tmp_table_size_basic_32.test b/mysql-test/suite/sys_vars/t/tmp_table_size_basic_32.test deleted file mode 100644 index c772b5c896c..00000000000 --- a/mysql-test/suite/sys_vars/t/tmp_table_size_basic_32.test +++ /dev/null @@ -1,9 +0,0 @@ -################################################################################ -# Created by Horst Hunger 2008-05-07 # -# # -# Wrapper for 32 bit machines # -################################################################################ - ---source include/have_32bit.inc ---source suite/sys_vars/inc/tmp_table_size_basic.inc - diff --git a/mysql-test/suite/sys_vars/t/tmp_table_size_basic_64.test b/mysql-test/suite/sys_vars/t/tmp_table_size_basic_64.test deleted file mode 100644 index 46b3f65be9a..00000000000 --- a/mysql-test/suite/sys_vars/t/tmp_table_size_basic_64.test +++ /dev/null @@ -1,9 +0,0 @@ -################################################################################ -# Created by Horst Hunger 2008-05-07 # -# # -# Wrapper for 64 bit machines # -################################################################################ - ---source include/have_64bit.inc ---source suite/sys_vars/inc/tmp_table_size_basic.inc - diff --git a/mysql-test/t/tmpdir_basic.test b/mysql-test/suite/sys_vars/t/tmpdir_basic.test index 5e9d08c4876..5e9d08c4876 100644 --- a/mysql-test/t/tmpdir_basic.test +++ b/mysql-test/suite/sys_vars/t/tmpdir_basic.test diff --git a/mysql-test/t/tx_isolation_basic.test b/mysql-test/suite/sys_vars/t/tx_isolation_basic.test index 136a9b4331e..136a9b4331e 100644 --- a/mysql-test/t/tx_isolation_basic.test +++ b/mysql-test/suite/sys_vars/t/tx_isolation_basic.test diff --git a/mysql-test/t/tx_isolation_func-master.opt b/mysql-test/suite/sys_vars/t/tx_isolation_func-master.opt index c15943a7544..c15943a7544 100644 --- a/mysql-test/t/tx_isolation_func-master.opt +++ b/mysql-test/suite/sys_vars/t/tx_isolation_func-master.opt diff --git a/mysql-test/t/tx_isolation_func.test b/mysql-test/suite/sys_vars/t/tx_isolation_func.test index 1fd2e323db8..1fd2e323db8 100644 --- a/mysql-test/t/tx_isolation_func.test +++ b/mysql-test/suite/sys_vars/t/tx_isolation_func.test diff --git a/mysql-test/t/unique_checks_basic.test b/mysql-test/suite/sys_vars/t/unique_checks_basic.test index 55308adcc82..55308adcc82 100644 --- a/mysql-test/t/unique_checks_basic.test +++ b/mysql-test/suite/sys_vars/t/unique_checks_basic.test diff --git a/mysql-test/t/updatable_views_with_limit_basic.test b/mysql-test/suite/sys_vars/t/updatable_views_with_limit_basic.test index 61a45793d39..61a45793d39 100644 --- a/mysql-test/t/updatable_views_with_limit_basic.test +++ b/mysql-test/suite/sys_vars/t/updatable_views_with_limit_basic.test diff --git a/mysql-test/t/updatable_views_with_limit_func.test b/mysql-test/suite/sys_vars/t/updatable_views_with_limit_func.test index 2e1a3f97346..2e1a3f97346 100644 --- a/mysql-test/t/updatable_views_with_limit_func.test +++ b/mysql-test/suite/sys_vars/t/updatable_views_with_limit_func.test diff --git a/mysql-test/t/version_basic.test b/mysql-test/suite/sys_vars/t/version_basic.test index 0a22713ca12..0a22713ca12 100644 --- a/mysql-test/t/version_basic.test +++ b/mysql-test/suite/sys_vars/t/version_basic.test diff --git a/mysql-test/t/version_comment_basic.test b/mysql-test/suite/sys_vars/t/version_comment_basic.test index 3ae6daa192a..3ae6daa192a 100644 --- a/mysql-test/t/version_comment_basic.test +++ b/mysql-test/suite/sys_vars/t/version_comment_basic.test diff --git a/mysql-test/t/version_compile_machine_basic.test b/mysql-test/suite/sys_vars/t/version_compile_machine_basic.test index 30742436068..30742436068 100644 --- a/mysql-test/t/version_compile_machine_basic.test +++ b/mysql-test/suite/sys_vars/t/version_compile_machine_basic.test diff --git a/mysql-test/t/version_compile_os_basic.test b/mysql-test/suite/sys_vars/t/version_compile_os_basic.test index 8858f248249..8858f248249 100644 --- a/mysql-test/t/version_compile_os_basic.test +++ b/mysql-test/suite/sys_vars/t/version_compile_os_basic.test diff --git a/mysql-test/t/wait_timeout_func.test b/mysql-test/suite/sys_vars/t/wait_timeout_func.test index 6b7c8d016d2..6b7c8d016d2 100644 --- a/mysql-test/t/wait_timeout_func.test +++ b/mysql-test/suite/sys_vars/t/wait_timeout_func.test diff --git a/mysql-test/t/warning_count_basic.test b/mysql-test/suite/sys_vars/t/warning_count_basic.test index 64539e28d5b..64539e28d5b 100644 --- a/mysql-test/t/warning_count_basic.test +++ b/mysql-test/suite/sys_vars/t/warning_count_basic.test diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index a5460c6defd..2498d566f66 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -751,6 +751,19 @@ ALTER TABLE t1 MODIFY COLUMN v VARCHAR(4); SELECT * FROM t1; DROP TABLE t1; + +# +# Bug#31291 ALTER TABLE CONVERT TO CHARACTER SET does not change some data types +# +create table t1 (a tinytext character set latin1); +alter table t1 convert to character set utf8; +show create table t1; +drop table t1; +create table t1 (a mediumtext character set latin1); +alter table t1 convert to character set utf8; +show create table t1; +drop table t1; + --echo End of 5.0 tests # diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test index b42c8446a32..7139d95ab49 100644 --- a/mysql-test/t/archive.test +++ b/mysql-test/t/archive.test @@ -1598,3 +1598,4 @@ CREATE TABLE t1(a INT NOT NULL AUTO_INCREMENT, b BLOB, KEY(a)) ENGINE=archive; INSERT INTO t1 VALUES (NULL, NULL),(NULL, NULL); FLUSH TABLE t1; SELECT * FROM t1 ORDER BY a; +DROP TABLE t1; diff --git a/mysql-test/t/backup.test b/mysql-test/t/backup.test index cdbf7b69615..61e80ec682e 100644 --- a/mysql-test/t/backup.test +++ b/mysql-test/t/backup.test @@ -1,6 +1,6 @@ # The server need to be started in $MYSQLTEST_VARDIR since it -# uses ../std_data_ln/ +# uses ../../std_data/ -- source include/uses_vardir.inc # @@ -16,41 +16,41 @@ drop table if exists t1, t2, t3, t4; --enable_warnings create table t4(n int); --replace_result ": 1" ": X" ": 2" ": X" ": 22" ": X" ": 23" ": X" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -backup table t4 to '../bogus'; -backup table t4 to '../tmp'; +backup table t4 to '../../bogus'; +backup table t4 to '../../tmp'; --replace_result ": 7" ": X" ": 17" ": X" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -backup table t4 to '../tmp'; +backup table t4 to '../../tmp'; drop table t4; -restore table t4 from '../tmp'; +restore table t4 from '../../tmp'; select count(*) from t4; create table t1(n int); insert into t1 values (23),(45),(67); -backup table t1 to '../tmp'; +backup table t1 to '../../tmp'; drop table t1; --replace_result ": 1" ": X" ": 2" ": X" ": 22" ": X" ": 23" ": X" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -restore table t1 from '../bogus'; -restore table t1 from '../tmp'; +restore table t1 from '../../bogus'; +restore table t1 from '../../tmp'; select n from t1; create table t2(m int not null primary key); create table t3(k int not null primary key); insert into t2 values (123),(145),(167); insert into t3 values (223),(245),(267); -backup table t2,t3 to '../tmp'; +backup table t2,t3 to '../../tmp'; drop table t1,t2,t3; -restore table t1,t2,t3 from '../tmp'; +restore table t1,t2,t3 from '../../tmp'; select n from t1; select m from t2; select k from t3; drop table t1,t2,t3,t4; -restore table t1 from '../tmp'; +restore table t1 from '../../tmp'; connection con2; rename table t1 to t5; --send lock tables t5 write; connection con1; --send -backup table t5 to '../tmp'; +backup table t5 to '../../tmp'; connection con2; reap; unlock tables; @@ -80,11 +80,11 @@ DROP TABLE IF EXISTS `t+1`; --enable_warnings CREATE TABLE `t+1` (c1 INT); INSERT INTO `t+1` VALUES (1), (2), (3); -BACKUP TABLE `t+1` TO '../tmp'; +BACKUP TABLE `t+1` TO '../../tmp'; DROP TABLE `t+1`; # # Same for restore. -RESTORE TABLE `t+1` FROM '../tmp'; +RESTORE TABLE `t+1` FROM '../../tmp'; SELECT * FROM `t+1`; DROP TABLE `t+1`; diff --git a/mysql-test/t/bootstrap.test b/mysql-test/t/bootstrap.test index a6871733c94..3b62887869d 100644 --- a/mysql-test/t/bootstrap.test +++ b/mysql-test/t/bootstrap.test @@ -5,6 +5,10 @@ drop table if exists t1; --enable_warnings +# Add the datadir to the bootstrap command +let $MYSQLD_DATADIR= `select @@datadir`; +let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR; + # # Check that --bootstrap reads from stdin # diff --git a/mysql-test/t/crash_commit_before.test b/mysql-test/t/crash_commit_before.test index 4e212d81e66..e3dba58d4df 100644 --- a/mysql-test/t/crash_commit_before.test +++ b/mysql-test/t/crash_commit_before.test @@ -15,7 +15,7 @@ insert into t1 values(9); SET SESSION debug="d,crash_commit_before"; # Write file to make mysql-test-run.pl expect crash and restart ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/master0.expect +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect # Run the crashing query --error 2013 diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index bcbd507bcdd..0412bc0628c 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -1420,6 +1420,7 @@ SHOW CREATE TABLE t2; --echo DROP TABLE t2; +DROP TABLE t1; --echo --echo # -- End of test case for Bug#21380. @@ -1534,5 +1535,11 @@ DROP TABLE t1; ########################################################################### +# +# Bug#40104 regression with table names? +# +create table `me:i`(id int); +drop table `me:i`; + --echo --echo End of 5.1 tests diff --git a/mysql-test/t/create_not_windows.test b/mysql-test/t/create_not_windows.test index 56b4002106d..b612e31e3aa 100644 --- a/mysql-test/t/create_not_windows.test +++ b/mysql-test/t/create_not_windows.test @@ -29,7 +29,8 @@ drop table if exists t1; --enable_warnings create table t1(a int) engine=myisam; insert into t1 values(1); ---system rm -f $MYSQLTEST_VARDIR/master-data/test/t1.frm +let $MYSQLD_DATADIR= `select @@datadir`; +remove_file $MYSQLD_DATADIR/test/t1.frm; --echo "We get an error because the table is in the definition cache" --error ER_TABLE_EXISTS_ERROR create table t1(a int, b int); diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test index ac628f96a0f..abc161d014c 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -1409,7 +1409,8 @@ DROP TABLE test_repair_table; # CREATE TABLE test_repair_table2 ( val integer not null ) ENGINE = CSV; ---remove_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table2.CSM +let $MYSQLD_DATADIR= `select @@datadir`; +--remove_file $MYSQLD_DATADIR/test/test_repair_table2.CSM # Should give a warning and perform autorepair. We also disable ps-protocol # here, as mysql-test eats up warnings in ps-protocol mode @@ -1420,15 +1421,15 @@ SELECT * from test_repair_table2; # this should work ok, as the table is already repaired SELECT * from test_repair_table2; # check that the metafile appeared again. ---file_exists $MYSQLTEST_VARDIR/master-data/test/test_repair_table2.CSM +--file_exists $MYSQLD_DATADIR/test/test_repair_table2.CSM CHECK TABLE test_repair_table2; DROP TABLE test_repair_table2; # Corrupt csv file and see if we can repair it CREATE TABLE test_repair_table3 ( val integer not null ) ENGINE = CSV; ---remove_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table3.CSV ---write_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table3.CSV +--remove_file $MYSQLD_DATADIR/test/test_repair_table3.CSV +--write_file $MYSQLD_DATADIR/test/test_repair_table3.CSV "1" "4" "3 @@ -1447,7 +1448,7 @@ CREATE TABLE test_repair_table4 ( founded char(4) DEFAULT '' NOT NULL ) ENGINE = CSV; ---remove_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table4.CSM +--remove_file $MYSQLD_DATADIR/test/test_repair_table4.CSM --disable_ps_protocol SELECT * FROM test_repair_table4; --enable_ps_protocol @@ -1480,8 +1481,8 @@ CREATE TABLE test_repair_table5 ( ) ENGINE = CSV; # Corrupt a table -- put a file with wrong # of columns ---remove_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table5.CSV ---write_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table5.CSV +--remove_file $MYSQLD_DATADIR/test/test_repair_table5.CSV +--write_file $MYSQLD_DATADIR/test/test_repair_table5.CSV "1","101","IBM" EOF @@ -1492,7 +1493,7 @@ INSERT INTO test_repair_table5 VALUES (1, 102, "CORRECT", 1876); SELECT * FROM test_repair_table5; # Corrupt a table -- put a row with wrong # of columns at end of file ---append_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table5.CSV +--append_file $MYSQLD_DATADIR/test/test_repair_table5.CSV "1","101","IBM" EOF @@ -1505,7 +1506,7 @@ INSERT INTO test_repair_table5 VALUES (1, 102, "CORRECT2", 1876); SELECT * FROM test_repair_table5; # Corrupt table again -- put a row with wrong # of columns at end of file ---append_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table5.CSV +--append_file $MYSQLD_DATADIR/test/test_repair_table5.CSV "1","101","IBM" EOF @@ -1588,14 +1589,14 @@ drop table t1; create table bug15205 (val int(11) not null) engine=csv; create table bug15205_2 (val int(11) not null) engine=csv; ---remove_file $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV +--remove_file $MYSQLD_DATADIR/test/bug15205.CSV # system error (can't open the datafile) ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' --error 13 select * from bug15205; select * from bug15205_2; # Create empty file ---write_file $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV +--write_file $MYSQLD_DATADIR/test/bug15205.CSV EOF select * from bug15205; drop table bug15205; @@ -1634,16 +1635,16 @@ insert into bug22080_1 values(2,'string'); insert into bug22080_1 values(3,'string'); # Create first corrupt file as described in bug report ---remove_file $MYSQLTEST_VARDIR/master-data/test/bug22080_2.CSV ---write_file $MYSQLTEST_VARDIR/master-data/test/bug22080_2.CSV +--remove_file $MYSQLD_DATADIR/test/bug22080_2.CSV +--write_file $MYSQLD_DATADIR/test/bug22080_2.CSV 1,"string" 2","string" 3,"string" EOF # Create second corrupt file as described in bug report ---remove_file $MYSQLTEST_VARDIR/master-data/test/bug22080_3.CSV ---write_file $MYSQLTEST_VARDIR/master-data/test/bug22080_3.CSV +--remove_file $MYSQLD_DATADIR/test/bug22080_3.CSV +--write_file $MYSQLD_DATADIR/test/bug22080_3.CSV 1,"string" "2",string" 3,"string" @@ -1703,8 +1704,8 @@ check table t1; drop table t1; create table t1(a int not null, b int not null) engine=csv; ---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.CSV ---write_file $MYSQLTEST_VARDIR/master-data/test/t1.CSV +--remove_file $MYSQLD_DATADIR/test/t1.CSV +--write_file $MYSQLD_DATADIR/test/t1.CSV 1, 1E-2 -2E2, .9 -10E-1, -.9 @@ -1794,8 +1795,8 @@ create table t1 (a int not null) engine=csv; lock tables t1 read; connect (con1,localhost,root,,); --connection con1 ---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.CSV ---replace_result $MYSQLTEST_VARDIR . master-data/ '' 13 2 +--remove_file $MYSQLD_DATADIR/test/t1.CSV +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR/ ./ MYSQLD_DATADIR/ 13 2 # EE_FILENOTFOUND 29 --error 29 select * from t1; @@ -1804,4 +1805,17 @@ unlock tables; drop table t1; --disconnect con1 +# +# Bug#41441 repair csv table crashes debug server +# +# Note: The test should be removed after Bug#33717 is fixed + +create table t1(a enum ('a') not null) engine=csv; +insert into t1 values (2); +--error ER_CRASHED_ON_USAGE +select * from t1 limit 1; +repair table t1; +select * from t1 limit 1; +drop table t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test index 5a8a13f2bad..a75fd917052 100644 --- a/mysql-test/t/ctype_big5.test +++ b/mysql-test/t/ctype_big5.test @@ -75,12 +75,12 @@ create table t1 (a blob); insert into t1 values (0xEE00); select * into outfile 'test/t1.txt' from t1; delete from t1; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---eval select hex(load_file('$MYSQLTEST_VARDIR/master-data/test/t1.txt')); +let $MYSQLD_DATADIR= `select @@datadir`; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--eval select hex(load_file('$MYSQLD_DATADIR/test/t1.txt')); load data infile 't1.txt' into table t1; select hex(a) from t1; ---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.txt - +--remove_file $MYSQLD_DATADIR/test/t1.txt drop table t1; --echo End of 5.0 tests diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index cb371bc0ca6..e247110658b 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -697,4 +697,29 @@ set names latin1; # select hex(char(0x41 using ucs2)); +# +# Bug#37575: UCASE fails on monthname +# +SET character_set_connection=ucs2; +SELECT CHARSET(DAYNAME(19700101)); +SELECT CHARSET(MONTHNAME(19700101)); +SELECT LOWER(DAYNAME(19700101)); +SELECT LOWER(MONTHNAME(19700101)); +SELECT UPPER(DAYNAME(19700101)); +SELECT UPPER(MONTHNAME(19700101)); +SELECT HEX(MONTHNAME(19700101)); +SELECT HEX(DAYNAME(19700101)); +SET LC_TIME_NAMES=ru_RU; +SET NAMES utf8; +SET character_set_connection=ucs2; +SELECT CHARSET(DAYNAME(19700101)); +SELECT CHARSET(MONTHNAME(19700101)); +SELECT LOWER(DAYNAME(19700101)); +SELECT LOWER(MONTHNAME(19700101)); +SELECT UPPER(DAYNAME(19700101)); +SELECT UPPER(MONTHNAME(19700101)); +SELECT HEX(MONTHNAME(19700101)); +SELECT HEX(DAYNAME(19700101)); +SET character_set_connection=latin1; + --echo End of 5.0 tests diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test index abf09942d1c..e474fac8a2a 100644 --- a/mysql-test/t/date_formats.test +++ b/mysql-test/t/date_formats.test @@ -340,3 +340,15 @@ select str_to_date('04/30 /2004', '%m /%d /%Y'); select str_to_date('04/30/2004 ', '%m/%d/%Y '); --echo "End of 4.1 tests" + +# +# Bug #41470: DATE_FORMAT() crashes the complete server with a valid date +# + +# show that these two do not crash the server: +SELECT DATE_FORMAT("0000-01-01",'%W %d %M %Y') as valid_date; +SELECT DATE_FORMAT("0000-02-28",'%W %d %M %Y') as valid_date; +# show that date within the Gregorian range render correct results: (THU) +SELECT DATE_FORMAT("2009-01-01",'%W %d %M %Y') as valid_date; + +--echo "End of 5.0 tests" diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 5de0a435ba5..118efb6f7ed 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -9,7 +9,18 @@ # Do not use any TAB characters for whitespace. # ############################################################################## +delayed_insert_limit_func : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions +event_scheduler_func : BUG#37962, BUG#40816 2008-07-08 sven *_func tests containing sleeps/race conditions +interactive_timeout_func : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions +query_cache_wlock_invalidate_func : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions +rpl_init_slave_func : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions +rpl_max_binlog_size_func : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions +slow_query_log_func : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions +sql_low_priority_updates_func : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions +timestamp_func : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions +innodb_max_dirty_pages_pct_func : BUG#41018 BUG#39382 2008-12-02 sven test fails often. some failures fill up the disk, causing subsequent failures in many other tests federated_transactions : Bug#29523 Transactions do not work -log_tables.test : Bug #37798: main.log_tables fails randomly on powermacg5 and windows -slow_query_log_func.test : Bug #37962: *_func tests containing sleeps/race conditions wait_timeout_func : Bug #41225 joro wait_timeout_func fails +kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild. +query_cache_28249 : Bug#41098 Query Cache returns wrong result with concurrent insert +innodb_bug39438 : BUG#42383 2009-01-28 lsoares "This fails in embedded and on windows. Note that this test is not run on windows and on embedded in PB for main trees currently" diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test index 5be8d911881..a77d1136840 100644 --- a/mysql-test/t/distinct.test +++ b/mysql-test/t/distinct.test @@ -440,7 +440,6 @@ SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a; DROP TABLE t1; #Bug #20836: Selecting into variables results in wrong results being returned - --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings @@ -488,14 +487,14 @@ CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20) default NULL); SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE -'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE'; -LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2; +'../../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE'; +LOAD DATA INFILE '../../tmp/data1.tmp' INTO TABLE t2; --error 0,1 --remove_file $MYSQLTEST_VARDIR/tmp/data1.tmp SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE -'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE'; -LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2; +'../../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE'; +LOAD DATA INFILE '../../tmp/data2.tmp' INTO TABLE t2; --remove_file $MYSQLTEST_VARDIR/tmp/data2.tmp SELECT @v19, @v20; diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test index 2c490b51afc..4f0777922b8 100644 --- a/mysql-test/t/drop.test +++ b/mysql-test/t/drop.test @@ -131,7 +131,8 @@ create table mysql_test.t1(f1 int); create table mysql_test.`#sql-347f_7` (f1 int); create table mysql_test.`#sql-347f_8` (f1 int); drop table mysql_test.`#sql-347f_8`; -copy_file $MYSQLTEST_VARDIR/master-data/mysql_test/t1.frm $MYSQLTEST_VARDIR/master-data/mysql_test/#sql-347f_6.frm; +let $MYSQLD_DATADIR= `select @@datadir`; +copy_file $MYSQLD_DATADIR/mysql_test/t1.frm $MYSQLD_DATADIR/mysql_test/#sql-347f_6.frm; drop database mysql_test; ########################################################################### @@ -148,17 +149,18 @@ DROP DATABASE IF EXISTS mysql_test; CREATE DATABASE mysql_test; ---copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/bug29958.proc.frm ---copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYD ---copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYI +let $MYSQLD_DATADIR= `select @@datadir`; +--copy_file $MYSQLD_DATADIR/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/bug29958.proc.frm +--copy_file $MYSQLD_DATADIR/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYD +--copy_file $MYSQLD_DATADIR/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYI DROP TABLE mysql.proc; DROP DATABASE mysql_test; ---copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.frm $MYSQLTEST_VARDIR/master-data/mysql/proc.frm ---copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYD $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD ---copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYI $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI +--copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.frm $MYSQLD_DATADIR/mysql/proc.frm +--copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYD $MYSQLD_DATADIR/mysql/proc.MYD +--copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYI $MYSQLD_DATADIR/mysql/proc.MYI --echo --echo # -- diff --git a/mysql-test/t/error_simulation-master.opt b/mysql-test/t/error_simulation-master.opt deleted file mode 100644 index edb77cfa85e..00000000000 --- a/mysql-test/t/error_simulation-master.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-debug=d,raise_error diff --git a/mysql-test/t/error_simulation.test b/mysql-test/t/error_simulation.test index 2f6ea5eac87..f730c95208e 100644 --- a/mysql-test/t/error_simulation.test +++ b/mysql-test/t/error_simulation.test @@ -21,10 +21,15 @@ INSERT INTO t1 VALUES set tmp_table_size=1024; +# Set debug flag so an error is returned when +# tmp table in query is converted from heap to myisam +set session debug="d,raise_error"; + --replace_regex /in table '[^']+'/in table 'tmp_table'/ --error ER_DUP_KEY SELECT MAX(a) FROM t1 GROUP BY a,b; set tmp_table_size=default; - DROP TABLE t1; + + diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test index e86734c167c..69e2f681aa2 100644 --- a/mysql-test/t/events_bugs.test +++ b/mysql-test/t/events_bugs.test @@ -1,40 +1,133 @@ #### t/events_bugs.test # # Last change: -# 2008-10-16 mleich +# 2009-01-08 mleich # - Fix for -# Bug#39848 events_bugs fails sporadically on pushbuild -# (missing rows in table event_log) -# Bug#39863 events_bugs fails sporadically on pushbuild (extra processes -# in I_S.PROCESSLIST) -# Bug#39978 main.events_bugs does not clean up -# Bug#39569 events_bugs fails sporadically on pushbuild (should have -# failed with errno 1539) -# - Minor improvements of formatting -# -# -# Outcome of some experiments (mleich): -# 1. SET GLOBAL event_scheduler = 'ON'; -# Immediate observation of the processlist. -# Effects: -# 1. There is no guarantee to find immediate the user 'event_scheduler' -# within information_schema.processlist. -# 2. Some states of the user 'event_scheduler' found in PROCESSLIST: -# USER HOST DB COMMAND TIME STATE INFO -# event_scheduler localhost NULL Daemon 0 Waiting on empty queue NULL -# event_scheduler localhost NULL Daemon 0 Initialized NULL +# Bug#41111 events_bugs fails sporadically on pushbuild +# - Avoid effects of +# Bug#41925 Warning 1366 Incorrect string value: ... for column processlist.info +# +# Please set $ +let $fixed_bug41925= 0; +# +# Dear maintainer of this test. Please do NOT remove the next big comment. +# The tests for events were quite unstable over a significant time because the +# effects of events in general and their representation within the processlist +# were partially not known. Therefore I had to make excessive experiments. +# The comment with the outcome of these experiments will be moved into a README +# file as soon as the tests for events get their own testsuite. +# +# Outcome of some experiments (mleich, mysql-5.1 2008-12): +# -------------------------------------------------------- +# 0. Most time used setup: +# High parallel I/O load +# set global event_scheduler= off; +# sleep 3; +# use events_test; +# create event e_16407 on schedule every 2 second do +# begin +# select 'FIRST COMMAND', sleep(0.5); +# select 'SECOND COMMAND'; +# end| +# set global event_scheduler= on; +# Start observation of the processlist +# +# +# 1. SET GLOBAL event_scheduler = 'ON' and immediate observation of the processlist. +# 1.1 Effects around event scheduler: +# 1.1.1 First phase (very short) +# No user 'event_scheduler' within information_schema.processlist. +# 1.1.2 Second phase observed (independend of probably existing events and very short) was +# USER HOST DB COMMAND TIME STATE INFO +# event_scheduler localhost NULL Daemon 0 Initialized NULL +# 1.1.3 Third phase observed: +# 1.1.3.1 Case we do not have existing events (rather long) +# USER HOST DB COMMAND TIME STATE INFO +# event_scheduler localhost NULL Daemon 0 Waiting on empty queue NULL +# 1.1.3.2 Case there exists already an event +# 1.1.3.2.1 Event executor is not visible in processlist but comes up soon +# USER HOST DB COMMAND TIME STATE INFO +# event_scheduler localhost NULL Daemon 0 NULL +# or +# event_scheduler localhost NULL Daemon 0 NULL NULL +# 1.1.3.2.2 A bit later, at least one event executor is or was visible in processlist +# The states mentioned in 3.2.1 or a bit later +# USER HOST DB COMMAND TIME STATE INFO +# event_scheduler localhost NULL Daemon 0 Waiting for next activation NULL +# 1.2 Effects around event executor: +# Typical processlist content: +# USER evtest1 -- Definer of event +# DB events_test -- DB during time of event creation (use DB is not allowed in events) +# COMMAND Connect +# STATE NULL +# INFO SET @evname = 'ev_sched_1823' -- Part of the event code +# +# State before "User sleep select 'FIRST COMMAND', sleep(0.5);" +# ID USER HOST DB COMMAND TIME STATE INFO +# 7 event_scheduler localhost NULL Connect 0 NULL NULL +# !! The user is not the event creator and the DB is different. !! +# !! This means that we must get later a change of the identity. !! +# or +# USER HOST DB COMMAND TIME STATE INFO +# root localhost events_test Connect 0 checking permissions +# or +# USER HOST DB COMMAND TIME STATE INFO +# root localhost events_test Connect 0 checking permissions CREATE PROCEDURE .... +# or +# USER HOST DB COMMAND TIME STATE INFO +# root localhost events_test Connect 0 NULL select 'FIRST COMMAND', sleep(0.5) +# or +# USER HOST DB COMMAND TIME STATE INFO +# root localhost events_test Connect 0 checking permissions select 'FIRST COMMAND'... +# or +# USER HOST DB COMMAND TIME STATE INFO +# root localhost events_test Connect 0 Opening table select 'FIRST COMMAND', sleep(0.5) +# or +# USER HOST DB COMMAND TIME STATE INFO +# root localhost events_test Connect 0 Locked select 'FIRST COMMAND', sleep(0.5) +# or +# USER HOST DB COMMAND TIME STATE INFO +# root localhost events_test Connect 0 executing select 'FIRST COMMAND', sleep(0.5) +# +# State "User sleep select 'FIRST COMMAND', sleep(0.5);" reached +# USER HOST DB COMMAND TIME STATE INFO +# root localhost events_test Connect 0 User sleep select 'FIRST COMMAND', sleep(0.5) +# +# State at end (! It looks like a slow CREATE PROC !) of event code execution was sometimes +# USER HOST DB COMMAND TIME STATE INFO +# root localhost events_test Connect 0 logging slow query CREATE PROCEDURE `e_16407`... +# +# State after running some event code was sometimes +# USER HOST DB COMMAND TIME STATE INFO +# root localhost events_test Connect 0 logging slow query select 'SECOND COMMAND' +# +# State somewhere (I guess just before the event executor disappears) +# USER HOST DB COMMAND TIME STATE INFO +# Event thread fin <empty> events_test Connect 0 Clearing NULL +# +# # 2. SET GLOBAL event_scheduler = 'OFF'; # Immediate observation of the processlist. # Effects: # 1. I never found the user 'event_scheduler' within the processlist. # 2. Events just during execution could be found within the processlist # = It does not look like "SET GLOBAL event_scheduler = 'OFF'" stops them. -# 3. An event gets executed -# USER evtest1 (Definer of event) -# DB events_test (DB during time of event creation) -# COMMAND Connect -# STATE NULL -# INFO SET @evname = 'ev_sched_1823' (Part of the event code) +# ==> Everything mentioned in 1.2 above could be observed. +# +# Several subtests were weak because they showed random result set differences after issuing +# "SET GLOBAL EVENT_SCHEDULER= off;". +# 1. Reason one: There were already event executors +# Fix: Wait till there is no event executor active ==> no session WHERE +# - command IN ('Connect') +# There must be no parallel session being just in "Connect" phase! +# or +# - user = <who created the maybe current running events> +# There must be no parallel session of this person. +# or user = 'event_scheduler' with command = 'Connect' +# The session which will soon change its identity to event creator. +# +# 2. Reason two: If an event modifies a MyISAM table than a delayed visibilty of changes +# might occur (concurrent_inserts=on or delayed inserts ...). # # Can't test with embedded server that doesn't support grants @@ -47,6 +140,10 @@ drop database if exists mysqltest_db2; --enable_warnings create database events_test; use events_test; +# We use MyISAM tables and must avoid effects (visibility of changes might be +# delayed) caused by concurrent_insert on (default). +set @concurrent_insert= @@global.concurrent_insert; +set @@global.concurrent_insert = 0; # # START: Bug #31332 --event-scheduler option misbehaving @@ -56,8 +153,11 @@ use events_test; # option with no argument in events_bugs-master.opt turns the scheduler on. select * from information_schema.global_variables where variable_name like 'event_scheduler'; +# Check that the event_scheduler is really running +--source include/running_event_scheduler.inc SET GLOBAL event_scheduler = 'OFF'; +--source include/check_events_off.inc # # END: Bug #31332 @@ -132,8 +232,10 @@ create event e_55 on schedule every 10 hour starts 10000101000000 do drop table # Start - 16407: Events: Changes in sql_mode won't be taken into account # set global event_scheduler=off; +--source include/check_events_off.inc delete from mysql.event; set global event_scheduler= on; +--source include/running_event_scheduler.inc set @old_sql_mode:=@@sql_mode; set sql_mode=ansi; select get_lock('test_bug16407', 60); @@ -148,13 +250,13 @@ delimiter ;| # We wait till one event runs and hangs when trying to get the user lock. let $wait_condition= select count(*) > 0 from information_schema.processlist - where info = 'select get_lock(\'test_bug16407\', 60)'; + where state = 'User lock' and info = 'select get_lock(\'test_bug16407\', 60)'; --source include/wait_condition.inc --echo "Now if everything is fine the event has compiled and is locked" # Expect to see one session in events_test waiting for the user lock. select /*1*/ user, host, db, info from information_schema.processlist -where info = 'select get_lock(\'test_bug16407\', 60)'; +where state = 'User lock' and info = 'select get_lock(\'test_bug16407\', 60)'; select release_lock('test_bug16407'); # Try to avoid # Bug#39863 events_bugs fails sporadically on pushbuild (extra processes in I_S.PROCESSLIST) @@ -162,23 +264,27 @@ select release_lock('test_bug16407'); # Bug#32782 User lock hash fails to find lock # "various issues related to missing or incorrect return results # from release_lock()." -# Therefore we check here if the event executing session disappeared or +# Therefore we check here if the event executor is no more locked or # we waited >= 5 seconds for this to happen. let $wait_timeout= 5; let $wait_condition= select count(*) = 0 from information_schema.processlist - where info = 'select get_lock(\'test_bug16407\', 60)'; + where state = 'User lock' and info = 'select get_lock(\'test_bug16407\', 60)'; --source include/wait_condition.inc if (!`$wait_condition`) { - --echo ERROR: There must be no session with info = 'select get_lock('test_bug16407', 60) within the processlist. + --echo ERROR: There must be no session with + --echo state = 'User lock' and info = 'select get_lock('test_bug16407', 60) + --echo within the processlist. --echo We probably hit Bug#32782 User lock hash fails to find lock - eval select * from information_schema.processlist; + SELECT * FROM information_schema.processlist; --echo Abort exit; } set global event_scheduler= off; +# Wait till the event scheduler and all event executors have finished their work. +--source include/check_events_off.inc select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name; --echo "Let's check whether we change the sql_mode on ALTER EVENT" @@ -191,9 +297,10 @@ set sql_mode="ansi"; select get_lock('ee_16407_2', 60); set global event_scheduler= 1; +--source include/running_event_scheduler.inc --echo "Another sql_mode test" set sql_mode="traditional"; -create table events_smode_test(ev_name char(10), a date) engine=myisam; +create table events_smode_test(ev_name char(10), a date); --echo "This should never insert something" delimiter |; create event ee_16407_2 on schedule every 60 second do @@ -203,7 +310,7 @@ begin insert into events_test.events_smode_test values('ee_16407_2','1980-19-02'); end| --error ER_TRUNCATED_WRONG_VALUE -insert into events_smode_test values ('test','1980-19-02')| +insert into events_test.events_smode_test values ('test','1980-19-02')| --echo "This is ok" create event ee_16407_3 on schedule every 60 second do begin @@ -223,13 +330,20 @@ end| delimiter ;| select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name; +# We wait till we have three event executors waiting for the removal of the lock. let $wait_condition= select count(*) = 3 from information_schema.processlist - where info = 'select get_lock(\'ee_16407_2\', 60)'; + where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)'; --source include/wait_condition.inc +# There is an extreme low risk that an additional event execution is just coming +# up because +# - the events have to be started every 60 seconds. +# - we are just after event creation + waiting for seeing 3 locked +# We expect to see three event executors in state 'User lock'. select /*2*/ user, host, db, info from information_schema.processlist -where info = 'select get_lock(\'ee_16407_2\', 60)'; +where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)'; + select release_lock('ee_16407_2'); # Try to avoid @@ -244,13 +358,37 @@ let $wait_timeout= 5; let $wait_condition= select count(*) = 0 from information_schema.processlist - where info = 'select get_lock(\'ee_16407_2\', 60)'; + where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)'; --source include/wait_condition.inc +if (!`$wait_condition`) +{ + --echo ERROR: There must be no session with + --echo state = 'User lock' and info = 'select get_lock('test_bug16407_2', 60) + --echo within the processlist. + --echo We probably hit Bug#32782 User lock hash fails to find lock + SELECT * FROM information_schema.processlist; + --echo Abort + exit; +} +# We expect to see no event executors in state 'User lock'. +if(!$fixed_bug41925) +{ + --disable_warnings +} select /*3*/ user, host, db, info from information_schema.processlist -where info = 'select get_lock(\'ee_16407_2\', 60)'; +where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)'; +if(!$fixed_bug41925) +{ + --enable_warnings +} + set global event_scheduler= off; -select * from events_smode_test order by ev_name, a; +# Wait till the event scheduler and all event executors have finished their work. +# Without this the next queries will give unstable results. +--source include/check_events_off.inc + +select * from events_test.events_smode_test order by ev_name, a; --echo "OK, last check before we drop them" select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name; drop event ee_16407_2; @@ -259,11 +397,12 @@ drop event ee_16407_4; --echo "And now one last test regarding sql_mode and call of SP from an event" -delete from events_smode_test; +delete from events_test.events_smode_test; set sql_mode='ansi'; select get_lock('ee_16407_5', 60); set global event_scheduler= on; +--source include/running_event_scheduler.inc set sql_mode='traditional'; delimiter |; @@ -286,34 +425,46 @@ delimiter ;| let $wait_condition= select count(*) = 2 from information_schema.processlist - where info = 'select get_lock(\'ee_16407_5\', 60)'; + where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)'; --source include/wait_condition.inc --echo "Should have 2 locked processes" select /*4*/ user, host, db, info from information_schema.processlist -where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') -order by info; +where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)'; + select release_lock('ee_16407_5'); let $wait_condition= - select count(*) = 1 and user = 'event_scheduler' and info is null - from information_schema.processlist - where (command!='Daemon' || user='event_scheduler') - and (info is null or info not like '%processlist%'); + select count(*) = 0 from information_schema.processlist + where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)'; --source include/wait_condition.inc --echo "Should have 0 processes locked" +if(!$fixed_bug41925) +{ + --disable_warnings +} select /*5*/ user, host, db, info from information_schema.processlist -where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') -order by info; -select * from events_smode_test order by ev_name, a; +where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)'; +if(!$fixed_bug41925) +{ + --enable_warnings +} + +# Wait till all event executors have finished their work, so that we can be sure +# that their changes to events_smode_test are done. +--source include/no_running_events.inc + +select * from events_test.events_smode_test order by ev_name, a; --echo "And here we check one more time before we drop the events" select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name; + drop event ee_16407_5; drop event ee_16407_6; drop procedure ee_16407_5_pendant; drop procedure ee_16407_6_pendant; set global event_scheduler= off; +--source include/check_events_off.inc drop table events_smode_test; set sql_mode=@old_sql_mode; # @@ -324,6 +475,7 @@ set sql_mode=@old_sql_mode; # START - 18897: Events: unauthorized action possible with alter event rename # set global event_scheduler=off; +--source include/check_events_off.inc --disable_warnings delete from mysql.user where User like 'mysqltest_%'; delete from mysql.db where User like 'mysqltest_%'; @@ -409,6 +561,7 @@ create function f22830 () returns int return 5; select get_lock('ee_22830', 60); set global event_scheduler=on; +--source include/running_event_scheduler.inc delimiter |; create procedure p22830_wait() @@ -456,6 +609,7 @@ let $wait_condition= --source include/wait_condition.inc set global event_scheduler=off; +--source include/check_events_off.inc select event_name, event_definition, interval_value, interval_field from information_schema.events order by event_name; drop procedure p22830_wait; drop function f22830; @@ -537,6 +691,7 @@ DROP USER mysqltest_u1@localhost; # For the actual tests of time zones please see events_time_zone.test # SET GLOBAL EVENT_SCHEDULER= OFF; +--source include/check_events_off.inc SET @save_time_zone= @@TIME_ZONE; #---------------------------------------------------------------------- @@ -749,6 +904,7 @@ let $engine=MyISAM; USE test; SHOW GRANTS FOR CURRENT_USER; SET GLOBAL event_scheduler = ON; +--source include/running_event_scheduler.inc eval CREATE TABLE events_test.event_log (id int KEY AUTO_INCREMENT, ev_nm char(40), ev_cnt int, ev_tm timestamp) @@ -817,12 +973,14 @@ disconnect e1; DROP EVENT events_test.ev_sched_1823; DROP TABLE events_test.event_log; SET GLOBAL event_scheduler = OFF; +--source include/check_events_off.inc # # Bug#28641 CREATE EVENT with '2038.01.18 03:00:00' let server crash. # SET GLOBAL event_scheduler= ON; +--source include/running_event_scheduler.inc DELIMITER |; CREATE EVENT bug28641 ON SCHEDULE AT '2038.01.18 03:00:00' DO BEGIN @@ -831,6 +989,7 @@ END;| DELIMITER ;| SET GLOBAL event_scheduler= OFF; +--source include/check_events_off.inc DROP EVENT bug28641; ########################################################################### @@ -955,6 +1114,7 @@ SET GLOBAL READ_ONLY = 1; --echo SET GLOBAL EVENT_SCHEDULER = ON; +--source include/running_event_scheduler.inc --echo @@ -980,6 +1140,7 @@ let $wait_condition = --echo SET GLOBAL EVENT_SCHEDULER = OFF; +--source include/check_events_off.inc --echo @@ -1056,14 +1217,15 @@ drop event e1; # ########################################################################### -let $wait_condition= - select count(*) = 0 from information_schema.processlist - where db='events_test' and command = 'Connect' and user=current_user(); ---source include/wait_condition.inc +# Ensure that all event executors have finished their work and cannot harm +# the next test. +--source include/no_running_events.inc DROP DATABASE events_test; -# Restore the original state (option with no argument in events_bugs-master.opt -# turns the scheduler on). -SET GLOBAL event_scheduler = 'ON'; +# Restore the original state i.e to how it was when test started +# (option with no argument in events_bugs-master.opt turns the scheduler on). +SET GLOBAL event_scheduler= 'ON'; +--source include/running_event_scheduler.inc +SET @@global.concurrent_insert= @concurrent_insert; # THIS MUST BE THE LAST LINE in this file. diff --git a/mysql-test/t/events_restart-master.opt b/mysql-test/t/events_restart-master.opt new file mode 100644 index 00000000000..f93413a61e5 --- /dev/null +++ b/mysql-test/t/events_restart-master.opt @@ -0,0 +1 @@ +--event-scheduler diff --git a/mysql-test/t/events_restart.test b/mysql-test/t/events_restart.test new file mode 100644 index 00000000000..e155fe2ea16 --- /dev/null +++ b/mysql-test/t/events_restart.test @@ -0,0 +1,106 @@ +# Can't test with embedded server that doesn't support grants +-- source include/not_embedded.inc + +# +# Test that when the server is restarted, it checks mysql.event table, +# and disables the scheduler if it's not up to date. +# + +# Switch off the scheduler for now. +set global event_scheduler=off; + +--disable_warnings +drop database if exists events_test; +--enable_warnings +create database events_test; +use events_test; +create table execution_log(name char(10)); + +create event abc1 on schedule every 1 second do + insert into execution_log value('abc1'); +create event abc2 on schedule every 1 second do + insert into execution_log value('abc2'); +create event abc3 on schedule every 1 second do + insert into execution_log value('abc3'); +# +# There are various conditions when a server would regard mysql.event +# table as damaged: +# - the table has more column than specified in the compiled in value, but +# the version of the server which created the table is the same +# - the column count in the table is less than the compiled in value +# - some column has an incompatible type specification (for what is an +# incompatible type specification please refer to the comments in the source +# +# Unfortunately, in order to test a condition, we need to restart the +# server. Therefore, here we test only one simple case: changing the data +# type of the 'body' field to blob. +# +# First, let's do a backup to not depend on actual definition of mysql.event +create table event_like like mysql.event; +insert into event_like select * from mysql.event; +# Now let's alter the table and restart the server +alter table mysql.event + change column body body longtext character set utf8 collate utf8_bin; +--echo "Now we restart the server" + +--source include/restart_mysqld.inc + +use events_test; +# Event scheduler should be disabled: the system tables are damaged +select @@event_scheduler; +# Try various Event Scheduler operation and check the output. +--error ER_EVENTS_DB_ERROR +show events; +--error ER_EVENTS_DB_ERROR +select event_name from information_schema.events; +--error ER_EVENTS_DB_ERROR +show create event intact_check; +--error ER_EVENTS_DB_ERROR +drop event no_such_event; +--error ER_EVENTS_DB_ERROR +create event intact_check_1 on schedule every 5 hour do select 5; +--error ER_EVENTS_DB_ERROR +alter event intact_check_1 on schedule every 8 hour do select 8; +--error ER_EVENTS_DB_ERROR +alter event intact_check_1 rename to intact_check_2; +--error ER_EVENTS_DB_ERROR +drop event intact_check_1; +--error ER_EVENTS_DB_ERROR +drop event intact_check_2; +--error ER_EVENTS_DB_ERROR +drop event intact_check; +--error ER_EVENTS_DB_ERROR +set global event_scheduler=on; +--error ER_EVENTS_DB_ERROR +set global event_scheduler=off; +show variables like 'event_scheduler'; +--echo Make sure that we still can create and drop databases, +--echo and no warnings are produced. +drop database if exists mysqltest_database_not_exists; +create database mysqltest_db1; +drop database mysqltest_db1; +--echo Restore the original mysql.event table +drop table mysql.event; +rename table event_like to mysql.event; +--echo Now let's restart the server again + +--source include/restart_mysqld.inc + +# We need this file primarily to make sure that the scheduler is restarted +# and enabled after we have restored mysql.event table. +# This is the final step of the "cleanup". +# +# Make sure also that events are executed OK after restart, just in case. +use events_test; +# Make sure the scheduler was started successfully +select @@event_scheduler; +let $wait_condition=select count(distinct name)=3 from execution_log; +--source include/wait_condition.inc +drop table execution_log; +# Will drop all events +drop database events_test; + +let $wait_condition= + select count(*) = 0 from information_schema.processlist + where db='events_test' and command = 'Connect' and user=current_user(); +--source include/wait_condition.inc diff --git a/mysql-test/t/events_restart_phase1.test b/mysql-test/t/events_restart_phase1.test deleted file mode 100644 index 6a94ef12222..00000000000 --- a/mysql-test/t/events_restart_phase1.test +++ /dev/null @@ -1,43 +0,0 @@ -# Can't test with embedded server that doesn't support grants --- source include/not_embedded.inc -# -# Test that when the server is restarted, it checks mysql.event table, -# and disables the scheduler if it's not up to date. -# - -# Switch off the scheduler for now. -set global event_scheduler=off; - ---disable_warnings -drop database if exists events_test; ---enable_warnings -create database events_test; -use events_test; -create table execution_log(name char(10)); - -create event abc1 on schedule every 1 second do - insert into execution_log value('abc1'); -create event abc2 on schedule every 1 second do - insert into execution_log value('abc2'); -create event abc3 on schedule every 1 second do - insert into execution_log value('abc3'); -# -# There are various conditions when a server would regard mysql.event -# table as damaged: -# - the table has more column than specified in the compiled in value, but -# the version of the server which created the table is the same -# - the column count in the table is less than the compiled in value -# - some column has an incompatible type specification (for what is an -# incompatible type specification please refer to the comments in the source -# -# Unfortunately, in order to test a condition, we need to restart the -# server. Therefore, here we test only one simple case: changing the data -# type of the 'body' field to blob. -# -# First, let's do a backup to not depend on actual definition of mysql.event -create table event_like like mysql.event; -insert into event_like select * from mysql.event; -# Now let's alter the table and restart the server -alter table mysql.event - change column body body longtext character set utf8 collate utf8_bin; ---echo "Now we restart the server" diff --git a/mysql-test/t/events_restart_phase2-master.opt b/mysql-test/t/events_restart_phase2-master.opt deleted file mode 100644 index 673e87f4357..00000000000 --- a/mysql-test/t/events_restart_phase2-master.opt +++ /dev/null @@ -1 +0,0 @@ ---event-scheduler=on diff --git a/mysql-test/t/events_restart_phase2.test b/mysql-test/t/events_restart_phase2.test deleted file mode 100644 index c3f799634b3..00000000000 --- a/mysql-test/t/events_restart_phase2.test +++ /dev/null @@ -1,41 +0,0 @@ -# Can't test with embedded server that doesn't support grants --- source include/not_embedded.inc - -use events_test; -# Event scheduler should be disabled: the system tables are damaged -select @@event_scheduler; -# Try various Event Scheduler operation and check the output. ---error ER_EVENTS_DB_ERROR -show events; ---error ER_EVENTS_DB_ERROR -select event_name from information_schema.events; ---error ER_EVENTS_DB_ERROR -show create event intact_check; ---error ER_EVENTS_DB_ERROR -drop event no_such_event; ---error ER_EVENTS_DB_ERROR -create event intact_check_1 on schedule every 5 hour do select 5; ---error ER_EVENTS_DB_ERROR -alter event intact_check_1 on schedule every 8 hour do select 8; ---error ER_EVENTS_DB_ERROR -alter event intact_check_1 rename to intact_check_2; ---error ER_EVENTS_DB_ERROR -drop event intact_check_1; ---error ER_EVENTS_DB_ERROR -drop event intact_check_2; ---error ER_EVENTS_DB_ERROR -drop event intact_check; ---error ER_EVENTS_DB_ERROR -set global event_scheduler=on; ---error ER_EVENTS_DB_ERROR -set global event_scheduler=off; -show variables like 'event_scheduler'; ---echo Make sure that we still can create and drop databases, ---echo and no warnings are produced. -drop database if exists mysqltest_database_not_exists; -create database mysqltest_db1; -drop database mysqltest_db1; ---echo Restore the original mysql.event table -drop table mysql.event; -rename table event_like to mysql.event; ---echo Now let's restart the server again diff --git a/mysql-test/t/events_restart_phase3-master.opt b/mysql-test/t/events_restart_phase3-master.opt deleted file mode 100644 index 656b9e1b017..00000000000 --- a/mysql-test/t/events_restart_phase3-master.opt +++ /dev/null @@ -1 +0,0 @@ ---event-scheduler=1 diff --git a/mysql-test/t/events_restart_phase3.test b/mysql-test/t/events_restart_phase3.test deleted file mode 100644 index 04d879e50ec..00000000000 --- a/mysql-test/t/events_restart_phase3.test +++ /dev/null @@ -1,21 +0,0 @@ -# Can't test with embedded server that doesn't support grants --- source include/not_embedded.inc -# -# We need this file primarily to make sure that the scheduler is restarted -# and enabled after we have restored mysql.event table. -# This is the final step of the "cleanup". -# -# Make sure also that events are executed OK after restart, just in case. -use events_test; -# Make sure the scheduler was started successfully -select @@event_scheduler; -let $wait_condition=select count(distinct name)=3 from execution_log; ---source include/wait_condition.inc -drop table execution_log; -# Will drop all events -drop database events_test; - -let $wait_condition= - select count(*) = 0 from information_schema.processlist - where db='events_test' and command = 'Connect' and user=current_user(); ---source include/wait_condition.inc diff --git a/mysql-test/t/events_scheduling.test b/mysql-test/t/events_scheduling.test index 87cfa42e283..041a2def490 100644 --- a/mysql-test/t/events_scheduling.test +++ b/mysql-test/t/events_scheduling.test @@ -58,8 +58,6 @@ ON COMPLETION PRESERVE DO INSERT INTO table_4 VALUES (1); -# Wait for the events to fire and check the data afterwards - # Let event_1 insert at least 4 records into the table let $wait_condition=select count(*) >= 4 from table_1; --source include/wait_condition.inc @@ -85,25 +83,13 @@ let $wait_condition=select count(*) = 0 from information_schema.events where event_name='event_4' and status='enabled'; --source include/wait_condition.inc -let $wait_condition=SELECT SUM(a) >= 4 FROM table_1; -source include/wait_condition.inc; -SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1; - -# In case of a testing box under heavy load it cannot be guaranteed that -# it is really often enough checked if event_2 has to be executed. -# -> Bug#39854 events_scheduling fails sporadically on pushbuild -# Therefore we lowered here the original expectation of 5 to 4. -let $wait_condition=SELECT SUM(a) >= 4 FROM table_2; -source include/wait_condition.inc; -SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_2; - -let $wait_condition=SELECT SUM(a) >= 1 FROM table_3; -source include/wait_condition.inc; -SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_3; - -let $wait_condition=SELECT SUM(a) >= 1 FROM table_4; -source include/wait_condition.inc; -SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_4; +# +# On a busy system the scheduler may skip execution of events, +# we can't reliably expect that the data in a table to be modified +# by an event will be exact. Thus we do not SELECT from the tables +# in this test. See also +# Bug#39854 events_scheduling fails sporadically on pushbuild +# SELECT IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS diff --git a/mysql-test/t/execution_constants.test b/mysql-test/t/execution_constants.test index 4930164d3fa..e61d79f5249 100644 --- a/mysql-test/t/execution_constants.test +++ b/mysql-test/t/execution_constants.test @@ -41,12 +41,19 @@ while ($i) error 0,1436 // eval $query_head 0 $query_tail// - if ($mysql_errno != 1436) + if ($mysql_errno) { # We reached the place where we reported an error about the stack limit, # and we successfully returned the error. That means that at the stack # limit, we still have enough space reserved to report an error. let $i = 1// + + # Check that mysql_errno is 1436 + if (`select $mysql_errno != 1436`) + { + die Wrong error triggered, expected 1436 but got $mysql_errno// + } + } # Multiplying by three stack frames should be fine enough resolution. diff --git a/mysql-test/t/fix_priv_tables.test b/mysql-test/t/fix_priv_tables.test index 3051fd88076..c7cd500f8d2 100644 --- a/mysql-test/t/fix_priv_tables.test +++ b/mysql-test/t/fix_priv_tables.test @@ -51,7 +51,8 @@ echo; -- disable_query_log # Run the mysql_fix_privilege_tables.sql using "mysql --force" ---exec $MYSQL --force mysql < $MYSQL_FIX_PRIVILEGE_TABLES > $MYSQLTEST_VARDIR/log/fix_priv_tables.log 2>&1 +--exec $MYSQL --force mysql < $MYSQL_FIX_PRIVILEGE_TABLES > $MYSQLTEST_VARDIR/tmp/fix_priv_tables.log 2>&1 +--remove_file $MYSQLTEST_VARDIR/tmp/fix_priv_tables.log -- enable_query_log -- enable_result_log diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index 4f366ad0731..e045d34ed32 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -454,3 +454,12 @@ insert into t1 set a='water',b='2008-08-04'; select 1 from t1 where match(a) against ('water' in boolean mode) and b>='2008-08-01'; drop table t1; show warnings; + +# +# BUG#37245 - Full text search problem +# +CREATE TABLE t1(a CHAR(10)); +INSERT INTO t1 VALUES('aaa15'); +SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE) FROM t1; +SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) FROM t1; +DROP TABLE t1; diff --git a/mysql-test/t/fulltext_plugin-master.opt b/mysql-test/t/fulltext_plugin-master.opt new file mode 100644 index 00000000000..a2554caa20b --- /dev/null +++ b/mysql-test/t/fulltext_plugin-master.opt @@ -0,0 +1 @@ +$SIMPLE_PARSER_OPT diff --git a/mysql-test/t/fulltext_plugin.test b/mysql-test/t/fulltext_plugin.test new file mode 100644 index 00000000000..31978dadc51 --- /dev/null +++ b/mysql-test/t/fulltext_plugin.test @@ -0,0 +1,10 @@ +--source include/have_simple_parser.inc + +# +# BUG#39746 - Debug flag breaks struct definition (server crash) +# +INSTALL PLUGIN simple_parser SONAME 'mypluglib.so'; +CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a) WITH PARSER simple_parser); +ALTER TABLE t1 ADD FULLTEXT(b) WITH PARSER simple_parser; +DROP TABLE t1; +UNINSTALL PLUGIN simple_parser; diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test index 7f17fd2180f..0ad5b3ca7b1 100644 --- a/mysql-test/t/func_compress.test +++ b/mysql-test/t/func_compress.test @@ -86,3 +86,8 @@ select *, uncompress(a), uncompress(a) is null from t1; drop table t1; --echo End of 5.0 tests +--disable_result_log +--disable_query_log +set @@global.max_allowed_packet=default; +--enable_result_log +--enable_query_log diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test index 8da10f36cbe..4efea8e195e 100644 --- a/mysql-test/t/func_if.test +++ b/mysql-test/t/func_if.test @@ -150,4 +150,18 @@ FROM t1; DROP TABLE t1; +# +# Bug #40761: Assert on sum func on IF(..., CAST(longtext AS UNSIGNED), signed) +# (was: LEFT JOIN on inline view crashes server) +# + +CREATE TABLE t1 (c LONGTEXT); +INSERT INTO t1 VALUES(1), (2), (3), (4), ('12345678901234567890'); + +SELECT * FROM (SELECT MAX(IF(1, CAST(c AS UNSIGNED), 0)) FROM t1) AS te; +SELECT * FROM (SELECT MAX(IFNULL(CAST(c AS UNSIGNED), 0)) FROM t1) AS te; + +DROP TABLE t1; + + --echo End of 5.0 tests diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index d0d4dea0713..3fc1697f146 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -426,4 +426,17 @@ select * from t1 where NOT id in (select null union all select 1); select * from t1 where NOT id in (null, 1); drop table t1; +# +# Bug #41363: crash of mysqld on windows with aggregate in case +# + +CREATE TABLE t1(c0 INTEGER, c1 INTEGER, c2 INTEGER); +INSERT INTO t1 VALUES(1, 1, 1), (1, 1, 1); + +SELECT CASE AVG (c0) WHEN c1 * c2 THEN 1 END FROM t1; +SELECT CASE c1 * c2 WHEN SUM(c0) THEN 1 WHEN AVG(c0) THEN 2 END FROM t1; +SELECT CASE c1 WHEN c1 + 1 THEN 1 END, ABS(AVG(c0)) FROM t1; + +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index 5a5f4024bc4..5d77c678d52 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -1263,4 +1263,14 @@ CREATE VIEW v1 AS SELECT CHAR(0x414243) as c1; SELECT HEX(c1) from v1; DROP VIEW v1; +# +# Bug #35558 Wrong server metadata blows up the client +# +create table t1(a float); +insert into t1 values (1.33); +--enable_metadata +select format(a, 2) from t1; +--disable_metadata +drop table t1; + --echo End of 5.0 tests diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index c417e9a02bf..b9da946a55f 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -304,6 +304,15 @@ select unix_timestamp('1970-01-01 03:00:01'); # check bad date, close to the boundary (we cut them off in the very end) select unix_timestamp('2038-01-19 07:14:07'); +# +# Bug #28759: DAYNAME() and MONTHNAME() return binary string +# + +SELECT CHARSET(DAYNAME(19700101)); +SELECT CHARSET(MONTHNAME(19700101)); +SELECT LOWER(DAYNAME(19700101)); +SELECT LOWER(MONTHNAME(19700101)); +SELECT COERCIBILITY(MONTHNAME('1970-01-01')),COERCIBILITY(DAYNAME('1970-01-01')); # # Test types from + INTERVAL @@ -606,6 +615,7 @@ select time_format('100:00:00', '%H %k %h %I %l'); # Bug #12562: Make SYSDATE behave like it does in Oracle: always the current # time, regardless of magic to make NOW() always the same for the # entirety of a statement. +SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; create table t1 (a timestamp default '2005-05-05 01:01:01', @@ -656,6 +666,7 @@ end; delimiter ;// call t_sysdate(); drop procedure t_sysdate; +SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; # # Bug #13534: timestampdiff() returned incorrect results across leap years diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index e6b8b91783c..f8b8b0e17a7 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -386,7 +386,7 @@ drop table t1; create table t1 (a TEXT, b GEOMETRY NOT NULL, SPATIAL KEY(b)); alter table t1 disable keys; --error 1263 -load data infile '../std_data_ln/bad_gis_data.dat' into table t1; +load data infile '../../std_data/bad_gis_data.dat' into table t1; alter table t1 enable keys; drop table t1; diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index 3fac767468e..a9491dc2736 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -3,6 +3,7 @@ # Grant tests not performed with embedded server -- source include/not_embedded.inc +SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; # Cleanup @@ -1294,6 +1295,13 @@ drop view v1; drop table test; drop function test_function; +# +# Bug#41456 SET PASSWORD hates CURRENT_USER() +# +SELECT CURRENT_USER(); +SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin"); +SET PASSWORD FOR CURRENT_USER() = PASSWORD(""); + --echo End of 5.0 tests # @@ -1468,4 +1476,4 @@ use test; DROP DATABASE dbbug33464; ---echo End of 5.1 tests +SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test index d91592f6bb6..21de3e349cf 100644 --- a/mysql-test/t/grant2.test +++ b/mysql-test/t/grant2.test @@ -488,6 +488,7 @@ flush privileges; # BUG#13310 incorrect user parsing by SP # +SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; grant all privileges on test.* to `a@`@localhost; @@ -512,7 +513,7 @@ connection default; REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost; drop user `a@`@localhost; -SET GLOBAL log_bin_trust_function_creators = 0; +SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; # diff --git a/mysql-test/t/grant_cache_no_prot.test b/mysql-test/t/grant_cache_no_prot.test index 1f6a9aeb9ed..31209f343b9 100644 --- a/mysql-test/t/grant_cache_no_prot.test +++ b/mysql-test/t/grant_cache_no_prot.test @@ -18,7 +18,7 @@ if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL + $VIEW_PROTOCOL > 0`) { - --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled + --skip Need normal protocol } # The main testing script diff --git a/mysql-test/t/grant_cache_ps_prot.test b/mysql-test/t/grant_cache_ps_prot.test index 7b579f869e9..27b3f23de3f 100644 --- a/mysql-test/t/grant_cache_ps_prot.test +++ b/mysql-test/t/grant_cache_ps_prot.test @@ -17,7 +17,7 @@ if (`SELECT $SP_PROTOCOL + $CURSOR_PROTOCOL + $VIEW_PROTOCOL > 0 OR $PS_PROTOCOL = 0`) { - --skip Test requires: ps-protocol enabled, other protocols disabled + --skip Need ps-protocol } # The main testing script diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 36aef981f21..e3cf3ca856d 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1091,6 +1091,7 @@ EXPLAIN SELECT b from t2 GROUP BY b; SELECT b from t2 GROUP BY b; DROP TABLE t1; +DROP TABLE t2; # # Bug #31797: error while parsing subqueries -- WHERE is parsed as HAVING diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index bcb22c44076..7105d7e04f0 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -37,7 +37,11 @@ create table t3(a int, KEY a_data (a)); create table mysqltest.t4(a int); create table t5 (id int auto_increment primary key); insert into t5 values (10); -create view v1 (c) as select table_name from information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status'; +create view v1 (c) as + SELECT table_name FROM information_schema.TABLES + WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND + table_name<>'ndb_binlog_index' AND + table_name<>'ndb_apply_status'; select * from v1; select c,table_name from v1 @@ -133,25 +137,25 @@ delimiter ;| # Bug#7222 information_schema: errors in "routines" # select parameter_style, sql_data_access, dtd_identifier -from information_schema.routines; +from information_schema.routines where routine_schema='test'; --replace_column 5 # 6 # -show procedure status; +show procedure status where db='test'; --replace_column 5 # 6 # -show function status; +show function status where db='test'; select a.ROUTINE_NAME from information_schema.ROUTINES a, information_schema.SCHEMATA b where -a.ROUTINE_SCHEMA = b.SCHEMA_NAME; +a.ROUTINE_SCHEMA = b.SCHEMA_NAME AND b.SCHEMA_NAME='test'; --replace_column 3 # explain select a.ROUTINE_NAME from information_schema.ROUTINES a, information_schema.SCHEMATA b where a.ROUTINE_SCHEMA = b.SCHEMA_NAME; select a.ROUTINE_NAME, b.name from information_schema.ROUTINES a, -mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) order by 1; -select count(*) from information_schema.ROUTINES; +mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) AND a.ROUTINE_SCHEMA='test' order by 1; +select count(*) from information_schema.ROUTINES where routine_schema='test'; -create view v1 as select routine_schema, routine_name from information_schema.routines +create view v1 as select routine_schema, routine_name from information_schema.routines where routine_schema='test' order by routine_schema, routine_name; select * from v1; drop view v1; @@ -528,7 +532,7 @@ flush privileges; # Bug #9404 information_schema: Weird error messages # with SELECT SUM() ... GROUP BY queries # -SELECT table_schema, count(*) FROM information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA; +SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA; # @@ -557,7 +561,7 @@ begin end| delimiter ;| show triggers; -select * from information_schema.triggers; +select * from information_schema.triggers where trigger_schema in ('mysql', 'information_schema', 'test', 'mysqltest'); drop trigger trg1; drop trigger trg2; @@ -727,7 +731,7 @@ BEGIN SELECT 'foo' FROM DUAL; END | delimiter ;| -select ROUTINE_NAME from routines; +select ROUTINE_NAME from routines where ROUTINE_SCHEMA='information_schema'; # # Bug #10734 Grant of privileges other than 'select' and 'create view' should fail on schema # @@ -827,7 +831,7 @@ use mysql; INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL', 'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03', '2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a'); -select routine_name from information_schema.routines; +select routine_name from information_schema.routines where ROUTINE_SCHEMA='test'; delete from proc where name=''; use test; @@ -874,13 +878,13 @@ CREATE USER mysql_bug20230@localhost; GRANT EXECUTE ON PROCEDURE p1 TO mysql_bug20230@localhost; GRANT EXECUTE ON FUNCTION f1 TO mysql_bug20230@localhost; -SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES; +SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='test'; SHOW CREATE PROCEDURE p1; SHOW CREATE FUNCTION f1; connect (conn1, localhost, mysql_bug20230,,); -SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES; +SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='test'; SHOW CREATE PROCEDURE p1; SHOW CREATE FUNCTION f1; CALL p1(); @@ -931,10 +935,10 @@ SELECT t.table_name, c1.column_name # INFORMARTION_SCHEMA.TABLES # -SELECT MAX(table_name) FROM information_schema.tables; +SELECT MAX(table_name) FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test'); SELECT table_name from information_schema.tables WHERE table_name=(SELECT MAX(table_name) - FROM information_schema.tables); + FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test')); # # Bug #23037: Bug in field "Default" of query "SHOW COLUMNS FROM table" # @@ -1383,4 +1387,11 @@ select a.VARIABLE_VALUE - b.VARIABLE_VALUE from t0 b, information_schema.global_ where a.VARIABLE_NAME = b.VARIABLE_NAME; drop table t0; +# +# Bug#35275 INFORMATION_SCHEMA.TABLES.CREATE_OPTIONS omits KEY_BLOCK_SIZE +# +CREATE TABLE t1(a INT) KEY_BLOCK_SIZE=1; +SELECT CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; +DROP TABLE t1; + --echo End of 5.1 tests. diff --git a/mysql-test/t/information_schema_chmod.test b/mysql-test/t/information_schema_chmod.test index 51e67a0c956..39e2f680bb8 100644 --- a/mysql-test/t/information_schema_chmod.test +++ b/mysql-test/t/information_schema_chmod.test @@ -17,7 +17,8 @@ # create database mysqltest; create table mysqltest.t1(a int); -chmod 0000 $MYSQLTEST_VARDIR/master-data/mysqltest; +let $MYSQLD_DATADIR= `select @@datadir`; +chmod 0000 $MYSQLD_DATADIR/mysqltest; select table_schema from information_schema.tables where table_schema='mysqltest'; -chmod 0777 $MYSQLTEST_VARDIR/master-data/mysqltest; +chmod 0777 $MYSQLD_DATADIR/mysqltest; drop database mysqltest; diff --git a/mysql-test/t/init_file.test b/mysql-test/t/init_file.test index 7c580afadda..a6efbf6722e 100644 --- a/mysql-test/t/init_file.test +++ b/mysql-test/t/init_file.test @@ -18,7 +18,7 @@ DROP DATABASE init_file; --echo ok --echo end of 4.1 tests # -# Chec 5.x features +# Check 5.x features # # Expected: # 3, 5, 7, 11, 13 diff --git a/mysql-test/t/innodb-autoinc-optimize.test b/mysql-test/t/innodb-autoinc-optimize.test index c7e22a8ff40..0f0cb57f92f 100644 --- a/mysql-test/t/innodb-autoinc-optimize.test +++ b/mysql-test/t/innodb-autoinc-optimize.test @@ -14,3 +14,6 @@ insert into t1 set a = -1; # NOTE: The database needs to be shutdown and restarted (here) for # the test to work. It's included for reference only. optimize table t1; + +--echo ==== clean up ==== +DROP TABLE t1; diff --git a/mysql-test/t/innodb-autoinc.test b/mysql-test/t/innodb-autoinc.test index aa464e42627..e6b804c4fff 100644 --- a/mysql-test/t/innodb-autoinc.test +++ b/mysql-test/t/innodb-autoinc.test @@ -23,7 +23,6 @@ DROP TABLE t1; CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; INSERT INTO t1 VALUES (127, null); -- error ER_DUP_ENTRY,1062 --- warning ER_WARN_DATA_OUT_OF_RANGE,1264 INSERT INTO t1 (c2) VALUES ('innodb'); SELECT * FROM t1; DROP TABLE t1; @@ -31,7 +30,6 @@ DROP TABLE t1; CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; INSERT INTO t1 VALUES (255, null); -- error ER_DUP_ENTRY,1062 --- warning ER_WARN_DATA_OUT_OF_RANGE,1264 INSERT INTO t1 (c2) VALUES ('innodb'); SELECT * FROM t1; DROP TABLE t1; @@ -41,7 +39,6 @@ DROP TABLE t1; CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; INSERT INTO t1 VALUES (32767, null); -- error ER_DUP_ENTRY,1062 --- warning ER_WARN_DATA_OUT_OF_RANGE,1264 INSERT INTO t1 (c2) VALUES ('innodb'); SELECT * FROM t1; DROP TABLE t1; @@ -49,7 +46,6 @@ DROP TABLE t1; CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; INSERT INTO t1 VALUES (65535, null); -- error ER_DUP_ENTRY,1062 --- warning ER_WARN_DATA_OUT_OF_RANGE,1264 INSERT INTO t1 (c2) VALUES ('innodb'); SELECT * FROM t1; DROP TABLE t1; @@ -59,7 +55,6 @@ DROP TABLE t1; CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; INSERT INTO t1 VALUES (8388607, null); -- error ER_DUP_ENTRY,1062 --- warning ER_WARN_DATA_OUT_OF_RANGE,1264 INSERT INTO t1 (c2) VALUES ('innodb'); SELECT * FROM t1; DROP TABLE t1; @@ -67,7 +62,6 @@ DROP TABLE t1; CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; INSERT INTO t1 VALUES (16777215, null); -- error ER_DUP_ENTRY,1062 --- warning ER_WARN_DATA_OUT_OF_RANGE,1264 INSERT INTO t1 (c2) VALUES ('innodb'); SELECT * FROM t1; DROP TABLE t1; @@ -77,7 +71,6 @@ DROP TABLE t1; CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; INSERT INTO t1 VALUES (2147483647, null); -- error ER_DUP_ENTRY,1062 --- warning ER_WARN_DATA_OUT_OF_RANGE,1264 INSERT INTO t1 (c2) VALUES ('innodb'); SELECT * FROM t1; DROP TABLE t1; @@ -94,7 +87,6 @@ DROP TABLE t1; CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; INSERT INTO t1 VALUES (9223372036854775807, null); -- error ER_DUP_ENTRY,1062 --- warning ER_WARN_DATA_OUT_OF_RANGE,1264 INSERT INTO t1 (c2) VALUES ('innodb'); SELECT * FROM t1; DROP TABLE t1; @@ -139,3 +131,262 @@ SELECT c1 FROM t1; SHOW CREATE TABLE t1; DROP TABLE t1; +# +# Bug 38839 +# Reset the last value generated at end of statement +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL, 1); +DELETE FROM t1 WHERE c1 = 1; +INSERT INTO t1 VALUES (2,1); +INSERT INTO t1 VALUES (NULL,8); +SELECT * FROM t1; +DROP TABLE t1; +# Bug 38839 -- same as above but for multi value insert +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL, 1); +DELETE FROM t1 WHERE c1 = 1; +INSERT INTO t1 VALUES (2,1), (NULL, 8); +INSERT INTO t1 VALUES (NULL,9); +SELECT * FROM t1; +DROP TABLE t1; + +# +# Test changes to AUTOINC next value calculation +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL),(5),(NULL); +INSERT INTO t1 VALUES (250),(NULL); +SELECT * FROM t1; +INSERT INTO t1 VALUES (1000); +SET @@INSERT_ID=400; +INSERT INTO t1 VALUES(NULL),(NULL); +SELECT * FROM t1; +DROP TABLE t1; + +# Test with SIGNED INT column, by inserting a 0 for the first column value +# 0 is treated in the same was NULL. +# Reset the AUTOINC session variables +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(0); +SELECT * FROM t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +INSERT INTO t1 VALUES (-1), (NULL),(2),(NULL); +INSERT INTO t1 VALUES (250),(NULL); +SELECT * FROM t1; +SET @@INSERT_ID=400; +# Duplicate error expected here for autoinc_lock_mode != TRADITIONAL +-- error ER_DUP_ENTRY,1062 +INSERT INTO t1 VALUES(NULL),(NULL); +SELECT * FROM t1; +DROP TABLE t1; + +# Test with SIGNED INT column +# Reset the AUTOINC session variables +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(-1); +SELECT * FROM t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +INSERT INTO t1 VALUES (-2), (NULL),(2),(NULL); +INSERT INTO t1 VALUES (250),(NULL); +SELECT * FROM t1; +INSERT INTO t1 VALUES (1000); +SET @@INSERT_ID=400; +INSERT INTO t1 VALUES(NULL),(NULL); +SELECT * FROM t1; +DROP TABLE t1; + +# Test with UNSIGNED INT column, single insert +# The sign in the value is ignored and a new column value is generated +# Reset the AUTOINC session variables +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(-1); +SELECT * FROM t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +INSERT INTO t1 VALUES (-2); +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (250); +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1; +INSERT INTO t1 VALUES (1000); +SET @@INSERT_ID=400; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +DROP TABLE t1; + +# Test with UNSIGNED INT column, multi-value inserts +# The sign in the value is ignored and a new column value is generated +# Reset the AUTOINC session variables +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(-1); +SELECT * FROM t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +INSERT INTO t1 VALUES (-2),(NULL),(2),(NULL); +INSERT INTO t1 VALUES (250),(NULL); +SELECT * FROM t1; +INSERT INTO t1 VALUES (1000); +SET @@INSERT_ID=400; +# Duplicate error expected here for autoinc_lock_mode != TRADITIONAL +-- error ER_DUP_ENTRY,1062 +INSERT INTO t1 VALUES(NULL),(NULL); +SELECT * FROM t1; +DROP TABLE t1; + +# +# Check for overflow handling when increment is > 1 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +# TODO: Fix the autoinc init code +# We have to do this because of a bug in the AUTOINC init code. +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES (9223372036854775794); #-- 2^63 - 14 +SELECT * FROM t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +# This should just fit +INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); +SELECT * FROM t1; +DROP TABLE t1; + +# +# Check for overflow handling when increment and offser are > 1 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +# TODO: Fix the autoinc init code +# We have to do this because of a bug in the AUTOINC init code. +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13 +SELECT * FROM t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +# This should fail because of overflow but it doesn't, it seems to be +# a MySQL server bug. It wraps around to 0 for the last value. +# See MySQL Bug# 39828 +# +# Instead of wrapping around, it asserts when MySQL is compiled --with-debug +# (see sql/handler.cc:handler::update_auto_increment()). Don't test for +# overflow until Bug #39828 is fixed. +# +# Since this asserts when compiled --with-debug, we can't properly test this +# until Bug #39828 is fixed. For now, this test is meaningless. +#if Bug #39828 is fixed +#INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); +#else +INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); +#endif +SELECT * FROM t1; +DROP TABLE t1; + +# +# Check for overflow handling when increment and offset are odd numbers +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +# TODO: Fix the autoinc init code +# We have to do this because of a bug in the AUTOINC init code. +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13 +SELECT * FROM t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7; +SHOW VARIABLES LIKE "%auto_inc%"; +# This should fail because of overflow but it doesn't. It fails with +# a duplicate entry message because of a MySQL server bug, it wraps +# around. See MySQL Bug# 39828, once MySQL fix the bug we can replace +# the ER_DUP_ENTRY, 1062 below with the appropriate error message +# +# Since this asserts when compiled --with-debug, we can't properly test this +# until Bug #39828 is fixed. For now, this test is meaningless. +#if Bug #39828 is fixed +# Still need to fix this error code, error should mention overflow +#-- error ER_DUP_ENTRY,1062 +#INSERT INTO t1 VALUES (NULL),(NULL), (NULL); +#else +INSERT INTO t1 VALUES (NULL),(NULL); +#endif +SELECT * FROM t1; +DROP TABLE t1; + +# Check for overflow handling when increment and offset are odd numbers +# and check for large -ve numbers +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +# TODO: Fix the autoinc init code +# We have to do this because of a bug in the AUTOINC init code. +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES(-9223372036854775806); #-- -2^63 + 2 +INSERT INTO t1 VALUES(-9223372036854775807); #-- -2^63 + 1 +INSERT INTO t1 VALUES(-9223372036854775808); #-- -2^63 +SELECT * FROM t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=3, @@SESSION.AUTO_INCREMENT_OFFSET=3; +SHOW VARIABLES LIKE "%auto_inc%"; +INSERT INTO t1 VALUES (NULL),(NULL), (NULL); +SELECT * FROM t1; +DROP TABLE t1; +# +# Check for overflow handling when increment and offset are very +# large numbers 2^60 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +# TODO: Fix the autoinc init code +# We have to do this because of a bug in the AUTOINC init code. +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2 +SELECT * FROM t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976; +SHOW VARIABLES LIKE "%auto_inc%"; +# This should fail because of overflow but it doesn't. It wraps around +# and the autoinc values look bogus too. +# See MySQL Bug# 39828, once MySQL fix the bug we can enable the error +# code expected test. +# -- error ER_AUTOINC_READ_FAILED,1467 +# +# Since this asserts when compiled --with-debug, we can't properly test this +# until Bug #39828 is fixed. For now, this test is meaningless. +#if Bug #39828 is fixed +#-- error ER_AUTOINC_READ_FAILED,1467 +#INSERT INTO t1 VALUES (NULL),(NULL); +#else +INSERT INTO t1 VALUES (NULL); +#endif +SELECT * FROM t1; +DROP TABLE t1; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 339be87419a..b0353ed5268 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -1163,7 +1163,7 @@ drop table t2; # Test error handling # Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' --error ER_WRONG_FK_DEF create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb; @@ -1317,6 +1317,7 @@ set global innodb_sync_spin_loops=20; show variables like "innodb_sync_spin_loops"; # Test for innodb_thread_concurrency variable +SET @old_innodb_thread_concurrency= @@global.innodb_thread_concurrency; show variables like "innodb_thread_concurrency"; set global innodb_thread_concurrency=1001; show variables like "innodb_thread_concurrency"; @@ -1324,6 +1325,7 @@ set global innodb_thread_concurrency=0; show variables like "innodb_thread_concurrency"; set global innodb_thread_concurrency=16; show variables like "innodb_thread_concurrency"; +SET @@global.innodb_thread_concurrency= @old_innodb_thread_concurrency; # Test for innodb_concurrency_tickets variable show variables like "innodb_concurrency_tickets"; @@ -1356,7 +1358,7 @@ source include/varchar.inc; # # Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' create table t1 (v varchar(65530), key(v)); drop table t1; create table t1 (v varchar(65536)); @@ -1631,7 +1633,7 @@ disconnect b; set foreign_key_checks=0; create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb; # Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' -- error 1005 create table t1(a char(10) primary key, b varchar(20)) engine = innodb; set foreign_key_checks=1; @@ -1643,7 +1645,7 @@ drop table t2; set foreign_key_checks=0; create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; # Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' -- error 1005 create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8; set foreign_key_checks=1; @@ -1674,7 +1676,7 @@ set foreign_key_checks=0; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8; # Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' -- error 1025 rename table t3 to t1; set foreign_key_checks=1; @@ -2314,7 +2316,7 @@ ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL; # mysqltest first does replace_regex, then replace_result --replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/ # Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' --error 1025 ALTER TABLE t2 MODIFY a INT NOT NULL; DELETE FROM t1; @@ -2475,6 +2477,7 @@ SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2'; DROP TABLE t2; DROP TABLE t1; # End 34920 test +# # Bug #29507 TRUNCATE shows to many rows effected # CONNECTION default; @@ -2491,6 +2494,36 @@ TRUNCATE TABLE t1; --disable_info DROP TABLE t1; # +# Bug#35537 Innodb doesn't increment handler_update and handler_delete. +# +-- disable_query_log +-- disable_result_log + +CONNECT (c1,localhost,root,,); + +DROP TABLE IF EXISTS bug35537; +CREATE TABLE bug35537 ( + c1 int +) ENGINE=InnoDB; + +INSERT INTO bug35537 VALUES (1); + +-- enable_result_log + +SHOW SESSION STATUS LIKE 'Handler_update%'; +SHOW SESSION STATUS LIKE 'Handler_delete%'; + +UPDATE bug35537 SET c1 = 2 WHERE c1 = 1; +DELETE FROM bug35537 WHERE c1 = 2; + +SHOW SESSION STATUS LIKE 'Handler_update%'; +SHOW SESSION STATUS LIKE 'Handler_delete%'; + +DROP TABLE bug35537; + +DISCONNECT c1; +CONNECTION default; + ####################################################################### # # # Please, DO NOT TOUCH this file as well as the innodb.result file. # diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug30919-master.opt b/mysql-test/t/innodb_bug30919-master.opt index 8636d2d8734..8636d2d8734 100644 --- a/mysql-test/suite/rpl/t/rpl_innodb_bug30919-master.opt +++ b/mysql-test/t/innodb_bug30919-master.opt diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug30919.test b/mysql-test/t/innodb_bug30919.test index 56b2c7bc03d..56b2c7bc03d 100644 --- a/mysql-test/suite/rpl/t/rpl_innodb_bug30919.test +++ b/mysql-test/t/innodb_bug30919.test diff --git a/mysql-test/t/innodb_bug34300.test b/mysql-test/t/innodb_bug34300.test index 114bcf98c25..ff81d3476f8 100644 --- a/mysql-test/t/innodb_bug34300.test +++ b/mysql-test/t/innodb_bug34300.test @@ -30,3 +30,10 @@ ALTER TABLE bug34300 ADD COLUMN (f10 INT); SELECT f4, f8 FROM bug34300; DROP TABLE bug34300; + +--disable_result_log +--disable_query_log +SET @@global.max_allowed_packet=default; +--enable_result_log +--enable_query_log + diff --git a/mysql-test/t/innodb_bug38231.test b/mysql-test/t/innodb_bug38231.test new file mode 100644 index 00000000000..b3fcd89f371 --- /dev/null +++ b/mysql-test/t/innodb_bug38231.test @@ -0,0 +1,75 @@ +# +# Bug#38231 Innodb crash in lock_reset_all_on_table() on TRUNCATE + LOCK / UNLOCK +# http://bugs.mysql.com/38231 +# + +-- source include/have_innodb.inc + +SET storage_engine=InnoDB; + +# we care only that the following SQL commands do not crash the server +-- disable_query_log +-- disable_result_log + +DROP TABLE IF EXISTS bug38231; +CREATE TABLE bug38231 (a INT); + +-- connect (con1,localhost,root,,) +-- connect (con2,localhost,root,,) + +-- connection con1 +SET autocommit=0; +LOCK TABLE bug38231 WRITE; + +-- connection con2 +SET autocommit=0; +-- send +LOCK TABLE bug38231 WRITE; + +-- connection default +-- send +TRUNCATE TABLE bug38231; + +-- connection con1 +# give time to TRUNCATE and others to be executed; without sleep, sometimes +# UNLOCK executes before TRUNCATE +# TODO: Replace with wait_condition once possible under embedded server. +-- sleep 0.2 +# this crashes the server if the bug is present +UNLOCK TABLES; + +# clean up + +-- connection con2 +-- reap +UNLOCK TABLES; + +-- connection default +-- reap +-- disconnect con1 +-- disconnect con2 + +# test that TRUNCATE works with with row-level locks + +-- enable_query_log +-- enable_result_log + +INSERT INTO bug38231 VALUES (1), (10), (300); + +-- connect (con4,localhost,root,,) + +-- connection con4 +SET autocommit=0; +SELECT * FROM bug38231 FOR UPDATE; + +-- connection default +TRUNCATE TABLE bug38231; + +-- connection con4 +COMMIT; + +-- connection default + +-- disconnect con4 + +DROP TABLE bug38231; diff --git a/mysql-test/t/innodb_bug39438-master.opt b/mysql-test/t/innodb_bug39438-master.opt new file mode 100644 index 00000000000..43fac202fd4 --- /dev/null +++ b/mysql-test/t/innodb_bug39438-master.opt @@ -0,0 +1 @@ +--innodb-file-per-table=1 diff --git a/mysql-test/t/innodb_bug39438.test b/mysql-test/t/innodb_bug39438.test new file mode 100644 index 00000000000..4dc3d957c39 --- /dev/null +++ b/mysql-test/t/innodb_bug39438.test @@ -0,0 +1,27 @@ +# +# Bug#39438 Testcase for Bug#39436 crashes on 5.1 in fil_space_get_latch +# http://bugs.mysql.com/39438 +# +# This test must be run with innodb_file_per_table=1 because the crash +# only occurs if that option is turned on and DISCARD TABLESPACE only +# works with innodb_file_per_table. +# + +-- source include/have_innodb.inc + +SET storage_engine=InnoDB; + +# we care only that the following SQL commands do not crash the server +-- disable_query_log +-- disable_result_log + +DROP TABLE IF EXISTS bug39438; + +CREATE TABLE bug39438 (id INT) ENGINE=INNODB; + +ALTER TABLE bug39438 DISCARD TABLESPACE; + +# this crashes the server if the bug is present +SHOW TABLE STATUS; + +DROP TABLE bug39438; diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index d47406697f8..21ee440f10b 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -53,3 +53,135 @@ CREATE TABLE t1 (a char(50)) ENGINE=InnoDB; CREATE INDEX i1 on t1 (a(3)); SELECT * FROM t1 WHERE a = 'abcde'; DROP TABLE t1; + +# +# Bug #37742: HA_EXTRA_KEYREAD flag is set when key contains only prefix of +# requested column +# + +CREATE TABLE foo (a int, b int, c char(10), + PRIMARY KEY (c(3)), + KEY b (b) +) engine=innodb; + +CREATE TABLE foo2 (a int, b int, c char(10), + PRIMARY KEY (c), + KEY b (b) +) engine=innodb; + +CREATE TABLE bar (a int, b int, c char(10), + PRIMARY KEY (c(3)), + KEY b (b) +) engine=myisam; + +INSERT INTO foo VALUES + (1,2,'abcdefghij'), (2,3,''), (3,4,'klmnopqrst'), + (4,5,'uvwxyz'), (5,6,'meotnsyglt'), (4,5,'asfdewe'); + +INSERT INTO bar SELECT * FROM foo; +INSERT INTO foo2 SELECT * FROM foo; + +--query_vertical EXPLAIN SELECT c FROM bar WHERE b>2; +--query_vertical EXPLAIN SELECT c FROM foo WHERE b>2; +--query_vertical EXPLAIN SELECT c FROM foo2 WHERE b>2; + +--query_vertical EXPLAIN SELECT c FROM bar WHERE c>2; +--query_vertical EXPLAIN SELECT c FROM foo WHERE c>2; +--query_vertical EXPLAIN SELECT c FROM foo2 WHERE c>2; + +DROP TABLE foo, bar, foo2; + +# +# Bug#41348: INSERT INTO tbl SELECT * FROM temp_tbl overwrites locking type of temp table +# + +--disable_warnings +DROP TABLE IF EXISTS t1,t3,t2; +DROP FUNCTION IF EXISTS f1; +--enable_warnings + +DELIMITER |; +CREATE FUNCTION f1() RETURNS VARCHAR(250) + BEGIN + return 'hhhhhhh' ; + END| +DELIMITER ;| + +CREATE TABLE t1 (a VARCHAR(20), b VARCHAR(20), c VARCHAR(20)) ENGINE=INNODB; + +BEGIN WORK; + +CREATE TEMPORARY TABLE t2 (a VARCHAR(20), b VARCHAR(20), c varchar(20)) ENGINE=INNODB; +CREATE TEMPORARY TABLE t3 LIKE t2; + +INSERT INTO t1 VALUES ('a','b',NULL),('c','d',NULL),('e','f',NULL); + +SET @stmt := CONCAT('INSERT INTO t2 SELECT tbl.a, tbl.b, f1()',' FROM t1 tbl'); +PREPARE stmt1 FROM @stmt; + +SET @stmt := CONCAT('INSERT INTO t3', ' SELECT * FROM t2'); +PREPARE stmt3 FROM @stmt; + +EXECUTE stmt1; + +COMMIT; + +DEALLOCATE PREPARE stmt1; +DEALLOCATE PREPARE stmt3; + +DROP TABLE t1,t3,t2; +DROP FUNCTION f1; + +# +# Bug#37016: TRUNCATE TABLE removes some rows but not all +# + +--disable_warnings +DROP TABLE IF EXISTS t1,t2; +--enable_warnings + +CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; +CREATE TABLE t2 (id INT PRIMARY KEY, + t1_id INT, INDEX par_ind (t1_id), + FOREIGN KEY (t1_id) REFERENCES t1(id)) ENGINE=INNODB; +INSERT INTO t1 VALUES (1),(2); +INSERT INTO t2 VALUES (3,2); + +SET AUTOCOMMIT = 0; + +START TRANSACTION; +--error ER_ROW_IS_REFERENCED_2 +TRUNCATE TABLE t1; +SELECT * FROM t1; +COMMIT; +SELECT * FROM t1; + +START TRANSACTION; +--error ER_ROW_IS_REFERENCED_2 +TRUNCATE TABLE t1; +SELECT * FROM t1; +ROLLBACK; +SELECT * FROM t1; + +SET AUTOCOMMIT = 1; + +START TRANSACTION; +SELECT * FROM t1; +COMMIT; + +--error ER_ROW_IS_REFERENCED_2 +TRUNCATE TABLE t1; +SELECT * FROM t1; +DELETE FROM t2 WHERE id = 3; + +START TRANSACTION; +SELECT * FROM t1; +TRUNCATE TABLE t1; +ROLLBACK; +SELECT * FROM t1; +TRUNCATE TABLE t2; + +DROP TABLE t2; +DROP TABLE t1; + +--echo End of 5.1 tests diff --git a/mysql-test/t/innodb_mysql_rbk-master.opt b/mysql-test/t/innodb_mysql_rbk-master.opt new file mode 100644 index 00000000000..0e400f9c36b --- /dev/null +++ b/mysql-test/t/innodb_mysql_rbk-master.opt @@ -0,0 +1 @@ +--innodb_lock_wait_timeout=1 --innodb_rollback_on_timeout=1 diff --git a/mysql-test/t/innodb_mysql_rbk.test b/mysql-test/t/innodb_mysql_rbk.test new file mode 100644 index 00000000000..d2368c81f95 --- /dev/null +++ b/mysql-test/t/innodb_mysql_rbk.test @@ -0,0 +1,35 @@ +-- source include/have_innodb.inc + +# +# Bug #41453: Assertion `m_status == DA_ERROR' failed in +# Diagnostics_area::sql_errno +# + +CREATE TABLE t1(a INT, b INT NOT NULL, PRIMARY KEY (a)) ENGINE=innodb +DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7); +CONNECT (con1,localhost,root,,); +CONNECT (con2,localhost,root,,); + +CONNECTION con1; +START TRANSACTION; +SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE; +CONNECTION con2; +START TRANSACTION; +--error ER_LOCK_WAIT_TIMEOUT +UPDATE t1 SET b=b+12 WHERE a > 2 ORDER BY a; +ROLLBACK; + +CONNECTION con1; +START TRANSACTION; +SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE; +CONNECTION con2; +START TRANSACTION; +--error ER_LOCK_WAIT_TIMEOUT +UPDATE t1 SET b=10 WHERE a > 1 ORDER BY a; +SELECT * FROM t1 WHERE b = 10; + +CONNECTION default; +DISCONNECT con1; +DISCONNECT con2; +DROP TABLE t1; diff --git a/mysql-test/t/innodb_notembedded.test b/mysql-test/t/innodb_notembedded.test index 2731f8e33ed..564b947c75e 100644 --- a/mysql-test/t/innodb_notembedded.test +++ b/mysql-test/t/innodb_notembedded.test @@ -5,6 +5,8 @@ drop table if exists t1; --enable_warnings +SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; + connect (a,localhost,root,,); connect (b,localhost,root,,); @@ -39,4 +41,4 @@ drop table t1; drop function f1; disconnect a; disconnect b; -SET GLOBAL log_bin_trust_function_creators = 0; +SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; diff --git a/mysql-test/t/insert_update.test b/mysql-test/t/insert_update.test index 67f21731afe..de38ae0b0d3 100644 --- a/mysql-test/t/insert_update.test +++ b/mysql-test/t/insert_update.test @@ -76,7 +76,7 @@ INSERT t1 SELECT a,b,c FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=t1.c+100; SELECT * FROM t1; INSERT t1 SET a=5 ON DUPLICATE KEY UPDATE b=0; SELECT * FROM t1; ---error 1052 +--error ER_NON_UNIQ_ERROR INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a); INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=t1.c+VALUES(t1.a); SELECT *, VALUES(a) FROM t1; @@ -95,9 +95,9 @@ insert ignore into t1 select a from t1 as t2 on duplicate key update a=t1.a+1 ; select * from t1; insert into t1 select 1 on duplicate key update a=2; select * from t1; ---error 1052 +--error ER_NON_UNIQ_ERROR insert into t1 select a from t1 on duplicate key update a=a+1 ; ---error 1052 +--error ER_NON_UNIQ_ERROR insert ignore into t1 select a from t1 on duplicate key update a=t1.a+1 ; drop table t1; @@ -171,13 +171,13 @@ SET SQL_MODE = 'TRADITIONAL'; CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL); ---error 1364 +--error ER_NO_DEFAULT_FOR_FIELD INSERT INTO t1 (a) VALUES (1); ---error 1364 +--error ER_NO_DEFAULT_FOR_FIELD INSERT INTO t1 (a) VALUES (1) ON DUPLICATE KEY UPDATE a = b; ---error 1364 +--error ER_NO_DEFAULT_FOR_FIELD INSERT INTO t1 (a) VALUES (1) ON DUPLICATE KEY UPDATE b = b; SELECT * FROM t1; @@ -278,7 +278,7 @@ INSERT INTO t1 (id,c1) VALUES (1,10); SELECT * FROM t1; CREATE TABLE t2 (id INT, c1 INT); INSERT INTO t2 VALUES (1,NULL), (2,2); ---error 1048 +--error ER_BAD_NULL_ERROR INSERT INTO t1 (id,c1) SELECT 1,NULL ON DUPLICATE KEY UPDATE c1=NULL; SELECT * FROM t1; @@ -290,6 +290,7 @@ INSERT IGNORE INTO t1 (id,c1) SELECT * FROM t2 SELECT * FROM t1; DROP TABLE t1; +DROP TABLE t2; # # Bug#28904: INSERT .. ON DUPLICATE was silently updating rows when it diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index 46de411677c..7bfe2491c7c 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -7,25 +7,25 @@ drop table if exists t1, t2; --enable_warnings create table t1 (a date, b date, c date not null, d date); -load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ','; -load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES; +load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ','; +load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES; SELECT * from t1; truncate table t1; -load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d); +load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d); SELECT * from t1; drop table t1; create table t1 (a text, b text); -load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by ''''; +load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by ''''; select concat('|',a,'|'), concat('|',b,'|') from t1; drop table t1; create table t1 (a int, b char(10)); -load data infile '../std_data_ln/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines; +load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines; select * from t1; truncate table t1; -load data infile '../std_data_ln/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines; +load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines; # The empty line last comes from the end line field in the file select * from t1; @@ -63,7 +63,7 @@ drop table t1; # ENCLOSED # create table t1 (a varchar(20), b varchar(20)); -load data infile '../std_data_ln/loaddata_dq.dat' into table t1 fields terminated by ',' enclosed by '"' escaped by '"' (a,b); +load data infile '../../std_data/loaddata_dq.dat' into table t1 fields terminated by ',' enclosed by '"' escaped by '"' (a,b); select * from t1; drop table t1; @@ -108,44 +108,44 @@ DROP TABLE t1,t2; # create table t1 (a int default 100, b int, c varchar(60)); # we can do something like this -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10, c=concat("b=",@b); +load data infile '../../std_data/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10, c=concat("b=",@b); select * from t1; truncate table t1; # we can use filled fields in expressions # we also assigning NULL value to field with non-NULL default here -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set c= if(a is null,"oops",a); +load data infile '../../std_data/rpl_loaddata.dat' into table t1 (a, @b) set c= if(a is null,"oops",a); select * from t1; truncate table t1; # we even can use variables in set clause, and missed columns will be set # with default values set @c:=123; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, b) set c= if(@a is null,@c,b); +load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, b) set c= if(@a is null,@c,b); select * from t1; # let us test side-effect of such load -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, @b); +load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, @b); select * from t1; select @a, @b; truncate table t1; # Reading of all columns with set -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 set c=b; +load data infile '../../std_data/rpl_loaddata.dat' into table t1 set c=b; select * from t1; truncate table t1; # now going to test fixed field-row file format -load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow"; +load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow"; select * from t1; truncate table t1; # this also should work -load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c=concat(a,"+",b,"+",@c,"+",b,"+",if(c is null,"NIL",c)); +load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c=concat(a,"+",b,"+",@c,"+",b,"+",if(c is null,"NIL",c)); select * from t1; # and this should bark --error 1409 -load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, @b); +load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, @b); # Now let us test LOAD DATA with subselect create table t2 (num int primary key, str varchar(10)); insert into t2 values (10,'Ten'), (15,'Fifteen'); truncate table t1; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@dummy,@n) set a= @n, c= (select str from t2 where num=@n); +load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@dummy,@n) set a= @n, c= (select str from t2 where num=@n); select * from t1; # @@ -163,7 +163,7 @@ set @@secure_file_priv= 0; # Test "load data" truncate table t1; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---error 1290 +--error ER_OPTION_PREVENTS_STATEMENT, ER_TEXTFILE_NOT_READABLE eval load data infile '$MYSQL_TEST_DIR/t/loaddata.test' into table t1; select * from t1; @@ -264,7 +264,7 @@ CREATE VIEW v2 AS SELECT 1 + 2 AS c0, c1, c2 FROM t1; CREATE VIEW v3 AS SELECT 1 AS d1, 2 AS d2; --echo -LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v1 +LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v1 FIELDS ESCAPED BY '\\' TERMINATED BY ',' ENCLOSED BY '"' @@ -280,7 +280,7 @@ SELECT * FROM v1; DELETE FROM t1; --echo -LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2 +LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v2 FIELDS ESCAPED BY '\\' TERMINATED BY ',' ENCLOSED BY '"' @@ -297,7 +297,7 @@ DELETE FROM t1; --echo --error ER_LOAD_DATA_INVALID_COLUMN -LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2 +LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v2 FIELDS ESCAPED BY '\\' TERMINATED BY ',' ENCLOSED BY '"' @@ -305,7 +305,7 @@ LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2 --echo --error ER_NON_UPDATABLE_TABLE -LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v3 +LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v3 FIELDS ESCAPED BY '\\' TERMINATED BY ',' ENCLOSED BY '"' @@ -526,7 +526,8 @@ select @@character_set_filesystem; LOAD DATA INFILE 't@002d1' INTO TABLE t1; SELECT * FROM t1; DROP TABLE t1; -remove_file $MYSQLTEST_VARDIR/master-data/test/t@002d1; +let $MYSQLD_DATADIR= `select @@datadir`; +remove_file $MYSQLD_DATADIR/test/t@002d1; SET character_set_filesystem=default; select @@character_set_filesystem; diff --git a/mysql-test/t/log_bin_trust_function_creators_func-master.opt b/mysql-test/t/log_bin_trust_function_creators_func-master.opt deleted file mode 100644 index 2dd562ea1aa..00000000000 --- a/mysql-test/t/log_bin_trust_function_creators_func-master.opt +++ /dev/null @@ -1 +0,0 @@ ---log-bin=test.log diff --git a/mysql-test/t/log_queries_not_using_indexes_basic.test b/mysql-test/t/log_queries_not_using_indexes_basic.test deleted file mode 100644 index d6de4d4ca02..00000000000 --- a/mysql-test/t/log_queries_not_using_indexes_basic.test +++ /dev/null @@ -1,103 +0,0 @@ - - -################## mysql-test\t\log_queries_not_using_indexes_basic.test ###### -# # -# Variable Name: log_queries_not_using_indexes # -# Scope: Global # -# Access Type: Static # -# Data Type: # -# # -# # -# Creation Date: 2008-02-07 # -# Author : Sharique Abdullah # -# # -# # -# Description:Test Cases of Dynamic System Variable log_queries_not_using_indexes# -# that checks the behavior of this variable in the following ways # -# * Value Check # -# * Scope Check # -# # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # -# # -############################################################################### - ---echo '#---------------------BS_STVARS_041_01----------------------#' -#################################################################### -# Displaying default value # -#################################################################### -SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes); ---echo 1 Expected - - ---echo '#---------------------BS_STVARS_041_02----------------------#' -# -# Test case for Bug #35433 -# -#################################################################### -# Check if Value can set # -#################################################################### - -#--error ER_INCORRECT_GLOBAL_LOCAL_VAR -SET @@GLOBAL.log_queries_not_using_indexes=1; ---echo Expected error 'Read only variable' ---ECHO "BUG:It should give error on setting this variable as it is readonly variable" -SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes); ---echo 1 Expected - - - - ---echo '#---------------------BS_STVARS_041_03----------------------#' -################################################################# -# Check if the value in GLOBAL Table matches value in variable # -################################################################# - -SELECT @@GLOBAL.log_queries_not_using_indexes = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='log_queries_not_using_indexes'; ---echo 1 Expected - -SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes); ---echo 1 Expected - -SELECT COUNT(VARIABLE_VALUE) -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='log_queries_not_using_indexes'; ---echo 1 Expected - - - ---echo '#---------------------BS_STVARS_041_04----------------------#' -################################################################################ -# Check if accessing variable with and without GLOBAL point to same variable # -################################################################################ -SELECT @@log_queries_not_using_indexes = @@GLOBAL.log_queries_not_using_indexes; ---echo 1 Expected - - - ---echo '#---------------------BS_STVARS_041_05----------------------#' -################################################################################ -# Check if log_queries_not_using_indexes can be accessed with and without @@ sign # -################################################################################ - -SELECT COUNT(@@log_queries_not_using_indexes); ---echo 1 Expected - ---Error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT COUNT(@@local.log_queries_not_using_indexes); ---echo Expected error 'Variable is a GLOBAL variable' - ---Error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT COUNT(@@SESSION.log_queries_not_using_indexes); ---echo Expected error 'Variable is a GLOBAL variable' - -SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes); ---echo 1 Expected - ---Error ER_BAD_FIELD_ERROR -SELECT log_queries_not_using_indexes = @@SESSION.log_queries_not_using_indexes; ---echo Expected error 'Readonly variable' - - diff --git a/mysql-test/t/log_state.test b/mysql-test/t/log_state.test index 977b74aa1e3..e40dd1e3491 100644 --- a/mysql-test/t/log_state.test +++ b/mysql-test/t/log_state.test @@ -1,7 +1,30 @@ --- source include/not_embedded.inc +### t/log_state.test ### +# +# This test suffers from server +# Bug#38124 "general_log_file" variable silently unset when using expression +# In short: +# SET GLOBAL general_log_file = @<whatever> +# SET GLOBAL slow_query_log = @<whatever> +# cause that the value of these server system variables is set to default +# instead of the assigned values. There comes no error message or warning. +# If this bug is fixed please +# 1. try this test with "let $fixed_bug38124 = 0;" +# 2. remove all workarounds if 1. was successful. +let $fixed_bug38124 = 0; + +--source include/not_embedded.inc --source include/have_csv.inc +# Several subtests modify global variables. Save the initial values only here, +# but reset to the initial values per subtest. +SET @old_general_log= @@global.general_log; +SET @old_general_log_file= @@global.general_log_file; +SET @old_slow_query_log= @@global.slow_query_log; +SET @old_slow_query_log_file= @@global.slow_query_log_file; + + --disable_ps_protocol + set global general_log= OFF; truncate table mysql.general_log; truncate table mysql.slow_log; @@ -23,20 +46,32 @@ show global variables where Variable_name = 'log' or Variable_name = 'log_slow_queries' or Variable_name = 'general_log' or Variable_name = 'slow_query_log'; +--echo # Establish connection con1 (user=root) connect (con1,localhost,root,,); +--echo # Switch to connection con1 connection con1; -set session long_query_time=1; -select sleep(2); +# Please increase @long_query_time if the corresponding selects show an +# additional unexpected entry like +# start_time ... sql_text +# TIMESTAMP ... set session long_query_time=... +# (Bug#40377 sporadic pushbuild failure in log_state: result mismatch) +--replace_result 2 <long_query_time> +set @long_query_time = 2; +set session long_query_time = @long_query_time; +select sleep(@long_query_time + 1); --replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%'; +--echo # Switch to connection default connection default; set global slow_query_log= ON; +--echo # Switch to connection con1 connection con1; -set session long_query_time=1; -select sleep(2); +set session long_query_time = @long_query_time; +select sleep(@long_query_time + 1); --replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%'; +--echo # Switch to connection default connection default; show global variables where Variable_name = 'log' or Variable_name = 'log_slow_queries' or @@ -71,16 +106,16 @@ show variables like 'slow_query_log_file'; show variables like 'log_output'; # Can't set general_log_file to a non existing file ---error 1231 -set global general_log_file='/not exiting path/log.master'; +--error ER_WRONG_VALUE_FOR_VAR +set global general_log_file='/not existing path/log.master'; # Can't set general_log_file to a directory --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---error 1231 +--error ER_WRONG_VALUE_FOR_VAR eval set global general_log_file='$MYSQLTEST_VARDIR'; # Can't set general_log_file to empty string ---error 1231 +--error ER_WRONG_VALUE_FOR_VAR set global general_log_file=''; --replace_column 2 # @@ -126,17 +161,30 @@ drop table t1; --replace_column 1 TIMESTAMP 2 USER_HOST 3 # select * from mysql.general_log; -# -# Bug#29129 (Resetting general_log while the GLOBAL READ LOCK is set causes -# a deadlock) +# Reset to initial values +SET @@global.general_log = @old_general_log; +SET @@global.general_log_file = @old_general_log_file; +SET @@global.slow_query_log = @old_slow_query_log; +SET @@global.slow_query_log_file = @old_slow_query_log_file; +if(!$fixed_bug38124) +{ + --disable_query_log + let $my_var = `SELECT @old_general_log_file`; + eval SET @@global.general_log_file = '$my_var'; + let $my_var = `SELECT @old_slow_query_log_file`; + eval SET @@global.slow_query_log_file = '$my_var'; + --enable_query_log +} -# save state -SET @old_general_log_state = @@global.general_log; -SET @old_slow_log_state = @@global.slow_query_log; +########################################################################### -# Test ON->OFF transition under a GLOBAL READ LOCK +# +# Bug#29129 (Resetting general_log while the GLOBAL READ LOCK is set causes +# a deadlock) +# +# Test ON->OFF transition under a GLOBAL READ LOCK SET GLOBAL general_log = ON; SET GLOBAL slow_query_log = ON; @@ -148,7 +196,6 @@ SET GLOBAL slow_query_log = OFF; UNLOCK TABLES; # Test OFF->ON transition under a GLOBAL READ LOCK - FLUSH TABLES WITH READ LOCK; SET GLOBAL general_log = ON; @@ -157,7 +204,6 @@ SET GLOBAL slow_query_log = ON; UNLOCK TABLES; # Test ON->OFF transition under a GLOBAL READ_ONLY - SET GLOBAL READ_ONLY = ON; SET GLOBAL general_log = OFF; @@ -166,7 +212,6 @@ SET GLOBAL slow_query_log = OFF; SET GLOBAL READ_ONLY = OFF; # Test OFF->ON transition under a GLOBAL READ_ONLY - SET GLOBAL READ_ONLY = ON; SET GLOBAL general_log = ON; @@ -174,17 +219,18 @@ SET GLOBAL slow_query_log = ON; SET GLOBAL READ_ONLY = OFF; -# Restore state +# Reset to initial values +SET GLOBAL general_log = @old_general_log; +SET GLOBAL slow_query_log = @old_slow_query_log; -SET GLOBAL general_log = @old_general_log_state; -SET GLOBAL slow_query_log = @old_slow_log_state; + +########################################################################### # -# Bug #29131: SHOW VARIABLES reports variable 'log' but SET doesn't recognize it +# Bug#29131: SHOW VARIABLES reports variable 'log' but SET doesn't recognize it # -SET @old_general_log_state = @@global.general_log; -SET @old_slow_log_state = @@global.slow_query_log; +SET GLOBAL general_log = ON; SHOW VARIABLES LIKE 'general_log'; SHOW VARIABLES LIKE 'log'; @@ -210,67 +256,84 @@ SHOW VARIABLES LIKE 'slow_query_log'; SHOW VARIABLES LIKE 'log_slow_queries'; SELECT @@slow_query_log, @@log_slow_queries; -SET GLOBAL general_log = @old_general_log_state; -SET GLOBAL slow_query_log = @old_slow_log_state; +SET GLOBAL general_log = @old_general_log; +SET GLOBAL slow_query_log = @old_slow_query_log; + + +########################################################################### # -# Bug #31604: server crash when setting slow_query_log_file/general_log_file +# Bug#31604: server crash when setting slow_query_log_file/general_log_file # -set @old_general_log_file= @@global.general_log_file; -set @old_slow_query_log_file= @@global.slow_query_log_file; - ---error 1231 -set global general_log_file= concat('/not exiting path/log.maste', 'r'); ---error 1231 -set global general_log_file= NULL; ---error 1231 -set global slow_query_log_file= concat('/not exiting path/log.maste', 'r'); ---error 1231 -set global slow_query_log_file= NULL; -set global general_log_file= @old_general_log_file; -set global slow_query_log_file= @old_slow_query_log_file; +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL general_log_file= CONCAT('/not existing path/log.maste', 'r'); +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL general_log_file= NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL slow_query_log_file= CONCAT('/not existing path/log.maste', 'r'); +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL slow_query_log_file= NULL; + +# Reset to initial values in case a setting above was successful. +SET GLOBAL general_log_file= @old_general_log_file; +SET GLOBAL slow_query_log_file= @old_slow_query_log_file; +if(!$fixed_bug38124) +{ + --disable_query_log + let $my_var = `SELECT @old_general_log_file`; + eval SET @@global.general_log_file = '$my_var'; + let $my_var = `SELECT @old_slow_query_log_file`; + eval SET @@global.slow_query_log_file = '$my_var'; + --enable_query_log +} ########################################################################### --echo --echo # -- --echo # -- Bug#32748: Inconsistent handling of assignments to ---echo # -- general_log_file/slow_query_log_file. +--echo # -- general_log_file/slow_query_log_file. --echo # -- --echo -SET @general_log_file_saved = @@global.general_log_file; -SET @slow_query_log_file_saved = @@global.slow_query_log_file; - ---echo SET GLOBAL general_log_file = 'bug32748.query.log'; SET GLOBAL slow_query_log_file = 'bug32748.slow.log'; --echo SHOW VARIABLES LIKE '%log_file'; +# Reset to initial values --echo -SET GLOBAL general_log_file = @general_log_file_saved; -SET GLOBAL slow_query_log_file = @slow_query_log_file_saved; +SET GLOBAL general_log_file = @old_general_log_file; +SET GLOBAL slow_query_log_file = @old_slow_query_log_file; +if(!$fixed_bug38124) +{ + --disable_query_log + let $my_var = `SELECT @old_general_log_file`; + eval SET @@global.general_log_file = '$my_var'; + let $my_var = `SELECT @old_slow_query_log_file`; + eval SET @@global.slow_query_log_file = '$my_var'; + --enable_query_log +} --echo --echo # -- End of Bug#32748. -########################################################################### - +########################################################################### -## WL#4403 - deprecate @log and @slow_log_queries variables +# WL#4403 - deprecate @log and @slow_log_queries variables -## these are all deprecated -- show for command-line as well! +# These server system variables are all deprecated +# -- show for command-line as well! --echo deprecated: SET GLOBAL log = 0; SET GLOBAL log_slow_queries = 0; SET GLOBAL log = DEFAULT; SET GLOBAL log_slow_queries = DEFAULT; -## these are NOT deprecated +# These server system variables are NOT deprecated. --echo not deprecated: SELECT @@global.general_log_file INTO @my_glf; SELECT @@global.slow_query_log_file INTO @my_sqlf; @@ -283,6 +346,20 @@ SET GLOBAL slow_query_log_file = @my_sqlf; SET GLOBAL general_log = DEFAULT; SET GLOBAL slow_query_log = DEFAULT; +## Reset to initial values +SET @@global.general_log = @old_general_log; +SET @@global.general_log_file = @old_general_log_file; +SET @@global.slow_query_log = @old_slow_query_log; +SET @@global.slow_query_log_file = @old_slow_query_log_file; +if(!$fixed_bug38124) +{ + --disable_query_log + let $my_var = `SELECT @old_general_log_file`; + eval SET @@global.general_log_file = '$my_var'; + let $my_var = `SELECT @old_slow_query_log_file`; + eval SET @@global.slow_query_log_file = '$my_var'; + --enable_query_log +} --echo End of 5.1 tests @@ -290,10 +367,30 @@ SET GLOBAL slow_query_log = DEFAULT; --enable_ps_protocol # -# Cleanup (must be done last to avoid delayed 'Quit' message in general log) +# Cleanup # +# Disconnect must be done last to avoid delayed 'Quit' message in general log +--echo # Close connection con1 disconnect con1; +# set back the saved default values +connection default; + +# Reset global system variables to initial values if forgotten somewhere above. +SET global general_log = @old_general_log; +SET global general_log_file = @old_general_log_file; +SET global slow_query_log = @old_slow_query_log; +SET global slow_query_log_file = @old_slow_query_log_file; +if(!$fixed_bug38124) +{ + --disable_query_log + let $my_var = `SELECT @old_general_log_file`; + eval SET @@global.general_log_file = '$my_var'; + let $my_var = `SELECT @old_slow_query_log_file`; + eval SET @@global.slow_query_log_file = '$my_var'; + --enable_query_log +} # Remove the log files that was created in the "default location" # i.e var/run ---remove_file $MYSQLTEST_VARDIR/run/master.log +--remove_file $MYSQLTEST_VARDIR/run/mysqld.log +--remove_file $MYSQLTEST_VARDIR/tmp/log.master diff --git a/mysql-test/t/log_tables.test b/mysql-test/t/log_tables.test index bdd22538c14..326914f09d9 100644 --- a/mysql-test/t/log_tables.test +++ b/mysql-test/t/log_tables.test @@ -7,6 +7,12 @@ # check that CSV engine was compiled in --source include/have_csv.inc +SET @old_general_log_state = @@global.general_log; +SET @old_log_output= @@global.log_output; +SET @old_slow_query_log= @@global.slow_query_log; +SET @old_general_log= @@global.general_log; +SET @old_long_query_time= @@session.long_query_time; + --disable_ps_protocol use mysql; @@ -525,7 +531,8 @@ FLUSH LOGS; ALTER TABLE mysql.slow_log DROP COLUMN seq; ALTER TABLE mysql.slow_log ENGINE = CSV; -SET GLOBAL slow_query_log = @saved_slow_query_log; +SET GLOBAL general_log = @old_general_log; +SET GLOBAL slow_query_log = @old_slow_query_log; # # Bug#25422 (Hang with log tables) @@ -829,8 +836,8 @@ DROP PROCEDURE IF EXISTS `db_17876.archiveSlowLog`; DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`; DROP DATABASE IF EXISTS `db_17876`; -SET GLOBAL general_log = @saved_general_log; -SET GLOBAL slow_query_log = @saved_slow_query_log; +SET GLOBAL general_log = @old_general_log; +SET GLOBAL slow_query_log = @old_slow_query_log; # # Bug#21557 entries in the general query log truncated at 1000 characters. @@ -948,7 +955,7 @@ execute long_query using @lparam; set global general_log = off; select command_type, argument from mysql.general_log where thread_id = @thread_id; deallocate prepare long_query; -set global general_log = @saved_general_log; +set global general_log = @old_general_log; # # Bug#34306: Can't make copy of log tables when server binary log is enabled @@ -1020,10 +1027,8 @@ DROP TABLE t1; TRUNCATE TABLE mysql.slow_log; -# RESET altered system variables before exiting the test -SET GLOBAL slow_query_log = @saved_slow_query_log; -SET GLOBAL general_log=@saved_general_log; -SET SESSION long_query_time =@saved_long_query_time; -SET GLOBAL LOG_OUTPUT = @saved_log_output; - +SET @@session.long_query_time= @old_long_query_time; +SET @@global.log_output= @old_log_output; +SET @@global.slow_query_log= @old_slow_query_log; +SET @@global.general_log= @old_general_log; diff --git a/mysql-test/t/lowercase_table3.test b/mysql-test/t/lowercase_table3.test index d3c9ec5145e..e71d9029606 100644 --- a/mysql-test/t/lowercase_table3.test +++ b/mysql-test/t/lowercase_table3.test @@ -9,6 +9,8 @@ --source include/have_case_insensitive_file_system.inc --source include/not_windows.inc +call mtr.add_suppression("Cannot find or open table test/BUG29839 from"); + --disable_warnings DROP TABLE IF EXISTS t1,T1; --enable_warnings diff --git a/mysql-test/t/myisam-system.test b/mysql-test/t/myisam-system.test index c4a7651ac7d..dc5bb58b6a2 100644 --- a/mysql-test/t/myisam-system.test +++ b/mysql-test/t/myisam-system.test @@ -7,14 +7,15 @@ drop table if exists t1,t2; --enable_warnings create table t1 (a int) engine=myisam; ---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI +let $MYSQLD_DATADIR= `select @@datadir`; +--remove_file $MYSQLD_DATADIR/test/t1.MYI drop table if exists t1; create table t1 (a int) engine=myisam; ---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI +--remove_file $MYSQLD_DATADIR/test/t1.MYI --error 1051,6 drop table t1; create table t1 (a int) engine=myisam; ---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD +--remove_file $MYSQLD_DATADIR/test/t1.MYD --error 1105,6,29 drop table t1; --error 1051 diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 76d37fdc734..b5099695e47 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1473,8 +1473,9 @@ CREATE TABLE t1 ( KEY (c1), KEY (c2) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MYISAMCHK -d $MYSQLTEST_VARDIR/master-data/test/t1 +let $MYSQLD_DATADIR= `select @@datadir`; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--exec $MYISAMCHK -d $MYSQLD_DATADIR/test/t1 DROP TABLE t1; # Test warnings with transactional=1 with MyISAM diff --git a/mysql-test/t/myisampack.test b/mysql-test/t/myisampack.test index 6598af6318a..2650c0d2cc3 100644 --- a/mysql-test/t/myisampack.test +++ b/mysql-test/t/myisampack.test @@ -26,8 +26,35 @@ INSERT INTO t1 VALUES (2.22402118719591e-05,2.37546284320705e-05,2.58463051055541e-05,1.83391609130854e-05,1.6300720519646e-05,1.74559091886791e-05,1.63733785575587e-05,2.26616253279828e-05,1.79541237435621e-05,45), (3.01092775359837e-05,3.23865212934412e-05,4.09444584045994e-05,0,2.15470966302776e-05,2.39082636344032e-05,2.28296706429177e-05,2.9007671511595e-05,2.44201138973326e-05,46); FLUSH TABLES; ---exec $MYISAMPACK -s $MYSQLTEST_VARDIR/master-data/test/t1 ---exec $MYISAMCHK -srq $MYSQLTEST_VARDIR/master-data/test/t1 ---exec $MYISAMCHK -s --unpack $MYSQLTEST_VARDIR/master-data/test/t1 +let $MYSQLD_DATADIR= `select @@datadir`; +--exec $MYISAMPACK -s $MYSQLD_DATADIR/test/t1 +--exec $MYISAMCHK -srq $MYSQLD_DATADIR/test/t1 +--exec $MYISAMCHK -s --unpack $MYSQLD_DATADIR/test/t1 CHECK TABLE t1 EXTENDED; DROP TABLE t1; + +# +# Bug#40949 Debug version of MySQL server crashes when run OPTIMIZE on compressed table. +# +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1(f1 int, f2 char(255)); +insert into t1 values(1, 'foo'), (2, 'bar'); +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +flush tables; +let $MYSQLD_DATADIR= `select @@datadir`; +--exec $MYISAMPACK $MYSQLD_DATADIR/test/t1 +optimize table t1; +drop table t1; diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index 528337da77b..a182da5fbea 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -291,6 +291,30 @@ EOF --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug29323.sql 2>&1 remove_file $MYSQLTEST_VARDIR/tmp/bug29323.sql; +# +# Bug #33812: mysql client incorrectly parsing DELIMITER +# +# The space and ; after delimiter are important +--exec $MYSQL -e "select 1 delimiter ;" + +# +# Bug #38158: mysql client regression, can't read dump files +# +--write_file $MYSQLTEST_VARDIR/tmp/bug38158.sql +-- Testing +-- +delimiter || +select 2 || +EOF +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug38158.sql 2>&1 +--exec $MYSQL -c < $MYSQLTEST_VARDIR/tmp/bug38158.sql 2>&1 +remove_file $MYSQLTEST_VARDIR/tmp/bug38158.sql; + +# +# Bug #41437: Value stored in 'case' lacks charset, causees segfault +# +--exec $MYSQL -e "select @z:='1',@z=database()" + --echo End of 5.0 tests # diff --git a/mysql-test/t/mysql_client_test.test b/mysql-test/t/mysql_client_test.test index 7667522feaf..15c0cd4ac84 100644 --- a/mysql-test/t/mysql_client_test.test +++ b/mysql-test/t/mysql_client_test.test @@ -1,6 +1,8 @@ # This test should work in embedded server after we fix mysqltest -- source include/not_embedded.inc +SET @old_general_log= @@global.general_log; + # We run with different binaries for normal and --embedded-server # # If this test fails with "command "$MYSQL_CLIENT_TEST" failed", @@ -14,3 +16,4 @@ # End of 4.1 tests echo ok; +SET @@global.general_log= @old_general_log; diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test index 233e8c7c256..6b2ce0cd2d6 100644 --- a/mysql-test/t/mysql_upgrade.test +++ b/mysql-test/t/mysql_upgrade.test @@ -15,7 +15,8 @@ select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade; --exec $MYSQL_UPGRADE --skip-verbose 2>&1 # It should have created a file in the MySQL Servers datadir -file_exists $MYSQLTEST_VARDIR/master-data/mysql_upgrade_info; +let $MYSQLD_DATADIR= `select @@datadir`; +file_exists $MYSQLD_DATADIR/mysql_upgrade_info; --echo Run it again - should say already completed --replace_result $MYSQL_SERVER_VERSION VERSION @@ -23,13 +24,13 @@ file_exists $MYSQLTEST_VARDIR/master-data/mysql_upgrade_info; --exec $MYSQL_UPGRADE --skip-verbose 2>&1 # It should have created a file in the MySQL Servers datadir -file_exists $MYSQLTEST_VARDIR/master-data/mysql_upgrade_info; +file_exists $MYSQLD_DATADIR/mysql_upgrade_info; --echo Force should run it regardless of wether it's been run before --exec $MYSQL_UPGRADE --skip-verbose --force 2>&1 # It should have created a file in the MySQL Servers datadir -file_exists $MYSQLTEST_VARDIR/master-data/mysql_upgrade_info; +file_exists $MYSQLD_DATADIR/mysql_upgrade_info; # diff --git a/mysql-test/t/mysqlbinlog-cp932.test b/mysql-test/t/mysqlbinlog-cp932.test index 4ca0eedaece..a7055bfc8ca 100644 --- a/mysql-test/t/mysqlbinlog-cp932.test +++ b/mysql-test/t/mysqlbinlog-cp932.test @@ -13,7 +13,8 @@ create table t4 (f text character set cp932); --exec $MYSQL --default-character-set=cp932 test -e "insert into t4 values(_cp932'ƒ\');" flush logs; rename table t3 to t03, t4 to t04; ---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000002 | $MYSQL --default-character-set=utf8 +let $MYSQLD_DATADIR= `select @@datadir`; +--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000002 | $MYSQL --default-character-set=utf8 # original and recovered data must be equal select HEX(f) from t03; select HEX(f) from t3; diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index eb364c60e71..e0595674cf9 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -4,6 +4,9 @@ -- source include/have_log_bin.inc +# Deletes all the binary logs +reset master; + # we need this for getting fixed timestamps inside of this test set timestamp=1000000000; @@ -23,11 +26,11 @@ insert into t2 values (); # test for load data and load data distributed among the several # files (we need to fill up first binlog) -load data infile '../std_data_ln/words.dat' into table t1; -load data infile '../std_data_ln/words.dat' into table t1; -load data infile '../std_data_ln/words.dat' into table t1; -load data infile '../std_data_ln/words.dat' into table t1; -load data infile '../std_data_ln/words.dat' into table t1; +load data infile '../../std_data/words.dat' into table t1; +load data infile '../../std_data/words.dat' into table t1; +load data infile '../../std_data/words.dat' into table t1; +load data infile '../../std_data/words.dat' into table t1; +load data infile '../../std_data/words.dat' into table t1; # simple query to show more in second binlog insert into t1 values ("Alas"); flush logs; @@ -41,10 +44,10 @@ select "--- Local --" as ""; # We should use --short-form everywhere because in other case output will # be time dependend. Better than nothing. # - +let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000001 # this should not fail but shouldn't produce any working statements --disable_query_log @@ -52,7 +55,7 @@ select "--- Broken LOAD DATA --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000002 2> /dev/null +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000002 2> /dev/null # this should show almost nothing --disable_query_log @@ -60,7 +63,7 @@ select "--- --database --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --database=nottest $MYSQLTEST_VARDIR/log/master-bin.000001 2> /dev/null +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --database=nottest $MYSQLD_DATADIR/master-bin.000001 2> /dev/null # this test for position option --disable_query_log @@ -68,7 +71,7 @@ select "--- --position --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=239 $MYSQLTEST_VARDIR/log/master-bin.000002 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=239 $MYSQLD_DATADIR/master-bin.000002 # These are tests for remote binlog. # They should return the same as previous test. @@ -137,7 +140,7 @@ EOF # must be digestable for both client and server. In 4.1 the client # should use default-character-set same as the server. flush logs; ---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000004 | $MYSQL +--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000004 | $MYSQL select * from t5 /* must be (1),(1) */; drop table t5; @@ -156,7 +159,7 @@ insert into t5 values (3, date_format('2001-01-01','%W')); select * from t5 order by c1; flush logs; drop table t5; ---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000006 | $MYSQL +--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000006 | $MYSQL select * from t5 order by c1; drop table t5; @@ -180,8 +183,8 @@ drop procedure p1; --error 1305 call p1(); --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ ---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000008 ---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000008 | $MYSQL +--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008 +--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008 | $MYSQL call p1(); drop procedure p1; @@ -200,23 +203,23 @@ drop procedure p1; flush logs; create table t1 (a varchar(64) character set utf8); -load data infile '../std_data_ln/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; set character_set_database=koi8r; -load data infile '../std_data_ln/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; set character_set_database=latin1; -load data infile '../std_data_ln/loaddata6.dat' into table t1; -load data infile '../std_data_ln/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; set character_set_database=koi8r; -load data infile '../std_data_ln/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1; set character_set_database=latin1; -load data infile '../std_data_ln/loaddata6.dat' into table t1; -load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8r; +load data infile '../../std_data/loaddata6.dat' into table t1; +load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8r; select hex(a) from t1; drop table t1; flush logs; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000010 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000010 # # Bug#28293 missed '#' sign in the hex dump when the dump length @@ -229,7 +232,7 @@ flush logs; INSERT INTO t1 VALUES ('0123456789'); flush logs; DROP TABLE t1; ---exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000012 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g' +--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000012 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g' # # Bug #29928: incorrect connection_id() restoring from mysqlbinlog out @@ -239,7 +242,7 @@ create table t1(a int); insert into t1 values(connection_id()); let $a= `select a from t1`; flush logs; ---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000014 > $MYSQLTEST_VARDIR/tmp/bug29928.sql +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000014 > $MYSQLTEST_VARDIR/tmp/bug29928.sql drop table t1; connect (con1, localhost, root, , test); connection con1; @@ -263,8 +266,8 @@ exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTES # flush logs; --error 1 ---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000016 >/dev/null 2>/dev/null ---exec $MYSQL_BINLOG --force-if-open $MYSQLTEST_VARDIR/log/master-bin.000016 >/dev/null 2>/dev/null +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null +--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null --echo BUG#31611: Security risk with BINLOG statement @@ -280,7 +283,7 @@ flush logs; INSERT INTO t1 VALUES (1,USER()); flush logs; echo mysqlbinlog var/log/master-bin.000017 > var/tmp/bug31611.sql; -exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000017 > $MYSQLTEST_VARDIR/tmp/bug31611.sql; +exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000017 > $MYSQLTEST_VARDIR/tmp/bug31611.sql; connect (unsecure,localhost,untrusted,,mysqltest1); echo mysql mysqltest1 -uuntrusted < var/tmp/bug31611.sql; error 1; @@ -313,7 +316,7 @@ query_vertical SELECT * FROM t1; DROP TABLE t1; echo >> mysqlbinlog var/log/master-bin.000019 > var/tmp/bug32580.sql; -exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000019 > $MYSQLTEST_VARDIR/tmp/bug32580.sql; +exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000019 > $MYSQLTEST_VARDIR/tmp/bug32580.sql; echo >> mysql test < var/tmp/bug32580.sql; exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug32580.sql; remove_file $MYSQLTEST_VARDIR/tmp/bug32580.sql; diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test index 59017b09c54..d6be029ea56 100644 --- a/mysql-test/t/mysqlbinlog2.test +++ b/mysql-test/t/mysqlbinlog2.test @@ -40,33 +40,33 @@ select "--- Local --" as ""; # We should use --short-form everywhere because in other case output will # be time dependent (the Start events). Better than nothing. # - ---exec $MYSQL_BINLOG --short-form --base64-output=never $MYSQLTEST_VARDIR/log/master-bin.000001 +let $MYSQLD_DATADIR= `select @@datadir`; +--exec $MYSQL_BINLOG --short-form --base64-output=never $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- offset --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --offset=2 $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --offset=2 $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- start-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- stop-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --stop-position=608 $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --stop-position=608 $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- start and stop positions ---" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- stop-datetime --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- Local with 2 binlogs on command line --" as ""; @@ -75,28 +75,28 @@ select "--- Local with 2 binlogs on command line --" as ""; # This is to verify that some options apply only to first, or last binlog flush logs; ---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002 +--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 --disable_query_log select "--- offset --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --offset=2 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002 +--exec $MYSQL_BINLOG --short-form --offset=2 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 --disable_query_log select "--- start-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002 +--exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 --disable_query_log select "--- stop-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --stop-position=134 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002 +--exec $MYSQL_BINLOG --short-form --stop-position=134 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002 +--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 --disable_query_log select "--- stop-datetime --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002 +--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 --disable_query_log select "--- Remote --" as ""; diff --git a/mysql-test/t/mysqlbinlog_base64.test b/mysql-test/t/mysqlbinlog_base64.test index 1b5dc67c150..fb21e28fdcb 100644 --- a/mysql-test/t/mysqlbinlog_base64.test +++ b/mysql-test/t/mysqlbinlog_base64.test @@ -1,5 +1,10 @@ -- source include/have_binlog_format_row.inc # +# Reset master to cleanup binlog +# +reset master; + +# # Write different events to binlog # create table t1 (a int); @@ -10,13 +15,14 @@ update t1 set a=a+2 where a=2; update t1 set a=a+2 where a=3; create table t2 (word varchar(20)); -load data infile '../std_data_ln/words.dat' into table t2; +load data infile '../../std_data/words.dat' into table t2; # # Save binlog # +let $MYSQLD_DATADIR=`select @@datadir`; flush logs; ---exec $MYSQL_BINLOG --hexdump $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql +--exec $MYSQL_BINLOG --hexdump $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql # # Clear database and restore from binlog @@ -38,7 +44,7 @@ select * from t2; flush logs; drop table t2; create table t2 (word varchar(20)); -load data infile '../std_data_ln/words.dat' into table t2; +load data infile '../../std_data/words.dat' into table t2; insert into t2 select * from t2; insert into t2 select * from t2; insert into t2 select * from t2; @@ -51,7 +57,7 @@ insert into t2 select * from t2; select count(*) from t2; flush logs; ---exec $MYSQL_BINLOG --hexdump $MYSQLTEST_VARDIR/log/master-bin.000003 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql +--exec $MYSQL_BINLOG --hexdump $MYSQLD_DATADIR/master-bin.000003 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql --exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql # @@ -62,6 +68,6 @@ select count(*) from t2; # # Test cleanup # ---exec rm $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql +--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql drop table t1; drop table t2; diff --git a/mysql-test/t/mysqlbinlog_row.test b/mysql-test/t/mysqlbinlog_row.test index 9d94e1f55e7..9b41c63d195 100644 --- a/mysql-test/t/mysqlbinlog_row.test +++ b/mysql-test/t/mysqlbinlog_row.test @@ -443,4 +443,4 @@ flush logs; let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/ ---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 diff --git a/mysql-test/t/mysqlbinlog_row_big.test b/mysql-test/t/mysqlbinlog_row_big.test index 62c8c7df327..14e818e7214 100644 --- a/mysql-test/t/mysqlbinlog_row_big.test +++ b/mysql-test/t/mysqlbinlog_row_big.test @@ -38,7 +38,7 @@ SET timestamp=1000000000; --echo # --echo # We need big packets. --echo # -SET @@session.max_allowed_packet= 1024*1024*1024; +SET @@global.max_allowed_packet= 1024*1024*1024; --echo # --echo # Delete all existing binary logs. @@ -115,7 +115,7 @@ FLUSH LOGS; let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ ---exec $MYSQL_BINLOG -v -v $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/$mysqlbinlog_output +--exec $MYSQL_BINLOG -v -v $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/$mysqlbinlog_output --echo # --echo # Cleanup. diff --git a/mysql-test/t/mysqlbinlog_row_trans.test b/mysql-test/t/mysqlbinlog_row_trans.test index d84b1743783..24abc441c4c 100644 --- a/mysql-test/t/mysqlbinlog_row_trans.test +++ b/mysql-test/t/mysqlbinlog_row_trans.test @@ -151,7 +151,7 @@ FLUSH LOGS; let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ ---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 --echo # --echo # Cleanup. diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test index 0e675731fd5..e834c60dcb5 100644 --- a/mysql-test/t/mysqlcheck.test +++ b/mysql-test/t/mysqlcheck.test @@ -14,6 +14,9 @@ DROP TABLE IF EXISTS t1, `t``1`, `t 1`; drop view if exists v1; drop database if exists client_test_db; +# Repair any tables in mysql, sometimes the slow_log is marked as crashed +# after server has been killed +--exec $MYSQL_CHECK --repair --databases mysql > /dev/null 2>&1 --enable_warnings # @@ -55,9 +58,10 @@ create table t_bug25347 (a int); create view v_bug25347 as select * from t_bug25347; insert into t_bug25347 values (1),(2),(3); flush tables; +let $MYSQLD_DATADIR= `select @@datadir`; --echo removing and creating ---remove_file $MYSQLTEST_VARDIR/master-data/d_bug25347/t_bug25347.MYI ---write_file $MYSQLTEST_VARDIR/master-data/d_bug25347/t_bug25347.MYI +--remove_file $MYSQLD_DATADIR/d_bug25347/t_bug25347.MYI +--write_file $MYSQLD_DATADIR/d_bug25347/t_bug25347.MYI EOF --exec $MYSQL_CHECK --repair --databases d_bug25347 --error 130 @@ -78,7 +82,6 @@ create view v1 as select * from information_schema.routines; check table v1, information_schema.routines; drop view v1; - # # Bug#37527: mysqlcheck fails to report entire database # when frm file corruption @@ -86,29 +89,109 @@ drop view v1; CREATE TABLE t1(a INT); CREATE TABLE t2(a INT); # backup then null t1.frm ---copy_file $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm.bak ---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm ---write_file $MYSQLTEST_VARDIR/master-data/test/t1.frm +--copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/t1.frm.bak +--remove_file $MYSQLD_DATADIR/test/t1.frm +--write_file $MYSQLD_DATADIR/test/t1.frm EOF --exec $MYSQL_CHECK test # restore t1.frm ---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm ---copy_file $MYSQLTEST_VARDIR/master-data/test/t1.frm.bak $MYSQLTEST_VARDIR/master-data/test/t1.frm ---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm.bak +--remove_file $MYSQLD_DATADIR/test/t1.frm +--copy_file $MYSQLD_DATADIR/test/t1.frm.bak $MYSQLD_DATADIR/test/t1.frm +--remove_file $MYSQLD_DATADIR/test/t1.frm.bak DROP TABLE t1, t2; --echo End of 5.0 tests + # # Bug #30679: 5.1 name encoding not performed for views during upgrade # create table t1(a int); create view v1 as select * from t1; show tables; ---copy_file $MYSQLTEST_VARDIR/master-data/test/v1.frm $MYSQLTEST_VARDIR/master-data/test/v-1.frm +let $MYSQLD_DATADIR= `select @@datadir`; +--copy_file $MYSQLD_DATADIR/test/v1.frm $MYSQLD_DATADIR/test/v-1.frm show tables; --exec $MYSQL_CHECK --check-upgrade --fix-table-names --databases test show tables; drop view v1, `v-1`; drop table t1; + + +# +# Bug #33094: Error in upgrading from 5.0 to 5.1 when table contains triggers +# Bug #41385: Crash when attempting to repair a #mysql50# upgraded table with +# triggers +# +SET NAMES utf8; +CREATE TABLE `#mysql50#@` (a INT); +SHOW TABLES; +SET NAMES DEFAULT; +--echo mysqlcheck --fix-table-names --databases test +--exec $MYSQL_CHECK --fix-table-names --databases test +SET NAMES utf8; +SHOW TABLES; +DROP TABLE `@`; + +CREATE TABLE `Ñ` (a INT); +SET NAMES DEFAULT; +--echo mysqlcheck --default-character-set="latin1" --databases test +# Error returned depends on platform, replace it with "Table doesn't exist" +--replace_result "Can't find file: './test/@003f.frm' (errno: 22)" "Table doesn't exist" "Table 'test.?' doesn't exist" "Table doesn't exist" +--exec $MYSQL_CHECK --default-character-set="latin1" --databases test +--echo mysqlcheck --default-character-set="utf8" --databases test +--exec $MYSQL_CHECK --default-character-set="utf8" --databases test +SET NAMES utf8; +DROP TABLE `Ñ`; +SET NAMES DEFAULT; + +CREATE DATABASE `#mysql50#a@b`; +USE `#mysql50#a@b`; +CREATE TABLE `#mysql50#c@d` (a INT); +CREATE TABLE t1 (a INT); + +# Create 5.0 like triggers +let $MYSQLTEST_VARDIR= `select @@datadir`; +--write_file $MYSQLTEST_VARDIR/a@b/c@d.TRG +TYPE=TRIGGERS +triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON `c@d` FOR EACH ROW SET NEW.a = 10 * NEW.a' +sql_modes=0 +definers='root@localhost' +EOF +--write_file $MYSQLTEST_VARDIR/a@b/tr1.TRN +TYPE=TRIGGERNAME +trigger_table=c@d +EOF +--write_file $MYSQLTEST_VARDIR/a@b/t1.TRG +TYPE=TRIGGERS +triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr2 BEFORE INSERT ON `a@b`.t1 FOR EACH ROW SET NEW.a = 100 * NEW.a' +sql_modes=0 +definers='root@localhost' +EOF +--write_file $MYSQLTEST_VARDIR/a@b/tr2.TRN +TYPE=TRIGGERNAME +trigger_table=t1 +EOF + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS + WHERE TRIGGER_SCHEMA="#mysql50#a@b" ORDER BY trigger_name; + +--echo mysqlcheck --fix-db-names --fix-table-names --all-databases +--exec $MYSQL_CHECK --fix-db-names --fix-table-names --all-databases + +USE `a@b`; +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS + WHERE TRIGGER_SCHEMA="a@b" ORDER BY trigger_name; + +INSERT INTO `c@d` VALUES (2), (1); +SELECT * FROM `c@d`; +INSERT INTO t1 VALUES (3), (5); +SELECT * FROM t1; + +DROP DATABASE `a@b`; + +USE test; + + +--echo End of 5.1 tests diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 28e3439b960..ae5c27af1d8 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -1646,7 +1646,7 @@ select * from t2; # Now we test with multiple threads, but less threads than files. create table words(a varchar(255)); create table words2(b varchar(255)); ---exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data_ln/words.dat $MYSQLTEST_VARDIR/std_data_ln/words2.dat +--exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data/words.dat $MYSQLTEST_VARDIR/std_data/words2.dat select * from t1; select * from t2; select * from words; @@ -1656,7 +1656,7 @@ select * from words2; drop table words; --replace_regex /.*mysqlimport(\.exe)*/mysql-import/ --error 1 ---exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data_ln/words.dat $MYSQLTEST_VARDIR/std_data_ln/words2.dat 2>&1 +--exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data/words.dat $MYSQLTEST_VARDIR/std_data/words2.dat 2>&1 drop table t1; drop table t2; diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index b4b4cf2f308..6c5efba8b5b 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1229,7 +1229,7 @@ select "a" as col1, "c" as col2; --exec echo "replace_result a;" | $MYSQL_TEST 2>&1 --error 1 --exec echo "replace_result a ;" | $MYSQL_TEST 2>&1 ---exec echo "replace_result a b; echo OK;" | $MYSQL_TEST 2>&1 +--exec echo "replace_result a b; echo OK; exit;" | $MYSQL_TEST 2>&1 --error 1 --exec echo "--replace_result a b c" | $MYSQL_TEST 2>&1 --error 1 @@ -1293,7 +1293,7 @@ while ($i) dec $i; } EOF ---exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql; echo OK;" | $MYSQL_TEST 2>&1 +--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql; echo OK; exit;" | $MYSQL_TEST 2>&1 remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql; # Repeat connect/disconnect @@ -1500,6 +1500,7 @@ echo Multi statement using expected error; --exec echo "select 'select-me';" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql --exec echo "insertz "error query"||||" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql --exec echo "delimiter ;||||" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql +--exec echo "exit;" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql # These two should work since the error is expected --exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/bug11731.sql 2>&1 @@ -1692,6 +1693,7 @@ EOF --diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff4.tmp --error 1 --diff_files $MYSQLTEST_VARDIR/tmp/diff4.tmp $MYSQLTEST_VARDIR/tmp/diff1.tmp +exit; EOF # Execute the above diffs, and send their output to /dev/null - only @@ -2147,5 +2149,71 @@ rmdir $MYSQLTEST_VARDIR/tmp/testdir; --replace_result c:\\a.txt z SELECT 'c:\\a.txt' AS col; +# +# Bug #32307 mysqltest - does not detect illegal if syntax +# + +let $test= 1; +if ($test){ + echo hej; +} + +--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql +if ($mysql_errno != 1436) +{ + echo ^ Should not be allowed! +} +EOF +--error 1 +--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 +remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql; + + +# ---------------------------------------------------------------------------- +# Test that -- is not allowed as comment, only as mysqltest builtin command +# ---------------------------------------------------------------------------- + +# valid +select 1; +--query select 1 +--query -- a comment for the server + +# Not valid, "select" is not a mysqltest command +--error 1 +--exec echo "--select 1;" | $MYSQL_TEST 2>&1 + + +# ---------------------------------------------------------------------------- +# BUG#35701: please allow test language variables in connection and sync_slave_with_master +# Test that "connection $variable" works and that $CURRENT_CONNECTION has the right value. +# ---------------------------------------------------------------------------- + +connect (con1,localhost,root,,); +--echo $CURRENT_CONNECTION + +connection default; +--echo $CURRENT_CONNECTION + +connection con1; +--echo $CURRENT_CONNECTION + +let $x= default; +let $y= con1; + +connection $x; +--echo $CURRENT_CONNECTION + +connection $y; +--echo $CURRENT_CONNECTION + +# Disconnect the not selected connection +disconnect $x; +--echo $CURRENT_CONNECTION + +# Disconnect the selected connection +disconnect $y; +--echo $CURRENT_CONNECTION + + --echo End of tests diff --git a/mysql-test/t/not_embedded_server.test b/mysql-test/t/not_embedded_server.test index ffc13cf80f7..562194a62a4 100644 --- a/mysql-test/t/not_embedded_server.test +++ b/mysql-test/t/not_embedded_server.test @@ -4,21 +4,33 @@ -- source include/not_embedded.inc + +# The following fails sporadically because 'check-testcase' runs +# queries before this test and there is no way to guarantee that any +# previous process finishes. The purpose of the test is not clearly +# stated, there is no reference to any bug report, and "select from +# I_S from prepared statement" doesn't look like something that's +# really imporant to test. I'm commenting out this for now. If +# anyone wants to keep this, please fix the race and motivate why we +# need to test this. If you see this comment and it is after mid-2009 +# or so, feel free to remove this test from the file. /Sven # -# Show full process list with prepare -# To not show other connections, this must be the first test and we must -# have a server restart before this one # -# We don't have any 4.1 tests as we use I_S to query the PROCESSLIST to -# exclude system threads that may/may not be active in the server -# (namely the ndb injector thread) +## Show full process list with prepare +## To not show other connections, this must be the first test and we must +## have a server restart before this one +## +## We don't have any 4.1 tests as we use I_S to query the PROCESSLIST to +## exclude system threads that may/may not be active in the server +## (namely the ndb injector thread) +## +## End of 4.1 tests # -# End of 4.1 tests +#prepare stmt1 from ' SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!=\'Daemon\' '; +#--replace_column 1 number 6 time 3 localhost +#execute stmt1; +#deallocate prepare stmt1; -prepare stmt1 from ' SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!=\'Daemon\' '; ---replace_column 1 number 6 time 3 localhost -execute stmt1; -deallocate prepare stmt1; # @@ -48,10 +60,16 @@ while ($i) --enable_query_log --enable_result_log -SHOW GLOBAL STATUS LIKE 'com_select'; +let $before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_select',Value,1); --change_user -SHOW GLOBAL STATUS LIKE 'com_select'; +let $after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_select',Value,1); + +if (`select $after != $before`){ + SHOW GLOBAL STATUS LIKE 'com_select'; + die The value of com_select changed during change_user; +} +echo Value of com_select did not change; # End of 5.1 tests diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test index 1f5ada76366..fb9622a4ed9 100644 --- a/mysql-test/t/openssl_1.test +++ b/mysql-test/t/openssl_1.test @@ -1,7 +1,7 @@ # Tests for SSL connections, only run if mysqld is compiled # with support for SSL. --- source include/have_ssl.inc +--source include/have_ssl.inc --disable_warnings drop table if exists t1; @@ -101,7 +101,7 @@ drop table t1; # - Apparently selecting a cipher doesn't work at all # - Usa a cipher that both yaSSL and OpenSSL supports # ---exec echo "SHOW STATUS LIKE 'Ssl_cipher';" > $MYSQLTEST_VARDIR/tmp/test.sql +--exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit;" > $MYSQLTEST_VARDIR/tmp/test.sql --exec $MYSQL_TEST --ssl-cipher=DHE-RSA-AES256-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 # @@ -155,18 +155,18 @@ SET GLOBAL event_scheduler=0; # # Test to connect using a list of ciphers # ---exec echo "SHOW STATUS LIKE 'Ssl_cipher';" > $MYSQLTEST_VARDIR/tmp/test.sql +--exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit;" > $MYSQLTEST_VARDIR/tmp/test.sql --exec $MYSQL_TEST --ssl-cipher=UNKNOWN-CIPHER:AES128-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 # Test to connect using a specifi cipher # ---exec echo "SHOW STATUS LIKE 'Ssl_cipher';" > $MYSQLTEST_VARDIR/tmp/test.sql +--exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit;" > $MYSQLTEST_VARDIR/tmp/test.sql --exec $MYSQL_TEST --ssl-cipher=AES128-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 # Test to connect using an unknown cipher # ---exec echo "SHOW STATUS LIKE 'Ssl_cipher';" > $MYSQLTEST_VARDIR/tmp/test.sql +--exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit" > $MYSQLTEST_VARDIR/tmp/test.sql --error 1 --exec $MYSQL_TEST --ssl-cipher=UNKNOWN-CIPHER < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 @@ -201,7 +201,8 @@ DROP TABLE t1; --exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=EDH-RSA-DES-CBC3-SHA --exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=EDH-RSA-DES-CBC-SHA --exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=RC4-SHA ---disable_output +--disable_query_log +--disable_result_log # Below here caused crashes. ################ --error 1,0 @@ -224,7 +225,8 @@ DROP TABLE t1; # End of crashers. ########################## # If this gives a result, then the bug is fixed. ---enable_output +--enable_result_log +--enable_query_log select 'is still running; no cipher request crashed the server' as result from dual; ## diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test index 527a4d398d8..57399e16bef 100644 --- a/mysql-test/t/outfile.test +++ b/mysql-test/t/outfile.test @@ -1,7 +1,7 @@ disable_query_log; -- source include/test_outfile.inc -# Server are started in "var/master-data", so "../tmp" will be "var/tmp" -eval set @tmpdir="../tmp"; +# Server are started in "var/master-data", so "../../tmp" will be "var/tmp" +eval set @tmpdir="../../tmp"; enable_query_log; -- source include/have_outfile.inc @@ -16,15 +16,15 @@ drop table if exists t1; create table t1 (`a` blob); insert into t1 values("hello world"),("Hello mars"),(NULL); disable_query_log; -eval select * into outfile "../tmp/outfile-test.1" from t1; +eval select * into outfile "../../tmp/outfile-test.1" from t1; enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.1")); disable_query_log; -eval select * into dumpfile "../tmp/outfile-test.2" from t1 limit 1; +eval select * into dumpfile "../../tmp/outfile-test.2" from t1 limit 1; enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.2")); disable_query_log; -eval select * into dumpfile "../tmp/outfile-test.3" from t1 where a is null; +eval select * into dumpfile "../../tmp/outfile-test.3" from t1 where a is null; enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.3")); @@ -32,13 +32,13 @@ select load_file(concat(@tmpdir,"/outfile-test.3")); disable_query_log; --error ER_FILE_EXISTS_ERROR -eval select * into outfile "../tmp/outfile-test.1" from t1; +eval select * into outfile "../../tmp/outfile-test.1" from t1; --error ER_FILE_EXISTS_ERROR -eval select * into dumpfile "../tmp/outfile-test.2" from t1; +eval select * into dumpfile "../../tmp/outfile-test.2" from t1; --error ER_FILE_EXISTS_ERROR -eval select * into dumpfile "../tmp/outfile-test.3" from t1; +eval select * into dumpfile "../../tmp/outfile-test.3" from t1; enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.not-exist")); --remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.1 @@ -48,7 +48,7 @@ drop table t1; # Bug#8191 disable_query_log; -eval select 1 into outfile "../tmp/outfile-test.4"; +eval select 1 into outfile "../../tmp/outfile-test.4"; enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.4")); --remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4 @@ -71,7 +71,7 @@ DROP TABLE t1; # Bug#13202 SELECT * INTO OUTFILE ... FROM information_schema.schemata now fails # disable_query_log; -eval SELECT * INTO OUTFILE "../tmp/outfile-test.4" +eval SELECT * INTO OUTFILE "../../tmp/outfile-test.4" FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' FROM information_schema.schemata LIMIT 0, 5; # enable_query_log; @@ -79,7 +79,7 @@ FROM information_schema.schemata LIMIT 0, 5; use information_schema; # disable_query_log; -eval SELECT * INTO OUTFILE "../tmp/outfile-test.4" +eval SELECT * INTO OUTFILE "../../tmp/outfile-test.4" FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' FROM schemata LIMIT 0, 5; enable_query_log; @@ -107,7 +107,7 @@ connect (con28181_1,localhost,user_1,,mysqltest); --error ER_DBACCESS_DENIED_ERROR eval select schema_name -into outfile "../tmp/outfile-test.4" +into outfile "../../tmp/outfile-test.4" fields terminated by ',' optionally enclosed by '"' lines terminated by '\n' from information_schema.schemata @@ -118,7 +118,7 @@ grant file on *.* to user_1@localhost; connect (con28181_2,localhost,user_1,,mysqltest); eval select schema_name -into outfile "../tmp/outfile-test.4" +into outfile "../../tmp/outfile-test.4" fields terminated by ',' optionally enclosed by '"' lines terminated by '\n' from information_schema.schemata diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 6a12e4a4d12..23a300de9e5 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -10,6 +10,8 @@ # --source include/have_partition.inc +SET @old_general_log= @@global.general_log; + --disable_warnings drop table if exists t1, t2; --enable_warnings @@ -1913,3 +1915,6 @@ select count(*) from t1; drop table t1; --echo End of 5.1 tests + + +SET @@global.general_log= @old_general_log; diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test index d470fb67b49..41b904b876f 100644 --- a/mysql-test/t/partition_error.test +++ b/mysql-test/t/partition_error.test @@ -121,7 +121,8 @@ partitions 3 partition x2 tablespace ts2, partition x3 tablespace ts3); -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); +let $MYSQLD_DATADIR= `select @@datadir`; +select load_file('$MYSQLD_DATADIR/test/t1.par'); # # Partition by hash, invalid field in function # @@ -217,7 +218,7 @@ partition by hash (a) partitions 2 (partition x1 values less than (4), partition x2 values less than (5)); -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); +select load_file('$MYSQLD_DATADIR/test/t1.par'); # # Partition by hash, values in error @@ -232,7 +233,7 @@ partition by hash (a) partitions 2 (partition x1 values in (4), partition x2 values in (5)); -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); +select load_file('$MYSQLD_DATADIR/test/t1.par'); # # Partition by hash, values in error @@ -247,7 +248,7 @@ partition by hash (a) partitions 2 (partition x1 values in (4,6), partition x2 values in (5,7)); -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); +select load_file('$MYSQLD_DATADIR/test/t1.par'); # # Subpartition by key, no partitions defined, single field @@ -260,7 +261,7 @@ c int not null, primary key (a,b)) partition by key (a) subpartition by key (b); -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); +select load_file('$MYSQLD_DATADIR/test/t1.par'); # # Subpartition by key, no partitions defined, list of fields @@ -273,7 +274,7 @@ c int not null, primary key (a,b)) partition by key (a) subpartition by key (a, b); -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); +select load_file('$MYSQLD_DATADIR/test/t1.par'); # # Subpartition by hash, no partitions defined @@ -286,7 +287,7 @@ c int not null, primary key (a,b)) partition by key (a) subpartition by hash (a+b); -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); +select load_file('$MYSQLD_DATADIR/test/t1.par'); # # Subpartition by key, no partitions defined, single field @@ -299,7 +300,7 @@ c int not null, primary key (a,b)) partition by key (a) subpartition by key (b); -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); +select load_file('$MYSQLD_DATADIR/test/t1.par'); # # Subpartition by key, no partitions defined, list of fields @@ -312,7 +313,7 @@ c int not null, primary key (a,b)) partition by key (a) subpartition by key (a, b); -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); +select load_file('$MYSQLD_DATADIR/test/t1.par'); # # Subpartition by hash, no partitions defined @@ -325,7 +326,7 @@ c int not null, primary key (a,b)) partition by key (a) subpartition by hash (a+b); -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); +select load_file('$MYSQLD_DATADIR/test/t1.par'); # # Subpartition by hash, no partitions defined, wrong subpartition function @@ -352,7 +353,7 @@ partition by key (a) subpartition by hash (sin(a+b)) (partition x1 (subpartition x11, subpartition x12), partition x2 (subpartition x21, subpartition x22)); -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); +select load_file('$MYSQLD_DATADIR/test/t1.par'); # # Subpartition by hash, no partitions defined, wrong subpartition function @@ -381,7 +382,7 @@ partition by range (a) subpartition by key (a,d) (partition x1 values less than (1) (subpartition x11, subpartition x12), partition x2 values less than (2) (subpartition x21, subpartition x22)); -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); +select load_file('$MYSQLD_DATADIR/test/t1.par'); # # Subpartition by hash, no partitions defined, wrong subpartition function @@ -419,7 +420,7 @@ b int not null, c int not null, primary key(a,b)) partition by range (a); -select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par'); +select load_file('$MYSQLD_DATADIR/test/t1.par'); # # Partition by range, invalid field in function diff --git a/mysql-test/t/partition_federated.test b/mysql-test/t/partition_federated.test index c8483291228..0fe692ecd01 100644 --- a/mysql-test/t/partition_federated.test +++ b/mysql-test/t/partition_federated.test @@ -3,7 +3,7 @@ # -- source include/have_partition.inc -- source include/not_embedded.inc --- source include/have_federated_db.inc +-- source suite/federated/have_federated_db.inc --disable_warnings drop table if exists t1; diff --git a/mysql-test/t/partition_innodb_semi_consistent-master.opt b/mysql-test/t/partition_innodb_semi_consistent-master.opt new file mode 100644 index 00000000000..e76299453d3 --- /dev/null +++ b/mysql-test/t/partition_innodb_semi_consistent-master.opt @@ -0,0 +1 @@ +--innodb_lock_wait_timeout=2 diff --git a/mysql-test/t/partition_innodb_semi_consistent.test b/mysql-test/t/partition_innodb_semi_consistent.test new file mode 100644 index 00000000000..cfa170f575b --- /dev/null +++ b/mysql-test/t/partition_innodb_semi_consistent.test @@ -0,0 +1,194 @@ +-- source include/have_partition.inc +-- source include/not_embedded.inc +-- source include/have_innodb.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +# basic tests of semi-consistent reads +# for verifying Bug#40595: Non-matching rows not released with READ-COMMITTED +# on tables with partitions + +connect (a,localhost,root,,); +connect (b,localhost,root,,); +connection a; +set binlog_format=mixed; +set session transaction isolation level read committed; +create table t1(a int not null) +engine=innodb +DEFAULT CHARSET=latin1 +PARTITION BY RANGE(a) +(PARTITION p0 VALUES LESS THAN (20), + PARTITION p1 VALUES LESS THAN MAXVALUE); +insert into t1 values (1),(2),(3),(4),(5),(6),(7); +set autocommit=0; +# this should lock the entire table +select * from t1 where a=3 lock in share mode; +connection b; +set binlog_format=mixed; +set session transaction isolation level read committed; +set autocommit=0; +-- error ER_LOCK_WAIT_TIMEOUT +update t1 set a=10 where a=5; +connection a; +#DELETE FROM t1 WHERE a=5; +commit; +connection b; +update t1 set a=10 where a=5; +connection a; +-- error ER_LOCK_WAIT_TIMEOUT +select * from t1 where a=2 for update; +# this should lock the records (1),(2) +select * from t1 where a=2 limit 1 for update; +connection b; +update t1 set a=11 where a=6; +-- error ER_LOCK_WAIT_TIMEOUT +update t1 set a=12 where a=2; +-- error ER_LOCK_WAIT_TIMEOUT +update t1 set a=13 where a=1; +connection a; +commit; +connection b; +update t1 set a=14 where a=1; +commit; +connection a; +--sorted_result +select * from t1; +drop table t1; + +connection default; +disconnect a; +disconnect b; + +# +# Bug #31310: Locked rows silently skipped in read-committed isolation level. +# (This also tests the '*_semi_consistent*' functions in partitioning) +# Copied from include/mix1.inc + +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); +SET SESSION AUTOCOMMIT = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +set binlog_format=mixed; +--echo # Switch to connection con1 +connection con1; + +eval +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256)) +ENGINE = InnoDB +PARTITION BY RANGE (a) +(PARTITION p0 VALUES LESS THAN (300), + PARTITION p1 VALUES LESS THAN MAXVALUE); +INSERT INTO t1 VALUES (1,2); + +--echo # 1. test for locking: + +BEGIN; +--enable_info +UPDATE t1 SET b = 12 WHERE a = 1; +--disable_info +SELECT * FROM t1; + +--echo # Switch to connection con2 +connection con2; + +--enable_info +--disable_abort_on_error +--error ER_LOCK_WAIT_TIMEOUT +UPDATE t1 SET b = 21 WHERE a = 1; +--disable_info + +--echo # Switch to connection con1 +connection con1; +SELECT * FROM t1; +ROLLBACK; + +--echo # 2. test for serialized update: + +CREATE TABLE t2 (a INT); + +TRUNCATE t1; +INSERT INTO t1 VALUES (1,'init'); + +DELIMITER |; +CREATE PROCEDURE p1() +BEGIN + UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1; + INSERT INTO t2 VALUES (); +END| +DELIMITER ;| + +BEGIN; +--enable_info +UPDATE t1 SET b = CONCAT(b, '+con1') WHERE a = 1; +--disable_info +SELECT * FROM t1; + +--echo # Switch to connection con2 +connection con2; + +--send CALL p1; + +--echo # Switch to connection con1 +connection con1; +SELECT * FROM t1; +COMMIT; + +let $bug31310 = 1; +while ($bug31310) +{ + let $bug31310= `SELECT 1 - COUNT(*) FROM t2`; +} + +SELECT * FROM t1; + +--echo # Switch to connection con2 +connection con2; +--reap +SELECT * FROM t1; + +--echo # Switch to connection con1 +connection con1; + +--echo # 3. test for updated key column: + +TRUNCATE t1; +TRUNCATE t2; + +INSERT INTO t1 VALUES (1,'init'); + +BEGIN; +--enable_info +UPDATE t1 SET a = 2, b = CONCAT(b, '+con1') WHERE a = 1; +--disable_info +SELECT * FROM t1; + +--echo # Switch to connection con2 +connection con2; + +--send CALL p1; + +--echo # Switch to connection con1 +connection con1; +SELECT * FROM t1; +COMMIT; + +let $bug31310 = 1; +while ($bug31310) +{ + let $bug31310= `SELECT 1 - COUNT(*) FROM t2`; +} + +SELECT * FROM t1; + +--echo # Switch to connection con2 +connection con2; +SELECT * FROM t1; + +connection default; +disconnect con1; +disconnect con2; +DROP PROCEDURE p1; +DROP TABLE t1, t2; + diff --git a/mysql-test/t/partition_innodb_stmt.test b/mysql-test/t/partition_innodb_stmt.test index 2ed5baee0ac..d6181ce068e 100644 --- a/mysql-test/t/partition_innodb_stmt.test +++ b/mysql-test/t/partition_innodb_stmt.test @@ -1,3 +1,4 @@ +--source include/have_partition.inc --source include/have_binlog_format_statement.inc --source include/have_innodb.inc diff --git a/mysql-test/t/partition_mgm.test b/mysql-test/t/partition_mgm.test index 524a2e04b25..e17edf0a4e5 100644 --- a/mysql-test/t/partition_mgm.test +++ b/mysql-test/t/partition_mgm.test @@ -4,6 +4,17 @@ DROP TABLE IF EXISTS t1; --enable_warnings # +# Bug 40389: REORGANIZE PARTITION crashes when only using one partition +# +CREATE TABLE t1 (a INT PRIMARY KEY) +ENGINE MYISAM +PARTITION BY HASH (a) +PARTITIONS 1; +INSERT INTO t1 VALUES (1),(2),(3),(4),(5); +ALTER TABLE t1 REORGANIZE PARTITION; +DROP TABLE t1; + +# # Bug 21143: mysqld hang when error in number of subparts in # REORGANIZE command # @@ -22,18 +33,19 @@ drop table t1; CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30)) PARTITION BY HASH(YEAR(f_date)) PARTITIONS 2; SHOW CREATE TABLE t1; --- file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD --- file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI --- file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD --- file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI --- file_exists $MYSQLTEST_VARDIR/master-data/test/t1.frm --- file_exists $MYSQLTEST_VARDIR/master-data/test/t1.par +let $MYSQLD_DATADIR= `select @@datadir`; +-- file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYD +-- file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYI +-- file_exists $MYSQLD_DATADIR/test/t1#P#p1.MYD +-- file_exists $MYSQLD_DATADIR/test/t1#P#p1.MYI +-- file_exists $MYSQLD_DATADIR/test/t1.frm +-- file_exists $MYSQLD_DATADIR/test/t1.par ALTER TABLE t1 COALESCE PARTITION 1; SHOW CREATE TABLE t1; --- file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD --- file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI --- file_exists $MYSQLTEST_VARDIR/master-data/test/t1.frm --- file_exists $MYSQLTEST_VARDIR/master-data/test/t1.par +-- file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYD +-- file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYI +-- file_exists $MYSQLD_DATADIR/test/t1.frm +-- file_exists $MYSQLD_DATADIR/test/t1.par drop table t1; # # Bug 20767: REORGANIZE partition crashes diff --git a/mysql-test/t/partition_not_windows.test b/mysql-test/t/partition_not_windows.test index d7108d5af98..333e12e2b16 100644 --- a/mysql-test/t/partition_not_windows.test +++ b/mysql-test/t/partition_not_windows.test @@ -11,8 +11,8 @@ # Bug 20770 Partitions: DATA DIRECTORY clause change in reorganize # doesn't remove old directory +let $MYSQLD_DATADIR= `select @@datadir`; let $data_directory = DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp'; - let $inx_directory = INDEX DIRECTORY = '$MYSQLTEST_VARDIR/tmp'; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR @@ -23,12 +23,12 @@ subpartition by hash (a) (SUBPARTITION subpart00, SUBPARTITION subpart01)); --echo # Checking if file exists before alter ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1.frm ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1.par ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart00.MYD ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart00.MYI ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart01.MYD ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart01.MYI +--file_exists $MYSQLD_DATADIR/test/t1.frm +--file_exists $MYSQLD_DATADIR/test/t1.par +--file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart00.MYD +--file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart00.MYI +--file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart01.MYD +--file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart01.MYI --file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart00.MYD --file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart01.MYD --file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart00.MYI @@ -42,16 +42,16 @@ eval ALTER TABLE t1 REORGANIZE PARTITION p0 INTO (SUBPARTITION subpart20, SUBPARTITION subpart21)); --echo # Checking if file exists after alter ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1.frm ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1.par ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1#SP#subpart10.MYD ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1#SP#subpart10.MYI ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1#SP#subpart11.MYD ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1#SP#subpart11.MYI ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart20.MYD ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart20.MYI ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart21.MYD ---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart21.MYI +--file_exists $MYSQLD_DATADIR/test/t1.frm +--file_exists $MYSQLD_DATADIR/test/t1.par +--file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart10.MYD +--file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart10.MYI +--file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart11.MYD +--file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart11.MYI +--file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart20.MYD +--file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart20.MYI +--file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart21.MYD +--file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart21.MYI --file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p1#SP#subpart10.MYD --file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p1#SP#subpart11.MYD --file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p2#SP#subpart20.MYD @@ -93,39 +93,43 @@ set @@sql_mode=@org_mode; # # Bug#32167: another privilege bypass with DATA/INDEX DIRECTORY # ---replace_result $MYSQLTEST_VARDIR TEST_DIR + +let $MYSQLD_DATADIR= `select @@datadir`; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --error ER_WRONG_ARGUMENTS eval CREATE TABLE t1(a INT) PARTITION BY KEY (a) -(PARTITION p0 DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/test'); ---replace_result $MYSQLTEST_VARDIR TEST_DIR +(PARTITION p0 DATA DIRECTORY '$MYSQLD_DATADIR/test'); + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --error ER_WRONG_ARGUMENTS eval CREATE TABLE t1(a INT) PARTITION BY KEY (a) -(PARTITION p0 INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/test'); +(PARTITION p0 INDEX DIRECTORY '$MYSQLD_DATADIR/test'); ---replace_result $MYSQLTEST_VARDIR TEST_DIR +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --error ER_WRONG_ARGUMENTS eval CREATE TABLE ts (id INT, purchased DATE) PARTITION BY RANGE(YEAR(purchased)) SUBPARTITION BY HASH(TO_DAYS(purchased)) ( PARTITION p0 VALUES LESS THAN (1990) ( SUBPARTITION s0a - DATA DIRECTORY = '$MYSQLTEST_VARDIR/master-data/test', + DATA DIRECTORY = '$MYSQLD_DATADIR/test', SUBPARTITION s0b - DATA DIRECTORY = '$MYSQLTEST_VARDIR/master-data/test' + DATA DIRECTORY = '$MYSQLD_DATADIR/test' )); ---replace_result $MYSQLTEST_VARDIR TEST_DIR +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --error ER_WRONG_ARGUMENTS eval CREATE TABLE ts (id INT, purchased DATE) PARTITION BY RANGE(YEAR(purchased)) SUBPARTITION BY HASH(TO_DAYS(purchased)) ( PARTITION p0 VALUES LESS THAN (1990) ( SUBPARTITION s0a - INDEX DIRECTORY = '$MYSQLTEST_VARDIR/master-data/test', + INDEX DIRECTORY = '$MYSQLD_DATADIR/test', SUBPARTITION s0b - INDEX DIRECTORY = '$MYSQLTEST_VARDIR/master-data/test' + INDEX DIRECTORY = '$MYSQLD_DATADIR/test' )); # End Windows specific test failures. @@ -165,21 +169,24 @@ INDEX DIRECTORY = '$MYSQLTEST_VARDIR/p2Index', PARTITION p3 DATA DIRECTORY = '$MYSQLTEST_VARDIR/p3Data' INDEX DIRECTORY = '$MYSQLTEST_VARDIR/p3Index' ); + +let $MYSQLD_DATADIR= `select @@datadir`; + --echo # Checking that MyISAM .MYD and .MYI are in test db and data/idx dir ---file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p0.MYI ---file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p0.MYD +--file_exists $MYSQLD_DATADIR/test/example#P#p0.MYI +--file_exists $MYSQLD_DATADIR/test/example#P#p0.MYD --file_exists $MYSQLTEST_VARDIR/p0Data/example#P#p0.MYD --file_exists $MYSQLTEST_VARDIR/p0Index/example#P#p0.MYI ---file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p1.MYI ---file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p1.MYD +--file_exists $MYSQLD_DATADIR/test/example#P#p1.MYI +--file_exists $MYSQLD_DATADIR/test/example#P#p1.MYD --file_exists $MYSQLTEST_VARDIR/p1Data/example#P#p1.MYD --file_exists $MYSQLTEST_VARDIR/p1Index/example#P#p1.MYI ---file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p2.MYI ---file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p2.MYD +--file_exists $MYSQLD_DATADIR/test/example#P#p2.MYI +--file_exists $MYSQLD_DATADIR/test/example#P#p2.MYD --file_exists $MYSQLTEST_VARDIR/p2Data/example#P#p2.MYD --file_exists $MYSQLTEST_VARDIR/p2Index/example#P#p2.MYI ---file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p3.MYI ---file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p3.MYD +--file_exists $MYSQLD_DATADIR/test/example#P#p3.MYI +--file_exists $MYSQLD_DATADIR/test/example#P#p3.MYD --file_exists $MYSQLTEST_VARDIR/p3Data/example#P#p3.MYD --file_exists $MYSQLTEST_VARDIR/p3Index/example#P#p3.MYI DROP TABLE example; diff --git a/mysql-test/t/partition_pruning.test b/mysql-test/t/partition_pruning.test index 31008d2b011..ad102062ef8 100644 --- a/mysql-test/t/partition_pruning.test +++ b/mysql-test/t/partition_pruning.test @@ -8,6 +8,22 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; --enable_warnings +# +# Bug#40972: some sql execution lead the whole database crashing +# +# Setup so the start is at partition pX and end is at p1 +# Pruning does handle 'bad' dates differently. +CREATE TABLE t1 +(a INT NOT NULL AUTO_INCREMENT, + b DATETIME, + PRIMARY KEY (a,b), + KEY (b)) +PARTITION BY RANGE (to_days(b)) +(PARTITION p0 VALUES LESS THAN (733681) COMMENT = 'LESS THAN 2008-10-01', + PARTITION p1 VALUES LESS THAN (733712) COMMENT = 'LESS THAN 2008-11-01', + PARTITION pX VALUES LESS THAN MAXVALUE); +SELECT a,b FROM t1 WHERE b >= '2008-12-01' AND b < '2009-12-00'; +DROP TABLE t1; # Check if we can infer from condition on partition fields that # no records will match. diff --git a/mysql-test/t/profiling.test b/mysql-test/t/profiling.test index 5cb3f66aa2b..275c2d77c4a 100644 --- a/mysql-test/t/profiling.test +++ b/mysql-test/t/profiling.test @@ -14,6 +14,7 @@ select @@profiling; set global profiling = ON; # But size is okay +set @start_value= @@global.profiling_history_size; set global profiling_history_size=100; show global variables like 'profil%'; @@ -261,6 +262,6 @@ drop function if exists f1; ## last thing in the file set session profiling = OFF; - +set global profiling_history_size= @start_value; ## --echo End of 5.0 tests diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 3e1a41d32c8..91cb6eef8ad 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -1665,7 +1665,7 @@ DROP PROCEDURE IF EXISTS p1; let $iterations= 100; --disable_query_log --disable_result_log -while ($iterations > 0) +while ($iterations) { --error ER_PARSE_ERROR PREPARE stmt FROM "CREATE PROCEDURE p1()"; diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test index 95cbd908933..3ad3f394840 100644 --- a/mysql-test/t/ps_1general.test +++ b/mysql-test/t/ps_1general.test @@ -576,7 +576,7 @@ prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ; create table t5 (a int) ; # rename must fail, t7 does not exist # Clean up the filename here because embedded server reports whole path ---replace_result $MYSQLTEST_VARDIR . master-data/ '' t7.frm t7 +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' t7.frm t7 --error 1017 execute stmt1 ; create table t7 (a int) ; diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index e77108cfa46..886d677a26a 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -300,7 +300,7 @@ select * from t1; select * from t1; show status like "Qcache_queries_in_cache"; insert delayed into t1 values (4); ---sleep 5 # Wait for insert delayed to be executed. +--sleep 5 # Wait for insert delayed to be executed. select a from t1; show status like "Qcache_queries_in_cache"; drop table t1; @@ -410,10 +410,10 @@ create table t1(id int auto_increment primary key); insert into t1 values (NULL), (NULL), (NULL); select * from t1 where id=2; alter table t1 rename to t2; --- error 1146 +--error ER_NO_SUCH_TABLE select * from t1 where id=2; drop table t2; --- error 1146 +--error ER_NO_SUCH_TABLE select * from t1 where id=2; # @@ -423,7 +423,7 @@ create table t1 (word char(20) not null); select * from t1; show status like "Qcache_queries_in_cache"; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval load data infile '$MYSQLTEST_VARDIR/std_data_ln/words.dat' into table t1; +eval load data infile '$MYSQLTEST_VARDIR/std_data/words.dat' into table t1; show status like "Qcache_queries_in_cache"; select count(*) from t1; drop table t1; @@ -435,11 +435,14 @@ create table t1 (a int); insert into t1 values (1),(2),(3); show status like "Qcache_queries_in_cache"; select * from t1 into outfile "query_cache.out.file"; ---error 1086 +--error ER_FILE_EXISTS_ERROR select * from t1 into outfile "query_cache.out.file"; select * from t1 limit 1 into dumpfile "query_cache.dump.file"; show status like "Qcache_queries_in_cache"; drop table t1; +let $datadir=`select @@datadir`; +--remove_file $datadir/test/query_cache.dump.file +--remove_file $datadir/test/query_cache.out.file # # test of SQL_SELECT_LIMIT @@ -537,7 +540,7 @@ drop table t1; # If at least one of the above variables has changed, # the cached query can't be reused. In the below test # absolutely the same query is used several times, -# SELECT should fetch different results for every instance. +# SELECT should fetch different results for every instance. # No hits should be produced. # New cache entry should appear for every SELECT. # @@ -554,21 +557,21 @@ show status like "Qcache_queries_in_cache"; # Change collation_connection and run the same query again # set collation_connection=koi8r_bin; -SELECT a,'Â','â'='Â' FROM t1; +SELECT a,'Â','â'='Â' FROM t1; show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; # # Now change character_set_client and run the same query again # set character_set_client=cp1251; -SELECT a,'Â','â'='Â' FROM t1; +SELECT a,'Â','â'='Â' FROM t1; show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; # # And finally change character_set_results and run the same query again # set character_set_results=cp1251; -SELECT a,'Â','â'='Â' FROM t1; +SELECT a,'Â','â'='Â' FROM t1; show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; SET NAMES default; @@ -602,12 +605,12 @@ insert into t1 set c = repeat('x',24); insert into t1 set c = concat(repeat('x',24),'x'); insert into t1 set c = concat(repeat('x',24),'w'); insert into t1 set c = concat(repeat('x',24),'y'); -set max_sort_length=200; +set max_sort_length=200; select c from t1 order by c, id; reset query cache; set max_sort_length=20; select c from t1 order by c, id; -set max_sort_length=200; +set max_sort_length=200; select c from t1 order by c, id; set max_sort_length=default; # sql_mode @@ -801,9 +804,10 @@ create procedure `p1`() begin select a, f1() from t1; end// +SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; call p1()// -SET GLOBAL log_bin_trust_function_creators = 0; +SET GLOBAL log_bin_trust_function_creators = @old_log_bin_trust_function_creators; drop procedure p1// drop function f1// @@ -1016,7 +1020,7 @@ set GLOBAL query_cache_size= default; # -# Bug #28897 UUID() returns non-unique values when query cache is enabled +# Bug#28897 UUID() returns non-unique values when query cache is enabled # set GLOBAL query_cache_size=1000000; @@ -1025,7 +1029,7 @@ create table t1 (a char); insert into t1 values ('c'); let $q1= `select UUID(), a from t1`; -let $q2= `select UUID(), a from t1`; +let $q2= `select UUID(), a from t1`; # disabling the logging of the query because the UUIDs are different each run. --disable_query_log @@ -1046,7 +1050,7 @@ create table t1 (a char); insert into t1 values ('c'); let $q1= `select RAND() from t1 union select sql_cache 1 from t1;`; -let $q2= `select RAND() from t1 union select sql_cache 1 from t1;`; +let $q2= `select RAND() from t1 union select sql_cache 1 from t1;`; # disabling the logging of the query because the times are different each run. --disable_query_log @@ -1182,75 +1186,6 @@ DROP TABLE t1; SET GLOBAL query_cache_size= default; # -# Bug #28249 Query Cache returns wrong result with concurrent insert / certain lock -# ---echo Bug#28249 Query Cache returns wrong result with concurrent insert/ certain lock -connect (user1,localhost,root,,test,,); -connect (user2,localhost,root,,test,,); -connect (user3,localhost,root,,test,,); - -connection user1; - -set GLOBAL query_cache_type=1; -set GLOBAL query_cache_limit=10000; -set GLOBAL query_cache_min_res_unit=0; -set GLOBAL query_cache_size= 100000; - -flush tables; ---disable_warnings -drop table if exists t1, t2; ---enable_warnings -create table t1 (a int); -create table t2 (a int); -insert into t1 values (1),(2),(3); -connection user2; ---echo Locking table T2 with a write lock. -lock table t2 write; - -connection user1; ---echo Select blocked by write lock. ---send select *, (select count(*) from t2) from t1; ---echo Sleeing is ok, because selecting should be done very fast. -sleep 5; - -connection user3; ---echo Inserting into table T1. -insert into t1 values (4); - -connection user2; ---echo Unlocking the tables. -unlock tables; - -connection user1; ---echo Collecting result from previously blocked select. -# -# Since the lock ordering rule in thr_multi_lock depends on -# pointer values, from execution to execution we might have -# different lock order, and therefore, sometimes lock t1 and block -# on t2, and sometimes block on t2 right away. In the second case, -# the following insert succeeds, and only then this select can -# proceed, and we actually test nothing, as the very first select -# returns 4 rows right away. -# It's fine to have a test case that covers the problematic area -# at least once in a while. -# We, however, need to disable the result log here to make the -# test repeatable. ---disable_result_log ---reap ---enable_result_log ---echo Next select should contain 4 rows, as the insert is long finished. -select *, (select count(*) from t2) from t1; -reset query cache; -select *, (select count(*) from t2) from t1; - -drop table t1,t2; - -connection default; -disconnect user1; -disconnect user2; -disconnect user3; - -# --echo # --echo # Bug#25132 disabled query cache: Qcache_free_blocks = 1 --echo # @@ -1260,7 +1195,7 @@ set global query_cache_type=0; show status like 'Qcache_free_blocks'; --echo Restore default values. -# Bug #28211 RENAME DATABASE and query cache don't play nicely together +# Bug#28211 RENAME DATABASE and query cache don't play nicely together # # TODO: enable these tests when RENAME DATABASE is implemented. # --disable_warnings @@ -1278,7 +1213,7 @@ show status like 'Qcache_free_blocks'; # show status like 'Qcache_queries_in_cache'; # drop database db2; # set global query_cache_size=default; -# +# # --disable_warnings # drop database if exists db1; # drop database if exists db3; diff --git a/mysql-test/t/query_cache_28249.test b/mysql-test/t/query_cache_28249.test new file mode 100644 index 00000000000..3cf6c89369e --- /dev/null +++ b/mysql-test/t/query_cache_28249.test @@ -0,0 +1,123 @@ +### t/query_cache_28249.test ### +# +# Test for +# Bug#28249 Query Cache returns wrong result with concurrent insert / certain lock +# +# Last modification: +# 2008-11-27 mleich - Move this test out of query_cache.test +# - Fix Bug#40179 Test main.query_cache failing randomly on Pushbuild, +# test weakness +# - Minor improvements (comments,formatting etc.) +# + +--source include/have_query_cache.inc + +SET @query_cache_type= @@global.query_cache_type; +SET @query_cache_limit= @@global.query_cache_limit; +SET @query_cache_min_res_unit= @@global.query_cache_min_res_unit; +SET @query_cache_size= @@global.query_cache_size; + +--echo # Bug#28249 Query Cache returns wrong result with concurrent insert/ certain lock +--echo # Establish connections user1,user2,user3 (user=root) +connect (user1,localhost,root,,test,,); +connect (user2,localhost,root,,test,,); +connect (user3,localhost,root,,test,,); + +--echo # Switch to connection user1 +connection user1; + +SET GLOBAL query_cache_type=1; +SET GLOBAL query_cache_limit=10000; +SET GLOBAL query_cache_min_res_unit=0; +SET GLOBAL query_cache_size= 100000; + +FLUSH TABLES; +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); + +--echo # Switch to connection user2 +connection user2; +LOCK TABLE t2 WRITE; + +--echo # Switch to connection user1 +connection user1; +--echo # "send" the next select, "reap" the result later. +--echo # The select will be blocked by the write lock on the t1. +let $select_for_qc = +SELECT *, (SELECT COUNT(*) FROM t2) FROM t1; +send; +eval $select_for_qc; + +--echo # Switch to connection user3 +connection user3; +# Typical information_schema.processlist content after sufficient sleep time +# ID USER COMMAND TIME STATE INFO +# .... +# 2 root Query 5 Locked SELECT *, (SELECT COUNT(*) FROM t2) FROM t1 +# .... +# XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +# The values marked with 'X' must be reached. +--echo # Poll till the select of connection user1 is blocked by the write lock on t1. +let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist +WHERE state = 'Locked' + AND info = '$select_for_qc'; +--source include/wait_condition.inc +eval +SELECT user,command,state,info FROM information_schema.processlist +WHERE state = 'Locked' + AND info = '$select_for_qc'; +INSERT INTO t1 VALUES (4); + +--echo # Switch to connection user2 +connection user2; +UNLOCK TABLES; + +--echo # Switch to connection user1 +connection user1; +# +# Since the lock ordering rule in thr_multi_lock depends on +# pointer values, from execution to execution we might have +# different lock order, and therefore, sometimes lock t1 and block +# on t2, and sometimes block on t2 right away. In the second case, +# the following insert succeeds, and only then this select can +# proceed, and we actually test nothing, as the very first select +# returns 4 rows right away. +# It's fine to have a test case that covers the problematic area +# at least once in a while. +--echo # Collecting ("reap") the result from the previously blocked select. +--echo # The printing of the result (varies between 3 and 4 rows) set has to be suppressed. +--disable_result_log +--reap +--enable_result_log + +--echo # Switch to connection user3 +connection user3; +--echo # The next select enforces that effects of "concurrent_inserts" like the +--echo # record with a = 4 is missing in result sets can no more happen. +SELECT 1 FROM t1 WHERE a = 4; + +--echo # Switch to connection user1 +connection user1; +--echo # The next result set must contain 4 rows. +# If not, we have a regression of Bug#28249 +eval $select_for_qc; +RESET QUERY CACHE; +eval $select_for_qc; + +DROP TABLE t1,t2; + +--echo # Switch to connection default + close connections user1,user2,user3 +connection default; +disconnect user1; +disconnect user2; +disconnect user3; + +SET GLOBAL query_cache_type= @query_cache_type; +SET GLOBAL query_cache_limit= @query_cache_limit; +SET GLOBAL query_cache_min_res_unit= @query_cache_min_res_unit; +SET GLOBAL query_cache_size= @query_cache_size; + diff --git a/mysql-test/t/query_cache_notembedded.test b/mysql-test/t/query_cache_notembedded.test index 929b93e10d5..ecb7bfc100e 100644 --- a/mysql-test/t/query_cache_notembedded.test +++ b/mysql-test/t/query_cache_notembedded.test @@ -183,6 +183,8 @@ drop table t1; # # bug#14767: INSERT in SF + concurrent SELECT with query cache # +connection default; +SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; reset query cache; @@ -224,7 +226,7 @@ disconnect con2; connection default; set GLOBAL query_cache_size=0; -SET GLOBAL log_bin_trust_function_creators = 0; +SET @@global.log_bin_trust_function_creators = @old_log_bin_trust_function_creators; # # Bug #30269 Query cache eats memory diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test index 94a9fda6757..eb2ca7992a6 100644 --- a/mysql-test/t/repair.test +++ b/mysql-test/t/repair.test @@ -29,7 +29,8 @@ repair table t1 use_frm; create table t1 engine=myisam SELECT 1,"table 1"; flush tables; -system echo 1 > $MYSQLTEST_VARDIR/master-data/test/t1.MYI ; +let $MYSQLD_DATADIR= `select @@datadir`; +system echo 1 > $MYSQLD_DATADIR/test/t1.MYI ; repair table t1; repair table t1 use_frm; drop table t1; @@ -119,9 +120,10 @@ DROP TABLE t1; # --echo # Test with a saved table from 4.1 ---copy_file std_data/bug36055.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm ---copy_file std_data/bug36055.MYD $MYSQLTEST_VARDIR/master-data/test/t1.MYD ---copy_file std_data/bug36055.MYI $MYSQLTEST_VARDIR/master-data/test/t1.MYI +let $MYSQLD_DATADIR= `select @@datadir`; +--copy_file std_data/bug36055.frm $MYSQLD_DATADIR/test/t1.frm +--copy_file std_data/bug36055.MYD $MYSQLD_DATADIR/test/t1.MYD +--copy_file std_data/bug36055.MYI $MYSQLD_DATADIR/test/t1.MYI --replace_column 12 # 13 # SHOW TABLE STATUS LIKE 't1'; diff --git a/mysql-test/t/rpl_init_slave_func-slave.opt b/mysql-test/t/rpl_init_slave_func-slave.opt deleted file mode 100644 index 337e8a60d97..00000000000 --- a/mysql-test/t/rpl_init_slave_func-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---init-slave="set global max_connections=500" diff --git a/mysql-test/t/rpl_init_slave_func.test b/mysql-test/t/rpl_init_slave_func.test deleted file mode 100644 index b3d647f4394..00000000000 --- a/mysql-test/t/rpl_init_slave_func.test +++ /dev/null @@ -1,96 +0,0 @@ -###################### mysql-test\t\init_slave_func.test ##################### -# # -# Variable Name: init_slave # -# Scope: GLOBAL # -# Access Type: Dynamic # -# Data Type: string # -# Default Value: # -# Range: # -# # -# # -# Creation Date: 2008-03-08 # -# Author: Rizwan # -# # -# Description: Test Cases of Dynamic System Variable init_slave # -# that checks the behavior of this variable # -# # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # -# # -############################################################################### - -source include/master-slave.inc; - ---echo '#--------------------FN_DYNVARS_037_01-------------------------#' -################################################################## -# Check if setting init_slave is changed in every new connection # -################################################################## - -SET @@global.init_slave = "SET @a = 10"; - ---echo 'connect (con1,localhost,root,,)' -connect (con1,localhost,root,,); ---echo 'connection con1' -connection con1; -SELECT @@global.init_slave; -disconnect con1; ---echo 'connection master' -connection master; - ---echo '#--------------------FN_DYNVARS_037_02-------------------------#' -#################################################### -# Begin the functionality Testing of init_slave # -#################################################### - -#==================================================== ---echo 'check if value in slave opt file is executed' -#==================================================== -save_master_pos; ---echo 'connection slave' -connection slave; -sleep 1; -show variables like 'init_slave'; -show variables like 'max_connections'; -sync_with_master; -reset master; - -#=============================================================== ---echo 'check if value in slave opt file doesnt apply to master' -#=============================================================== - ---echo 'connection master' -connection master; -show variables like 'init_slave'; -show variables like 'max_connections'; -save_master_pos; ---echo 'connection slave' -connection slave; -sync_with_master; - -#======================================================= ---echo 'try creating a temporary variable in init_slave' -#======================================================= - -SET @@global.init_slave = "SET @a=5"; - -stop slave; ---wait_for_slave_to_stop -reset slave; -# Clean up old test tables ---disable_warnings -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; ---enable_warnings -start slave; - -SHOW VARIABLES LIKE 'init_slave'; -SELECT @a; - ---echo 'Bug#35365 SET statement in init_slave not execute if slave is restarted' - -# Restore value -set global max_connections= default; - -################################################## -# End of functionality Testing for init_slave # -################################################## - diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 30abb797e83..ccdb53ec11f 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -3690,6 +3690,42 @@ SELECT DISTINCT b FROM t1 LEFT JOIN t2 USING(a) WHERE c <= 3; SHOW STATUS LIKE 'Handler_read%'; DROP TABLE t1, t2; +# +# Bug#40953 SELECT query throws "ERROR 1062 (23000): Duplicate entry..." error +# +CREATE TABLE t1 (f1 bigint(20) NOT NULL default '0', + f2 int(11) NOT NULL default '0', + f3 bigint(20) NOT NULL default '0', + f4 varchar(255) NOT NULL default '', + PRIMARY KEY (f1), + KEY key1 (f4), + KEY key2 (f2)); +CREATE TABLE t2 (f1 int(11) NOT NULL default '0', + f2 enum('A1','A2','A3') NOT NULL default 'A1', + f3 int(11) NOT NULL default '0', + PRIMARY KEY (f1), + KEY key1 (f3)); +CREATE TABLE t3 (f1 bigint(20) NOT NULL default '0', + f2 datetime NOT NULL default '1980-01-01 00:00:00', + PRIMARY KEY (f1)); + +insert into t1 values (1, 1, 1, 'abc'); +insert into t1 values (2, 1, 2, 'def'); +insert into t1 values (3, 1, 2, 'def'); +insert into t2 values (1, 'A1', 1); +insert into t3 values (1, '1980-01-01'); + +SELECT a.f3, cr.f4, count(*) count +FROM t2 a +STRAIGHT_JOIN t1 cr ON cr.f2 = a.f1 +LEFT JOIN +(t1 cr2 + JOIN t3 ae2 ON cr2.f3 = ae2.f1 +) ON a.f1 = cr2.f2 AND ae2.f2 < now() - INTERVAL 7 DAY AND +cr.f4 = cr2.f4 +GROUP BY a.f3, cr.f4; + +drop table t1, t2, t3; --echo End of 5.0 tests # @@ -3701,3 +3737,36 @@ SELECT a FROM t1 ORDER BY a LIMIT 2; SELECT a FROM t1 ORDER BY a LIMIT 2,4294967296; SELECT a FROM t1 ORDER BY a LIMIT 2,4294967297; DROP TABLE t1; + +# +# Bug #37936: ASSERT_COLUMN_MARKED_FOR_WRITE in Field_datetime::store , +# Field_varstring::store +# + +CREATE TABLE A (date_key date); + +CREATE TABLE C ( + pk int, + int_nokey int, + int_key int, + date_key date NOT NULL, + date_nokey date, + varchar_key varchar(1) +); + +INSERT INTO C VALUES +(1,1,1,'0000-00-00',NULL,NULL), +(1,1,1,'0000-00-00',NULL,NULL); + +SELECT 1 FROM C WHERE pk > ANY (SELECT 1 FROM C); + +SELECT COUNT(DISTINCT 1) FROM C + WHERE date_key = (SELECT 1 FROM A WHERE C.date_key IS NULL) GROUP BY pk; +SELECT date_nokey FROM C + WHERE int_key IN (SELECT 1 FROM A) + HAVING date_nokey = '10:41:7' + ORDER BY date_key; + +DROP TABLE A,C; + +--echo End of 5.1 tests diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index 765a69aaa5f..116298a9c80 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -422,14 +422,15 @@ DROP TABLE t1; flush tables; # Create a junk frm file on disk -system echo "this is a junk file for test" >> $MYSQLTEST_VARDIR/master-data/test/t1.frm ; +let $MYSQLD_DATADIR= `select @@datadir`; +system echo "this is a junk file for test" >> $MYSQLD_DATADIR/test/t1.frm ; --replace_column 6 # 7 # 8 # 9 # SHOW TABLE STATUS like 't1'; --error 1033 show create table t1; drop table if exists t1; --error 1,0 ---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm +--remove_file $MYSQLD_DATADIR/test/t1.frm # # BUG 12183 - SHOW OPEN TABLES behavior doesn't match grammar diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test index 56d99c4435c..14c38a2fdb4 100644 --- a/mysql-test/t/sp-destruct.test +++ b/mysql-test/t/sp-destruct.test @@ -13,9 +13,10 @@ -- source include/not_embedded.inc # Backup proc table ---copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/proc.frm ---copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/proc.MYD ---copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/proc.MYI +let $MYSQLD_DATADIR= `select @@datadir`; +--copy_file $MYSQLD_DATADIR/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/proc.frm +--copy_file $MYSQLD_DATADIR/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/proc.MYD +--copy_file $MYSQLD_DATADIR/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/proc.MYI use test; @@ -50,8 +51,8 @@ insert into t1 values (0); flush table mysql.proc; # Thrashing the .frm file ---remove_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm ---write_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm +--remove_file $MYSQLD_DATADIR/mysql/proc.frm +--write_file $MYSQLD_DATADIR/mysql/proc.frm saljdfa EOF --replace_result $MYSQLTEST_VARDIR . master-data// '' '\\' '/' @@ -67,9 +68,9 @@ insert into t1 values (0); flush table mysql.proc; # Drop the mysql.proc table ---remove_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm ---remove_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD ---remove_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI +--remove_file $MYSQLD_DATADIR/mysql/proc.frm +--remove_file $MYSQLD_DATADIR/mysql/proc.MYD +--remove_file $MYSQLD_DATADIR/mysql/proc.MYI --error ER_NO_SUCH_TABLE call bug14233(); --error ER_NO_SUCH_TABLE @@ -78,9 +79,9 @@ create view v1 as select bug14233_f(); insert into t1 values (0); # Restore mysql.proc ---copy_file $MYSQLTEST_VARDIR/tmp/proc.frm $MYSQLTEST_VARDIR/master-data/mysql/proc.frm ---copy_file $MYSQLTEST_VARDIR/tmp/proc.MYD $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD ---copy_file $MYSQLTEST_VARDIR/tmp/proc.MYI $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI +--copy_file $MYSQLTEST_VARDIR/tmp/proc.frm $MYSQLD_DATADIR/mysql/proc.frm +--copy_file $MYSQLTEST_VARDIR/tmp/proc.MYD $MYSQLD_DATADIR/mysql/proc.MYD +--copy_file $MYSQLTEST_VARDIR/tmp/proc.MYI $MYSQLD_DATADIR/mysql/proc.MYI --remove_file $MYSQLTEST_VARDIR/tmp/proc.frm --remove_file $MYSQLTEST_VARDIR/tmp/proc.MYD --remove_file $MYSQLTEST_VARDIR/tmp/proc.MYI @@ -152,5 +153,5 @@ drop function bug14233_1; drop function bug14233_2; drop procedure bug14233_3; # Assert: These should show nothing. -show procedure status; -show function status; +show procedure status where db=DATABASE(); +show function status where db=DATABASE(); diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index 5437f3a156f..8d7c6d75a34 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -6,6 +6,10 @@ drop table if exists t1, t2; --enable_warnings +# Backup the mysql.proc table +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval SELECT * FROM mysql.proc INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/proc.txt'; + # Make sure we don't have any procedures left. delete from mysql.proc; @@ -2425,3 +2429,9 @@ delimiter ;$$ #--enable_warnings #create procedure bugNNNN... #create function bugNNNN... + +# +# CLEANUP and RESTORE +# +LOAD DATA INFILE '../../tmp/proc.txt' INTO TABLE mysql.proc; +remove_file $MYSQLTEST_VARDIR/tmp/proc.txt; diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test index 91de14116d4..b372c05b6e3 100644 --- a/mysql-test/t/sp-security.test +++ b/mysql-test/t/sp-security.test @@ -243,11 +243,11 @@ disconnect con2user1; disconnect con3anon; disconnect con4user2; use test; -select type,db,name from mysql.proc; +select type,db,name from mysql.proc where db like 'db%'; drop database db1_secret; drop database db2; # Make sure the routines are gone -select type,db,name from mysql.proc; +select type,db,name from mysql.proc where db like 'db%'; # Get rid of the users delete from mysql.user where user='user1' or user='user2'; delete from mysql.user where user='' and host='%'; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 05bccae67aa..d57fe777953 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -703,7 +703,7 @@ drop procedure into_test4| --disable_warnings drop procedure if exists into_outfile| --enable_warnings ---replace_result $MYSQLTEST_VARDIR .. +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval create procedure into_outfile(x char(16), y int) begin insert into test.t1 values (x, y); @@ -722,7 +722,7 @@ drop procedure into_outfile| --disable_warnings drop procedure if exists into_dumpfile| --enable_warnings ---replace_result $MYSQLTEST_VARDIR .. +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval create procedure into_dumpfile(x char(16), y int) begin insert into test.t1 values (x, y); @@ -1540,7 +1540,7 @@ begin end| show create procedure opp| --replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00' -show procedure status like '%p%'| +show procedure status where name like '%p%' and db='test'| # This isn't the fastest way in the world to compute prime numbers, so # don't be too ambitious. ;-) @@ -1558,7 +1558,7 @@ drop table t3| drop procedure opp| drop procedure ip| --replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00' -show procedure status like '%p%'| +show procedure status where name like '%p%' and db='test'| # Fibonacci, for recursion test. (Yet Another Numerical series :) @@ -2280,7 +2280,7 @@ drop procedure if exists bug2267_1| --enable_warnings create procedure bug2267_1() begin - show procedure status; + show procedure status where db='test'; end| --disable_warnings @@ -2288,7 +2288,7 @@ drop procedure if exists bug2267_2| --enable_warnings create procedure bug2267_2() begin - show function status; + show function status where db='test'; end| --disable_warnings @@ -5261,9 +5261,9 @@ drop procedure if exists bug13012| create procedure bug13012() BEGIN REPAIR TABLE t1; - BACKUP TABLE t1 to '../tmp'; + BACKUP TABLE t1 to '../../tmp'; DROP TABLE t1; - RESTORE TABLE t1 FROM '../tmp'; + RESTORE TABLE t1 FROM '../../tmp'; END| call bug13012()| --enable_warnings diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test index bc241423417..f487f0695a3 100644 --- a/mysql-test/t/status.test +++ b/mysql-test/t/status.test @@ -238,6 +238,8 @@ let $tmp_table2 = `show global status like 'Created_tmp_tables'`; --disable_query_log eval select substring_index('$rnd_next2',0x9,-1)-substring_index('$rnd_next',0x9,-1) as rnd_diff, substring_index('$tmp_table2',0x9,-1)-substring_index('$tmp_table',0x9,-1) as tmp_table_diff; --enable_query_log +disconnect con1; +connection default; # # Bug#30252 Com_create_function is not incremented. @@ -287,10 +289,51 @@ show procedure status where name ='proc37908' and 1 in (select f1 from db37908.t --error 1142 show function status where name ='func37908' and 1 in (select func37908()); -connection root; +connection default; +disconnect user1; +disconnect root; drop database db37908; drop procedure proc37908; drop function func37908; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; +DROP USER mysqltest_1@localhost; + +# +# Bug#41131 "Questions" fails to increment - ignores statements instead stored procs +# +connect (con1,localhost,root,,); +connection con1; +--disable_warnings +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +--enable_warnings +DELIMITER $$; +CREATE FUNCTION f1() RETURNS INTEGER +BEGIN + DECLARE foo INTEGER; + DECLARE bar INTEGER; + SET foo=1; + SET bar=2; + RETURN foo; +END $$ +CREATE PROCEDURE p1() + BEGIN + SELECT 1; +END $$ +DELIMITER ;$$ +let $org_queries= `SHOW STATUS LIKE 'Queries'`; +SELECT f1(); +CALL p1(); +let $new_queries= `SHOW STATUS LIKE 'Queries'`; +--disable_query_log +let $diff= `SELECT SUBSTRING('$new_queries',9)-SUBSTRING('$org_queries',9)`; +--enable_query_log +eval SELECT $diff; +disconnect con1; +connection default; +DROP PROCEDURE p1; +DROP FUNCTION f1; + # End of 5.1 tests # Restore global concurrent_insert value. Keep in the end of the test file. diff --git a/mysql-test/t/status2.test b/mysql-test/t/status2.test new file mode 100644 index 00000000000..2d1541c54f2 --- /dev/null +++ b/mysql-test/t/status2.test @@ -0,0 +1,68 @@ +--source include/not_embedded.inc + +--echo # +--echo # Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines +--echo # +FLUSH STATUS; +DELIMITER $$; +CREATE FUNCTION testQuestion() RETURNS INTEGER +BEGIN + DECLARE foo INTEGER; + DECLARE bar INTEGER; + SET foo=1; + SET bar=2; + RETURN foo; +END $$ +CREATE PROCEDURE testQuestion2() +BEGIN + SELECT 1; +END $$ +DELIMITER ;$$ +--disable_warnings +DROP TABLE IF EXISTS t1,t2; +--enable_warnings +CREATE TABLE t1 (c1 INT); +CREATE TABLE t2 (c1 INT); +CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND + DO INSERT INTO t1 VALUES(1); + +--echo Assert Questions == 7 +SHOW STATUS LIKE 'Questions'; +SELECT testQuestion(); +--echo Assert Questions == 9 +SHOW STATUS LIKE 'Questions'; +CALL testQuestion2(); +--echo Assert Questions == 11 +SHOW STATUS LIKE 'Questions'; +SELECT 1; +--echo Assert Questions == 13 +SHOW STATUS LIKE 'Questions'; +connect (con1,localhost,root,,); +connection con1; +SELECT 1; +connection default; +disconnect con1; +--echo Assert Questions == 14 +SHOW STATUS LIKE 'Questions'; +DELIMITER $$; +CREATE TRIGGER trigg1 AFTER INSERT ON t1 + FOR EACH ROW BEGIN + INSERT INTO t2 VALUES (1); + END; +$$ +DELIMITER ;$$ +--echo Assert Questions == 16 +SHOW STATUS LIKE 'Questions'; +INSERT INTO t1 VALUES (1); +--echo Assert Questions == 18 +SHOW STATUS LIKE 'Questions'; +# TODO: Uncomment the lines below when FLUSH GLOBAL STATUS is implemented. +# FLUSH STATUS; +# SHOW GLOBAL STATUS LIKE 'Questions'; +DROP PROCEDURE testQuestion2; +DROP TRIGGER trigg1; +DROP FUNCTION testQuestion; +DROP EVENT ev1; +DROP TABLE t1,t2; +--echo End of 6.0 tests + diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test index 486f7ce7897..f2ce045840c 100644 --- a/mysql-test/t/strict.test +++ b/mysql-test/t/strict.test @@ -1199,6 +1199,15 @@ show create table t1; drop table t1; # +# Bug #39591: Crash if table comment is longer than 62 characters +# + +#60 chars, 120 (+1) bytes (UTF-8 with 2-byte chars) +CREATE TABLE t3 (f1 INT) COMMENT 'כקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחן'; +SHOW CREATE TABLE t3; +DROP TABLE t3; + +# # Bug #26359: Strings becoming truncated and converted to numbers under STRICT mode # set sql_mode= 'traditional'; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 1960af371e1..569df9368f6 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -1041,13 +1041,14 @@ DROP TABLE t1; create table t1 (a int, b decimal(13, 3)); insert into t1 values (1, 0.123); -let $outfile = $MYSQLTEST_VARDIR/master-data/test/subselect.out.file.1; +let $outfile_abs= $MYSQLTEST_VARDIR/tmp/subselect.out.file.1; +let $outfile_rel= ../../tmp/subselect.out.file.1; --error 0,1 ---remove_file $outfile -select a, (select max(b) from t1) into outfile "subselect.out.file.1" from t1; +--remove_file $outfile_abs +eval select a, (select max(b) from t1) into outfile "$outfile_rel" from t1; delete from t1; -load data infile "subselect.out.file.1" into table t1; ---remove_file $outfile +eval load data infile "$outfile_rel" into table t1; +--remove_file $outfile_abs select * from t1; drop table t1; diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test index b13640e7f3b..c805dd40fe8 100644 --- a/mysql-test/t/symlink.test +++ b/mysql-test/t/symlink.test @@ -176,14 +176,15 @@ drop table t1; # # Bug #29325: create table overwrites .MYD file of other table (datadir) # +let $MYSQLD_DATADIR= `select @@datadir`; SET SESSION keep_files_on_create = TRUE; ---write_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD +--write_file $MYSQLD_DATADIR/test/t1.MYD EOF --disable_abort_on_error --error 1,1,ER_TABLE_EXISTS_ERROR CREATE TABLE t1 (a INT) ENGINE MYISAM; --error 0,1 ---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD; +--remove_file $MYSQLD_DATADIR/test/t1.MYD; --enable_abort_on_error SET SESSION keep_files_on_create = FALSE; CREATE TABLE t1 (a INT) ENGINE MYISAM; @@ -199,34 +200,35 @@ DROP TABLE t1; # home directory is symlinked, e.g. mysql-test-run --mem. # This will be fixed in 6.0 only. # ---replace_result $MYSQLTEST_VARDIR TEST_DIR +let $MYSQLD_DATADIR= `select @@datadir`; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --error 0,ER_WRONG_ARGUMENTS eval CREATE TABLE t1(a INT) -INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql'; +INDEX DIRECTORY='$MYSQLD_DATADIR/mysql'; --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings # ---replace_result $MYSQLTEST_VARDIR TEST_DIR +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --error 0,ER_WRONG_ARGUMENTS eval CREATE TABLE t1(a INT) -DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/test'; +DATA DIRECTORY='$MYSQLD_DATADIR/test'; --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings # ---replace_result $MYSQLTEST_VARDIR TEST_DIR +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --error 0,ER_WRONG_ARGUMENTS eval CREATE TABLE t1(a INT) -DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/'; +DATA DIRECTORY='$MYSQLD_DATADIR/'; --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings # ---replace_result $MYSQLTEST_VARDIR TEST_DIR +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --error 0,ER_WRONG_ARGUMENTS eval CREATE TABLE t1(a INT) -INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data'; +INDEX DIRECTORY='$MYSQLD_DATADIR'; --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings @@ -240,6 +242,7 @@ INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data_var'; # BUG#25677 - With --skip-symbolic-links option on, DATA DIRECTORY clause is # silently ignored # + SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='NO_DIR_IN_CREATE'; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval CREATE TABLE t1(a INT) DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp'; diff --git a/mysql-test/t/system_mysql_db.test b/mysql-test/t/system_mysql_db.test index e3d58ab7139..398a222b642 100644 --- a/mysql-test/t/system_mysql_db.test +++ b/mysql-test/t/system_mysql_db.test @@ -6,11 +6,6 @@ # depends on the presence of the log tables (which are CSV-based). --source include/have_csv.inc -# First delete some tables maybe left over from previous tests ---disable_warnings -drop table if exists t1,t1aa,t2aa; ---enable_warnings - -- disable_query_log use mysql; -- enable_query_log diff --git a/mysql-test/t/system_mysql_db_fix30020.test b/mysql-test/t/system_mysql_db_fix30020.test index dc68f469d3a..a3dc9adb254 100644 --- a/mysql-test/t/system_mysql_db_fix30020.test +++ b/mysql-test/t/system_mysql_db_fix30020.test @@ -21,10 +21,6 @@ if (`SELECT LENGTH("$MYSQL_FIX_SYSTEM_TABLES") <= 0`) # mysql_fix_system_tables which should be ignored. # Instead, concentrate on the errors in r/system_mysql_db.reject ---disable_warnings -drop table if exists t1,t1aa,t2aa; ---enable_warnings - -- disable_result_log -- disable_query_log diff --git a/mysql-test/t/system_mysql_db_fix40123.test b/mysql-test/t/system_mysql_db_fix40123.test index 419a9cd1827..440fcc8aa8a 100644 --- a/mysql-test/t/system_mysql_db_fix40123.test +++ b/mysql-test/t/system_mysql_db_fix40123.test @@ -18,10 +18,6 @@ if (`SELECT LENGTH("$MYSQL_FIX_PRIVILEGE_TABLES") <= 0`) # mysql_fix_system_tables which should be ignored. # Instead, concentrate on the errors in r/system_mysql_db.reject ---disable_warnings -drop table if exists t1,t1aa,t2aa; ---enable_warnings - -- disable_result_log -- disable_query_log diff --git a/mysql-test/t/system_mysql_db_fix50030.test b/mysql-test/t/system_mysql_db_fix50030.test index 80365cfdff4..4924c625d57 100644 --- a/mysql-test/t/system_mysql_db_fix50030.test +++ b/mysql-test/t/system_mysql_db_fix50030.test @@ -18,10 +18,6 @@ if (`SELECT LENGTH("$MYSQL_FIX_PRIVILEGE_TABLES") <= 0`) # mysql_fix_system_tables which should be ignored. # Instead, concentrate on the errors in r/system_mysql_db.reject ---disable_warnings -drop table if exists t1,t1aa,t2aa; ---enable_warnings - -- disable_result_log -- disable_query_log diff --git a/mysql-test/t/system_mysql_db_fix50117.test b/mysql-test/t/system_mysql_db_fix50117.test index 1eed4d671ef..d88c4edba93 100644 --- a/mysql-test/t/system_mysql_db_fix50117.test +++ b/mysql-test/t/system_mysql_db_fix50117.test @@ -18,10 +18,6 @@ if (`SELECT LENGTH("$MYSQL_FIX_PRIVILEGE_TABLES") <= 0`) # mysql_fix_system_tables which should be ignored. # Instead, concentrate on the errors in r/system_mysql_db.reject ---disable_warnings - drop table if exists t1,t1aa,t2aa; ---enable_warnings - -- disable_result_log -- disable_query_log diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test index 4ab8a982e63..2bfa4936c91 100644 --- a/mysql-test/t/temp_table.test +++ b/mysql-test/t/temp_table.test @@ -204,4 +204,35 @@ DELETE FROM t1; SELECT * FROM t1; DROP TABLE t1; +# +# Bug#41348: INSERT INTO tbl SELECT * FROM temp_tbl overwrites locking type of temp table +# + +--disable_warnings +DROP TABLE IF EXISTS t1,t2; +DROP FUNCTION IF EXISTS f1; +--enable_warnings + +CREATE TEMPORARY TABLE t1 (a INT); +CREATE TEMPORARY TABLE t2 LIKE t1; + +DELIMITER |; +CREATE FUNCTION f1() RETURNS INT + BEGIN + return 1; + END| +DELIMITER ;| + +INSERT INTO t2 SELECT * FROM t1; +INSERT INTO t1 SELECT f1(); + +CREATE TABLE t3 SELECT * FROM t1; +INSERT INTO t1 SELECT f1(); + +UPDATE t1,t2 SET t1.a = t2.a; +INSERT INTO t2 SELECT f1(); + +DROP TABLE t1,t2,t3; +DROP FUNCTION f1; + --echo End of 5.1 tests diff --git a/mysql-test/t/timezone2.test b/mysql-test/t/timezone2.test index 4f70539ca8d..15ddceb8d68 100644 --- a/mysql-test/t/timezone2.test +++ b/mysql-test/t/timezone2.test @@ -228,6 +228,7 @@ drop table t1; # Test for bug #11081 "Using a CONVERT_TZ function in a stored function # or trigger fails". # +SET @old_log_bin_trust_function_creators = @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; create table t1 (ldt datetime, udt datetime); @@ -243,7 +244,7 @@ select ldt, f1(udt) as ldt2 from t1; drop table t1; drop function f1; -SET GLOBAL log_bin_trust_function_creators = 0; +SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; # End of 5.0 tests diff --git a/mysql-test/t/trigger-compat.test b/mysql-test/t/trigger-compat.test index 9f7fd8bc505..bf119cd89e6 100644 --- a/mysql-test/t/trigger-compat.test +++ b/mysql-test/t/trigger-compat.test @@ -60,8 +60,9 @@ CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1 --echo --echo ---> patching t1.TRG... ---exec grep -v 'definers=' $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG > $MYSQLTEST_VARDIR/tmp/t1.TRG ---exec mv $MYSQLTEST_VARDIR/tmp/t1.TRG $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG +let $MYSQLD_DATADIR= `select @@datadir`; +--exec grep -v 'definers=' $MYSQLD_DATADIR/mysqltest_db1/t1.TRG > $MYSQLTEST_VARDIR/tmp/t1.TRG +--exec mv $MYSQLTEST_VARDIR/tmp/t1.TRG $MYSQLD_DATADIR/mysqltest_db1/t1.TRG # # Create a new trigger. diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index c57178c1928..6974a4cc5da 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -472,11 +472,11 @@ create trigger trg1 before insert on t1 for each row set new.k = new.i; create trigger trg2 after insert on t1 for each row set @b:= "Fired"; set @b:=""; # Test triggers with file with separators -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, i); +load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, i); select *, @b from t1; set @b:=""; # Test triggers with fixed size row file -load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, j); +load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, j); select *, @b from t1; # This also will drop triggers drop table t1; @@ -510,7 +510,7 @@ delete from t1 where i = 2; select * from t1; # Should fail and insert only 1 row --error ER_BAD_FIELD_ERROR -load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k); +load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k); select * from t1; --error ER_BAD_FIELD_ERROR insert into t1 select 3, 3; @@ -567,7 +567,7 @@ select * from t1; delete from t1; select * from t1; --error ER_BAD_FIELD_ERROR -load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k); +load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k); select * from t1; --error ER_BAD_FIELD_ERROR insert into t1 select 3, 3; @@ -1141,12 +1141,13 @@ select trigger_schema, trigger_name, event_object_schema, event_object_table, action_statement from information_schema.triggers where event_object_schema = 'test'; # Trick which makes update of second .TRN file impossible -write_file $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~; +let $MYSQLD_DATADIR= `select @@datadir`; +write_file $MYSQLD_DATADIR/test/t1_ai.TRN~; dummy EOF -chmod 0000 $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~; +chmod 0000 $MYSQLD_DATADIR/test/t1_ai.TRN~; # Normalize the datadir path; the embedded server doesn't chdir to datadir ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' --error 1 rename table t1 to t2; # 't1' should be still there and triggers should work correctly @@ -1155,8 +1156,8 @@ select @a, @b; select trigger_schema, trigger_name, event_object_schema, event_object_table, action_statement from information_schema.triggers where event_object_schema = 'test'; -chmod 0600 $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~; -remove_file $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~; +chmod 0600 $MYSQLD_DATADIR/test/t1_ai.TRN~; +remove_file $MYSQLD_DATADIR/test/t1_ai.TRN~; # Let us check that updates to .TRN files were rolled back too drop trigger t1_bi; drop trigger t1_ai; @@ -1189,7 +1190,7 @@ insert into t1 (a) values create trigger t2_ai after insert on t2 for each row set @a:= (select max(a) from t2); insert into t2 select * from t1; -load data infile '../std_data_ln/words.dat' into table t1 (a); +load data infile '../../std_data/words.dat' into table t1 (a); drop trigger t1_ai; drop trigger t2_ai; # Test that the problem for functions is fixed as well @@ -1199,7 +1200,7 @@ insert into t1 values ("And",f1()),("the",f1()),("mome", f1()),("raths",f1()),("outgrabe",f1()); create function f2() returns int return (select max(b) from t2); insert into t2 select a, f2() from t1; -load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1(); +load data infile '../../std_data/words.dat' into table t1 (a) set b:= f1(); drop function f1; drop function f2; drop table t1, t2; diff --git a/mysql-test/t/trigger_notembedded.test b/mysql-test/t/trigger_notembedded.test index 5d2ab84adaf..9588ec6e3ed 100644 --- a/mysql-test/t/trigger_notembedded.test +++ b/mysql-test/t/trigger_notembedded.test @@ -360,10 +360,11 @@ CREATE TRIGGER trg5 BEFORE DELETE ON t1 SET @a = 5; # Replace definers with the "weird" definers +let MYSQLD_DATADIR= `select @@datadir`; perl; use strict; use warnings; -my $fname= "$ENV{'MYSQLTEST_VARDIR'}/master-data/mysqltest_db1/t1.TRG"; +my $fname= "$ENV{'MYSQLD_DATADIR'}/mysqltest_db1/t1.TRG"; open(FILE, "<", $fname) or die; my @content= grep($_ !~ /^definers=/, <FILE>); close FILE; diff --git a/mysql-test/t/type_bit.test b/mysql-test/t/type_bit.test index 5793846a0b2..dc5120db430 100644 --- a/mysql-test/t/type_bit.test +++ b/mysql-test/t/type_bit.test @@ -352,6 +352,51 @@ SELECT HEX(b1), HEX(b2), i2 FROM t2 DROP TABLE t1, t2; +# +# Bug #35796 SHOW CREATE TABLE and default value for BIT field +# +CREATE TABLE IF NOT EXISTS t1 ( +f1 bit(2) NOT NULL default b'10', +f2 bit(14) NOT NULL default b'11110000111100' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--error ER_INVALID_DEFAULT +CREATE TABLE IF NOT EXISTS t1 ( +f1 bit(2) NOT NULL default b'' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; + + +# +# Bug#31399 Wrong query result when doing join buffering over BIT fields +# +create table t1bit7 (a1 bit(7) not null) engine=MyISAM; +create table t2bit7 (b1 bit(7)) engine=MyISAM; + +insert into t1bit7 values (b'1100000'); +insert into t1bit7 values (b'1100001'); +insert into t1bit7 values (b'1100010'); +insert into t2bit7 values (b'1100001'); +insert into t2bit7 values (b'1100010'); +insert into t2bit7 values (b'1100110'); + +select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1; +drop table t1bit7, t2bit7; + +create table t1bit7 (a1 bit(15) not null) engine=MyISAM; +create table t2bit7 (b1 bit(15)) engine=MyISAM; + +insert into t1bit7 values (b'110000011111111'); +insert into t1bit7 values (b'110000111111111'); +insert into t1bit7 values (b'110001011111111'); +insert into t2bit7 values (b'110000111111111'); +insert into t2bit7 values (b'110001011111111'); +insert into t2bit7 values (b'110011011111111'); + +select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1; +drop table t1bit7, t2bit7; + --echo End of 5.0 tests # diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test index 35e5b30ecb8..460da1c1614 100644 --- a/mysql-test/t/type_blob.test +++ b/mysql-test/t/type_blob.test @@ -308,20 +308,20 @@ create table t1 (id integer auto_increment unique,imagem LONGBLOB not null defau insert into t1 (id) values (1); # We have to clean up the path in the results for safe comparison eval select - charset(load_file('../std_data_ln/words.dat')), - collation(load_file('../std_data_ln/words.dat')), - coercibility(load_file('../std_data_ln/words.dat')); + charset(load_file('../../std_data/words.dat')), + collation(load_file('../../std_data/words.dat')), + coercibility(load_file('../../std_data/words.dat')); --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval explain extended select - charset(load_file('$MYSQLTEST_VARDIR/std_data_ln/words.dat')), - collation(load_file('$MYSQLTEST_VARDIR/std_data_ln/words.dat')), - coercibility(load_file('$MYSQLTEST_VARDIR/std_data_ln/words.dat')); + charset(load_file('$MYSQLTEST_VARDIR/std_data/words.dat')), + collation(load_file('$MYSQLTEST_VARDIR/std_data/words.dat')), + coercibility(load_file('$MYSQLTEST_VARDIR/std_data/words.dat')); --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval update t1 set imagem=load_file('$MYSQLTEST_VARDIR/std_data_ln/words.dat') where id=1; +eval update t1 set imagem=load_file('$MYSQLTEST_VARDIR/std_data/words.dat') where id=1; select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1; drop table t1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval create table t1 select load_file('$MYSQLTEST_VARDIR/std_data_ln/words.dat') l; +eval create table t1 select load_file('$MYSQLTEST_VARDIR/std_data/words.dat') l; # We mask out the Privileges column because it differs for embedded server --replace_column 8 # show full fields from t1; diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test index 9bc428c3715..aec60bc2dee 100644 --- a/mysql-test/t/type_date.test +++ b/mysql-test/t/type_date.test @@ -62,7 +62,7 @@ drop table t1; # Test of date and not null # -create table t1 (date date); +create table t1 (date date); insert into t1 values ("2000-08-10"),("2000-08-11"); select date_add(date,INTERVAL 1 DAY),date_add(date,INTERVAL 1 SECOND) from t1; drop table t1; @@ -75,9 +75,12 @@ CREATE TABLE t1(AFIELD INT); INSERT INTO t1 VALUES(1); CREATE TABLE t2(GMT VARCHAR(32)); INSERT INTO t2 VALUES('GMT-0800'); -SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1, t2 GROUP BY t1.AFIELD; +SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) +FROM t1, t2 GROUP BY t1.AFIELD; INSERT INTO t1 VALUES(1); -SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)), DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1,t2 GROUP BY t1.AFIELD; +SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)), + DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) +FROM t1,t2 GROUP BY t1.AFIELD; drop table t1,t2; # @@ -90,7 +93,7 @@ SELECT DATE_FORMAT(f1, "%l.%i %p") , DATE_FORMAT(f2, "%l.%i %p") FROM t1; DROP TABLE t1; # -# Bug 4937: different date -> string conversion when using SELECT ... UNION +# Bug#4937: different date -> string conversion when using SELECT ... UNION # and INSERT ... SELECT ... UNION # @@ -141,7 +144,7 @@ select * from t1; drop table t1; # -# Bug #30942: select str_to_date from derived table returns varying results +# Bug#30942: select str_to_date from derived table returns varying results # CREATE TABLE t1 ( a INT @@ -155,10 +158,22 @@ DROP TABLE t1; # -# Bug #31221: Optimizer incorrectly identifies impossible WHERE clause +# Bug#31221: Optimizer incorrectly identifies impossible WHERE clause # -CREATE TABLE t1 (a DATE, b int, PRIMARY KEY (a,b)); +CREATE TABLE t1 (a DATE, b INT, PRIMARY KEY (a,b)); +## The current sub test could fail (difference to expected result) if we +## have just reached midnight. +## (Bug#41776 type_date.test may fail if run around midnight) +## Therefore we sleep a bit if we are too close to midnight. +## The complete test itself needs in average less than 1 second. +## Therefore a time_distance to midnight of 5 seconds should be sufficient. +if (`SELECT CURTIME() > SEC_TO_TIME(24 * 3600 - 5)`) +{ + # We are here when CURTIME() is between '23:59:56' and '23:59:59'. + # So a sleep time of 5 seconds brings us between '00:00:01' and '00:00:04'. + --real_sleep 5 +} INSERT INTO t1 VALUES (DATE(NOW()), 1); SELECT COUNT(*) FROM t1 WHERE a = NOW(); EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW(); @@ -174,7 +189,7 @@ EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW(); DROP TABLE t1; # -# Bug #28687: Search fails on '0000-00-00' date after sql_mode change +# Bug#28687: Search fails on '0000-00-00' date after sql_mode change # CREATE TABLE t1 (a DATE); diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test index 9aa8c00d24a..53bcf44061d 100644 --- a/mysql-test/t/type_float.test +++ b/mysql-test/t/type_float.test @@ -252,4 +252,19 @@ insert into t1 values (2e30), (-2e30); select f1 + 0e0 from t1; drop table t1; +# +# Bug #27483: Casting 'scientific notation type' to 'unsigned bigint' fails on +# windows. +# + +create table t1(d double, u bigint unsigned); + +insert into t1(d) values (9.22337203685479e18), + (1.84e19); + +update t1 set u = d; +select u from t1; + +drop table t1; + --echo End of 5.0 tests diff --git a/mysql-test/t/type_varchar.test b/mysql-test/t/type_varchar.test index 1eb949a21e3..9098881e379 100644 --- a/mysql-test/t/type_varchar.test +++ b/mysql-test/t/type_varchar.test @@ -3,7 +3,8 @@ drop table if exists t1, t2; --enable_warnings create table t1 (v varchar(30), c char(3), e enum('abc','def','ghi'), t text); -copy_file $MYSQL_TEST_DIR/std_data/vchar.frm $MYSQLTEST_VARDIR/master-data/test/vchar.frm; +let $MYSQLD_DATADIR= `select @@datadir`; +copy_file $MYSQL_TEST_DIR/std_data/vchar.frm $MYSQLD_DATADIR/test/vchar.frm; truncate table vchar; show create table t1; show create table vchar; @@ -162,8 +163,8 @@ create table t3 ( en varchar(255) character set utf8, cz varchar(255) character set utf8 ); -remove_file $MYSQLTEST_VARDIR/master-data/test/t3.frm; -copy_file $MYSQL_TEST_DIR/std_data/14897.frm $MYSQLTEST_VARDIR/master-data/test/t3.frm; +remove_file $MYSQLD_DATADIR/test/t3.frm; +copy_file $MYSQL_TEST_DIR/std_data/14897.frm $MYSQLD_DATADIR/test/t3.frm; truncate table t3; insert into t3 (id, en, cz) values (1,'en string 1','cz string 1'), diff --git a/mysql-test/t/upgrade.test b/mysql-test/t/upgrade.test index ce40ec8ed77..a96d1f47cb2 100644 --- a/mysql-test/t/upgrade.test +++ b/mysql-test/t/upgrade.test @@ -52,7 +52,8 @@ drop table `txu#p#p1`; # Check if old tables work # -system cp $MYSQL_TEST_DIR/std_data/old_table-323.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm; +let $MYSQLD_DATADIR= `select @@datadir`; +system cp $MYSQL_TEST_DIR/std_data/old_table-323.frm $MYSQLD_DATADIR/test/t1.frm; truncate t1; drop table t1; @@ -70,11 +71,11 @@ create table tabc.t1 (a int); FLUSH TABLES; # Manually make a 5.0 database from the template ---mkdir $MYSQLTEST_VARDIR/master-data/a-b-c ---copy_file $MYSQLTEST_VARDIR/master-data/tabc/db.opt $MYSQLTEST_VARDIR/master-data/a-b-c/db.opt ---copy_file $MYSQLTEST_VARDIR/master-data/tabc/t1.frm $MYSQLTEST_VARDIR/master-data/a-b-c/t1.frm ---copy_file $MYSQLTEST_VARDIR/master-data/tabc/t1.MYD $MYSQLTEST_VARDIR/master-data/a-b-c/t1.MYD ---copy_file $MYSQLTEST_VARDIR/master-data/tabc/t1.MYI $MYSQLTEST_VARDIR/master-data/a-b-c/t1.MYI +--mkdir $MYSQLD_DATADIR/a-b-c +--copy_file $MYSQLD_DATADIR/tabc/db.opt $MYSQLD_DATADIR/a-b-c/db.opt +--copy_file $MYSQLD_DATADIR/tabc/t1.frm $MYSQLD_DATADIR/a-b-c/t1.frm +--copy_file $MYSQLD_DATADIR/tabc/t1.MYD $MYSQLD_DATADIR/a-b-c/t1.MYD +--copy_file $MYSQLD_DATADIR/tabc/t1.MYI $MYSQLD_DATADIR/a-b-c/t1.MYI show databases like '%a-b-c%'; ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME; diff --git a/mysql-test/t/user_var-binlog.test b/mysql-test/t/user_var-binlog.test index 70f2f0fa7a6..0098f237de9 100644 --- a/mysql-test/t/user_var-binlog.test +++ b/mysql-test/t/user_var-binlog.test @@ -16,9 +16,9 @@ source include/show_binlog_events.inc; # more important than SHOW BINLOG EVENTS, mysqlbinlog (where we # absolutely need variables names to be quoted and strings to be # escaped). ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +let $MYSQLD_DATADIR= `select @@datadir`; flush logs; ---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 drop table t1; # End of 4.1 tests diff --git a/mysql-test/t/varbinary.test b/mysql-test/t/varbinary.test index 1db561183a7..1f9f7b5412d 100644 --- a/mysql-test/t/varbinary.test +++ b/mysql-test/t/varbinary.test @@ -47,12 +47,13 @@ drop table t1; # # Test with a saved table from 4.1 -copy_file std_data/bug19371.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm; -chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.frm; -copy_file std_data/bug19371.MYD $MYSQLTEST_VARDIR/master-data/test/t1.MYD; -chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.MYD; -copy_file std_data/bug19371.MYI $MYSQLTEST_VARDIR/master-data/test/t1.MYI; -chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.MYI; +let $MYSQLD_DATADIR= `select @@datadir`; +copy_file std_data/bug19371.frm $MYSQLD_DATADIR/test/t1.frm; +chmod 0777 $MYSQLD_DATADIR/test/t1.frm; +copy_file std_data/bug19371.MYD $MYSQLD_DATADIR/test/t1.MYD; +chmod 0777 $MYSQLD_DATADIR/test/t1.MYD; +copy_file std_data/bug19371.MYI $MYSQLD_DATADIR/test/t1.MYI; +chmod 0777 $MYSQLD_DATADIR/test/t1.MYI; # Everything _looks_ fine show create table t1; diff --git a/mysql-test/t/variables-notembedded.test b/mysql-test/t/variables-notembedded.test index 823fecb8791..7cc068c68c7 100644 --- a/mysql-test/t/variables-notembedded.test +++ b/mysql-test/t/variables-notembedded.test @@ -28,6 +28,7 @@ set global slave_net_timeout=default; # sql_slave_skip_counter is write-only, so we can't save previous # value and restore it here. That's ok, because it's normally 0. set global sql_slave_skip_counter= 0; +set @@global.slave_net_timeout= @my_slave_net_timeout; # # Bug#28234 - global/session scope - documentation vs implementation diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 828cb3a2916..296827fdbd8 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -24,6 +24,7 @@ set @my_max_heap_table_size =@@global.max_heap_table_size; set @my_max_insert_delayed_threads=@@global.max_insert_delayed_threads; set @my_max_join_size =@@global.max_join_size; set @my_myisam_data_pointer_size =@@global.myisam_data_pointer_size; +set @my_myisam_max_sort_file_size =@@global.myisam_max_sort_file_size; set @my_net_buffer_length =@@global.net_buffer_length; set @my_net_write_timeout =@@global.net_write_timeout; set @my_net_read_timeout =@@global.net_read_timeout; @@ -34,7 +35,6 @@ set @my_server_id =@@global.server_id; set @my_slow_launch_time =@@global.slow_launch_time; set @my_storage_engine =@@global.storage_engine; set @my_thread_cache_size =@@global.thread_cache_size; - # case insensitivity tests (new in 5.0) set @`test`=1; select @test, @`test`, @TEST, @`TEST`, @"teSt"; @@ -748,7 +748,7 @@ set global delayed_queue_size =@my_delayed_queue_size; set global flush =@my_flush; set global flush_time =@my_flush_time; set global key_buffer_size =@my_key_buffer_size; -set global max_binlog_cache_size =default; #@my_max_binlog_cache_size; +set global max_binlog_cache_size =@my_max_binlog_cache_size; set global max_binlog_size =@my_max_binlog_size; set global max_connect_errors =@my_max_connect_errors; set global max_connections =@my_max_connections; @@ -759,6 +759,7 @@ set global max_join_size =@my_max_join_size; set global max_user_connections =default; set global max_write_lock_count =default; set global myisam_data_pointer_size =@my_myisam_data_pointer_size; +set global myisam_max_sort_file_size =@my_myisam_max_sort_file_size; set global net_buffer_length =@my_net_buffer_length; set global net_write_timeout =@my_net_write_timeout; set global net_read_timeout =@my_net_read_timeout; @@ -769,7 +770,7 @@ set global server_id =@my_server_id; set global slow_launch_time =@my_slow_launch_time; set global storage_engine =@my_storage_engine; set global thread_cache_size =@my_thread_cache_size; - +set global max_allowed_packet = default; # # Bug#28580 Repeatation of status variables # diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 1ea248f1fe9..9e22006ea67 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -1228,11 +1228,11 @@ drop table t1; create table t1 (a int, b char(10)); create view v1 as select * from t1 where a != 0 with check option; -- error 1369 -load data infile '../std_data_ln/loaddata3.dat' into table v1 fields terminated by '' enclosed by '' ignore 1 lines; +load data infile '../../std_data/loaddata3.dat' into table v1 fields terminated by '' enclosed by '' ignore 1 lines; select * from t1; select * from v1; delete from t1; -load data infile '../std_data_ln/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines; +load data infile '../../std_data/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines; select * from t1 order by a,b; select * from v1 order by a,b; drop view v1; @@ -1241,11 +1241,11 @@ drop table t1; create table t1 (a text, b text); create view v1 as select * from t1 where a <> 'Field A' with check option; -- error 1369 -load data infile '../std_data_ln/loaddata2.dat' into table v1 fields terminated by ',' enclosed by ''''; +load data infile '../../std_data/loaddata2.dat' into table v1 fields terminated by ',' enclosed by ''''; select concat('|',a,'|'), concat('|',b,'|') from t1; select concat('|',a,'|'), concat('|',b,'|') from v1; delete from t1; -load data infile '../std_data_ln/loaddata2.dat' ignore into table v1 fields terminated by ',' enclosed by ''''; +load data infile '../../std_data/loaddata2.dat' ignore into table v1 fields terminated by ',' enclosed by ''''; select concat('|',a,'|'), concat('|',b,'|') from t1; select concat('|',a,'|'), concat('|',b,'|') from v1; drop view v1; diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test index 9e7e3e4f945..4074317f38a 100644 --- a/mysql-test/t/warnings.test +++ b/mysql-test/t/warnings.test @@ -50,7 +50,7 @@ drop table t1; # create table t1(a tinyint, b int not null, c date, d char(5)); -load data infile '../std_data_ln/warnings_loaddata.dat' into table t1 fields terminated by ','; +load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated by ','; # PS doesn't work good with @@warning_count --disable_ps_protocol select @@warning_count; diff --git a/mysql-test/t/warnings_engine_disabled.test b/mysql-test/t/warnings_engine_disabled.test index 0b09cff7b1e..b8751a062b7 100644 --- a/mysql-test/t/warnings_engine_disabled.test +++ b/mysql-test/t/warnings_engine_disabled.test @@ -4,7 +4,7 @@ # disable_query_log; --require r/true.require -select support = 'Disabled' as `TRUE` from information_schema.engines where engine = 'ndbcluster'; +select support = 'NO' as `TRUE` from information_schema.engines where engine = 'ndbcluster'; enable_query_log; @@ -16,4 +16,9 @@ create table t1 (id int) engine=NDB; alter table t1 engine=NDB; drop table t1; - +# +# Bug#29263 disabled storage engines omitted in SHOW ENGINES +# +SELECT ENGINE, SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='ndbcluster'; +SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE +PLUGIN_NAME='ndbcluster'; diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test index 5ca9c7afd76..d840e14ba5f 100644 --- a/mysql-test/t/xml.test +++ b/mysql-test/t/xml.test @@ -551,4 +551,29 @@ INSERT INTO t1 VALUES (0), (0); SELECT 1 FROM t1 ORDER BY(UPDATEXML(a, '1', '1')); DROP TABLE t1; +# +# BUG#38227 EXTRACTVALUE doesn't work with DTD declarations +# +# Check that quoted strings work fine in DOCTYPE declaration. +# + +SET @xml= +'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> + <head> + <title> Title - document with document declaration</title> + </head> + <body> Hi, Im a webpage with document a declaration </body> +</html>'; + +SELECT ExtractValue(@xml, 'html/head/title'); +SELECT ExtractValue(@xml, 'html/body'); + +# These two documents will fail. +# Quoted strings are not allowed in regular tags +# +SELECT ExtractValue('<xml "xxx" "yyy">CharData</xml>', '/xml'); +SELECT ExtractValue('<xml xxx "yyy">CharData</xml>', '/xml'); + + --echo End of 5.1 tests diff --git a/mysys/hash.c b/mysys/hash.c index ba606e835a8..63aad7d30ed 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 464b1d2e3cc..361f6cb8a90 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -974,24 +974,26 @@ static void init_one_value(const struct my_option *option, uchar* *variable, *((my_bool*) variable)= (my_bool) value; break; case GET_INT: - *((int*) variable)= (int) value; + *((int*) variable)= (int) getopt_ll_limit_value((int) value, option, NULL); break; - case GET_UINT: /* Fall through */ case GET_ENUM: *((uint*) variable)= (uint) value; break; + case GET_UINT: + *((uint*) variable)= (uint) getopt_ull_limit_value((uint) value, option, NULL); + break; case GET_LONG: - *((long*) variable)= (long) value; + *((long*) variable)= (long) getopt_ll_limit_value((long) value, option, NULL); break; case GET_ULONG: - *((ulong*) variable)= (ulong) value; + *((ulong*) variable)= (ulong) getopt_ull_limit_value((ulong) value, option, NULL); break; case GET_LL: - *((longlong*) variable)= (longlong) value; + *((longlong*) variable)= (longlong) getopt_ll_limit_value((longlong) value, option, NULL); break; case GET_ULL: /* Fall through */ case GET_SET: - *((ulonglong*) variable)= (ulonglong) value; + *((ulonglong*) variable)= (ulonglong) getopt_ull_limit_value((ulonglong) value, option, NULL); break; case GET_DOUBLE: *((double*) variable)= (double) value; @@ -1227,7 +1229,7 @@ void my_print_variables(const struct my_option *options) printf("%d\n", *((int*) value)); break; case GET_UINT: - printf("%d\n", *((uint*) value)); + printf("%u\n", *((uint*) value)); break; case GET_LONG: printf("%ld\n", *((long*) value)); diff --git a/mysys/my_init.c b/mysys/my_init.c index 0c607af5d58..0560d64d9d8 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -30,7 +30,6 @@ #endif my_bool have_tcpip=0; static void my_win_init(void); -static my_bool win32_have_tcpip(void); static my_bool win32_init_tcp_ip(); #else #define my_win_init() @@ -82,17 +81,15 @@ my_bool my_init(void) if (my_progname) my_progname_short= my_progname + dirname_length(my_progname); -#if defined(THREAD) && defined(SAFE_MUTEX) - safe_mutex_global_init(); /* Must be called early */ -#endif -#if defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) - fastmutex_global_init(); /* Must be called early */ -#endif + /* first initialize systems and global libraries */ netware_init(); #ifdef THREAD #if defined(HAVE_PTHREAD_INIT) pthread_init(); /* Must be called before DBUG_ENTER */ #endif + /* Initalize our mutex handling */ + my_mutex_init(); + /* Initialize mysys global variables and global mutex */ if (my_thread_global_init()) return 1; #if !defined( __WIN__) && !defined(__NETWARE__) @@ -226,6 +223,7 @@ Voluntary context switches %ld, Involuntary context switches %ld\n", #ifdef THREAD my_thread_end(); my_thread_global_end(); + my_mutex_end(); #if defined(SAFE_MUTEX) /* Check on destroying of mutexes. A few may be left that will get cleaned @@ -253,29 +251,6 @@ void my_debug_put_break_here(void) #ifdef __WIN__ -/* - This code is specially for running MySQL, but it should work in - other cases too. - - Inizializzazione delle variabili d'ambiente per Win a 32 bit. - - Vengono inserite nelle variabili d'ambiente (utilizzando cosi' - le funzioni getenv e putenv) i valori presenti nelle chiavi - del file di registro: - - HKEY_LOCAL_MACHINE\software\MySQL - - Se la kiave non esiste nonn inserisce nessun valore -*/ - -/* Crea la stringa d'ambiente */ - -void setEnvString(char *ret, const char *name, const char *value) -{ - DBUG_ENTER("setEnvString"); - strxmov(ret, name,"=",value,NullS); - DBUG_VOID_RETURN ; -} /* my_parameter_handler @@ -325,17 +300,6 @@ int handle_rtc_failure(int err_type, const char *file, int line, static void my_win_init(void) { - HKEY hSoftMysql ; - DWORD dimName = 256 ; - DWORD dimData = 1024 ; - DWORD dimNameValueBuffer = 256 ; - DWORD dimDataValueBuffer = 1024 ; - DWORD indexValue = 0 ; - long retCodeEnumValue ; - char NameValueBuffer[256] ; - char DataValueBuffer[1024] ; - char EnvString[1271] ; - const char *targetKey = "Software\\MySQL" ; DBUG_ENTER("my_win_init"); #if defined(_MSC_VER) @@ -361,6 +325,30 @@ static void my_win_init(void) _tzset(); + + + + + + + + + + + + + + + + + + + + + + + + /* The following is used by time functions */ #define OFFSET_TO_EPOC ((__int64) 134774 * 24 * 60 * 60 * 1000 * 1000 * 10) #define MS 10000000 @@ -385,43 +373,57 @@ static void my_win_init(void) } } - /* apre la chiave HKEY_LOCAL_MACHINES\software\MySQL */ - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,(LPCTSTR)targetKey,0, - KEY_READ,&hSoftMysql) != ERROR_SUCCESS) - DBUG_VOID_RETURN; - - /* - ** Ne legge i valori e li inserisce nell'ambiente - ** suppone che tutti i valori letti siano di tipo stringa + '\0' - ** Legge il valore con indice 0 e lo scarta - */ - retCodeEnumValue = RegEnumValue(hSoftMysql, indexValue++, - (LPTSTR)NameValueBuffer, &dimNameValueBuffer, - NULL, NULL, (LPBYTE)DataValueBuffer, - &dimDataValueBuffer) ; - - while (retCodeEnumValue != ERROR_NO_MORE_ITEMS) { - char *my_env; - /* Crea la stringa d'ambiente */ - setEnvString(EnvString, NameValueBuffer, DataValueBuffer) ; - - /* Inserisce i dati come variabili d'ambiente */ - my_env=strdup(EnvString); /* variable for putenv must be allocated ! */ - putenv(my_env) ; - - dimNameValueBuffer = dimName ; - dimDataValueBuffer = dimData ; + /* + Open HKEY_LOCAL_MACHINE\SOFTWARE\MySQL and set any strings found + there as environment variables + */ + HKEY key_handle; + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, (LPCTSTR)"SOFTWARE\\MySQL", + 0, KEY_READ, &key_handle) == ERROR_SUCCESS) + { + LONG ret; + DWORD index= 0; + DWORD type; + char key_name[256], key_data[1024]; + DWORD key_name_len= sizeof(key_name) - 1; + DWORD key_data_len= sizeof(key_data) - 1; + + while ((ret= RegEnumValue(key_handle, index++, + key_name, &key_name_len, + NULL, &type, (LPBYTE)&key_data, + &key_data_len)) != ERROR_NO_MORE_ITEMS) + { + char env_string[sizeof(key_name) + sizeof(key_data) + 2]; + + if (ret == ERROR_MORE_DATA) + { + /* Registry value larger than 'key_data', skip it */ + DBUG_PRINT("error", ("Skipped registry value that was too large")); + } + else if (ret == ERROR_SUCCESS) + { + if (type == REG_SZ) + { + strxmov(env_string, key_name, "=", key_data, NullS); + + /* variable for putenv must be allocated ! */ + putenv(strdup(env_string)) ; + } + } + else + { + /* Unhandled error, break out of loop */ + break; + } + + key_name_len= sizeof(key_name) - 1; + key_data_len= sizeof(key_data) - 1; + } - retCodeEnumValue = RegEnumValue(hSoftMysql, indexValue++, - NameValueBuffer, &dimNameValueBuffer, - NULL, NULL, (LPBYTE)DataValueBuffer, - &dimDataValueBuffer) ; + RegCloseKey(key_handle) ; + } } - - /* chiude la chiave */ - RegCloseKey(hSoftMysql) ; - DBUG_VOID_RETURN ; } diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 3f4c4a4d638..252ad9f203e 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -40,12 +40,6 @@ pthread_mutex_t LOCK_localtime_r; #ifndef HAVE_GETHOSTBYNAME_R pthread_mutex_t LOCK_gethostbyname_r; #endif -#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP -pthread_mutexattr_t my_fast_mutexattr; -#endif -#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP -pthread_mutexattr_t my_errorcheck_mutexattr; -#endif #ifdef TARGET_OS_LINUX @@ -124,29 +118,6 @@ my_bool my_thread_global_init(void) if (my_thread_init()) return 1; -#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP - /* - Set mutex type to "fast" a.k.a "adaptive" - - In this case the thread may steal the mutex from some other thread - that is waiting for the same mutex. This will save us some - context switches but may cause a thread to 'starve forever' while - waiting for the mutex (not likely if the code within the mutex is - short). - */ - pthread_mutexattr_init(&my_fast_mutexattr); - pthread_mutexattr_settype(&my_fast_mutexattr, - PTHREAD_MUTEX_ADAPTIVE_NP); -#endif -#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP - /* - Set mutex type to "errorcheck" - */ - pthread_mutexattr_init(&my_errorcheck_mutexattr); - pthread_mutexattr_settype(&my_errorcheck_mutexattr, - PTHREAD_MUTEX_ERRORCHECK); -#endif - /* Mutex uses by mysys */ pthread_mutex_init(&THR_LOCK_open,MY_MUTEX_INIT_FAST); pthread_mutex_init(&THR_LOCK_lock,MY_MUTEX_INIT_FAST); @@ -226,12 +197,6 @@ void my_thread_global_end(void) } pthread_key_delete(THR_KEY_mysys); -#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP - pthread_mutexattr_destroy(&my_fast_mutexattr); -#endif -#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP - pthread_mutexattr_destroy(&my_errorcheck_mutexattr); -#endif if (all_threads_killed) { pthread_mutex_destroy(&THR_LOCK_threads); diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c index 4f19f5d79c4..cc6bdab2522 100644 --- a/mysys/thr_mutex.c +++ b/mysys/thr_mutex.c @@ -19,7 +19,11 @@ #if defined(TARGET_OS_LINUX) && !defined (__USE_UNIX98) #define __USE_UNIX98 /* To get rw locks under Linux */ #endif -#if defined(THREAD) && defined(SAFE_MUTEX) +#ifdef SAFE_MUTEX +#define SAFE_MUTEX_DEFINED +#endif + +#if defined(THREAD) #undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */ #include "mysys_priv.h" #include "my_static.h" @@ -41,6 +45,13 @@ #endif #endif /* DO_NOT_REMOVE_THREAD_WRAPPERS */ +#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP +pthread_mutexattr_t my_fast_mutexattr; +#endif +#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP +pthread_mutexattr_t my_errorcheck_mutexattr; +#endif +#ifdef SAFE_MUTEX_DEFINED static pthread_mutex_t THR_LOCK_mutex; static ulong safe_mutex_count= 0; /* Number of mutexes created */ static ulong safe_mutex_id= 0; @@ -60,7 +71,58 @@ static my_bool remove_from_used_mutex(safe_mutex_deadlock_t *locked_mutex, safe_mutex_t *mutex); static void print_deadlock_warning(safe_mutex_t *new_mutex, safe_mutex_t *conflicting_mutex); +#endif + + +/* Initialize all mutex handling */ + +void my_mutex_init() +{ + /* Initialize mutex attributes */ +#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP + /* + Set mutex type to "fast" a.k.a "adaptive" + + In this case the thread may steal the mutex from some other thread + that is waiting for the same mutex. This will save us some + context switches but may cause a thread to 'starve forever' while + waiting for the mutex (not likely if the code within the mutex is + short). + */ + pthread_mutexattr_init(&my_fast_mutexattr); + pthread_mutexattr_settype(&my_fast_mutexattr, + PTHREAD_MUTEX_ADAPTIVE_NP); +#endif +#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP + /* + Set mutex type to "errorcheck" + */ + pthread_mutexattr_init(&my_errorcheck_mutexattr); + pthread_mutexattr_settype(&my_errorcheck_mutexattr, + PTHREAD_MUTEX_ERRORCHECK); +#endif + +#if defined(SAFE_MUTEX_DEFINED) + safe_mutex_global_init(); +#elif defined(MY_PTHREAD_FASTMUTEX) + fastmutex_global_init(); +#endif +} + +void my_mutex_end() +{ +#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP + pthread_mutexattr_destroy(&my_fast_mutexattr); +#endif +#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP + pthread_mutexattr_destroy(&my_errorcheck_mutexattr); +#endif +} + + +/* Initialize safe_mutex handling */ +#ifdef SAFE_MUTEX_DEFINED void safe_mutex_global_init(void) { pthread_mutex_init(&THR_LOCK_mutex,MY_MUTEX_INIT_FAST); @@ -865,4 +927,5 @@ void fastmutex_global_init(void) #endif } -#endif /* defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) */ +#endif /* SAFE_MUTEX_DEFINED */ +#endif /* THREAD */ diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 5a2409eeb6f..20b7973cb4e 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -21,6 +21,7 @@ basedir="" builddir="" ldata="@localstatedir@" +langdir="" srcdir="" args="" @@ -106,7 +107,7 @@ parse_arguments() # Note that the user will be passed to mysqld so that it runs # as 'user' (crucial e.g. if log-bin=/some_other_path/ # where a chown of datadir won't help) - user=`parse_arg "$arg"` ;; + user=`parse_arg "$arg"` ;; --skip-name-resolve) ip_only=1 ;; --verbose) verbose=1 ;; # Obsolete --rpm) in_rpm=1 ;; @@ -171,7 +172,20 @@ find_in_basedir() cannot_find_file() { echo - echo "FATAL ERROR: Could not find $*" + echo "FATAL ERROR: Could not find $1" + + shift + if test $# -ne 0 + then + echo + echo "The following directories were searched:" + echo + for dir in "$@" + do + echo " $dir" + done + fi + echo echo "If you compiled from source, you need to run 'make install' to" echo "copy the software into the correct location ready for operation." @@ -210,6 +224,11 @@ then elif test -n "$basedir" then print_defaults=`find_in_basedir my_print_defaults bin extra` + if test -z "$print_defaults" + then + cannot_find_file my_print_defaults $basedir/bin $basedir/extra + exit 1 + fi else print_defaults="@bindir@/my_print_defaults" fi @@ -232,7 +251,7 @@ then bindir="$basedir/client" extra_bindir="$basedir/extra" mysqld="$basedir/sql/mysqld" - mysqld_opt="--language=$srcdir/sql/share/english" + langdir="$srcdir/sql/share/english" pkgdatadir="$srcdir/scripts" scriptdir="$srcdir/scripts" elif test -n "$basedir" @@ -240,7 +259,23 @@ then bindir="$basedir/bin" extra_bindir="$bindir" mysqld=`find_in_basedir mysqld libexec sbin bin` + if test -z "$mysqld" + then + cannot_find_file mysqld $basedir/libexec $basedir/sbin $basedir/bin + exit 1 + fi + langdir=`find_in_basedir --dir errmsg.sys share/english share/mysql/english` + if test -z "$langdir" + then + cannot_find_file errmsg.sys $basedir/share/english $basedir/share/mysql/english + exit 1 + fi pkgdatadir=`find_in_basedir --dir fill_help_tables.sql share share/mysql` + if test -z "$pkgdatadir" + then + cannot_find_file fill_help_tables.sql $basedir/share $basedir/share/mysql + exit 1 + fi scriptdir="$basedir/scripts" else basedir="@prefix@" @@ -271,6 +306,16 @@ then exit 1 fi +if test -n "$langdir" +then + if test ! -f "$langdir/errmsg.sys" + then + cannot_find_file "$langdir/errmsg.sys" + exit 1 + fi + mysqld_opt="--language=$langdir" +fi + # Try to determine the hostname hostname=`@HOSTNAME@` diff --git a/sql-common/my_time.c b/sql-common/my_time.c index 23532027883..155e0237e3c 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -762,19 +762,20 @@ long calc_daynr(uint year,uint month,uint day) { long delsum; int temp; + int y= year; /* may be < 0 temporarily */ DBUG_ENTER("calc_daynr"); - if (year == 0 && month == 0 && day == 0) + if (y == 0 && month == 0 && day == 0) DBUG_RETURN(0); /* Skip errors */ - delsum= (long) (365L * year+ 31*(month-1) +day); + delsum= (long) (365L * y+ 31*(month-1) +day); if (month <= 2) - year--; + y--; else delsum-= (long) (month*4+23)/10; - temp=(int) ((year/100+1)*3)/4; + temp=(int) ((y/100+1)*3)/4; DBUG_PRINT("exit",("year: %d month: %d day: %d -> daynr: %ld", - year+(month <= 2),month,day,delsum+year/4-temp)); - DBUG_RETURN(delsum+(int) year/4-temp); + y+(month <= 2),month,day,delsum+y/4-temp)); + DBUG_RETURN(delsum+(int) y/4-temp); } /* calc_daynr */ diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc index 868e59a8777..8faab5023da 100644 --- a/sql/event_db_repository.cc +++ b/sql/event_db_repository.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2006 MySQL AB +/* Copyright 2004-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/event_parse_data.cc b/sql/event_parse_data.cc index df419e92d0d..63ecc3006dd 100644 --- a/sql/event_parse_data.cc +++ b/sql/event_parse_data.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/event_parse_data.h b/sql/event_parse_data.h index 87a800c2078..8b42eb23937 100644 --- a/sql/event_parse_data.h +++ b/sql/event_parse_data.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/field.cc b/sql/field.cc index 75f2fc7ac47..a278c125df2 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -3836,7 +3836,7 @@ int Field_longlong::store(double nr) error= 1; } else - res=(longlong) (ulonglong) nr; + res=(longlong) double2ulonglong(nr); } else { diff --git a/sql/field.h b/sql/field.h index 364d8fd22db..ac8e7dae3c5 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/filesort.cc b/sql/filesort.cc index 0ddb9ae5b10..dc59f1c8fcd 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -562,10 +562,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select, if (quick_select) { if ((error= select->quick->get_next())) - { - error= HA_ERR_END_OF_FILE; break; - } file->position(sort_form->record[0]); DBUG_EXECUTE_IF("debug_filesort", dbug_print_record(sort_form, TRUE);); } diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index 7b2395673eb..214ee4c99d2 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -451,7 +451,7 @@ int main(int argc,char **argv) printf("/*\n\n Do " "not " "edit " "this " "file " "directly!\n\n*/\n"); printf("\ -/* Copyright (C) 2001-2004 MySQL AB\n\ +/* Copyright 2001-2008 MySQL AB, 2008 Sun Microsystems, Inc.\n\ \n\ This program is free software; you can redistribute it and/or modify\n\ it under the terms of the GNU General Public License as published by\n\ diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 6fb16912f3a..9be4bfba9ab 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -5211,6 +5211,7 @@ int ha_ndbcluster::create(const char *name, strcmp(m_tabname, NDB_SCHEMA_TABLE) == 0)) { DBUG_PRINT("info", ("Schema distribution table not setup")); + DBUG_ASSERT(ndb_schema_share); DBUG_RETURN(HA_ERR_NO_CONNECTION); } single_user_mode = NdbDictionary::Table::SingleUserModeReadWrite; @@ -6038,6 +6039,7 @@ ha_ndbcluster::delete_table(ha_ndbcluster *h, Ndb *ndb, if (!ndb_schema_share) { DBUG_PRINT("info", ("Schema distribution table not setup")); + DBUG_ASSERT(ndb_schema_share); DBUG_RETURN(HA_ERR_NO_CONNECTION); } /* ndb_share reference temporary */ @@ -6219,6 +6221,7 @@ int ha_ndbcluster::delete_table(const char *name) if (!ndb_schema_share) { DBUG_PRINT("info", ("Schema distribution table not setup")); + DBUG_ASSERT(ndb_schema_share); DBUG_RETURN(HA_ERR_NO_CONNECTION); } #endif @@ -6506,8 +6509,11 @@ int ha_ndbcluster::open(const char *name, int mode, uint test_if_locked) DBUG_RETURN(res); } #ifdef HAVE_NDB_BINLOG - if (!ndb_binlog_tables_inited && ndb_binlog_running) + if (!ndb_binlog_tables_inited) + { table->db_stat|= HA_READ_ONLY; + sql_print_information("table '%s' opened read only", name); + } #endif DBUG_RETURN(0); } @@ -6871,8 +6877,8 @@ static void ndbcluster_drop_database(handlerton *hton, char *path) if (!ndb_schema_share) { DBUG_PRINT("info", ("Schema distribution table not setup")); + DBUG_ASSERT(ndb_schema_share); DBUG_VOID_RETURN; - //DBUG_RETURN(HA_ERR_NO_CONNECTION); } #endif ndbcluster_drop_database_impl(path); diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index 1788fed26b1..4f25068feb8 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -815,9 +815,10 @@ static int ndbcluster_create_ndb_apply_status_table(THD *thd) " end_pos BIGINT UNSIGNED NOT NULL, " " PRIMARY KEY USING HASH (server_id) ) ENGINE=NDB CHARACTER SET latin1"); - const int no_print_error[5]= {ER_TABLE_EXISTS_ERROR, + const int no_print_error[6]= {ER_TABLE_EXISTS_ERROR, 701, 702, + 721, // Table already exist 4009, 0}; // do not print error 701 etc run_query(thd, buf, end, no_print_error, TRUE); @@ -876,9 +877,10 @@ static int ndbcluster_create_schema_table(THD *thd) " type INT UNSIGNED NOT NULL," " PRIMARY KEY USING HASH (db,name) ) ENGINE=NDB CHARACTER SET latin1"); - const int no_print_error[5]= {ER_TABLE_EXISTS_ERROR, + const int no_print_error[6]= {ER_TABLE_EXISTS_ERROR, 701, 702, + 721, // Table already exist 4009, 0}; // do not print error 701 etc run_query(thd, buf, end, no_print_error, TRUE); @@ -919,12 +921,9 @@ int ndbcluster_setup_binlog_table_shares(THD *thd) { pthread_mutex_lock(&LOCK_open); ndb_binlog_tables_inited= TRUE; - if (ndb_binlog_running) - { - if (ndb_extra_logging) - sql_print_information("NDB Binlog: ndb tables writable"); - close_cached_tables(NULL, NULL, TRUE, FALSE, FALSE); - } + if (ndb_extra_logging) + sql_print_information("NDB Binlog: ndb tables writable"); + close_cached_tables(NULL, NULL, TRUE, FALSE, FALSE); pthread_mutex_unlock(&LOCK_open); /* Signal injector thread that all is setup */ pthread_cond_signal(&injector_cond); @@ -2071,6 +2070,7 @@ ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *ndb, ndb_schema_share->use_count)); free_share(&ndb_schema_share); ndb_schema_share= 0; + ndb_binlog_tables_inited= 0; pthread_mutex_unlock(&ndb_schema_share_mutex); /* end protect ndb_schema_share */ @@ -3271,6 +3271,7 @@ ndb_binlog_thread_handle_non_data_event(THD *thd, Ndb *ndb, share->key, share->use_count)); free_share(&ndb_apply_status_share); ndb_apply_status_share= 0; + ndb_binlog_tables_inited= 0; } DBUG_PRINT("error", ("CLUSTER FAILURE EVENT: " "%s received share: 0x%lx op: 0x%lx share op: 0x%lx " @@ -3290,6 +3291,7 @@ ndb_binlog_thread_handle_non_data_event(THD *thd, Ndb *ndb, share->key, share->use_count)); free_share(&ndb_apply_status_share); ndb_apply_status_share= 0; + ndb_binlog_tables_inited= 0; } /* ToDo: remove printout */ if (ndb_extra_logging) @@ -4313,6 +4315,7 @@ err: ndb_schema_share->use_count)); free_share(&ndb_schema_share); ndb_schema_share= 0; + ndb_binlog_tables_inited= 0; pthread_mutex_unlock(&ndb_schema_share_mutex); /* end protect ndb_schema_share */ } diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index fb24d1d57db..40c363f0182 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 MySQL AB +/* Copyright 2005-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -2818,6 +2818,36 @@ void ha_partition::unlock_row() DBUG_VOID_RETURN; } +/** + Check if semi consistent read was used + + SYNOPSIS + was_semi_consistent_read() + + RETURN VALUE + TRUE Previous read was a semi consistent read + FALSE Previous read was not a semi consistent read + + DESCRIPTION + See handler.h: + In an UPDATE or DELETE, if the row under the cursor was locked by another + transaction, and the engine used an optimistic read of the last + committed row value under the cursor, then the engine returns 1 from this + function. MySQL must NOT try to update this optimistic value. If the + optimistic value does not match the WHERE condition, MySQL can decide to + skip over this row. Currently only works for InnoDB. This can be used to + avoid unnecessary lock waits. + + If this method returns nonzero, it will also signal the storage + engine that the next read will be a locking re-read of the row. +*/ +bool ha_partition::was_semi_consistent_read() +{ + DBUG_ENTER("ha_partition::was_semi_consistent_read"); + DBUG_ASSERT(m_last_part < m_tot_parts && + bitmap_is_set(&(m_part_info->used_partitions), m_last_part)); + DBUG_RETURN(m_file[m_last_part]->was_semi_consistent_read()); +} /** Use semi consistent read if possible @@ -3432,7 +3462,7 @@ int ha_partition::rnd_next(uchar *buf) while (TRUE) { - int result= file->rnd_next(buf); + result= file->rnd_next(buf); if (!result) { m_last_part= part_id; @@ -4786,7 +4816,7 @@ int ha_partition::info(uint flag) /* Calculates statistical variables records: Estimate of number records in table - We report sum (always at least 2) + We report sum (always at least 2 if not empty) deleted: Estimate of number holes in the table due to deletes We report sum @@ -4825,13 +4855,13 @@ int ha_partition::info(uint flag) stats.check_time= file->stats.check_time; } } while (*(++file_array)); - if (stats.records < 2 && + if (stats.records && stats.records < 2 && !(m_file[0]->ha_table_flags() & HA_STATS_RECORDS_IS_EXACT)) stats.records= 2; if (stats.records > 0) stats.mean_rec_length= (ulong) (stats.data_file_length / stats.records); else - stats.mean_rec_length= 1; //? What should we set here + stats.mean_rec_length= 0; } if (flag & HA_STATUS_CONST) { diff --git a/sql/ha_partition.h b/sql/ha_partition.h index b22e7bd1801..3a7084c87ed 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 MySQL AB +/* Copyright 2005-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -112,7 +112,7 @@ private: uint m_reorged_parts; // Number of reorganised parts uint m_tot_parts; // Total number of partitions; uint m_no_locks; // For engines like ha_blackhole, which needs no locks - uint m_last_part; // Last file that we update,write + uint m_last_part; // Last file that we update,write,read int m_lock_type; // Remembers type of last // external_lock part_id_range m_part_spec; // Which parts to scan @@ -326,6 +326,10 @@ public: */ virtual void unlock_row(); /* + Check if semi consistent read + */ + virtual bool was_semi_consistent_read(); + /* Call to hint about semi consistent read */ virtual void try_semi_consistent_read(bool); diff --git a/sql/handler.cc b/sql/handler.cc index 044e47b3f6d..4291bc02dcc 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/handler.h b/sql/handler.h index 68bb894a5d2..02fef2760f1 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/item.cc b/sql/item.cc index 2882c3cc28a..be62ebb4688 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -5110,6 +5110,9 @@ int Item_hex_string::save_in_field(Field *field, bool no_conversions) ulonglong nr; uint32 length= str_value.length(); + if (!length) + return 1; + if (length > 8) { nr= field->flags & UNSIGNED_FLAG ? ULONGLONG_MAX : LONGLONG_MAX; diff --git a/sql/item.h b/sql/item.h index c46a3322d94..8327f938a8f 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index adcc2e352db..0d4ae3539c5 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -394,19 +394,16 @@ static bool convert_constant_item(THD *thd, Item_field *field_item, TABLE *table= field->table; ulong orig_sql_mode= thd->variables.sql_mode; enum_check_fields orig_count_cuted_fields= thd->count_cuted_fields; - my_bitmap_map *old_write_map; - my_bitmap_map *old_read_map; + my_bitmap_map *old_maps[2]; ulonglong orig_field_val; /* original field value if valid */ - LINT_INIT(old_write_map); - LINT_INIT(old_read_map); + LINT_INIT(old_maps[0]); + LINT_INIT(old_maps[1]); LINT_INIT(orig_field_val); if (table) - { - old_write_map= dbug_tmp_use_all_columns(table, table->write_set); - old_read_map= dbug_tmp_use_all_columns(table, table->read_set); - } + dbug_tmp_use_all_columns(table, old_maps, + table->read_set, table->write_set); /* For comparison purposes allow invalid dates like 2000-01-32 */ thd->variables.sql_mode= (orig_sql_mode & ~MODE_NO_ZERO_DATE) | MODE_INVALID_DATES; @@ -441,10 +438,7 @@ static bool convert_constant_item(THD *thd, Item_field *field_item, thd->variables.sql_mode= orig_sql_mode; thd->count_cuted_fields= orig_count_cuted_fields; if (table) - { - dbug_tmp_restore_column_map(table->write_set, old_write_map); - dbug_tmp_restore_column_map(table->read_set, old_read_map); - } + dbug_tmp_restore_column_maps(table->read_set, table->write_set, old_maps); } return result; } @@ -2718,6 +2712,16 @@ void Item_func_case::fix_length_and_dec() nagg++; if (!(found_types= collect_cmp_types(agg, nagg))) return; + if (with_sum_func || current_thd->lex->current_select->group_list.elements) + { + /* + See TODO commentary in the setup_copy_fields function: + item in a group may be wrapped with an Item_copy_string item. + That item has a STRING_RESULT result type, so we need + to take this type into account. + */ + found_types |= (1 << item_cmp_type(left_result_type, STRING_RESULT)); + } for (i= 0; i <= (uint)DECIMAL_RESULT; i++) { diff --git a/sql/item_func.cc b/sql/item_func.cc index 1f3af312321..ee00d45ecb8 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/item_func.h b/sql/item_func.h index 070f24d343c..322128598e6 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -362,7 +362,10 @@ public: Item_func_unsigned(Item *a) :Item_func_signed(a) {} const char *func_name() const { return "cast_as_unsigned"; } void fix_length_and_dec() - { max_length=args[0]->max_length; unsigned_flag=1; } + { + max_length= min(args[0]->max_length, DECIMAL_MAX_PRECISION + 2); + unsigned_flag=1; + } longlong val_int(); virtual void print(String *str, enum_query_type query_type); }; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 5f70bff595a..cf2453e13ec 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1782,6 +1782,12 @@ Item *Item_func_sysconst::safe_charset_converter(CHARSET_INFO *tocs) Item_string *conv; uint conv_errors; String tmp, cstr, *ostr= val_str(&tmp); + if (null_value) + { + Item *null_item= new Item_null((char *) fully_qualified_func_name()); + null_item->collation.set (tocs); + return null_item; + } cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), tocs, &conv_errors); if (conv_errors || !(conv= new Item_static_string_func(fully_qualified_func_name(), @@ -2033,10 +2039,11 @@ Item_func_format::Item_func_format(Item *org, Item *dec) void Item_func_format::fix_length_and_dec() { - collation.set(default_charset()); uint char_length= args[0]->max_length/args[0]->collation.collation->mbmaxlen; - max_length= ((char_length + (char_length-args[0]->decimals)/3) * - collation.collation->mbmaxlen); + uint max_sep_count= char_length/3 + (decimals ? 1 : 0) + /*sign*/1; + collation.set(default_charset()); + max_length= (char_length + max_sep_count + decimals) * + collation.collation->mbmaxlen; } diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 1b399ede327..bae01542d5c 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -654,8 +654,7 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref) return TRUE; // 'item' can be changed during fix_fields - if ((!item->fixed && - item->fix_fields(thd, args)) || + if ((!item->fixed && item->fix_fields(thd, args)) || (item= args[0])->check_cols(1)) return TRUE; decimals=item->decimals; diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index a584f983516..deffb0d56ca 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1034,12 +1034,25 @@ longlong Item_func_month::val_int() } +void Item_func_monthname::fix_length_and_dec() +{ + THD* thd= current_thd; + CHARSET_INFO *cs= thd->variables.collation_connection; + uint32 repertoire= my_charset_repertoire(cs); + locale= thd->variables.lc_time_names; + collation.set(cs, DERIVATION_COERCIBLE, repertoire); + decimals=0; + max_length= locale->max_month_name_length * collation.collation->mbmaxlen; + maybe_null=1; +} + + String* Item_func_monthname::val_str(String* str) { DBUG_ASSERT(fixed == 1); const char *month_name; - uint month= (uint) val_int(); - THD *thd= current_thd; + uint month= (uint) val_int(); + uint err; if (null_value || !month) { @@ -1047,8 +1060,9 @@ String* Item_func_monthname::val_str(String* str) return (String*) 0; } null_value=0; - month_name= thd->variables.lc_time_names->month_names->type_names[month-1]; - str->set(month_name, strlen(month_name), system_charset_info); + month_name= locale->month_names->type_names[month-1]; + str->copy(month_name, strlen(month_name), &my_charset_utf8_bin, + collation.collation, &err); return str; } @@ -1173,19 +1187,32 @@ longlong Item_func_weekday::val_int() odbc_type) + test(odbc_type); } +void Item_func_dayname::fix_length_and_dec() +{ + THD* thd= current_thd; + CHARSET_INFO *cs= thd->variables.collation_connection; + uint32 repertoire= my_charset_repertoire(cs); + locale= thd->variables.lc_time_names; + collation.set(cs, DERIVATION_COERCIBLE, repertoire); + decimals=0; + max_length= locale->max_day_name_length * collation.collation->mbmaxlen; + maybe_null=1; +} + String* Item_func_dayname::val_str(String* str) { DBUG_ASSERT(fixed == 1); uint weekday=(uint) val_int(); // Always Item_func_daynr() const char *day_name; - THD *thd= current_thd; + uint err; if (null_value) return (String*) 0; - day_name= thd->variables.lc_time_names->day_names->type_names[weekday]; - str->set(day_name, strlen(day_name), system_charset_info); + day_name= locale->day_names->type_names[weekday]; + str->copy(day_name, strlen(day_name), &my_charset_utf8_bin, + collation.collation, &err); return str; } diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 99240b1c759..94b02d1eaf6 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -116,18 +116,13 @@ public: class Item_func_monthname :public Item_func_month { + MY_LOCALE *locale; public: Item_func_monthname(Item *a) :Item_func_month(a) {} const char *func_name() const { return "monthname"; } String *val_str(String *str); enum Item_result result_type () const { return STRING_RESULT; } - void fix_length_and_dec() - { - collation.set(&my_charset_bin); - decimals=0; - max_length=10*my_charset_bin.mbmaxlen; - maybe_null=1; - } + void fix_length_and_dec(); bool check_partition_func_processor(uchar *int_arg) {return TRUE;} }; @@ -291,18 +286,13 @@ public: class Item_func_dayname :public Item_func_weekday { + MY_LOCALE *locale; public: Item_func_dayname(Item *a) :Item_func_weekday(a,0) {} const char *func_name() const { return "dayname"; } String *val_str(String *str); enum Item_result result_type () const { return STRING_RESULT; } - void fix_length_and_dec() - { - collation.set(&my_charset_bin); - decimals=0; - max_length=9*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; - } + void fix_length_and_dec(); bool check_partition_func_processor(uchar *int_arg) {return TRUE;} }; diff --git a/sql/lock.cc b/sql/lock.cc index 21255fb24b0..8f58dd6ee86 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/log.cc b/sql/log.cc index aa027108490..91fe42b4412 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -207,6 +207,7 @@ public: truncate(0); before_stmt_pos= MY_OFF_T_UNDEF; trans_log.end_of_file= max_binlog_cache_size; + DBUG_ASSERT(empty()); } Rows_log_event *pending() const @@ -1377,8 +1378,6 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, FLAGSTR(thd->options, OPTION_NOT_AUTOCOMMIT), FLAGSTR(thd->options, OPTION_BEGIN))); - thd->binlog_flush_pending_rows_event(TRUE); - /* NULL denotes ROLLBACK with nothing to replicate: i.e., rollback of only transactional tables. If the transaction contain changes to @@ -1387,6 +1386,7 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, */ if (end_ev != NULL) { + thd->binlog_flush_pending_rows_event(TRUE); /* Doing a commit or a rollback including non-transactional tables, i.e., ending a transaction where we might write the transaction @@ -1435,6 +1435,7 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, mysql_bin_log.update_table_map_version(); } + DBUG_ASSERT(thd->binlog_get_pending_rows_event() == NULL); DBUG_RETURN(error); } @@ -1449,8 +1450,6 @@ static int binlog_prepare(handlerton *hton, THD *thd, bool all) return 0; } -#define YESNO(X) ((X) ? "yes" : "no") - /** This function is called once after each statement. @@ -1466,6 +1465,7 @@ static int binlog_prepare(handlerton *hton, THD *thd, bool all) */ static int binlog_commit(handlerton *hton, THD *thd, bool all) { + int error= 0; DBUG_ENTER("binlog_commit"); binlog_trx_data *const trx_data= (binlog_trx_data*) thd_get_ha_data(thd, binlog_hton); @@ -1478,60 +1478,11 @@ static int binlog_commit(handlerton *hton, THD *thd, bool all) } /* - Decision table for committing a transaction. The top part, the - *conditions* represent different cases that can occur, and hte - bottom part, the *actions*, represent what should be done in that - particular case. - - Real transaction 'all' was true - - Statement in cache There were at least one statement in the - transaction cache - - In transaction We are inside a transaction - - Stmt modified non-trans The statement being committed modified a - non-transactional table - - All modified non-trans Some statement before this one in the - transaction modified a non-transactional - table - - - ============================= = = = = = = = = = = = = = = = = - Real transaction N N N N N N N N N N N N N N N N - Statement in cache N N N N N N N N Y Y Y Y Y Y Y Y - In transaction N N N N Y Y Y Y N N N N Y Y Y Y - Stmt modified non-trans N N Y Y N N Y Y N N Y Y N N Y Y - All modified non-trans N Y N Y N Y N Y N Y N Y N Y N Y - - Action: (C)ommit/(A)ccumulate C C - C A C - C - - - - A A - A - ============================= = = = = = = = = = = = = = = = = + We commit the transaction if: + - We are not in a transaction and committing a statement, or - ============================= = = = = = = = = = = = = = = = = - Real transaction Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y - Statement in cache N N N N N N N N Y Y Y Y Y Y Y Y - In transaction N N N N Y Y Y Y N N N N Y Y Y Y - Stmt modified non-trans N N Y Y N N Y Y N N Y Y N N Y Y - All modified non-trans N Y N Y N Y N Y N Y N Y N Y N Y - - (C)ommit/(A)ccumulate/(-) - - - - C C - C - - - - C C - C - ============================= = = = = = = = = = = = = = = = = - - In other words, we commit the transaction if and only if both of - the following are true: - - We are not in a transaction and committing a statement - - - We are in a transaction and one (or more) of the following are - true: - - - A full transaction is committed - - OR - - - A non-transactional statement is committed and there is - no statement cached + - We are in a transaction and a full transaction is committed Otherwise, we accumulate the statement */ @@ -1544,25 +1495,18 @@ static int binlog_commit(handlerton *hton, THD *thd, bool all) YESNO(in_transaction), YESNO(thd->transaction.all.modified_non_trans_table), YESNO(thd->transaction.stmt.modified_non_trans_table))); - if (thd->options & OPTION_BIN_LOG) + if (!in_transaction || all) { - if ((in_transaction && - (all || - (!trx_data->at_least_one_stmt && - thd->transaction.stmt.modified_non_trans_table))) || - (!in_transaction && !all)) - { - Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, FALSE); - qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE) - int error= binlog_end_trans(thd, trx_data, &qev, all); - DBUG_RETURN(error); - } - } - else - { - trx_data->reset(); + Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, FALSE); + qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE) + error= binlog_end_trans(thd, trx_data, &qev, all); + goto end; } - DBUG_RETURN(0); + +end: + if (!all) + trx_data->before_stmt_pos = MY_OFF_T_UNDEF; // part of the stmt commit + DBUG_RETURN(error); } /** @@ -1622,6 +1566,8 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all) */ error= binlog_end_trans(thd, trx_data, 0, all); } + if (!all) + trx_data->before_stmt_pos = MY_OFF_T_UNDEF; // part of the stmt rollback DBUG_RETURN(error); } @@ -2356,6 +2302,7 @@ const char *MYSQL_LOG::generate_name(const char *log_name, MYSQL_BIN_LOG::MYSQL_BIN_LOG() :bytes_written(0), prepared_xids(0), file_id(1), open_count(1), need_start_event(TRUE), m_table_map_version(0), + is_relay_log(0), description_event_for_exec(0), description_event_for_queue(0) { /* @@ -2366,6 +2313,7 @@ MYSQL_BIN_LOG::MYSQL_BIN_LOG() */ index_file_name[0] = 0; bzero((char*) &index_file, sizeof(index_file)); + bzero((char*) &purge_temp, sizeof(purge_temp)); } /* this is called only once */ @@ -2558,7 +2506,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name, */ description_event_for_queue->created= 0; /* Don't set log_pos in event header */ - description_event_for_queue->artificial_event=1; + description_event_for_queue->set_artificial_event(); if (description_event_for_queue->write(&log_file)) goto err; @@ -2965,6 +2913,7 @@ err: int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included) { int error; + char *to_purge_if_included= NULL; DBUG_ENTER("purge_first_log"); DBUG_ASSERT(is_open()); @@ -2972,36 +2921,20 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included) DBUG_ASSERT(!strcmp(rli->linfo.log_file_name,rli->event_relay_log_name)); pthread_mutex_lock(&LOCK_index); - pthread_mutex_lock(&rli->log_space_lock); - rli->relay_log.purge_logs(rli->group_relay_log_name, included, - 0, 0, &rli->log_space_total); - // Tell the I/O thread to take the relay_log_space_limit into account - rli->ignore_log_space_limit= 0; - pthread_mutex_unlock(&rli->log_space_lock); + to_purge_if_included= my_strdup(rli->group_relay_log_name, MYF(0)); /* - Ok to broadcast after the critical region as there is no risk of - the mutex being destroyed by this thread later - this helps save - context switches - */ - pthread_cond_broadcast(&rli->log_space_cond); - - /* Read the next log file name from the index file and pass it back to - the caller - If included is true, we want the first relay log; - otherwise we want the one after event_relay_log_name. + the caller. */ - if ((included && (error=find_log_pos(&rli->linfo, NullS, 0))) || - (!included && - ((error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0)) || - (error=find_next_log(&rli->linfo, 0))))) + if((error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0)) || + (error=find_next_log(&rli->linfo, 0))) { char buff[22]; sql_print_error("next log error: %d offset: %s log: %s included: %d", error, llstr(rli->linfo.index_file_offset,buff), - rli->group_relay_log_name, + rli->event_relay_log_name, included); goto err; } @@ -3029,7 +2962,42 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included) /* Store where we are in the new file for the execution thread */ flush_relay_log_info(rli); + DBUG_EXECUTE_IF("crash_before_purge_logs", abort();); + + pthread_mutex_lock(&rli->log_space_lock); + rli->relay_log.purge_logs(to_purge_if_included, included, + 0, 0, &rli->log_space_total); + // Tell the I/O thread to take the relay_log_space_limit into account + rli->ignore_log_space_limit= 0; + pthread_mutex_unlock(&rli->log_space_lock); + + /* + Ok to broadcast after the critical region as there is no risk of + the mutex being destroyed by this thread later - this helps save + context switches + */ + pthread_cond_broadcast(&rli->log_space_cond); + + /* + * Need to update the log pos because purge logs has been called + * after fetching initially the log pos at the begining of the method. + */ + if((error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0))) + { + char buff[22]; + sql_print_error("next log error: %d offset: %s log: %s included: %d", + error, + llstr(rli->linfo.index_file_offset,buff), + rli->group_relay_log_name, + included); + goto err; + } + + /* If included was passed, rli->linfo should be the first entry. */ + DBUG_ASSERT(!included || rli->linfo.index_file_start_offset == 0); + err: + my_free(to_purge_if_included, MYF(0)); pthread_mutex_unlock(&LOCK_index); DBUG_RETURN(error); } @@ -3080,7 +3048,6 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log, ulonglong *decrease_log_space) { int error; - int ret = 0; bool exit_loop= 0; LOG_INFO log_info; THD *thd= current_thd; @@ -3089,8 +3056,36 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log, if (need_mutex) pthread_mutex_lock(&LOCK_index); - if ((error=find_log_pos(&log_info, to_log, 0 /*no mutex*/))) + if ((error=find_log_pos(&log_info, to_log, 0 /*no mutex*/))) + { + sql_print_error("MYSQL_LOG::purge_logs was called with file %s not " + "listed in the index.", to_log); goto err; + } + + /* + For crash recovery reasons the index needs to be updated before + any files are deleted. Move files to be deleted into a temp file + to be processed after the index is updated. + */ + if (!my_b_inited(&purge_temp)) + { + if ((error=open_cached_file(&purge_temp, mysql_tmpdir, TEMP_PREFIX, + DISK_BUFFER_SIZE, MYF(MY_WME)))) + { + sql_print_error("MYSQL_LOG::purge_logs failed to open purge_temp"); + goto err; + } + } + else + { + if ((error=reinit_io_cache(&purge_temp, WRITE_CACHE, 0, 0, 1))) + { + sql_print_error("MYSQL_LOG::purge_logs failed to reinit purge_temp " + "for write"); + goto err; + } + } /* File name exists in index file; delete until we find this file @@ -3101,6 +3096,61 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log, while ((strcmp(to_log,log_info.log_file_name) || (exit_loop=included)) && !log_in_use(log_info.log_file_name)) { + if ((error=my_b_write(&purge_temp, (const uchar*)log_info.log_file_name, + strlen(log_info.log_file_name))) || + (error=my_b_write(&purge_temp, (const uchar*)"\n", 1))) + { + sql_print_error("MYSQL_LOG::purge_logs failed to copy %s to purge_temp", + log_info.log_file_name); + goto err; + } + + if (find_next_log(&log_info, 0) || exit_loop) + break; + } + + /* We know how many files to delete. Update index file. */ + if ((error=update_log_index(&log_info, need_update_threads))) + { + sql_print_error("MSYQL_LOG::purge_logs failed to update the index file"); + goto err; + } + + DBUG_EXECUTE_IF("crash_after_update_index", abort();); + + /* Switch purge_temp for read. */ + if ((error=reinit_io_cache(&purge_temp, READ_CACHE, 0, 0, 0))) + { + sql_print_error("MSYQL_LOG::purge_logs failed to reinit purge_temp " + "for read"); + goto err; + } + + /* Read each entry from purge_temp and delete the file. */ + for (;;) + { + uint length; + + if ((length=my_b_gets(&purge_temp, log_info.log_file_name, + FN_REFLEN)) <= 1) + { + if (purge_temp.error) + { + error= purge_temp.error; + sql_print_error("MSYQL_LOG::purge_logs error %d reading from " + "purge_temp", error); + goto err; + } + + /* Reached EOF */ + break; + } + + /* Get rid of the trailing '\n' */ + log_info.log_file_name[length-1]= 0; + + ha_binlog_index_purge_file(current_thd, log_info.log_file_name); + MY_STAT s; if (!my_stat(log_info.log_file_name, &s, MYF(0))) { @@ -3201,23 +3251,10 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log, } } } - - ha_binlog_index_purge_file(current_thd, log_info.log_file_name); - - if (find_next_log(&log_info, 0) || exit_loop) - break; - } - - /* - If we get killed -9 here, the sysadmin would have to edit - the log index file after restart - otherwise, this should be safe - */ - error= update_log_index(&log_info, need_update_threads); - if (error == 0) { - error = ret; } err: + close_cached_file(&purge_temp); if (need_mutex) pthread_mutex_unlock(&LOCK_index); DBUG_RETURN(error); @@ -3228,7 +3265,7 @@ err: index file. @param thd Thread pointer - @param before_date Delete all log files before given date. + @param purge_time Delete all log files before given date. @note If any of the logs before the deleted one is in use, @@ -3245,6 +3282,7 @@ err: int MYSQL_BIN_LOG::purge_logs_before_date(time_t purge_time) { int error; + char to_log[FN_REFLEN]; LOG_INFO log_info; MY_STAT stat_area; THD *thd= current_thd; @@ -3252,12 +3290,8 @@ int MYSQL_BIN_LOG::purge_logs_before_date(time_t purge_time) DBUG_ENTER("purge_logs_before_date"); pthread_mutex_lock(&LOCK_index); + to_log[0]= 0; - /* - Delete until we find curren file - or a file that is used or a file - that is older than purge_time. - */ if ((error=find_log_pos(&log_info, NullS, 0 /*no mutex*/))) goto err; @@ -3307,55 +3341,18 @@ int MYSQL_BIN_LOG::purge_logs_before_date(time_t purge_time) } else { - if (stat_area.st_mtime >= purge_time) + if (stat_area.st_mtime < purge_time) + strmake(to_log, + log_info.log_file_name, + sizeof(log_info.log_file_name)); + else break; - if (my_delete(log_info.log_file_name, MYF(0))) - { - if (my_errno == ENOENT) - { - /* It's not fatal even if we can't delete a log file */ - if (thd) - { - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE), - log_info.log_file_name); - } - sql_print_information("Failed to delete file '%s'", - log_info.log_file_name); - my_errno= 0; - } - else - { - if (thd) - { - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, - ER_BINLOG_PURGE_FATAL_ERR, - "a problem with deleting %s; " - "consider examining correspondence " - "of your binlog index file " - "to the actual binlog files", - log_info.log_file_name); - } - else - { - sql_print_information("Failed to delete log file '%s'", - log_info.log_file_name); - } - error= LOG_INFO_FATAL; - goto err; - } - } - ha_binlog_index_purge_file(current_thd, log_info.log_file_name); } if (find_next_log(&log_info, 0)) break; } - /* - If we get killed -9 here, the sysadmin would have to edit - the log index file after restart - otherwise, this should be safe - */ - error= update_log_index(&log_info, 1); + error= (to_log[0] ? purge_logs(to_log, 1, 0, 1, (ulonglong *) 0) : 0); err: pthread_mutex_unlock(&LOCK_index); @@ -3481,7 +3478,7 @@ void MYSQL_BIN_LOG::new_file_impl(bool need_lock) to change base names at some point. */ Rotate_log_event r(new_name+dirname_length(new_name), - 0, LOG_EVENT_OFFSET, 0); + 0, LOG_EVENT_OFFSET, is_relay_log ? Rotate_log_event::RELAY_LOG : 0); r.write(&log_file); bytes_written += r.data_written; } diff --git a/sql/log.h b/sql/log.h index 891134a9762..d54df8add3b 100644 --- a/sql/log.h +++ b/sql/log.h @@ -233,6 +233,13 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG pthread_cond_t update_cond; ulonglong bytes_written; IO_CACHE index_file; + /* + purge_temp is a temp file used in purge_logs so that the index file + can be updated before deleting files from disk, yielding better crash + recovery. It is created on demand the first time purge_logs is called + and then reused for subsequent calls. It is cleaned up in cleanup(). + */ + IO_CACHE purge_temp; char index_file_name[FN_REFLEN]; /* The max size before rotation (usable only if log_type == LOG_BIN: binary @@ -274,6 +281,10 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG public: MYSQL_LOG::generate_name; MYSQL_LOG::is_open; + + /* This is relay log */ + bool is_relay_log; + /* These describe the log's format. This is used only for relay logs. _for_exec is used by the SQL thread, _for_queue by the I/O thread. It's diff --git a/sql/log_event.cc b/sql/log_event.cc index 87fe707ac09..28398709a9f 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2004 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -809,9 +809,8 @@ bool Log_event::write_header(IO_CACHE* file, ulong event_data_length) if (is_artificial_event()) { /* - We should not do any cleanup on slave when reading this. We - mark this by setting log_pos to 0. Start_log_event_v3() will - detect this on reading and set artificial_event=1 for the event. + Artificial events are automatically generated and do not exist + in master's binary log, so log_pos should be set to 0. */ log_pos= 0; } @@ -2679,7 +2678,7 @@ void Query_log_event::print_query_header(IO_CACHE* file, if (!(flags & LOG_EVENT_SUPPRESS_USE_F) && db) { - if (different_db= memcmp(print_event_info->db, db, db_len + 1)) + if ((different_db= memcmp(print_event_info->db, db, db_len + 1))) memcpy(print_event_info->db, db, db_len + 1); if (db[0] && different_db) my_b_printf(file, "use %s%s\n", db, print_event_info->delimiter); @@ -2723,11 +2722,13 @@ void Query_log_event::print_query_header(IO_CACHE* file, bool need_comma= 0; my_b_printf(file, "SET "); print_set_option(file, tmp, OPTION_NO_FOREIGN_KEY_CHECKS, ~flags2, - "@@session.foreign_key_checks", &need_comma); + "@@session.foreign_key_checks", &need_comma); print_set_option(file, tmp, OPTION_AUTO_IS_NULL, flags2, - "@@session.sql_auto_is_null", &need_comma); + "@@session.sql_auto_is_null", &need_comma); print_set_option(file, tmp, OPTION_RELAXED_UNIQUE_CHECKS, ~flags2, - "@@session.unique_checks", &need_comma); + "@@session.unique_checks", &need_comma); + print_set_option(file, tmp, OPTION_NOT_AUTOCOMMIT, ~flags2, + "@@session.autocommit", &need_comma); my_b_printf(file,"%s\n", print_event_info->delimiter); print_event_info->flags2= flags2; } @@ -3195,7 +3196,7 @@ Query_log_event::do_shall_skip(Relay_log_info *rli) #ifndef MYSQL_CLIENT Start_log_event_v3::Start_log_event_v3() :Log_event(), created(0), binlog_version(BINLOG_VERSION), - artificial_event(0), dont_set_created(0) + dont_set_created(0) { memcpy(server_version, ::server_version, ST_SERVER_VER_LEN); } @@ -3243,7 +3244,7 @@ void Start_log_event_v3::print(FILE* file, PRINT_EVENT_INFO* print_event_info) my_b_printf(&cache, "# Warning: this binlog was not closed properly. " "Most probably mysqld crashed writing it.\n"); } - if (!artificial_event && created) + if (!is_artificial_event() && created) { #ifdef WHEN_WE_HAVE_THE_RESET_CONNECTION_SQL_COMMAND /* @@ -3286,8 +3287,6 @@ Start_log_event_v3::Start_log_event_v3(const char* buf, // prevent overrun if log is corrupted on disk server_version[ST_SERVER_VER_LEN-1]= 0; created= uint4korr(buf+ST_CREATED_OFFSET); - /* We use log_pos to mark if this was an artificial event or not */ - artificial_event= (log_pos == 0); dont_set_created= 1; } @@ -3424,7 +3423,8 @@ Format_description_log_event(uint8 binlog_ver, const char* server_ver) number_of_event_types= LOG_EVENT_TYPES; /* we'll catch my_malloc() error in is_valid() */ post_header_len=(uint8*) my_malloc(number_of_event_types*sizeof(uint8), - MYF(MY_ZEROFILL)); + MYF(0)); + /* This long list of assignments is not beautiful, but I see no way to make it nicer, as the right members are #defines, not array members, so @@ -3432,16 +3432,40 @@ Format_description_log_event(uint8 binlog_ver, const char* server_ver) */ if (post_header_len) { + // Allows us to sanity-check that all events initialized their + // events (see the end of this 'if' block). + IF_DBUG(memset(post_header_len, 255, + number_of_event_types*sizeof(uint8));); + + /* Note: all event types must explicitly fill in their lengths here. */ post_header_len[START_EVENT_V3-1]= START_V3_HEADER_LEN; post_header_len[QUERY_EVENT-1]= QUERY_HEADER_LEN; + post_header_len[STOP_EVENT-1]= STOP_HEADER_LEN; post_header_len[ROTATE_EVENT-1]= ROTATE_HEADER_LEN; + post_header_len[INTVAR_EVENT-1]= INTVAR_HEADER_LEN; post_header_len[LOAD_EVENT-1]= LOAD_HEADER_LEN; + post_header_len[SLAVE_EVENT-1]= SLAVE_HEADER_LEN; post_header_len[CREATE_FILE_EVENT-1]= CREATE_FILE_HEADER_LEN; post_header_len[APPEND_BLOCK_EVENT-1]= APPEND_BLOCK_HEADER_LEN; post_header_len[EXEC_LOAD_EVENT-1]= EXEC_LOAD_HEADER_LEN; post_header_len[DELETE_FILE_EVENT-1]= DELETE_FILE_HEADER_LEN; - post_header_len[NEW_LOAD_EVENT-1]= post_header_len[LOAD_EVENT-1]; + post_header_len[NEW_LOAD_EVENT-1]= NEW_LOAD_HEADER_LEN; + post_header_len[RAND_EVENT-1]= RAND_HEADER_LEN; + post_header_len[USER_VAR_EVENT-1]= USER_VAR_HEADER_LEN; post_header_len[FORMAT_DESCRIPTION_EVENT-1]= FORMAT_DESCRIPTION_HEADER_LEN; + post_header_len[XID_EVENT-1]= XID_HEADER_LEN; + post_header_len[BEGIN_LOAD_QUERY_EVENT-1]= BEGIN_LOAD_QUERY_HEADER_LEN; + post_header_len[EXECUTE_LOAD_QUERY_EVENT-1]= EXECUTE_LOAD_QUERY_HEADER_LEN; + /* + The PRE_GA events are never be written to any binlog, but + their lengths are included in Format_description_log_event. + Hence, we need to be assign some value here, to avoid reading + uninitialized memory when the array is written to disk. + */ + post_header_len[PRE_GA_WRITE_ROWS_EVENT-1] = 0; + post_header_len[PRE_GA_UPDATE_ROWS_EVENT-1] = 0; + post_header_len[PRE_GA_DELETE_ROWS_EVENT-1] = 0; + post_header_len[TABLE_MAP_EVENT-1]= TABLE_MAP_HEADER_LEN; post_header_len[WRITE_ROWS_EVENT-1]= ROWS_HEADER_LEN; post_header_len[UPDATE_ROWS_EVENT-1]= ROWS_HEADER_LEN; @@ -3461,9 +3485,14 @@ Format_description_log_event(uint8 binlog_ver, const char* server_ver) post_header_len[WRITE_ROWS_EVENT-1]= post_header_len[UPDATE_ROWS_EVENT-1]= post_header_len[DELETE_ROWS_EVENT-1]= 6;); - post_header_len[BEGIN_LOAD_QUERY_EVENT-1]= post_header_len[APPEND_BLOCK_EVENT-1]; - post_header_len[EXECUTE_LOAD_QUERY_EVENT-1]= EXECUTE_LOAD_QUERY_HEADER_LEN; post_header_len[INCIDENT_EVENT-1]= INCIDENT_HEADER_LEN; + + // Sanity-check that all post header lengths are initialized. + IF_DBUG({ + int i; + for (i=0; i<number_of_event_types; i++) + assert(post_header_len[i] != 255); + }); } break; @@ -3699,7 +3728,7 @@ int Format_description_log_event::do_apply_event(Relay_log_info const *rli) original place when it comes to us; we'll know this by checking log_pos ("artificial" events have log_pos == 0). */ - if (!artificial_event && created && thd->transaction.all.ha_list) + if (!is_artificial_event() && created && thd->transaction.all.ha_list) { /* This is not an error (XA is safe), just an information */ rli->report(INFORMATION_LEVEL, 0, @@ -4636,6 +4665,8 @@ Rotate_log_event::Rotate_log_event(const char* new_log_ident_arg, #endif if (flags & DUP_NAME) new_log_ident= my_strndup(new_log_ident_arg, ident_len, MYF(MY_WME)); + if (flags & RELAY_LOG) + set_relay_log_event(); DBUG_VOID_RETURN; } #endif @@ -4707,8 +4738,6 @@ int Rotate_log_event::do_update_pos(Relay_log_info *rli) DBUG_PRINT("info", ("new_log_ident: %s", this->new_log_ident)); DBUG_PRINT("info", ("pos: %s", llstr(this->pos, buf))); - pthread_mutex_lock(&rli->data_lock); - rli->event_relay_log_pos= my_b_tell(rli->cur_log); /* If we are in a transaction or in a group: the only normal case is when the I/O thread was copying a big transaction, then it was @@ -4726,23 +4755,24 @@ int Rotate_log_event::do_update_pos(Relay_log_info *rli) relay log, which shall not change the group positions. */ if ((server_id != ::server_id || rli->replicate_same_server_id) && + !is_relay_log_event() && !rli->is_in_group()) { + pthread_mutex_lock(&rli->data_lock); DBUG_PRINT("info", ("old group_master_log_name: '%s' " "old group_master_log_pos: %lu", rli->group_master_log_name, (ulong) rli->group_master_log_pos)); memcpy(rli->group_master_log_name, new_log_ident, ident_len+1); rli->notify_group_master_log_name_update(); - rli->group_master_log_pos= pos; - strmake(rli->group_relay_log_name, rli->event_relay_log_name, - sizeof(rli->group_relay_log_name) - 1); - rli->notify_group_relay_log_name_update(); - rli->group_relay_log_pos= rli->event_relay_log_pos; + rli->inc_group_relay_log_pos(pos, TRUE /* skip_lock */); DBUG_PRINT("info", ("new group_master_log_name: '%s' " "new group_master_log_pos: %lu", rli->group_master_log_name, (ulong) rli->group_master_log_pos)); + pthread_mutex_unlock(&rli->data_lock); + flush_relay_log_info(rli); + /* Reset thd->options and sql_mode etc, because this could be the signal of a master's downgrade from 5.0 to 4.0. @@ -4756,9 +4786,9 @@ int Rotate_log_event::do_update_pos(Relay_log_info *rli) thd->variables.auto_increment_increment= thd->variables.auto_increment_offset= 1; } - pthread_mutex_unlock(&rli->data_lock); - pthread_cond_broadcast(&rli->data_cond); - flush_relay_log_info(rli); + else + rli->inc_event_relay_log_pos(); + DBUG_RETURN(0); } @@ -4812,7 +4842,9 @@ Intvar_log_event::Intvar_log_event(const char* buf, const Format_description_log_event* description_event) :Log_event(buf, description_event) { - buf+= description_event->common_header_len; + /* The Post-Header is empty. The Varible Data part begins immediately. */ + buf+= description_event->common_header_len + + description_event->post_header_len[INTVAR_EVENT-1]; type= buf[I_TYPE_OFFSET]; val= uint8korr(buf+I_VAL_OFFSET); } @@ -4956,7 +4988,9 @@ Rand_log_event::Rand_log_event(const char* buf, const Format_description_log_event* description_event) :Log_event(buf, description_event) { - buf+= description_event->common_header_len; + /* The Post-Header is empty. The Variable Data part begins immediately. */ + buf+= description_event->common_header_len + + description_event->post_header_len[RAND_EVENT-1]; seed1= uint8korr(buf+RAND_SEED1_OFFSET); seed2= uint8korr(buf+RAND_SEED2_OFFSET); } @@ -5060,7 +5094,9 @@ Xid_log_event(const char* buf, const Format_description_log_event *description_event) :Log_event(buf, description_event) { - buf+= description_event->common_header_len; + /* The Post-Header is empty. The Variable Data part begins immediately. */ + buf+= description_event->common_header_len + + description_event->post_header_len[XID_EVENT-1]; memcpy((char*) &xid, buf, sizeof(xid)); } @@ -5207,7 +5243,9 @@ User_var_log_event(const char* buf, const Format_description_log_event* description_event) :Log_event(buf, description_event) { - buf+= description_event->common_header_len; + /* The Post-Header is empty. The Variable Data part begins immediately. */ + buf+= description_event->common_header_len + + description_event->post_header_len[USER_VAR_EVENT-1]; name_len= uint4korr(buf); name= (char *) buf + UV_NAME_LEN_SIZE; buf+= UV_NAME_LEN_SIZE + name_len; @@ -8093,6 +8131,9 @@ Write_rows_log_event::do_before_row_operations(const Slave_reporting_capability analyze if explicit data is provided for slave's TIMESTAMP columns). */ m_table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET; + + /* Honor next number column if present */ + m_table->next_number_field= m_table->found_next_number_field; return error; } @@ -8101,6 +8142,7 @@ Write_rows_log_event::do_after_row_operations(const Slave_reporting_capability * int error) { int local_error= 0; + m_table->next_number_field=0; if (bit_is_set(slave_exec_mode, SLAVE_EXEC_MODE_IDEMPOTENT) == 1 || m_table->s->db_type()->db_type == DB_TYPE_NDBCLUSTER) { @@ -9059,7 +9101,17 @@ Incident_log_event::Incident_log_event(const char *buf, uint event_len, DBUG_PRINT("info",("event_len: %u; common_header_len: %d; post_header_len: %d", event_len, common_header_len, post_header_len)); - m_incident= static_cast<Incident>(uint2korr(buf + common_header_len)); + int incident_number= uint2korr(buf + common_header_len); + if (incident_number >= INCIDENT_COUNT || + incident_number <= INCIDENT_NONE) + { + // If the incident is not recognized, this binlog event is + // invalid. If we set incident_number to INCIDENT_NONE, the + // invalidity will be detected by is_valid(). + incident_number= INCIDENT_NONE; + DBUG_VOID_RETURN; + } + m_incident= static_cast<Incident>(incident_number); char const *ptr= buf + common_header_len + post_header_len; char const *const str_end= buf + event_len; uint8 len= 0; // Assignment to keep compiler happy @@ -9086,9 +9138,6 @@ Incident_log_event::description() const }; DBUG_PRINT("info", ("m_incident: %d", m_incident)); - - DBUG_ASSERT((size_t) m_incident <= sizeof(description)/sizeof(*description)); - return description[m_incident]; } diff --git a/sql/log_event.h b/sql/log_event.h index 3c109b798d3..1d11d7e2d5f 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -227,14 +227,22 @@ struct sql_ex_info #define QUERY_HEADER_MINIMAL_LEN (4 + 4 + 1 + 2) // where 5.0 differs: 2 for len of N-bytes vars. #define QUERY_HEADER_LEN (QUERY_HEADER_MINIMAL_LEN + 2) +#define STOP_HEADER_LEN 0 #define LOAD_HEADER_LEN (4 + 4 + 4 + 1 +1 + 4) +#define SLAVE_HEADER_LEN 0 #define START_V3_HEADER_LEN (2 + ST_SERVER_VER_LEN + 4) #define ROTATE_HEADER_LEN 8 // this is FROZEN (the Rotate post-header is frozen) +#define INTVAR_HEADER_LEN 0 #define CREATE_FILE_HEADER_LEN 4 #define APPEND_BLOCK_HEADER_LEN 4 #define EXEC_LOAD_HEADER_LEN 4 #define DELETE_FILE_HEADER_LEN 4 +#define NEW_LOAD_HEADER_LEN LOAD_HEADER_LEN +#define RAND_HEADER_LEN 0 +#define USER_VAR_HEADER_LEN 0 #define FORMAT_DESCRIPTION_HEADER_LEN (START_V3_HEADER_LEN+1+LOG_EVENT_TYPES) +#define XID_HEADER_LEN 0 +#define BEGIN_LOAD_QUERY_HEADER_LEN APPEND_BLOCK_HEADER_LEN #define ROWS_HEADER_LEN 8 #define TABLE_MAP_HEADER_LEN 8 #define EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN (4 + 4 + 4 + 1) @@ -319,18 +327,16 @@ struct sql_ex_info #define Q_CHARSET_DATABASE_CODE 8 #define Q_TABLE_MAP_FOR_UPDATE_CODE 9 -/* Intvar event post-header */ +/* Intvar event data */ #define I_TYPE_OFFSET 0 #define I_VAL_OFFSET 1 -/* Rand event post-header */ - +/* Rand event data */ #define RAND_SEED1_OFFSET 0 #define RAND_SEED2_OFFSET 8 -/* User_var event post-header */ - +/* User_var event data */ #define UV_VAL_LEN_SIZE 4 #define UV_VAL_IS_NULL 1 #define UV_VAL_TYPE_SIZE 1 @@ -338,7 +344,6 @@ struct sql_ex_info #define UV_CHARSET_NUMBER_SIZE 4 /* Load event post-header */ - #define L_THREAD_ID_OFFSET 0 #define L_EXEC_TIME_OFFSET 4 #define L_SKIP_LINES_OFFSET 8 @@ -349,7 +354,6 @@ struct sql_ex_info #define L_DATA_OFFSET LOAD_HEADER_LEN /* Rotate event post-header */ - #define R_POS_OFFSET 0 #define R_IDENT_OFFSET 8 @@ -458,6 +462,25 @@ struct sql_ex_info #define LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F 0x10 /** + @def LOG_EVENT_ARTIFICIAL_F + + Artificial events are created arbitarily and not written to binary + log + + These events should not update the master log position when slave + SQL thread executes them. +*/ +#define LOG_EVENT_ARTIFICIAL_F 0x20 + +/** + @def LOG_EVENT_RELAY_LOG_F + + Events with this flag set are created by slave IO thread and written + to relay log +*/ +#define LOG_EVENT_RELAY_LOG_F 0x40 + +/** @def OPTIONS_WRITTEN_TO_BIN_LOG OPTIONS_WRITTEN_TO_BIN_LOG are the bits of thd->options which must @@ -980,7 +1003,10 @@ public: #endif virtual Log_event_type get_type_code() = 0; virtual bool is_valid() const = 0; - virtual bool is_artificial_event() { return 0; } + void set_artificial_event() { flags |= LOG_EVENT_ARTIFICIAL_F; } + void set_relay_log_event() { flags |= LOG_EVENT_RELAY_LOG_F; } + bool is_artificial_event() const { return flags & LOG_EVENT_ARTIFICIAL_F; } + bool is_relay_log_event() const { return flags & LOG_EVENT_RELAY_LOG_F; } inline bool get_cache_stmt() const { return cache_stmt; } Log_event(const char* buf, const Format_description_log_event *description_event); @@ -2079,12 +2105,6 @@ public: uint16 binlog_version; char server_version[ST_SERVER_VER_LEN]; /* - artifical_event is 1 in the case where this is a generated event that - should not case any cleanup actions. We handle this in the log by - setting log_event == 0 (for now). - */ - bool artificial_event; - /* We set this to 1 if we don't want to have the created time in the log, which is the case when we rollover to a new log. */ @@ -2112,7 +2132,6 @@ public: { return START_V3_HEADER_LEN; //no variable-sized part } - virtual bool is_artificial_event() { return artificial_event; } protected: #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) @@ -2206,10 +2225,11 @@ protected: @section Intvar_log_event_binary_format Binary Format - The Post-Header has two components: + The Post-Header for this event type is empty. The Body has two + components: <table> - <caption>Post-Header for Intvar_log_event</caption> + <caption>Body for Intvar_log_event</caption> <tr> <th>Name</th> @@ -2283,11 +2303,12 @@ private: which are stored internally as two 64-bit numbers. @section Rand_log_event_binary_format Binary Format - This event type has no Post-Header. The Body of this event type has - two components: + + The Post-Header for this event type is empty. The Body has two + components: <table> - <caption>Post-Header for Intvar_log_event</caption> + <caption>Body for Rand_log_event</caption> <tr> <th>Name</th> @@ -2532,7 +2553,8 @@ class Rotate_log_event: public Log_event { public: enum { - DUP_NAME= 2 // if constructor should dup the string argument + DUP_NAME= 2, // if constructor should dup the string argument + RELAY_LOG=4 // rotate event for relay log }; const char* new_log_ident; ulonglong pos; @@ -3870,7 +3892,10 @@ public: virtual Log_event_type get_type_code() { return INCIDENT_EVENT; } - virtual bool is_valid() const { return 1; } + virtual bool is_valid() const + { + return m_incident > INCIDENT_NONE && m_incident < INCIDENT_COUNT; + } virtual int get_data_size() { return INCIDENT_HEADER_LEN + 1 + m_message.length; } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 46a63969faf..b19294c5676 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -148,15 +148,20 @@ typedef struct my_locale_st TYPELIB *ab_month_names; TYPELIB *day_names; TYPELIB *ab_day_names; + uint max_month_name_length; + uint max_day_name_length; #ifdef __cplusplus my_locale_st(uint number_par, const char *name_par, const char *descr_par, bool is_ascii_par, TYPELIB *month_names_par, TYPELIB *ab_month_names_par, - TYPELIB *day_names_par, TYPELIB *ab_day_names_par) : + TYPELIB *day_names_par, TYPELIB *ab_day_names_par, + uint max_month_name_length_par, uint max_day_name_length_par) : number(number_par), name(name_par), description(descr_par), is_ascii(is_ascii_par), month_names(month_names_par), ab_month_names(ab_month_names_par), - day_names(day_names_par), ab_day_names(ab_day_names_par) + day_names(day_names_par), ab_day_names(ab_day_names_par), + max_month_name_length(max_month_name_length_par), + max_day_name_length(max_day_name_length_par) {} #endif } MY_LOCALE; @@ -2231,6 +2236,7 @@ uint strconvert(CHARSET_INFO *from_cs, const char *from, CHARSET_INFO *to_cs, char *to, uint to_length, uint *errors); uint filename_to_tablename(const char *from, char *to, uint to_length); uint tablename_to_filename(const char *from, char *to, uint to_length); +uint check_n_cut_mysql50_prefix(const char *from, char *to, uint to_length); #endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */ #ifdef MYSQL_SERVER uint build_table_filename(char *buff, size_t bufflen, const char *db, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index dbbb6faaa7d..b77d8ad233e 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -228,6 +228,12 @@ extern "C" int gethostname(char *name, int namelen); extern "C" sig_handler handle_segfault(int sig); +#if defined(__linux__) +#define ENABLE_TEMP_POOL 1 +#else +#define ENABLE_TEMP_POOL 0 +#endif + /* Constants */ const char *show_comp_option_name[]= {"YES", "NO", "DISABLED"}; @@ -3462,8 +3468,13 @@ static int init_common_variables(const char *conf_file_name, int argc, sys_var_slow_log_path.value= my_strdup(s, MYF(0)); sys_var_slow_log_path.value_length= strlen(s); +#if (ENABLE_TEMP_POOL) if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1)) return 1; +#else + use_temp_pool= 0; +#endif + if (my_database_names_init()) return 1; @@ -4198,6 +4209,44 @@ void decrement_handler_count() #ifndef EMBEDDED_LIBRARY +#ifndef DBUG_OFF +/* + Debugging helper function to keep the locale database + (see sql_locale.cc) and max_month_name_length and + max_day_name_length variable values in consistent state. +*/ +static void test_lc_time_sz() +{ + DBUG_ENTER("test_lc_time_sz"); + for (MY_LOCALE **loc= my_locales; *loc; loc++) + { + uint max_month_len= 0; + uint max_day_len = 0; + for (const char **month= (*loc)->month_names->type_names; *month; month++) + { + set_if_bigger(max_month_len, + my_numchars_mb(&my_charset_utf8_general_ci, + *month, *month + strlen(*month))); + } + for (const char **day= (*loc)->day_names->type_names; *day; day++) + { + set_if_bigger(max_day_len, + my_numchars_mb(&my_charset_utf8_general_ci, + *day, *day + strlen(*day))); + } + if ((*loc)->max_month_name_length != max_month_len || + (*loc)->max_day_name_length != max_day_len) + { + DBUG_PRINT("Wrong max day name(or month name) length for locale:", + ("%s", (*loc)->name)); + DBUG_ASSERT(0); + } + } + DBUG_VOID_RETURN; +} +#endif//DBUG_OFF + + #ifdef __WIN__ int win_main(int argc, char **argv) #else @@ -4291,6 +4340,10 @@ int main(int argc, char **argv) openlog(libwrapName, LOG_PID, LOG_AUTH); #endif +#ifndef DBUG_OFF + test_lc_time_sz(); +#endif + /* We have enough space for fiddling with the argv, continue */ @@ -6410,9 +6463,14 @@ log and this option does nothing anymore.", (uchar**) &opt_tc_heuristic_recover, (uchar**) &opt_tc_heuristic_recover, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"temp-pool", OPT_TEMP_POOL, +#if (ENABLE_TEMP_POOL) "Using this option will cause most temporary files created to use a small set of names, rather than a unique name for each new file.", +#else + "This option is ignored on this OS.", +#endif (uchar**) &use_temp_pool, (uchar**) &use_temp_pool, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, + {"timed_mutexes", OPT_TIMED_MUTEXES, "Specify whether to time mutexes (only InnoDB mutexes are currently supported)", (uchar**) &timed_mutexes, (uchar**) &timed_mutexes, 0, GET_BOOL, NO_ARG, 0, @@ -6963,13 +7021,15 @@ The minimum value for this variable is 4096.", {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; -static int show_question(THD *thd, SHOW_VAR *var, char *buff) + +static int show_queries(THD *thd, SHOW_VAR *var, char *buff) { var->type= SHOW_LONGLONG; var->value= (char *)&thd->query_id; return 0; } + static int show_net_compression(THD *thd, SHOW_VAR *var, char *buff) { var->type= SHOW_MY_BOOL; @@ -7385,7 +7445,8 @@ SHOW_VAR status_vars[]= { {"Qcache_queries_in_cache", (char*) &query_cache.queries_in_cache, SHOW_LONG_NOFLUSH}, {"Qcache_total_blocks", (char*) &query_cache.total_blocks, SHOW_LONG_NOFLUSH}, #endif /*HAVE_QUERY_CACHE*/ - {"Questions", (char*) &show_question, SHOW_FUNC}, + {"Queries", (char*) &show_queries, SHOW_FUNC}, + {"Questions", (char*) offsetof(STATUS_VAR, questions), SHOW_LONG_STATUS}, #ifdef HAVE_REPLICATION {"Rpl_status", (char*) &show_rpl_status, SHOW_FUNC}, #endif diff --git a/sql/opt_range.cc b/sql/opt_range.cc index c9311cdf398..37cc0b1ee7b 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1245,6 +1245,9 @@ QUICK_INDEX_MERGE_SELECT::~QUICK_INDEX_MERGE_SELECT() quick->file= NULL; quick_selects.delete_elements(); delete pk_quick_select; + /* It's ok to call the next two even if they are already deinitialized */ + end_read_record(&read_record); + free_io_cache(head); free_root(&alloc,MYF(0)); DBUG_VOID_RETURN; } @@ -2668,7 +2671,7 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond) PART_PRUNE_PARAM prune_param; MEM_ROOT alloc; RANGE_OPT_PARAM *range_par= &prune_param.range_param; - my_bitmap_map *old_read_set, *old_write_set; + my_bitmap_map *old_sets[2]; prune_param.part_info= part_info; init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0); @@ -2682,8 +2685,8 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond) DBUG_RETURN(FALSE); } - old_write_set= dbug_tmp_use_all_columns(table, table->write_set); - old_read_set= dbug_tmp_use_all_columns(table, table->read_set); + dbug_tmp_use_all_columns(table, old_sets, + table->read_set, table->write_set); range_par->thd= thd; range_par->table= table; /* range_par->cond doesn't need initialization */ @@ -2773,8 +2776,7 @@ all_used: retval= FALSE; // some partitions are used mark_all_partitions_as_used(prune_param.part_info); end: - dbug_tmp_restore_column_map(table->write_set, old_write_set); - dbug_tmp_restore_column_map(table->read_set, old_read_set); + dbug_tmp_restore_column_maps(table->read_set, table->write_set, old_sets); thd->no_errors=0; thd->mem_root= range_par->old_root; free_root(&alloc,MYF(0)); // Return memory & allocator @@ -11146,9 +11148,9 @@ print_key(KEY_PART *key_part, const uchar *key, uint used_length) String tmp(buff,sizeof(buff),&my_charset_bin); uint store_length; TABLE *table= key_part->field->table; - my_bitmap_map *old_write_set, *old_read_set; - old_write_set= dbug_tmp_use_all_columns(table, table->write_set); - old_read_set= dbug_tmp_use_all_columns(table, table->read_set); + my_bitmap_map *old_sets[2]; + + dbug_tmp_use_all_columns(table, old_sets, table->read_set, table->write_set); for (; key < key_end; key+=store_length, key_part++) { @@ -11174,8 +11176,7 @@ print_key(KEY_PART *key_part, const uchar *key, uint used_length) if (key+store_length < key_end) fputc('/',DBUG_FILE); } - dbug_tmp_restore_column_map(table->write_set, old_write_set); - dbug_tmp_restore_column_map(table->read_set, old_read_set); + dbug_tmp_restore_column_maps(table->read_set, table->write_set, old_sets); } @@ -11183,18 +11184,16 @@ static void print_quick(QUICK_SELECT_I *quick, const key_map *needed_reg) { char buf[MAX_KEY/8+1]; TABLE *table; - my_bitmap_map *old_read_map, *old_write_map; + my_bitmap_map *old_sets[2]; DBUG_ENTER("print_quick"); if (!quick) DBUG_VOID_RETURN; DBUG_LOCK_FILE; table= quick->head; - old_read_map= dbug_tmp_use_all_columns(table, table->read_set); - old_write_map= dbug_tmp_use_all_columns(table, table->write_set); + dbug_tmp_use_all_columns(table, old_sets, table->read_set, table->write_set); quick->dbug_dump(0, TRUE); - dbug_tmp_restore_column_map(table->read_set, old_read_map); - dbug_tmp_restore_column_map(table->write_set, old_write_map); + dbug_tmp_restore_column_maps(table->read_set, table->write_set, old_sets); fprintf(DBUG_FILE,"other_keys: 0x%s:\n", needed_reg->print(buf)); diff --git a/sql/partition_info.cc b/sql/partition_info.cc index dfdd29975ac..8fc9e584789 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -867,6 +867,7 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type, if (part_type != HASH_PARTITION || !list_of_part_fields) { + DBUG_ASSERT(part_expr); err= part_expr->walk(&Item::check_partition_func_processor, 0, NULL); if (!err && is_sub_partitioned() && !list_of_subpart_fields) diff --git a/sql/partition_info.h b/sql/partition_info.h index 703b92305b1..415f955d5d4 100644 --- a/sql/partition_info.h +++ b/sql/partition_info.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2006 MySQL AB +/* Copyright 2006-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index d7e783f534f..582348608de 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -644,6 +644,16 @@ err: } #endif + +/** + Execute a SHOW SLAVE HOSTS statement. + + @param thd Pointer to THD object for the client thread executing the + statement. + + @retval FALSE success + @retval TRUE failure +*/ bool show_slave_hosts(THD* thd) { List<Item> field_list; diff --git a/sql/rpl_constants.h b/sql/rpl_constants.h index 426e80a328d..32fb4b8a7f2 100644 --- a/sql/rpl_constants.h +++ b/sql/rpl_constants.h @@ -6,10 +6,10 @@ */ enum Incident { /** No incident */ - INCIDENT_NONE, + INCIDENT_NONE = 0, /** There are possibly lost events in the replication stream */ - INCIDENT_LOST_EVENTS, + INCIDENT_LOST_EVENTS = 1, /** Shall be last event of the enumeration */ INCIDENT_COUNT diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 8a977ad66af..fe8e17dc1c7 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -155,6 +155,7 @@ int init_relay_log_info(Relay_log_info* rli, sql_print_error("Failed in open_log() called from init_relay_log_info()"); DBUG_RETURN(1); } + rli->relay_log.is_relay_log= TRUE; } /* if file does not exist */ diff --git a/sql/set_var.cc b/sql/set_var.cc index 640c0fe7291..468e6776996 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1540,14 +1540,14 @@ bool sys_var_thd_ulong::update(THD *thd, set_var *var) ulonglong tmp= var->save_result.ulonglong_value; /* Don't use bigger value than given with --maximum-variable-name=.. */ - if ((ulong) tmp > max_system_variables.*offset) + if (tmp > max_system_variables.*offset) { throw_bounds_warning(thd, TRUE, TRUE, name, (longlong) tmp); tmp= max_system_variables.*offset; } if (option_limits) - tmp= (ulong) fix_unsigned(thd, tmp, option_limits); + tmp= fix_unsigned(thd, tmp, option_limits); #if SIZEOF_LONG < SIZEOF_LONG_LONG else if (tmp > ULONG_MAX) { @@ -1556,6 +1556,7 @@ bool sys_var_thd_ulong::update(THD *thd, set_var *var) } #endif + DBUG_ASSERT(tmp <= ULONG_MAX); if (var->type == OPT_GLOBAL) global_system_variables.*offset= (ulong) tmp; else @@ -3554,6 +3555,7 @@ int set_var_password::check(THD *thd) #ifndef NO_EMBEDDED_ACCESS_CHECKS if (!user->host.str) { + DBUG_ASSERT(thd->security_ctx->priv_host); if (*thd->security_ctx->priv_host != 0) { user->host.str= (char *) thd->security_ctx->priv_host; @@ -3565,6 +3567,12 @@ int set_var_password::check(THD *thd) user->host.length= 1; } } + if (!user->user.str) + { + DBUG_ASSERT(thd->security_ctx->priv_user); + user->user.str= (char *) thd->security_ctx->priv_user; + user->user.length= strlen(thd->security_ctx->priv_user); + } /* Returns 1 as the function sends error to client */ return check_change_password(thd, user->host.str, user->user.str, password, strlen(password)) ? 1 : 0; diff --git a/sql/slave.cc b/sql/slave.cc index 62aeec03ebb..6d48e57d298 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1358,6 +1358,17 @@ int register_slave_on_master(MYSQL* mysql, Master_info *mi, } +/** + Execute a SHOW SLAVE STATUS statement. + + @param thd Pointer to THD object for the client thread executing the + statement. + + @param mi Pointer to Master_info object for the IO thread. + + @retval FALSE success + @retval TRUE failure +*/ bool show_master_info(THD* thd, Master_info* mi) { // TODO: fix this for multi-master @@ -2063,7 +2074,7 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli, fewer times, 0 is returned. - init_master_info or init_relay_log_pos failed. (These are called - if a failure occurs when applying the event.)</li> + if a failure occurs when applying the event.) - An error occurred when updating the binlog position. @@ -2308,8 +2319,14 @@ static int try_to_reconnect(THD *thd, MYSQL *mysql, Master_info *mi, } -/* Slave I/O Thread entry point */ +/** + Slave IO thread entry point. + + @param arg Pointer to Master_info struct that holds information for + the IO thread. + @return Always 0. +*/ pthread_handler_t handle_slave_io(void *arg) { THD *thd; // needs to be first for thread_stack @@ -2617,8 +2634,14 @@ err: } -/* Slave SQL Thread entry point */ +/** + Slave SQL thread entry point. + + @param arg Pointer to Relay_log_info object that holds information + for the SQL thread. + @return Always 0. +*/ pthread_handler_t handle_slave_sql(void *arg) { THD *thd; /* needs to be first for thread_stack */ @@ -3711,6 +3734,16 @@ static IO_CACHE *reopen_relay_log(Relay_log_info *rli, const char **errmsg) } +/** + Reads next event from the relay log. Should be called from the + slave IO thread. + + @param rli Relay_log_info structure for the slave IO thread. + + @return The event read, or NULL on error. If an error occurs, the + error is reported through the sql_print_information() or + sql_print_error() functions. +*/ static Log_event* next_event(Relay_log_info* rli) { Log_event* ev; diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 534cd0a7ca1..ef6cb556f4c 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 MySQL AB +/* Copyright 2002-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index ed41ff90cbc..d8d43fbd878 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -6301,10 +6301,12 @@ int wild_case_compare(CHARSET_INFO *cs, const char *str,const char *wildstr) } -void update_schema_privilege(TABLE *table, char *buff, const char* db, - const char* t_name, const char* column, - uint col_length, const char *priv, - uint priv_length, const char* is_grantable) +#ifndef NO_EMBEDDED_ACCESS_CHECKS +static bool update_schema_privilege(THD *thd, TABLE *table, char *buff, + const char* db, const char* t_name, + const char* column, uint col_length, + const char *priv, uint priv_length, + const char* is_grantable) { int i= 2; CHARSET_INFO *cs= system_charset_info; @@ -6317,14 +6319,16 @@ void update_schema_privilege(TABLE *table, char *buff, const char* db, if (column) table->field[i++]->store(column, col_length, cs); table->field[i++]->store(priv, priv_length, cs); - table->field[i]->store(is_grantable, (uint) strlen(is_grantable), cs); - table->file->ha_write_row(table->record[0]); + table->field[i]->store(is_grantable, strlen(is_grantable), cs); + return schema_table_store_record(thd, table); } +#endif int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond) { #ifndef NO_EMBEDDED_ACCESS_CHECKS + int error= 0; uint counter; ACL_USER *acl_user; ulong want_access; @@ -6358,8 +6362,14 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond) strxmov(buff,"'",user,"'@'",host,"'",NullS); if (!(want_access & ~GRANT_ACL)) - update_schema_privilege(table, buff, 0, 0, 0, 0, - STRING_WITH_LEN("USAGE"), is_grantable); + { + if (update_schema_privilege(thd, table, buff, 0, 0, 0, 0, + STRING_WITH_LEN("USAGE"), is_grantable)) + { + error= 1; + goto err; + } + } else { uint priv_id; @@ -6367,16 +6377,22 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond) for (priv_id=0, j = SELECT_ACL;j <= GLOBAL_ACLS; priv_id++,j <<= 1) { if (test_access & j) - update_schema_privilege(table, buff, 0, 0, 0, 0, - command_array[priv_id], - command_lengths[priv_id], is_grantable); + { + if (update_schema_privilege(thd, table, buff, 0, 0, 0, 0, + command_array[priv_id], + command_lengths[priv_id], is_grantable)) + { + error= 1; + goto err; + } + } } } } - +err: pthread_mutex_unlock(&acl_cache->lock); - DBUG_RETURN(0); + DBUG_RETURN(error); #else return(0); #endif @@ -6386,6 +6402,7 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond) int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond) { #ifndef NO_EMBEDDED_ACCESS_CHECKS + int error= 0; uint counter; ACL_DB *acl_db; ulong want_access; @@ -6423,24 +6440,36 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond) } strxmov(buff,"'",user,"'@'",host,"'",NullS); if (!(want_access & ~GRANT_ACL)) - update_schema_privilege(table, buff, acl_db->db, 0, 0, - 0, STRING_WITH_LEN("USAGE"), is_grantable); + { + if (update_schema_privilege(thd, table, buff, acl_db->db, 0, 0, + 0, STRING_WITH_LEN("USAGE"), is_grantable)) + { + error= 1; + goto err; + } + } else { int cnt; ulong j,test_access= want_access & ~GRANT_ACL; for (cnt=0, j = SELECT_ACL; j <= DB_ACLS; cnt++,j <<= 1) if (test_access & j) - update_schema_privilege(table, buff, acl_db->db, 0, 0, 0, - command_array[cnt], command_lengths[cnt], - is_grantable); + { + if (update_schema_privilege(thd, table, buff, acl_db->db, 0, 0, 0, + command_array[cnt], command_lengths[cnt], + is_grantable)) + { + error= 1; + goto err; + } + } } } } - +err: pthread_mutex_unlock(&acl_cache->lock); - DBUG_RETURN(0); + DBUG_RETURN(error); #else return (0); #endif @@ -6450,6 +6479,7 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond) int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond) { #ifndef NO_EMBEDDED_ACCESS_CHECKS + int error= 0; uint index; char buff[100]; TABLE *table= tables->table; @@ -6489,8 +6519,15 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond) strxmov(buff, "'", user, "'@'", host, "'", NullS); if (!test_access) - update_schema_privilege(table, buff, grant_table->db, grant_table->tname, - 0, 0, STRING_WITH_LEN("USAGE"), is_grantable); + { + if (update_schema_privilege(thd, table, buff, grant_table->db, + grant_table->tname, 0, 0, + STRING_WITH_LEN("USAGE"), is_grantable)) + { + error= 1; + goto err; + } + } else { ulong j; @@ -6498,17 +6535,24 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond) for (cnt= 0, j= SELECT_ACL; j <= TABLE_ACLS; cnt++, j<<= 1) { if (test_access & j) - update_schema_privilege(table, buff, grant_table->db, - grant_table->tname, 0, 0, command_array[cnt], - command_lengths[cnt], is_grantable); + { + if (update_schema_privilege(thd, table, buff, grant_table->db, + grant_table->tname, 0, 0, + command_array[cnt], + command_lengths[cnt], is_grantable)) + { + error= 1; + goto err; + } + } } } - } + } } - +err: rw_unlock(&LOCK_grant); - DBUG_RETURN(0); + DBUG_RETURN(error); #else return (0); #endif @@ -6518,6 +6562,7 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond) int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond) { #ifndef NO_EMBEDDED_ACCESS_CHECKS + int error= 0; uint index; char buff[100]; TABLE *table= tables->table; @@ -6567,22 +6612,28 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond) GRANT_COLUMN *grant_column = (GRANT_COLUMN*) hash_element(&grant_table->hash_columns,col_index); if ((grant_column->rights & j) && (table_access & j)) - update_schema_privilege(table, buff, grant_table->db, - grant_table->tname, - grant_column->column, - grant_column->key_length, - command_array[cnt], - command_lengths[cnt], is_grantable); + { + if (update_schema_privilege(thd, table, buff, grant_table->db, + grant_table->tname, + grant_column->column, + grant_column->key_length, + command_array[cnt], + command_lengths[cnt], is_grantable)) + { + error= 1; + goto err; + } + } } } } } } } - +err: rw_unlock(&LOCK_grant); - DBUG_RETURN(0); + DBUG_RETURN(error); #else return (0); #endif diff --git a/sql/sql_base.cc b/sql/sql_base.cc index bf45bb648bd..1f086683aa2 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1111,6 +1111,27 @@ static void mark_temp_tables_as_free_for_reuse(THD *thd) */ if (table->child_l || table->parent) detach_merge_children(table, TRUE); + /* + Reset temporary table lock type to it's default value (TL_WRITE). + + Statements such as INSERT INTO .. SELECT FROM tmp, CREATE TABLE + .. SELECT FROM tmp and UPDATE may under some circumstances modify + the lock type of the tables participating in the statement. This + isn't a problem for non-temporary tables since their lock type is + reset at every open, but the same does not occur for temporary + tables for historical reasons. + + Furthermore, the lock type of temporary tables is not really that + important because they can only be used by one query at a time and + not even twice in a query -- a temporary table is represented by + only one TABLE object. Nonetheless, it's safer from a maintenance + point of view to reset the lock type of this singleton TABLE object + as to not cause problems when the table is reused. + + Even under LOCK TABLES mode its okay to reset the lock type as + LOCK TABLES is allowed (but ignored) for a temporary table. + */ + table->reginfo.lock_type= TL_WRITE; } } } @@ -4699,7 +4720,7 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags) else if (tables->lock_type == TL_READ_DEFAULT) tables->table->reginfo.lock_type= read_lock_type_for_table(thd, tables->table); - else if (tables->table->s->tmp_table == NO_TMP_TABLE) + else tables->table->reginfo.lock_type= tables->lock_type; } tables->table->grant= tables->grant; diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc index 7ca7bef3a56..96e99b57e3c 100644 --- a/sql/sql_binlog.cc +++ b/sql/sql_binlog.cc @@ -18,7 +18,7 @@ #include "base64.h" /** - Execute a BINLOG statement + Execute a BINLOG statement. To execute the BINLOG command properly the server needs to know which format the BINLOG command's event is in. Therefore, the first @@ -26,6 +26,9 @@ Format_description_log_event, as outputted by mysqlbinlog. This Format_description_log_event is cached in rli->description_event_for_exec. + + @param thd Pointer to THD object for the client thread executing the + statement. */ void mysql_client_binlog_statement(THD* thd) diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 1748a737b07..6e9079d4e98 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 6f068074641..45478ab66e8 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -3590,7 +3590,6 @@ show_query_type(THD::enum_binlog_query_type qtype) default: DBUG_ASSERT(0 <= qtype && qtype < THD::QUERY_TYPE_COUNT); } - static char buf[64]; sprintf(buf, "UNKNOWN#%d", qtype); return buf; diff --git a/sql/sql_class.h b/sql/sql_class.h index 01f5c9eb1e9..612a49f03ab 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -462,8 +462,15 @@ typedef struct system_status_var ulong com_stmt_fetch; ulong com_stmt_reset; ulong com_stmt_close; - /* + Number of statements sent from the client + */ + ulong questions; + /* + IMPORTANT! + SEE last_system_status_var DEFINITION BELOW. + Below 'last_system_status_var' are all variables which doesn't make any + sense to add to the /global/ status variable counter. Status variables which it does not make sense to add to global status variable counter */ @@ -476,7 +483,7 @@ typedef struct system_status_var counter */ -#define last_system_status_var com_stmt_close +#define last_system_status_var questions void mark_transaction_to_rollback(THD *thd, bool all); @@ -1009,6 +1016,7 @@ show_system_thread(enum_thread_type thread) { #define RETURN_NAME_AS_STRING(NAME) case (NAME): return #NAME switch (thread) { + static char buf[64]; RETURN_NAME_AS_STRING(NON_SYSTEM_THREAD); RETURN_NAME_AS_STRING(SYSTEM_THREAD_DELAYED_INSERT); RETURN_NAME_AS_STRING(SYSTEM_THREAD_SLAVE_IO); @@ -1016,9 +1024,11 @@ show_system_thread(enum_thread_type thread) RETURN_NAME_AS_STRING(SYSTEM_THREAD_NDBCLUSTER_BINLOG); RETURN_NAME_AS_STRING(SYSTEM_THREAD_EVENT_SCHEDULER); RETURN_NAME_AS_STRING(SYSTEM_THREAD_EVENT_WORKER); + default: + sprintf(buf, "<UNKNOWN SYSTEM THREAD: %d>", thread); + return buf; } #undef RETURN_NAME_AS_STRING - return "UNKNOWN"; /* keep gcc happy */ } /** @@ -2118,8 +2128,8 @@ public: Don't reset binlog format for NDB binlog injector thread. */ DBUG_PRINT("debug", - ("temporary_tables: %p, in_sub_stmt: %d, system_thread: %s", - temporary_tables, in_sub_stmt, + ("temporary_tables: %s, in_sub_stmt: %s, system_thread: %s", + YESNO(temporary_tables), YESNO(in_sub_stmt), show_system_thread(system_thread))); if ((temporary_tables == NULL) && (in_sub_stmt == 0) && (system_thread != SYSTEM_THREAD_NDBCLUSTER_BINLOG)) diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc index 7c530cb9013..6f61dc40f66 100644 --- a/sql/sql_cursor.cc +++ b/sql/sql_cursor.cc @@ -85,6 +85,7 @@ class Materialized_cursor: public Server_side_cursor List<Item> item_list; ulong fetch_limit; ulong fetch_count; + bool is_rnd_inited; public: Materialized_cursor(select_result *result, TABLE *table); @@ -190,7 +191,11 @@ int mysql_open_cursor(THD *thd, uint flags, select_result *result, such command is SHOW VARIABLES or SHOW STATUS. */ if (rc) + { + if (result_materialize->materialized_cursor) + delete result_materialize->materialized_cursor; goto err_open; + } if (sensitive_cursor->is_open()) { @@ -542,7 +547,8 @@ Materialized_cursor::Materialized_cursor(select_result *result_arg, :Server_side_cursor(&table_arg->mem_root, result_arg), table(table_arg), fetch_limit(0), - fetch_count(0) + fetch_count(0), + is_rnd_inited(0) { fake_unit.init_query(); fake_unit.thd= table->in_use; @@ -599,11 +605,12 @@ int Materialized_cursor::open(JOIN *join __attribute__((unused))) THD *thd= fake_unit.thd; int rc; Query_arena backup_arena; - thd->set_n_backup_active_arena(this, &backup_arena); /* Create a list of fields and start sequential scan */ - rc= (result->prepare(item_list, &fake_unit) || - table->file->ha_rnd_init(TRUE)); + rc= result->prepare(item_list, &fake_unit); + if (!rc && !(rc= table->file->ha_rnd_init(TRUE))) + is_rnd_inited= 1; + thd->restore_active_arena(this, &backup_arena); if (rc == 0) { @@ -678,7 +685,8 @@ void Materialized_cursor::close() { /* Free item_list items */ free_items(); - (void) table->file->ha_rnd_end(); + if (is_rnd_inited) + (void) table->file->ha_rnd_end(); /* We need to grab table->mem_root to prevent free_tmp_table from freeing: the cursor object was allocated in this memory. diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 83d78ab9852..8a891f88057 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -907,7 +907,6 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) remove_db_from_cache(db); pthread_mutex_unlock(&LOCK_open); - error= -1; /* We temporarily disable the binary log while dropping the objects diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 6a400a4f197..a0abb9c2118 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -951,6 +951,26 @@ bool multi_delete::send_eof() ****************************************************************************/ /* + Row-by-row truncation if the engine does not support table recreation. + Probably a InnoDB table. +*/ + +static bool mysql_truncate_by_delete(THD *thd, TABLE_LIST *table_list) +{ + bool error, save_binlog_row_based= thd->current_stmt_binlog_row_based; + DBUG_ENTER("mysql_truncate_by_delete"); + table_list->lock_type= TL_WRITE; + mysql_init_select(thd->lex); + thd->clear_current_stmt_binlog_row_based(); + error= mysql_delete(thd, table_list, NULL, NULL, HA_POS_ERROR, LL(0), TRUE); + ha_autocommit_or_rollback(thd, error); + end_trans(thd, error ? ROLLBACK : COMMIT); + thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_RETURN(error); +} + + +/* Optimize delete of all rows by doing a full generate of the table This will work even if the .ISM and .ISD tables are destroyed @@ -1060,27 +1080,6 @@ end: DBUG_RETURN(error); trunc_by_del: - /* Probably InnoDB table */ - ulonglong save_options= thd->options; - bool save_binlog_row_based= thd->current_stmt_binlog_row_based; - - table_list->lock_type= TL_WRITE; - thd->options&= ~(OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT); - ha_enable_transaction(thd, FALSE); - mysql_init_select(thd->lex); - thd->clear_current_stmt_binlog_row_based(); - - /* Delete all rows from table */ - error= mysql_delete(thd, table_list, (COND*) 0, (SQL_LIST*) 0, - HA_POS_ERROR, LL(0), TRUE); - ha_enable_transaction(thd, TRUE); - /* - Safety, in case the engine ignored ha_enable_transaction(FALSE) - above. Also clears thd->transaction.*. - */ - error= ha_autocommit_or_rollback(thd, error); - ha_commit(thd); - thd->options= save_options; - thd->current_stmt_binlog_row_based= save_binlog_row_based; + error= mysql_truncate_by_delete(thd, table_list); DBUG_RETURN(error); } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 0c3ea8bd731..a64429fb7bc 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 82b4481200b..272c74917ad 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 24731b600e9..ed6b9e7d8df 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -190,6 +190,15 @@ typedef struct st_lex_server_options char *server_name, *host, *db, *username, *password, *scheme, *socket, *owner; } LEX_SERVER_OPTIONS; + +/** + Structure to hold parameters for CHANGE MASTER or START/STOP SLAVE + or SHOW NEW MASTER. + + Remark: this should not be confused with Master_info (and perhaps + would better be renamed to st_lex_replication_info). Some fields, + e.g., delay, are saved in Relay_log_info, not in Master_info. +*/ typedef struct st_lex_master_info { char *host, *user, *password, *log_file_name; diff --git a/sql/sql_locale.cc b/sql/sql_locale.cc index 4e61c664106..3def9864c29 100644 --- a/sql/sql_locale.cc +++ b/sql/sql_locale.cc @@ -49,7 +49,9 @@ MY_LOCALE my_locale_ar_AE &my_locale_typelib_month_names_ar_AE, &my_locale_typelib_ab_month_names_ar_AE, &my_locale_typelib_day_names_ar_AE, - &my_locale_typelib_ab_day_names_ar_AE + &my_locale_typelib_ab_day_names_ar_AE, + 6, + 8 ); /***** LOCALE END ar_AE *****/ @@ -79,7 +81,9 @@ MY_LOCALE my_locale_ar_BH &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_BH *****/ @@ -109,7 +113,9 @@ MY_LOCALE my_locale_ar_JO &my_locale_typelib_month_names_ar_JO, &my_locale_typelib_ab_month_names_ar_JO, &my_locale_typelib_day_names_ar_JO, - &my_locale_typelib_ab_day_names_ar_JO + &my_locale_typelib_ab_day_names_ar_JO, + 12, + 8 ); /***** LOCALE END ar_JO *****/ @@ -139,7 +145,9 @@ MY_LOCALE my_locale_ar_SA &my_locale_typelib_month_names_ar_SA, &my_locale_typelib_ab_month_names_ar_SA, &my_locale_typelib_day_names_ar_SA, - &my_locale_typelib_ab_day_names_ar_SA + &my_locale_typelib_ab_day_names_ar_SA, + 12, + 8 ); /***** LOCALE END ar_SA *****/ @@ -169,7 +177,9 @@ MY_LOCALE my_locale_ar_SY &my_locale_typelib_month_names_ar_SY, &my_locale_typelib_ab_month_names_ar_SY, &my_locale_typelib_day_names_ar_SY, - &my_locale_typelib_ab_day_names_ar_SY + &my_locale_typelib_ab_day_names_ar_SY, + 12, + 8 ); /***** LOCALE END ar_SY *****/ @@ -199,7 +209,9 @@ MY_LOCALE my_locale_be_BY &my_locale_typelib_month_names_be_BY, &my_locale_typelib_ab_month_names_be_BY, &my_locale_typelib_day_names_be_BY, - &my_locale_typelib_ab_day_names_be_BY + &my_locale_typelib_ab_day_names_be_BY, + 10, + 10 ); /***** LOCALE END be_BY *****/ @@ -229,7 +241,9 @@ MY_LOCALE my_locale_bg_BG &my_locale_typelib_month_names_bg_BG, &my_locale_typelib_ab_month_names_bg_BG, &my_locale_typelib_day_names_bg_BG, - &my_locale_typelib_ab_day_names_bg_BG + &my_locale_typelib_ab_day_names_bg_BG, + 9, + 10 ); /***** LOCALE END bg_BG *****/ @@ -259,7 +273,9 @@ MY_LOCALE my_locale_ca_ES &my_locale_typelib_month_names_ca_ES, &my_locale_typelib_ab_month_names_ca_ES, &my_locale_typelib_day_names_ca_ES, - &my_locale_typelib_ab_day_names_ca_ES + &my_locale_typelib_ab_day_names_ca_ES, + 8, + 9 ); /***** LOCALE END ca_ES *****/ @@ -289,7 +305,9 @@ MY_LOCALE my_locale_cs_CZ &my_locale_typelib_month_names_cs_CZ, &my_locale_typelib_ab_month_names_cs_CZ, &my_locale_typelib_day_names_cs_CZ, - &my_locale_typelib_ab_day_names_cs_CZ + &my_locale_typelib_ab_day_names_cs_CZ, + 8, + 7 ); /***** LOCALE END cs_CZ *****/ @@ -319,7 +337,9 @@ MY_LOCALE my_locale_da_DK &my_locale_typelib_month_names_da_DK, &my_locale_typelib_ab_month_names_da_DK, &my_locale_typelib_day_names_da_DK, - &my_locale_typelib_ab_day_names_da_DK + &my_locale_typelib_ab_day_names_da_DK, + 9, + 7 ); /***** LOCALE END da_DK *****/ @@ -349,7 +369,9 @@ MY_LOCALE my_locale_de_AT &my_locale_typelib_month_names_de_AT, &my_locale_typelib_ab_month_names_de_AT, &my_locale_typelib_day_names_de_AT, - &my_locale_typelib_ab_day_names_de_AT + &my_locale_typelib_ab_day_names_de_AT, + 9, + 10 ); /***** LOCALE END de_AT *****/ @@ -379,7 +401,9 @@ MY_LOCALE my_locale_de_DE &my_locale_typelib_month_names_de_DE, &my_locale_typelib_ab_month_names_de_DE, &my_locale_typelib_day_names_de_DE, - &my_locale_typelib_ab_day_names_de_DE + &my_locale_typelib_ab_day_names_de_DE, + 9, + 10 ); /***** LOCALE END de_DE *****/ @@ -409,7 +433,9 @@ MY_LOCALE my_locale_en_US &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, - &my_locale_typelib_ab_day_names_en_US + &my_locale_typelib_ab_day_names_en_US, + 9, + 9 ); /***** LOCALE END en_US *****/ @@ -439,7 +465,9 @@ MY_LOCALE my_locale_es_ES &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_ES *****/ @@ -469,7 +497,9 @@ MY_LOCALE my_locale_et_EE &my_locale_typelib_month_names_et_EE, &my_locale_typelib_ab_month_names_et_EE, &my_locale_typelib_day_names_et_EE, - &my_locale_typelib_ab_day_names_et_EE + &my_locale_typelib_ab_day_names_et_EE, + 9, + 9 ); /***** LOCALE END et_EE *****/ @@ -499,7 +529,9 @@ MY_LOCALE my_locale_eu_ES &my_locale_typelib_month_names_eu_ES, &my_locale_typelib_ab_month_names_eu_ES, &my_locale_typelib_day_names_eu_ES, - &my_locale_typelib_ab_day_names_eu_ES + &my_locale_typelib_ab_day_names_eu_ES, + 9, + 10 ); /***** LOCALE END eu_ES *****/ @@ -529,7 +561,9 @@ MY_LOCALE my_locale_fi_FI &my_locale_typelib_month_names_fi_FI, &my_locale_typelib_ab_month_names_fi_FI, &my_locale_typelib_day_names_fi_FI, - &my_locale_typelib_ab_day_names_fi_FI + &my_locale_typelib_ab_day_names_fi_FI, + 9, + 11 ); /***** LOCALE END fi_FI *****/ @@ -559,7 +593,9 @@ MY_LOCALE my_locale_fo_FO &my_locale_typelib_month_names_fo_FO, &my_locale_typelib_ab_month_names_fo_FO, &my_locale_typelib_day_names_fo_FO, - &my_locale_typelib_ab_day_names_fo_FO + &my_locale_typelib_ab_day_names_fo_FO, + 9, + 12 ); /***** LOCALE END fo_FO *****/ @@ -589,7 +625,9 @@ MY_LOCALE my_locale_fr_FR &my_locale_typelib_month_names_fr_FR, &my_locale_typelib_ab_month_names_fr_FR, &my_locale_typelib_day_names_fr_FR, - &my_locale_typelib_ab_day_names_fr_FR + &my_locale_typelib_ab_day_names_fr_FR, + 9, + 8 ); /***** LOCALE END fr_FR *****/ @@ -619,7 +657,9 @@ MY_LOCALE my_locale_gl_ES &my_locale_typelib_month_names_gl_ES, &my_locale_typelib_ab_month_names_gl_ES, &my_locale_typelib_day_names_gl_ES, - &my_locale_typelib_ab_day_names_gl_ES + &my_locale_typelib_ab_day_names_gl_ES, + 8, + 8 ); /***** LOCALE END gl_ES *****/ @@ -649,7 +689,9 @@ MY_LOCALE my_locale_gu_IN &my_locale_typelib_month_names_gu_IN, &my_locale_typelib_ab_month_names_gu_IN, &my_locale_typelib_day_names_gu_IN, - &my_locale_typelib_ab_day_names_gu_IN + &my_locale_typelib_ab_day_names_gu_IN, + 10, + 8 ); /***** LOCALE END gu_IN *****/ @@ -679,7 +721,9 @@ MY_LOCALE my_locale_he_IL &my_locale_typelib_month_names_he_IL, &my_locale_typelib_ab_month_names_he_IL, &my_locale_typelib_day_names_he_IL, - &my_locale_typelib_ab_day_names_he_IL + &my_locale_typelib_ab_day_names_he_IL, + 7, + 5 ); /***** LOCALE END he_IL *****/ @@ -709,7 +753,9 @@ MY_LOCALE my_locale_hi_IN &my_locale_typelib_month_names_hi_IN, &my_locale_typelib_ab_month_names_hi_IN, &my_locale_typelib_day_names_hi_IN, - &my_locale_typelib_ab_day_names_hi_IN + &my_locale_typelib_ab_day_names_hi_IN, + 7, + 9 ); /***** LOCALE END hi_IN *****/ @@ -739,7 +785,9 @@ MY_LOCALE my_locale_hr_HR &my_locale_typelib_month_names_hr_HR, &my_locale_typelib_ab_month_names_hr_HR, &my_locale_typelib_day_names_hr_HR, - &my_locale_typelib_ab_day_names_hr_HR + &my_locale_typelib_ab_day_names_hr_HR, + 8, + 11 ); /***** LOCALE END hr_HR *****/ @@ -769,7 +817,9 @@ MY_LOCALE my_locale_hu_HU &my_locale_typelib_month_names_hu_HU, &my_locale_typelib_ab_month_names_hu_HU, &my_locale_typelib_day_names_hu_HU, - &my_locale_typelib_ab_day_names_hu_HU + &my_locale_typelib_ab_day_names_hu_HU, + 10, + 9 ); /***** LOCALE END hu_HU *****/ @@ -799,7 +849,9 @@ MY_LOCALE my_locale_id_ID &my_locale_typelib_month_names_id_ID, &my_locale_typelib_ab_month_names_id_ID, &my_locale_typelib_day_names_id_ID, - &my_locale_typelib_ab_day_names_id_ID + &my_locale_typelib_ab_day_names_id_ID, + 9, + 6 ); /***** LOCALE END id_ID *****/ @@ -829,7 +881,9 @@ MY_LOCALE my_locale_is_IS &my_locale_typelib_month_names_is_IS, &my_locale_typelib_ab_month_names_is_IS, &my_locale_typelib_day_names_is_IS, - &my_locale_typelib_ab_day_names_is_IS + &my_locale_typelib_ab_day_names_is_IS, + 9, + 12 ); /***** LOCALE END is_IS *****/ @@ -859,7 +913,9 @@ MY_LOCALE my_locale_it_CH &my_locale_typelib_month_names_it_CH, &my_locale_typelib_ab_month_names_it_CH, &my_locale_typelib_day_names_it_CH, - &my_locale_typelib_ab_day_names_it_CH + &my_locale_typelib_ab_day_names_it_CH, + 9, + 9 ); /***** LOCALE END it_CH *****/ @@ -889,7 +945,9 @@ MY_LOCALE my_locale_ja_JP &my_locale_typelib_month_names_ja_JP, &my_locale_typelib_ab_month_names_ja_JP, &my_locale_typelib_day_names_ja_JP, - &my_locale_typelib_ab_day_names_ja_JP + &my_locale_typelib_ab_day_names_ja_JP, + 3, + 3 ); /***** LOCALE END ja_JP *****/ @@ -919,7 +977,9 @@ MY_LOCALE my_locale_ko_KR &my_locale_typelib_month_names_ko_KR, &my_locale_typelib_ab_month_names_ko_KR, &my_locale_typelib_day_names_ko_KR, - &my_locale_typelib_ab_day_names_ko_KR + &my_locale_typelib_ab_day_names_ko_KR, + 3, + 3 ); /***** LOCALE END ko_KR *****/ @@ -949,7 +1009,9 @@ MY_LOCALE my_locale_lt_LT &my_locale_typelib_month_names_lt_LT, &my_locale_typelib_ab_month_names_lt_LT, &my_locale_typelib_day_names_lt_LT, - &my_locale_typelib_ab_day_names_lt_LT + &my_locale_typelib_ab_day_names_lt_LT, + 9, + 14 ); /***** LOCALE END lt_LT *****/ @@ -979,7 +1041,9 @@ MY_LOCALE my_locale_lv_LV &my_locale_typelib_month_names_lv_LV, &my_locale_typelib_ab_month_names_lv_LV, &my_locale_typelib_day_names_lv_LV, - &my_locale_typelib_ab_day_names_lv_LV + &my_locale_typelib_ab_day_names_lv_LV, + 10, + 11 ); /***** LOCALE END lv_LV *****/ @@ -1009,7 +1073,9 @@ MY_LOCALE my_locale_mk_MK &my_locale_typelib_month_names_mk_MK, &my_locale_typelib_ab_month_names_mk_MK, &my_locale_typelib_day_names_mk_MK, - &my_locale_typelib_ab_day_names_mk_MK + &my_locale_typelib_ab_day_names_mk_MK, + 9, + 10 ); /***** LOCALE END mk_MK *****/ @@ -1039,7 +1105,9 @@ MY_LOCALE my_locale_mn_MN &my_locale_typelib_month_names_mn_MN, &my_locale_typelib_ab_month_names_mn_MN, &my_locale_typelib_day_names_mn_MN, - &my_locale_typelib_ab_day_names_mn_MN + &my_locale_typelib_ab_day_names_mn_MN, + 18, + 6 ); /***** LOCALE END mn_MN *****/ @@ -1069,7 +1137,9 @@ MY_LOCALE my_locale_ms_MY &my_locale_typelib_month_names_ms_MY, &my_locale_typelib_ab_month_names_ms_MY, &my_locale_typelib_day_names_ms_MY, - &my_locale_typelib_ab_day_names_ms_MY + &my_locale_typelib_ab_day_names_ms_MY, + 9, + 6 ); /***** LOCALE END ms_MY *****/ @@ -1099,7 +1169,9 @@ MY_LOCALE my_locale_nb_NO &my_locale_typelib_month_names_nb_NO, &my_locale_typelib_ab_month_names_nb_NO, &my_locale_typelib_day_names_nb_NO, - &my_locale_typelib_ab_day_names_nb_NO + &my_locale_typelib_ab_day_names_nb_NO, + 9, + 7 ); /***** LOCALE END nb_NO *****/ @@ -1129,7 +1201,9 @@ MY_LOCALE my_locale_nl_NL &my_locale_typelib_month_names_nl_NL, &my_locale_typelib_ab_month_names_nl_NL, &my_locale_typelib_day_names_nl_NL, - &my_locale_typelib_ab_day_names_nl_NL + &my_locale_typelib_ab_day_names_nl_NL, + 9, + 9 ); /***** LOCALE END nl_NL *****/ @@ -1159,7 +1233,9 @@ MY_LOCALE my_locale_pl_PL &my_locale_typelib_month_names_pl_PL, &my_locale_typelib_ab_month_names_pl_PL, &my_locale_typelib_day_names_pl_PL, - &my_locale_typelib_ab_day_names_pl_PL + &my_locale_typelib_ab_day_names_pl_PL, + 11, + 12 ); /***** LOCALE END pl_PL *****/ @@ -1189,7 +1265,9 @@ MY_LOCALE my_locale_pt_BR &my_locale_typelib_month_names_pt_BR, &my_locale_typelib_ab_month_names_pt_BR, &my_locale_typelib_day_names_pt_BR, - &my_locale_typelib_ab_day_names_pt_BR + &my_locale_typelib_ab_day_names_pt_BR, + 9, + 7 ); /***** LOCALE END pt_BR *****/ @@ -1219,7 +1297,9 @@ MY_LOCALE my_locale_pt_PT &my_locale_typelib_month_names_pt_PT, &my_locale_typelib_ab_month_names_pt_PT, &my_locale_typelib_day_names_pt_PT, - &my_locale_typelib_ab_day_names_pt_PT + &my_locale_typelib_ab_day_names_pt_PT, + 9, + 7 ); /***** LOCALE END pt_PT *****/ @@ -1249,7 +1329,9 @@ MY_LOCALE my_locale_ro_RO &my_locale_typelib_month_names_ro_RO, &my_locale_typelib_ab_month_names_ro_RO, &my_locale_typelib_day_names_ro_RO, - &my_locale_typelib_ab_day_names_ro_RO + &my_locale_typelib_ab_day_names_ro_RO, + 10, + 8 ); /***** LOCALE END ro_RO *****/ @@ -1279,7 +1361,9 @@ MY_LOCALE my_locale_ru_RU &my_locale_typelib_month_names_ru_RU, &my_locale_typelib_ab_month_names_ru_RU, &my_locale_typelib_day_names_ru_RU, - &my_locale_typelib_ab_day_names_ru_RU + &my_locale_typelib_ab_day_names_ru_RU, + 8, + 11 ); /***** LOCALE END ru_RU *****/ @@ -1309,7 +1393,9 @@ MY_LOCALE my_locale_ru_UA &my_locale_typelib_month_names_ru_UA, &my_locale_typelib_ab_month_names_ru_UA, &my_locale_typelib_day_names_ru_UA, - &my_locale_typelib_ab_day_names_ru_UA + &my_locale_typelib_ab_day_names_ru_UA, + 8, + 11 ); /***** LOCALE END ru_UA *****/ @@ -1339,7 +1425,9 @@ MY_LOCALE my_locale_sk_SK &my_locale_typelib_month_names_sk_SK, &my_locale_typelib_ab_month_names_sk_SK, &my_locale_typelib_day_names_sk_SK, - &my_locale_typelib_ab_day_names_sk_SK + &my_locale_typelib_ab_day_names_sk_SK, + 9, + 8 ); /***** LOCALE END sk_SK *****/ @@ -1369,7 +1457,9 @@ MY_LOCALE my_locale_sl_SI &my_locale_typelib_month_names_sl_SI, &my_locale_typelib_ab_month_names_sl_SI, &my_locale_typelib_day_names_sl_SI, - &my_locale_typelib_ab_day_names_sl_SI + &my_locale_typelib_ab_day_names_sl_SI, + 9, + 10 ); /***** LOCALE END sl_SI *****/ @@ -1399,7 +1489,9 @@ MY_LOCALE my_locale_sq_AL &my_locale_typelib_month_names_sq_AL, &my_locale_typelib_ab_month_names_sq_AL, &my_locale_typelib_day_names_sq_AL, - &my_locale_typelib_ab_day_names_sq_AL + &my_locale_typelib_ab_day_names_sq_AL, + 7, + 10 ); /***** LOCALE END sq_AL *****/ @@ -1429,7 +1521,9 @@ MY_LOCALE my_locale_sr_YU &my_locale_typelib_month_names_sr_YU, &my_locale_typelib_ab_month_names_sr_YU, &my_locale_typelib_day_names_sr_YU, - &my_locale_typelib_ab_day_names_sr_YU + &my_locale_typelib_ab_day_names_sr_YU, + 9, + 10 ); /***** LOCALE END sr_YU *****/ @@ -1459,7 +1553,9 @@ MY_LOCALE my_locale_sv_SE &my_locale_typelib_month_names_sv_SE, &my_locale_typelib_ab_month_names_sv_SE, &my_locale_typelib_day_names_sv_SE, - &my_locale_typelib_ab_day_names_sv_SE + &my_locale_typelib_ab_day_names_sv_SE, + 9, + 7 ); /***** LOCALE END sv_SE *****/ @@ -1489,7 +1585,9 @@ MY_LOCALE my_locale_ta_IN &my_locale_typelib_month_names_ta_IN, &my_locale_typelib_ab_month_names_ta_IN, &my_locale_typelib_day_names_ta_IN, - &my_locale_typelib_ab_day_names_ta_IN + &my_locale_typelib_ab_day_names_ta_IN, + 10, + 8 ); /***** LOCALE END ta_IN *****/ @@ -1519,7 +1617,9 @@ MY_LOCALE my_locale_te_IN &my_locale_typelib_month_names_te_IN, &my_locale_typelib_ab_month_names_te_IN, &my_locale_typelib_day_names_te_IN, - &my_locale_typelib_ab_day_names_te_IN + &my_locale_typelib_ab_day_names_te_IN, + 10, + 9 ); /***** LOCALE END te_IN *****/ @@ -1549,7 +1649,9 @@ MY_LOCALE my_locale_th_TH &my_locale_typelib_month_names_th_TH, &my_locale_typelib_ab_month_names_th_TH, &my_locale_typelib_day_names_th_TH, - &my_locale_typelib_ab_day_names_th_TH + &my_locale_typelib_ab_day_names_th_TH, + 10, + 8 ); /***** LOCALE END th_TH *****/ @@ -1579,7 +1681,9 @@ MY_LOCALE my_locale_tr_TR &my_locale_typelib_month_names_tr_TR, &my_locale_typelib_ab_month_names_tr_TR, &my_locale_typelib_day_names_tr_TR, - &my_locale_typelib_ab_day_names_tr_TR + &my_locale_typelib_ab_day_names_tr_TR, + 7, + 9 ); /***** LOCALE END tr_TR *****/ @@ -1609,7 +1713,9 @@ MY_LOCALE my_locale_uk_UA &my_locale_typelib_month_names_uk_UA, &my_locale_typelib_ab_month_names_uk_UA, &my_locale_typelib_day_names_uk_UA, - &my_locale_typelib_ab_day_names_uk_UA + &my_locale_typelib_ab_day_names_uk_UA, + 8, + 9 ); /***** LOCALE END uk_UA *****/ @@ -1639,7 +1745,9 @@ MY_LOCALE my_locale_ur_PK &my_locale_typelib_month_names_ur_PK, &my_locale_typelib_ab_month_names_ur_PK, &my_locale_typelib_day_names_ur_PK, - &my_locale_typelib_ab_day_names_ur_PK + &my_locale_typelib_ab_day_names_ur_PK, + 6, + 6 ); /***** LOCALE END ur_PK *****/ @@ -1669,7 +1777,9 @@ MY_LOCALE my_locale_vi_VN &my_locale_typelib_month_names_vi_VN, &my_locale_typelib_ab_month_names_vi_VN, &my_locale_typelib_day_names_vi_VN, - &my_locale_typelib_ab_day_names_vi_VN + &my_locale_typelib_ab_day_names_vi_VN, + 16, + 11 ); /***** LOCALE END vi_VN *****/ @@ -1699,7 +1809,9 @@ MY_LOCALE my_locale_zh_CN &my_locale_typelib_month_names_zh_CN, &my_locale_typelib_ab_month_names_zh_CN, &my_locale_typelib_day_names_zh_CN, - &my_locale_typelib_ab_day_names_zh_CN + &my_locale_typelib_ab_day_names_zh_CN, + 3, + 3 ); /***** LOCALE END zh_CN *****/ @@ -1729,7 +1841,9 @@ MY_LOCALE my_locale_zh_TW &my_locale_typelib_month_names_zh_TW, &my_locale_typelib_ab_month_names_zh_TW, &my_locale_typelib_day_names_zh_TW, - &my_locale_typelib_ab_day_names_zh_TW + &my_locale_typelib_ab_day_names_zh_TW, + 3, + 2 ); /***** LOCALE END zh_TW *****/ @@ -1743,7 +1857,9 @@ MY_LOCALE my_locale_ar_DZ &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_DZ *****/ @@ -1757,7 +1873,9 @@ MY_LOCALE my_locale_ar_EG &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_EG *****/ @@ -1771,7 +1889,9 @@ MY_LOCALE my_locale_ar_IN &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_IN *****/ @@ -1785,7 +1905,9 @@ MY_LOCALE my_locale_ar_IQ &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_IQ *****/ @@ -1799,7 +1921,9 @@ MY_LOCALE my_locale_ar_KW &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_KW *****/ @@ -1813,7 +1937,9 @@ MY_LOCALE my_locale_ar_LB &my_locale_typelib_month_names_ar_JO, &my_locale_typelib_ab_month_names_ar_JO, &my_locale_typelib_day_names_ar_JO, - &my_locale_typelib_ab_day_names_ar_JO + &my_locale_typelib_ab_day_names_ar_JO, + 12, + 8 ); /***** LOCALE END ar_LB *****/ @@ -1827,7 +1953,9 @@ MY_LOCALE my_locale_ar_LY &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_LY *****/ @@ -1841,7 +1969,9 @@ MY_LOCALE my_locale_ar_MA &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_MA *****/ @@ -1855,7 +1985,9 @@ MY_LOCALE my_locale_ar_OM &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_OM *****/ @@ -1869,7 +2001,9 @@ MY_LOCALE my_locale_ar_QA &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_QA *****/ @@ -1883,7 +2017,9 @@ MY_LOCALE my_locale_ar_SD &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_SD *****/ @@ -1897,7 +2033,9 @@ MY_LOCALE my_locale_ar_TN &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_TN *****/ @@ -1911,7 +2049,9 @@ MY_LOCALE my_locale_ar_YE &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_YE *****/ @@ -1925,7 +2065,9 @@ MY_LOCALE my_locale_de_BE &my_locale_typelib_month_names_de_DE, &my_locale_typelib_ab_month_names_de_DE, &my_locale_typelib_day_names_de_DE, - &my_locale_typelib_ab_day_names_de_DE + &my_locale_typelib_ab_day_names_de_DE, + 9, + 10 ); /***** LOCALE END de_BE *****/ @@ -1939,7 +2081,9 @@ MY_LOCALE my_locale_de_CH &my_locale_typelib_month_names_de_DE, &my_locale_typelib_ab_month_names_de_DE, &my_locale_typelib_day_names_de_DE, - &my_locale_typelib_ab_day_names_de_DE + &my_locale_typelib_ab_day_names_de_DE, + 9, + 10 ); /***** LOCALE END de_CH *****/ @@ -1953,7 +2097,9 @@ MY_LOCALE my_locale_de_LU &my_locale_typelib_month_names_de_DE, &my_locale_typelib_ab_month_names_de_DE, &my_locale_typelib_day_names_de_DE, - &my_locale_typelib_ab_day_names_de_DE + &my_locale_typelib_ab_day_names_de_DE, + 9, + 10 ); /***** LOCALE END de_LU *****/ @@ -1967,7 +2113,9 @@ MY_LOCALE my_locale_en_AU &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, - &my_locale_typelib_ab_day_names_en_US + &my_locale_typelib_ab_day_names_en_US, + 9, + 9 ); /***** LOCALE END en_AU *****/ @@ -1981,7 +2129,9 @@ MY_LOCALE my_locale_en_CA &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, - &my_locale_typelib_ab_day_names_en_US + &my_locale_typelib_ab_day_names_en_US, + 9, + 9 ); /***** LOCALE END en_CA *****/ @@ -1995,7 +2145,9 @@ MY_LOCALE my_locale_en_GB &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, - &my_locale_typelib_ab_day_names_en_US + &my_locale_typelib_ab_day_names_en_US, + 9, + 9 ); /***** LOCALE END en_GB *****/ @@ -2009,7 +2161,9 @@ MY_LOCALE my_locale_en_IN &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, - &my_locale_typelib_ab_day_names_en_US + &my_locale_typelib_ab_day_names_en_US, + 9, + 9 ); /***** LOCALE END en_IN *****/ @@ -2023,7 +2177,9 @@ MY_LOCALE my_locale_en_NZ &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, - &my_locale_typelib_ab_day_names_en_US + &my_locale_typelib_ab_day_names_en_US, + 9, + 9 ); /***** LOCALE END en_NZ *****/ @@ -2037,7 +2193,9 @@ MY_LOCALE my_locale_en_PH &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, - &my_locale_typelib_ab_day_names_en_US + &my_locale_typelib_ab_day_names_en_US, + 9, + 9 ); /***** LOCALE END en_PH *****/ @@ -2051,7 +2209,9 @@ MY_LOCALE my_locale_en_ZA &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, - &my_locale_typelib_ab_day_names_en_US + &my_locale_typelib_ab_day_names_en_US, + 9, + 9 ); /***** LOCALE END en_ZA *****/ @@ -2065,7 +2225,9 @@ MY_LOCALE my_locale_en_ZW &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, - &my_locale_typelib_ab_day_names_en_US + &my_locale_typelib_ab_day_names_en_US, + 9, + 9 ); /***** LOCALE END en_ZW *****/ @@ -2079,7 +2241,9 @@ MY_LOCALE my_locale_es_AR &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_AR *****/ @@ -2093,7 +2257,9 @@ MY_LOCALE my_locale_es_BO &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_BO *****/ @@ -2107,7 +2273,9 @@ MY_LOCALE my_locale_es_CL &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_CL *****/ @@ -2121,7 +2289,9 @@ MY_LOCALE my_locale_es_CO &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_CO *****/ @@ -2135,7 +2305,9 @@ MY_LOCALE my_locale_es_CR &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_CR *****/ @@ -2149,7 +2321,9 @@ MY_LOCALE my_locale_es_DO &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_DO *****/ @@ -2163,7 +2337,9 @@ MY_LOCALE my_locale_es_EC &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_EC *****/ @@ -2177,7 +2353,9 @@ MY_LOCALE my_locale_es_GT &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_GT *****/ @@ -2191,7 +2369,9 @@ MY_LOCALE my_locale_es_HN &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_HN *****/ @@ -2205,7 +2385,9 @@ MY_LOCALE my_locale_es_MX &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_MX *****/ @@ -2219,7 +2401,9 @@ MY_LOCALE my_locale_es_NI &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_NI *****/ @@ -2233,7 +2417,9 @@ MY_LOCALE my_locale_es_PA &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_PA *****/ @@ -2247,7 +2433,9 @@ MY_LOCALE my_locale_es_PE &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_PE *****/ @@ -2261,7 +2449,9 @@ MY_LOCALE my_locale_es_PR &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_PR *****/ @@ -2275,7 +2465,9 @@ MY_LOCALE my_locale_es_PY &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_PY *****/ @@ -2289,7 +2481,9 @@ MY_LOCALE my_locale_es_SV &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_SV *****/ @@ -2303,7 +2497,9 @@ MY_LOCALE my_locale_es_US &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_US *****/ @@ -2317,7 +2513,9 @@ MY_LOCALE my_locale_es_UY &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_UY *****/ @@ -2331,7 +2529,9 @@ MY_LOCALE my_locale_es_VE &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_VE *****/ @@ -2345,7 +2545,9 @@ MY_LOCALE my_locale_fr_BE &my_locale_typelib_month_names_fr_FR, &my_locale_typelib_ab_month_names_fr_FR, &my_locale_typelib_day_names_fr_FR, - &my_locale_typelib_ab_day_names_fr_FR + &my_locale_typelib_ab_day_names_fr_FR, + 9, + 8 ); /***** LOCALE END fr_BE *****/ @@ -2359,7 +2561,9 @@ MY_LOCALE my_locale_fr_CA &my_locale_typelib_month_names_fr_FR, &my_locale_typelib_ab_month_names_fr_FR, &my_locale_typelib_day_names_fr_FR, - &my_locale_typelib_ab_day_names_fr_FR + &my_locale_typelib_ab_day_names_fr_FR, + 9, + 8 ); /***** LOCALE END fr_CA *****/ @@ -2373,7 +2577,9 @@ MY_LOCALE my_locale_fr_CH &my_locale_typelib_month_names_fr_FR, &my_locale_typelib_ab_month_names_fr_FR, &my_locale_typelib_day_names_fr_FR, - &my_locale_typelib_ab_day_names_fr_FR + &my_locale_typelib_ab_day_names_fr_FR, + 9, + 8 ); /***** LOCALE END fr_CH *****/ @@ -2387,7 +2593,9 @@ MY_LOCALE my_locale_fr_LU &my_locale_typelib_month_names_fr_FR, &my_locale_typelib_ab_month_names_fr_FR, &my_locale_typelib_day_names_fr_FR, - &my_locale_typelib_ab_day_names_fr_FR + &my_locale_typelib_ab_day_names_fr_FR, + 9, + 8 ); /***** LOCALE END fr_LU *****/ @@ -2401,7 +2609,9 @@ MY_LOCALE my_locale_it_IT &my_locale_typelib_month_names_it_CH, &my_locale_typelib_ab_month_names_it_CH, &my_locale_typelib_day_names_it_CH, - &my_locale_typelib_ab_day_names_it_CH + &my_locale_typelib_ab_day_names_it_CH, + 9, + 9 ); /***** LOCALE END it_IT *****/ @@ -2415,7 +2625,9 @@ MY_LOCALE my_locale_nl_BE &my_locale_typelib_month_names_nl_NL, &my_locale_typelib_ab_month_names_nl_NL, &my_locale_typelib_day_names_nl_NL, - &my_locale_typelib_ab_day_names_nl_NL + &my_locale_typelib_ab_day_names_nl_NL, + 9, + 9 ); /***** LOCALE END nl_BE *****/ @@ -2429,7 +2641,9 @@ MY_LOCALE my_locale_no_NO &my_locale_typelib_month_names_nb_NO, &my_locale_typelib_ab_month_names_nb_NO, &my_locale_typelib_day_names_nb_NO, - &my_locale_typelib_ab_day_names_nb_NO + &my_locale_typelib_ab_day_names_nb_NO, + 9, + 7 ); /***** LOCALE END no_NO *****/ @@ -2443,7 +2657,9 @@ MY_LOCALE my_locale_sv_FI &my_locale_typelib_month_names_sv_SE, &my_locale_typelib_ab_month_names_sv_SE, &my_locale_typelib_day_names_sv_SE, - &my_locale_typelib_ab_day_names_sv_SE + &my_locale_typelib_ab_day_names_sv_SE, + 9, + 7 ); /***** LOCALE END sv_FI *****/ @@ -2457,7 +2673,9 @@ MY_LOCALE my_locale_zh_HK &my_locale_typelib_month_names_zh_CN, &my_locale_typelib_ab_month_names_zh_CN, &my_locale_typelib_day_names_zh_CN, - &my_locale_typelib_ab_day_names_zh_CN + &my_locale_typelib_ab_day_names_zh_CN, + 3, + 3 ); /***** LOCALE END zh_HK *****/ diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 4b9f3b4241a..b587d172b68 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -979,8 +979,24 @@ bool dispatch_command(enum enum_server_command command, THD *thd, thd->set_time(); VOID(pthread_mutex_lock(&LOCK_thread_count)); thd->query_id= global_query_id; - if (command != COM_STATISTICS && command != COM_PING) + + switch( command ) { + /* Ignore these statements. */ + case COM_STATISTICS: + case COM_PING: + break; + /* Only increase id on these statements but don't count them. */ + case COM_STMT_PREPARE: + case COM_STMT_CLOSE: + case COM_STMT_RESET: next_query_id(); + break; + /* Increase id and count all other statements. */ + default: + statistic_increment(thd->status_var.questions, &LOCK_status); + next_query_id(); + } + thread_running++; /* TODO: set thd->lex->sql_command to SQLCOM_END here */ VOID(pthread_mutex_unlock(&LOCK_thread_count)); @@ -1241,6 +1257,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd, VOID(pthread_mutex_lock(&LOCK_thread_count)); thd->query_length= length; thd->query= beginning_of_next_stmt; + /* + Count each statement from the client. + */ + statistic_increment(thd->status_var.questions, &LOCK_status); thd->query_id= next_query_id(); thd->set_time(); /* Reset the query start time. */ /* TODO: set thd->lex->sql_command to SQLCOM_END here */ diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index dea6030e378..41766d15c2a 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2005, 2006 MySQL AB +/* Copyright 2005-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -4233,9 +4233,8 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, after the change as before. Thus we can reply ok immediately without any changes at all. */ - DBUG_RETURN(fast_end_partition(thd, ULL(0), ULL(0), - table, NULL, - TRUE, NULL, FALSE)); + *fast_alter_partition= TRUE; + DBUG_RETURN(FALSE); } else if (new_part_no > curr_part_no) { @@ -5304,8 +5303,8 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, DDL_LOG_ENTRY ddl_log_entry; partition_info *part_info= lpt->part_info; DDL_LOG_MEMORY_ENTRY *log_entry; - char tmp_path[FN_LEN]; - char normal_path[FN_LEN]; + char tmp_path[FN_REFLEN]; + char normal_path[FN_REFLEN]; List_iterator<partition_element> part_it(part_info->partitions); uint temp_partitions= part_info->temp_partitions.elements; uint no_elements= part_info->partitions.elements; @@ -5516,7 +5515,7 @@ static bool write_log_drop_shadow_frm(ALTER_PARTITION_PARAM_TYPE *lpt) partition_info *part_info= lpt->part_info; DDL_LOG_MEMORY_ENTRY *log_entry; DDL_LOG_MEMORY_ENTRY *exec_log_entry= NULL; - char shadow_path[FN_LEN]; + char shadow_path[FN_REFLEN]; DBUG_ENTER("write_log_drop_shadow_frm"); build_table_shadow_filename(shadow_path, sizeof(shadow_path), lpt); @@ -5559,8 +5558,8 @@ static bool write_log_rename_frm(ALTER_PARTITION_PARAM_TYPE *lpt) partition_info *part_info= lpt->part_info; DDL_LOG_MEMORY_ENTRY *log_entry; DDL_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry; - char path[FN_LEN]; - char shadow_path[FN_LEN]; + char path[FN_REFLEN]; + char shadow_path[FN_REFLEN]; DDL_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->first_log_entry; DBUG_ENTER("write_log_rename_frm"); @@ -5610,8 +5609,8 @@ static bool write_log_drop_partition(ALTER_PARTITION_PARAM_TYPE *lpt) partition_info *part_info= lpt->part_info; DDL_LOG_MEMORY_ENTRY *log_entry; DDL_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry; - char tmp_path[FN_LEN]; - char path[FN_LEN]; + char tmp_path[FN_REFLEN]; + char path[FN_REFLEN]; uint next_entry= 0; DDL_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->first_log_entry; DBUG_ENTER("write_log_drop_partition"); @@ -5669,8 +5668,8 @@ static bool write_log_add_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt) partition_info *part_info= lpt->part_info; DDL_LOG_MEMORY_ENTRY *log_entry; DDL_LOG_MEMORY_ENTRY *exec_log_entry= NULL; - char tmp_path[FN_LEN]; - char path[FN_LEN]; + char tmp_path[FN_REFLEN]; + char path[FN_REFLEN]; uint next_entry= 0; DBUG_ENTER("write_log_add_change_partition"); @@ -5723,8 +5722,8 @@ static bool write_log_final_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt) partition_info *part_info= lpt->part_info; DDL_LOG_MEMORY_ENTRY *log_entry; DDL_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry; - char path[FN_LEN]; - char shadow_path[FN_LEN]; + char path[FN_REFLEN]; + char shadow_path[FN_REFLEN]; DDL_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->first_log_entry; uint next_entry= 0; DBUG_ENTER("write_log_final_change_partition"); @@ -6679,6 +6678,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info, uint32 max_endpoint_val; get_endpoint_func get_endpoint; uint field_len= field->pack_length_in_rec(); + part_iter->ret_null_part= part_iter->ret_null_part_orig= FALSE; if (part_info->part_type == RANGE_PARTITION) { @@ -6699,7 +6699,6 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info, max_endpoint_val= part_info->no_list_values; part_iter->get_next= get_next_partition_id_list; part_iter->part_info= part_info; - part_iter->ret_null_part= part_iter->ret_null_part_orig= FALSE; if (max_endpoint_val == 0) { /* @@ -6761,7 +6760,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info, store_key_image_to_rec(field, max_value, field_len); bool include_endp= !test(flags & NEAR_MAX); part_iter->part_nums.end= get_endpoint(part_info, 0, include_endp); - if (part_iter->part_nums.start == part_iter->part_nums.end && + if (part_iter->part_nums.start >= part_iter->part_nums.end && !part_iter->ret_null_part) return 0; /* No partitions */ } @@ -6939,7 +6938,7 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info, uint32 get_next_partition_id_range(PARTITION_ITERATOR* part_iter) { - if (part_iter->part_nums.cur == part_iter->part_nums.end) + if (part_iter->part_nums.cur >= part_iter->part_nums.end) { part_iter->part_nums.cur= part_iter->part_nums.start; return NOT_A_PARTITION_ID; diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 7d3b6f86b8c..5a961109ab2 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -751,21 +751,22 @@ static bool plugin_add(MEM_ROOT *tmp_root, tmp.name.length= name_len; tmp.ref_count= 0; tmp.state= PLUGIN_IS_UNINITIALIZED; - if (!test_plugin_options(tmp_root, &tmp, argc, argv, true)) + if (test_plugin_options(tmp_root, &tmp, argc, argv, true)) + tmp.state= PLUGIN_IS_DISABLED; + + if ((tmp_plugin_ptr= plugin_insert_or_reuse(&tmp))) { - if ((tmp_plugin_ptr= plugin_insert_or_reuse(&tmp))) + plugin_array_version++; + if (!my_hash_insert(&plugin_hash[plugin->type], (uchar*)tmp_plugin_ptr)) { - plugin_array_version++; - if (!my_hash_insert(&plugin_hash[plugin->type], (uchar*)tmp_plugin_ptr)) - { - init_alloc_root(&tmp_plugin_ptr->mem_root, 4096, 4096); - DBUG_RETURN(FALSE); - } - tmp_plugin_ptr->state= PLUGIN_IS_FREED; + init_alloc_root(&tmp_plugin_ptr->mem_root, 4096, 4096); + DBUG_RETURN(FALSE); } - mysql_del_sys_var_chain(tmp.system_vars); - goto err; + tmp_plugin_ptr->state= PLUGIN_IS_FREED; } + mysql_del_sys_var_chain(tmp.system_vars); + goto err; + /* plugin was disabled */ plugin_dl_del(dl); DBUG_RETURN(FALSE); @@ -1145,11 +1146,12 @@ int plugin_init(int *argc, char **argv, int flags) tmp.plugin= plugin; tmp.name.str= (char *)plugin->name; tmp.name.length= strlen(plugin->name); - + tmp.state= 0; free_root(&tmp_root, MYF(MY_MARK_BLOCKS_FREE)); if (test_plugin_options(&tmp_root, &tmp, argc, argv, def_enabled)) - continue; - + tmp.state= PLUGIN_IS_DISABLED; + else + tmp.state= PLUGIN_IS_UNINITIALIZED; if (register_builtin(plugin, &tmp, &plugin_ptr)) goto err_unlock; @@ -1159,7 +1161,8 @@ int plugin_init(int *argc, char **argv, int flags) my_strcasecmp(&my_charset_latin1, plugin->name, "CSV")) continue; - if (plugin_initialize(plugin_ptr)) + if (plugin_ptr->state == PLUGIN_IS_UNINITIALIZED && + plugin_initialize(plugin_ptr)) goto err_unlock; /* @@ -1246,8 +1249,6 @@ static bool register_builtin(struct st_mysql_plugin *plugin, struct st_plugin_int **ptr) { DBUG_ENTER("register_builtin"); - - tmp->state= PLUGIN_IS_UNINITIALIZED; tmp->ref_count= 0; tmp->plugin_dl= 0; @@ -1296,7 +1297,7 @@ bool plugin_register_builtin(THD *thd, struct st_mysql_plugin *plugin) if (test_plugin_options(thd->mem_root, &tmp, &dummy_argc, NULL, true)) goto end; - + tmp.state= PLUGIN_IS_UNINITIALIZED; if ((result= register_builtin(plugin, &tmp, &ptr))) mysql_del_sys_var_chain(tmp.system_vars); @@ -1534,7 +1535,7 @@ void plugin_shutdown(void) } } - if (count > free_slots) + if (count > free_slots && global_system_variables.log_warnings > 1) sql_print_warning("Forcing shutdown of %d plugins", count - free_slots); plugins= (struct st_plugin_int **) my_alloca(sizeof(void*) * (count+1)); @@ -1555,7 +1556,8 @@ void plugin_shutdown(void) We loop through all plugins and call deinit() if they have one. */ for (i= 0; i < count; i++) - if (!(plugins[i]->state & (PLUGIN_IS_UNINITIALIZED | PLUGIN_IS_FREED))) + if (!(plugins[i]->state & (PLUGIN_IS_UNINITIALIZED | PLUGIN_IS_FREED | + PLUGIN_IS_DISABLED))) { sql_print_information("Plugin '%s' will be forced to shutdown", plugins[i]->name.str); diff --git a/sql/sql_plugin.h b/sql/sql_plugin.h index e8f2cb6ee5e..8ae38d58845 100644 --- a/sql/sql_plugin.h +++ b/sql/sql_plugin.h @@ -54,6 +54,7 @@ typedef struct st_mysql_show_var SHOW_VAR; #define PLUGIN_IS_UNINITIALIZED 4 #define PLUGIN_IS_READY 8 #define PLUGIN_IS_DYING 16 +#define PLUGIN_IS_DISABLED 32 /* A handle for the dynamic library containing a plugin or plugins. */ diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc index 6f234a2a626..320360b2587 100644 --- a/sql/sql_profile.cc +++ b/sql/sql_profile.cc @@ -549,8 +549,8 @@ int PROFILING::fill_statistics_info(THD *thd, TABLE_LIST *tables, Item *cond) The order of these fields is set by the query_profile_statistics_info array. */ - table->field[0]->store((ulonglong) query->profiling_query_id); - table->field[1]->store((ulonglong) seq); /* the step in the sequence */ + table->field[0]->store((ulonglong) query->profiling_query_id, TRUE); + table->field[1]->store((ulonglong) seq, TRUE); /* the step in the sequence */ /* This entry, n, has a point in time, T(n), and a status phrase, S(n). The status phrase S(n) describes the period of time that begins at diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 126bc7c03b3..14088961ea2 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -63,7 +63,7 @@ static int fake_rotate_event(NET* net, String* packet, char* log_file_name, ulong event_len = ident_len + LOG_EVENT_HEADER_LEN + ROTATE_HEADER_LEN; int4store(header + SERVER_ID_OFFSET, server_id); int4store(header + EVENT_LEN_OFFSET, event_len); - int2store(header + FLAGS_OFFSET, 0); + int2store(header + FLAGS_OFFSET, LOG_EVENT_ARTIFICIAL_F); // TODO: check what problems this may cause and fix them int4store(header + LOG_POS_OFFSET, 0); @@ -257,6 +257,17 @@ bool purge_error_message(THD* thd, int res) } +/** + Execute a PURGE BINARY LOGS TO <log> command. + + @param thd Pointer to THD object for the client thread executing the + statement. + + @param to_log Name of the last log to purge. + + @retval FALSE success + @retval TRUE failure +*/ bool purge_master_logs(THD* thd, const char* to_log) { char search_file_name[FN_REFLEN]; @@ -273,6 +284,17 @@ bool purge_master_logs(THD* thd, const char* to_log) } +/** + Execute a PURGE BINARY LOGS BEFORE <date> command. + + @param thd Pointer to THD object for the client thread executing the + statement. + + @param purge_time Date before which logs should be purged. + + @retval FALSE success + @retval TRUE failure +*/ bool purge_master_logs_before_date(THD* thd, time_t purge_time) { if (!mysql_bin_log.is_open()) @@ -765,6 +787,20 @@ err: DBUG_VOID_RETURN; } + +/** + Execute a START SLAVE statement. + + @param thd Pointer to THD object for the client thread executing the + statement. + + @param mi Pointer to Master_info object for the slave's IO thread. + + @param net_report If true, saves the exit status into thd->main_da. + + @retval 0 success + @retval 1 error +*/ int start_slave(THD* thd , Master_info* mi, bool net_report) { int slave_errno= 0; @@ -890,6 +926,19 @@ int start_slave(THD* thd , Master_info* mi, bool net_report) } +/** + Execute a STOP SLAVE statement. + + @param thd Pointer to THD object for the client thread executing the + statement. + + @param mi Pointer to Master_info object for the slave's IO thread. + + @param net_report If true, saves the exit status into thd->main_da. + + @retval 0 success + @retval 1 error +*/ int stop_slave(THD* thd, Master_info* mi, bool net_report ) { DBUG_ENTER("stop_slave"); @@ -942,20 +991,17 @@ int stop_slave(THD* thd, Master_info* mi, bool net_report ) } -/* - Remove all relay logs and start replication from the start - - SYNOPSIS - reset_slave() - thd Thread handler - mi Master info for the slave +/** + Execute a RESET SLAVE statement. - RETURN - 0 ok - 1 error -*/ + @param thd Pointer to THD object of the client thread executing the + statement. + @param mi Pointer to Master_info object for the slave. + @retval 0 success + @retval 1 error +*/ int reset_slave(THD *thd, Master_info* mi) { MY_STAT stat_area; @@ -1070,6 +1116,18 @@ void kill_zombie_dump_threads(uint32 slave_server_id) } +/** + Execute a CHANGE MASTER statement. + + @param thd Pointer to THD object for the client thread executing the + statement. + + @param mi Pointer to Master_info object belonging to the slave's IO + thread. + + @retval FALSE success + @retval TRUE error +*/ bool change_master(THD* thd, Master_info* mi) { int thread_mask; @@ -1283,6 +1341,16 @@ bool change_master(THD* thd, Master_info* mi) DBUG_RETURN(FALSE); } + +/** + Execute a RESET MASTER statement. + + @param thd Pointer to THD object of the client thread executing the + statement. + + @retval 0 success + @retval 1 error +*/ int reset_master(THD* thd) { if (!mysql_bin_log.is_open()) @@ -1312,6 +1380,15 @@ int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1, } +/** + Execute a SHOW BINLOG EVENTS statement. + + @param thd Pointer to THD object for the client thread executing the + statement. + + @retval FALSE success + @retval TRUE failure +*/ bool mysql_show_binlog_events(THD* thd) { Protocol *protocol= thd->protocol; @@ -1462,6 +1539,15 @@ err: } +/** + Execute a SHOW MASTER STATUS statement. + + @param thd Pointer to THD object for the client thread executing the + statement. + + @retval FALSE success + @retval TRUE failure +*/ bool show_binlog_info(THD* thd) { Protocol *protocol= thd->protocol; @@ -1495,18 +1581,15 @@ bool show_binlog_info(THD* thd) } -/* - Send a list of all binary logs to client +/** + Execute a SHOW BINARY LOGS statement. - SYNOPSIS - show_binlogs() - thd Thread specific variable + @param thd Pointer to THD object for the client thread executing the + statement. - RETURN VALUES - FALSE OK - TRUE error + @retval FALSE success + @retval TRUE failure */ - bool show_binlogs(THD* thd) { IO_CACHE *index_file; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 828656005e7..5f755660c65 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1677,8 +1677,11 @@ JOIN::exec() (zero_result_cause?zero_result_cause:"No tables used")); else { - result->send_fields(*columns_list, - Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF); + if (result->send_fields(*columns_list, + Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) + { + DBUG_VOID_RETURN; + } /* We have to test for 'conds' here as the WHERE may not be constant even if we don't have any tables for prepared statements or if @@ -2606,7 +2609,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds, if (s->dependent & table->map) s->dependent |= table->reginfo.join_tab->dependent; } - if (s->dependent) + if (outer_join & s->table->map) s->table->maybe_null= 1; } /* Catch illegal cross references for outer joins */ @@ -14063,6 +14066,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count) length=0; for (i=0 ; i < table_count ; i++) { + bool have_bit_fields= FALSE; uint null_fields=0,used_fields; Field **f_ptr,*field; MY_BITMAP *read_set= tables[i].table->read_set; @@ -14077,13 +14081,16 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count) length+=field->fill_cache_field(copy); if (copy->blob_field) (*blob_ptr++)=copy; - if (field->maybe_null()) + if (field->real_maybe_null()) null_fields++; + if (field->type() == MYSQL_TYPE_BIT && + ((Field_bit*)field)->bit_len) + have_bit_fields= TRUE; copy++; } } /* Copy null bits from table */ - if (null_fields && tables[i].table->s->null_fields) + if (null_fields || have_bit_fields) { /* must copy null bits */ copy->str= tables[i].table->null_flags; copy->length= tables[i].table->s->null_bytes; diff --git a/sql/sql_select.h b/sql/sql_select.h index c8922d9045e..eacd3d39905 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -285,7 +285,11 @@ public: fetching data from a cursor */ bool resume_nested_loop; - table_map const_table_map,found_const_table_map,outer_join; + table_map const_table_map,found_const_table_map; + /* + Bitmap of all inner tables from outer joins + */ + table_map outer_join; ha_rows send_records,found_records,examined_rows,row_limit, select_limit; /** Used to fetch no more than given amount of rows per one diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 570a98b3aa3..697a9d42bca 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2004 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -112,7 +112,6 @@ static my_bool show_plugins(THD *thd, plugin_ref plugin, make_version_string(version_buf, sizeof(version_buf), plug->version), cs); - switch (plugin_state(plugin)) { /* case PLUGIN_IS_FREED: does not happen */ case PLUGIN_IS_DELETED: @@ -124,6 +123,9 @@ static my_bool show_plugins(THD *thd, plugin_ref plugin, case PLUGIN_IS_READY: table->field[2]->store(STRING_WITH_LEN("ACTIVE"), cs); break; + case PLUGIN_IS_DISABLED: + table->field[2]->store(STRING_WITH_LEN("DISABLED"), cs); + break; default: DBUG_ASSERT(0); } @@ -471,6 +473,7 @@ find_files(THD *thd, List<LEX_STRING> *files, const char *db, if (wild && !wild[0]) wild=0; + bzero((char*) &table_list,sizeof(table_list)); if (!(dirp = my_dir(path,MYF(dir ? MY_WANT_STAT : 0)))) @@ -993,15 +996,14 @@ static bool get_field_default_value(THD *thd, TABLE *table, { bool has_default; bool has_now_default; - + enum enum_field_types field_type= field->type(); /* - We are using CURRENT_TIMESTAMP instead of NOW because it is - more standard + We are using CURRENT_TIMESTAMP instead of NOW because it is + more standard */ has_now_default= table->timestamp_field == field && field->unireg_check != Field::TIMESTAMP_UN_FIELD; - - has_default= (field->type() != FIELD_TYPE_BLOB && + has_default= (field_type != FIELD_TYPE_BLOB && !(field->flags & NO_DEFAULT_VALUE_FLAG) && field->unireg_check != Field::NEXT_NUMBER && !((thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40)) @@ -1016,7 +1018,19 @@ static bool get_field_default_value(THD *thd, TABLE *table, { // Not null by default char tmp[MAX_FIELD_WIDTH]; String type(tmp, sizeof(tmp), field->charset()); - field->val_str(&type); + if (field_type == MYSQL_TYPE_BIT) + { + longlong dec= field->val_int(); + char *ptr= longlong2str(dec, tmp + 2, 2); + uint32 length= (uint32) (ptr - tmp); + tmp[0]= 'b'; + tmp[1]= '\''; + tmp[length]= '\''; + type.length(length + 1); + quoted= 0; + } + else + field->val_str(&type); if (type.length()) { String def_val; @@ -2092,7 +2106,7 @@ static bool show_status_array(THD *thd, const char *wild, CHARSET_INFO *charset= system_charset_info; DBUG_ENTER("show_status_array"); - thd->count_cuted_fields= CHECK_FIELD_WARN; + thd->count_cuted_fields= CHECK_FIELD_WARN; null_lex_str.str= 0; // For sys_var->value_ptr() null_lex_str.length= 0; @@ -3571,6 +3585,11 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables, ptr=strxmov(ptr, " row_format=", ha_row_type[(uint) share->row_type], NullS); + if (share->key_block_size) + { + ptr= strmov(ptr, " key_block_size="); + ptr= longlong10_to_str(share->key_block_size, ptr, 10); + } #ifdef WITH_PARTITION_STORAGE_ENGINE if (is_partitioned) ptr= strmov(ptr, " partitioned"); @@ -3907,6 +3926,25 @@ static my_bool iter_schema_engines(THD *thd, plugin_ref plugin, handlerton *default_type= ha_default_handlerton(thd); DBUG_ENTER("iter_schema_engines"); + + /* Disabled plugins */ + if (plugin_state(plugin) != PLUGIN_IS_READY) + { + + struct st_mysql_plugin *plug= plugin_decl(plugin); + if (!(wild && wild[0] && + wild_case_compare(scs, plug->name,wild))) + { + restore_record(table, s->default_values); + table->field[0]->store(plug->name, strlen(plug->name), scs); + table->field[1]->store(C_STRING_WITH_LEN("NO"), scs); + table->field[2]->store(plug->descr, strlen(plug->descr), scs); + if (schema_table_store_record(thd, table)) + DBUG_RETURN(1); + } + DBUG_RETURN(0); + } + if (!(hton->flags & HTON_HIDDEN)) { LEX_STRING *name= plugin_name(plugin); @@ -3927,10 +3965,13 @@ static my_bool iter_schema_engines(THD *thd, plugin_ref plugin, strlen(plugin_decl(plugin)->descr), scs); tmp= &yesno[test(hton->commit)]; table->field[3]->store(tmp->str, tmp->length, scs); + table->field[3]->set_notnull(); tmp= &yesno[test(hton->prepare)]; table->field[4]->store(tmp->str, tmp->length, scs); + table->field[4]->set_notnull(); tmp= &yesno[test(hton->savepoint_set)]; table->field[5]->store(tmp->str, tmp->length, scs); + table->field[5]->set_notnull(); if (schema_table_store_record(thd, table)) DBUG_RETURN(1); @@ -3941,8 +3982,12 @@ static my_bool iter_schema_engines(THD *thd, plugin_ref plugin, int fill_schema_engines(THD *thd, TABLE_LIST *tables, COND *cond) { - return plugin_foreach(thd, iter_schema_engines, - MYSQL_STORAGE_ENGINE_PLUGIN, tables->table); + DBUG_ENTER("fill_schema_engines"); + if (plugin_foreach_with_mask(thd, iter_schema_engines, + MYSQL_STORAGE_ENGINE_PLUGIN, + ~PLUGIN_IS_FREED, tables->table)) + DBUG_RETURN(1); + DBUG_RETURN(0); } @@ -5362,7 +5407,7 @@ get_referential_constraints_record(THD *thd, TABLE_LIST *tables, f_key_info->referenced_table->length, cs); if (f_key_info->referenced_key_name) { - table->field[5]->store(f_key_info->referenced_key_name->str, + table->field[5]->store(f_key_info->referenced_key_name->str, f_key_info->referenced_key_name->length, cs); table->field[5]->set_notnull(); } @@ -6139,9 +6184,9 @@ ST_FIELD_INFO engines_fields_info[]= {"ENGINE", 64, MYSQL_TYPE_STRING, 0, 0, "Engine", SKIP_OPEN_TABLE}, {"SUPPORT", 8, MYSQL_TYPE_STRING, 0, 0, "Support", SKIP_OPEN_TABLE}, {"COMMENT", 80, MYSQL_TYPE_STRING, 0, 0, "Comment", SKIP_OPEN_TABLE}, - {"TRANSACTIONS", 3, MYSQL_TYPE_STRING, 0, 0, "Transactions", SKIP_OPEN_TABLE}, - {"XA", 3, MYSQL_TYPE_STRING, 0, 0, "XA", SKIP_OPEN_TABLE}, - {"SAVEPOINTS", 3 ,MYSQL_TYPE_STRING, 0, 0, "Savepoints", SKIP_OPEN_TABLE}, + {"TRANSACTIONS", 3, MYSQL_TYPE_STRING, 0, 1, "Transactions", SKIP_OPEN_TABLE}, + {"XA", 3, MYSQL_TYPE_STRING, 0, 1, "XA", SKIP_OPEN_TABLE}, + {"SAVEPOINTS", 3 ,MYSQL_TYPE_STRING, 0, 1, "Savepoints", SKIP_OPEN_TABLE}, {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} }; @@ -6641,7 +6686,7 @@ ST_SCHEMA_TABLE schema_tables[]= {"PROCESSLIST", processlist_fields_info, create_schema_table, fill_schema_processlist, make_old_format, 0, -1, -1, 0, 0}, {"PROFILING", query_profile_statistics_info, create_schema_table, - fill_query_profile_statistics_info, make_profile_table_for_show, + fill_query_profile_statistics_info, make_profile_table_for_show, NULL, -1, -1, false, 0}, {"REFERENTIAL_CONSTRAINTS", referential_constraints_fields_info, create_schema_table, get_all_tables, 0, get_referential_constraints_record, @@ -6656,12 +6701,12 @@ ST_SCHEMA_TABLE schema_tables[]= fill_status, make_old_format, 0, 0, -1, 0, 0}, {"SESSION_VARIABLES", variables_fields_info, create_schema_table, fill_variables, make_old_format, 0, 0, -1, 0, 0}, - {"STATISTICS", stat_fields_info, create_schema_table, + {"STATISTICS", stat_fields_info, create_schema_table, get_all_tables, make_old_format, get_schema_stat_record, 1, 2, 0, OPEN_TABLE_ONLY|OPTIMIZE_I_S_TABLE}, - {"STATUS", variables_fields_info, create_schema_table, fill_status, + {"STATUS", variables_fields_info, create_schema_table, fill_status, make_old_format, 0, 0, -1, 1, 0}, - {"TABLES", tables_fields_info, create_schema_table, + {"TABLES", tables_fields_info, create_schema_table, get_all_tables, make_old_format, get_schema_tables_record, 1, 2, 0, OPTIMIZE_I_S_TABLE}, {"TABLE_CONSTRAINTS", table_constraints_fields_info, create_schema_table, @@ -6677,7 +6722,7 @@ ST_SCHEMA_TABLE schema_tables[]= fill_schema_user_privileges, 0, 0, -1, -1, 0, 0}, {"VARIABLES", variables_fields_info, create_schema_table, fill_variables, make_old_format, 0, 0, -1, 1, 0}, - {"VIEWS", view_fields_info, create_schema_table, + {"VIEWS", view_fields_info, create_schema_table, get_all_tables, 0, get_schema_views_record, 1, 2, 0, OPEN_VIEW_ONLY|OPTIMIZE_I_S_TABLE}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} diff --git a/sql/sql_show.h b/sql/sql_show.h index 3baaef00a7d..fa067a46033 100644 --- a/sql/sql_show.h +++ b/sql/sql_show.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2006 MySQL AB +/* Copyright 2006-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_table.cc b/sql/sql_table.cc index e91a82a0b1d..47440c2cfe4 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2004 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -114,6 +114,30 @@ uint filename_to_tablename(const char *from, char *to, uint to_length) } +/** + Check if given string begins with "#mysql50#" prefix, cut it if so. + + @param from string to check and cut + @param to[out] buffer for result string + @param to_length its size + + @retval + 0 no prefix found + @retval + non-0 result string length +*/ + +uint check_n_cut_mysql50_prefix(const char *from, char *to, uint to_length) +{ + if (from[0] == '#' && + !strncmp(from, MYSQL50_TABLE_NAME_PREFIX, + MYSQL50_TABLE_NAME_PREFIX_LENGTH)) + return (uint) (strmake(to, from + MYSQL50_TABLE_NAME_PREFIX_LENGTH, + to_length - 1) - to); + return 0; +} + + /* Translate a table name to a file name (WL #1324). @@ -133,11 +157,8 @@ uint tablename_to_filename(const char *from, char *to, uint to_length) DBUG_ENTER("tablename_to_filename"); DBUG_PRINT("enter", ("from '%s'", from)); - if (from[0] == '#' && !strncmp(from, MYSQL50_TABLE_NAME_PREFIX, - MYSQL50_TABLE_NAME_PREFIX_LENGTH)) - DBUG_RETURN((uint) (strmake(to, from+MYSQL50_TABLE_NAME_PREFIX_LENGTH, - to_length-1) - - (from + MYSQL50_TABLE_NAME_PREFIX_LENGTH))); + if ((length= check_n_cut_mysql50_prefix(from, to, to_length))) + DBUG_RETURN(length); length= strconvert(system_charset_info, from, &my_charset_filename, to, to_length, &errors); if (check_if_legal_tablename(to) && @@ -3111,10 +3132,12 @@ static bool prepare_blob_field(THD *thd, Create_field *sql_field) push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_AUTO_CONVERT, warn_buff); } - + if ((sql_field->flags & BLOB_FLAG) && sql_field->length) { - if (sql_field->sql_type == MYSQL_TYPE_BLOB) + if (sql_field->sql_type == FIELD_TYPE_BLOB || + sql_field->sql_type == FIELD_TYPE_TINY_BLOB || + sql_field->sql_type == FIELD_TYPE_MEDIUM_BLOB) { /* The user has given a length to the blob column */ sql_field->sql_type= get_blob_type_from_length(sql_field->length); @@ -3426,14 +3449,6 @@ bool mysql_create_table_no_lock(THD *thd, } else { - #ifdef FN_DEVCHAR - /* check if the table name contains FN_DEVCHAR when defined */ - if (strchr(alias, FN_DEVCHAR)) - { - my_error(ER_WRONG_TABLE_NAME, MYF(0), alias); - DBUG_RETURN(TRUE); - } -#endif path_length= build_table_filename(path, sizeof(path), db, alias, reg_ext, internal_tmp_table ? FN_IS_TMP : 0); } @@ -4328,6 +4343,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, table->table=0; // For query cache if (protocol->write()) goto err; + thd->main_da.reset_diagnostics_area(); continue; /* purecov: end */ } @@ -5881,7 +5897,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, if (key_info->flags & HA_USES_BLOCK_SIZE) key_create_info.block_size= key_info->block_size; if (key_info->flags & HA_USES_PARSER) - key_create_info.parser_name= *key_info->parser_name; + key_create_info.parser_name= *plugin_name(key_info->parser); if (key_info->flags & HA_SPATIAL) key_type= Key::SPATIAL; diff --git a/sql/sql_test.cc b/sql/sql_test.cc index 01363714484..78932396efe 100644 --- a/sql/sql_test.cc +++ b/sql/sql_test.cc @@ -513,7 +513,7 @@ Next alarm time: %lu\n", fprintf(stdout,"\nBegin safemalloc memory dump:\n"); // tag needed for test suite TERMINATE(stdout, 1); // Write malloc information fprintf(stdout,"\nEnd safemalloc memory dump.\n"); - + fflush(stdout); #ifdef HAVE_MALLINFO struct mallinfo info= mallinfo(); printf("\nMemory status:\n\ diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 7fe487c87cf..bad8db56f02 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -1368,15 +1368,27 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, if (triggers->on_table_names_list.push_back(on_table_name, &table->mem_root)) goto err_with_lex_cleanup; - +#ifndef DBUG_OFF /* Let us check that we correctly update trigger definitions when we rename tables with triggers. + + In special cases like "RENAME TABLE `#mysql50#somename` TO `somename`" + or "ALTER DATABASE `#mysql50#somename` UPGRADE DATA DIRECTORY NAME" + we might be given table or database name with "#mysql50#" prefix (and + trigger's definiton contains un-prefixed version of the same name). + To remove this prefix we use check_n_cut_mysql50_prefix(). */ - DBUG_ASSERT(!my_strcasecmp(table_alias_charset, lex.query_tables->db, db) && - !my_strcasecmp(table_alias_charset, lex.query_tables->table_name, - table_name)); + char fname[NAME_LEN + 1]; + DBUG_ASSERT((!my_strcasecmp(table_alias_charset, lex.query_tables->db, db) || + (check_n_cut_mysql50_prefix(db, fname, sizeof(fname)) && + !my_strcasecmp(table_alias_charset, lex.query_tables->db, fname))) && + (!my_strcasecmp(table_alias_charset, lex.query_tables->table_name, + table_name) || + (check_n_cut_mysql50_prefix(table_name, fname, sizeof(fname)) && + !my_strcasecmp(table_alias_charset, lex.query_tables->table_name, fname)))); +#endif if (names_only) { lex_end(&lex); @@ -1692,7 +1704,8 @@ end: (change name of table in triggers' definitions). @param thd Thread context - @param db_name Database of subject table + @param old_db_name Old database of subject table + @param new_db_name New database of subject table @param old_table_name Old subject table's name @param new_table_name New subject table's name @@ -1704,7 +1717,8 @@ end: bool Table_triggers_list::change_table_name_in_triggers(THD *thd, - const char *db_name, + const char *old_db_name, + const char *new_db_name, LEX_STRING *old_table_name, LEX_STRING *new_table_name) { @@ -1757,11 +1771,11 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd, if (thd->is_fatal_error) return TRUE; /* OOM */ - if (save_trigger_file(this, db_name, new_table_name->str)) + if (save_trigger_file(this, new_db_name, new_table_name->str)) return TRUE; - if (rm_trigger_file(path_buff, db_name, old_table_name->str)) + if (rm_trigger_file(path_buff, old_db_name, old_table_name->str)) { - (void) rm_trigger_file(path_buff, db_name, new_table_name->str); + (void) rm_trigger_file(path_buff, new_db_name, new_table_name->str); return TRUE; } return FALSE; @@ -1772,7 +1786,8 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd, Iterate though Table_triggers_list::names_list list and update .TRN files after renaming triggers' subject table. - @param db_name Database of subject table + @param old_db_name Old database of subject table + @param new_db_name New database of subject table @param new_table_name New subject table's name @param stopper Pointer to Table_triggers_list::names_list at which we should stop updating. @@ -1785,7 +1800,8 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd, */ LEX_STRING* -Table_triggers_list::change_table_name_in_trignames(const char *db_name, +Table_triggers_list::change_table_name_in_trignames(const char *old_db_name, + const char *new_db_name, LEX_STRING *new_table_name, LEX_STRING *stopper) { @@ -1798,7 +1814,7 @@ Table_triggers_list::change_table_name_in_trignames(const char *db_name, while ((trigger= it_name++) != stopper) { trigname_file.length= build_table_filename(trigname_buff, FN_REFLEN-1, - db_name, trigger->str, + new_db_name, trigger->str, TRN_EXT, 0); trigname_file.str= trigname_buff; @@ -1807,6 +1823,16 @@ Table_triggers_list::change_table_name_in_trignames(const char *db_name, if (sql_create_definition_file(NULL, &trigname_file, &trigname_file_type, (uchar*)&trigname, trigname_file_parameters)) return trigger; + + /* Remove stale .TRN file in case of database upgrade */ + if (old_db_name) + { + if (rm_trigname_file(trigname_buff, old_db_name, trigger->str)) + { + (void) rm_trigname_file(trigname_buff, new_db_name, trigger->str); + return trigger; + } + } } return 0; @@ -1840,6 +1866,7 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db, { TABLE table; bool result= 0; + bool upgrading50to51= FALSE; LEX_STRING *err_trigname; DBUG_ENTER("change_table_name"); @@ -1877,14 +1904,27 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db, moving table with them between two schemas raises too many questions. (E.g. what should happen if in new schema we already have trigger with same name ?). + + In case of "ALTER DATABASE `#mysql50#db1` UPGRADE DATA DIRECTORY NAME" + we will be given table name with "#mysql50#" prefix + To remove this prefix we use check_n_cut_mysql50_prefix(). */ if (my_strcasecmp(table_alias_charset, db, new_db)) { - my_error(ER_TRG_IN_WRONG_SCHEMA, MYF(0)); - result= 1; - goto end; + char dbname[NAME_LEN + 1]; + if (check_n_cut_mysql50_prefix(db, dbname, sizeof(dbname)) && + !my_strcasecmp(table_alias_charset, dbname, new_db)) + { + upgrading50to51= TRUE; + } + else + { + my_error(ER_TRG_IN_WRONG_SCHEMA, MYF(0)); + result= 1; + goto end; + } } - if (table.triggers->change_table_name_in_triggers(thd, db, + if (table.triggers->change_table_name_in_triggers(thd, db, new_db, &old_table_name, &new_table_name)) { @@ -1892,7 +1932,8 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db, goto end; } if ((err_trigname= table.triggers->change_table_name_in_trignames( - db, &new_table_name, 0))) + upgrading50to51 ? db : NULL, + new_db, &new_table_name, 0))) { /* If we were unable to update one of .TRN files properly we will @@ -1900,16 +1941,17 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db, We assume that we will be able to undo our changes without errors (we can't do much if there will be an error anyway). */ - (void) table.triggers->change_table_name_in_trignames(db, - &old_table_name, - err_trigname); - (void) table.triggers->change_table_name_in_triggers(thd, db, - &new_table_name, - &old_table_name); + (void) table.triggers->change_table_name_in_trignames( + upgrading50to51 ? new_db : NULL, db, + &old_table_name, err_trigname); + (void) table.triggers->change_table_name_in_triggers( + thd, db, new_db, + &new_table_name, &old_table_name); result= 1; goto end; } } + end: delete table.triggers; free_root(&table.mem_root, MYF(0)); diff --git a/sql/sql_trigger.h b/sql/sql_trigger.h index 1b0edf6bea8..f6754a75284 100644 --- a/sql/sql_trigger.h +++ b/sql/sql_trigger.h @@ -146,11 +146,13 @@ public: private: bool prepare_record1_accessors(TABLE *table); - LEX_STRING* change_table_name_in_trignames(const char *db_name, + LEX_STRING* change_table_name_in_trignames(const char *old_db_name, + const char *new_db_name, LEX_STRING *new_table_name, LEX_STRING *stopper); bool change_table_name_in_triggers(THD *thd, - const char *db_name, + const char *old_db_name, + const char *new_db_name, LEX_STRING *old_table_name, LEX_STRING *new_table_name); }; diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 050deeaf0ae..68a614c710e 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 91d486fc38c..2de3a5d67a9 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 00099fa6a79..4bbee0ba696 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/table.cc b/sql/table.cc index 6355d46f4d5..c4c12208719 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -400,6 +400,8 @@ void init_tmp_table_share(THD *thd, TABLE_SHARE *share, const char *key, void free_table_share(TABLE_SHARE *share) { MEM_ROOT mem_root; + uint idx; + KEY *key_info; DBUG_ENTER("free_table_share"); DBUG_PRINT("enter", ("table: %s.%s", share->db.str, share->table_name.str)); DBUG_ASSERT(share->ref_count == 0); @@ -426,6 +428,16 @@ void free_table_share(TABLE_SHARE *share) plugin_unlock(NULL, share->db_plugin); share->db_plugin= NULL; + /* Release fulltext parsers */ + key_info= share->key_info; + for (idx= share->keys; idx; idx--, key_info++) + { + if (key_info->flags & HA_USES_PARSER) + { + plugin_unlock(NULL, key_info->parser); + key_info->flags= 0; + } + } /* We must copy mem_root from share because share is allocated through it */ memcpy((char*) &mem_root, (char*) &share->mem_root, sizeof(mem_root)); free_root(&mem_root, MYF(0)); // Free's share @@ -1416,7 +1428,9 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, */ if (ha_option & HA_PRIMARY_KEY_IN_READ_INDEX) { - field->part_of_key= share->keys_in_use; + if (field->key_length() == key_part->length && + !(field->flags & BLOB_FLAG)) + field->part_of_key= share->keys_in_use; if (field->part_of_sortkey.is_set(key)) field->part_of_sortkey= share->keys_in_use; } @@ -1941,22 +1955,11 @@ partititon_err: int closefrm(register TABLE *table, bool free_share) { int error=0; - uint idx; - KEY *key_info; DBUG_ENTER("closefrm"); DBUG_PRINT("enter", ("table: 0x%lx", (long) table)); if (table->db_stat) error=table->file->close(); - key_info= table->key_info; - for (idx= table->s->keys; idx; idx--, key_info++) - { - if (key_info->flags & HA_USES_PARSER) - { - plugin_unlock(NULL, key_info->parser); - key_info->flags= 0; - } - } my_free((char*) table->alias, MYF(MY_ALLOW_ZERO_PTR)); table->alias= 0; if (table->field) diff --git a/sql/table.h b/sql/table.h index 1cdc1381eb5..97840d2a1c6 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1691,5 +1691,35 @@ static inline void dbug_tmp_restore_column_map(MY_BITMAP *bitmap, #endif } + +/* + Variant of the above : handle both read and write sets. + Provide for the possiblity of the read set being the same as the write set +*/ +static inline void dbug_tmp_use_all_columns(TABLE *table, + my_bitmap_map **save, + MY_BITMAP *read_set, + MY_BITMAP *write_set) +{ +#ifndef DBUG_OFF + save[0]= read_set->bitmap; + save[1]= write_set->bitmap; + (void) tmp_use_all_columns(table, read_set); + (void) tmp_use_all_columns(table, write_set); +#endif +} + + +static inline void dbug_tmp_restore_column_maps(MY_BITMAP *read_set, + MY_BITMAP *write_set, + my_bitmap_map **old) +{ +#ifndef DBUG_OFF + tmp_restore_column_map(read_set, old[0]); + tmp_restore_column_map(write_set, old[1]); +#endif +} + + size_t max_row_length(TABLE *table, const uchar *data); diff --git a/sql/unireg.cc b/sql/unireg.cc index 10446c036ec..cbe09889b39 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -204,6 +204,24 @@ bool mysql_create_frm(THD *thd, const char *file_name, (create_info->min_rows == 1) && (keys == 0)); int2store(fileinfo+28,key_info_length); + /* + This gives us the byte-position of the character at + (character-position, not byte-position) TABLE_COMMENT_MAXLEN. + The trick here is that character-positions start at 0, so the last + character in a maximum-allowed length string would be at char-pos + MAXLEN-1; charpos MAXLEN will be the position of the terminator. + Consequently, bytepos(charpos(MAXLEN)) should be equal to + comment[length] (which should also be the terminator, or at least + the first byte after the payload in the strict sense). If this is + not so (bytepos(charpos(MAXLEN)) comes /before/ the end of the + string), the string is too long. + + For additional credit, realise that UTF-8 has 1-3 bytes before 6.0, + and 1-4 bytes in 6.0 (6.0 also has UTF-32). This means that the + inlined COMMENT supposedly does not exceed 60 character plus + terminator, vulgo, 181 bytes. + */ + tmp_len= system_charset_info->cset->charpos(system_charset_info, create_info->comment.str, create_info->comment.str + @@ -226,14 +244,6 @@ bool mysql_create_frm(THD *thd, const char *file_name, strmake((char*) forminfo+47, create_info->comment.str ? create_info->comment.str : "", create_info->comment.length); forminfo[46]=(uchar) create_info->comment.length; -#ifdef EXTRA_DEBUG - /* - EXTRA_DEBUG causes strmake() to initialize its buffer behind the - payload with a magic value to detect wrong buffer-sizes. We - explicitly zero that segment again. - */ - memset((char*) forminfo+47 + forminfo[46], 0, 61 - forminfo[46]); -#endif #ifdef WITH_PARTITION_STORAGE_ENGINE if (part_info) { diff --git a/storage/archive/archive_reader.c b/storage/archive/archive_reader.c index bfc01073161..84d4e318b49 100644 --- a/storage/archive/archive_reader.c +++ b/storage/archive/archive_reader.c @@ -374,10 +374,8 @@ static struct my_option my_long_options[] = static void usage(void) { print_version(); - puts("Copyright (C) 2007 MySQL AB"); - puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\ - \nand you are welcome to modify and redistribute it under the GPL \ - license\n"); + puts("Copyright 2007-2008 MySQL AB, 2008 Sun Microsystems, Inc."); + puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); puts("Read and modify Archive files directly\n"); printf("Usage: %s [OPTIONS] file_to_be_looked_at [file_for_backup]\n", my_progname); print_defaults("my", load_default_groups); diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc index 1a1a0d02375..357496fe095 100644 --- a/storage/blackhole/ha_blackhole.cc +++ b/storage/blackhole/ha_blackhole.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 MySQL AB +/* Copyright 2005-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h index 085840cce43..289e449be10 100644 --- a/storage/blackhole/ha_blackhole.h +++ b/storage/blackhole/ha_blackhole.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 MySQL AB +/* Copyright 2005-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 3d24000823a..e29fe4162f4 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -1439,6 +1439,17 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt) a file, which descriptor is still open. EACCES will be returned when trying to delete the "to"-file in my_rename(). */ + if (share->tina_write_opened) + { + /* + Data file might be opened twice, on table opening stage and + during write_row execution. We need to close both instances + to satisfy Win. + */ + if (my_close(share->tina_write_filedes, MYF(0))) + DBUG_RETURN(my_errno ? my_errno : -1); + share->tina_write_opened= FALSE; + } if (my_close(data_file,MYF(0)) || my_close(repair_file, MYF(0)) || my_rename(repaired_fname, share->data_file_name, MYF(0))) DBUG_RETURN(-1); diff --git a/storage/innobase/Makefile.am b/storage/innobase/Makefile.am index b5e5c5375dc..7410bf7e591 100644 --- a/storage/innobase/Makefile.am +++ b/storage/innobase/Makefile.am @@ -15,21 +15,21 @@ # Process this file with automake to create Makefile.in -MYSQLDATAdir = $(localstatedir) -MYSQLSHAREdir = $(pkgdatadir) -MYSQLBASEdir= $(prefix) -MYSQLLIBdir= $(pkglibdir) -pkgplugindir = $(pkglibdir)/plugin -INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ +MYSQLDATAdir= $(localstatedir) +MYSQLSHAREdir= $(pkgdatadir) +MYSQLBASEdir= $(prefix) +MYSQLLIBdir= $(pkglibdir) +pkgplugindir= $(pkglibdir)/plugin +INCLUDES= -I$(top_srcdir)/include -I$(top_builddir)/include \ -I$(top_srcdir)/regex \ -I$(top_srcdir)/storage/innobase/include \ -I$(top_srcdir)/sql \ - -I$(srcdir) + -I$(srcdir) -DEFS = @DEFS@ +DEFS= @DEFS@ -noinst_HEADERS = include/btr0btr.h include/btr0btr.ic \ +noinst_HEADERS= include/btr0btr.h include/btr0btr.ic \ include/btr0cur.h include/btr0cur.ic \ include/btr0pcur.h include/btr0pcur.ic \ include/btr0sea.h include/btr0sea.ic \ @@ -121,9 +121,9 @@ noinst_HEADERS = include/btr0btr.h include/btr0btr.ic \ include/ut0list.ic include/ut0wqueue.h \ include/ha_prototypes.h handler/ha_innodb.h -EXTRA_LIBRARIES = libinnobase.a -noinst_LIBRARIES = @plugin_innobase_static_target@ -libinnobase_a_SOURCES = btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \ +EXTRA_LIBRARIES= libinnobase.a +noinst_LIBRARIES= @plugin_innobase_static_target@ +libinnobase_a_SOURCES= btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \ btr/btr0sea.c buf/buf0buf.c buf/buf0flu.c \ buf/buf0lru.c buf/buf0rea.c data/data0data.c \ data/data0type.c dict/dict0boot.c \ @@ -156,17 +156,17 @@ libinnobase_a_SOURCES = btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \ handler/ha_innodb.cc libinnobase_a_CXXFLAGS= $(AM_CFLAGS) -libinnobase_a_CFLAGS = $(AM_CFLAGS) +libinnobase_a_CFLAGS= $(AM_CFLAGS) -EXTRA_LTLIBRARIES = ha_innodb.la +EXTRA_LTLIBRARIES= ha_innodb.la pkgplugin_LTLIBRARIES= @plugin_innobase_shared_target@ -ha_innodb_la_LDFLAGS = -module -rpath $(pkgplugindir) -ha_innodb_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -ha_innodb_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -ha_innodb_la_SOURCES = $(libinnobase_a_SOURCES) +ha_innodb_la_LDFLAGS= -module -rpath $(pkgplugindir) +ha_innodb_la_CXXFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) +ha_innodb_la_CFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) +ha_innodb_la_SOURCES= $(libinnobase_a_SOURCES) -EXTRA_DIST = CMakeLists.txt plug.in \ +EXTRA_DIST= CMakeLists.txt plug.in \ pars/make_bison.sh pars/make_flex.sh \ pars/pars0grm.y pars/pars0lex.l diff --git a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c index 2fe3606a390..3482e16497a 100644 --- a/storage/innobase/btr/btr0sea.c +++ b/storage/innobase/btr/btr0sea.c @@ -161,6 +161,7 @@ btr_search_info_create( info->magic_n = BTR_SEARCH_MAGIC_N; #endif /* UNIV_DEBUG */ + info->ref_count = 0; info->root_guess = NULL; info->hash_analysis = 0; @@ -184,6 +185,31 @@ btr_search_info_create( return(info); } +/********************************************************************* +Returns the value of ref_count. The value is protected by +btr_search_latch. */ +ulint +btr_search_info_get_ref_count( +/*==========================*/ + /* out: ref_count value. */ + btr_search_t* info) /* in: search info. */ +{ + ulint ret; + + ut_ad(info); + +#ifdef UNIV_SYNC_DEBUG + ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED)); + ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX)); +#endif /* UNIV_SYNC_DEBUG */ + + rw_lock_s_lock(&btr_search_latch); + ret = info->ref_count; + rw_lock_s_unlock(&btr_search_latch); + + return(ret); +} + /************************************************************************* Updates the search info of an index about hash successes. NOTE that info is NOT protected by any semaphore, to save CPU time! Do not assume its fields @@ -1022,8 +1048,12 @@ next_rec: ha_remove_all_nodes_to_page(table, folds[i], page); } + ut_a(index->search_info->ref_count > 0); + index->search_info->ref_count--; + block->is_hashed = FALSE; block->index = NULL; + cleanup: if (UNIV_UNLIKELY(block->n_pointers)) { /* Corruption */ @@ -1244,6 +1274,15 @@ btr_search_build_page_hash_index( goto exit_func; } + /* This counter is decremented every time we drop page + hash index entries and is incremented here. Since we can + rebuild hash index for a page that is already hashed, we + have to take care not to increment the counter in that + case. */ + if (!block->is_hashed) { + index->search_info->ref_count++; + } + block->is_hashed = TRUE; block->n_hash_helps = 0; diff --git a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c index f3913ed49b7..d3c787d1578 100644 --- a/storage/innobase/buf/buf0lru.c +++ b/storage/innobase/buf/buf0lru.c @@ -42,6 +42,11 @@ initial segment in buf_LRU_get_recent_limit */ #define BUF_LRU_INITIAL_RATIO 8 +/* When dropping the search hash index entries before deleting an ibd +file, we build a local array of pages belonging to that tablespace +in the buffer pool. Following is the size of that array. */ +#define BUF_LRU_DROP_SEARCH_HASH_SIZE 1024 + /* If we switch on the InnoDB monitor because there are too few available frames in the buffer pool, we set this to TRUE */ ibool buf_lru_switched_on_innodb_mon = FALSE; @@ -66,6 +71,120 @@ buf_LRU_block_free_hashed_page( be in a state where it can be freed */ /********************************************************************** +Attempts to drop page hash index on a batch of pages belonging to a +particular space id. */ +static +void +buf_LRU_drop_page_hash_batch( +/*=========================*/ + ulint id, /* in: space id */ + const ulint* arr, /* in: array of page_no */ + ulint count) /* in: number of entries in array */ +{ + ulint i; + + ut_ad(arr != NULL); + ut_ad(count <= BUF_LRU_DROP_SEARCH_HASH_SIZE); + + for (i = 0; i < count; ++i) { + btr_search_drop_page_hash_when_freed(id, arr[i]); + } +} + +/********************************************************************** +When doing a DROP TABLE/DISCARD TABLESPACE we have to drop all page +hash index entries belonging to that table. This function tries to +do that in batch. Note that this is a 'best effort' attempt and does +not guarantee that ALL hash entries will be removed. */ +static +void +buf_LRU_drop_page_hash_for_tablespace( +/*==================================*/ + ulint id) /* in: space id */ +{ + buf_block_t* block; + ulint* page_arr; + ulint num_entries; + + page_arr = ut_malloc(sizeof(ulint) + * BUF_LRU_DROP_SEARCH_HASH_SIZE); + mutex_enter(&buf_pool->mutex); + +scan_again: + num_entries = 0; + block = UT_LIST_GET_LAST(buf_pool->LRU); + + while (block != NULL) { + buf_block_t* prev_block; + + mutex_enter(&block->mutex); + prev_block = UT_LIST_GET_PREV(LRU, block); + + ut_a(block->state == BUF_BLOCK_FILE_PAGE); + + if (block->space != id + || block->buf_fix_count > 0 + || block->io_fix != 0) { + /* We leave the fixed pages as is in this scan. + To be dealt with later in the final scan. */ + mutex_exit(&block->mutex); + goto next_page; + } + + ut_ad(block->space == id); + if (block->is_hashed) { + + /* Store the offset(i.e.: page_no) in the array + so that we can drop hash index in a batch + later. */ + page_arr[num_entries] = block->offset; + mutex_exit(&block->mutex); + ut_a(num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE); + ++num_entries; + + if (num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE) { + goto next_page; + } + /* Array full. We release the buf_pool->mutex to + obey the latching order. */ + mutex_exit(&buf_pool->mutex); + + buf_LRU_drop_page_hash_batch(id, page_arr, + num_entries); + num_entries = 0; + mutex_enter(&buf_pool->mutex); + } else { + mutex_exit(&block->mutex); + } + +next_page: + /* Note that we may have released the buf_pool->mutex + above after reading the prev_block during processing + of a page_hash_batch (i.e.: when the array was full). + This means that prev_block can change in LRU list. + This is OK because this function is a 'best effort' + to drop as many search hash entries as possible and + it does not guarantee that ALL such entries will be + dropped. */ + block = prev_block; + + /* If, however, block has been removed from LRU list + to the free list then we should restart the scan. + block->state is protected by buf_pool->mutex. */ + if (block && block->state != BUF_BLOCK_FILE_PAGE) { + ut_a(num_entries == 0); + goto scan_again; + } + } + + mutex_exit(&buf_pool->mutex); + + /* Drop any remaining batch of search hashed pages. */ + buf_LRU_drop_page_hash_batch(id, page_arr, num_entries); + ut_free(page_arr); +} + +/********************************************************************** Invalidates all pages belonging to a given tablespace when we are deleting the data file(s) of that tablespace. */ @@ -78,6 +197,14 @@ buf_LRU_invalidate_tablespace( ulint page_no; ibool all_freed; + /* Before we attempt to drop pages one by one we first + attempt to drop page hash index entries in batches to make + it more efficient. The batching attempt is a best effort + attempt and does not guarantee that all pages hash entries + will be dropped. We get rid of remaining page hash entries + one by one below. */ + buf_LRU_drop_page_hash_for_tablespace(id); + scan_again: mutex_enter(&(buf_pool->mutex)); diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c index 5eaa44b4615..c7a57d6a2b8 100644 --- a/storage/innobase/dict/dict0dict.c +++ b/storage/innobase/dict/dict0dict.c @@ -422,8 +422,7 @@ dict_table_autoinc_lock( } /************************************************************************ -Initializes the autoinc counter. It is not an error to initialize an already -initialized counter. */ +Unconditionally set the autoinc counter. */ void dict_table_autoinc_initialize( @@ -433,7 +432,6 @@ dict_table_autoinc_initialize( { ut_ad(mutex_own(&table->autoinc_mutex)); - table->autoinc_inited = TRUE; table->autoinc = value; } @@ -447,32 +445,25 @@ dict_table_autoinc_read( /* out: value for a new row, or 0 */ dict_table_t* table) /* in: table */ { - ib_longlong value; - ut_ad(mutex_own(&table->autoinc_mutex)); - if (!table->autoinc_inited) { - - value = 0; - } else { - value = table->autoinc; - } - - return(value); + return(table->autoinc); } /************************************************************************ Updates the autoinc counter if the value supplied is greater than the -current value. If not inited, does nothing. */ +current value. */ void -dict_table_autoinc_update( -/*======================*/ +dict_table_autoinc_update_if_greater( +/*=================================*/ dict_table_t* table, /* in: table */ ib_ulonglong value) /* in: value which was assigned to a row */ { - if (table->autoinc_inited && value > table->autoinc) { + ut_ad(mutex_own(&table->autoinc_mutex)); + + if (value > table->autoinc) { table->autoinc = value; } @@ -1394,12 +1385,59 @@ dict_index_remove_from_cache( dict_index_t* index) /* in, own: index */ { ulint size; + ulint retries = 0; + btr_search_t* info; ut_ad(table && index); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); ut_ad(mutex_own(&(dict_sys->mutex))); + /* We always create search info whether or not adaptive + hash index is enabled or not. */ + info = index->search_info; + ut_ad(info); + + /* We are not allowed to free the in-memory index struct + dict_index_t until all entries in the adaptive hash index + that point to any of the page belonging to his b-tree index + are dropped. This is so because dropping of these entries + require access to dict_index_t struct. To avoid such scenario + We keep a count of number of such pages in the search_info and + only free the dict_index_t struct when this count drops to + zero. */ + + for (;;) { + ulint ref_count = btr_search_info_get_ref_count(info); + if (ref_count == 0) { + break; + } + + /* Sleep for 10ms before trying again. */ + os_thread_sleep(10000); + ++retries; + + if (retries % 500 == 0) { + /* No luck after 5 seconds of wait. */ + fprintf(stderr, "InnoDB: Error: Waited for" + " %lu secs for hash index" + " ref_count (%lu) to drop" + " to 0.\n" + "index: \"%s\"" + " table: \"%s\"\n", + retries/100, + ref_count, + index->name, + table->name); + } + + /* To avoid a hang here we commit suicide if the + ref_count doesn't drop to zero in 600 seconds. */ + if (retries >= 60000) { + ut_error; + } + } + rw_lock_free(&index->lock); /* Remove the index from the list of indexes of the table */ diff --git a/storage/innobase/dict/dict0mem.c b/storage/innobase/dict/dict0mem.c index 47cf7a0bc9c..168771ca307 100644 --- a/storage/innobase/dict/dict0mem.c +++ b/storage/innobase/dict/dict0mem.c @@ -89,11 +89,7 @@ dict_mem_table_create( mutex_create(&table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX); - table->autoinc_inited = FALSE; - - /* The actual increment value will be set by MySQL, we simply - default to 1 here.*/ - table->autoinc_increment = 1; + table->autoinc = 0; /* The number of transactions that are either waiting on the AUTOINC lock or have been granted the lock. */ diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 396844f265b..5222a3dd10b 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -507,6 +507,18 @@ thd_has_edited_nontrans_tables( return((ibool) thd_non_transactional_update((THD*) thd)); } +/********************************************************************** +Returns true if the thread is executing a SELECT statement. */ +extern "C" +ibool +thd_is_select( +/*==========*/ + /* out: true if thd is executing SELECT */ + const void* thd) /* in: thread handle (THD*) */ +{ + return(thd_sql_command((const THD*) thd) == SQLCOM_SELECT); +} + /************************************************************************ Obtain the InnoDB transaction of a MySQL thread. */ inline @@ -910,6 +922,81 @@ innobase_convert_string( } /************************************************************************* +Compute the next autoinc value. + +For MySQL replication the autoincrement values can be partitioned among +the nodes. The offset is the start or origin of the autoincrement value +for a particular node. For n nodes the increment will be n and the offset +will be in the interval [1, n]. The formula tries to allocate the next +value for a particular node. + +Note: This function is also called with increment set to the number of +values we want to reserve for multi-value inserts e.g., + + INSERT INTO T VALUES(), (), (); + +innobase_next_autoinc() will be called with increment set to +n * 3 where autoinc_lock_mode != TRADITIONAL because we want +to reserve 3 values for the multi-value INSERT above. */ +static +ulonglong +innobase_next_autoinc( +/*==================*/ + /* out: the next value */ + ulonglong current, /* in: Current value */ + ulonglong increment, /* in: increment current by */ + ulonglong offset, /* in: AUTOINC offset */ + ulonglong max_value) /* in: max value for type */ +{ + ulonglong next_value; + + /* Should never be 0. */ + ut_a(increment > 0); + + if (max_value <= current) { + next_value = max_value; + } else if (offset <= 1) { + /* Offset 0 and 1 are the same, because there must be at + least one node in the system. */ + if (max_value - current <= increment) { + next_value = max_value; + } else { + next_value = current + increment; + } + } else { + if (current > offset) { + next_value = ((current - offset) / increment) + 1; + } else { + next_value = ((offset - current) / increment) + 1; + } + + ut_a(increment > 0); + ut_a(next_value > 0); + + /* Check for multiplication overflow. */ + if (increment > (max_value / next_value)) { + + next_value = max_value; + } else { + next_value *= increment; + + ut_a(max_value >= next_value); + + /* Check for overflow. */ + if (max_value - next_value <= offset) { + next_value = max_value; + } else { + next_value += offset; + } + } + } + + ut_a(next_value <= max_value); + + return(next_value); +} + +/************************************************************************* Gets the InnoDB transaction handle for a MySQL handler object, creates an InnoDB transaction struct if the corresponding MySQL thread struct still lacks one. */ @@ -2272,6 +2359,44 @@ normalize_table_name( #endif } +/************************************************************************ +Set the autoinc column max value. This should only be called once from +ha_innobase::open(). Therefore there's no need for a covering lock. */ + +ulong +ha_innobase::innobase_initialize_autoinc() +/*======================================*/ +{ + dict_index_t* index; + ulonglong auto_inc; + const char* col_name; + ulint error = DB_SUCCESS; + dict_table_t* innodb_table = prebuilt->table; + + col_name = table->found_next_number_field->field_name; + index = innobase_get_index(table->s->next_number_index); + + /* Execute SELECT MAX(col_name) FROM TABLE; */ + error = row_search_max_autoinc(index, col_name, &auto_inc); + + if (error == DB_SUCCESS) { + + /* At the this stage we dont' know the increment + or the offset, so use default inrement of 1. */ + ++auto_inc; + + dict_table_autoinc_initialize(innodb_table, auto_inc); + + } else { + ut_print_timestamp(stderr); + fprintf(stderr, " InnoDB: Error: (%lu) Couldn't read " + "the MAX(%s) autoinc value from the " + "index (%s).\n", error, col_name, index->name); + } + + return(ulong(error)); +} + /********************************************************************* Creates and opens a handle to a table which already exists in an InnoDB database. */ @@ -2296,6 +2421,14 @@ ha_innobase::open( UT_NOT_USED(test_if_locked); thd = ha_thd(); + + /* Under some cases MySQL seems to call this function while + holding btr_search_latch. This breaks the latching order as + we acquire dict_sys->mutex below and leads to a deadlock. */ + if (thd != NULL) { + innobase_release_temporary_latches(ht, thd); + } + normalize_table_name(norm_name, name); user_thd = NULL; @@ -2455,6 +2588,26 @@ retry: info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST); + /* Only if the table has an AUTOINC column. */ + if (prebuilt->table != NULL && table->found_next_number_field != NULL) { + ulint error; + + dict_table_autoinc_lock(prebuilt->table); + + /* Since a table can already be "open" in InnoDB's internal + data dictionary, we only init the autoinc counter once, the + first time the table is loaded. We can safely reuse the + autoinc value from a previous MySQL open. */ + if (dict_table_autoinc_read(prebuilt->table) == 0) { + + error = innobase_initialize_autoinc(); + /* Should always succeed! */ + ut_a(error == DB_SUCCESS); + } + + dict_table_autoinc_unlock(prebuilt->table); + } + DBUG_RETURN(0); } @@ -3262,6 +3415,59 @@ skip_field: } /************************************************************************ +Get the upper limit of the MySQL integral type. */ + +ulonglong +ha_innobase::innobase_get_int_col_max_value( +/*========================================*/ + const Field* field) +{ + ulonglong max_value = 0; + + switch(field->key_type()) { + /* TINY */ + case HA_KEYTYPE_BINARY: + max_value = 0xFFULL; + break; + case HA_KEYTYPE_INT8: + max_value = 0x7FULL; + break; + /* SHORT */ + case HA_KEYTYPE_USHORT_INT: + max_value = 0xFFFFULL; + break; + case HA_KEYTYPE_SHORT_INT: + max_value = 0x7FFFULL; + break; + /* MEDIUM */ + case HA_KEYTYPE_UINT24: + max_value = 0xFFFFFFULL; + break; + case HA_KEYTYPE_INT24: + max_value = 0x7FFFFFULL; + break; + /* LONG */ + case HA_KEYTYPE_ULONG_INT: + max_value = 0xFFFFFFFFULL; + break; + case HA_KEYTYPE_LONG_INT: + max_value = 0x7FFFFFFFULL; + break; + /* BIG */ + case HA_KEYTYPE_ULONGLONG: + max_value = 0xFFFFFFFFFFFFFFFFULL; + break; + case HA_KEYTYPE_LONGLONG: + max_value = 0x7FFFFFFFFFFFFFFFULL; + break; + default: + ut_error; + } + + return(max_value); +} + +/************************************************************************ This special handling is really to overcome the limitations of MySQL's binlogging. We need to eliminate the non-determinism that will arise in INSERT ... SELECT type of statements, since MySQL binlog only stores the @@ -3269,7 +3475,7 @@ min value of the autoinc interval. Once that is fixed we can get rid of the special lock handling.*/ ulong -ha_innobase::innobase_autoinc_lock(void) +ha_innobase::innobase_lock_autoinc(void) /*====================================*/ /* out: DB_SUCCESS if all OK else error code */ @@ -3334,7 +3540,7 @@ ha_innobase::innobase_reset_autoinc( { ulint error; - error = innobase_autoinc_lock(); + error = innobase_lock_autoinc(); if (error == DB_SUCCESS) { @@ -3359,11 +3565,11 @@ ha_innobase::innobase_set_max_autoinc( { ulint error; - error = innobase_autoinc_lock(); + error = innobase_lock_autoinc(); if (error == DB_SUCCESS) { - dict_table_autoinc_update(prebuilt->table, auto_inc); + dict_table_autoinc_update_if_greater(prebuilt->table, auto_inc); dict_table_autoinc_unlock(prebuilt->table); } @@ -3483,8 +3689,20 @@ no_commit: /* This is the case where the table has an auto-increment column */ if (table->next_number_field && record == table->record[0]) { + /* Reset the error code before calling + innobase_get_auto_increment(). */ + prebuilt->autoinc_error = DB_SUCCESS; + if ((error = update_auto_increment())) { + /* We don't want to mask autoinc overflow errors. */ + if (prebuilt->autoinc_error != DB_SUCCESS) { + error = prebuilt->autoinc_error; + + goto report_error; + } + + /* MySQL errors are passed straight back. */ goto func_exit; } @@ -3508,6 +3726,7 @@ no_commit: if (auto_inc_used) { ulint err; ulonglong auto_inc; + ulonglong col_max_value; /* Note the number of rows processed for this statement, used by get_auto_increment() to determine the number of AUTO-INC @@ -3517,6 +3736,11 @@ no_commit: --trx->n_autoinc_rows; } + /* We need the upper limit of the col type to check for + whether we update the table autoinc counter or not. */ + col_max_value = innobase_get_int_col_max_value( + table->next_number_field); + /* Get the value that MySQL attempted to store in the table.*/ auto_inc = table->next_number_field->val_int(); @@ -3555,22 +3779,19 @@ no_commit: update the table upper limit. Note: last_value will be 0 if get_auto_increment() was not called.*/ - if (auto_inc > prebuilt->last_value) { + if (auto_inc <= col_max_value + && auto_inc > prebuilt->autoinc_last_value) { set_max_autoinc: - ut_a(prebuilt->table->autoinc_increment > 0); + ut_a(prebuilt->autoinc_increment > 0); - ulonglong have; ulonglong need; + ulonglong offset; - /* Check for overflow conditions. */ - need = prebuilt->table->autoinc_increment; - have = ~0x0ULL - auto_inc; + offset = prebuilt->autoinc_offset; + need = prebuilt->autoinc_increment; - if (have < need) { - need = have; - } - - auto_inc += need; + auto_inc = innobase_next_autoinc( + auto_inc, need, offset, col_max_value); err = innobase_set_max_autoinc(auto_inc); @@ -3584,6 +3805,7 @@ set_max_autoinc: innodb_srv_conc_exit_innodb(prebuilt->trx); +report_error: error = convert_error_code_to_mysql(error, user_thd); func_exit: @@ -3765,6 +3987,8 @@ ha_innobase::update_row( ut_a(prebuilt->trx == trx); + ha_statistic_increment(&SSV::ha_update_count); + if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE) table->timestamp_field->set_time(); @@ -3805,12 +4029,26 @@ ha_innobase::update_row( && (trx->duplicates & (TRX_DUP_IGNORE | TRX_DUP_REPLACE)) == TRX_DUP_IGNORE) { - longlong auto_inc; + ulonglong auto_inc; + ulonglong col_max_value; auto_inc = table->next_number_field->val_int(); - if (auto_inc != 0) { - auto_inc += prebuilt->table->autoinc_increment; + /* We need the upper limit of the col type to check for + whether we update the table autoinc counter or not. */ + col_max_value = innobase_get_int_col_max_value( + table->next_number_field); + + if (auto_inc <= col_max_value && auto_inc != 0) { + + ulonglong need; + ulonglong offset; + + offset = prebuilt->autoinc_offset; + need = prebuilt->autoinc_increment; + + auto_inc = innobase_next_autoinc( + auto_inc, need, offset, col_max_value); error = innobase_set_max_autoinc(auto_inc); } @@ -3854,29 +4092,7 @@ ha_innobase::delete_row( ut_a(prebuilt->trx == trx); - /* Only if the table has an AUTOINC column */ - if (table->found_next_number_field && record == table->record[0]) { - ulonglong dummy = 0; - - /* First check whether the AUTOINC sub-system has been - initialized using the AUTOINC mutex. If not then we - do it the "proper" way, by acquiring the heavier locks. */ - dict_table_autoinc_lock(prebuilt->table); - - if (!prebuilt->table->autoinc_inited) { - dict_table_autoinc_unlock(prebuilt->table); - - error = innobase_get_auto_increment(&dummy); - - if (error == DB_SUCCESS) { - dict_table_autoinc_unlock(prebuilt->table); - } else { - goto error_exit; - } - } else { - dict_table_autoinc_unlock(prebuilt->table); - } - } + ha_statistic_increment(&SSV::ha_delete_count); if (!prebuilt->upd_node) { row_get_prebuilt_update_vector(prebuilt); @@ -3892,7 +4108,6 @@ ha_innobase::delete_row( innodb_srv_conc_exit_innodb(trx); -error_exit: error = convert_error_code_to_mysql(error, user_thd); /* Tell the InnoDB server that there might be work for @@ -4996,6 +5211,29 @@ ha_innobase::create( DBUG_ENTER("ha_innobase::create"); DBUG_ASSERT(thd != NULL); + DBUG_ASSERT(create_info != NULL); + +#ifdef __WIN__ + /* Names passed in from server are in two formats: + 1. <database_name>/<table_name>: for normal table creation + 2. full path: for temp table creation, or sym link + + When srv_file_per_table is on, check for full path pattern, i.e. + X:\dir\..., X is a driver letter, or + \\dir1\dir2\..., UNC path + returns error if it is in full path format, but not creating a temp. + table. Currently InnoDB does not support symbolic link on Windows. */ + + if (srv_file_per_table + && (!create_info->options & HA_LEX_CREATE_TMP_TABLE)) { + + if ((name[1] == ':') + || (name[0] == '\\' && name[1] == '\\')) { + sql_print_error("Cannot create table %s\n", name); + DBUG_RETURN(HA_ERR_GENERIC); + } + } +#endif if (form->s->fields > 1000) { /* The limit probably should be REC_MAX_N_FIELDS - 3 = 1020, @@ -5226,7 +5464,8 @@ ha_innobase::delete_all_rows(void) if (thd_sql_command(user_thd) != SQLCOM_TRUNCATE) { fallback: /* We only handle TRUNCATE TABLE t as a special case. - DELETE FROM t will have to use ha_innobase::delete_row(). */ + DELETE FROM t will have to use ha_innobase::delete_row(), + because DELETE is transactional while TRUNCATE is not. */ DBUG_RETURN(my_errno=HA_ERR_WRONG_COMMAND); } @@ -5807,7 +6046,7 @@ ha_innobase::info( not be updated. This will force write_row() into attempting an update of the table's AUTOINC counter. */ - prebuilt->last_value = 0; + prebuilt->autoinc_last_value = 0; } stats.records = (ha_rows)n_rows; @@ -5828,9 +6067,39 @@ ha_innobase::info( so the "old" value can remain. delete_length is initialized to 0 in the ha_statistics' constructor. */ if (!(flag & HA_STATUS_NO_LOCK)) { - stats.delete_length = - fsp_get_available_space_in_free_extents( - ib_table->space) * 1024; + + /* lock the data dictionary to avoid races with + ibd_file_missing and tablespace_discarded */ + row_mysql_lock_data_dictionary(prebuilt->trx); + + /* ib_table->space must be an existent tablespace */ + if (!ib_table->ibd_file_missing + && !ib_table->tablespace_discarded) { + + stats.delete_length = + fsp_get_available_space_in_free_extents( + ib_table->space) * 1024; + } else { + + THD* thd; + + thd = ha_thd(); + + push_warning_printf( + thd, + MYSQL_ERROR::WARN_LEVEL_WARN, + ER_CANT_GET_STAT, + "InnoDB: Trying to get the free " + "space for table %s but its " + "tablespace has been discarded or " + "the .ibd file is missing. Setting " + "the free space to zero.", + ib_table->name); + + stats.delete_length = 0; + } + + row_mysql_unlock_data_dictionary(prebuilt->trx); } stats.check_time = 0; @@ -5915,29 +6184,7 @@ ha_innobase::info( } if (flag & HA_STATUS_AUTO && table->found_next_number_field) { - ulonglong auto_inc; - int ret; - - /* The following function call can the first time fail in - a lock wait timeout error because it reserves the auto-inc - lock on the table. If it fails, then someone is already initing - the auto-inc counter, and the second call is guaranteed to - succeed. */ - - ret = innobase_read_and_init_auto_inc(&auto_inc); - - if (ret != 0) { - ret = innobase_read_and_init_auto_inc(&auto_inc); - - if (ret != 0) { - sql_print_error("Cannot get table %s auto-inc" - "counter value in ::info\n", - ib_table->name); - auto_inc = 0; - } - } - - stats.auto_increment_value = auto_inc; + stats.auto_increment_value = innobase_peek_autoinc(); } prebuilt->trx->op_info = (char*)""; @@ -6400,15 +6647,26 @@ ha_innobase::extra( return(0); } +/********************************************************************** +Reset state of file to after 'open'. +This function is called after every statement for all tables used +by that statement. */ int ha_innobase::reset() { - if (prebuilt->blob_heap) { - row_mysql_prebuilt_free_blob_heap(prebuilt); - } - reset_template(prebuilt); - return 0; -} + if (prebuilt->blob_heap) { + row_mysql_prebuilt_free_blob_heap(prebuilt); + } + + reset_template(prebuilt); + + /* TODO: This should really be reset in reset_template() but for now + it's safer to do it explicitly here. */ + + /* This is a statement level counter. */ + prebuilt->autoinc_last_value = 0; + return(0); +} /********************************************************************** MySQL calls this function at the start of each SQL statement inside LOCK @@ -7257,169 +7515,59 @@ ha_innobase::store_lock( return(to); } -/*********************************************************************** -This function initializes the auto-inc counter if it has not been -initialized yet. This function does not change the value of the auto-inc -counter if it already has been initialized. In parameter ret returns -the value of the auto-inc counter. */ - -int -ha_innobase::innobase_read_and_init_auto_inc( -/*=========================================*/ - /* out: 0 or generic MySQL - error code */ - ulonglong* value) /* out: the autoinc value */ -{ - ulonglong auto_inc; - ibool stmt_start; - int mysql_error = 0; - dict_table_t* innodb_table = prebuilt->table; - ibool trx_was_not_started = FALSE; - - ut_a(prebuilt); - ut_a(prebuilt->table); - - /* Remember if we are in the beginning of an SQL statement. - This function must not change that flag. */ - stmt_start = prebuilt->sql_stat_start; - - /* Prepare prebuilt->trx in the table handle */ - update_thd(ha_thd()); - - if (prebuilt->trx->conc_state == TRX_NOT_STARTED) { - trx_was_not_started = TRUE; - } - - /* In case MySQL calls this in the middle of a SELECT query, release - possible adaptive hash latch to avoid deadlocks of threads */ - - trx_search_latch_release_if_reserved(prebuilt->trx); - - dict_table_autoinc_lock(prebuilt->table); - - auto_inc = dict_table_autoinc_read(prebuilt->table); - - /* Was the AUTOINC counter reset during normal processing, if - so then we simply start count from 1. No need to go to the index.*/ - if (auto_inc == 0 && innodb_table->autoinc_inited) { - ++auto_inc; - dict_table_autoinc_initialize(innodb_table, auto_inc); - } - - if (auto_inc == 0) { - dict_index_t* index; - ulint error; - const char* autoinc_col_name; - - ut_a(!innodb_table->autoinc_inited); - - index = innobase_get_index(table->s->next_number_index); - - autoinc_col_name = table->found_next_number_field->field_name; - - error = row_search_max_autoinc( - index, autoinc_col_name, &auto_inc); - - if (error == DB_SUCCESS) { - if (auto_inc < ~0x0ULL) { - ++auto_inc; - } - dict_table_autoinc_initialize(innodb_table, auto_inc); - } else { - ut_print_timestamp(stderr); - fprintf(stderr, " InnoDB: Error: (%lu) Couldn't read " - "the max AUTOINC value from the index (%s).\n", - error, index->name); - - mysql_error = 1; - } - } - - *value = auto_inc; - - dict_table_autoinc_unlock(prebuilt->table); - - /* Since MySQL does not seem to call autocommit after SHOW TABLE - STATUS (even if we would register the trx here), we commit our - transaction here if it was started here. This is to eliminate a - dangling transaction. If the user had AUTOCOMMIT=0, then SHOW - TABLE STATUS does leave a dangling transaction if the user does not - himself call COMMIT. */ - - if (trx_was_not_started) { - - innobase_commit_low(prebuilt->trx); - } - - prebuilt->sql_stat_start = stmt_start; - - return(mysql_error); -} - /******************************************************************************* -Read the next autoinc value, initialize the table if it's not initialized. -On return if there is no error then the tables AUTOINC lock is locked.*/ +Read the next autoinc value. Acquire the relevant locks before reading +the AUTOINC value. If SUCCESS then the table AUTOINC mutex will be locked +on return and all relevant locks acquired. */ ulong -ha_innobase::innobase_get_auto_increment( -/*=====================================*/ +ha_innobase::innobase_get_autoinc( +/*==============================*/ + /* out: DB_SUCCESS or error code */ ulonglong* value) /* out: autoinc value */ { - ulong error; - - *value = 0; - - /* Note: If the table is not initialized when we attempt the - read below. We initialize the table's auto-inc counter and - always do a reread of the AUTOINC value. */ - do { - error = innobase_autoinc_lock(); - - if (error == DB_SUCCESS) { - ulonglong autoinc; + *value = 0; + + prebuilt->autoinc_error = innobase_lock_autoinc(); - /* Determine the first value of the interval */ - autoinc = dict_table_autoinc_read(prebuilt->table); + if (prebuilt->autoinc_error == DB_SUCCESS) { - /* We need to initialize the AUTO-INC value, for - that we release all locks.*/ - if (autoinc == 0) { - trx_t* trx; + /* Determine the first value of the interval */ + *value = dict_table_autoinc_read(prebuilt->table); - trx = prebuilt->trx; - dict_table_autoinc_unlock(prebuilt->table); + /* It should have been initialized during open. */ + ut_a(*value != 0); + } + + return(ulong(prebuilt->autoinc_error)); +} - /* If we had reserved the AUTO-INC - lock in this SQL statement we release - it before retrying.*/ - row_unlock_table_autoinc_for_mysql(trx); +/*********************************************************************** +This function reads the global auto-inc counter. It doesn't use the +AUTOINC lock even if the lock mode is set to TRADITIONAL. */ - /* Just to make sure */ - ut_a(!trx->auto_inc_lock); +ulonglong +ha_innobase::innobase_peek_autoinc() +/*================================*/ + /* out: the autoinc value */ +{ + ulonglong auto_inc; + dict_table_t* innodb_table; - int mysql_error; + ut_a(prebuilt != NULL); + ut_a(prebuilt->table != NULL); - mysql_error = innobase_read_and_init_auto_inc( - &autoinc); + innodb_table = prebuilt->table; - if (mysql_error) { - error = DB_ERROR; - } - } else { - *value = autoinc; - } - /* A deadlock error during normal processing is OK - and can be ignored. */ - } else if (error != DB_DEADLOCK) { + dict_table_autoinc_lock(innodb_table); - sql_print_error("InnoDB: Error: %lu in " - "::innobase_get_auto_increment()", - error); - } + auto_inc = dict_table_autoinc_read(innodb_table); - } while (*value == 0 && error == DB_SUCCESS); + ut_a(auto_inc > 0); - return(error); + dict_table_autoinc_unlock(innodb_table); + + return(auto_inc); } /******************************************************************************* @@ -7446,7 +7594,7 @@ ha_innobase::get_auto_increment( /* Prepare prebuilt->trx in the table handle */ update_thd(ha_thd()); - error = innobase_get_auto_increment(&autoinc); + error = innobase_get_autoinc(&autoinc); if (error != DB_SUCCESS) { *first_value = (~(ulonglong) 0); @@ -7482,7 +7630,7 @@ ha_innobase::get_auto_increment( set_if_bigger(*first_value, autoinc); /* Not in the middle of a mult-row INSERT. */ - } else if (prebuilt->last_value == 0) { + } else if (prebuilt->autoinc_last_value == 0) { set_if_bigger(*first_value, autoinc); } @@ -7491,35 +7639,40 @@ ha_innobase::get_auto_increment( /* With old style AUTOINC locking we only update the table's AUTOINC counter after attempting to insert the row. */ if (innobase_autoinc_lock_mode != AUTOINC_OLD_STYLE_LOCKING) { - ulonglong have; ulonglong need; + ulonglong next_value; + ulonglong col_max_value; - /* Check for overflow conditions. */ - need = *nb_reserved_values * increment; - have = ~0x0ULL - *first_value; + /* We need the upper limit of the col type to check for + whether we update the table autoinc counter or not. */ + col_max_value = innobase_get_int_col_max_value( + table->next_number_field); - if (have < need) { - need = have; - } + need = *nb_reserved_values * increment; /* Compute the last value in the interval */ - prebuilt->last_value = *first_value + need; + next_value = innobase_next_autoinc( + *first_value, need, offset, col_max_value); - ut_a(prebuilt->last_value >= *first_value); + prebuilt->autoinc_last_value = next_value; + + ut_a(prebuilt->autoinc_last_value >= *first_value); /* Update the table autoinc variable */ - dict_table_autoinc_update( - prebuilt->table, prebuilt->last_value); + dict_table_autoinc_update_if_greater( + prebuilt->table, prebuilt->autoinc_last_value); } else { /* This will force write_row() into attempting an update of the table's AUTOINC counter. */ - prebuilt->last_value = 0; + prebuilt->autoinc_last_value = 0; } /* The increment to be used to increase the AUTOINC value, we use this in write_row() and update_row() to increase the autoinc counter - for columns that are filled by the user.*/ - prebuilt->table->autoinc_increment = increment; + for columns that are filled by the user. We need the offset and + the increment. */ + prebuilt->autoinc_offset = offset; + prebuilt->autoinc_increment = increment; dict_table_autoinc_unlock(prebuilt->table); } @@ -7544,6 +7697,11 @@ ha_innobase::reset_auto_increment( DBUG_RETURN(error); } + /* The next value can never be 0. */ + if (value == 0) { + value = 1; + } + innobase_reset_autoinc(value); DBUG_RETURN(0); @@ -8101,7 +8259,7 @@ static MYSQL_SYSVAR_BOOL(adaptive_hash_index, innobase_adaptive_hash_index, static MYSQL_SYSVAR_LONG(additional_mem_pool_size, innobase_additional_mem_pool_size, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.", - NULL, NULL, 1*1024*1024L, 512*1024L, ~0L, 1024); + NULL, NULL, 1*1024*1024L, 512*1024L, LONG_MAX, 1024); static MYSQL_SYSVAR_ULONG(autoextend_increment, srv_auto_extend_increment, PLUGIN_VAR_RQCMDARG, @@ -8141,7 +8299,7 @@ static MYSQL_SYSVAR_LONG(lock_wait_timeout, innobase_lock_wait_timeout, static MYSQL_SYSVAR_LONG(log_buffer_size, innobase_log_buffer_size, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "The size of the buffer which InnoDB uses to write log to the log files on disk.", - NULL, NULL, 1024*1024L, 256*1024L, ~0L, 1024); + NULL, NULL, 1024*1024L, 256*1024L, LONG_MAX, 1024); static MYSQL_SYSVAR_LONGLONG(log_file_size, innobase_log_file_size, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, @@ -8161,7 +8319,7 @@ static MYSQL_SYSVAR_LONG(mirrored_log_groups, innobase_mirrored_log_groups, static MYSQL_SYSVAR_LONG(open_files, innobase_open_files, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "How many files at the maximum InnoDB keeps open at the same time.", - NULL, NULL, 300L, 10L, ~0L, 0); + NULL, NULL, 300L, 10L, LONG_MAX, 0); static MYSQL_SYSVAR_ULONG(sync_spin_loops, srv_n_spin_wait_rounds, PLUGIN_VAR_RQCMDARG, diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 4ffcdb1e3c2..8ca72ee1a60 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -72,12 +72,15 @@ class ha_innobase: public handler int update_thd(THD* thd); int change_active_index(uint keynr); int general_fetch(uchar* buf, uint direction, uint match_mode); - int innobase_read_and_init_auto_inc(ulonglong* ret); - ulong innobase_autoinc_lock(); + ulong innobase_lock_autoinc(); + ulonglong innobase_peek_autoinc(); ulong innobase_set_max_autoinc(ulonglong auto_inc); ulong innobase_reset_autoinc(ulonglong auto_inc); - ulong innobase_get_auto_increment(ulonglong* value); + ulong innobase_get_autoinc(ulonglong* value); + ulong innobase_update_autoinc(ulonglong auto_inc); + ulong innobase_initialize_autoinc(); dict_index_t* innobase_get_index(uint keynr); + ulonglong innobase_get_int_col_max_value(const Field* field); /* Init values for the class: */ public: diff --git a/storage/innobase/include/btr0sea.h b/storage/innobase/include/btr0sea.h index 281587ad060..6d1c2bb86d3 100644 --- a/storage/innobase/include/btr0sea.h +++ b/storage/innobase/include/btr0sea.h @@ -40,6 +40,14 @@ btr_search_info_create( /*===================*/ /* out, own: search info struct */ mem_heap_t* heap); /* in: heap where created */ +/********************************************************************* +Returns the value of ref_count. The value is protected by +btr_search_latch. */ +ulint +btr_search_info_get_ref_count( +/*==========================*/ + /* out: ref_count value. */ + btr_search_t* info); /* in: search info. */ /************************************************************************* Updates the search info. */ UNIV_INLINE @@ -137,6 +145,13 @@ btr_search_validate(void); /* The search info struct in an index */ struct btr_search_struct{ + ulint ref_count; /* Number of blocks in this index tree + that have search index built + i.e. block->index points to this index. + Protected by btr_search_latch except + when during initialization in + btr_search_info_create(). */ + /* The following fields are not protected by any latch. Unfortunately, this means that they must be aligned to the machine word, i.e., they cannot be turned into bit-fields. */ diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index f60775c8c2f..7d5ff09c7a6 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -178,8 +178,7 @@ dict_table_autoinc_lock( /*====================*/ dict_table_t* table); /* in: table */ /************************************************************************ -Initializes the autoinc counter. It is not an error to initialize an already -initialized counter. */ +Unconditionally set the autoinc counter. */ void dict_table_autoinc_initialize( @@ -196,12 +195,12 @@ dict_table_autoinc_read( /* out: value for a new row, or 0 */ dict_table_t* table); /* in: table */ /************************************************************************ -Updates the autoinc counter if the value supplied is equal or bigger than the -current value. If not inited, does nothing. */ +Updates the autoinc counter if the value supplied is greater than the +current value. */ void -dict_table_autoinc_update( -/*======================*/ +dict_table_autoinc_update_if_greater( +/*=================================*/ dict_table_t* table, /* in: table */ ib_ulonglong value); /* in: value which was assigned to a row */ diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 2fe72498989..ac28fdb1bae 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -405,17 +405,8 @@ struct dict_table_struct{ mutex_t autoinc_mutex; /* mutex protecting the autoincrement counter */ - ibool autoinc_inited; - /* TRUE if the autoinc counter has been - inited; MySQL gets the init value by executing - SELECT MAX(auto inc column) */ ib_ulonglong autoinc;/* autoinc counter value to give to the next inserted row */ - - ib_longlong autoinc_increment; - /* The increment step of the auto increment - column. Value must be greater than or equal - to 1 */ ulong n_waiting_or_granted_auto_inc_locks; /* This counter is used to track the number of granted and pending autoinc locks on this @@ -425,6 +416,7 @@ struct dict_table_struct{ acquired the AUTOINC lock or not. Of course only one transaction can be granted the lock but there can be multiple waiters. */ + /*----------------------*/ #ifdef UNIV_DEBUG ulint magic_n;/* magic number */ diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h index ef0722321af..6bfc43579b3 100644 --- a/storage/innobase/include/ha_prototypes.h +++ b/storage/innobase/include/ha_prototypes.h @@ -63,5 +63,14 @@ thd_has_edited_nontrans_tables( been edited */ void* thd); /* in: thread handle (THD*) */ +/********************************************************************** +Returns true if the thread is executing a SELECT statement. */ + +ibool +thd_is_select( +/*==========*/ + /* out: true if thd is executing SELECT */ + const void* thd); /* in: thread handle (THD*) */ + #endif #endif diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h index 8b08b6284f6..635724bf5a1 100644 --- a/storage/innobase/include/lock0lock.h +++ b/storage/innobase/include/lock0lock.h @@ -463,14 +463,21 @@ void lock_cancel_waiting_and_release( /*============================*/ lock_t* lock); /* in: waiting lock request */ + /************************************************************************* -Resets all locks, both table and record locks, on a table to be dropped. -No lock is allowed to be a wait lock. */ +Removes locks on a table to be dropped or truncated. +If remove_also_table_sx_locks is TRUE then table-level S and X locks are +also removed in addition to other table-level and record-level locks. +No lock, that is going to be removed, is allowed to be a wait lock. */ void -lock_reset_all_on_table( -/*====================*/ - dict_table_t* table); /* in: table to be dropped */ +lock_remove_all_on_table( +/*=====================*/ + dict_table_t* table, /* in: table to be dropped + or truncated */ + ibool remove_also_table_sx_locks);/* in: also removes + table S and X locks */ + /************************************************************************* Calculates the fold value of a page file address: used in inserting or searching for a lock in the hash table. */ diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index ca9d9c6b8f8..9c3ba558d3c 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -683,7 +683,21 @@ struct row_prebuilt_struct { to this heap */ mem_heap_t* old_vers_heap; /* memory heap where a previous version is built in consistent read */ - ulonglong last_value; /* last value of AUTO-INC interval */ + /*----------------------*/ + ulonglong autoinc_last_value;/* last value of AUTO-INC interval */ + ulonglong autoinc_increment;/* The increment step of the auto + increment column. Value must be + greater than or equal to 1. Required to + calculate the next value */ + ulonglong autoinc_offset; /* The offset passed to + get_auto_increment() by MySQL. Required + to calculate the next value */ + ulint autoinc_error; /* The actual error code encountered + while trying to init or read the + autoinc value from the table. We + store it here so that we can return + it to MySQL */ + /*----------------------*/ ulint magic_n2; /* this should be the same as magic_n */ }; diff --git a/storage/innobase/include/sync0sync.ic b/storage/innobase/include/sync0sync.ic index 908797f9729..ee640abefa6 100644 --- a/storage/innobase/include/sync0sync.ic +++ b/storage/innobase/include/sync0sync.ic @@ -197,7 +197,7 @@ mutex_exit( { ut_ad(mutex_own(mutex)); - ut_d(mutex->thread_id = ULINT_UNDEFINED); + ut_d(mutex->thread_id = (os_thread_id_t) ULINT_UNDEFINED); #ifdef UNIV_SYNC_DEBUG sync_thread_reset_level(mutex); diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index a60ce73c35a..8ad1782b178 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -145,11 +145,15 @@ ib_time_t ut_time(void); /*=========*/ /************************************************************** -Returns system time. */ +Returns system time. +Upon successful completion, the value 0 is returned; otherwise the +value -1 is returned and the global variable errno is set to indicate the +error. */ -void +int ut_usectime( /*========*/ + /* out: 0 on success, -1 otherwise */ ulint* sec, /* out: seconds since the Epoch */ ulint* ms); /* out: microseconds since the Epoch+*sec */ /************************************************************** diff --git a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c index c2ede22dccb..173d074cb82 100644 --- a/storage/innobase/lock/lock0lock.c +++ b/storage/innobase/lock/lock0lock.c @@ -3920,15 +3920,25 @@ lock_cancel_waiting_and_release( trx_end_lock_wait(lock->trx); } +/* True if a lock mode is S or X */ +#define IS_LOCK_S_OR_X(lock) \ + (lock_get_mode(lock) == LOCK_S \ + || lock_get_mode(lock) == LOCK_X) + + /************************************************************************* -Resets all record and table locks of a transaction on a table to be dropped. -No lock is allowed to be a wait lock. */ +Removes locks of a transaction on a table to be dropped. +If remove_also_table_sx_locks is TRUE then table-level S and X locks are +also removed in addition to other table-level and record-level locks. +No lock, that is going to be removed, is allowed to be a wait lock. */ static void -lock_reset_all_on_table_for_trx( -/*============================*/ - dict_table_t* table, /* in: table to be dropped */ - trx_t* trx) /* in: a transaction */ +lock_remove_all_on_table_for_trx( +/*=============================*/ + dict_table_t* table, /* in: table to be dropped */ + trx_t* trx, /* in: a transaction */ + ibool remove_also_table_sx_locks)/* in: also removes + table S and X locks */ { lock_t* lock; lock_t* prev_lock; @@ -3946,7 +3956,9 @@ lock_reset_all_on_table_for_trx( lock_rec_discard(lock); } else if (lock_get_type(lock) & LOCK_TABLE - && lock->un_member.tab_lock.table == table) { + && lock->un_member.tab_lock.table == table + && (remove_also_table_sx_locks + || !IS_LOCK_S_OR_X(lock))) { ut_a(!lock_get_wait(lock)); @@ -3958,26 +3970,65 @@ lock_reset_all_on_table_for_trx( } /************************************************************************* -Resets all locks, both table and record locks, on a table to be dropped. -No lock is allowed to be a wait lock. */ +Removes locks on a table to be dropped or truncated. +If remove_also_table_sx_locks is TRUE then table-level S and X locks are +also removed in addition to other table-level and record-level locks. +No lock, that is going to be removed, is allowed to be a wait lock. */ void -lock_reset_all_on_table( -/*====================*/ - dict_table_t* table) /* in: table to be dropped */ +lock_remove_all_on_table( +/*=====================*/ + dict_table_t* table, /* in: table to be dropped + or truncated */ + ibool remove_also_table_sx_locks)/* in: also removes + table S and X locks */ { lock_t* lock; + lock_t* prev_lock; mutex_enter(&kernel_mutex); lock = UT_LIST_GET_FIRST(table->locks); - while (lock) { - ut_a(!lock_get_wait(lock)); + while (lock != NULL) { - lock_reset_all_on_table_for_trx(table, lock->trx); + prev_lock = UT_LIST_GET_PREV(un_member.tab_lock.locks, + lock); - lock = UT_LIST_GET_FIRST(table->locks); + /* If we should remove all locks (remove_also_table_sx_locks + is TRUE), or if the lock is not table-level S or X lock, + then check we are not going to remove a wait lock. */ + if (remove_also_table_sx_locks + || !(lock_get_type(lock) == LOCK_TABLE + && IS_LOCK_S_OR_X(lock))) { + + ut_a(!lock_get_wait(lock)); + } + + lock_remove_all_on_table_for_trx(table, lock->trx, + remove_also_table_sx_locks); + + if (prev_lock == NULL) { + if (lock == UT_LIST_GET_FIRST(table->locks)) { + /* lock was not removed, pick its successor */ + lock = UT_LIST_GET_NEXT( + un_member.tab_lock.locks, lock); + } else { + /* lock was removed, pick the first one */ + lock = UT_LIST_GET_FIRST(table->locks); + } + } else if (UT_LIST_GET_NEXT(un_member.tab_lock.locks, + prev_lock) != lock) { + /* If lock was removed by + lock_remove_all_on_table_for_trx() then pick the + successor of prev_lock ... */ + lock = UT_LIST_GET_NEXT( + un_member.tab_lock.locks, prev_lock); + } else { + /* ... otherwise pick the successor of lock. */ + lock = UT_LIST_GET_NEXT( + un_member.tab_lock.locks, lock); + } } mutex_exit(&kernel_mutex); diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c index 9adb9ddac50..8fd959512c1 100644 --- a/storage/innobase/os/os0file.c +++ b/storage/innobase/os/os0file.c @@ -1267,9 +1267,19 @@ try_again: if (file == INVALID_HANDLE_VALUE) { *success = FALSE; - retry = os_file_handle_error(name, - create_mode == OS_FILE_CREATE ? - "create" : "open"); + /* When srv_file_per_table is on, file creation failure may not + be critical to the whole instance. Do not crash the server in + case of unknown errors. */ + if (srv_file_per_table) { + retry = os_file_handle_error_no_exit(name, + create_mode == OS_FILE_CREATE ? + "create" : "open"); + } else { + retry = os_file_handle_error(name, + create_mode == OS_FILE_CREATE ? + "create" : "open"); + } + if (retry) { goto try_again; } @@ -1344,9 +1354,19 @@ try_again: if (file == -1) { *success = FALSE; - retry = os_file_handle_error(name, - create_mode == OS_FILE_CREATE ? - "create" : "open"); + /* When srv_file_per_table is on, file creation failure may not + be critical to the whole instance. Do not crash the server in + case of unknown errors. */ + if (srv_file_per_table) { + retry = os_file_handle_error_no_exit(name, + create_mode == OS_FILE_CREATE ? + "create" : "open"); + } else { + retry = os_file_handle_error(name, + create_mode == OS_FILE_CREATE ? + "create" : "open"); + } + if (retry) { goto try_again; } else { diff --git a/storage/innobase/plug.in b/storage/innobase/plug.in index b252d471fba..f7d2abed751 100644 --- a/storage/innobase/plug.in +++ b/storage/innobase/plug.in @@ -15,25 +15,30 @@ MYSQL_PLUGIN_ACTIONS(innobase, [ AC_CHECK_FUNCS(localtime_r) AC_C_BIGENDIAN case "$target_os" in - lin*) - CFLAGS="$CFLAGS -DUNIV_LINUX";; - hpux10*) - CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX -DUNIV_HPUX10";; - hp*) - CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX";; - aix*) - CFLAGS="$CFLAGS -DUNIV_AIX";; - irix*) - CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; - osf*) - CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; - *solaris*|*SunOS*) - CFLAGS="$CFLAGS -DUNIV_SOLARIS";; - sysv5uw7*) - # Problem when linking on SCO - CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; - openbsd*) - CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; + lin*) + CFLAGS="$CFLAGS -DUNIV_LINUX";; + hpux10*) + CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX -DUNIV_HPUX10";; + hp*) + CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX";; + aix*) + CFLAGS="$CFLAGS -DUNIV_AIX";; + irix*|osf*|sysv5uw7*|openbsd*) + CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; + *solaris*|*SunOS*) + CFLAGS="$CFLAGS -DUNIV_SOLARIS";; esac + INNODB_DYNAMIC_CFLAGS="-DMYSQL_DYNAMIC_PLUGIN" + case "$target_cpu" in + x86_64) + # The AMD64 ABI forbids absolute addresses in shared libraries + ;; + *86) + # Use absolute addresses on IA-32 + INNODB_DYNAMIC_CFLAGS="$INNODB_DYNAMIC_CFLAGS -prefer-non-pic" + ;; + esac + AC_SUBST(INNODB_DYNAMIC_CFLAGS) ]) +# vim: set ft=config: diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index d5ef12d0af2..d76af54b420 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -661,7 +661,14 @@ row_create_prebuilt( prebuilt->old_vers_heap = NULL; - prebuilt->last_value = 0; + prebuilt->autoinc_error = 0; + prebuilt->autoinc_offset = 0; + + /* Default to 1, we will set the actual value later in + ha_innobase::get_auto_increment(). */ + prebuilt->autoinc_increment = 1; + + prebuilt->autoinc_last_value = 0; return(prebuilt); } @@ -1963,6 +1970,7 @@ row_create_index_for_mysql( ulint err; ulint i, j; ulint len; + char* table_name; #ifdef UNIV_SYNC_DEBUG ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX)); @@ -1972,6 +1980,11 @@ row_create_index_for_mysql( trx->op_info = "creating index"; + /* Copy the table name because we may want to drop the + table later, after the index object is freed (inside + que_run_threads()) and thus index->table_name is not available. */ + table_name = mem_strdup(index->table_name); + trx_start_if_not_started(trx); /* Check that the same column does not appear twice in the index. @@ -2044,13 +2057,15 @@ error_handling: trx_general_rollback_for_mysql(trx, FALSE, NULL); - row_drop_table_for_mysql(index->table_name, trx, FALSE); + row_drop_table_for_mysql(table_name, trx, FALSE); trx->error_state = DB_SUCCESS; } trx->op_info = ""; + mem_free(table_name); + return((int) err); } @@ -2443,8 +2458,8 @@ row_discard_tablespace_for_mysql( new_id = dict_hdr_get_new_id(DICT_HDR_TABLE_ID); - /* Remove any locks there are on the table or its records */ - lock_reset_all_on_table(table); + /* Remove all locks except the table-level S and X locks. */ + lock_remove_all_on_table(table, FALSE); info = pars_info_create(); @@ -2779,9 +2794,8 @@ row_truncate_table_for_mysql( goto funct_exit; } - /* Remove any locks there are on the table or its records */ - - lock_reset_all_on_table(table); + /* Remove all locks except the table-level S and X locks. */ + lock_remove_all_on_table(table, FALSE); trx->table_id = table->id; @@ -2896,7 +2910,7 @@ next_rec: /* MySQL calls ha_innobase::reset_auto_increment() which does the same thing. */ dict_table_autoinc_lock(table); - dict_table_autoinc_initialize(table, 0); + dict_table_autoinc_initialize(table, 1); dict_table_autoinc_unlock(table); dict_update_statistics(table); @@ -3131,9 +3145,8 @@ check_next_foreign: goto funct_exit; } - /* Remove any locks there are on the table or its records */ - - lock_reset_all_on_table(table); + /* Remove all locks there are on the table or its records */ + lock_remove_all_on_table(table, TRUE); trx->dict_operation = TRUE; trx->table_id = table->id; @@ -3429,8 +3442,6 @@ loop: err = row_drop_table_for_mysql(table_name, trx, TRUE); - mem_free(table_name); - if (err != DB_SUCCESS) { fputs("InnoDB: DROP DATABASE ", stderr); ut_print_name(stderr, trx, TRUE, name); @@ -3438,8 +3449,11 @@ loop: (ulint) err); ut_print_name(stderr, trx, TRUE, table_name); putc('\n', stderr); + mem_free(table_name); break; } + + mem_free(table_name); } if (err == DB_SUCCESS) { diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index 6ff135e4f5a..79f107ce77d 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -32,6 +32,7 @@ Created 12/19/1997 Heikki Tuuri #include "row0mysql.h" #include "read0read.h" #include "buf0lru.h" +#include "ha_prototypes.h" /* Maximum number of rows to prefetch; MySQL interface has another parameter */ #define SEL_MAX_N_PREFETCH 16 @@ -3577,20 +3578,12 @@ shortcut_fails_too_big_rec: if (trx->isolation_level <= TRX_ISO_READ_COMMITTED && prebuilt->select_lock_type != LOCK_NONE - && trx->mysql_query_str != NULL - && *trx->mysql_query_str != NULL - && trx->mysql_thd != NULL) { + && trx->mysql_thd != NULL + && thd_is_select(trx->mysql_thd)) { + /* It is a plain locking SELECT and the isolation + level is low: do not lock gaps */ - /* Scan the MySQL query string; check if SELECT is the first - word there */ - - if (dict_str_starts_with_keyword( - trx->mysql_thd, *trx->mysql_query_str, "SELECT")) { - /* It is a plain locking SELECT and the isolation - level is low: do not lock gaps */ - - set_also_gap_locks = FALSE; - } + set_also_gap_locks = FALSE; } /* Note that if the search mode was GE or G, then the cursor diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c index 773b5d583e0..e8b7bd4cee2 100644 --- a/storage/innobase/srv/srv0srv.c +++ b/storage/innobase/srv/srv0srv.c @@ -1453,8 +1453,11 @@ srv_suspend_mysql_thread( srv_n_lock_wait_count++; srv_n_lock_wait_current_count++; - ut_usectime(&sec, &ms); - start_time = (ib_longlong)sec * 1000000 + ms; + if (ut_usectime(&sec, &ms) == -1) { + start_time = -1; + } else { + start_time = (ib_longlong)sec * 1000000 + ms; + } } /* Wake the lock timeout monitor thread, if it is suspended */ @@ -1508,14 +1511,20 @@ srv_suspend_mysql_thread( wait_time = ut_difftime(ut_time(), slot->suspend_time); if (thr->lock_state == QUE_THR_LOCK_ROW) { - ut_usectime(&sec, &ms); - finish_time = (ib_longlong)sec * 1000000 + ms; + if (ut_usectime(&sec, &ms) == -1) { + finish_time = -1; + } else { + finish_time = (ib_longlong)sec * 1000000 + ms; + } diff_time = (ulint) (finish_time - start_time); srv_n_lock_wait_current_count--; srv_n_lock_wait_time = srv_n_lock_wait_time + diff_time; - if (diff_time > srv_n_lock_max_wait_time) { + if (diff_time > srv_n_lock_max_wait_time && + /* only update the variable if we successfully + retrieved the start and finish times. See Bug#36819. */ + start_time != -1 && finish_time != -1) { srv_n_lock_max_wait_time = diff_time; } } diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c index 979d882307a..ea88039f3dd 100644 --- a/storage/innobase/srv/srv0start.c +++ b/storage/innobase/srv/srv0start.c @@ -202,13 +202,13 @@ srv_parse_data_file_paths_and_sizes( str = srv_parse_megabytes(str, &size); - if (0 == memcmp(str, ":autoextend", - (sizeof ":autoextend") - 1)) { + if (0 == strncmp(str, ":autoextend", + (sizeof ":autoextend") - 1)) { str += (sizeof ":autoextend") - 1; - if (0 == memcmp(str, ":max:", - (sizeof ":max:") - 1)) { + if (0 == strncmp(str, ":max:", + (sizeof ":max:") - 1)) { str += (sizeof ":max:") - 1; @@ -290,14 +290,15 @@ srv_parse_data_file_paths_and_sizes( (*data_file_names)[i] = path; (*data_file_sizes)[i] = size; - if (0 == memcmp(str, ":autoextend", - (sizeof ":autoextend") - 1)) { + if (0 == strncmp(str, ":autoextend", + (sizeof ":autoextend") - 1)) { *is_auto_extending = TRUE; str += (sizeof ":autoextend") - 1; - if (0 == memcmp(str, ":max:", (sizeof ":max:") - 1)) { + if (0 == strncmp(str, ":max:", + (sizeof ":max:") - 1)) { str += (sizeof ":max:") - 1; diff --git a/storage/innobase/ut/ut0ut.c b/storage/innobase/ut/ut0ut.c index 1ca278cd633..6b5bcef1830 100644 --- a/storage/innobase/ut/ut0ut.c +++ b/storage/innobase/ut/ut0ut.c @@ -112,19 +112,45 @@ ut_time(void) } /************************************************************** -Returns system time. */ +Returns system time. +Upon successful completion, the value 0 is returned; otherwise the +value -1 is returned and the global variable errno is set to indicate the +error. */ -void +int ut_usectime( /*========*/ + /* out: 0 on success, -1 otherwise */ ulint* sec, /* out: seconds since the Epoch */ ulint* ms) /* out: microseconds since the Epoch+*sec */ { struct timeval tv; + int ret; + int errno_gettimeofday; + int i; + + for (i = 0; i < 10; i++) { + + ret = ut_gettimeofday(&tv, NULL); + + if (ret == -1) { + errno_gettimeofday = errno; + ut_print_timestamp(stderr); + fprintf(stderr, " InnoDB: gettimeofday(): %s\n", + strerror(errno_gettimeofday)); + os_thread_sleep(100000); /* 0.1 sec */ + errno = errno_gettimeofday; + } else { + break; + } + } + + if (ret != -1) { + *sec = (ulint) tv.tv_sec; + *ms = (ulint) tv.tv_usec; + } - ut_gettimeofday(&tv, NULL); - *sec = (ulint) tv.tv_sec; - *ms = (ulint) tv.tv_usec; + return(ret); } /************************************************************** diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c index 0fac5d06379..274f91e2691 100644 --- a/storage/myisam/ft_boolean_search.c +++ b/storage/myisam/ft_boolean_search.c @@ -161,11 +161,11 @@ static int FTB_WORD_cmp(my_off_t *v, FTB_WORD *a, FTB_WORD *b) static int FTB_WORD_cmp_list(CHARSET_INFO *cs, FTB_WORD **a, FTB_WORD **b) { - /* ORDER BY word DESC, ndepth DESC */ - int i= ha_compare_text(cs, (uchar*) (*b)->word+1,(*b)->len-1, - (uchar*) (*a)->word+1,(*a)->len-1,0,0); + /* ORDER BY word, ndepth */ + int i= ha_compare_text(cs, (uchar*) (*a)->word + 1, (*a)->len - 1, + (uchar*) (*b)->word + 1, (*b)->len - 1, 0, 0); if (!i) - i=CMP_NUM((*b)->ndepth,(*a)->ndepth); + i= CMP_NUM((*a)->ndepth, (*b)->ndepth); return i; } @@ -865,23 +865,49 @@ static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param, FT_INFO *ftb= ftb_param->ftb; FTB_WORD *ftbw; int a, b, c; + /* + Find right-most element in the array of query words matching this + word from a document. + */ for (a= 0, b= ftb->queue.elements, c= (a+b)/2; b-a>1; c= (a+b)/2) { ftbw= ftb->list[c]; if (ha_compare_text(ftb->charset, (uchar*)word, len, (uchar*)ftbw->word+1, ftbw->len-1, - (my_bool)(ftbw->flags&FTB_FLAG_TRUNC), 0) > 0) + (my_bool) (ftbw->flags & FTB_FLAG_TRUNC), 0) < 0) b= c; else a= c; } + /* + If there were no words with truncation operator, we iterate to the + beginning of an array until array element is equal to the word from + a document. This is done mainly because the same word may be + mentioned twice (or more) in the query. + + In case query has words with truncation operator we must iterate + to the beginning of the array. There may be non-matching query words + between matching word with truncation operator and the right-most + matching element. E.g., if we're looking for 'aaa15' in an array of + 'aaa1* aaa14 aaa15 aaa16'. + + Worse of that there still may be match even if the binary search + above didn't find matching element. E.g., if we're looking for + 'aaa15' in an array of 'aaa1* aaa14 aaa16'. The binary search will + stop at 'aaa16'. + */ for (; c >= 0; c--) { ftbw= ftb->list[c]; if (ha_compare_text(ftb->charset, (uchar*)word, len, (uchar*)ftbw->word + 1,ftbw->len - 1, (my_bool)(ftbw->flags & FTB_FLAG_TRUNC), 0)) - break; + { + if (ftb->with_scan & FTB_FLAG_TRUNC) + continue; + else + break; + } if (ftbw->docid[1] == ftb->info->lastpos) continue; ftbw->docid[1]= ftb->info->lastpos; diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c index 1c8e9e7f4dd..3d96dfaafa1 100644 --- a/storage/myisam/myisampack.c +++ b/storage/myisam/myisampack.c @@ -300,7 +300,7 @@ static void print_version(void) static void usage(void) { print_version(); - puts("Copyright (C) 2002 MySQL AB"); + puts("Copyright 2002-2008 MySQL AB, 2008 Sun Microsystems, Inc."); puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,"); puts("and you are welcome to modify and redistribute it under the GPL license\n"); diff --git a/storage/ndb/docs/doxygen/postdoxy.pl b/storage/ndb/docs/doxygen/postdoxy.pl index ad0edb44a31..3bf54e4ff75 100755 --- a/storage/ndb/docs/doxygen/postdoxy.pl +++ b/storage/ndb/docs/doxygen/postdoxy.pl @@ -81,9 +81,9 @@ open (OUTFILE, "> ${destdir}/doxygen.sty.new") while (<INFILE>) { if (/\\rfoot/) { - print OUTFILE "\\rfoot[\\fancyplain{}{\\bfseries\\small \\copyright~Copyright 2003-2004 MySQL AB\\hfill support-cluster\@mysql.com}]{}\n"; + print OUTFILE "\\rfoot[\\fancyplain{}{\\bfseries\\small \\copyright~Copyright 2003-2008 MySQL AB, 2008 Sun Microsystems, Inc.\\hfill support-cluster\@mysql.com}]{}\n"; } elsif (/\\lfoot/) { - print OUTFILE "\\lfoot[]{\\fancyplain{}{\\bfseries\\small support-cluster\@mysql.com\\hfill \\copyright~Copyright 2003-2004 MySQL AB}}\n"; + print OUTFILE "\\lfoot[]{\\fancyplain{}{\\bfseries\\small support-cluster\@mysql.com\\hfill \\copyright~Copyright 2003-2008 MySQL AB, 2008 Sun Microsystems, Inc.}}\n"; } else { print OUTFILE; } diff --git a/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp index 043df5d5038..7bd61dfe8b3 100644 --- a/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp +++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp @@ -551,7 +551,7 @@ Dbtc::execDROP_TAB_REQ(Signal* signal) Uint32 senderRef = req->senderRef; Uint32 senderData = req->senderData; DropTabReq::RequestType rt = (DropTabReq::RequestType)req->requestType; - + if(!tabPtr.p->get_enabled() && rt == DropTabReq::OnlineDropTab){ jam(); DropTabRef* ref = (DropTabRef*)signal->getDataPtrSend(); diff --git a/storage/ndb/test/run-test/atrt.hpp b/storage/ndb/test/run-test/atrt.hpp index 14d2dccd245..db26bd9bfc0 100644 --- a/storage/ndb/test/run-test/atrt.hpp +++ b/storage/ndb/test/run-test/atrt.hpp @@ -2,8 +2,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/storage/ndb/test/tools/connect.cpp b/storage/ndb/test/tools/connect.cpp index 2d3ac34d3e8..278dbe833ea 100644 --- a/storage/ndb/test/tools/connect.cpp +++ b/storage/ndb/test/tools/connect.cpp @@ -2,8 +2,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/strings/conf_to_src.c b/strings/conf_to_src.c index dc2a300a2ec..7e742050aa8 100644 --- a/strings/conf_to_src.c +++ b/strings/conf_to_src.c @@ -249,7 +249,7 @@ static void fprint_copyright(FILE *file) { fprintf(file, -"/* Copyright (C) 2000-2007 MySQL AB\n" +"/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.\n" "\n" " This program is free software; you can redistribute it and/or modify\n" " it under the terms of the GNU General Public License as published by\n" diff --git a/strings/ctype.c b/strings/ctype.c index 59ebb50b124..69fe5b6b9dc 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -341,6 +341,16 @@ my_string_repertoire(CHARSET_INFO *cs, const char *str, ulong length) /* + Returns repertoire for charset +*/ +uint my_charset_repertoire(CHARSET_INFO *cs) +{ + return cs->state & MY_CS_PUREASCII ? + MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30; +} + + +/* Detect whether a character set is ASCII compatible. Returns TRUE for: diff --git a/strings/xml.c b/strings/xml.c index 5c62a8e8603..1b697ec6b26 100644 --- a/strings/xml.c +++ b/strings/xml.c @@ -328,7 +328,7 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, size_t len) } while ((MY_XML_IDENT == (lex=my_xml_scan(p,&a))) || - (MY_XML_STRING == lex)) + ((MY_XML_STRING == lex && exclam))) { MY_XML_ATTR b; if (MY_XML_EQ == (lex=my_xml_scan(p,&b))) @@ -349,13 +349,22 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, size_t len) return MY_XML_ERROR; } } - else if ((MY_XML_STRING == lex) || (MY_XML_IDENT == lex)) + else if (MY_XML_IDENT == lex) { p->current_node_type= MY_XML_NODE_ATTR; if ((MY_XML_OK != my_xml_enter(p,a.beg,(size_t) (a.end-a.beg))) || (MY_XML_OK != my_xml_leave(p,a.beg,(size_t) (a.end-a.beg)))) return MY_XML_ERROR; } + else if ((MY_XML_STRING == lex) && exclam) + { + /* + We are in <!DOCTYPE>, e.g. + <!DOCTYPE name SYSTEM "SystemLiteral"> + <!DOCTYPE name PUBLIC "PublidLiteral" "SystemLiteral"> + Just skip "SystemLiteral" and "PublicidLiteral" + */ + } else break; } diff --git a/support-files/my-small.cnf.sh b/support-files/my-small.cnf.sh index 11ad69f1f71..7bf8f323d57 100644 --- a/support-files/my-small.cnf.sh +++ b/support-files/my-small.cnf.sh @@ -34,7 +34,7 @@ sort_buffer_size = 64K read_buffer_size = 256K read_rnd_buffer_size = 256K net_buffer_length = 2K -thread_stack = 64K +thread_stack = 128K # Don't listen on a TCP/IP port at all. This can be a security enhancement, # if all processes that need to connect to mysqld run on the same host. diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 0a4afbb2698..206b582c891 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -1,4 +1,4 @@ -# Copyright (C) 2000-2007 MySQL AB +# Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,7 +15,11 @@ # MA 02110-1301 USA. %define mysql_version @VERSION@ -%define mysql_vendor MySQL AB + +# NOTE: "vendor" is used in upgrade/downgrade check, so you can't +# change these, has to be exactly as is. +%define mysql_old_vendor MySQL AB +%define mysql_vendor Sun Microsystems, Inc. # use "rpmbuild --with static" or "rpm --define '_with_static 1'" (for RPM 3.x) # to enable static linking (off by default) @@ -43,7 +47,7 @@ %define release 0.glibc23 %endif %define license GPL -%define mysqld_user mysql +%define mysqld_user mysql %define mysqld_group mysql %define server_suffix -standard %define mysqldatadir /var/lib/mysql @@ -76,10 +80,10 @@ Summary: MySQL: a very fast and reliable SQL database server Group: Applications/Databases Version: @MYSQL_NO_DASH_VERSION@ Release: %{release} -License: %{license} +License: Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Under %{license} license as shown in the Description field. Source: http://www.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/mysql-%{mysql_version}.tar.gz URL: http://www.mysql.com/ -Packager: MySQL Production Engineering Team <build@mysql.com> +Packager: Sun Microsystems, Inc. Product Engineering Team <build@mysql.com> Vendor: %{mysql_vendor} Provides: msqlormysql MySQL-server mysql BuildRequires: ncurses-devel @@ -95,9 +99,11 @@ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database server. MySQL Server is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software. MySQL is a trademark of -MySQL AB. +Sun Microsystems, Inc. + +Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. All rights reserved. +Use is subject to license terms. -Copyright (C) 2000-2007 MySQL AB This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL license. @@ -117,9 +123,11 @@ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database server. MySQL Server is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software. MySQL is a trademark of -MySQL AB. +Sun Microsystems, Inc. + +Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. All rights reserved. +Use is subject to license terms. -Copyright (C) 2000-2007 MySQL AB This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL license. @@ -289,7 +297,11 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \ --with-unix-socket-path=/var/lib/mysql/mysql.sock \ --with-pic \ --prefix=/ \ +%if %{CLUSTER_BUILD} --with-extra-charsets=all \ +%else + --with-extra-charsets=complex \ +%endif %if %{YASSL_BUILD} --with-ssl \ %endif @@ -304,7 +316,20 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \ --mandir=%{_mandir} \ --enable-thread-safe-client \ --with-readline \ - " + --with-innodb \ +%if %{CLUSTER_BUILD} + --with-ndbcluster \ +%else + --without-ndbcluster \ +%endif + --with-archive-storage-engine \ + --with-csv-storage-engine \ + --with-blackhole-storage-engine \ + --with-federated-storage-engine \ + --with-partition \ + --with-big-tables \ + --enable-shared \ + " make } @@ -331,6 +356,8 @@ mkdir -p $RBR%{_libdir}/mysql PATH=${MYSQL_BUILD_PATH:-/bin:/usr/bin} export PATH +# Build the Debug binary. + # Use gcc for C and C++ code (to avoid a dependency on libstdc++ and # including exceptions into the code if [ -z "$CXX" -a -z "$CC" ] @@ -351,19 +378,23 @@ CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-except ( # We are in a subshell, so we can modify variables just for one run. -CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]* //' -e 's/-unroll2 //' -e 's/-ip //' -e 's/$/ -g/'` -CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-O[0-9]* //' -e 's/-unroll2 //' -e 's/-ip //' -e 's/$/ -g/'` +CFLAGS=`echo " $CFLAGS " | \ + sed -e 's/ -O[0-9]* / /' -e 's/ -unroll2 / /' -e 's/ -ip / /' \ + -e 's/^ //' -e 's/ $//'` +CXXFLAGS=`echo " $CXXFLAGS " | \ + sed -e 's/ -O[0-9]* / /' -e 's/ -unroll2 / /' -e 's/ -ip / /' \ + -e 's/^ //' -e 's/ $//'` # Add -g and --with-debug. cd mysql-debug-%{mysql_version} && -CFLAGS=\"$CFLAGS\" \ -CXXFLAGS=\"$CXXFLAGS\" \ -BuildMySQL "--enable-shared \ +CFLAGS="$CFLAGS" \ +CXXFLAGS="$CXXFLAGS" \ +BuildMySQL "\ --with-debug \ %if %{MARIA_BUILD} - --with-comment=\"MySQL Community Server - Debug [Maria] (GPL)\" \ + --with-comment=\"MySQL Community Server - Debug [Maria] (%{license})\" \ %else - --with-comment=\"MySQL Community Server - Debug (GPL)\" \ + --with-comment=\"MySQL Community Server - Debug (%{license})\" \ %endif ") @@ -382,14 +413,14 @@ fi ############################################################################## (cd mysql-release-%{mysql_version} && -CFLAGS=\"$CFLAGS\" \ -CXXFLAGS=\"$CXXFLAGS\" \ -BuildMySQL "--enable-shared \ +CFLAGS="$CFLAGS" \ +CXXFLAGS="$CXXFLAGS" \ +BuildMySQL "\ --with-embedded-server \ %if %{MARIA_BUILD} - --with-comment=\"MySQL Community Server [Maria] (GPL)\" \ + --with-comment=\"MariaDB, a community SQL server based on the MySQL Server with Maria (GPL)\" \ %else - --with-comment=\"MySQL Community Server (GPL)\" \ + --with-comment=\"MySQL Community Server (%{license})\" \ %endif ") # We might want to save the config log file @@ -471,6 +502,7 @@ installed=`rpm -q --whatprovides mysql-server 2> /dev/null` if [ $? -eq 0 -a -n "$installed" ]; then vendor=`rpm -q --queryformat='%{VENDOR}' "$installed" 2>&1` version=`rpm -q --queryformat='%{VERSION}' "$installed" 2>&1` + myoldvendor='%{mysql_old_vendor}' myvendor='%{mysql_vendor}' myversion='%{mysql_version}' @@ -482,12 +514,12 @@ if [ $? -eq 0 -a -n "$installed" ]; then [ -z "$new_family" ] && new_family="<bad package specification: version $myversion>" error_text= - if [ "$vendor" != "$myvendor" ]; then + if [ "$vendor" != "$myoldvendor" -a "$vendor" != "$myvendor" ]; then error_text="$error_text The current MySQL server package is provided by a different -vendor ($vendor) than $myvendor. Some files may be installed -to different locations, including log files and the service -startup script in %{_sysconfdir}/init.d/. +vendor ($vendor) than $myoldvendor or $myvendor. +Some files may be installed to different locations, including log +files and the service startup script in %{_sysconfdir}/init.d/. " fi @@ -711,7 +743,6 @@ fi %attr(755, root, root) %{_bindir}/msql2mysql %attr(755, root, root) %{_bindir}/mysql %attr(755, root, root) %{_bindir}/mysql_find_rows -%attr(755, root, root) %{_bindir}/mysql_upgrade_shell %attr(755, root, root) %{_bindir}/mysql_waitpid %attr(755, root, root) %{_bindir}/mysqlaccess %attr(755, root, root) %{_bindir}/mysqladmin @@ -851,6 +882,16 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog +* Fri Nov 07 2008 Joerg Bruehe <joerg@mysql.com> + +- Correct yesterday's fix, so that it also works for the last flag, + and fix a wrong quoting: un-quoted quote marks must not be escaped. + +* Thu Nov 06 2008 Kent Boortz <kent.boortz@sun.com> + +- Removed "mysql_upgrade_shell" +- Removed some copy/paste between debug and normal build + * Thu Nov 06 2008 Joerg Bruehe <joerg@mysql.com> - Modify CFLAGS and CXXFLAGS such that a debug build is not optimized. diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 3fa1296d66e..68a99c62902 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -16553,6 +16553,61 @@ static void test_change_user() DBUG_VOID_RETURN; } +#ifdef HAVE_SPATIAL +/** + Bug#37956 memory leak and / or crash with geometry and prepared statements! +*/ + +static void test_bug37956(void) +{ + const char *query="select point(?,?)"; + MYSQL_STMT *stmt=NULL; + ulong val=0; + MYSQL_BIND bind_param[2]; + unsigned char buff[2]= { 134, 211 }; + DBUG_ENTER("test_bug37956"); + myheader("test_bug37956"); + + stmt= mysql_simple_prepare(mysql, query); + check_stmt(stmt); + + val=1; + mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (void *)&val); + val=CURSOR_TYPE_READ_ONLY; + mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void *)&val); + val=0; + mysql_stmt_attr_set(stmt, STMT_ATTR_PREFETCH_ROWS, (void *)&val); + + memset(bind_param, 0, sizeof(bind_param)); + bind_param[0].buffer_type=MYSQL_TYPE_TINY; + bind_param[0].buffer= (void *)buff; + bind_param[0].is_null=NULL; + bind_param[0].error=NULL; + bind_param[0].is_unsigned=1; + bind_param[1].buffer_type=MYSQL_TYPE_TINY; + bind_param[1].buffer= (void *)(buff+1); + bind_param[1].is_null=NULL; + bind_param[1].error=NULL; + bind_param[1].is_unsigned=1; + + if (mysql_stmt_bind_param(stmt, bind_param)) + { + mysql_stmt_close(stmt); + DIE_UNLESS(0); + } + + if (mysql_stmt_execute(stmt)) + { + mysql_stmt_close(stmt); + DBUG_VOID_RETURN; + } + /* Should never reach here: execution returns an error. */ + mysql_stmt_close(stmt); + DIE_UNLESS(0); + DBUG_VOID_RETURN; +} +#endif + /* Bug#27592 (stack overrun when storing datetime value using prepared statements) */ @@ -17968,6 +18023,9 @@ static struct my_tests_st my_tests[]= { { "test_wl4166_2", test_wl4166_2 }, { "test_bug38486", test_bug38486 }, { "test_bug40365", test_bug40365 }, +#ifdef HAVE_SPATIAL + { "test_bug37956", test_bug37956 }, +#endif { 0, 0 } }; diff --git a/win/configure.js b/win/configure.js index f3a30ec9686..9aa7c881d4d 100644 --- a/win/configure.js +++ b/win/configure.js @@ -49,6 +49,7 @@ try case "__NT__": case "CYBOZU": case "EMBED_MANIFESTS": + case "EXTRA_DEBUG": case "WITH_EMBEDDED_SERVER": configfile.WriteLine("SET (" + args.Item(i) + " TRUE)"); break; |