Commit 44438803 authored by Sven Sandberg's avatar Sven Sandberg

merge with local changes for bug#37906

parents fb17cbe4 1bcd20bf
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags $valgrind_flags"
extra_configs="$pentium_configs $debug_configs $max_no_ndb_configs"
. "$path/FINISH.sh"
if test -z "$just_print"
then
set +v +x
echo "\
******************************************************************************
Note that by default BUILD/compile-pentium-valgrind-max calls 'configure' with
--enable-assembler. When Valgrind detects an error involving an assembly
function (for example an uninitialized value used as an argument of an
assembly function), Valgrind will not print the stacktrace and 'valgrind
--gdb-attach=yes' will not work either. If you need a stacktrace in those
cases, you have to run BUILD/compile-pentium-valgrind-max with the
--disable-assembler argument.
******************************************************************************"
fi
...@@ -149,7 +149,7 @@ test-bt: ...@@ -149,7 +149,7 @@ test-bt:
echo "no program found for 'ndbcluster' tests - skipped testing" ; \ echo "no program found for 'ndbcluster' tests - skipped testing" ; \
fi fi
-cd mysql-test ; MTR_BUILD_THREAD=auto \ -cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --force --comment=funcs1+ps --ps-protocol --suite=funcs_1 @PERL@ ./mysql-test-run.pl --force --comment=funcs1+ps --ps-protocol --reorder --suite=funcs_1
-cd mysql-test ; MTR_BUILD_THREAD=auto \ -cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --force --comment=funcs2 --suite=funcs_2 @PERL@ ./mysql-test-run.pl --force --comment=funcs2 --suite=funcs_2
-cd mysql-test ; MTR_BUILD_THREAD=auto \ -cd mysql-test ; MTR_BUILD_THREAD=auto \
...@@ -190,7 +190,7 @@ test-force-full-pl: test-force-full ...@@ -190,7 +190,7 @@ test-force-full-pl: test-force-full
test-ext-funcs: test-ext-funcs:
cd mysql-test ; \ cd mysql-test ; \
@PERL@ ./mysql-test-run.pl --force --suite=funcs_1 ; \ @PERL@ ./mysql-test-run.pl --force --reorder --suite=funcs_1 ; \
@PERL@ ./mysql-test-run.pl --force --suite=funcs_2 @PERL@ ./mysql-test-run.pl --force --suite=funcs_2
test-ext-rpl: test-ext-rpl:
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake") INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake")
# We use the "mysqlclient_notls" library here just as safety, in case # We use the "mysqlclient_notls" library here just as safety, in case
# any of the clients here would go beond the client API and access the # any of the clients here would go beyond the client API and access the
# Thread Local Storage directly. # Thread Local Storage directly.
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
...@@ -32,9 +32,9 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ...@@ -32,9 +32,9 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../mysys/my_conio.c) ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../mysys/my_conio.c)
TARGET_LINK_LIBRARIES(mysql mysqlclient_notls wsock32) TARGET_LINK_LIBRARIES(mysql mysqlclient_notls wsock32)
ADD_EXECUTABLE(mysqltest mysqltest.c ../mysys/my_getsystime.c ADD_EXECUTABLE(mysqltest mysqltest.c)
../mysys/my_copy.c ../mysys/my_mkdir.c) SET_SOURCE_FILES_PROPERTIES(mysqltest.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqltest mysqlclient_notls regex wsock32) TARGET_LINK_LIBRARIES(mysqltest mysqlclient mysys regex wsock32 dbug)
ADD_EXECUTABLE(mysqlcheck mysqlcheck.c) ADD_EXECUTABLE(mysqlcheck mysqlcheck.c)
TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient_notls wsock32) TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient_notls wsock32)
......
...@@ -86,11 +86,13 @@ mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \ ...@@ -86,11 +86,13 @@ mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
$(LIBMYSQLCLIENT_LA) \ $(LIBMYSQLCLIENT_LA) \
$(top_builddir)/mysys/libmysys.a $(top_builddir)/mysys/libmysys.a
mysqltest_SOURCES= mysqltest.c \ mysqltest_SOURCES= mysqltest.c
$(top_srcdir)/mysys/my_getsystime.c \ mysqltest_CFLAGS= -DTHREAD -UUNDEF_THREADS_HACK
$(top_srcdir)/mysys/my_copy.c \ mysqltest_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
$(top_srcdir)/mysys/my_mkdir.c @CLIENT_EXTRA_LDFLAGS@ \
mysqltest_LDADD = $(top_builddir)/regex/libregex.a $(LDADD) $(LIBMYSQLCLIENT_LA) \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/regex/libregex.a
mysql_upgrade_SOURCES= mysql_upgrade.c \ mysql_upgrade_SOURCES= mysql_upgrade.c \
$(top_srcdir)/mysys/my_getpagesize.c $(top_srcdir)/mysys/my_getpagesize.c
......
...@@ -1821,7 +1821,7 @@ static int read_and_execute(bool interactive) ...@@ -1821,7 +1821,7 @@ static int read_and_execute(bool interactive)
the very beginning of a text file when the very beginning of a text file when
you save the file using "Unicode UTF-8" format. you save the file using "Unicode UTF-8" format.
*/ */
if (!line_number && if (line && !line_number &&
(uchar) line[0] == 0xEF && (uchar) line[0] == 0xEF &&
(uchar) line[1] == 0xBB && (uchar) line[1] == 0xBB &&
(uchar) line[2] == 0xBF) (uchar) line[2] == 0xBF)
...@@ -2101,37 +2101,6 @@ static bool add_line(String &buffer,char *line,char *in_string, ...@@ -2101,37 +2101,6 @@ static bool add_line(String &buffer,char *line,char *in_string,
continue; 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)) else if (!*ml_comment && !*in_string && is_prefix(pos, delimiter))
{ {
// Found a statement. Continue parsing after the delimiter // Found a statement. Continue parsing after the delimiter
...@@ -2176,7 +2145,14 @@ static bool add_line(String &buffer,char *line,char *in_string, ...@@ -2176,7 +2145,14 @@ static bool add_line(String &buffer,char *line,char *in_string,
} }
else if (!*ml_comment && (!*in_string && (inchar == '#' || else if (!*ml_comment && (!*in_string && (inchar == '#' ||
inchar == '-' && pos[1] == '-' && inchar == '-' && pos[1] == '-' &&
my_isspace(charset_info,pos[2])))) /*
The third byte is either whitespace or is the
end of the line -- which would occur only
because of the user sending newline -- which is
itself whitespace and should also match.
*/
(my_isspace(charset_info,pos[2]) ||
!pos[2]))))
{ {
// Flush previously accepted characters // Flush previously accepted characters
if (out != line) if (out != line)
......
...@@ -48,7 +48,15 @@ ...@@ -48,7 +48,15 @@
#ifdef __WIN__ #ifdef __WIN__
#include <direct.h> #include <direct.h>
#endif #endif
#include <signal.h>
#include <my_stacktrace.h>
#ifdef __WIN__
#include <crtdbg.h>
#define SIGNAL_FMT "exception 0x%x"
#else
#define SIGNAL_FMT "signal %d"
#endif
/* Use cygwin for --exec and --system before 5.0 */ /* Use cygwin for --exec and --system before 5.0 */
#if MYSQL_VERSION_ID < 50000 #if MYSQL_VERSION_ID < 50000
...@@ -214,6 +222,7 @@ struct st_connection ...@@ -214,6 +222,7 @@ struct st_connection
/* Used when creating views and sp, to avoid implicit commit */ /* Used when creating views and sp, to avoid implicit commit */
MYSQL* util_mysql; MYSQL* util_mysql;
char *name; char *name;
size_t name_len;
MYSQL_STMT* stmt; MYSQL_STMT* stmt;
#ifdef EMBEDDED_LIBRARY #ifdef EMBEDDED_LIBRARY
...@@ -4613,6 +4622,7 @@ void do_connect(struct st_command *command) ...@@ -4613,6 +4622,7 @@ void do_connect(struct st_command *command)
ds_connection_name.str)); ds_connection_name.str));
if (!(con_slot->name= my_strdup(ds_connection_name.str, MYF(MY_WME)))) if (!(con_slot->name= my_strdup(ds_connection_name.str, MYF(MY_WME))))
die("Out of memory"); die("Out of memory");
con_slot->name_len= strlen(con_slot->name);
cur_con= con_slot; cur_con= con_slot;
if (con_slot == next_con) if (con_slot == next_con)
...@@ -7015,6 +7025,104 @@ void mark_progress(struct st_command* command __attribute__((unused)), ...@@ -7015,6 +7025,104 @@ void mark_progress(struct st_command* command __attribute__((unused)),
} }
#ifdef HAVE_STACKTRACE
static void dump_backtrace(void)
{
struct st_connection *conn= cur_con;
my_safe_print_str("read_command_buf", read_command_buf,
sizeof(read_command_buf));
if (conn)
{
my_safe_print_str("conn->name", conn->name, conn->name_len);
#ifdef EMBEDDED_LIBRARY
my_safe_print_str("conn->cur_query", conn->cur_query, conn->cur_query_len);
#endif
}
fputs("Attempting backtrace...\n", stderr);
my_print_stacktrace(NULL, my_thread_stack_size);
}
#else
static void dump_backtrace(void)
{
fputs("Backtrace not available.\n", stderr);
}
#endif
static sig_handler signal_handler(int sig)
{
fprintf(stderr, "mysqltest got " SIGNAL_FMT "\n", sig);
dump_backtrace();
}
#ifdef __WIN__
LONG WINAPI exception_filter(EXCEPTION_POINTERS *exp)
{
__try
{
my_set_exception_pointers(exp);
signal_handler(exp->ExceptionRecord->ExceptionCode);
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
fputs("Got exception in exception handler!\n", stderr);
}
return EXCEPTION_CONTINUE_SEARCH;
}
static void init_signal_handling(void)
{
UINT mode;
/* Set output destination of messages to the standard error stream. */
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
/* Do not not display the a error message box. */
mode= SetErrorMode(0) | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX;
SetErrorMode(mode);
SetUnhandledExceptionFilter(exception_filter);
}
#else /* __WIN__ */
static void init_signal_handling(void)
{
struct sigaction sa;
DBUG_ENTER("init_signal_handling");
#ifdef HAVE_STACKTRACE
my_init_stacktrace();
#endif
sa.sa_flags = SA_RESETHAND | SA_NODEFER;
sigemptyset(&sa.sa_mask);
sigprocmask(SIG_SETMASK, &sa.sa_mask, NULL);
sa.sa_handler= signal_handler;
sigaction(SIGSEGV, &sa, NULL);
sigaction(SIGABRT, &sa, NULL);
#ifdef SIGBUS
sigaction(SIGBUS, &sa, NULL);
#endif
sigaction(SIGILL, &sa, NULL);
sigaction(SIGFPE, &sa, NULL);
}
#endif /* !__WIN__ */
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
...@@ -7028,6 +7136,8 @@ int main(int argc, char **argv) ...@@ -7028,6 +7136,8 @@ int main(int argc, char **argv)
save_file[0]= 0; save_file[0]= 0;
TMPDIR[0]= 0; TMPDIR[0]= 0;
init_signal_handling();
/* Init expected errors */ /* Init expected errors */
memset(&saved_expected_errors, 0, sizeof(saved_expected_errors)); memset(&saved_expected_errors, 0, sizeof(saved_expected_errors));
......
...@@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM ...@@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM
# #
# When changing major version number please also check switch statement # When changing major version number please also check switch statement
# in mysqlbinlog::check_master_version(). # in mysqlbinlog::check_master_version().
AM_INIT_AUTOMAKE(mysql, 5.1.26-rc) AM_INIT_AUTOMAKE(mysql, 5.1.28)
AM_CONFIG_HEADER([include/config.h:config.h.in]) AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10 PROTOCOL_VERSION=10
...@@ -2341,10 +2341,31 @@ then ...@@ -2341,10 +2341,31 @@ then
fi fi
AC_MSG_RESULT("$netinet_inc") AC_MSG_RESULT("$netinet_inc")
AC_CACHE_CHECK([support for weak symbols], mysql_cv_weak_symbol,
[AC_TRY_LINK([],[
extern void __attribute__((weak)) foo(void);
], [mysql_cv_weak_symbol=yes], [mysql_cv_weak_symbol=no])])
if test "x$mysql_cv_weak_symbol" = xyes; then
AC_DEFINE(HAVE_WEAK_SYMBOL, 1,
[Define to 1 if compiler supports weak symbol attribute.])
fi
AC_CACHE_CHECK([whether __bss_start is defined], mysql_cv_bss_start,
[AC_TRY_LINK([],[
extern char *__bss_start;
return __bss_start ? 1 : 0;
], [mysql_cv_bss_start=yes], [mysql_cv_bss_start=no])])
if test "x$mysql_cv_bss_start" = xyes; then
AC_DEFINE(HAVE_BSS_START, 1,
[Define to 1 if compiler defines __bss_start.])
fi
AC_LANG_SAVE AC_LANG_SAVE
AC_LANG_CPLUSPLUS AC_LANG_CPLUSPLUS
AC_CHECK_HEADERS(cxxabi.h) AC_CHECK_HEADERS(cxxabi.h)
AC_CACHE_CHECK([checking for abi::__cxa_demangle], mysql_cv_cxa_demangle, AC_CACHE_CHECK([for abi::__cxa_demangle], mysql_cv_cxa_demangle,
[AC_TRY_LINK([#include <cxxabi.h>], [ [AC_TRY_LINK([#include <cxxabi.h>], [
char *foo= 0; int bar= 0; char *foo= 0; int bar= 0;
foo= abi::__cxa_demangle(foo, foo, 0, &bar); foo= abi::__cxa_demangle(foo, foo, 0, &bar);
......
...@@ -36,7 +36,7 @@ noinst_HEADERS = config-win.h config-netware.h my_bit.h \ ...@@ -36,7 +36,7 @@ noinst_HEADERS = config-win.h config-netware.h my_bit.h \
mysql_version.h.in my_handler.h my_time.h \ mysql_version.h.in my_handler.h my_time.h \
my_vle.h my_user.h my_atomic.h atomic/nolock.h \ my_vle.h my_user.h my_atomic.h atomic/nolock.h \
atomic/rwlock.h atomic/x86-gcc.h atomic/x86-msvc.h \ atomic/rwlock.h atomic/x86-gcc.h atomic/x86-msvc.h \
atomic/gcc_builtins.h my_libwrap.h atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h
# Remove built files and the symlinked directories # Remove built files and the symlinked directories
CLEANFILES = $(BUILT_SOURCES) readline openssl CLEANFILES = $(BUILT_SOURCES) readline openssl
......
...@@ -13,57 +13,54 @@ ...@@ -13,57 +13,54 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __cplusplus #ifndef _my_stacktrace_h_
extern "C" { #define _my_stacktrace_h_
#endif
#if HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS && HAVE_CXXABI_H && HAVE_ABI_CXA_DEMANGLE #include <my_global.h>
#define BACKTRACE_DEMANGLE 1
#endif
#if BACKTRACE_DEMANGLE #ifdef TARGET_OS_LINUX
char *my_demangle(const char *mangled_name, int *status); #if defined (__x86_64__) || defined (__i386__) || \
(defined(__alpha__) && defined(__GNUC__))
#define HAVE_STACKTRACE 1
#endif
#elif defined(__WIN__)
#define HAVE_STACKTRACE 1
#endif #endif
#ifdef TARGET_OS_LINUX #if HAVE_BACKTRACE && (HAVE_BACKTRACE_SYMBOLS || HAVE_BACKTRACE_SYMBOLS_FD)
#if defined(HAVE_STACKTRACE) || (defined (__x86_64__) || defined (__i386__) || (defined(__alpha__) && defined(__GNUC__)))
#undef HAVE_STACKTRACE #undef HAVE_STACKTRACE
#define HAVE_STACKTRACE #define HAVE_STACKTRACE 1
#endif
extern char* __bss_start;
extern char* heap_start;
#define init_stacktrace() do { \ #if !defined(__NETWARE__)
heap_start = (char*) &__bss_start; \ #define HAVE_WRITE_CORE
} while(0);
void check_thread_lib(void);
#endif /* defined (__i386__) || (defined(__alpha__) && defined(__GNUC__))) */
#elif defined (__WIN__)
#define HAVE_STACKTRACE
extern void set_exception_pointers(EXCEPTION_POINTERS *ep);
#define init_stacktrace() {}
#endif #endif
#ifdef HAVE_STACKTRACE #if HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS && \
void print_stacktrace(uchar* stack_bottom, ulong thread_stack); HAVE_CXXABI_H && HAVE_ABI_CXA_DEMANGLE && \
void safe_print_str(const char* name, const char* val, int max_len); HAVE_WEAK_SYMBOL
#else #define BACKTRACE_DEMANGLE 1
/* Define empty prototypes for functions that are not implemented */ #endif
#define init_stacktrace() {}
#define print_stacktrace(A,B) {}
#define safe_print_str(A,B,C) {}
#endif /* HAVE_STACKTRACE */
C_MODE_START
#if !defined(__NETWARE__) #if defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)
#define HAVE_WRITE_CORE void my_init_stacktrace();
void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack);
void my_safe_print_str(const char* name, const char* val, int max_len);
void my_write_core(int sig);
#if BACKTRACE_DEMANGLE
char *my_demangle(const char *mangled_name, int *status);
#endif
#ifdef __WIN__
void my_set_exception_pointers(EXCEPTION_POINTERS *ep);
#endif
#endif #endif
#ifdef HAVE_WRITE_CORE #ifdef HAVE_WRITE_CORE
void write_core(int sig); void my_write_core(int sig);
#endif #endif
C_MODE_END
#ifdef __cplusplus #endif /* _my_stacktrace_h_ */
}
#endif
...@@ -185,8 +185,7 @@ SET(LIBMYSQLD_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc ...@@ -185,8 +185,7 @@ SET(LIBMYSQLD_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/strfunc.cc ../sql/table.cc ../sql/thr_malloc.cc ../sql/strfunc.cc ../sql/table.cc ../sql/thr_malloc.cc
../sql/time.cc ../sql/tztime.cc ../sql/uniques.cc ../sql/unireg.cc ../sql/time.cc ../sql/tztime.cc ../sql/uniques.cc ../sql/unireg.cc
../sql/partition_info.cc ../sql/sql_connect.cc ../sql/partition_info.cc ../sql/sql_connect.cc
../sql/scheduler.cc ../sql/stacktrace.c ../sql/scheduler.cc ../sql/event_parse_data.cc
../sql/event_parse_data.cc
${GEN_SOURCES} ${GEN_SOURCES}
${LIB_SOURCES}) ${LIB_SOURCES})
......
...@@ -69,7 +69,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \ ...@@ -69,7 +69,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
sql_select.cc sql_do.cc sql_show.cc set_var.cc \ sql_select.cc sql_do.cc sql_show.cc set_var.cc \
sql_string.cc sql_table.cc sql_test.cc sql_udf.cc \ sql_string.cc sql_table.cc sql_test.cc sql_udf.cc \
sql_update.cc sql_yacc.cc table.cc thr_malloc.cc time.cc \ sql_update.cc sql_yacc.cc table.cc thr_malloc.cc time.cc \
unireg.cc uniques.cc stacktrace.c sql_union.cc hash_filo.cc \ unireg.cc uniques.cc sql_union.cc hash_filo.cc \
spatial.cc gstream.cc sql_help.cc tztime.cc sql_cursor.cc \ spatial.cc gstream.cc sql_help.cc tztime.cc sql_cursor.cc \
sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \ sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \ parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
......
...@@ -79,6 +79,15 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command, ...@@ -79,6 +79,15 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
my_bool result= 1; my_bool result= 1;
THD *thd=(THD *) mysql->thd; THD *thd=(THD *) mysql->thd;
NET *net= &mysql->net; NET *net= &mysql->net;
my_bool stmt_skip= stmt ? stmt->state != MYSQL_STMT_INIT_DONE : FALSE;
if (!thd)
{
/* Do "reconnect" if possible */
if (mysql_reconnect(mysql) || stmt_skip)
return 1;
thd= (THD *) mysql->thd;
}
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) #if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
thd->profiling.start_new_query(); thd->profiling.start_new_query();
......
...@@ -265,6 +265,22 @@ eval SELECT "$last_error" AS Last_SQL_Error; ...@@ -265,6 +265,22 @@ eval SELECT "$last_error" AS Last_SQL_Error;
enable_query_log; enable_query_log;
query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2; query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
# BUG#37076: TIMESTAMP/DATETIME values are not replicated correctly
# between machines with mixed endiannes
# (regression test)
--echo **** Test for BUG#37076 ****
--echo **** On Master ****
connection master;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a TIMESTAMP, b DATETIME, c DATE);
INSERT INTO t1 VALUES(
'2005-11-14 01:01:01', '2005-11-14 01:01:02', '2005-11-14');
--echo **** On Slave ****
sync_slave_with_master slave;
SELECT * FROM t1;
# #
# cleanup # cleanup
# #
......
...@@ -1429,29 +1429,31 @@ DROP TABLE t1; ...@@ -1429,29 +1429,31 @@ DROP TABLE t1;
# Bug#21704: Renaming column does not update FK definition. # Bug#21704: Renaming column does not update FK definition.
# #
--disable_warnings #
DROP TABLE IF EXISTS t1; # --disable_warnings
DROP TABLE IF EXISTS t2; # DROP TABLE IF EXISTS t1;
--enable_warnings # DROP TABLE IF EXISTS t2;
# --enable_warnings
CREATE TABLE t1(id INT PRIMARY KEY) #
ENGINE=innodb; # CREATE TABLE t1(id INT PRIMARY KEY)
# ENGINE=innodb;
CREATE TABLE t2( #
t1_id INT PRIMARY KEY, # CREATE TABLE t2(
CONSTRAINT fk1 FOREIGN KEY (t1_id) REFERENCES t1(id)) # t1_id INT PRIMARY KEY,
ENGINE=innodb; # CONSTRAINT fk1 FOREIGN KEY (t1_id) REFERENCES t1(id))
# ENGINE=innodb;
--echo #
# --echo
--disable_result_log #
--error ER_ERROR_ON_RENAME # --disable_result_log
ALTER TABLE t1 CHANGE id id2 INT; # --error ER_ERROR_ON_RENAME
--enable_result_log # ALTER TABLE t1 CHANGE id id2 INT;
# --enable_result_log
--echo #
# --echo
DROP TABLE t2; #
DROP TABLE t1; # DROP TABLE t2;
# DROP TABLE t1;
#
--echo End of 5.1 tests --echo End of 5.1 tests
# 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;
}
--enable_query_log
...@@ -1184,3 +1184,42 @@ check table t1; ...@@ -1184,3 +1184,42 @@ check table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
drop table t1; drop table t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (id int, c int) character set latin1;
INSERT INTO t1 VALUES (1,1);
ALTER TABLE t1 CHANGE c d int;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t1 CHANGE d c int;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t1 MODIFY c VARCHAR(10);
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 0
ALTER TABLE t1 CHANGE c d varchar(10);
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t1 CHANGE d c varchar(10);
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (id int, c int) character set utf8;
INSERT INTO t1 VALUES (1,1);
ALTER TABLE t1 CHANGE c d int;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t1 CHANGE d c int;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t1 MODIFY c VARCHAR(10);
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 0
ALTER TABLE t1 CHANGE c d varchar(10);
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t1 CHANGE d c varchar(10);
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
DROP TABLE t1;
End of 5.1 tests
...@@ -104,41 +104,99 @@ t1 CREATE TABLE `t1` ( ...@@ -104,41 +104,99 @@ t1 CREATE TABLE `t1` (
`length(uuid())` int(10) NOT NULL DEFAULT '0' `length(uuid())` int(10) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 (a timestamp default '2005-05-05 01:01:01', #------------------------------------------------------------------------
b timestamp default '2005-05-05 01:01:01'); # Tests for Bug#6760 and Bug#12689
insert into t1 set a = now(); SET @row_count = 4;
select sleep(3); SET @sleep_time_per_result_row = 1;
sleep(3) SET @max_acceptable_delay = 2;
0 SET @@global.query_cache_size = 1024 * 64;
update t1 set b = now(); DROP TEMPORARY TABLE IF EXISTS t_history;
select timediff(b, a) >= '00:00:03' from t1; DROP TABLE IF EXISTS t1;
timediff(b, a) >= '00:00:03' CREATE TEMPORARY TABLE t_history (attempt SMALLINT,
1 start_ts DATETIME, end_ts DATETIME,
drop table t1; start_cached INTEGER, end_cached INTEGER);
set global query_cache_size=1355776; CREATE TABLE t1 (f1 BIGINT);
create table t1 (a int); INSERT INTO t1 VALUES (1);
insert into t1 values (1),(1),(1); INSERT INTO t1 VALUES (1);
create table t2 (a datetime default null, b datetime default null); INSERT INTO t1 VALUES (1);
insert into t2 set a = now(); INSERT INTO t1 VALUES (1);
select a from t1 where sleep(1); INSERT INTO t_history
a SET attempt = 4 - 4 + 1, start_ts = NOW(),
update t2 set b = now() where b is null; start_cached = 0;
insert into t2 set a = now(); SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
select a from t1 where sleep(a); f1 SLEEP(@sleep_time_per_result_row)
a 1 0
update t2 set b = now() where b is null; 1 0
insert into t2 set a = now(); 1 0
select a from t1 where sleep(1); 1 0
a UPDATE t_history SET end_ts = NOW()
update t2 set b = now() where b is null; WHERE attempt = 4 - 4 + 1;
select timediff(b, a) >= '00:00:03' from t2; UPDATE t_history SET end_cached = 0
timediff(b, a) >= '00:00:03' WHERE attempt = 4 - 4 + 1;
INSERT INTO t_history
SET attempt = 4 - 3 + 1, start_ts = NOW(),
start_cached = 0;
SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
f1 SLEEP(@sleep_time_per_result_row)
1 0
1 0
1 0
1 0
UPDATE t_history SET end_ts = NOW()
WHERE attempt = 4 - 3 + 1;
UPDATE t_history SET end_cached = 0
WHERE attempt = 4 - 3 + 1;
INSERT INTO t_history
SET attempt = 4 - 2 + 1, start_ts = NOW(),
start_cached = 0;
SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
f1 SLEEP(@sleep_time_per_result_row)
1 0
1 0
1 0
1 0
UPDATE t_history SET end_ts = NOW()
WHERE attempt = 4 - 2 + 1;
UPDATE t_history SET end_cached = 0
WHERE attempt = 4 - 2 + 1;
INSERT INTO t_history
SET attempt = 4 - 1 + 1, start_ts = NOW(),
start_cached = 0;
SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
f1 SLEEP(@sleep_time_per_result_row)
1 0
1 0
1 0
1 0
UPDATE t_history SET end_ts = NOW()
WHERE attempt = 4 - 1 + 1;
UPDATE t_history SET end_cached = 0
WHERE attempt = 4 - 1 + 1;
# Test 1: Does the query with SLEEP need a reasonable time?
SELECT COUNT(*) >= 4 - 1 INTO @aux1 FROM t_history
WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count
BETWEEN 0 AND @max_acceptable_delay;
SELECT @aux1 AS "Expect 1";
Expect 1
1 1
# Test 2: Does the query with SLEEP need a reasonable time even in case
# of the non first execution?
SELECT COUNT(*) >= 4 - 1 - 1 INTO @aux2 FROM t_history
WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count
BETWEEN 0 AND @max_acceptable_delay
AND attempt > 1;
SELECT @aux2 AS "Expect 1";
Expect 1
1 1
# Test 3: The query with SLEEP must be not cached.
SELECT COUNT(*) = 4 INTO @aux3 FROM t_history
WHERE end_cached = start_cached;
SELECT @aux3 AS "Expect 1";
Expect 1
1 1
drop table t2; DROP TABLE t1;
drop table t1; DROP TEMPORARY TABLE t_history;
set global query_cache_size=default; SET @@global.query_cache_size = default;
create table t1 select INET_ATON('255.255.0.1') as `a`; create table t1 select INET_ATON('255.255.0.1') as `a`;
show create table t1; show create table t1;
Table Create Table Table Create Table
......
...@@ -3,11 +3,11 @@ create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=inn ...@@ -3,11 +3,11 @@ create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=inn
select * from t1; select * from t1;
c1 c2 stamp c1 c2 stamp
replace delayed into t1 (c1, c2) values ( "text1","11"); replace delayed into t1 (c1, c2) values ( "text1","11");
ERROR HY000: Table storage engine for 't1' doesn't have this option ERROR HY000: DELAYED option not supported for table 't1'
select * from t1; select * from t1;
c1 c2 stamp c1 c2 stamp
replace delayed into t1 (c1, c2) values ( "text1","12"); replace delayed into t1 (c1, c2) values ( "text1","12");
ERROR HY000: Table storage engine for 't1' doesn't have this option ERROR HY000: DELAYED option not supported for table 't1'
select * from t1; select * from t1;
c1 c2 stamp c1 c2 stamp
drop table t1; drop table t1;
'#--------------------FN_DYNVARS_044_02-------------------------#' '#--------------------FN_DYNVARS_044_02-------------------------#'
SET @old_innodb_max_dirty_pages_pct= @@global.innodb_max_dirty_pages_pct;
SET @@global.innodb_max_dirty_pages_pct = 80; SET @@global.innodb_max_dirty_pages_pct = 80;
'connect (con1,localhost,root,,,,)' 'connect (con1,localhost,root,,,,)'
'connection con1' 'connection con1'
...@@ -28,3 +29,5 @@ DROP PROCEDURE add_records; ...@@ -28,3 +29,5 @@ DROP PROCEDURE add_records;
DROP PROCEDURE add_until; DROP PROCEDURE add_until;
DROP PROCEDURE check_pct; DROP PROCEDURE check_pct;
DROP FUNCTION dirty_pct; DROP FUNCTION dirty_pct;
DROP TABLE t1;
SET @@global.innodb_max_dirty_pages_pct = @old_innodb_max_dirty_pages_pct;
...@@ -1640,19 +1640,6 @@ vid tid idx name type ...@@ -1640,19 +1640,6 @@ vid tid idx name type
3 1 2 c1 NULL 3 1 2 c1 NULL
3 1 1 pk NULL 3 1 1 pk NULL
DROP TABLE t1; DROP TABLE t1;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(id INT PRIMARY KEY)
ENGINE=innodb;
CREATE TABLE t2(
t1_id INT PRIMARY KEY,
CONSTRAINT fk1 FOREIGN KEY (t1_id) REFERENCES t1(id))
ENGINE=innodb;
ALTER TABLE t1 CHANGE id id2 INT;
DROP TABLE t2;
DROP TABLE t1;
End of 5.1 tests End of 5.1 tests
drop table if exists t1, t2, t3; drop table if exists t1, t2, t3;
create table t1(a int); create table t1(a int);
......
...@@ -38,6 +38,8 @@ t2 ...@@ -38,6 +38,8 @@ t2
t3 t3
Tables_in_test Tables_in_test
t1 t1
delimiter
1
_ _
Test delimiter : from command line Test delimiter : from command line
a a
......
drop table if exists t1; drop table if exists t1, t2;
CREATE TABLE t1 (
a INT NOT NULL,
b MEDIUMINT NOT NULL,
c INT NOT NULL,
KEY b (b)
) ENGINE=MyISAM
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (1)
);
INSERT INTO t1 VALUES (1,1,0), (1,1,1), (1,1,2), (1,1,53), (1,1,4), (1,1,5),
(1,1,6), (1,1,7), (1,1,8), (1,1,9), (1,1,10), (1,1,11), (1,1,12), (1,1,13),
(1,1,14), (1,1,15), (1,1,16), (1,1,67), (1,1,18), (1,1,19), (1,1,20), (1,1,21),
(1,1,22), (1,1,23), (1,1,24), (1,1,75), (1,1,26), (1,1,27), (1,1,128),
(1,1,79), (1,1,30), (1,1,31), (1,1,32), (1,1,33), (1,1,34), (1,1,85), (1,1,36),
(1,1,37), (1,1,38), (1,1,39), (1,1,40), (1,1,241), (1,1,42), (1,1,43),
(1,1,44), (1,1,45), (1,1,46), (1,1,147), (1,1,48), (1,1,49), (1,2,0), (1,2,1),
(1,2,2), (1,2,3), (1,2,4), (1,2,5), (1,2,6), (1,2,7), (1,2,8), (1,2,9),
(1,2,10), (1,2,11), (1,2,12), (1,2,13), (1,2,14), (1,2,15), (1,2,16), (1,2,17),
(1,2,18), (1,2,19), (1,2,20), (1,2,21), (1,2,22), (1,2,23), (1,2,24), (1,2,25),
(1,2,26), (1,2,27), (1,2,28), (1,2,29), (1,2,30), (1,2,31), (1,2,32), (1,2,33),
(1,2,34), (1,2,35), (1,2,36), (1,2,37), (1,2,38), (1,2,39), (1,2,40), (1,2,41),
(1,2,42), (1,2,43), (1,2,44), (1,2,45), (1,2,46), (1,2,47), (1,2,48), (1,2,49),
(1,6,0), (1,6,1), (1,6,2), (1,6,3), (1,6,4), (1,6,5), (1,6,6), (1,6,7),
(1,6,8), (1,6,9), (1,6,10), (1,6,11), (1,6,12), (1,6,13), (1,6,14), (1,6,15),
(1,6,16), (1,6,17), (1,6,18), (1,6,19), (1,6,20), (1,6,21), (1,6,22), (1,6,23),
(1,6,24), (1,6,25), (1,6,26), (1,6,27), (1,6,28), (1,6,29), (1,6,30), (1,6,31),
(1,6,32), (1,6,33), (1,6,34), (1,6,35), (1,6,36), (1,6,37), (1,6,38), (1,6,39),
(1,6,40), (1,6,41), (1,6,42), (1,6,43), (1,6,44), (1,6,45), (1,6,46), (1,6,47),
(1,6,48), (1,6,49), (1,7,0), (1,7,1), (1,7,2), (1,7,3), (1,7,4), (1,7,5),
(1,7,6), (1,7,7), (1,7,8), (1,7,9), (1,7,10), (1,7,11), (1,7,12), (1,7,13),
(1,7,14), (1,7,15), (1,7,16), (1,7,17), (1,7,18), (1,7,19), (1,7,20), (1,7,21),
(1,7,22), (1,7,23), (1,7,24), (1,7,25), (1,7,26), (1,7,27), (1,7,28), (1,7,29),
(1,7,30), (1,7,31), (1,7,32), (1,7,33), (1,7,34), (1,7,35), (1,7,38), (1,7,39),
(1,7,90), (1,7,41), (1,7,43), (1,7,48), (1,7,49), (1,9,0), (1,9,1), (1,9,2),
(1,9,3), (1,9,4), (1,9,5), (1,9,6), (1,9,7), (1,9,8), (1,9,9), (1,9,10),
(1,9,11), (1,9,12), (1,9,13), (1,9,14), (1,9,15), (1,9,16), (1,9,17), (1,9,18),
(1,9,19), (1,9,20), (1,9,21), (1,9,22), (1,9,23), (1,9,24), (1,9,25), (1,9,26),
(1,9,29), (1,9,32), (1,9,35), (1,9,38), (1,10,0), (1,10,1), (1,10,2), (1,10,3),
(1,10,4), (1,10,5), (1,10,6), (1,10,7), (1,10,8), (1,10,9), (1,10,10),
(1,10,11), (1,10,13), (1,10,14), (1,10,15), (1,10,16), (1,10,17), (1,10,18),
(1,10,22), (1,10,24), (1,10,25), (1,10,26), (1,10,28), (1,10,131), (1,10,33),
(1,10,84), (1,10,35), (1,10,40), (1,10,42), (1,10,49), (1,11,0), (1,11,1),
(1,11,2), (1,11,3), (1,11,4), (1,11,5), (1,11,6), (1,11,7), (1,11,8), (1,11,9),
(1,11,10), (1,11,11), (1,11,12), (1,11,13), (1,11,14), (1,11,15), (1,11,16),
(1,11,17), (1,11,18), (1,11,19), (1,11,20), (1,11,21), (1,11,22), (1,11,23),
(1,11,24), (1,11,25), (1,11,26), (1,11,27), (1,11,28), (1,11,30), (1,11,31),
(1,11,32), (1,11,33), (1,11,34), (1,11,35), (1,11,37), (1,11,39), (1,11,40),
(1,11,42), (1,11,44), (1,11,45), (1,11,47), (1,11,48), (1,14,104), (1,14,58),
(1,14,12), (1,14,13), (1,14,15), (1,14,16), (1,14,17), (1,14,34), (1,15,0),
(1,15,1), (1,15,2), (1,15,3), (1,15,4), (1,15,5), (1,15,7), (1,15,9),
(1,15,15), (1,15,27), (1,15,49), (1,16,0), (1,16,1), (1,16,3), (1,17,4),
(1,19,1);
SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
COUNT(*)
24
SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
SUM(c)
400
ALTER TABLE t1 DROP INDEX b;
SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
COUNT(*)
24
SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
SUM(c)
400
ALTER TABLE t1 ENGINE = Memory;
SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
COUNT(*)
24
SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
SUM(c)
400
ALTER TABLE t1 ADD INDEX b USING HASH (b);
SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
COUNT(*)
24
SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
SUM(c)
400
DROP TABLE t1;
CREATE TABLE `t1` (
`c1` int(11) DEFAULT NULL,
KEY `c1` (`c1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `t2` (
`c1` int(11) DEFAULT NULL,
KEY `c1` (`c1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c1) (PARTITION a VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION b VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */;
INSERT INTO `t1` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
INSERT INTO `t2` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
EXPLAIN PARTITIONS SELECT c1 FROM t1 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 NULL range c1 c1 5 NULL 4 Using where; Using index
FLUSH STATUS;
SELECT c1 FROM t1 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20);
c1
11
12
18
19
SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_next 0
EXPLAIN PARTITIONS SELECT c1 FROM t2 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 a range c1 c1 5 NULL 4 Using where; Using index
FLUSH STATUS;
SELECT c1 FROM t2 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20);
c1
11
12
18
19
SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_next 0
DROP TABLE t1,t2;
CREATE TABLE `t1` (
`c1` int(11) DEFAULT NULL,
KEY `c1` (`c1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `t2` (
`c1` int(11) DEFAULT NULL,
KEY `c1` (`c1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c1) (PARTITION a VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION b VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */;
INSERT INTO `t1` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
INSERT INTO `t2` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
EXPLAIN PARTITIONS SELECT c1 FROM t1 WHERE (c1 > 2 AND c1 < 5);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 NULL range c1 c1 5 NULL 2 Using where; Using index
FLUSH STATUS;
SELECT c1 FROM t1 WHERE (c1 > 2 AND c1 < 5);
c1
3
4
SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
Handler_read_next 2
Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_next 0
EXPLAIN PARTITIONS SELECT c1 FROM t2 WHERE (c1 > 2 AND c1 < 5);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 a range c1 c1 5 NULL 2 Using where; Using index
FLUSH STATUS;
SELECT c1 FROM t2 WHERE (c1 > 2 AND c1 < 5);
c1
3
4
SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
Handler_read_next 2
Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_next 0
EXPLAIN PARTITIONS SELECT c1 FROM t1 WHERE (c1 > 12 AND c1 < 15);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 NULL range c1 c1 5 NULL 2 Using where; Using index
FLUSH STATUS;
SELECT c1 FROM t1 WHERE (c1 > 12 AND c1 < 15);
c1
13
14
SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
Handler_read_next 2
Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_next 0
EXPLAIN PARTITIONS SELECT c1 FROM t2 WHERE (c1 > 12 AND c1 < 15);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 a range c1 c1 5 NULL 2 Using where; Using index
FLUSH STATUS;
SELECT c1 FROM t2 WHERE (c1 > 12 AND c1 < 15);
c1
13
14
SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
Handler_read_next 2
Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_next 0
DROP TABLE t1,t2;
create table t1 (a int) partition by list ((a/3)*10 div 1) create table t1 (a int) partition by list ((a/3)*10 div 1)
(partition p0 values in (0), partition p1 values in (1)); (partition p0 values in (0), partition p1 values in (1));
ERROR HY000: This partition function is not allowed ERROR HY000: This partition function is not allowed
......
This diff is collapsed.
...@@ -163,13 +163,11 @@ Com_show_status 8 ...@@ -163,13 +163,11 @@ Com_show_status 8
rnd_diff tmp_table_diff rnd_diff tmp_table_diff
20 8 20 8
flush status; flush status;
show status like 'Com%function%'; show status like 'Com%function';
Variable_name Value Variable_name Value
Com_alter_function 0 Com_alter_function 0
Com_create_function 0 Com_create_function 0
Com_drop_function 0 Com_drop_function 0
Com_show_function_code 0
Com_show_function_status 0
create function f1 (x INTEGER) returns integer create function f1 (x INTEGER) returns integer
begin begin
declare ret integer; declare ret integer;
...@@ -177,10 +175,8 @@ set ret = x * 10; ...@@ -177,10 +175,8 @@ set ret = x * 10;
return ret; return ret;
end // end //
drop function f1; drop function f1;
show status like 'Com%function%'; show status like 'Com%function';
Variable_name Value Variable_name Value
Com_alter_function 0 Com_alter_function 0
Com_create_function 1 Com_create_function 1
Com_drop_function 1 Com_drop_function 1
Com_show_function_code 0
Com_show_function_status 0
...@@ -4391,3 +4391,10 @@ SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1); ...@@ -4391,3 +4391,10 @@ SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
s1 s1
a a
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(c int, KEY(c));
CREATE TABLE t2(a int, b int);
INSERT INTO t2 VALUES (1, 10), (2, NULL);
INSERT INTO t1 VALUES (1), (3);
SELECT * FROM t2 WHERE b NOT IN (SELECT max(t.c) FROM t1, t1 t WHERE t.c>10);
a b
DROP TABLE t1,t2;
...@@ -6,6 +6,7 @@ id INT NOT NULL auto_increment, ...@@ -6,6 +6,7 @@ id INT NOT NULL auto_increment,
PRIMARY KEY (id), PRIMARY KEY (id),
name VARCHAR(30) name VARCHAR(30)
); );
SET @old_wait_timeout = @@global.wait_timeout;
'#--------------------FN_DYNVARS_186_01-------------------------#' '#--------------------FN_DYNVARS_186_01-------------------------#'
## Creating new connection test_con1 ## ## Creating new connection test_con1 ##
## Setting value of variable to 5 ## ## Setting value of variable to 5 ##
...@@ -25,6 +26,8 @@ SET @@global.wait_timeout = 1; ...@@ -25,6 +26,8 @@ SET @@global.wait_timeout = 1;
## Creating new connection ## ## Creating new connection ##
INSERT into t1(name) values('Record_3'); INSERT into t1(name) values('Record_3');
## Using sleep to check timeout ## ## Using sleep to check timeout ##
## We cannot test it further because the server stops due to wait_timeout ## ## We cannot test it further because the server closes the connection due to wait_timeout ##
SELECT * from t1; SELECT * from t1;
ERROR HY000: MySQL server has gone away ERROR HY000: MySQL server has gone away
DROP TABLE t1;
SET @@global.wait_timeout = @old_wait_timeout;
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` (`id` int not null auto_increment primary key);
create trigger `trg` before insert on `t1` for each row begin end;
set @@global.debug="+d,simulate_bug33029";
stop slave;
start slave;
insert into `t1` values ();
select * from t1;
id
1
#
# Bug #36443 Server crashes when executing insert when insert trigger on table
#
# Emulating the former bug#33029 situation to see that there is no crash anymore.
#
source include/master-slave.inc;
create table `t1` (`id` int not null auto_increment primary key);
create trigger `trg` before insert on `t1` for each row begin end;
sync_slave_with_master;
set @@global.debug="+d,simulate_bug33029";
stop slave;
start slave;
connection master;
insert into `t1` values ();
sync_slave_with_master;
select * from t1;
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
# #
# The amount and properties of character_sets/collations depend on the # The amount and properties of character_sets/collations depend on the
# build type # build type
# 2007-12 MySQL 5.0 # 2007-12 MySQL 5.0, 2008-06 MySQL 5.1
# --------------------------------------------------------------------- # ---------------------------------------------------------------------
# #
# Variant 1 fits to # Variant 1 fits to
...@@ -33,10 +33,22 @@ ...@@ -33,10 +33,22 @@
# Variant 3 fits to # Variant 3 fits to
# version_comment MySQL Community Server (GPL) # version_comment MySQL Community Server (GPL)
# version_comment MySQL Cluster Server (Commercial) # version_comment MySQL Cluster Server (Commercial)
# version_comment MySQL Advanced Server (GPL) 5.1
# version_comment MySQL Advanced Server (Commercial) 5.1
# #
# Difference between variant 3 and 2 is within the collation properties # Difference between variant 3 and 2 is within the collation properties
# IS_COMPILED and SORTLEN. # IS_COMPILED and SORTLEN.
# #
# 2008-06 All time excluded variant is "vanilla".
# How to build "vanilla":
# ./BUILD/autorun.sh
# ./configure
# ./make
# Some properties of "vanilla"
# version_comment Source distribution
# Compared to the variants 1 to 3 a lot of character sets are missing.
# Example: "ucs2_bin" is in variant 1 to 3 but not in "vanilla".
#
# Created: # Created:
# 2007-12-18 mleich - remove the unstable character_set/collation subtests # 2007-12-18 mleich - remove the unstable character_set/collation subtests
# from include/datadict-master.inc # from include/datadict-master.inc
......
...@@ -84,4 +84,3 @@ SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, ...@@ -84,4 +84,3 @@ SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
FROM information_schema.columns FROM information_schema.columns
$my_where $my_where
ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION; ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# suite/funcs_1/datadict/tables.inc
#
# Auxiliary script to be sourced by
# is_tables_<engine>.test
#
# The variable $engine_type has to be assigned before sourcing ths script.
#
# Author:
# 2008-06-04 mleich Create this script based on older scripts and new code.
#
# Just have some tables within different databases.
--disable_warnings
DROP DATABASE IF EXISTS test1;
DROP DATABASE IF EXISTS test2;
--enable_warnings
CREATE DATABASE test1;
CREATE DATABASE test2;
--replace_result $engine_type <engine_to_be_used>
eval CREATE TABLE test1.t1 (f1 VARCHAR(20)) ENGINE = $engine_type;
--replace_result $engine_type <engine_to_be_used>
eval CREATE TABLE test1.t2 (f1 VARCHAR(20)) ENGINE = $engine_type;
--replace_result $engine_type <engine_to_be_used>
eval CREATE TABLE test2.t1 (f1 VARCHAR(20)) ENGINE = $engine_type;
--source suite/funcs_1/datadict/tables2.inc
SHOW TABLES FROM test1;
SHOW TABLES FROM test2;
# Create a low privileged user.
# Note: The database db_datadict is just a "home" for the low privileged user
# and not in the focus of testing.
--error 0,ER_CANNOT_USER
DROP USER testuser1@localhost;
CREATE USER testuser1@localhost;
GRANT SELECT ON test1.* TO testuser1@localhost;
--echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1,localhost,testuser1,,test1);
--source suite/funcs_1/datadict/tables2.inc
SHOW TABLES FROM test1;
# The lowprivileged user testuser1 will get here an error.
--disable_abort_on_error
SHOW TABLES FROM test2;
--enable_abort_on_error
--echo # Switch to connection default and close connection testuser1
connection default;
disconnect testuser1;
DROP USER testuser1@localhost;
DROP DATABASE test1;
DROP DATABASE test2;
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
# #
# Auxiliary script to be sourced by # Auxiliary script to be sourced by
# is_tables_mysql.test # is_tables_mysql.test
# is_tables_mysql_embedded.test
# is_tables_is.test # is_tables_is.test
# is_tables_<engine>.test
# #
# Author: # Author:
# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of # 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of
...@@ -12,28 +12,27 @@ ...@@ -12,28 +12,27 @@
# #
--disable_warnings --disable_warnings
DROP DATABASE IF EXISTS db_datadict; DROP DATABASE IF EXISTS test1;
--enable_warnings --enable_warnings
CREATE DATABASE db_datadict; CREATE DATABASE test1;
--source suite/funcs_1/datadict/tables2.inc --source suite/funcs_1/datadict/tables2.inc
# Create a low privileged user. # Create a low privileged user.
# Note: The database db_datadict is just a "home" for the low privileged user # Note: The database test1 is just a "home" for the low privileged user
# and not in the focus of testing. # and not in the focus of testing.
--error 0,ER_CANNOT_USER --error 0,ER_CANNOT_USER
DROP USER testuser1@localhost; DROP USER testuser1@localhost;
CREATE USER testuser1@localhost; CREATE USER testuser1@localhost;
GRANT SELECT ON db_datadict.* TO testuser1@localhost; GRANT SELECT ON test1.* TO testuser1@localhost;
--echo # Establish connection testuser1 (user=testuser1) --echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1,localhost,testuser1,,db_datadict); connect (testuser1,localhost,testuser1,,test1);
--source suite/funcs_1/datadict/tables2.inc --source suite/funcs_1/datadict/tables2.inc
--echo # Switch to connection default and close connection testuser1 --echo # Switch to connection default and close connection testuser1
connection default; connection default;
disconnect testuser1; disconnect testuser1;
DROP USER testuser1@localhost; DROP USER testuser1@localhost;
DROP DATABASE db_datadict; DROP DATABASE test1;
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
let $innodb_pattern = 'InnoDB free'; let $innodb_pattern = 'InnoDB free';
let $ndb_pattern = 'number_of_replicas'; let $ndb_pattern = 'number_of_replicas';
--vertical_results --vertical_results
# We do not unify the engine name here, because the rowformat is
# specific to the engine.
--replace_column 8 "#TBLR#" 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "#CRT#" 16 "#UT#" 17 "#CT#" 20 "#CO#" 21 "#TC#" --replace_column 8 "#TBLR#" 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "#CRT#" 16 "#UT#" 17 "#CT#" 20 "#CO#" 21 "#TC#"
eval eval
SELECT *, SELECT *,
...@@ -44,4 +46,3 @@ FROM information_schema.tables ...@@ -44,4 +46,3 @@ FROM information_schema.tables
$my_where $my_where
ORDER BY table_schema,table_name; ORDER BY table_schema,table_name;
--horizontal_results --horizontal_results
# Skip tests which suffer from
# Bug#28309 First insert violates unique constraint
# - was "memory" table empty?
# if the folowing conditions are fulfilled:
# - MySQL Version is 5.0 (Bug is fixed in 5.1 and up)
# - use of embedded server
# - run on a case insensitive filesystem
#
let $value= query_get_value(SHOW VARIABLES LIKE 'lower_case_file_system', Value, 1);
if (`SELECT '$value' = 'ON' AND VERSION() LIKE '5.0%embedded%'`)
{
skip # Test requires backport of fix for Bug#28309 First insert violates unique constraint - was "memory" table empty ?;
}
...@@ -7,7 +7,7 @@ create table tb1 ( ...@@ -7,7 +7,7 @@ create table tb1 (
f1 char(0), f1 char(0),
f2 char(0) binary, f2 char(0) binary,
f3 char(0) ascii, f3 char(0) ascii,
f4 tinytext unicode, f4 tinytext,
f5 text, f5 text,
f6 mediumtext, f6 mediumtext,
f7 longtext, f7 longtext,
......
...@@ -10,7 +10,7 @@ f120 char ascii not null DEFAULT b'101', ...@@ -10,7 +10,7 @@ f120 char ascii not null DEFAULT b'101',
f121 tinytext, f121 tinytext,
f122 text, f122 text,
f123 mediumtext, f123 mediumtext,
f124 longtext unicode, f124 longtext,
f125 tinyblob, f125 tinyblob,
f126 blob, f126 blob,
f127 mediumblob, f127 mediumblob,
......
...@@ -55,13 +55,13 @@ f223 year(3), ...@@ -55,13 +55,13 @@ f223 year(3),
f224 year(4), f224 year(4),
f225 enum("1enum","2enum"), f225 enum("1enum","2enum"),
f226 set("1set","2set"), f226 set("1set","2set"),
f235 char(0) unicode, f235 char(0),
f236 char(90), f236 char(90),
f237 char(255) ascii, f237 char(255) ascii,
f238 varchar(0), f238 varchar(0),
f239 varchar(20000) binary, f239 varchar(20000) binary,
f240 varchar(2000) unicode, f240 varchar(2000),
f241 char(100) unicode f241 char(100)
) engine = innodb; ) engine = innodb;
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> --replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
......
...@@ -55,12 +55,12 @@ f223 year(3), ...@@ -55,12 +55,12 @@ f223 year(3),
f224 year(4), f224 year(4),
f225 enum("1enum","2enum"), f225 enum("1enum","2enum"),
f226 set("1set","2set"), f226 set("1set","2set"),
f236 char(95) unicode, f236 char(95),
f241 char(255) unicode, f241 char(255),
f237 char(130) binary, f237 char(130) binary,
f238 varchar(25000) binary, f238 varchar(25000) binary,
f239 varbinary(0), f239 varbinary(0),
f240 varchar(1200) unicode f240 varchar(1200)
) engine = memory; ) engine = memory;
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> --replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
......
...@@ -7,7 +7,7 @@ create table tb1 ( ...@@ -7,7 +7,7 @@ create table tb1 (
f1 char, f1 char,
f2 char binary, f2 char binary,
f3 char ascii, f3 char ascii,
f4 tinytext unicode, f4 tinytext,
f5 text, f5 text,
f6 mediumtext, f6 mediumtext,
f7 longtext, f7 longtext,
......
...@@ -10,7 +10,7 @@ f120 char ascii not null DEFAULT b'101', ...@@ -10,7 +10,7 @@ f120 char ascii not null DEFAULT b'101',
f121 tinytext, f121 tinytext,
f122 text, f122 text,
f123 mediumtext, f123 mediumtext,
f124 longtext unicode, f124 longtext,
f125 tinyblob, f125 tinyblob,
f126 blob, f126 blob,
f127 mediumblob, f127 mediumblob,
......
...@@ -63,13 +63,13 @@ f231 VARBINARY(192), ...@@ -63,13 +63,13 @@ f231 VARBINARY(192),
f232 VARBINARY(27), f232 VARBINARY(27),
f233 VARBINARY(64), f233 VARBINARY(64),
f234 VARBINARY(192), f234 VARBINARY(192),
f235 char(255) unicode, f235 char(255),
f236 char(60) ascii, f236 char(60) ascii,
f237 char(255) binary, f237 char(255) binary,
f238 varchar(0) binary, f238 varchar(0) binary,
f239 varbinary(1000), f239 varbinary(1000),
f240 varchar(120) unicode, f240 varchar(120),
f241 char(100) unicode, f241 char(100),
f242 bit(30) f242 bit(30)
) engine = myisam; ) engine = myisam;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment