diff options
author | Mikael Ronstrom <mikael@dator8> | 2011-01-12 14:43:03 +0100 |
---|---|---|
committer | Mikael Ronstrom <mikael@dator8> | 2011-01-12 14:43:03 +0100 |
commit | 773267552f6c701cf3210f908a3608ad0da1087f (patch) | |
tree | 2572fe5a1f81ea6ca0b1fa3d47f468b568ff5503 | |
parent | 7dae4282d4d5ec2ec8d17f600e87918e0a0aea00 (diff) | |
parent | bbf40ba3c5cac76b4efd2dc177b9ffaff1ce9266 (diff) | |
download | mariadb-git-773267552f6c701cf3210f908a3608ad0da1087f.tar.gz |
merge
232 files changed, 5749 insertions, 6119 deletions
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 4c4747c25de..2c10fdbe853 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 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 @@ -17,9 +17,7 @@ #include "client_priv.h" #include <signal.h> -#ifdef THREAD #include <my_pthread.h> /* because of signal() */ -#endif #include <sys/stat.h> #include <mysql.h> #include <sql_common.h> diff --git a/cmd-line-utils/readline/CMakeLists.txt b/cmd-line-utils/readline/CMakeLists.txt index ed6a6b902ea..be84f22f210 100644 --- a/cmd-line-utils/readline/CMakeLists.txt +++ b/cmd-line-utils/readline/CMakeLists.txt @@ -16,7 +16,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/cmd-line-utils) -ADD_DEFINITIONS(-DHAVE_CONFIG_H -DNO_KILL_INTR -DMYSQL_CLIENT_NO_THREADS) +ADD_DEFINITIONS(-DHAVE_CONFIG_H -DNO_KILL_INTR) INCLUDE_DIRECTORIES(${CURSES_INCLUDE_PATH}) diff --git a/config.h.cmake b/config.h.cmake index e51dcf51f32..204e1032410 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -1,5 +1,6 @@ -/* Copyright (C) 2009 Sun Microsystems, Inc - +/* Copyright (C) 2009, 2011, Oracle and/or its affiliates. All rights + reserved + 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. @@ -470,9 +471,6 @@ #cmakedefine STACK_DIRECTION @STACK_DIRECTION@ -#define THREAD 1 -#define THREAD_SAFE_CLIENT 1 - #define SYSTEM_TYPE "@SYSTEM_TYPE@" #define MACHINE_TYPE "@CMAKE_SYSTEM_PROCESSOR@" #cmakedefine HAVE_DTRACE 1 @@ -604,6 +602,9 @@ #cmakedefine SO_EXT "@CMAKE_SHARED_MODULE_SUFFIX@" +#define MYSQL_MAJOR_VERSION @MAJOR_VERSION@ +#define MYSQL_MINOR_VERSION @MINOR_VERSION@ + #define PACKAGE "mysql" #define PACKAGE_BUGREPORT "" #define PACKAGE_NAME "MySQL Server" diff --git a/dbug/dbug.c b/dbug/dbug.c index 74568f55fe0..2c06eeff95a 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -319,15 +319,6 @@ static void DbugExit(const char *why); static const char *DbugStrTok(const char *s); static void DbugVfprintf(FILE *stream, const char* format, va_list args); -#ifndef THREAD - /* Open profile output stream */ -static FILE *OpenProfile(CODE_STATE *cs, const char *name); - /* Profile if asked for it */ -static BOOLEAN DoProfile(CODE_STATE *); - /* Return current user time (ms) */ -static unsigned long Clock(void); -#endif - /* * Miscellaneous printf format strings. */ @@ -355,7 +346,6 @@ static unsigned long Clock(void); ** Macros to allow dbugging with threads */ -#ifdef THREAD #include <my_pthread.h> static pthread_mutex_t THR_LOCK_dbug; @@ -394,30 +384,6 @@ static CODE_STATE *code_state(void) return cs; } -#else /* !THREAD */ - -static CODE_STATE static_code_state= -{ - "dbug", "?func", "?file", NULL, &init_settings, - NullS, NullS, 0,0,0,0,0,NullS -}; - -static CODE_STATE *code_state(void) -{ - if (!init_done) - { - bzero(&init_settings, sizeof(init_settings)); - init_settings.out_file=stderr; - init_settings.flags=OPEN_APPEND; - init_done=TRUE; - } - return &static_code_state; -} - -#define pthread_mutex_lock(A) {} -#define pthread_mutex_unlock(A) {} -#endif - /* * Translate some calls among different systems. */ @@ -601,15 +567,6 @@ int DbugParse(CODE_STATE *cs, const char *control) else stack->flags |= PID_ON; break; -#ifndef THREAD - case 'g': - if (OpenProfile(cs, PROF_FILE)) - { - stack->flags |= PROFILE_ON; - stack->p_functions= ListAdd(stack->p_functions, control, end); - } - break; -#endif case 'L': if (sign < 0) stack->flags &= ~LINE_ON; @@ -1154,23 +1111,7 @@ void _db_enter_(const char *_func_, const char *_file_, _stack_frame_->prev= cs->framep; _stack_frame_->level= ++cs->level | framep_trace_flag(cs, cs->framep); cs->framep= _stack_frame_; -#ifndef THREAD - if (DoProfile(cs)) - { - long stackused; - if (cs->framep->prev == NULL) - stackused= 0; - else - { - stackused= (char*)(cs->framep->prev) - (char*)(cs->framep); - stackused= stackused > 0 ? stackused : -stackused; - } - (void) fprintf(cs->stack->prof_file, PROF_EFMT , Clock(), cs->func); - (void) fprintf(cs->stack->prof_file, PROF_SFMT, (ulong) cs->framep, stackused, - AUTOS_REVERSE ? _stack_frame_->func : cs->func); - (void) fflush(cs->stack->prof_file); - } -#endif + switch (DoTrace(cs)) { case ENABLE_TRACE: cs->framep->level|= TRACE_ON; @@ -1229,10 +1170,7 @@ void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_) my_snprintf(buf, sizeof(buf), ERR_MISSING_RETURN, cs->func); DbugExit(buf); } -#ifndef THREAD - if (DoProfile(cs)) - (void) fprintf(cs->stack->prof_file, PROF_XFMT, Clock(), cs->func); -#endif + if (DoTrace(cs) & DO_TRACE) { if (TRACING) @@ -1744,36 +1682,6 @@ static int DoTrace(CODE_STATE *cs) return DONT_TRACE; } - -/* - * FUNCTION - * - * DoProfile check to see if profiling is current enabled - * - * SYNOPSIS - * - * static BOOLEAN DoProfile() - * - * DESCRIPTION - * - * Checks to see if profiling is enabled based on whether the - * user has specified profiling, the maximum trace depth has - * not yet been reached, the current function is selected, - * and the current process is selected. Returns TRUE if - * profiling is enabled, FALSE otherwise. - * - */ - -#ifndef THREAD -static BOOLEAN DoProfile(CODE_STATE *cs) -{ - return PROFILING && - cs->level <= cs->stack->maxdepth && - InList(cs->stack->p_functions, cs->func) & (INCLUDE|MATCHED) && - InList(cs->stack->processes, cs->process) & (INCLUDE|MATCHED); -} -#endif - FILE *_db_fp_(void) { CODE_STATE *cs; @@ -1900,11 +1808,7 @@ static void DoPrefix(CODE_STATE *cs, uint _line_) cs->lineno++; if (cs->stack->flags & PID_ON) { -#ifdef THREAD (void) fprintf(cs->stack->out_file, "%-7s: ", my_thread_name()); -#else - (void) fprintf(cs->stack->out_file, "%5d: ", (int) getpid()); -#endif } if (cs->stack->flags & NUMBER_ON) (void) fprintf(cs->stack->out_file, "%5d: ", cs->lineno); @@ -2014,63 +1918,6 @@ static void DBUGOpenFile(CODE_STATE *cs, } } - -/* - * FUNCTION - * - * OpenProfile open new output stream for profiler output - * - * SYNOPSIS - * - * static FILE *OpenProfile(name) - * char *name; - * - * DESCRIPTION - * - * Given name of a new file, opens the file - * and sets the profiler output stream to the new file. - * - * It is currently unclear whether the prefered behavior is - * to truncate any existing file, or simply append to it. - * The latter behavior would be desirable for collecting - * accumulated runtime history over a number of separate - * runs. It might take some changes to the analyzer program - * though, and the notes that Binayak sent with the profiling - * diffs indicated that append was the normal mode, but this - * does not appear to agree with the actual code. I haven't - * investigated at this time [fnf; 24-Jul-87]. - */ - -#ifndef THREAD -static FILE *OpenProfile(CODE_STATE *cs, const char *name) -{ - REGISTER FILE *fp; - REGISTER BOOLEAN newfile; - - fp=0; - if (!Writable(name)) - { - (void) fprintf(cs->stack->out_file, ERR_OPEN, cs->process, name); - perror(""); - (void) Delay(cs->stack->delay); - } - else - { - newfile= !EXISTS(name); - if (!(fp= fopen(name, "w"))) - { - (void) fprintf(cs->stack->out_file, ERR_OPEN, cs->process, name); - perror(""); - } - else - { - cs->stack->prof_file= fp; - } - } - return fp; -} -#endif - /* * FUNCTION * @@ -2419,80 +2266,6 @@ const char* _db_get_func_(void) return cs->func; } -/* - * Here we need the definitions of the clock routine. Add your - * own for whatever system that you have. - */ - -#ifndef THREAD -#if defined(HAVE_GETRUSAGE) - -#include <sys/param.h> -#include <sys/resource.h> - -/* extern int getrusage(int, struct rusage *); */ - -/* - * Returns the user time in milliseconds used by this process so - * far. - */ - -static unsigned long Clock() -{ - struct rusage ru; - - (void) getrusage(RUSAGE_SELF, &ru); - return ru.ru_utime.tv_sec*1000 + ru.ru_utime.tv_usec/1000; -} - -#elif defined(__WIN__) - -static ulong Clock() -{ - return clock()*(1000/CLOCKS_PER_SEC); -} -#elif defined(amiga) - -struct DateStamp { /* Yes, this is a hack, but doing it right */ - long ds_Days; /* is incredibly ugly without splitting this */ - long ds_Minute; /* off into a separate file */ - long ds_Tick; -}; - -static int first_clock= TRUE; -static struct DateStamp begin; -static struct DateStamp elapsed; - -static unsigned long Clock() -{ - register struct DateStamp *now; - register unsigned long millisec= 0; - extern VOID *AllocMem(); - - now= (struct DateStamp *) AllocMem((long) sizeof(struct DateStamp), 0L); - if (now != NULL) - { - if (first_clock == TRUE) - { - first_clock= FALSE; - (void) DateStamp(now); - begin= *now; - } - (void) DateStamp(now); - millisec= 24 * 3600 * (1000 / HZ) * (now->ds_Days - begin.ds_Days); - millisec += 60 * (1000 / HZ) * (now->ds_Minute - begin.ds_Minute); - millisec += (1000 / HZ) * (now->ds_Tick - begin.ds_Tick); - (void) FreeMem(now, (long) sizeof(struct DateStamp)); - } - return millisec; -} -#else -static unsigned long Clock() -{ - return 0; -} -#endif /* RUSAGE */ -#endif /* THREADS */ #else diff --git a/dbug/dbug_analyze.c b/dbug/dbug_analyze.c index 1ebe8bfd77e..3d5713758ae 100644 --- a/dbug/dbug_analyze.c +++ b/dbug/dbug_analyze.c @@ -571,12 +571,10 @@ int main (int argc, char **argv) FILE *infile; FILE *outfile = {stdout}; -#ifdef THREAD #if defined(HAVE_PTHREAD_INIT) pthread_init(); /* Must be called before DBUG_ENTER */ #endif - my_thread_global_init(); -#endif /* THREAD */ + my_thread_global_init(); { DBUG_ENTER ("main"); DBUG_PROCESS (argv[0]); diff --git a/dbug/my_main.c b/dbug/my_main.c index 31c15aa67aa..48d092ca10a 100644 --- a/dbug/my_main.c +++ b/dbug/my_main.c @@ -16,12 +16,11 @@ char *argv[]; { register int result, ix; extern int factorial(int); -#if defined(HAVE_PTHREAD_INIT) && defined(THREAD) +#if defined(HAVE_PTHREAD_INIT) pthread_init(); /* Must be called before DBUG_ENTER */ #endif -#ifdef THREAD my_thread_global_init(); -#endif + { DBUG_ENTER ("main"); DBUG_PROCESS (argv[0]); diff --git a/dbug/tests.c b/dbug/tests.c index d76266d34a3..837a477aef3 100644 --- a/dbug/tests.c +++ b/dbug/tests.c @@ -44,12 +44,11 @@ int main (int argc, char *argv[]) if (argc == 1) return 0; -#if defined(HAVE_PTHREAD_INIT) && defined(THREAD) +#if defined(HAVE_PTHREAD_INIT) pthread_init(); /* Must be called before DBUG_ENTER */ #endif -#ifdef THREAD my_thread_global_init(); -#endif + dup2(1, 2); for (i = 1; i < argc; i++) { diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index e89929d159d..d8bac7532cc 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -40,7 +40,6 @@ SET(HEADERS my_xml.h mysql_embed.h my_pthread.h - my_no_pthread.h decimal.h errmsg.h my_global.h diff --git a/include/heap.h b/include/heap.h index a585371e18f..755a1aa3fed 100644 --- a/include/heap.h +++ b/include/heap.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2000-2004 MySQL AB, 2009 Sun Microsystems, Inc +/* Copyright (C) 2000, 2011, Oracle and/or its affiliates. All rights + reserved 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 @@ -25,10 +26,9 @@ extern "C" { #ifndef _my_base_h #include <my_base.h> #endif -#ifdef THREAD + #include <my_pthread.h> #include <thr_lock.h> -#endif #include "my_handler.h" #include "my_tree.h" @@ -146,10 +146,8 @@ typedef struct st_heap_share uint open_count; uchar *del_link; /* Link to next block with del. rec */ char * name; /* Name of "memory-file" */ -#ifdef THREAD THR_LOCK lock; mysql_mutex_t intern_lock; /* Locking for use with _locking */ -#endif my_bool delete_on_close; LIST open_list; uint auto_key; @@ -175,9 +173,7 @@ typedef struct st_heap_info TREE_ELEMENT **last_pos; uint lastkey_len; my_bool implicit_emptied; -#ifdef THREAD THR_LOCK_DATA lock; -#endif LIST open_list; } HP_INFO; diff --git a/include/my_base.h b/include/my_base.h index 83b02bfd833..347bda01bef 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (C) 2000, 2011, Oracle and/or its affiliates. All rights + reserved 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 @@ -30,9 +31,6 @@ #define EOVERFLOW 84 #endif -#if !defined(USE_MY_FUNC) && !defined(THREAD) -#include <my_nosys.h> /* For faster code, after test */ -#endif /* USE_MY_FUNC */ #endif /* stdin */ #include <my_list.h> diff --git a/include/my_bitmap.h b/include/my_bitmap.h index 548eec14d6e..78b33b09a51 100644 --- a/include/my_bitmap.h +++ b/include/my_bitmap.h @@ -33,9 +33,7 @@ typedef struct st_bitmap thread_safe flag in bitmap_init was set. Otherwise, we optimize by not acquiring the mutex */ -#ifdef THREAD mysql_mutex_t *mutex; -#endif } MY_BITMAP; #ifdef __cplusplus diff --git a/include/my_global.h b/include/my_global.h index a411ab8a118..c1ae8a6d6bc 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -212,13 +212,6 @@ #include <sys/types.h> #endif -/* The client defines this to avoid all thread code */ -#if defined(MYSQL_CLIENT_NO_THREADS) || defined(UNDEF_THREADS_HACK) -#undef THREAD -#undef HAVE_LINUXTHREADS -#undef HAVE_NPTL -#endif - #ifdef HAVE_THREADS_WITHOUT_SOCKETS /* MIT pthreads does not work with unix sockets */ #undef HAVE_SYS_UN_H @@ -261,7 +254,7 @@ #endif #endif -#if defined(THREAD) && !defined(__WIN__) +#if !defined(__WIN__) #ifndef _POSIX_PTHREAD_SEMANTICS #define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */ #endif @@ -282,7 +275,7 @@ C_MODE_END #if !defined(SCO) && !defined(_REENTRANT) #define _REENTRANT 1 /* Threads requires reentrant code */ #endif -#endif /* THREAD */ +#endif /* !defined(__WIN__) */ /* Go around some bugs in different OS and compilers */ #ifdef _AIX /* By soren@t.dk */ @@ -415,7 +408,7 @@ C_MODE_END #include <sys/stream.h> /* HPUX 10.20 defines ulong here. UGLY !!! */ #define HAVE_ULONG #endif -#if defined(HPUX10) && defined(_LARGEFILE64_SOURCE) && defined(THREAD) +#if defined(HPUX10) && defined(_LARGEFILE64_SOURCE) /* Fix bug in setrlimit */ #undef setrlimit #define setrlimit cma_setrlimit64 @@ -1342,17 +1335,6 @@ do { doubleget_union _tmp; \ #endif /* WORDS_BIGENDIAN */ -#ifndef THREAD -#define thread_safe_increment(V,L) (V)++ -#define thread_safe_decrement(V,L) (V)-- -#define thread_safe_add(V,C,L) (V)+=(C) -#define thread_safe_sub(V,C,L) (V)-=(C) -#define statistic_increment(V,L) (V)++ -#define statistic_decrement(V,L) (V)-- -#define statistic_add(V,C,L) (V)+=(C) -#define statistic_sub(V,C,L) (V)-=(C) -#endif - #ifdef HAVE_CHARSET_utf8 #define MYSQL_UNIVERSAL_CLIENT_CHARSET "utf8" #else diff --git a/include/my_no_pthread.h b/include/my_no_pthread.h deleted file mode 100644 index 633a5b94a6c..00000000000 --- a/include/my_no_pthread.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef MY_NO_PTHREAD_INCLUDED -#define MY_NO_PTHREAD_INCLUDED - -/* Copyright (C) 2000 MySQL AB, 2008-2009 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - - -#ifndef THREAD - -/* - This block is to access some thread-related type definitions - even in builds which do not need thread functions, - as some variables (based on these types) are declared - even in non-threaded builds. - Case in point: 'mf_keycache.c' -*/ -#if defined(__WIN__) -#else /* Normal threads */ -#include <pthread.h> - -#endif /* defined(__WIN__) */ - - -/* - This undefs some pthread mutex locks when one isn't using threads - to make thread safe code, that should also work in single thread - environment, easier to use. -*/ -#define pthread_mutex_init(A,B) -#define pthread_mutex_lock(A) -#define pthread_mutex_unlock(A) -#define pthread_mutex_destroy(A) -#define my_rwlock_init(A,B) -#define rw_rdlock(A) -#define rw_wrlock(A) -#define rw_unlock(A) -#define rwlock_destroy(A) -#define safe_mutex_assert_owner(mp) - -#define mysql_mutex_init(A, B, C) do {} while (0) -#define mysql_mutex_lock(A) do {} while (0) -#define mysql_mutex_unlock(A) do {} while (0) -#define mysql_mutex_destroy(A) do {} while (0) - -#define mysql_rwlock_init(A, B, C) do {} while (0) -#define mysql_rwlock_rdlock(A) do {} while (0) -#define mysql_rwlock_wrlock(A) do {} while (0) -#define mysql_rwlock_unlock(A) do {} while (0) -#define mysql_rwlock_destroy(A) do {} while (0) - -typedef int my_pthread_once_t; -#define MY_PTHREAD_ONCE_INIT 0 -#define MY_PTHREAD_ONCE_DONE 1 - -#define my_pthread_once(C,F) do { \ - if (*(C) != MY_PTHREAD_ONCE_DONE) { F(); *(C)= MY_PTHREAD_ONCE_DONE; } \ - } while(0) - -#endif -#endif /* MY_NO_PTHREAD_INCLUDED */ diff --git a/include/my_pthread.h b/include/my_pthread.h index c71ad9bf321..f1636cad136 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -881,12 +881,6 @@ extern uint thd_lib_detected; to use my_atomic operations instead. */ -/* - Warning: - When compiling without threads, this file is not included. - See the *other* declarations of thread_safe_xxx in include/my_global.h -*/ -#ifdef THREAD #ifndef thread_safe_increment #ifdef _WIN32 #define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V)) @@ -910,7 +904,7 @@ extern uint thd_lib_detected; (mysql_mutex_lock((L)), (V)-=(C), mysql_mutex_unlock((L))) #endif #endif -#endif + /* statistics_xxx functions are for non critical statistic, diff --git a/include/my_sys.h b/include/my_sys.h index 7ece2fede95..b5aa8696767 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -41,11 +41,7 @@ typedef struct my_aio_result { # define MEM_CHECK_DEFINED(a,len) ((void) 0) #endif /* HAVE_VALGRIND */ -#ifndef THREAD -extern int my_errno; /* Last error in mysys */ -#else #include <my_pthread.h> -#endif #include <m_ctype.h> /* for CHARSET_INFO */ #include <stdarg.h> @@ -314,7 +310,7 @@ struct st_my_file_info int oflag; /* open flags, e.g O_APPEND */ #endif enum file_type type; -#if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32) +#if !defined(HAVE_PREAD) && !defined(_WIN32) mysql_mutex_t mutex; #endif }; @@ -334,9 +330,7 @@ typedef struct st_my_tmpdir DYNAMIC_ARRAY full_list; char **list; uint cur, max; -#ifdef THREAD mysql_mutex_t mutex; -#endif } MY_TMPDIR; typedef struct st_dynamic_string @@ -348,7 +342,6 @@ typedef struct st_dynamic_string struct st_io_cache; typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*); -#ifdef THREAD typedef struct st_io_cache_share { mysql_mutex_t mutex; /* To sync on reads into buffer. */ @@ -368,7 +361,6 @@ typedef struct st_io_cache_share my_bool alloced; #endif } IO_CACHE_SHARE; -#endif typedef struct st_io_cache /* Used when cacheing files */ { @@ -409,7 +401,7 @@ typedef struct st_io_cache /* Used when cacheing files */ WRITE_CACHE, and &read_pos and &read_end respectively otherwise */ uchar **current_pos, **current_end; -#ifdef THREAD + /* The lock is for append buffer used in SEQ_READ_APPEND cache need mutex copying from append buffer to read buffer. @@ -423,7 +415,7 @@ typedef struct st_io_cache /* Used when cacheing files */ READ_CACHE mode is supported. */ IO_CACHE_SHARE *share; -#endif + /* A caller will use my_b_read() macro to read from the cache if the data is already in cache, it will be simply copied with @@ -631,6 +623,7 @@ extern const char** get_global_errmsgs(); extern void wait_for_free_space(const char *filename, int errors); extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags); extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags); +extern FILE *my_freopen(const char *path, const char *mode, FILE *stream); extern int my_fclose(FILE *fd,myf MyFlags); extern File my_fileno(FILE *fd); extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags); @@ -657,14 +650,6 @@ extern int my_redel(const char *from, const char *to, int MyFlags); extern int my_copystat(const char *from, const char *to, int MyFlags); extern char * my_filename(File fd); -#ifndef THREAD -extern void dont_break(void); -extern void allow_break(void); -#else -#define dont_break() -#define allow_break() -#endif - #ifdef EXTRA_DEBUG void my_print_open_files(void); #else @@ -737,12 +722,10 @@ extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type, pbool clear_cache); extern void setup_io_cache(IO_CACHE* info); extern int _my_b_read(IO_CACHE *info,uchar *Buffer,size_t Count); -#ifdef THREAD extern int _my_b_read_r(IO_CACHE *info,uchar *Buffer,size_t Count); extern void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare, IO_CACHE *write_cache, uint num_threads); extern void remove_io_thread(IO_CACHE *info); -#endif extern int _my_b_seq_read(IO_CACHE *info,uchar *Buffer,size_t Count); extern int _my_b_net_read(IO_CACHE *info,uchar *Buffer,size_t Count); extern int _my_b_get(IO_CACHE *info); diff --git a/include/myisam.h b/include/myisam.h index c4076ead403..cb641e12e8e 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -433,10 +433,8 @@ typedef struct st_mi_check_param const char *db_name, *table_name; const char *op_name; enum_mi_stats_method stats_method; -#ifdef THREAD mysql_mutex_t print_msg_mutex; my_bool need_print_msg_lock; -#endif } MI_CHECK; typedef struct st_sort_ft_buf @@ -460,10 +458,8 @@ typedef struct st_sort_info SORT_FT_BUF *ft_buf; /* sync things */ uint got_error, threads_running; -#ifdef THREAD mysql_mutex_t mutex; mysql_cond_t cond; -#endif } SORT_INFO; /* functions in mi_check */ diff --git a/include/mysql/innodb_priv.h b/include/mysql/innodb_priv.h index 993dad7cf99..5406c292b18 100644 --- a/include/mysql/innodb_priv.h +++ b/include/mysql/innodb_priv.h @@ -22,7 +22,6 @@ class THD; -uint filename_to_tablename(const char *from, char *to, uint to_length); int get_quote_char_for_identifier(THD *thd, const char *name, uint length); bool schema_table_store_record(THD *thd, TABLE *table); void localtime_to_TIME(MYSQL_TIME *to, struct tm *from); diff --git a/include/thr_alarm.h b/include/thr_alarm.h index 8d7f5bcdee0..8c91fc0b899 100644 --- a/include/thr_alarm.h +++ b/include/thr_alarm.h @@ -41,7 +41,7 @@ typedef struct st_alarm_info void thr_alarm_info(ALARM_INFO *info); -#if defined(DONT_USE_THR_ALARM) || !defined(THREAD) +#if defined(DONT_USE_THR_ALARM) #define USE_ALARM_THREAD #undef USE_ONE_SIGNAL_HAND diff --git a/libmysql/client_settings.h b/libmysql/client_settings.h index 5204d03e5af..c5a08ce1fcc 100644 --- a/libmysql/client_settings.h +++ b/libmysql/client_settings.h @@ -35,21 +35,6 @@ sig_handler my_pipe_sig_handler(int sig); void read_user_name(char *name); my_bool handle_local_infile(MYSQL *mysql, const char *net_filename); -/* - Let the user specify that we don't want SIGPIPE; This doesn't however work - with threaded applications as we can have multiple read in progress. -*/ - -#if !defined(__WIN__) && defined(SIGPIPE) && !defined(THREAD) -#define init_sigpipe_variables sig_return old_signal_handler=(sig_return) 0; -#define set_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) old_signal_handler=signal(SIGPIPE, my_pipe_sig_handler) -#define reset_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) signal(SIGPIPE,old_signal_handler); -#else -#define init_sigpipe_variables -#define set_sigpipe(mysql) -#define reset_sigpipe(mysql) -#endif - void mysql_read_default_options(struct st_mysql_options *options, const char *filename,const char *group); void mysql_detach_stmt_list(LIST **stmt_list, const char *func_name); diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index c498ed0f089..f802387cf9a 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -51,7 +51,7 @@ #ifdef HAVE_SYS_UN_H #include <sys/un.h> #endif -#if defined(THREAD) && !defined(__WIN__) +#if !defined(__WIN__) #include <my_pthread.h> /* because of signal() */ #endif #ifndef INADDR_NONE @@ -172,10 +172,8 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)), result= init_embedded_server(argc, argv, groups); #endif } -#ifdef THREAD else result= (int)my_thread_init(); /* Init if new thread */ -#endif return result; } @@ -229,18 +227,12 @@ MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void) my_bool STDCALL mysql_thread_init() { -#ifdef THREAD return my_thread_init(); -#else - return 0; -#endif } void STDCALL mysql_thread_end() { -#ifdef THREAD my_thread_end(); -#endif } @@ -1092,11 +1084,7 @@ void STDCALL mysql_get_character_set_info(MYSQL *mysql, MY_CHARSET_INFO *csinfo) uint STDCALL mysql_thread_safe(void) { -#ifdef THREAD return 1; -#else - return 0; -#endif } diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index b723b59eeff..fd02498f39a 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -12,10 +12,8 @@ main.gis # Bug#52208 2010-11-24 alik gis fails o main.gis-rtree @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server main.information_schema # Bug#47449 2009-09-19 alik main.information_schema and innodb.innodb_information_schema fail sporadically main.lock_multi_bug38499 # Bug#47448 2009-09-19 alik main.lock_multi_bug38499 times out sporadically -main.lock_multi_bug38691 @solaris # Bug#47792 2009-10-02 alik main.lock_multi_bug38691 times out sporadically on Solaris 10 main.lowercase_table2 @darwin # Bug#55509 2010-07-26 alik main.lowercase_table2 fails on Mac OSX (again) main.outfile_loaddata @solaris # Bug#46895 2010-01-20 alik Test "outfile_loaddata" fails (reproducible) -main.show_check # Bug#58414 2010-11-24 alik Race condition in show_check.test main.signal_demo3 @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun main.sp @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun main.type_float @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server diff --git a/mysql-test/collections/default.weekly b/mysql-test/collections/default.weekly index aff4a435510..ab792e14926 100644..100755 --- a/mysql-test/collections/default.weekly +++ b/mysql-test/collections/default.weekly @@ -1,2 +1,8 @@ perl mysql-test-run.pl --timer --force --parallel=auto --comment=1st --experimental=collections/default.experimental 1st perl mysql-test-run.pl --timer --force --parallel=auto --comment=big-tests --experimental=collections/default.experimental --vardir=var-big-tests --big-test --testcase-timeout=60 --suite-timeout=600 main.alter_table-big main.archive-big main.count_distinct3 main.create-big main.events_stress main.events_time_zone main.information_schema-big main.log_tables-big main.merge-big main.mysqlbinlog_row_big main.read_many_rows_innodb main.ssl-big main.sum_distinct-big main.type_newdecimal-big main.variables-big parts.part_supported_sql_func_innodb parts.partition_alter1_1_2_innodb parts.partition_alter1_2_innodb parts.partition_alter2_1_1_innodb parts.partition_alter2_1_2_innodb parts.partition_alter2_2_2_innodb parts.partition_alter4_innodb funcs_1.myisam_views-big +perl mysql-test-run.pl --timer --force --parallel=auto --comment=eits-tests-myisam-engine --experimental=collections/default.experimental --vardir=var-stmt-eits-tests-myisam-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=myisam +perl mysql-test-run.pl --timer --force --parallel=auto --comment=eits-rpl-binlog-row-tests-myisam-engine --experimental=collections/default.experimental --vardir=var-binlog-row-eits-tests-myisam-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=myisam --do-test=rpl --mysqld=--binlog-format=row +perl mysql-test-run.pl --timer --force --parallel=auto --comment=eits-rpl-binlog-mixed-tests-myisam-engine --experimental=collections/default.experimental --vardir=var-binlog-mixed-eits-tests-myisam-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=myisam --do-test=rpl --mysqld=--binlog-format=mixed +perl mysql-test-run.pl --timer --force --parallel=auto --comment=eits-tests-innodb-engine --experimental=collections/default.experimental --vardir=var-stmt-eits-tests-innodb-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=innodb --mysqld=--innodb +perl mysql-test-run.pl --timer --force --parallel=auto --comment=eits-rpl-binlog-row-tests-innodb-engine --experimental=collections/default.experimental --vardir=var-binlog-row-eits-tests-innodb-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=innodb --mysqld=--innodb --do-test=rpl --mysqld=--binlog-format=row +perl mysql-test-run.pl --timer --force --parallel=auto --comment=eits-rpl-binlog-mixed-tests-innodb-engine --experimental=collections/default.experimental --vardir=var-binlog-mixed-eits-tests-innodb-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=innodb --mysqld=--innodb --do-test=rpl --mysqld=--binlog-format=mixed diff --git a/mysql-test/collections/mysql-5.1-innodb.push b/mysql-test/collections/mysql-5.1-innodb.push new file mode 100644 index 00000000000..a213706498e --- /dev/null +++ b/mysql-test/collections/mysql-5.1-innodb.push @@ -0,0 +1,5 @@ +perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list +perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list +perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --vardir=var-emebbed --embedded --experimental=collections/default.experimental --skip-ndb +perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list +perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental --skip-ndb diff --git a/mysql-test/collections/mysql-5.5-innodb.push b/mysql-test/collections/mysql-5.5-innodb.push new file mode 100644 index 00000000000..a213706498e --- /dev/null +++ b/mysql-test/collections/mysql-5.5-innodb.push @@ -0,0 +1,5 @@ +perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list +perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list +perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --vardir=var-emebbed --embedded --experimental=collections/default.experimental --skip-ndb +perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list +perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental --skip-ndb diff --git a/mysql-test/collections/mysql-trunk-innodb.push b/mysql-test/collections/mysql-trunk-innodb.push new file mode 100644 index 00000000000..df00743c6d8 --- /dev/null +++ b/mysql-test/collections/mysql-trunk-innodb.push @@ -0,0 +1,5 @@ +perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --suite=main,binlog,innodb,rpl,sys_vars,perfschema --skip-test-list=collections/disabled-per-push.list +perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --suite=main,binlog,innodb,rpl,sys_vars,perfschema --skip-test-list=collections/disabled-per-push.list +perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-emebbed --embedded --suite=main,binlog,innodb,rpl,sys_vars,perfschema +perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog --skip-test-list=collections/disabled-per-push.list +perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result index 5adbefe104c..d21e78428c5 100644 --- a/mysql-test/r/auto_increment.result +++ b/mysql-test/r/auto_increment.result @@ -497,3 +497,22 @@ SET @@SESSION.AUTO_INCREMENT_INCREMENT=default; SET @@SESSION.AUTO_INCREMENT_OFFSET=default; DROP TABLE t1; End of 5.1 tests +# +# Bug#50619 assert in handler::update_auto_increment +# +CREATE TABLE t1 (pk INT AUTO_INCREMENT, PRIMARY KEY (pk)); +INSERT INTO t1 VALUES (NULL), (-1), (NULL); +SELECT * FROM t1; +pk +-1 +1 +2 +DROP TABLE t1; +CREATE TABLE t1 (pk BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY (pk)); +INSERT INTO t1 VALUES (NULL), (18446744073709551615-1), (NULL); +ERROR HY000: Failed to read auto-increment value from storage engine +SELECT * FROM t1; +pk +1 +18446744073709551614 +DROP TABLE t1; diff --git a/mysql-test/r/innodb_mysql_sync.result b/mysql-test/r/innodb_mysql_sync.result index 43a98829d4e..d0ba7b0f2e9 100644 --- a/mysql-test/r/innodb_mysql_sync.result +++ b/mysql-test/r/innodb_mysql_sync.result @@ -66,3 +66,27 @@ SELECT ((@id := id) - id) FROM t2; KILL @id; SET DEBUG_SYNC= "now SIGNAL killed"; DROP TABLE t1, t2; +SET DEBUG_SYNC= "RESET"; +# +# Bug#58933 Assertion `thd- >is_error()' fails on shutdown with ongoing +# OPTIMIZE TABLE +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1), (2); +# Connection con1 +SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL waiting WAIT_FOR killed'; +# Sending: +OPTIMIZE TABLE t1; +# Connection default +SET DEBUG_SYNC= 'now WAIT_FOR waiting'; +KILL QUERY ID; +SET DEBUG_SYNC= 'now SIGNAL killed'; +# Connection con1 +# Reaping: 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 Operation failed +# Connection default +DROP TABLE t1; +SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/r/lowercase_table4.result b/mysql-test/r/lowercase_table4.result index e3f861f8884..f896b9008e3 100755 --- a/mysql-test/r/lowercase_table4.result +++ b/mysql-test/r/lowercase_table4.result @@ -5,3 +5,111 @@ CREATE DATABASE XY; USE XY; DROP DATABASE XY; +USE TEST; +# +# Bug55222 Mysqldump table names case bug in REFERENCES clause +# InnoDB did not handle lower_case_table_names=2 for +# foreign_table_names and referenced_table_names. +# +SHOW VARIABLES LIKE 'lower_case_table_names'; +Variable_name Value +lower_case_table_names 2 +DROP TABLE IF EXISTS `Table2`; +DROP TABLE IF EXISTS `Table1`; +CREATE TABLE `Table1`(c1 INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE `Table2`(c1 INT PRIMARY KEY, c2 INT) ENGINE=InnoDB; +ALTER TABLE `Table2` ADD CONSTRAINT fk1 FOREIGN KEY(c2) REFERENCES `Table1`(c1); +SHOW CREATE TABLE `Table2`; +Table Table2 +Create Table CREATE TABLE `Table2` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `fk1` (`c2`), + CONSTRAINT `fk1` FOREIGN KEY (`c2`) REFERENCES `Table1` (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS; +CONSTRAINT_CATALOG def +CONSTRAINT_SCHEMA test +CONSTRAINT_NAME fk1 +UNIQUE_CONSTRAINT_CATALOG def +UNIQUE_CONSTRAINT_SCHEMA test +UNIQUE_CONSTRAINT_NAME PRIMARY +MATCH_OPTION NONE +UPDATE_RULE RESTRICT +DELETE_RULE RESTRICT +TABLE_NAME Table2 +REFERENCED_TABLE_NAME Table1 +DROP TABLE `Table2`; +DROP TABLE `Table1`; +DROP TABLE IF EXISTS Product_Order; +DROP TABLE IF EXISTS Product; +DROP TABLE IF EXISTS Customer; +CREATE TABLE Product (Category INT NOT NULL, Id INT NOT NULL, +Price DECIMAL, PRIMARY KEY(Category, Id)) ENGINE=InnoDB; +CREATE TABLE Customer (Id INT NOT NULL, PRIMARY KEY (Id)) ENGINE=InnoDB; +CREATE TABLE Product_Order (No INT NOT NULL AUTO_INCREMENT, +Product_Category INT NOT NULL, +Product_Id INT NOT NULL, +Customer_Id INT NOT NULL, +PRIMARY KEY(No), +INDEX (Product_Category, Product_Id), +FOREIGN KEY (Product_Category, Product_Id) +REFERENCES Product(Category, Id) ON UPDATE CASCADE ON DELETE RESTRICT, +INDEX (Customer_Id), +FOREIGN KEY (Customer_Id) +REFERENCES Customer(Id) +) ENGINE=INNODB; +SHOW CREATE TABLE Product_Order; +Table Product_Order +Create Table CREATE TABLE `Product_Order` ( + `No` int(11) NOT NULL AUTO_INCREMENT, + `Product_Category` int(11) NOT NULL, + `Product_Id` int(11) NOT NULL, + `Customer_Id` int(11) NOT NULL, + PRIMARY KEY (`No`), + KEY `Product_Category` (`Product_Category`,`Product_Id`), + KEY `Customer_Id` (`Customer_Id`), + CONSTRAINT `product_order_ibfk_1` FOREIGN KEY (`Product_Category`, `Product_Id`) REFERENCES `Product` (`Category`, `Id`) ON UPDATE CASCADE, + CONSTRAINT `product_order_ibfk_2` FOREIGN KEY (`Customer_Id`) REFERENCES `Customer` (`Id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW CREATE TABLE Product; +Table Product +Create Table CREATE TABLE `Product` ( + `Category` int(11) NOT NULL, + `Id` int(11) NOT NULL, + `Price` decimal(10,0) DEFAULT NULL, + PRIMARY KEY (`Category`,`Id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW CREATE TABLE Customer; +Table Customer +Create Table CREATE TABLE `Customer` ( + `Id` int(11) NOT NULL, + PRIMARY KEY (`Id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS; +CONSTRAINT_CATALOG def +CONSTRAINT_SCHEMA test +CONSTRAINT_NAME product_order_ibfk_1 +UNIQUE_CONSTRAINT_CATALOG def +UNIQUE_CONSTRAINT_SCHEMA test +UNIQUE_CONSTRAINT_NAME PRIMARY +MATCH_OPTION NONE +UPDATE_RULE CASCADE +DELETE_RULE RESTRICT +TABLE_NAME Product_Order +REFERENCED_TABLE_NAME Product +CONSTRAINT_CATALOG def +CONSTRAINT_SCHEMA test +CONSTRAINT_NAME product_order_ibfk_2 +UNIQUE_CONSTRAINT_CATALOG def +UNIQUE_CONSTRAINT_SCHEMA test +UNIQUE_CONSTRAINT_NAME PRIMARY +MATCH_OPTION NONE +UPDATE_RULE RESTRICT +DELETE_RULE RESTRICT +TABLE_NAME Product_Order +REFERENCED_TABLE_NAME Customer +DROP TABLE Product_Order; +DROP TABLE Product; +DROP TABLE Customer; diff --git a/mysql-test/r/not_embedded_server.result b/mysql-test/r/not_embedded_server.result index ce229bf3e2e..1f8fdb65407 100644 --- a/mysql-test/r/not_embedded_server.result +++ b/mysql-test/r/not_embedded_server.result @@ -7,13 +7,13 @@ slave_skip_errors OFF # # FLUSH PRIVILEGES should not implicitly unlock locked tables. # -drop table if exists t1; -create table t1 (c1 int); -lock tables t1 read; -flush privileges; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INT); +LOCK TABLES t1 READ; +FLUSH PRIVILEGES; ERROR HY000: Table 'host' was not locked with LOCK TABLES -unlock tables; -drop table t1; +UNLOCK TABLES; +DROP TABLE t1; # # Bug#54812: assert in Diagnostics_area::set_ok_status during EXPLAIN # @@ -28,7 +28,7 @@ CREATE FUNCTION f() RETURNS INT RETURN 1; GRANT FILE ON *.* TO 'nopriv_user'@'localhost'; FLUSH PRIVILEGES; connection: con1 -SELECT MAX(key1) FROM t1 WHERE f() < 1 INTO OUTFILE 'mytest'; +SELECT MAX(key1) FROM t1 WHERE f() < 1 INTO OUTFILE '<outfile>'; ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f' INSERT INTO t2 SELECT MAX(key1) FROM t1 WHERE f() < 1; ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f' diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index a639f9e6b3b..9c8b93d9fe2 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -1901,7 +1901,7 @@ c1 bigint, c2 set('sweet'), key (c2,c1,c0), key(c0) -) engine=myisam partition by hash (month(c0)) partitions 5; +) engine=myisam partition by hash (c0) partitions 5; insert ignore into t1 set c0 = -6502262, c1 = 3992917, c2 = 35019; insert ignore into t1 set c0 = 241221, c1 = -6862346, c2 = 56644; select c1 from t1 group by (select c0 from t1 limit 1); diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result index d41e4cb510c..1dcb2fdebb8 100644 --- a/mysql-test/r/partition_error.result +++ b/mysql-test/r/partition_error.result @@ -1,5 +1,655 @@ drop table if exists t1, t2; # +# Bug#54483: valgrind errors when making warnings for multiline inserts +# into partition +# +CREATE TABLE t1 (a VARBINARY(10)) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a CHAR(10)) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIMESTAMP) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +INSERT INTO t1 VALUES ('test'),('a'),('5'); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +Warning 1265 Data truncated for column 'a' at row 2 +Warning 1265 Data truncated for column 'a' at row 3 +SHOW WARNINGS; +Level Code Message +Warning 1265 Data truncated for column 'a' at row 1 +Warning 1265 Data truncated for column 'a' at row 2 +Warning 1265 Data truncated for column 'a' at row 3 +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +INSERT INTO t1 VALUES ('test'),('a'),('5'); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 3 +SHOW WARNINGS; +Level Code Message +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 3 +DROP TABLE t1; +CREATE TABLE t1 (a TIME) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +SHOW WARNINGS; +Level Code Message +Error 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TO_DAYS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (TO_DAYS(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (TO_DAYS(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TO_DAYS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TO_DAYS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (DAYOFMONTH(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (DAYOFMONTH(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (DAYOFMONTH(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (DAYOFMONTH(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (DAYOFMONTH(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (MONTH(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (MONTH(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (MONTH(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (MONTH(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (MONTH(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (DAYOFYEAR(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (DAYOFYEAR(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (DAYOFYEAR(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (DAYOFYEAR(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (DAYOFYEAR(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (HOUR(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (HOUR(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (HOUR(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (HOUR(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (HOUR(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (MINUTE(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (MINUTE(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (MINUTE(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (MINUTE(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (MINUTE(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (QUARTER(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (QUARTER(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (QUARTER(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (QUARTER(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (QUARTER(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (SECOND(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (SECOND(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (SECOND(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (SECOND(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (SECOND(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (YEARWEEK(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (YEARWEEK(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (YEARWEEK(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (YEARWEEK(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (YEARWEEK(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (WEEKDAY(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (WEEKDAY(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (WEEKDAY(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (WEEKDAY(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (WEEKDAY(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +# TO_SECONDS() is added in 5.5. +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TO_SECONDS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (TO_SECONDS(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (TO_SECONDS(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TO_SECONDS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TO_SECONDS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (TIME_TO_SEC(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TIME_TO_SEC(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TIME_TO_SEC(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (FROM_DAYS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (FROM_DAYS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (FROM_DAYS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TO_DAYS(FROM_DAYS(a))); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (FROM_DAYS(a)); +ERROR HY000: The PARTITION function returns the wrong type +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TO_DAYS(FROM_DAYS(a))); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (FROM_DAYS(a)); +ERROR HY000: The PARTITION function returns the wrong type +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (MICROSECOND(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (MICROSECOND(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (MICROSECOND(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (MICROSECOND(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (MICROSECOND(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +# Bug#57071 +CREATE TABLE t1 +(`date` date, +`extracted_week` int, +`yearweek` int, +`week` int, +`default_week_format` int) +PARTITION BY LIST (EXTRACT(WEEK FROM date) % 3) +(PARTITION p0 VALUES IN (0), +PARTITION p1 VALUES IN (1), +PARTITION p2 VALUES IN (2)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 +(`date` date, +`extracted_week` int, +`yearweek` int, +`week` int, +`default_week_format` int); +SET @old_default_week_format := @@default_week_format; +SET default_week_format = 0; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 1; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 2; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 3; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 4; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 5; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 6; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 7; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SELECT * FROM t1; +date extracted_week yearweek week default_week_format +2000-01-01 0 199952 0 0 +2000-01-01 0 199952 0 1 +2000-01-01 52 199952 52 2 +2000-01-01 52 199952 52 3 +2000-01-01 0 199952 0 4 +2000-01-01 0 199952 0 5 +2000-01-01 52 199952 52 6 +2000-01-01 52 199952 52 7 +SET default_week_format = @old_default_week_format; +DROP TABLE t1; +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +# EXTRACT(WEEK...) is disallowed, see bug#57071. +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME, b DATE) +PARTITION BY HASH (DATEDIFF(a, b)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE, b DATETIME) +PARTITION BY HASH (DATEDIFF(a, b)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME, b DATE) +PARTITION BY HASH (DATEDIFF(a, b)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE, b VARCHAR(10)) +PARTITION BY HASH (DATEDIFF(a, b)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT, b DATETIME) +PARTITION BY HASH (DATEDIFF(a, b)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (TIME_TO_SEC(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TIME_TO_SEC(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TIME_TO_SEC(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +# # Bug#50036: Inconsistent errors when using TIMESTAMP # columns/expressions # 1. correct and appropriate errors in light of diff --git a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result index 4280158dd16..339f2209cb3 100644 --- a/mysql-test/r/partition_range.result +++ b/mysql-test/r/partition_range.result @@ -13,16 +13,16 @@ EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100, 3) GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range a a 5 NULL 4 Using where; Using index DROP TABLE t1; -create table t1 (a int) -partition by range (a) +create table t1 (a DATETIME) +partition by range (TO_DAYS(a)) subpartition by hash(to_seconds(a)) (partition p0 values less than (1)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL + `a` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY RANGE (a) +/*!50500 PARTITION BY RANGE (TO_DAYS(a)) SUBPARTITION BY HASH (to_seconds(a)) (PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM) */ drop table t1; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 3136b5dfcc0..b516585fc37 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -5004,6 +5004,58 @@ ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE)); SELECT * FROM t2 UNION SELECT * FROM t2 ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE)); DROP TABLE t1,t2; +# +# Bug #58818: Incorrect result for IN/ANY subquery +# with HAVING condition +# +CREATE TABLE t1(i INT); +INSERT INTO t1 VALUES (1), (2), (3); +CREATE TABLE t1s(i INT); +INSERT INTO t1s VALUES (10), (20), (30); +CREATE TABLE t2s(i INT); +INSERT INTO t2s VALUES (100), (200), (300); +SELECT * FROM t1 +WHERE t1.i NOT IN +( +SELECT STRAIGHT_JOIN t2s.i +FROM +t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i +HAVING t2s.i = 999 +); +i +1 +2 +3 +SELECT * FROM t1 +WHERE t1.I IN +( +SELECT STRAIGHT_JOIN t2s.i +FROM +t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i +HAVING t2s.i = 999 +) IS UNKNOWN; +i +SELECT * FROM t1 +WHERE NOT t1.I = ANY +( +SELECT STRAIGHT_JOIN t2s.i +FROM +t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i +HAVING t2s.i = 999 +); +i +1 +2 +3 +SELECT * FROM t1 +WHERE t1.i = ANY ( +SELECT STRAIGHT_JOIN t2s.i +FROM +t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i +HAVING t2s.i = 999 +) IS UNKNOWN; +i +DROP TABLE t1,t1s,t2s; End of 5.1 tests # # Bug #57704: Cleanup code dies with void TABLE::set_keyread(bool): diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result index ebda4b52f10..69f038f9396 100644 --- a/mysql-test/r/subselect4.result +++ b/mysql-test/r/subselect4.result @@ -164,6 +164,17 @@ a b 2 NULL DROP TABLE t1, t2, t3, t4, t5; # +# Bug#58207: invalid memory reads when using default column value and +# tmptable needed +# +CREATE TABLE t(a VARCHAR(245) DEFAULT +'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); +INSERT INTO t VALUES (''),(''),(''),(''),(''),(''),(''),(''),(''),(''),(''); +SELECT * FROM (SELECT default(a) FROM t GROUP BY a) d; +default(a) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +DROP TABLE t; +# # End of 5.1 tests. # # diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 33fc4333d1c..1f3422c1767 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1644,3 +1644,128 @@ b 2 DROP TABLE t1,t2; End of 5.1 tests +# +# Bug#57986 ORDER BY clause is not used after a UNION, +# if embedded in a SELECT +# +CREATE TABLE t1 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL); +CREATE TABLE t2 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL); +INSERT INTO t1 (c1, c2) VALUES ('t1a', 1), ('t1a', 2), ('t1a', 3), ('t1b', 2), ('t1b', 1); +INSERT INTO t2 (c1, c2) VALUES ('t2a', 1), ('t2a', 2), ('t2a', 3), ('t2b', 2), ('t2b', 1); +SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY c2, c1; +c1 c2 +t1a 1 +t1b 1 +t2a 1 +t2b 1 +t1a 2 +t1b 2 +t2a 2 +t2b 2 +t1a 3 +t2a 3 +SELECT * FROM t1 UNION (SELECT * FROM t2) ORDER BY c2, c1; +c1 c2 +t1a 1 +t1b 1 +t2a 1 +t2b 1 +t1a 2 +t1b 2 +t2a 2 +t2b 2 +t1a 3 +t2a 3 +SELECT * FROM t1 UNION (SELECT * FROM t2 ORDER BY c2, c1); +c1 c2 +t1a 1 +t1a 2 +t1a 3 +t1b 2 +t1b 1 +t2a 1 +t2a 2 +t2a 3 +t2b 2 +t2b 1 +SELECT c1, c2 FROM ( +SELECT c1, c2 FROM t1 +UNION +(SELECT c1, c2 FROM t2) +ORDER BY c2, c1 +) AS res; +c1 c2 +t1a 1 +t1b 1 +t2a 1 +t2b 1 +t1a 2 +t1b 2 +t2a 2 +t2b 2 +t1a 3 +t2a 3 +SELECT c1, c2 FROM ( +SELECT c1, c2 FROM t1 +UNION +(SELECT c1, c2 FROM t2) +ORDER BY c2 DESC, c1 LIMIT 1 +) AS res; +c1 c2 +t1a 3 +SELECT c1, c2 FROM ( +SELECT c1, c2 FROM t1 +UNION +(SELECT c1, c2 FROM t2 ORDER BY c2 DESC, c1 LIMIT 1) +) AS res; +c1 c2 +t1a 1 +t1a 2 +t1a 3 +t1b 2 +t1b 1 +t2a 3 +SELECT c1, c2 FROM ( +SELECT c1, c2 FROM t1 +UNION +SELECT c1, c2 FROM t2 +ORDER BY c2 DESC, c1 DESC LIMIT 1 +) AS res; +c1 c2 +t2a 3 +SELECT c1, c2 FROM ( +( +(SELECT c1, c2 FROM t1) +UNION +(SELECT c1, c2 FROM t2) +) +ORDER BY c2 DESC, c1 ASC LIMIT 1 +) AS res; +c1 c2 +t1a 3 +DROP TABLE t1, t2; +# +# Bug #58970 Problem Subquery (without referencing a table) +# and Order By +# +SELECT(SELECT 0 AS a UNION SELECT 1 AS a ORDER BY a ASC LIMIT 1) AS dev; +dev +0 +SELECT(SELECT 0 AS a UNION SELECT 1 AS a ORDER BY a DESC LIMIT 1) AS dev; +dev +1 +SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a ASC LIMIT 1) AS dev; +dev +0 +SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev; +dev +1 +SELECT(SELECT 1 AS a ORDER BY a) AS dev; +dev +1 +SELECT(SELECT 1 AS a LIMIT 1) AS dev; +dev +1 +SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev; +dev +1 diff --git a/mysql-test/suite/engines/funcs/r/in_multicolumn_string_pk_constraint_error.result b/mysql-test/suite/engines/funcs/r/in_multicolumn_string_pk_constraint_error.result index 6f66eec52a0..ff161fbae7a 100644 --- a/mysql-test/suite/engines/funcs/r/in_multicolumn_string_pk_constraint_error.result +++ b/mysql-test/suite/engines/funcs/r/in_multicolumn_string_pk_constraint_error.result @@ -55,6 +55,12 @@ INSERT INTO t1 (c1,c2,c3) VALUES('def','abc','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('def','def','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('def','abc','def'); INSERT INTO t1 (c1,c2,c3) VALUES('abc','def','def'); +INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','abc'); +ERROR 23000: Duplicate entry 'abc-abc-abc' for key 'PRIMARY' +INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','def'); +ERROR 23000: Duplicate entry 'abc-abc-def' for key 'PRIMARY' +INSERT INTO t1 (c1,c2,c3) VALUES('abc','def','def'); +ERROR 23000: Duplicate entry 'abc-def-def' for key 'PRIMARY' SELECT hex(c1),hex(c2),hex(c3) FROM t1; hex(c1) hex(c2) hex(c3) 61626300000000000000 61626300000000000000 61626300000000000000 diff --git a/mysql-test/suite/engines/funcs/r/in_multicolumn_string_pk_constraint_ignore.result b/mysql-test/suite/engines/funcs/r/in_multicolumn_string_pk_constraint_ignore.result index ac0fe07af56..c4d03026a87 100644 --- a/mysql-test/suite/engines/funcs/r/in_multicolumn_string_pk_constraint_ignore.result +++ b/mysql-test/suite/engines/funcs/r/in_multicolumn_string_pk_constraint_ignore.result @@ -55,6 +55,12 @@ INSERT INTO t1 (c1,c2,c3) VALUES('def','abc','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('def','def','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('def','abc','def'); INSERT INTO t1 (c1,c2,c3) VALUES('abc','def','def'); +INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','abc'); +ERROR 23000: Duplicate entry 'abc-abc-abc' for key 'PRIMARY' +INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','def'); +ERROR 23000: Duplicate entry 'abc-abc-def' for key 'PRIMARY' +INSERT INTO t1 (c1,c2,c3) VALUES('abc','def','def'); +ERROR 23000: Duplicate entry 'abc-def-def' for key 'PRIMARY' SELECT * FROM t1; c1 c2 c3 abc diff --git a/mysql-test/suite/engines/funcs/r/in_multicolumn_string_unique_constraint_error.result b/mysql-test/suite/engines/funcs/r/in_multicolumn_string_unique_constraint_error.result index 23fd244b40b..39e08f2f4ac 100644 --- a/mysql-test/suite/engines/funcs/r/in_multicolumn_string_unique_constraint_error.result +++ b/mysql-test/suite/engines/funcs/r/in_multicolumn_string_unique_constraint_error.result @@ -55,6 +55,12 @@ INSERT INTO t1 (c1,c2,c3) VALUES('def','abc','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('def','def','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('def','abc','def'); INSERT INTO t1 (c1,c2,c3) VALUES('abc','def','def'); +INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','abc'); +ERROR 23000: Duplicate entry 'abc-abc-abc' for key 'c1' +INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','def'); +ERROR 23000: Duplicate entry 'abc-abc-def' for key 'c1' +INSERT INTO t1 (c1,c2,c3) VALUES('abc','def','def'); +ERROR 23000: Duplicate entry 'abc-def-def' for key 'c1' SELECT * FROM t1; c1 c2 c3 abc diff --git a/mysql-test/suite/engines/funcs/r/in_string_pk_constraint_error.result b/mysql-test/suite/engines/funcs/r/in_string_pk_constraint_error.result Binary files differindex bbbccf797e7..7f60b844b64 100644 --- a/mysql-test/suite/engines/funcs/r/in_string_pk_constraint_error.result +++ b/mysql-test/suite/engines/funcs/r/in_string_pk_constraint_error.result diff --git a/mysql-test/suite/engines/funcs/r/in_string_unique_constraint_error.result b/mysql-test/suite/engines/funcs/r/in_string_unique_constraint_error.result Binary files differindex b1163e0b08a..42be531343e 100644 --- a/mysql-test/suite/engines/funcs/r/in_string_unique_constraint_error.result +++ b/mysql-test/suite/engines/funcs/r/in_string_unique_constraint_error.result diff --git a/mysql-test/suite/engines/funcs/r/rpl_000015.result b/mysql-test/suite/engines/funcs/r/rpl_000015.result index cfb4f0ead5a..bb3620ebc84 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_000015.result +++ b/mysql-test/suite/engines/funcs/r/rpl_000015.result @@ -10,25 +10,174 @@ File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 107 stop slave; reset slave; +show slave status; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry # Master_Log_File Read_Master_Log_Pos 4 +Relay_Log_File # +Relay_Log_Pos # 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 # +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 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 change master to master_host='127.0.0.1'; +show slave status; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry # Master_Log_File Read_Master_Log_Pos 4 +Relay_Log_File # +Relay_Log_Pos # 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 # +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 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=MASTER_PORT; +show slave status; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry # Master_Log_File Read_Master_Log_Pos 4 +Relay_Log_File # +Relay_Log_Pos # 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 # +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 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 start slave; +show slave status; +Slave_IO_State Waiting for master to send event +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 107 +Relay_Log_File slave-relay-bin.000002 +Relay_Log_Pos 254 Relay_Master_Log_File master-bin.000001 -Checking that both slave threads are running. +Slave_IO_Running Yes +Slave_SQL_Running Yes +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 107 +Relay_Log_Space 410 +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 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 drop table if exists t1; create table t1 (n int, PRIMARY KEY(n)); insert into t1 values (10),(45),(90); diff --git a/mysql-test/suite/engines/funcs/r/rpl_change_master.result b/mysql-test/suite/engines/funcs/r/rpl_change_master.result index 2258a35a869..c187f16cc83 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_change_master.result +++ b/mysql-test/suite/engines/funcs/r/rpl_change_master.result @@ -11,7 +11,13 @@ stop slave sql_thread; insert into t1 values(1); insert into t1 values(2); stop slave; +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running 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 Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed 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 Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id +# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 192 # None 0 No # No 0 0 1 change master to master_user='root'; +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running 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 Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed 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 Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id +# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 192 # None 0 No # No 0 0 1 start slave; select * from t1; n diff --git a/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result b/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result index ef4d7797dbf..53a521aaf85 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result +++ b/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result @@ -17,6 +17,45 @@ let $result_pattern= '%127.0.0.1%root%slave-bin.000001%slave-bin.000001%Yes%Yes% --source include/wait_slave_status.inc flush logs; -Relay_Log_File mysqld-relay-bin.000003 -Checking that both slave threads are running. +SHOW SLAVE STATUS; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port SLAVE_PORT +Connect_Retry 60 +Master_Log_File slave-bin.000001 +Read_Master_Log_Pos 107 +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File slave-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running Yes +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 107 +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 +Replicate_Ignore_Server_Ids +Master_Server_Id 2 STOP SLAVE; diff --git a/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result b/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result index 779a3af9631..8b2da7ff9a1 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result +++ b/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result @@ -10,6 +10,6 @@ load data infile '../../std_data/rpl_loaddata.dat' into table test.t1; select count(*) from test.t1; count(*) 2 -show binlog events from <binlog_start>; +show binlog events from 107; Log_name Pos Event_type Server_id End_log_pos Info drop table test.t1; diff --git a/mysql-test/suite/engines/funcs/r/rpl_log_pos.result b/mysql-test/suite/engines/funcs/r/rpl_log_pos.result index 1b2ded26f66..df4512fa0ea 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_log_pos.result +++ b/mysql-test/suite/engines/funcs/r/rpl_log_pos.result @@ -4,23 +4,39 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +show master status; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 107 <Binlog_Ignore_DB> +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running 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 Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed 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 Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id +# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 107 # # master-bin.000001 Yes Yes 0 0 107 # None 0 No # No 0 0 1 stop slave; -change master to master_log_pos=MASTER_LOG_POS; +change master to master_log_pos=107; start slave; stop slave; -change master to master_log_pos=MASTER_LOG_POS; +change master to master_log_pos=107; +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running 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 Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed 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 Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id +# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 107 # # master-bin.000001 No No 0 0 107 # None 0 No # No 0 0 1 start slave; +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running 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 Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed 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 Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id +# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 107 # # master-bin.000001 Yes Yes 0 0 107 # None 0 No # No 0 0 1 stop slave; -# impossible position leads to an error -change master to master_log_pos=MASTER_LOG_POS; +change master to master_log_pos=178; start slave; -Last_IO_Error = Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position' +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running 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 Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed 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 Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id +# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 178 # # master-bin.000001 No Yes 0 0 178 # None 0 No # No 1236 Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position' 0 1 +show master status; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 107 <Binlog_Ignore_DB> create table if not exists t1 (n int); drop table if exists t1; create table t1 (n int); insert into t1 values (1),(2),(3); stop slave; -change master to master_log_pos=MASTER_LOG_POS; +change master to master_log_pos=207; start slave; select * from t1 ORDER BY n; n diff --git a/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result b/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result index 0eb3d7e8ff9..13f7fbfbdeb 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result +++ b/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result @@ -8,17 +8,48 @@ start slave; CREATE TABLE t1 (a INT, b LONG); INSERT INTO t1 VALUES (1,1), (2,2); INSERT INTO t1 VALUES (3,UUID()), (4,UUID()); -show binlog events from <binlog_start>; +SHOW BINLOG EVENTS; **** On Slave **** -show binlog events from <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2) -slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # BEGIN -slave-bin.000001 # Table_map # # table_id: # (test.t1) -slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -slave-bin.000001 # Query # # COMMIT -show binlog events from <binlog_start>; +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 # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running Yes +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 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 +SHOW BINLOG EVENTS; DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_drop.result b/mysql-test/suite/engines/funcs/r/rpl_row_drop.result index 048e07271b3..d45bbadf7df 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_drop.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_drop.result @@ -41,11 +41,14 @@ t1 t2 **** On Master **** DROP TABLE t1,t2; -show binlog events from <binlog_start>; +SHOW BINLOG EVENTS; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int) -master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int) -master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ +master-bin.000001 4 Format_desc 1 107 Server ver: VERSION, Binlog ver: 4 +master-bin.000001 107 Query 1 193 use `test`; CREATE TABLE t1 (a int) +master-bin.000001 193 Query 1 279 use `test`; CREATE TABLE t2 (a int) +master-bin.000001 279 Query 1 403 use `test`; DROP TEMPORARY TABLE IF EXISTS `t2` /* generated by server */ +master-bin.000001 403 Query 1 527 use `test`; DROP TEMPORARY TABLE IF EXISTS `t2` /* generated by server */ +master-bin.000001 527 Query 1 631 use `test`; DROP TABLE `t1` /* generated by server */ SHOW TABLES; Tables_in_test t2 diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result b/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result index cd7528280d0..aff54e01b95 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result @@ -17,5 +17,45 @@ a 0 drop table t1; insert into t1 values (1); -Last_SQL_Error = Error 'Table 'test.t1' doesn't exist' on opening tables +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 Yes +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table test.t2 +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 1146 +Last_Error Error executing row event: 'Table 'test.t1' doesn't exist' +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 1146 +Last_SQL_Error Error executing row event: 'Table 'test.t1' doesn't exist' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 drop table t1, t2; diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result b/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result index 7bf09df31ca..5499d41bc1f 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result @@ -11,8 +11,9 @@ change master to master_user='test'; Master_User test Master_Host 127.0.0.1 reset slave; -Master_User root +Master_User test Master_Host 127.0.0.1 +change master to master_user='root'; include/start_slave.inc Master_User root Master_Host 127.0.0.1 @@ -30,11 +31,11 @@ include/stop_slave.inc reset slave; change master to master_user='impossible_user_name'; start slave; -include/stop_slave.inc +stop slave; change master to master_user='root'; include/start_slave.inc -include/stop_slave.inc +stop slave; change master to master_user='impossible_user_name'; start slave; -include/stop_slave.inc +stop slave; reset slave; diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp005.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp005.result index 01e1970e0df..58c53b394b2 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_sp005.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp005.result @@ -77,6 +77,8 @@ id2 < ---- Master selects-- > ------------------------- CALL test.p1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM test.t3 ORDER BY id3; id3 c 1 MySQL diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_trig003.result b/mysql-test/suite/engines/funcs/r/rpl_row_trig003.result index 43c2ecde2b4..131af933b41 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_trig003.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_trig003.result @@ -69,9 +69,15 @@ INSERT INTO test.t2 VALUES(NULL,0,'Testing MySQL databases is a cool ', 'MySQL C UPDATE test.t1 SET b1 = 0 WHERE b1 = 1; INSERT INTO test.t2 VALUES(NULL,1,'This is an after update test.', 'If this works, total will not be zero on the master or slave',1.4321,5.221,0,YEAR(NOW()),NOW()); UPDATE test.t2 SET b1 = 0 WHERE b1 = 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed INSERT INTO test.t1 VALUES(NULL,1,'add some more test data test.', 'and hope for the best', 3.321,5.221,0,YEAR(NOW()),NOW()); DELETE FROM test.t1 WHERE id = 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed DELETE FROM test.t2 WHERE id = 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed DROP TRIGGER test.t1_bi; DROP TRIGGER test.t2_ai; DROP TRIGGER test.t1_bu; diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_until.result b/mysql-test/suite/engines/funcs/r/rpl_row_until.result index 72dd1a6a7c3..d8637578ecc 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_until.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_until.result @@ -12,39 +12,201 @@ 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; -start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS; +start slave until master_log_file='master-bin.000001', master_log_pos=311; select * from t1; n 1 2 3 4 -start slave until master_log_file='master-no-such-bin.000001', master_log_pos=MASTER_LOG_POS; +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 slave-relay-bin.000004 +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running # +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 # +Relay_Log_Space # +Until_Condition Master +Until_Log_File master-bin.000001 +Until_Log_Pos 311 +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 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 +start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291; select * from t1; -n -1 -2 -3 -4 -start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=RELAY_LOG_POS; +n 1 +n 2 +n 3 +n 4 +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 slave-relay-bin.000004 +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running # +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 # +Relay_Log_Space # +Until_Condition Master +Until_Log_File master-no-such-bin.000001 +Until_Log_Pos 291 +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 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 +start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728; select * from t2; -n -1 -2 +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 slave-relay-bin.000004 +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running # +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 # +Relay_Log_Space # +Until_Condition Relay +Until_Log_File slave-relay-bin.000004 +Until_Log_Pos 728 +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 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 start slave; stop slave; -start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS; -start slave until master_log_file='master-bin', master_log_pos=MASTER_LOG_POS; +start slave until master_log_file='master-bin.000001', master_log_pos=740; +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 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 # +Relay_Log_Space # +Until_Condition Master +Until_Log_File master-bin.000001 +Until_Log_Pos 740 +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 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 +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=MASTER_LOG_POS, relay_log_pos=RELAY_LOG_POS; +start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL start slave until master_log_file='master-bin.000001'; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL 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=MASTER_LOG_POS; +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 until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS; +start slave until master_log_file='master-bin.000001', master_log_pos=740; Warnings: -Note 1254 Slave is already running +Level Note +Code 1254 +Message Slave is already running diff --git a/mysql-test/suite/engines/funcs/r/rpl_server_id1.result b/mysql-test/suite/engines/funcs/r/rpl_server_id1.result index 1e7108d7961..700bc270f07 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_server_id1.result +++ b/mysql-test/suite/engines/funcs/r/rpl_server_id1.result @@ -8,8 +8,10 @@ create table t1 (n int); reset master; stop slave; change master to master_port=SLAVE_PORT; +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running 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 Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed 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 Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id + 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # # 0 0 0 107 None 0 No NULL No 0 0 1 start slave; -Last_IO_Error = Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it). insert into t1 values (1); show status like "slave_running"; Variable_name Value diff --git a/mysql-test/suite/engines/funcs/r/rpl_server_id2.result b/mysql-test/suite/engines/funcs/r/rpl_server_id2.result index 066b563c4e8..f8d24f70776 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_server_id2.result +++ b/mysql-test/suite/engines/funcs/r/rpl_server_id2.result @@ -8,6 +8,9 @@ create table t1 (n int); reset master; stop slave; change master to master_port=SLAVE_PORT; +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running 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 Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed 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 Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id + 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 107 None 0 No NULL No 0 0 1 start slave; insert into t1 values (1); select * from t1; diff --git a/mysql-test/suite/engines/funcs/r/rpl_slave_status.result b/mysql-test/suite/engines/funcs/r/rpl_slave_status.result index c4dc7686045..0e438d294fd 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_slave_status.result +++ b/mysql-test/suite/engines/funcs/r/rpl_slave_status.result @@ -18,5 +18,46 @@ drop user rpl@127.0.0.1; flush privileges; stop slave; start slave; +show slave status; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User rpl +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 Connecting +Slave_SQL_Running Yes +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 NULL +Master_SSL_Verify_Server_Cert No +Last_IO_Errno # +Last_IO_Error # +Last_SQL_Errno 0 +Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 drop table t1; drop table t1; diff --git a/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result b/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result index e7306cd6293..b0d92f3ca3f 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result +++ b/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result @@ -376,7 +376,7 @@ CREATE TABLE t12 (data LONG); LOCK TABLES t12 WRITE; INSERT INTO t12 VALUES(UUID()); UNLOCK TABLES; -show binlog events from <binlog_start>; -show binlog events from <binlog_start>; +show binlog events; +show binlog events; drop database mysqltest1; set global binlog_format= @saved_binlog_format; diff --git a/mysql-test/suite/engines/funcs/r/sf_alter.result b/mysql-test/suite/engines/funcs/r/sf_alter.result index e89f529ba09..8885b20d557 100644 --- a/mysql-test/suite/engines/funcs/r/sf_alter.result +++ b/mysql-test/suite/engines/funcs/r/sf_alter.result @@ -35,6 +35,8 @@ ALTER FUNCTION sf1 #DET# ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -52,6 +54,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -72,6 +76,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -98,6 +105,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -163,6 +172,8 @@ ALTER FUNCTION sf1 #DET# CONTAINS SQL ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -180,6 +191,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -200,6 +213,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -226,6 +242,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -291,6 +309,8 @@ ALTER FUNCTION sf1 #DET# NO SQL ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -308,6 +328,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -328,6 +350,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -354,6 +379,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -419,6 +446,8 @@ ALTER FUNCTION sf1 #DET# READS SQL DATA ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -436,6 +465,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -456,6 +487,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -482,6 +516,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -547,6 +583,8 @@ ALTER FUNCTION sf1 #DET# MODIFIES SQL DATA ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -564,6 +602,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -584,6 +624,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -610,6 +653,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -675,6 +720,8 @@ ALTER FUNCTION sf1 #DET# COMMENT 'comment' ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -692,6 +739,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -712,6 +761,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -738,6 +790,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -803,6 +857,8 @@ ALTER FUNCTION sf1 #DET# CONTAINS SQL COMMENT 'comment' ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -820,6 +876,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -840,6 +898,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -866,6 +927,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -931,6 +994,8 @@ ALTER FUNCTION sf1 #DET# NO SQL COMMENT 'comment' ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -948,6 +1013,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -968,6 +1035,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -994,6 +1064,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1059,6 +1131,8 @@ ALTER FUNCTION sf1 #DET# READS SQL DATA COMMENT 'comment' ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1076,6 +1150,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1096,6 +1172,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1122,6 +1201,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1187,6 +1268,8 @@ ALTER FUNCTION sf1 #DET# MODIFIES SQL DATA COMMENT 'comment' ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1204,6 +1287,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1224,6 +1309,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1250,6 +1338,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1315,6 +1405,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1332,6 +1424,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1352,6 +1446,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1378,6 +1475,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1443,6 +1542,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# CONTAINS SQL ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1460,6 +1561,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1480,6 +1583,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1506,6 +1612,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1571,6 +1679,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# NO SQL ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1588,6 +1698,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1608,6 +1720,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1634,6 +1749,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1699,6 +1816,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# READS SQL DATA ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1716,6 +1835,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1736,6 +1857,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1762,6 +1886,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1827,6 +1953,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# MODIFIES SQL DATA ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1844,6 +1972,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1864,6 +1994,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1890,6 +2023,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1955,6 +2090,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# COMMENT 'comment' ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1972,6 +2109,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1992,6 +2131,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2018,6 +2160,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2083,6 +2227,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# CONTAINS SQL COMMENT 'comment' ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2100,6 +2246,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2120,6 +2268,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2146,6 +2297,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2211,6 +2364,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# NO SQL COMMENT 'comment' ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2228,6 +2383,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2248,6 +2405,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2274,6 +2434,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2339,6 +2501,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# READS SQL DATA COMMENT 'comment' ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2356,6 +2520,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2376,6 +2542,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2402,6 +2571,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2467,6 +2638,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# MODIFIES SQL DATA COMMENT 'comment' ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2484,6 +2657,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2504,6 +2679,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2530,6 +2708,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2595,6 +2775,8 @@ ALTER FUNCTION sf1 #DET# SQL SECURITY INVOKER ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2612,6 +2794,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2632,6 +2816,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2658,6 +2845,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2723,6 +2912,8 @@ ALTER FUNCTION sf1 #DET# CONTAINS SQL SQL SECURITY INVOKER ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2740,6 +2931,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2760,6 +2953,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2786,6 +2982,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2851,6 +3049,8 @@ ALTER FUNCTION sf1 #DET# NO SQL SQL SECURITY INVOKER ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2868,6 +3068,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2888,6 +3090,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2914,6 +3119,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2979,6 +3186,8 @@ ALTER FUNCTION sf1 #DET# READS SQL DATA SQL SECURITY INVOKER ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2996,6 +3205,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3016,6 +3227,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3042,6 +3256,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3107,6 +3323,8 @@ ALTER FUNCTION sf1 #DET# MODIFIES SQL DATA SQL SECURITY INVOKER ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3124,6 +3342,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3144,6 +3364,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3170,6 +3393,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3235,6 +3460,8 @@ ALTER FUNCTION sf1 #DET# SQL SECURITY INVOKER COMMENT 'comment' ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3252,6 +3479,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3272,6 +3501,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3298,6 +3530,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3363,6 +3597,8 @@ ALTER FUNCTION sf1 #DET# CONTAINS SQL SQL SECURITY INVOKER COMMENT 'comment' SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3380,6 +3616,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3400,6 +3638,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3426,6 +3667,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3491,6 +3734,8 @@ ALTER FUNCTION sf1 #DET# NO SQL SQL SECURITY INVOKER COMMENT 'comment' ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3508,6 +3753,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3528,6 +3775,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3554,6 +3804,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3619,6 +3871,8 @@ ALTER FUNCTION sf1 #DET# READS SQL DATA SQL SECURITY INVOKER COMMENT 'comment SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3636,6 +3890,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3656,6 +3912,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3682,6 +3941,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3747,6 +4008,8 @@ ALTER FUNCTION sf1 #DET# MODIFIES SQL DATA SQL SECURITY INVOKER COMMENT 'comm SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3764,6 +4027,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3784,6 +4049,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3810,6 +4078,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3875,6 +4145,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# SQL SECURITY INVOKER ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3892,6 +4164,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3912,6 +4186,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -3938,6 +4215,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4003,6 +4282,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# CONTAINS SQL SQL SECURITY INVOKER ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4020,6 +4301,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4040,6 +4323,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4066,6 +4352,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4131,6 +4419,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# NO SQL SQL SECURITY INVOKER ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4148,6 +4438,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4168,6 +4460,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4194,6 +4489,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4259,6 +4556,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# READS SQL DATA SQL SECURITY INVOKER ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4276,6 +4575,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4296,6 +4597,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4322,6 +4626,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4387,6 +4693,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# MODIFIES SQL DATA SQL SECURITY INVOKER SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4404,6 +4712,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4424,6 +4734,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4450,6 +4763,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4515,6 +4830,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# SQL SECURITY INVOKER COMMENT 'comment' SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4532,6 +4849,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4552,6 +4871,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4578,6 +4900,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4643,6 +4967,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# CONTAINS SQL SQL SECURITY INVOKER COMMENT SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4660,6 +4986,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4680,6 +5008,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4706,6 +5037,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4771,6 +5104,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# NO SQL SQL SECURITY INVOKER COMMENT 'comm SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4788,6 +5123,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4808,6 +5145,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4834,6 +5174,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4899,6 +5241,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# READS SQL DATA SQL SECURITY INVOKER COMME SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4916,6 +5260,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4936,6 +5282,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -4962,6 +5311,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5027,6 +5378,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# MODIFIES SQL DATA SQL SECURITY INVOKER CO SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5044,6 +5397,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5064,6 +5419,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5090,6 +5448,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5155,6 +5515,8 @@ ALTER FUNCTION sf1 #DET# SQL SECURITY DEFINER ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5172,6 +5534,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5192,6 +5556,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5218,6 +5585,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5283,6 +5652,8 @@ ALTER FUNCTION sf1 #DET# CONTAINS SQL SQL SECURITY DEFINER ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5300,6 +5671,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5320,6 +5693,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5346,6 +5722,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5411,6 +5789,8 @@ ALTER FUNCTION sf1 #DET# NO SQL SQL SECURITY DEFINER ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5428,6 +5808,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5448,6 +5830,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5474,6 +5859,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5539,6 +5926,8 @@ ALTER FUNCTION sf1 #DET# READS SQL DATA SQL SECURITY DEFINER ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5556,6 +5945,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5576,6 +5967,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5602,6 +5996,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5667,6 +6063,8 @@ ALTER FUNCTION sf1 #DET# MODIFIES SQL DATA SQL SECURITY DEFINER ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5684,6 +6082,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5704,6 +6104,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5730,6 +6133,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5795,6 +6200,8 @@ ALTER FUNCTION sf1 #DET# SQL SECURITY DEFINER COMMENT 'comment' ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5812,6 +6219,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5832,6 +6241,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5858,6 +6270,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5923,6 +6337,8 @@ ALTER FUNCTION sf1 #DET# CONTAINS SQL SQL SECURITY DEFINER COMMENT 'comment' SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5940,6 +6356,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5960,6 +6378,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -5986,6 +6407,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6051,6 +6474,8 @@ ALTER FUNCTION sf1 #DET# NO SQL SQL SECURITY DEFINER COMMENT 'comment' ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6068,6 +6493,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6088,6 +6515,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6114,6 +6544,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6179,6 +6611,8 @@ ALTER FUNCTION sf1 #DET# READS SQL DATA SQL SECURITY DEFINER COMMENT 'commen SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6196,6 +6630,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6216,6 +6652,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6242,6 +6681,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6307,6 +6748,8 @@ ALTER FUNCTION sf1 #DET# MODIFIES SQL DATA SQL SECURITY DEFINER COMMENT 'com SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6324,6 +6767,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6344,6 +6789,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6370,6 +6818,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6435,6 +6885,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# SQL SECURITY DEFINER ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6452,6 +6904,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6472,6 +6926,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6498,6 +6955,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6563,6 +7022,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# CONTAINS SQL SQL SECURITY DEFINER ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6580,6 +7041,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6600,6 +7063,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6626,6 +7092,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6691,6 +7159,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# NO SQL SQL SECURITY DEFINER ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6708,6 +7178,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6728,6 +7200,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6754,6 +7229,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6819,6 +7296,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# READS SQL DATA SQL SECURITY DEFINER ; SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6836,6 +7315,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6856,6 +7337,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6882,6 +7366,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6947,6 +7433,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# MODIFIES SQL DATA SQL SECURITY DEFINER SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6964,6 +7452,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -6984,6 +7474,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -7010,6 +7503,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -7075,6 +7570,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# SQL SECURITY DEFINER COMMENT 'comment' SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -7092,6 +7589,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -7112,6 +7611,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -7138,6 +7640,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -7203,6 +7707,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# CONTAINS SQL SQL SECURITY DEFINER COMMEN SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -7220,6 +7726,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -7240,6 +7748,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -7266,6 +7777,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -7331,6 +7844,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# NO SQL SQL SECURITY DEFINER COMMENT 'com SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -7348,6 +7863,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -7368,6 +7885,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -7394,6 +7914,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -7459,6 +7981,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# READS SQL DATA SQL SECURITY DEFINER COMM SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -7476,6 +8000,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -7496,6 +8022,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -7522,6 +8051,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -7587,6 +8118,8 @@ ALTER FUNCTION sf1 LANGUAGE SQL #DET# MODIFIES SQL DATA SQL SECURITY DEFINER C SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -7604,6 +8137,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -7624,6 +8159,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -7650,6 +8188,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 diff --git a/mysql-test/suite/engines/funcs/r/sf_cursor.result b/mysql-test/suite/engines/funcs/r/sf_cursor.result index 2fe2171b39d..e43bcaa50a3 100644 --- a/mysql-test/suite/engines/funcs/r/sf_cursor.result +++ b/mysql-test/suite/engines/funcs/r/sf_cursor.result @@ -34,6 +34,8 @@ END// SELECT sf1(); sf1() 0 +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -51,6 +53,8 @@ id data 2 1 3 3 INSERT INTO t4 VALUES(sf1()); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -71,6 +75,9 @@ id data 3 3 3 3 UPDATE t4 SET i = sf1() + 1 WHERE i = sf1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -97,6 +104,8 @@ id data 3 3 3 3 DELETE FROM t4 WHERE i = sf1() + 1; +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 diff --git a/mysql-test/suite/engines/funcs/r/sp_alter.result b/mysql-test/suite/engines/funcs/r/sp_alter.result index 22036fecde7..794a692edc4 100644 --- a/mysql-test/suite/engines/funcs/r/sp_alter.result +++ b/mysql-test/suite/engines/funcs/r/sp_alter.result @@ -31,6 +31,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -80,6 +82,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# CONTAINS SQL ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -129,6 +133,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# NO SQL ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -178,6 +184,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# READS SQL DATA ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -227,6 +235,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# MODIFIES SQL DATA ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -276,6 +286,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -325,6 +337,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# CONTAINS SQL COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -374,6 +388,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# NO SQL COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -423,6 +439,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# READS SQL DATA COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -472,6 +490,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# MODIFIES SQL DATA COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -521,6 +541,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -570,6 +592,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# CONTAINS SQL ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -619,6 +643,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# NO SQL ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -668,6 +694,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# READS SQL DATA ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -717,6 +745,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# MODIFIES SQL DATA ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -766,6 +796,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -815,6 +847,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# CONTAINS SQL COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -864,6 +898,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# NO SQL COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -913,6 +949,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# READS SQL DATA COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -962,6 +1000,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# MODIFIES SQL DATA COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1011,6 +1051,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# SQL SECURITY INVOKER ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1060,6 +1102,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# CONTAINS SQL SQL SECURITY INVOKER ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1109,6 +1153,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# NO SQL SQL SECURITY INVOKER ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1158,6 +1204,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# READS SQL DATA SQL SECURITY INVOKER ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1207,6 +1255,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# MODIFIES SQL DATA SQL SECURITY INVOKER ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1256,6 +1306,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# SQL SECURITY INVOKER COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1305,6 +1357,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# CONTAINS SQL SQL SECURITY INVOKER COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1354,6 +1408,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# NO SQL SQL SECURITY INVOKER COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1403,6 +1459,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# READS SQL DATA SQL SECURITY INVOKER COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1452,6 +1510,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# MODIFIES SQL DATA SQL SECURITY INVOKER COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1501,6 +1561,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# SQL SECURITY INVOKER ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1550,6 +1612,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# CONTAINS SQL SQL SECURITY INVOKER ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1599,6 +1663,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# NO SQL SQL SECURITY INVOKER ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1648,6 +1714,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# READS SQL DATA SQL SECURITY INVOKER ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1697,6 +1765,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# MODIFIES SQL DATA SQL SECURITY INVOKER ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1746,6 +1816,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# SQL SECURITY INVOKER COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1795,6 +1867,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# CONTAINS SQL SQL SECURITY INVOKER COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1844,6 +1918,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# NO SQL SQL SECURITY INVOKER COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1893,6 +1969,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# READS SQL DATA SQL SECURITY INVOKER COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1942,6 +2020,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# MODIFIES SQL DATA SQL SECURITY INVOKER COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -1991,6 +2071,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# SQL SECURITY DEFINER ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2040,6 +2122,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# CONTAINS SQL SQL SECURITY DEFINER ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2089,6 +2173,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# NO SQL SQL SECURITY DEFINER ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2138,6 +2224,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# READS SQL DATA SQL SECURITY DEFINER ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2187,6 +2275,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# MODIFIES SQL DATA SQL SECURITY DEFINER ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2236,6 +2326,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# SQL SECURITY DEFINER COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2285,6 +2377,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# CONTAINS SQL SQL SECURITY DEFINER COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2334,6 +2428,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# NO SQL SQL SECURITY DEFINER COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2383,6 +2479,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# READS SQL DATA SQL SECURITY DEFINER COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2432,6 +2530,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 #DET# MODIFIES SQL DATA SQL SECURITY DEFINER COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2481,6 +2581,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# SQL SECURITY DEFINER ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2530,6 +2632,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# CONTAINS SQL SQL SECURITY DEFINER ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2579,6 +2683,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# NO SQL SQL SECURITY DEFINER ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2628,6 +2734,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# READS SQL DATA SQL SECURITY DEFINER ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2677,6 +2785,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# MODIFIES SQL DATA SQL SECURITY DEFINER ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2726,6 +2836,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# SQL SECURITY DEFINER COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2775,6 +2887,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# CONTAINS SQL SQL SECURITY DEFINER COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2824,6 +2938,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# NO SQL SQL SECURITY DEFINER COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2873,6 +2989,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# READS SQL DATA SQL SECURITY DEFINER COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 @@ -2922,6 +3040,8 @@ CLOSE cur2; END// ALTER PROCEDURE sp1 LANGUAGE SQL #DET# MODIFIES SQL DATA SQL SECURITY DEFINER COMMENT 'comment' ; CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 diff --git a/mysql-test/suite/engines/funcs/r/sp_cursor.result b/mysql-test/suite/engines/funcs/r/sp_cursor.result index 6ce2aae030c..58383f8a9cb 100644 --- a/mysql-test/suite/engines/funcs/r/sp_cursor.result +++ b/mysql-test/suite/engines/funcs/r/sp_cursor.result @@ -30,6 +30,8 @@ CLOSE cur1; CLOSE cur2; END// CALL sp1(); +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM t1 ORDER BY id; id data 1 1 diff --git a/mysql-test/suite/engines/funcs/t/disabled.def b/mysql-test/suite/engines/funcs/t/disabled.def index 19de28441f0..2d8ea2d4ff8 100644 --- a/mysql-test/suite/engines/funcs/t/disabled.def +++ b/mysql-test/suite/engines/funcs/t/disabled.def @@ -1,8 +1,99 @@ # List of disabled tests # test name : comment -rpl_redirect : Fails due to bug#49978 -crash_manycolumns_string : Bug#50495 'Row size too large' for plugin, but works for built-in innodb -ix_unique_lob : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value -ix_unique_string_length : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value -rpl_empty_master_crash : Test not applicable in 5.5+ -rpl_REDIRECT : Test not applicable in 5.5+ +rpl_redirect : Fails due to bug#49978 +crash_manycolumns_string : Bug#50495 'Row size too large' for plugin, but works for built-in innodb +ix_unique_lob : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value +ix_unique_string_length : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value +rpl_empty_master_crash : Test not applicable in 5.5+ +rpl_REDIRECT : Test not applicable in 5.5+ + +rpl_create_database : Result Difference Due To Change In .inc file +rpl_loaddata_m : Result Difference Due To Change In .inc file +rpl_sp_effects : Result Difference Due To Change In .inc file +rpl_variables : Result Difference Due To Change In .inc file +rpl_loaddata_s : Result Difference Due To Change In .inc file +rpl_dual_pos_advance : Result Difference Due To Change In .inc file +rpl000011 : Result Difference Due To Change In .inc file +rpl000013 : Result Difference Due To Change In .inc file +rpl_000015 : Result Difference Due To Change In .inc file +rpl_LD_INFILE : Result Difference Due To Change In .inc file +rpl_alter : Result Difference Due To Change In .inc file +rpl_alter_db : Result Difference Due To Change In .inc file +rpl_alter_db : Result Difference Due To Change In .inc file +rpl_bit : Result Difference Due To Change In .inc file +rpl_bit_npk : Result Difference Due To Change In .inc file +rpl_change_master : Result Difference Due To Change In .inc file +rpl_do_grant : Result Difference Due To Change In .inc file +rpl_drop : Result Difference Due To Change In .inc file +rpl_drop_db : Result Difference Due To Change In .inc file +rpl_flushlog_loop : Result Difference Due To Change In .inc file +rpl_get_lock : Result Difference Due To Change In .inc file +rpl_get_lock : Result Difference Due To Change In .inc file +rpl_insert : Result Difference Due To Change In .inc file +rpl_insert_select : Result Difference Due To Change In .inc file +rpl_loaddata2 : Result Difference Due To Change In .inc file +rpl_loaddatalocal : Result Difference Due To Change In .inc file +rpl_loadfile : Result Difference Due To Change In .inc file +rpl_log_pos : Result Difference Due To Change In .inc file +rpl_many_optimize : Result Difference Due To Change In .inc file +rpl_master_pos_wait : Result Difference Due To Change In .inc file +rpl_misc_functions : Result Difference Due To Change In .inc file +rpl_ps : Result Difference Due To Change In .inc file +rpl_server_id1 : Result Difference Due To Change In .inc file +rpl_session_var : Result Difference Due To Change In .inc file +rpl_sf : Result Difference Due To Change In .inc file +rpl_slave_status : Result Difference Due To Change In .inc file +rpl_sp004 : Result Difference Due To Change In .inc file +rpl_start_stop_slave : Result Difference Due To Change In .inc file +rpl_stm_max_relay_size : Result Difference Due To Change In .inc file +rpl_stm_mystery22 : Result Difference Due To Change In .inc file +rpl_stm_no_op : Result Difference Due To Change In .inc file +rpl_stm_reset_slave : Result Difference Due To Change In .inc file +rpl_temp_table : Result Difference Due To Change In .inc file +rpl_temporary : Result Difference Due To Change In .inc file +rpl_trigger : Result Difference Due To Change In .inc file +rpl_trunc_temp : Result Difference Due To Change In .inc file +rpl_user_variables : Result Difference Due To Change In .inc file +rpl_server_id2 : Result Difference Due To Change In .inc file +rpl000010 : Result Difference Due To Change In .inc file +rpl_init_slave : Result Difference Due To Change In .inc file +rpl_multi_delete2 : Result Difference Due To Change In .inc file +rpl_view : Result Difference Due To Change In .inc file +rpl_ignore_table_update : Result Difference Due To Change In .inc file +rpl_err_ignoredtable : Result Difference Due To Change In .inc file +rpl_multi_update4 : Result Difference Due To Change In .inc file +rpl_multi_delete : Result Difference Due To Change In .inc file +rpl_ignore_grant : Result Difference Due To Change In .inc file +rpl_ignore_revoke : Result Difference Due To Change In .inc file +rpl_free_items : Result Difference Due To Change In .inc file +rpl_replicate_ignore_db : Result Difference Due To Change In .inc file +rpl000017 : Result Difference Due To Change In .inc file +rpl_skip_error : Result Difference Due To Change In .inc file + +rpl_row_until : Test Present in rpl suite as well . Test Fails table with t2 table not found. +rpl_loaddata_s : Test Present in rpl suite as well . Test Fails due to bin log truncation. +rpl_log_pos : Test Present in rpl suite as well . Test Fails due to bin log truncation. +rpl_row_NOW : Result Difference Due To Change In .inc file +rpl_row_USER : Result Difference Due To Change In .inc file +rpl_row_drop : Result Difference Due To Change In .inc file +rpl_row_func001 : Result Difference Due To Change In .inc file +rpl_row_max_relay_size : Result Difference Due To Change In .inc file +rpl_row_reset_slave : Result Difference Due To Change In .inc file +rpl_row_sp001 : Result Difference Due To Change In .inc file +rpl_row_sp005 : Result Difference Due To Change In .inc file +rpl_row_sp008 : Result Difference Due To Change In .inc file +rpl_row_sp009 : Result Difference Due To Change In .inc file +rpl_row_sp010 : Result Difference Due To Change In .inc file +rpl_row_sp011 : Result Difference Due To Change In .inc file +rpl_row_sp012 : Result Difference Due To Change In .inc file +rpl_row_stop_middle : Result Difference Due To Change In .inc file +rpl_row_trig001 : Result Difference Due To Change In .inc file +rpl_row_trig002 : Result Difference Due To Change In .inc file +rpl_row_trig003 : Result Difference Due To Change In .inc file +rpl_row_view01 : Result Difference Due To Change In .inc file +rpl_switch_stm_row_mixed : Result Difference Due To Change In .inc file +rpl_relayspace : Result Difference Due To Change In .inc file +rpl_row_inexist_tbl : Result Difference Due To Change In .inc file +rpl_sp : Result Difference Due To Change In .inc file +rpl_rbr_to_sbr : Result Difference Due To Change In .inc file +rpl_row_until : Test Timesout diff --git a/mysql-test/suite/engines/funcs/t/in_multicolumn_string_pk_constraint_error.test b/mysql-test/suite/engines/funcs/t/in_multicolumn_string_pk_constraint_error.test index 1b07a750b7e..f2b8a0afcdd 100644 --- a/mysql-test/suite/engines/funcs/t/in_multicolumn_string_pk_constraint_error.test +++ b/mysql-test/suite/engines/funcs/t/in_multicolumn_string_pk_constraint_error.test @@ -43,14 +43,13 @@ INSERT INTO t1 (c1,c2,c3) VALUES('def','abc','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('def','def','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('def','abc','def'); INSERT INTO t1 (c1,c2,c3) VALUES('abc','def','def'); -# Bug#52430 : Uncomment the following lines -# when the bug is fixed -#--error ER_DUP_ENTRY -#INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','abc'); -#--error ER_DUP_ENTRY -#INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','def'); -#--error ER_DUP_ENTRY -#INSERT INTO t1 (c1,c2,c3) VALUES('abc','def','def'); +# Bug#52430 +--error ER_DUP_ENTRY +INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','abc'); +--error ER_DUP_ENTRY +INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','def'); +--error ER_DUP_ENTRY +INSERT INTO t1 (c1,c2,c3) VALUES('abc','def','def'); --sorted_result SELECT hex(c1),hex(c2),hex(c3) FROM t1; DROP TABLE t1; diff --git a/mysql-test/suite/engines/funcs/t/in_multicolumn_string_pk_constraint_ignore.test b/mysql-test/suite/engines/funcs/t/in_multicolumn_string_pk_constraint_ignore.test index 58d97d9793f..98d34144b14 100644 --- a/mysql-test/suite/engines/funcs/t/in_multicolumn_string_pk_constraint_ignore.test +++ b/mysql-test/suite/engines/funcs/t/in_multicolumn_string_pk_constraint_ignore.test @@ -43,14 +43,13 @@ INSERT INTO t1 (c1,c2,c3) VALUES('def','abc','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('def','def','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('def','abc','def'); INSERT INTO t1 (c1,c2,c3) VALUES('abc','def','def'); -# Bug#52430 : Uncomment the following lines -# when the bug is fixed -#--error ER_DUP_ENTRY -#INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','abc'); -#--error ER_DUP_ENTRY -#INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','def'); -#--error ER_DUP_ENTRY -#INSERT INTO t1 (c1,c2,c3) VALUES('abc','def','def'); +# Bug#52430 +--error ER_DUP_ENTRY +INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','abc'); +--error ER_DUP_ENTRY +INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','def'); +--error ER_DUP_ENTRY +INSERT INTO t1 (c1,c2,c3) VALUES('abc','def','def'); --sorted_result SELECT * FROM t1; DROP TABLE t1; diff --git a/mysql-test/suite/engines/funcs/t/in_multicolumn_string_unique_constraint_error.test b/mysql-test/suite/engines/funcs/t/in_multicolumn_string_unique_constraint_error.test index d5e58f1bb1d..07529317f88 100644 --- a/mysql-test/suite/engines/funcs/t/in_multicolumn_string_unique_constraint_error.test +++ b/mysql-test/suite/engines/funcs/t/in_multicolumn_string_unique_constraint_error.test @@ -43,14 +43,13 @@ INSERT INTO t1 (c1,c2,c3) VALUES('def','abc','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('def','def','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('def','abc','def'); INSERT INTO t1 (c1,c2,c3) VALUES('abc','def','def'); -# Bug#52430 : Uncomment the following lines -# when the bug is fixed -#--error ER_DUP_ENTRY -#INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','abc'); -#--error ER_DUP_ENTRY -#INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','def'); -#--error ER_DUP_ENTRY -#INSERT INTO t1 (c1,c2,c3) VALUES('abc','def','def'); +# Bug#52430 +--error ER_DUP_ENTRY +INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','abc'); +--error ER_DUP_ENTRY +INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','def'); +--error ER_DUP_ENTRY +INSERT INTO t1 (c1,c2,c3) VALUES('abc','def','def'); --sorted_result SELECT * FROM t1; DROP TABLE t1; diff --git a/mysql-test/suite/engines/funcs/t/in_string_pk_constraint_error.test b/mysql-test/suite/engines/funcs/t/in_string_pk_constraint_error.test index 9a47ad296b2..5202992947c 100644 --- a/mysql-test/suite/engines/funcs/t/in_string_pk_constraint_error.test +++ b/mysql-test/suite/engines/funcs/t/in_string_pk_constraint_error.test @@ -18,10 +18,9 @@ DROP TABLE t1; CREATE TABLE t1(c1 BINARY(10) NOT NULL PRIMARY KEY); INSERT INTO t1 (c1) VALUES('abc'); INSERT INTO t1 (c1) VALUES('def'); -# Bug#52430 : Uncomment the following lines -# when the bug is fixed -#--error ER_DUP_ENTRY -#INSERT INTO t1 (c1) VALUES('abc'); +# Bug#52430 +--error ER_DUP_ENTRY +INSERT INTO t1 (c1) VALUES('abc'); SELECT * FROM t1; DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(10) NOT NULL PRIMARY KEY); diff --git a/mysql-test/suite/engines/funcs/t/in_string_unique_constraint_error.test b/mysql-test/suite/engines/funcs/t/in_string_unique_constraint_error.test index 27d60c9caad..bc29aa57ec9 100644 --- a/mysql-test/suite/engines/funcs/t/in_string_unique_constraint_error.test +++ b/mysql-test/suite/engines/funcs/t/in_string_unique_constraint_error.test @@ -18,10 +18,9 @@ DROP TABLE t1; CREATE TABLE t1(c1 BINARY(10) NULL UNIQUE); INSERT INTO t1 (c1) VALUES('abc'); INSERT INTO t1 (c1) VALUES('def'); -# Bug#52430 : Uncomment the following lines -# when the bug is fixed -#--error ER_DUP_ENTRY -#INSERT INTO t1 (c1) VALUES('abc'); +# Bug#52430 +--error ER_DUP_ENTRY +INSERT INTO t1 (c1) VALUES('abc'); SELECT * FROM t1; DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(10) NULL UNIQUE); diff --git a/mysql-test/suite/engines/funcs/t/rpl000013.test b/mysql-test/suite/engines/funcs/t/rpl000013.test index 69a102e84ce..2c727107563 100644 --- a/mysql-test/suite/engines/funcs/t/rpl000013.test +++ b/mysql-test/suite/engines/funcs/t/rpl000013.test @@ -14,14 +14,22 @@ connection slave; sync_with_master; connection master; +--disable_query_log +CALL mtr.add_suppression(" Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +--enable_query_log + create table t2(n int); create temporary table t1 (n int); insert into t1 values(1),(2),(3); +--disable_warnings insert into t2 select * from t1; +--enable_warnings connection master1; create temporary table t1 (n int); insert into t1 values (4),(5); +--disable_warnings insert into t2 select * from t1 as t10; +--enable_warnings save_master_pos; disconnect master; connection slave; diff --git a/mysql-test/suite/engines/funcs/t/rpl_000015.test b/mysql-test/suite/engines/funcs/t/rpl_000015.test index 6c18e66a3a6..817ed6f407c 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_000015.test +++ b/mysql-test/suite/engines/funcs/t/rpl_000015.test @@ -11,25 +11,31 @@ save_master_pos; connection slave; stop slave; reset slave; -let $status_items= Master_Log_File, Read_Master_Log_Pos, Relay_Master_Log_File, Exec_Master_Log_Pos; -source include/show_slave_status.inc; +--vertical_results +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 5 # 8 # 9 # 23 # 33 # +show slave status; change master to master_host='127.0.0.1'; # The following needs to be cleaned up when change master is fixed -source include/show_slave_status.inc; - +--vertical_results +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 5 # 8 # 9 # 23 # 33 # +show slave status; --replace_result $MASTER_MYPORT MASTER_PORT eval change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=$MASTER_MYPORT; -source include/show_slave_status.inc; - +--vertical_results +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 5 # 8 # 9 # 23 # 33 # +show slave status; start slave; sync_with_master; -let $status_items= Master_Log_File, Relay_Master_Log_File; -source include/show_slave_status.inc; -source include/check_slave_is_running.inc; - --vertical_results +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 5 # 8 # 9 # 23 # 33 # +--replace_column 33 # +show slave status; connection master; --disable_warnings drop table if exists t1; diff --git a/mysql-test/suite/engines/funcs/t/rpl_change_master.test b/mysql-test/suite/engines/funcs/t/rpl_change_master.test index ce8c921c2ad..c031464c95e 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_change_master.test +++ b/mysql-test/suite/engines/funcs/t/rpl_change_master.test @@ -18,26 +18,13 @@ save_master_pos; connection slave; --real_sleep 3 # wait for I/O thread to have read updates stop slave; -source include/wait_for_slave_to_stop.inc; - -let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); -let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); -if (`SELECT $read_pos = $exec_pos`) -{ - source include/show_rpl_debug_info.inc; - echo 'Read_Master_Log_Pos: $read_pos' == 'Exec_Master_Log_Pos: $exec_pos'; - die Failed because Read_Master_Log_Pos is equal to Exec_Master_Log_Pos; -} +--replace_result $MASTER_MYPORT MASTER_MYPORT +--replace_column 1 # 7 # 8 # 9 # 23 # 33 # +show slave status; change master to master_user='root'; -let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); -let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); -if (`SELECT $read_pos <> $exec_pos`) -{ - source include/show_rpl_debug_info.inc; - echo 'Read_Master_Log_Pos: $read_pos' <> 'Exec_Master_Log_Pos: $exec_pos'; - die Failed because Read_Master_Log_Pos is not equal to Exec_Master_Log_Pos; -} - +--replace_result $MASTER_MYPORT MASTER_MYPORT +--replace_column 1 # 7 # 8 # 9 # 23 # 33 # +show slave status; start slave; sync_with_master; select * from t1; diff --git a/mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test b/mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test index 5f7af126940..6b23f1a0d03 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test +++ b/mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test @@ -8,7 +8,7 @@ -- source include/master-slave.inc --disable_query_log -call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT"); +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); --enable_query_log connection master; diff --git a/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test b/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test index 0b71817226a..2e481f5e5e7 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test +++ b/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test @@ -41,7 +41,8 @@ sleep 5; # # Show status of slave # ---let status_items= Relay_Log_File ---source include/show_slave_status.inc ---source include/check_slave_is_running.inc +--replace_result $SLAVE_MYPORT SLAVE_PORT +--replace_column 1 # 8 # 9 # 16 # 23 # 33 # +--vertical_results +SHOW SLAVE STATUS; STOP SLAVE; diff --git a/mysql-test/suite/engines/funcs/t/rpl_get_lock.test b/mysql-test/suite/engines/funcs/t/rpl_get_lock.test index 6a6489954c9..c57e9313899 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_get_lock.test +++ b/mysql-test/suite/engines/funcs/t/rpl_get_lock.test @@ -1,7 +1,7 @@ source include/master-slave.inc; --disable_query_log -call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT"); +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); --enable_query_log create table t1(n int); diff --git a/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test b/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test index 2dd2218eb5c..a06df3bbfc9 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test +++ b/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test @@ -20,7 +20,9 @@ save_master_pos; connection slave; sync_with_master; select count(*) from test.t1; # check that LOAD was replicated -source include/show_binlog_events.inc; +--replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ +show binlog events from 107; # should be nothing # Cleanup connection master; diff --git a/mysql-test/suite/engines/funcs/t/rpl_loadfile.test b/mysql-test/suite/engines/funcs/t/rpl_loadfile.test index 8216af76341..97ee89a6d95 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_loadfile.test +++ b/mysql-test/suite/engines/funcs/t/rpl_loadfile.test @@ -13,7 +13,7 @@ -- source include/master-slave.inc --disable_query_log -call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT"); +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); --enable_query_log # Begin clean up test section diff --git a/mysql-test/suite/engines/funcs/t/rpl_log_pos.test b/mysql-test/suite/engines/funcs/t/rpl_log_pos.test index e07f0d5f2a7..3a762b19756 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_log_pos.test +++ b/mysql-test/suite/engines/funcs/t/rpl_log_pos.test @@ -11,41 +11,36 @@ # Passes with rbr no problem, removed statement include [jbm] source include/master-slave.inc; -let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1); +--replace_column 3 <Binlog_Ignore_DB> +show master status; sync_slave_with_master; +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 8 # 9 # 23 # 33 # +show slave status; stop slave; - ---replace_result $master_log_pos MASTER_LOG_POS -eval change master to master_log_pos=$master_log_pos; +change master to master_log_pos=107; start slave; sleep 5; stop slave; - ---replace_result $master_log_pos MASTER_LOG_POS -eval change master to master_log_pos=$master_log_pos; ---let $slave_param= Read_Master_Log_Pos ---let $slave_param_value= $master_log_pos ---source include/wait_for_slave_param.inc - +change master to master_log_pos=107; +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 8 # 9 # 23 # 33 # +show slave status; start slave; sleep 5; ---let $slave_param= Read_Master_Log_Pos ---let $slave_param_value= $master_log_pos ---source include/wait_for_slave_param.inc ---source include/check_slave_no_error.inc - +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 8 # 9 # 23 # 33 # +show slave status; stop slave; ---echo # impossible position leads to an error ---replace_result 177 MASTER_LOG_POS -change master to master_log_pos=177; +change master to master_log_pos=178; start slave; sleep 2; -let $slave_io_errno= 1236; -let $show_slave_io_error= 1; -source include/wait_for_slave_io_error.inc; +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 8 # 9 # 23 # 33 # +show slave status; connection master; - -let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1); +--replace_column 3 <Binlog_Ignore_DB> +show master status; create table if not exists t1 (n int); drop table if exists t1; create table t1 (n int); @@ -53,9 +48,7 @@ insert into t1 values (1),(2),(3); save_master_pos; connection slave; stop slave; - ---replace_result $master_log_pos MASTER_LOG_POS -eval change master to master_log_pos=$master_log_pos; +change master to master_log_pos=207; start slave; sync_with_master; select * from t1 ORDER BY n; diff --git a/mysql-test/suite/engines/funcs/t/rpl_misc_functions.test b/mysql-test/suite/engines/funcs/t/rpl_misc_functions.test index 205155a9a0e..6e4bedf7371 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_misc_functions.test +++ b/mysql-test/suite/engines/funcs/t/rpl_misc_functions.test @@ -4,7 +4,7 @@ source include/master-slave.inc; --disable_query_log -call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT"); +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); --enable_query_log create table t1(id int, i int, r1 int, r2 int, p varchar(100)); diff --git a/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test b/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test index e78c74ab423..30d2688c3fb 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test +++ b/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test @@ -9,17 +9,25 @@ CREATE TABLE t1 (a INT, b LONG); INSERT INTO t1 VALUES (1,1), (2,2); INSERT INTO t1 VALUES (3,UUID()), (4,UUID()); +let $VERSION=`select version()`; +--replace_result $VERSION VERSION +--replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ # Different number of binlog events are generated by different engines --disable_result_log -source include/show_binlog_events.inc; +SHOW BINLOG EVENTS; --enable_result_log sync_slave_with_master; --echo **** On Slave **** -source include/show_binlog_events.inc; - +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # +--query_vertical SHOW SLAVE STATUS +--replace_result $VERSION VERSION +--replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ # Different number of binlog events are generated by different engines --disable_result_log -source include/show_binlog_events.inc; +SHOW BINLOG EVENTS; --enable_result_log --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql --exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_drop.test b/mysql-test/suite/engines/funcs/t/rpl_row_drop.test index d18ebc2846b..20c217a7c3a 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_drop.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_drop.test @@ -30,7 +30,10 @@ connection master; --echo **** On Master **** # Should drop the non-temporary table t1 and the temporary table t2 DROP TABLE t1,t2; -source include/show_binlog_events.inc; +let $VERSION=`select version()`; +--replace_result $VERSION VERSION +--replace_regex /table_id: [0-9]+/table_id: #/ +SHOW BINLOG EVENTS; SHOW TABLES; sync_slave_with_master; --echo **** On Slave **** diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test b/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test index dca2894c9da..736071a8ece 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test @@ -22,11 +22,13 @@ connection master; insert into t1 values (1); connection slave; -# slave should have stopped because can't find table t1 +# slave should have stopped because can't find table t1 +wait_for_slave_to_stop; # see if we have a good error message: ---let $slave_sql_errno= 1146 ---let $show_slave_sql_error= 1 ---source include/wait_for_slave_sql_error.inc +--replace_result $MASTER_MYPORT MASTER_MYPORT +--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # +--vertical_results +show slave status; # cleanup connection master; diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_until.test b/mysql-test/suite/engines/funcs/t/rpl_row_until.test index b60734317c6..ccd9ce11637 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_until.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_until.test @@ -18,50 +18,44 @@ 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); -let $master_log_pos_1= query_get_value(SHOW MASTER STATUS, Position, 1); drop table t1; - create table t2(n int not null auto_increment primary key); insert into t2 values (1),(2); -let $master_log_pos_2= query_get_value(SHOW MASTER STATUS, Position, 1); insert into t2 values (3),(4); drop table t2; # try to replicate all queries until drop of t1 connection slave; ---replace_result $master_log_pos_1 MASTER_LOG_POS -eval start slave until master_log_file='master-bin.000001', master_log_pos=$master_log_pos_1; +start slave until master_log_file='master-bin.000001', master_log_pos=311; sleep 2; wait_for_slave_to_stop; # here table should be still not deleted select * from t1; ---let $slave_param= Exec_Master_Log_Pos ---let $slave_param_value= $master_log_pos_1 ---source include/check_slave_param.inc +--vertical_results +--replace_result $MASTER_MYPORT MASTER_MYPORT +--replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 # +show slave status; # this should fail right after start ---replace_result 291 MASTER_LOG_POS start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291; # again this table should be still not deleted select * from t1; sleep 2; wait_for_slave_to_stop; ---let $slave_param= Exec_Master_Log_Pos ---let $slave_param_value= $master_log_pos_1 ---source include/check_slave_param.inc +--vertical_results +--replace_result $MASTER_MYPORT MASTER_MYPORT +--replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 # +show slave status; # try replicate all up to and not including the second insert to t2; -let $master_log_pos= $master_log_pos_2; -let $relay_log_file= slave-relay-bin.000004; ---source include/get_relay_log_pos.inc ---replace_result $relay_log_pos RELAY_LOG_POS -eval start slave until relay_log_file='$relay_log_file', relay_log_pos=$relay_log_pos; +start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728; sleep 2; wait_for_slave_to_stop; select * from t2; ---let $slave_param= Exec_Master_Log_Pos ---let $slave_param_value= $master_log_pos ---source include/check_slave_param.inc +--vertical_results +--replace_result $MASTER_MYPORT MASTER_MYPORT +--replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 # +show slave status; # clean up start slave; @@ -71,32 +65,27 @@ connection slave; sync_with_master; stop slave; ---let $exec_log_pos_1= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1) # this should stop immediately as we are already there ---replace_result $master_log_pos_2 MASTER_LOG_POS -eval start slave until master_log_file='master-bin.000001', master_log_pos=$master_log_pos_2; +start slave until master_log_file='master-bin.000001', master_log_pos=740; sleep 2; wait_for_slave_to_stop; # here the sql slave thread should be stopped ---let $slave_param= Exec_Master_Log_Pos ---let $slave_param_value= $exec_log_pos_1 ---source include/check_slave_param.inc +--vertical_results +--replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004 +--replace_column 1 # 7 # 9 # 22 # 23 # 33 # +show slave status; #testing various error conditions ---replace_result 561 MASTER_LOG_POS --error 1277 start slave until master_log_file='master-bin', master_log_pos=561; ---replace_result 561 MASTER_LOG_POS 12 RELAY_LOG_POS --error 1277 start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12; --error 1277 start slave until master_log_file='master-bin.000001'; --error 1277 start slave until relay_log_file='slave-relay-bin.000002'; ---replace_result 561 MASTER_LOG_POS --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; ---replace_result 740 MASTER_LOG_POS start slave until master_log_file='master-bin.000001', master_log_pos=740; diff --git a/mysql-test/suite/engines/funcs/t/rpl_server_id1.test b/mysql-test/suite/engines/funcs/t/rpl_server_id1.test index 014f38d3544..71310750b60 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_server_id1.test +++ b/mysql-test/suite/engines/funcs/t/rpl_server_id1.test @@ -12,13 +12,10 @@ reset master; stop slave; --replace_result $SLAVE_MYPORT SLAVE_PORT eval change master to master_port=$SLAVE_MYPORT; -source include/check_slave_no_error.inc; - +--replace_result $SLAVE_MYPORT SLAVE_PORT +--replace_column 16 # 18 # +show slave status; start slave; -let $slave_io_errno= 1593; -let $show_slave_io_error= 1; -source include/wait_for_slave_io_error.inc; - insert into t1 values (1); # can't MASTER_POS_WAIT(), it does not work in this weird setup # (when slave is its own master without --replicate-same-server-id) diff --git a/mysql-test/suite/engines/funcs/t/rpl_server_id2.test b/mysql-test/suite/engines/funcs/t/rpl_server_id2.test index 5b8683ecfb1..0f2eb560d18 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_server_id2.test +++ b/mysql-test/suite/engines/funcs/t/rpl_server_id2.test @@ -9,6 +9,9 @@ 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 # +show slave status; start slave; insert into t1 values (1); save_master_pos; diff --git a/mysql-test/suite/engines/funcs/t/rpl_slave_status.test b/mysql-test/suite/engines/funcs/t/rpl_slave_status.test index cc3fbf6abee..b3d6e49e215 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_slave_status.test +++ b/mysql-test/suite/engines/funcs/t/rpl_slave_status.test @@ -22,7 +22,9 @@ drop table if exists t1; --enable_warnings create table t1 (n int); insert into t1 values (1); -sync_slave_with_master; +save_master_pos; +connection slave; +sync_with_master; select * from t1; # 3. Delete new replication user @@ -38,8 +40,12 @@ stop slave; start slave; # 5. Make sure Slave_IO_Running = No -let $slave_io_errno= 1045; -source include/wait_for_slave_io_error.inc; +--replace_result $MASTER_MYPORT MASTER_MYPORT +# Column 1 is replaced, since the output can be either +# "Connecting to master" or "Waiting for master update" +--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 35 # 36 # +--vertical_results +show slave status; # Cleanup (Note that slave IO thread is not running) connection slave; diff --git a/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test b/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test index c9e2ab6b703..b9df07101fb 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test +++ b/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test @@ -510,7 +510,9 @@ INSERT INTO t12 VALUES(UUID()); UNLOCK TABLES; --disable_result_log -source include/show_binlog_events.inc; +--replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ +show binlog events; --enable_result_log sync_slave_with_master; @@ -527,7 +529,9 @@ diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_ connection master; --disable_result_log -source include/show_binlog_events.inc; +--replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ +show binlog events; --enable_result_log # Now test that mysqlbinlog works fine on a binlog generated by the diff --git a/mysql-test/suite/engines/funcs/t/rpl_temp_table.test b/mysql-test/suite/engines/funcs/t/rpl_temp_table.test index 9b73961aeea..c13470f20b6 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_temp_table.test +++ b/mysql-test/suite/engines/funcs/t/rpl_temp_table.test @@ -4,18 +4,26 @@ -- source include/have_binlog_format_mixed_or_statement.inc -- source include/master-slave.inc +--disable_query_log +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +--enable_query_log + create table t2 (n int, PRIMARY KEY(n)); create temporary table t1 (n int); create temporary table t3 (n int not null); insert into t1 values(1),(2),(3),(100),(25),(26),(200),(300); +--disable_warnings insert into t2 select * from t1; +--enable_warnings alter table t3 add primary key(n); flush logs; insert into t3 values (1010); +--disable_warnings insert into t2 select * from t3; +--enable_warnings drop table if exists t3; insert into t2 values (1012); @@ -23,7 +31,9 @@ insert into t2 values (1012); connection master1; create temporary table t1 (n int); insert into t1 values (4),(5); +--disable_warnings insert into t2 select * from t1; +--enable_warnings save_master_pos; disconnect master; diff --git a/mysql-test/suite/engines/funcs/t/rpl_temporary.test b/mysql-test/suite/engines/funcs/t/rpl_temporary.test index 1539abeaceb..aa90a5153bf 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_temporary.test +++ b/mysql-test/suite/engines/funcs/t/rpl_temporary.test @@ -18,6 +18,10 @@ sync_with_master; reset master; connection master; +--disable_query_log +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +--enable_query_log + connect (con1,localhost,root,,); #added on 2007/5/18 @@ -62,7 +66,9 @@ insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); connection con1; create temporary table t3(f int); +--disable_warnings insert into t3 select * from t1 where f<6; +--enable_warnings sleep 1; connection con2; @@ -70,11 +76,15 @@ create temporary table t3(f int); sleep 1; connection con1; +--disable_warnings insert into t2 select count(*) from t3; +--enable_warnings sleep 1; connection con2; +--disable_warnings insert into t3 select * from t1 where f>=4; +--enable_warnings sleep 1; connection con1; @@ -82,7 +92,9 @@ drop temporary table t3; sleep 1; connection con2; +--disable_warnings insert into t2 select count(*) from t3; +--enable_warnings drop temporary table t3; select * from t2 ORDER BY f; @@ -107,22 +119,30 @@ SET @@session.pseudo_thread_id=1; create temporary table t3(f int); SET TIMESTAMP=1040323952; SET @@session.pseudo_thread_id=1; +--disable_warnings insert into t3 select * from t1 where f<6; +--enable_warnings SET TIMESTAMP=1040324145; SET @@session.pseudo_thread_id=2; create temporary table t3(f int); SET TIMESTAMP=1040324186; SET @@session.pseudo_thread_id=1; +--disable_warnings insert into t2 select count(*) from t3; +--enable_warnings SET TIMESTAMP=1040324200; SET @@session.pseudo_thread_id=2; +--disable_warnings insert into t3 select * from t1 where f>=4; +--enable_warnings SET TIMESTAMP=1040324211; SET @@session.pseudo_thread_id=1; drop temporary table t3; SET TIMESTAMP=1040324219; SET @@session.pseudo_thread_id=2; +--disable_warnings insert into t2 select count(*) from t3; +--enable_warnings SET TIMESTAMP=1040324224; SET @@session.pseudo_thread_id=2; drop temporary table t3; @@ -149,7 +169,9 @@ create table t5 (f int); # find dumper's $id select id from information_schema.processlist where command='Binlog Dump' into @id; kill @id; # to stimulate reconnection by slave w/o timeout +--disable_warnings insert into t5 select * from t4; +--enable_warnings save_master_pos; connection slave; diff --git a/mysql-test/suite/engines/funcs/t/rpl_trigger.test b/mysql-test/suite/engines/funcs/t/rpl_trigger.test index 2162c488bfc..77cc7a3b2c0 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_trigger.test +++ b/mysql-test/suite/engines/funcs/t/rpl_trigger.test @@ -6,7 +6,7 @@ --source include/master-slave.inc disable_query_log; -call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT"); +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); enable_query_log; --disable_warnings diff --git a/mysql-test/suite/engines/iuds/r/update_delete_calendar.result b/mysql-test/suite/engines/iuds/r/update_delete_calendar.result index e2dd83e03b4..a04585dfd72 100644 --- a/mysql-test/suite/engines/iuds/r/update_delete_calendar.result +++ b/mysql-test/suite/engines/iuds/r/update_delete_calendar.result @@ -791,6 +791,9 @@ Warning 1292 Truncated incorrect datetime value: '2009-01-10 23:60:59' SELECT count(*) FROM t1 WHERE c2='2001-01-11 23:59:60' /* returns 0 */; count(*) 0 +Warnings: +Warning 1292 Incorrect datetime value: '2001-01-11 23:59:60' for column 'c2' at row 1 +Warning 1292 Incorrect datetime value: '2001-01-11 23:59:60' for column 'c2' at row 1 SELECT * FROM t1 WHERE c1='0000-00-00 00:00:00' OR c2='0000-00-00 00:00:00'; c1 c2 c3 0000-00-00 00:00:00 0000-00-00 00:00:00 6 diff --git a/mysql-test/suite/engines/iuds/r/update_delete_number.result b/mysql-test/suite/engines/iuds/r/update_delete_number.result index 2ff7276f058..8e190870092 100644 --- a/mysql-test/suite/engines/iuds/r/update_delete_number.result +++ b/mysql-test/suite/engines/iuds/r/update_delete_number.result @@ -63,7 +63,7 @@ c1 c2 c3 4294967295 2147483647 9 UPDATE t1 SET c2=-2147483649 WHERE c1=109 ORDER BY c1; Warnings: -Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c2' at row 13 SELECT c1,c2 FROM t1 WHERE c1=109; c1 c2 109 -2147483648 @@ -1158,7 +1158,7 @@ c1 c2 c3 255 127 9 UPDATE t1 SET c2=-129 WHERE c1=109 ORDER BY c1; Warnings: -Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c2' at row 13 SELECT c1,c2 FROM t1 WHERE c1=109; c1 c2 109 -128 @@ -1929,7 +1929,7 @@ c1 c2 c3 65535 32767 9 UPDATE t1 SET c2=-32769 WHERE c1=109 ORDER BY c1; Warnings: -Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c2' at row 13 SELECT c1,c2 FROM t1 WHERE c1=109; c1 c2 109 -32768 @@ -2676,7 +2676,7 @@ c1 c2 c3 16777215 8388607 9 UPDATE t1 SET c2=-8388609 WHERE c1=109 ORDER BY c1; Warnings: -Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c2' at row 13 SELECT c1,c2 FROM t1 WHERE c1=109; c1 c2 109 -8388608 @@ -3423,7 +3423,7 @@ c1 c2 c3 18446744073709551615 9223372036854775807 9 UPDATE t1 SET c2=-9223372036854775809 WHERE c1=109 ORDER BY c1; Warnings: -Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c2' at row 13 SELECT c1,c2 FROM t1 WHERE c1=109; c1 c2 109 -9223372036854775808 diff --git a/mysql-test/suite/engines/iuds/t/disabled.def b/mysql-test/suite/engines/iuds/t/disabled.def index c8fdf80274b..7fd504c0996 100644 --- a/mysql-test/suite/engines/iuds/t/disabled.def +++ b/mysql-test/suite/engines/iuds/t/disabled.def @@ -1,2 +1,3 @@ insert_calendar : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value update_delete_calendar : Bug#52824 + Bug#52283(in case of Innodb) + diff --git a/mysql-test/suite/engines/iuds/t/insert_number.test b/mysql-test/suite/engines/iuds/t/insert_number.test index b55bd8dc98a..e2c809fad85 100644 --- a/mysql-test/suite/engines/iuds/t/insert_number.test +++ b/mysql-test/suite/engines/iuds/t/insert_number.test @@ -7812,9 +7812,6 @@ SELECT * FROM t2 ORDER BY c1,c6 LIMIT 2; SELECT * FROM t2 ORDER BY c1,c6 DESC LIMIT 2; ## ref type access - -# Bug#52283 : Remove the following --disable_warnings -# command when the bug is fixed --disable_warnings SELECT * FROM t2 WHERE c1 = 18446744073709551616 ORDER BY c1,c6; SELECT * FROM t2 WHERE c1 = 18446744073709551616 ORDER BY c1,c6 LIMIT 2; diff --git a/mysql-test/suite/engines/iuds/t/update_delete_calendar.test b/mysql-test/suite/engines/iuds/t/update_delete_calendar.test index c6a22511766..aa695953ce1 100644 --- a/mysql-test/suite/engines/iuds/t/update_delete_calendar.test +++ b/mysql-test/suite/engines/iuds/t/update_delete_calendar.test @@ -300,12 +300,7 @@ INSERT INTO t1 VALUES('2001-01-09','2001-01-10',6),('2001-01-11','2001-01-12',7) UPDATE t1 SET c1='2001-01-09 24:59:59',c2='2009-01-10 23:60:59' WHERE c1='2001-01-09'; UPDATE t1 SET c2='2001-01-11 23:59:60' WHERE c1='2001-01-11'; SELECT count(*) FROM t1 WHERE c1='2001-01-09 24:59:59' AND c2='2009-01-10 23:60:59'; - -# Bug#52283 : Remove the following --disable_warnings -# command when the bug is fixed ---disable_warnings SELECT count(*) FROM t1 WHERE c2='2001-01-11 23:59:60' /* returns 0 */; ---enable_warnings --sorted_result SELECT * FROM t1 WHERE c1='0000-00-00 00:00:00' OR c2='0000-00-00 00:00:00'; diff --git a/mysql-test/suite/innodb/r/innodb-autoinc-18274.result b/mysql-test/suite/innodb/r/innodb-autoinc-18274.result new file mode 100644 index 00000000000..22afc65a649 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-autoinc-18274.result @@ -0,0 +1,26 @@ +drop table if exists t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (null); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +DELETE FROM t1; +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 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES(null); +SELECT * FROM t1; +c1 +2 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-timeout.result b/mysql-test/suite/innodb/r/innodb-timeout.result index be9a688cd72..bb71ba5cb3d 100644 --- a/mysql-test/suite/innodb/r/innodb-timeout.result +++ b/mysql-test/suite/innodb/r/innodb-timeout.result @@ -13,13 +13,14 @@ set global innodb_lock_wait_timeout=347; select @@innodb_lock_wait_timeout; @@innodb_lock_wait_timeout 42 -set innodb_lock_wait_timeout=1; +set innodb_lock_wait_timeout=10; select @@innodb_lock_wait_timeout; @@innodb_lock_wait_timeout -1 +10 select @@innodb_lock_wait_timeout; @@innodb_lock_wait_timeout 347 +SET @connection_b_id = <connection_b_id>; create table t1(a int primary key)engine=innodb; begin; insert into t1 values(1),(2),(3); @@ -31,8 +32,9 @@ a 3 begin; insert into t1 values(4); +set innodb_lock_wait_timeout=3; select * from t1 for update; commit; ERROR HY000: Lock wait timeout exceeded; try restarting transaction drop table t1; -set global innodb_lock_wait_timeout=50; +set global innodb_lock_wait_timeout=<initial_timeout>; diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result index 09a2c5b9ef4..3aafd81084e 100644 --- a/mysql-test/suite/innodb/r/innodb.result +++ b/mysql-test/suite/innodb/r/innodb.result @@ -1,5 +1,8 @@ drop table if exists t1,t2,t3,t4; drop database if exists mysqltest; +CREATE TABLE bug58912 (a BLOB, b TEXT, PRIMARY KEY(a(1))) ENGINE=InnoDB; +INSERT INTO bug58912 VALUES(REPEAT('a',8000),REPEAT('b',8000)); +UPDATE bug58912 SET a=REPEAT('a',7999); create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb; insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); select id, code, name from t1 order by id; @@ -1670,10 +1673,10 @@ variable_value - @innodb_rows_deleted_orig 71 SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted'; variable_value - @innodb_rows_inserted_orig -1065 +1066 SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated'; variable_value - @innodb_rows_updated_orig -865 +866 SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits'; variable_value - @innodb_row_lock_waits_orig 0 @@ -3173,3 +3176,4 @@ Variable_name Value Handler_update 1 Variable_name Value Handler_delete 1 +DROP TABLE bug58912; diff --git a/mysql-test/suite/innodb/r/innodb_bug57904.result b/mysql-test/suite/innodb/r/innodb_bug57904.result index 84868dcf46b..d265adc385f 100755 --- a/mysql-test/suite/innodb/r/innodb_bug57904.result +++ b/mysql-test/suite/innodb/r/innodb_bug57904.result @@ -1,16 +1,16 @@ -CREATE TABLE product (category INT NOT NULL, id INT NOT NULL, +CREATE TABLE product (category INT NOT NULL, id INT NOT NULL, price DECIMAL, PRIMARY KEY(category, id)) ENGINE=INNODB; CREATE TABLE customer (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; -CREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT, -product_category INT NOT NULL, -product_id INT NOT NULL, -customer_id INT NOT NULL, -PRIMARY KEY(no), -INDEX (product_category, product_id), -FOREIGN KEY (product_category, product_id) -REFERENCES product(category, id) ON UPDATE CASCADE ON DELETE RESTRICT, -INDEX (customer_id), -FOREIGN KEY (customer_id) +CREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT, +product_category INT NOT NULL, +product_id INT NOT NULL, +customer_id INT NOT NULL, +PRIMARY KEY(no), +INDEX (product_category, product_id), +FOREIGN KEY (product_category, product_id) +REFERENCES product(category, id) ON UPDATE CASCADE ON DELETE RESTRICT, +INDEX (customer_id), +FOREIGN KEY (customer_id) REFERENCES customer(id) ) ENGINE=INNODB; SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS; diff --git a/mysql-test/suite/innodb/t/innodb-autoinc-18274.test b/mysql-test/suite/innodb/t/innodb-autoinc-18274.test new file mode 100644 index 00000000000..de9f3e3d18b --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-autoinc-18274.test @@ -0,0 +1,26 @@ +-- source include/have_innodb.inc +# embedded server ignores 'delayed', so skip this +-- source include/not_embedded.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +# +# Bug #18274 InnoDB auto_increment field reset on OPTIMIZE TABLE +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (null); +SHOW CREATE TABLE t1; +DELETE FROM t1; +OPTIMIZE TABLE t1; +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES(null); +SELECT * FROM t1; +DROP TABLE t1; + +# +# restore environment to the state it was before this test execution +# + +-- disable_query_log diff --git a/mysql-test/suite/innodb/t/innodb-timeout.test b/mysql-test/suite/innodb/t/innodb-timeout.test index f23fe3cff2d..b29aec8e83d 100644 --- a/mysql-test/suite/innodb/t/innodb-timeout.test +++ b/mysql-test/suite/innodb/t/innodb-timeout.test @@ -1,6 +1,6 @@ -- source include/have_innodb.inc -let $timeout=`select @@innodb_lock_wait_timeout`; +let $initial_timeout=`select @@innodb_lock_wait_timeout`; set global innodb_lock_wait_timeout=42; connect (a,localhost,root,,); @@ -12,19 +12,24 @@ set innodb_lock_wait_timeout=1; select @@innodb_lock_wait_timeout; connection b; +let $connection_b_id=`SELECT CONNECTION_ID()`; select @@innodb_lock_wait_timeout; set global innodb_lock_wait_timeout=347; select @@innodb_lock_wait_timeout; -set innodb_lock_wait_timeout=1; +set innodb_lock_wait_timeout=10; select @@innodb_lock_wait_timeout; connect (c,localhost,root,,); connection c; + select @@innodb_lock_wait_timeout; -connection default; + disconnect c; +--source include/wait_until_disconnected.inc connection a; +--replace_result $connection_b_id <connection_b_id> +eval SET @connection_b_id = $connection_b_id; create table t1(a int primary key)engine=innodb; begin; insert into t1 values(1),(2),(3); @@ -33,7 +38,37 @@ connection b; --send select * from t1 for update; +# Observation on information_schema.processlist (2010-12 mysql-5.5) +# ----------------------------------------------------------------- +# As soon as the server started the execution of the +# connection a: --send select ... for update +# High parallel load could delay this up to two seconds. +# and before either +# - the innodb_lock_wait_timeout was exceeded +# -> connection b reap gets ER_LOCK_WAIT_TIMEOUT +# or +# - connection a commits, the lock disappears and the statement +# of connection b finishes +# -> connection b reap gets success + result set +# we see within information_schema.processlist for connection b a row +# command state info +# Query Sending data select * from t1 for update +# The highest time value seen was @@innodb_lock_wait_timeout + 1. +# Please note that there is unfortunately nothing which says +# that we are just waiting for a lock. + connection a; +# In order to ensure that the execution of +# connection b: select * from t1 for update +# has really started and is most probably waiting for the lock now we poll on +# information_schema.processlist. +# Also our current session innodb_lock_wait_timeout of 10 seconds should big +# enough to prevent that connection b ends up with getting ER_LOCK_WAIT_TIMEOUT. +# +let $wait_timeout= 10; +let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist +WHERE id = @connection_b_id AND INFO = 'select * from t1 for update'; +--source include/wait_condition.inc commit; connection b; @@ -44,21 +79,39 @@ begin; insert into t1 values(4); connection b; +set innodb_lock_wait_timeout=3; +# 3 seconds should be big enough that the wait routine of connection a will +# hit the time span where our next statement is visible within the +# information_schema.processlist. --send select * from t1 for update; connection a; -sleep 2; +# Wait till the execution of the connection b statement was started. +let $wait_timeout= 10; +let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist +WHERE id = @connection_b_id AND INFO = 'select * from t1 for update'; +--source include/wait_condition.inc +# Wait till the execution of the connection b statement has ended. +let $wait_timeout= 10; +let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist +WHERE id = @connection_b_id AND INFO IS NULL; +--source include/wait_condition.inc +# Give "commit" though this must be too late for the statement of connection b. commit; connection b; --error ER_LOCK_WAIT_TIMEOUT reap; -drop table t1; -connection default; +disconnect b; +--source include/wait_until_disconnected.inc +connection a; disconnect a; -disconnect b; +--source include/wait_until_disconnected.inc -eval set global innodb_lock_wait_timeout=$timeout; +connection default; +drop table t1; +--replace_result $initial_timeout <initial_timeout> +eval set global innodb_lock_wait_timeout=$initial_timeout; diff --git a/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test index 8c24457e07c..69876297797 100644 --- a/mysql-test/suite/innodb/t/innodb.test +++ b/mysql-test/suite/innodb/t/innodb.test @@ -49,6 +49,15 @@ drop table if exists t1,t2,t3,t4; drop database if exists mysqltest; --enable_warnings +# Bug#58912 InnoDB unnecessarily avoids update-in-place on column prefixes +CREATE TABLE bug58912 (a BLOB, b TEXT, PRIMARY KEY(a(1))) ENGINE=InnoDB; +INSERT INTO bug58912 VALUES(REPEAT('a',8000),REPEAT('b',8000)); +UPDATE bug58912 SET a=REPEAT('a',7999); +# The above statements used to trigger a failure during purge when +# Bug#55284 was fixed while Bug#58912 was not. Defer the DROP TABLE, +# so that purge gets a chance to run (and a double free of the +# off-page column can be detected, if one is to occur.) + # # Small basic test with ignore # @@ -2548,6 +2557,9 @@ SET GLOBAL innodb_thread_concurrency = @innodb_thread_concurrency_orig; -- enable_query_log +# Clean up after the Bug#55284/Bug#58912 test case. +DROP TABLE bug58912; + ####################################################################### # # # Please, DO NOT TOUCH this file as well as the innodb.result file. # diff --git a/mysql-test/suite/innodb/t/innodb_bug57255.test b/mysql-test/suite/innodb/t/innodb_bug57255.test index 2b37a0a6092..0bf686578b2 100644 --- a/mysql-test/suite/innodb/t/innodb_bug57255.test +++ b/mysql-test/suite/innodb/t/innodb_bug57255.test @@ -12,6 +12,7 @@ create table C(id int not null auto_increment primary key, f1 int not null, fore insert into A values(1), (2); --disable_query_log +begin; let $i=257; while ($i) { @@ -24,6 +25,7 @@ while ($i) insert into C(f1) values(2); dec $i; } +commit; --enable_query_log # Following Deletes should not report error diff --git a/mysql-test/suite/innodb/t/innodb_bug57904.test b/mysql-test/suite/innodb/t/innodb_bug57904.test index d283ad11c3a..1131e24844d 100755 --- a/mysql-test/suite/innodb/t/innodb_bug57904.test +++ b/mysql-test/suite/innodb/t/innodb_bug57904.test @@ -3,19 +3,19 @@ # -- source include/have_innodb.inc -CREATE TABLE product (category INT NOT NULL, id INT NOT NULL, +CREATE TABLE product (category INT NOT NULL, id INT NOT NULL, price DECIMAL, PRIMARY KEY(category, id)) ENGINE=INNODB; CREATE TABLE customer (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; -CREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT, - product_category INT NOT NULL, - product_id INT NOT NULL, - customer_id INT NOT NULL, - PRIMARY KEY(no), - INDEX (product_category, product_id), - FOREIGN KEY (product_category, product_id) - REFERENCES product(category, id) ON UPDATE CASCADE ON DELETE RESTRICT, - INDEX (customer_id), - FOREIGN KEY (customer_id) +CREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT, + product_category INT NOT NULL, + product_id INT NOT NULL, + customer_id INT NOT NULL, + PRIMARY KEY(no), + INDEX (product_category, product_id), + FOREIGN KEY (product_category, product_id) + REFERENCES product(category, id) ON UPDATE CASCADE ON DELETE RESTRICT, + INDEX (customer_id), + FOREIGN KEY (customer_id) REFERENCES customer(id) ) ENGINE=INNODB; diff --git a/mysql-test/suite/parts/inc/part_supported_sql_funcs_main.inc b/mysql-test/suite/parts/inc/part_supported_sql_funcs_main.inc index 45d77225a23..b7a170dd9d8 100644 --- a/mysql-test/suite/parts/inc/part_supported_sql_funcs_main.inc +++ b/mysql-test/suite/parts/inc/part_supported_sql_funcs_main.inc @@ -88,8 +88,9 @@ let $val2 = '2006-01-17'; let $val3 = '2006-02-25'; let $val4 = '2006-02-05'; --source suite/parts/inc/partition_supported_sql_funcs.inc -let $coltype = char(30); ---source suite/parts/inc/partition_supported_sql_funcs.inc +# Disabled after fixing bug#54483. +#let $coltype = char(30); +#--source suite/parts/inc/partition_supported_sql_funcs.inc let $sqlfunc = extract(month from col1); let $valsqlfunc = extract(year from '1998-11-23'); @@ -139,8 +140,9 @@ let $val2 = '14:30:20'; let $val3 = '21:59:22'; let $val4 = '10:22:33'; --source suite/parts/inc/partition_supported_sql_funcs.inc -let $coltype = char(30); ---source suite/parts/inc/partition_supported_sql_funcs.inc +# second(non_time_col) is disabled after bug#54483. +#let $coltype = char(30); +#--source suite/parts/inc/partition_supported_sql_funcs.inc let $sqlfunc = month(col1); let $valsqlfunc = month('2006-10-14'); @@ -172,26 +174,28 @@ let $val3 = '21:59:22'; let $val4 = '10:33:11'; --source suite/parts/inc/partition_supported_sql_funcs.inc -let $sqlfunc = to_days(col1)-to_days('2006-01-01'); -let $valsqlfunc = to_days('2006-02-02')-to_days('2006-01-01'); -let $coltype = date; -let $infile = part_supported_sql_funcs_int_date.inc; -let $val1 = '2006-02-03'; -let $val2 = '2006-01-17'; -let $val3 = '2006-01-25'; -let $val4 = '2006-02-06'; ---source suite/parts/inc/partition_supported_sql_funcs.inc +# to_days(non_date_col) is disabled after bug#54483. +#let $sqlfunc = to_days(col1)-to_days('2006-01-01'); +#let $valsqlfunc = to_days('2006-02-02')-to_days('2006-01-01'); +#let $coltype = date; +#let $infile = part_supported_sql_funcs_int_date.inc; +#let $val1 = '2006-02-03'; +#let $val2 = '2006-01-17'; +#let $val3 = '2006-01-25'; +#let $val4 = '2006-02-06'; +#--source suite/parts/inc/partition_supported_sql_funcs.inc +# to_days(non_date_col) is disabled after bug#54483. # DATEDIFF() is implemented as (TO_DAYS(d1) - TO_DAYS(d2)) -let $sqlfunc = datediff(col1, '2006-01-01'); -let $valsqlfunc = datediff('2006-02-02', '2006-01-01'); -let $coltype = date; -let $infile = part_supported_sql_funcs_int_date.inc; -let $val1 = '2006-02-03'; -let $val2 = '2006-01-17'; -let $val3 = '2006-01-25'; -let $val4 = '2006-02-06'; ---source suite/parts/inc/partition_supported_sql_funcs.inc +#let $sqlfunc = datediff(col1, '2006-01-01'); +#let $valsqlfunc = datediff('2006-02-02', '2006-01-01'); +#let $coltype = date; +#let $infile = part_supported_sql_funcs_int_date.inc; +#let $val1 = '2006-02-03'; +#let $val2 = '2006-01-17'; +#let $val3 = '2006-01-25'; +#let $val4 = '2006-02-06'; +#--source suite/parts/inc/partition_supported_sql_funcs.inc let $sqlfunc = weekday(col1); let $valsqlfunc = weekday('2006-10-14'); 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 79462c25050..c5b4e0a8665 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 @@ -5425,513 +5425,6 @@ drop table if exists t44 ; drop table if exists t55 ; drop table if exists t66 ; ------------------------------------------------------------------------- ---- dayofyear(col1) in partition with coltype char(30) -------------------------------------------------------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -------------------------------------------------------------------------- ---- Create tables with dayofyear(col1) -------------------------------------------------------------------------- -create table t1 (col1 char(30)) engine='INNODB' -partition by range(dayofyear(col1)) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t2 (col1 char(30)) engine='INNODB' -partition by list(dayofyear(col1)) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t3 (col1 char(30)) engine='INNODB' -partition by hash(dayofyear(col1)); -create table t4 (colint int, col1 char(30)) engine='INNODB' -partition by range(colint) -subpartition by hash(dayofyear(col1)) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t5 (colint int, col1 char(30)) engine='INNODB' -partition by list(colint) -subpartition by hash(dayofyear(col1)) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t6 (colint int, col1 char(30)) engine='INNODB' -partition by range(colint) -(partition p0 values less than (dayofyear('2006-12-25')), -partition p1 values less than maxvalue); -------------------------------------------------------------------------- ---- Access tables with dayofyear(col1) -------------------------------------------------------------------------- -insert into t1 values ('2006-01-03'); -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-01-03'); -insert into t2 values ('2006-01-17'); -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 '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 -17 -select * from t1 order by col1; -col1 -2006-01-03 -2006-01-17 -select * from t2 order by col1; -col1 -2006-01-03 -2006-01-17 -2006-02-25 -select * from t3 order by col1; -col1 -2006-01-03 -2006-01-17 -2006-02-25 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -update t1 set col1='2006-02-05' where col1='2006-01-03'; -update t2 set col1='2006-02-05' where col1='2006-01-03'; -update t3 set col1='2006-02-05' where col1='2006-01-03'; -update t4 set col1='2006-02-05' where col1='2006-01-03'; -update t5 set col1='2006-02-05' where col1='2006-01-03'; -update t6 set col1='2006-02-05' where col1='2006-01-03'; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t2 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t3 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Alter tables with dayofyear(col1) -------------------------------------------------------------------------- -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -create table t11 engine='INNODB' as select * from t1; -create table t22 engine='INNODB' as select * from t2; -create table t33 engine='INNODB' as select * from t3; -create table t44 engine='INNODB' as select * from t4; -create table t55 engine='INNODB' as select * from t5; -create table t66 engine='INNODB' as select * from t6; -alter table t11 -partition by range(dayofyear(col1)) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t22 -partition by list(dayofyear(col1)) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t33 -partition by hash(dayofyear(col1)); -alter table t44 -partition by range(colint) -subpartition by hash(dayofyear(col1)) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t55 -partition by list(colint) -subpartition by hash(dayofyear(col1)) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t66 -partition by range(colint) -(partition p0 values less than (dayofyear('2006-12-25')), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t22 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t33 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t44 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t66 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 ---------------------------- ----- some alter table begin ---------------------------- -alter table t11 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-05 -alter table t11 -reorganize partition s1 into -(partition p0 values less than (15), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-05 -alter table t55 -partition by list(colint) -subpartition by hash(dayofyear(col1)) subpartitions 5 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -show create table t55; -Table Create Table -t55 CREATE TABLE `t55` ( - `colint` int(11) DEFAULT NULL, - `col1` char(30) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) -SUBPARTITION BY HASH (dayofyear(col1)) -SUBPARTITIONS 5 -(PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, - PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, - PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, - PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, - PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ -select * from t55 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (dayofyear('2006-12-25')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (dayofyear('2006-12-25')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with dayofyear(col1) -------------------------------------------------------------------------- -delete from t1 where col1='2006-01-17'; -delete from t2 where col1='2006-01-17'; -delete from t3 where col1='2006-01-17'; -delete from t4 where col1='2006-01-17'; -delete from t5 where col1='2006-01-17'; -delete from t6 where col1='2006-01-17'; -select * from t1 order by col1; -col1 -2006-02-05 -select * from t2 order by col1; -col1 -2006-02-05 -2006-02-25 -select * from t3 order by col1; -col1 -2006-02-05 -2006-02-25 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-01-17'); -insert into t3 values ('2006-01-17'); -insert into t4 values (60,'2006-01-17'); -insert into t5 values (60,'2006-01-17'); -insert into t6 values (60,'2006-01-17'); -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t2 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t3 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t1 drop partition p0; -alter table t2 drop partition p0; -alter table t4 drop partition p0; -alter table t5 drop partition p0; -alter table t6 drop partition p0; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t2 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t3 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t4 order by colint; -colint col1 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with dayofyear(col1) -------------------------------------------------------------------------- -delete from t11 where col1='2006-01-17'; -delete from t22 where col1='2006-01-17'; -delete from t33 where col1='2006-01-17'; -delete from t44 where col1='2006-01-17'; -delete from t55 where col1='2006-01-17'; -delete from t66 where col1='2006-01-17'; -select * from t11 order by col1; -col1 -2006-02-05 -select * from t22 order by col1; -col1 -2006-02-05 -2006-02-25 -select * from t33 order by col1; -col1 -2006-02-05 -2006-02-25 -select * from t44 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -insert into t11 values ('2006-01-17'); -insert into t22 values ('2006-01-17'); -insert into t33 values ('2006-01-17'); -insert into t44 values (60,'2006-01-17'); -insert into t55 values (60,'2006-01-17'); -insert into t66 values (60,'2006-01-17'); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t22 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t33 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t44 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t11 drop partition p0; -alter table t22 drop partition p0; -alter table t44 drop partition p0; -alter table t55 drop partition p0; -alter table t66 drop partition p0; -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t22 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t33 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t44 order by colint; -colint col1 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -------------------------- ----- some alter table end -------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -------------------------------------------------------------------------- --- extract(month from col1) in partition with coltype date ------------------------------------------------------------------------- drop table if exists t1 ; @@ -8489,525 +7982,6 @@ drop table if exists t44 ; drop table if exists t55 ; drop table if exists t66 ; ------------------------------------------------------------------------- ---- second(col1) in partition with coltype char(30) -------------------------------------------------------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -------------------------------------------------------------------------- ---- Create tables with second(col1) -------------------------------------------------------------------------- -create table t1 (col1 char(30)) engine='INNODB' -partition by range(second(col1)) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t2 (col1 char(30)) engine='INNODB' -partition by list(second(col1)) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t3 (col1 char(30)) engine='INNODB' -partition by hash(second(col1)); -create table t4 (colint int, col1 char(30)) engine='INNODB' -partition by range(colint) -subpartition by hash(second(col1)) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t5 (colint int, col1 char(30)) engine='INNODB' -partition by list(colint) -subpartition by hash(second(col1)) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t6 (colint int, col1 char(30)) engine='INNODB' -partition by range(colint) -(partition p0 values less than (second('18:30:14')), -partition p1 values less than maxvalue); -------------------------------------------------------------------------- ---- Access tables with second(col1) -------------------------------------------------------------------------- -insert into t1 values ('09:09:09'); -insert into t1 values ('14:30:20'); -insert into t2 values ('09:09:09'); -insert into t2 values ('14:30:20'); -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 '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 -20 -select * from t1 order by col1; -col1 -09:09:09 -14:30:20 -select * from t2 order by col1; -col1 -09:09:09 -14:30:20 -21:59:22 -select * from t3 order by col1; -col1 -09:09:09 -14:30:20 -21:59:22 -select * from t4 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t5 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t6 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -update t1 set col1='10:22:33' where col1='09:09:09'; -update t2 set col1='10:22:33' where col1='09:09:09'; -update t3 set col1='10:22:33' where col1='09:09:09'; -update t4 set col1='10:22:33' where col1='09:09:09'; -update t5 set col1='10:22:33' where col1='09:09:09'; -update t6 set col1='10:22:33' where col1='09:09:09'; -select * from t1 order by col1; -col1 -10:22:33 -14:30:20 -select * from t2 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t3 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t4 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t5 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t6 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -------------------------------------------------------------------------- ---- Alter tables with second(col1) -------------------------------------------------------------------------- -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -create table t11 engine='INNODB' as select * from t1; -create table t22 engine='INNODB' as select * from t2; -create table t33 engine='INNODB' as select * from t3; -create table t44 engine='INNODB' as select * from t4; -create table t55 engine='INNODB' as select * from t5; -create table t66 engine='INNODB' as select * from t6; -alter table t11 -partition by range(second(col1)) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t22 -partition by list(second(col1)) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t33 -partition by hash(second(col1)); -alter table t44 -partition by range(colint) -subpartition by hash(second(col1)) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t55 -partition by list(colint) -subpartition by hash(second(col1)) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t66 -partition by range(colint) -(partition p0 values less than (second('18:30:14')), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -10:22:33 -14:30:20 -select * from t22 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t33 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t44 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t55 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 ---------------------------- ----- some alter table begin ---------------------------- -alter table t11 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t11 order by col1; -col1 -10:22:33 -14:30:20 -alter table t11 -reorganize partition s1 into -(partition p0 values less than (15), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -10:22:33 -14:30:20 -alter table t55 -partition by list(colint) -subpartition by hash(second(col1)) subpartitions 5 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -show create table t55; -Table Create Table -t55 CREATE TABLE `t55` ( - `colint` int(11) DEFAULT NULL, - `col1` char(30) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) -SUBPARTITION BY HASH (second(col1)) -SUBPARTITIONS 5 -(PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, - PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, - PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, - PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, - PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ -select * from t55 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (second('18:30:14')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (second('18:30:14')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with second(col1) -------------------------------------------------------------------------- -delete from t1 where col1='14:30:20'; -delete from t2 where col1='14:30:20'; -delete from t3 where col1='14:30:20'; -delete from t4 where col1='14:30:20'; -delete from t5 where col1='14:30:20'; -delete from t6 where col1='14:30:20'; -select * from t1 order by col1; -col1 -10:22:33 -select * from t2 order by col1; -col1 -10:22:33 -21:59:22 -select * from t3 order by col1; -col1 -10:22:33 -21:59:22 -select * from t4 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t5 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -insert into t1 values ('14:30:20'); -insert into t2 values ('14:30:20'); -insert into t3 values ('14:30:20'); -insert into t4 values (60,'14:30:20'); -insert into t5 values (60,'14:30:20'); -insert into t6 values (60,'14:30:20'); -select * from t1 order by col1; -col1 -10:22:33 -14:30:20 -select * from t2 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t3 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t4 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -select * from t5 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -select * from t6 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -alter table t1 drop partition p0; -alter table t2 drop partition p0; -alter table t4 drop partition p0; -alter table t5 drop partition p0; -alter table t6 drop partition p0; -select * from t1 order by col1; -col1 -10:22:33 -14:30:20 -select * from t2 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t3 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t4 order by colint; -colint col1 -60 14:30:20 -select * from t5 order by colint; -colint col1 -60 14:30:20 -select * from t6 order by colint; -colint col1 -60 14:30:20 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with second(col1) -------------------------------------------------------------------------- -delete from t11 where col1='14:30:20'; -delete from t22 where col1='14:30:20'; -delete from t33 where col1='14:30:20'; -delete from t44 where col1='14:30:20'; -delete from t55 where col1='14:30:20'; -delete from t66 where col1='14:30:20'; -select * from t11 order by col1; -col1 -10:22:33 -select * from t22 order by col1; -col1 -10:22:33 -21:59:22 -select * from t33 order by col1; -col1 -10:22:33 -21:59:22 -select * from t44 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t55 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -insert into t11 values ('14:30:20'); -insert into t22 values ('14:30:20'); -insert into t33 values ('14:30:20'); -insert into t44 values (60,'14:30:20'); -insert into t55 values (60,'14:30:20'); -insert into t66 values (60,'14:30:20'); -select * from t11 order by col1; -col1 -10:22:33 -14:30:20 -select * from t22 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t33 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t44 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -select * from t55 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -alter table t11 drop partition p0; -alter table t22 drop partition p0; -alter table t44 drop partition p0; -alter table t55 drop partition p0; -alter table t66 drop partition p0; -select * from t11 order by col1; -col1 -10:22:33 -14:30:20 -select * from t22 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t33 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t44 order by colint; -colint col1 -60 14:30:20 -select * from t55 order by colint; -colint col1 -60 14:30:20 -select * from t66 order by colint; -colint col1 -60 14:30:20 -------------------------- ----- some alter table end -------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -------------------------------------------------------------------------- --- month(col1) in partition with coltype date ------------------------------------------------------------------------- drop table if exists t1 ; @@ -10549,1024 +9523,6 @@ drop table if exists t44 ; drop table if exists t55 ; drop table if exists t66 ; ------------------------------------------------------------------------- ---- to_days(col1)-to_days('2006-01-01') in partition with coltype date -------------------------------------------------------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -------------------------------------------------------------------------- ---- Create tables with to_days(col1)-to_days('2006-01-01') -------------------------------------------------------------------------- -create table t1 (col1 date) engine='INNODB' -partition by range(to_days(col1)-to_days('2006-01-01')) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t2 (col1 date) engine='INNODB' -partition by list(to_days(col1)-to_days('2006-01-01')) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t3 (col1 date) engine='INNODB' -partition by hash(to_days(col1)-to_days('2006-01-01')); -create table t4 (colint int, col1 date) engine='INNODB' -partition by range(colint) -subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t5 (colint int, col1 date) engine='INNODB' -partition by list(colint) -subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t6 (colint int, col1 date) engine='INNODB' -partition by range(colint) -(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), -partition p1 values less than maxvalue); -------------------------------------------------------------------------- ---- Access tables with to_days(col1)-to_days('2006-01-01') -------------------------------------------------------------------------- -insert into t1 values ('2006-02-03'); -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-02-03'); -insert into t2 values ('2006-01-17'); -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 '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 -33 -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-03 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-03 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-03 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -update t1 set col1='2006-02-06' where col1='2006-02-03'; -update t2 set col1='2006-02-06' where col1='2006-02-03'; -update t3 set col1='2006-02-06' where col1='2006-02-03'; -update t4 set col1='2006-02-06' where col1='2006-02-03'; -update t5 set col1='2006-02-06' where col1='2006-02-03'; -update t6 set col1='2006-02-06' where col1='2006-02-03'; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Alter tables with to_days(col1)-to_days('2006-01-01') -------------------------------------------------------------------------- -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -create table t11 engine='INNODB' as select * from t1; -create table t22 engine='INNODB' as select * from t2; -create table t33 engine='INNODB' as select * from t3; -create table t44 engine='INNODB' as select * from t4; -create table t55 engine='INNODB' as select * from t5; -create table t66 engine='INNODB' as select * from t6; -alter table t11 -partition by range(to_days(col1)-to_days('2006-01-01')) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t22 -partition by list(to_days(col1)-to_days('2006-01-01')) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t33 -partition by hash(to_days(col1)-to_days('2006-01-01')); -alter table t44 -partition by range(colint) -subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t55 -partition by list(colint) -subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t66 -partition by range(colint) -(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 ---------------------------- ----- some alter table begin ---------------------------- -alter table t11 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -alter table t11 -reorganize partition s1 into -(partition p0 values less than (15), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -alter table t55 -partition by list(colint) -subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 5 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -show create table t55; -Table Create Table -t55 CREATE TABLE `t55` ( - `colint` int(11) DEFAULT NULL, - `col1` date DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) -SUBPARTITION BY HASH (to_days(col1)-to_days('2006-01-01')) -SUBPARTITIONS 5 -(PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, - PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, - PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, - PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, - PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ -select * from t55 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01') -------------------------------------------------------------------------- -delete from t1 where col1='2006-01-17'; -delete from t2 where col1='2006-01-17'; -delete from t3 where col1='2006-01-17'; -delete from t4 where col1='2006-01-17'; -delete from t5 where col1='2006-01-17'; -delete from t6 where col1='2006-01-17'; -select * from t1 order by col1; -col1 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-01-17'); -insert into t3 values ('2006-01-17'); -insert into t4 values (60,'2006-01-17'); -insert into t5 values (60,'2006-01-17'); -insert into t6 values (60,'2006-01-17'); -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t1 drop partition p0; -alter table t2 drop partition p0; -alter table t4 drop partition p0; -alter table t5 drop partition p0; -alter table t6 drop partition p0; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -60 2006-01-17 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01') -------------------------------------------------------------------------- -delete from t11 where col1='2006-01-17'; -delete from t22 where col1='2006-01-17'; -delete from t33 where col1='2006-01-17'; -delete from t44 where col1='2006-01-17'; -delete from t55 where col1='2006-01-17'; -delete from t66 where col1='2006-01-17'; -select * from t11 order by col1; -col1 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -insert into t11 values ('2006-01-17'); -insert into t22 values ('2006-01-17'); -insert into t33 values ('2006-01-17'); -insert into t44 values (60,'2006-01-17'); -insert into t55 values (60,'2006-01-17'); -insert into t66 values (60,'2006-01-17'); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t11 drop partition p0; -alter table t22 drop partition p0; -alter table t44 drop partition p0; -alter table t55 drop partition p0; -alter table t66 drop partition p0; -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -60 2006-01-17 -------------------------- ----- some alter table end -------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -------------------------------------------------------------------------- ---- datediff(col1, '2006-01-01') in partition with coltype date -------------------------------------------------------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -------------------------------------------------------------------------- ---- Create tables with datediff(col1, '2006-01-01') -------------------------------------------------------------------------- -create table t1 (col1 date) engine='INNODB' -partition by range(datediff(col1, '2006-01-01')) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t2 (col1 date) engine='INNODB' -partition by list(datediff(col1, '2006-01-01')) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t3 (col1 date) engine='INNODB' -partition by hash(datediff(col1, '2006-01-01')); -create table t4 (colint int, col1 date) engine='INNODB' -partition by range(colint) -subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t5 (colint int, col1 date) engine='INNODB' -partition by list(colint) -subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t6 (colint int, col1 date) engine='INNODB' -partition by range(colint) -(partition p0 values less than (datediff('2006-02-02', '2006-01-01')), -partition p1 values less than maxvalue); -------------------------------------------------------------------------- ---- Access tables with datediff(col1, '2006-01-01') -------------------------------------------------------------------------- -insert into t1 values ('2006-02-03'); -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-02-03'); -insert into t2 values ('2006-01-17'); -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 '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 -33 -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-03 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-03 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-03 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -update t1 set col1='2006-02-06' where col1='2006-02-03'; -update t2 set col1='2006-02-06' where col1='2006-02-03'; -update t3 set col1='2006-02-06' where col1='2006-02-03'; -update t4 set col1='2006-02-06' where col1='2006-02-03'; -update t5 set col1='2006-02-06' where col1='2006-02-03'; -update t6 set col1='2006-02-06' where col1='2006-02-03'; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Alter tables with datediff(col1, '2006-01-01') -------------------------------------------------------------------------- -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -create table t11 engine='INNODB' as select * from t1; -create table t22 engine='INNODB' as select * from t2; -create table t33 engine='INNODB' as select * from t3; -create table t44 engine='INNODB' as select * from t4; -create table t55 engine='INNODB' as select * from t5; -create table t66 engine='INNODB' as select * from t6; -alter table t11 -partition by range(datediff(col1, '2006-01-01')) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t22 -partition by list(datediff(col1, '2006-01-01')) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t33 -partition by hash(datediff(col1, '2006-01-01')); -alter table t44 -partition by range(colint) -subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t55 -partition by list(colint) -subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t66 -partition by range(colint) -(partition p0 values less than (datediff('2006-02-02', '2006-01-01')), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 ---------------------------- ----- some alter table begin ---------------------------- -alter table t11 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -alter table t11 -reorganize partition s1 into -(partition p0 values less than (15), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -alter table t55 -partition by list(colint) -subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 5 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -show create table t55; -Table Create Table -t55 CREATE TABLE `t55` ( - `colint` int(11) DEFAULT NULL, - `col1` date DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) -SUBPARTITION BY HASH (datediff(col1, '2006-01-01')) -SUBPARTITIONS 5 -(PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, - PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, - PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, - PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, - PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, - PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */ -select * from t55 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (datediff('2006-02-02', '2006-01-01')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (datediff('2006-02-02', '2006-01-01')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with datediff(col1, '2006-01-01') -------------------------------------------------------------------------- -delete from t1 where col1='2006-01-17'; -delete from t2 where col1='2006-01-17'; -delete from t3 where col1='2006-01-17'; -delete from t4 where col1='2006-01-17'; -delete from t5 where col1='2006-01-17'; -delete from t6 where col1='2006-01-17'; -select * from t1 order by col1; -col1 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-01-17'); -insert into t3 values ('2006-01-17'); -insert into t4 values (60,'2006-01-17'); -insert into t5 values (60,'2006-01-17'); -insert into t6 values (60,'2006-01-17'); -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t1 drop partition p0; -alter table t2 drop partition p0; -alter table t4 drop partition p0; -alter table t5 drop partition p0; -alter table t6 drop partition p0; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -60 2006-01-17 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with datediff(col1, '2006-01-01') -------------------------------------------------------------------------- -delete from t11 where col1='2006-01-17'; -delete from t22 where col1='2006-01-17'; -delete from t33 where col1='2006-01-17'; -delete from t44 where col1='2006-01-17'; -delete from t55 where col1='2006-01-17'; -delete from t66 where col1='2006-01-17'; -select * from t11 order by col1; -col1 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -insert into t11 values ('2006-01-17'); -insert into t22 values ('2006-01-17'); -insert into t33 values ('2006-01-17'); -insert into t44 values (60,'2006-01-17'); -insert into t55 values (60,'2006-01-17'); -insert into t66 values (60,'2006-01-17'); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t11 drop partition p0; -alter table t22 drop partition p0; -alter table t44 drop partition p0; -alter table t55 drop partition p0; -alter table t66 drop partition p0; -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -60 2006-01-17 -------------------------- ----- some alter table end -------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -------------------------------------------------------------------------- --- weekday(col1) in partition with coltype date ------------------------------------------------------------------------- drop table if exists t1 ; 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 375a6e130be..3cd8e10a4f3 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 @@ -5425,513 +5425,6 @@ drop table if exists t44 ; drop table if exists t55 ; drop table if exists t66 ; ------------------------------------------------------------------------- ---- dayofyear(col1) in partition with coltype char(30) -------------------------------------------------------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -------------------------------------------------------------------------- ---- Create tables with dayofyear(col1) -------------------------------------------------------------------------- -create table t1 (col1 char(30)) engine='MYISAM' -partition by range(dayofyear(col1)) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t2 (col1 char(30)) engine='MYISAM' -partition by list(dayofyear(col1)) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t3 (col1 char(30)) engine='MYISAM' -partition by hash(dayofyear(col1)); -create table t4 (colint int, col1 char(30)) engine='MYISAM' -partition by range(colint) -subpartition by hash(dayofyear(col1)) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t5 (colint int, col1 char(30)) engine='MYISAM' -partition by list(colint) -subpartition by hash(dayofyear(col1)) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t6 (colint int, col1 char(30)) engine='MYISAM' -partition by range(colint) -(partition p0 values less than (dayofyear('2006-12-25')), -partition p1 values less than maxvalue); -------------------------------------------------------------------------- ---- Access tables with dayofyear(col1) -------------------------------------------------------------------------- -insert into t1 values ('2006-01-03'); -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-01-03'); -insert into t2 values ('2006-01-17'); -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 '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 -17 -select * from t1 order by col1; -col1 -2006-01-03 -2006-01-17 -select * from t2 order by col1; -col1 -2006-01-03 -2006-01-17 -2006-02-25 -select * from t3 order by col1; -col1 -2006-01-03 -2006-01-17 -2006-02-25 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -update t1 set col1='2006-02-05' where col1='2006-01-03'; -update t2 set col1='2006-02-05' where col1='2006-01-03'; -update t3 set col1='2006-02-05' where col1='2006-01-03'; -update t4 set col1='2006-02-05' where col1='2006-01-03'; -update t5 set col1='2006-02-05' where col1='2006-01-03'; -update t6 set col1='2006-02-05' where col1='2006-01-03'; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t2 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t3 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Alter tables with dayofyear(col1) -------------------------------------------------------------------------- -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -create table t11 engine='MYISAM' as select * from t1; -create table t22 engine='MYISAM' as select * from t2; -create table t33 engine='MYISAM' as select * from t3; -create table t44 engine='MYISAM' as select * from t4; -create table t55 engine='MYISAM' as select * from t5; -create table t66 engine='MYISAM' as select * from t6; -alter table t11 -partition by range(dayofyear(col1)) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t22 -partition by list(dayofyear(col1)) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t33 -partition by hash(dayofyear(col1)); -alter table t44 -partition by range(colint) -subpartition by hash(dayofyear(col1)) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t55 -partition by list(colint) -subpartition by hash(dayofyear(col1)) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t66 -partition by range(colint) -(partition p0 values less than (dayofyear('2006-12-25')), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t22 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t33 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t44 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t66 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 ---------------------------- ----- some alter table begin ---------------------------- -alter table t11 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-05 -alter table t11 -reorganize partition s1 into -(partition p0 values less than (15), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-05 -alter table t55 -partition by list(colint) -subpartition by hash(dayofyear(col1)) subpartitions 5 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -show create table t55; -Table Create Table -t55 CREATE TABLE `t55` ( - `colint` int(11) DEFAULT NULL, - `col1` char(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) -SUBPARTITION BY HASH (dayofyear(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) */ -select * from t55 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (dayofyear('2006-12-25')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (dayofyear('2006-12-25')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with dayofyear(col1) -------------------------------------------------------------------------- -delete from t1 where col1='2006-01-17'; -delete from t2 where col1='2006-01-17'; -delete from t3 where col1='2006-01-17'; -delete from t4 where col1='2006-01-17'; -delete from t5 where col1='2006-01-17'; -delete from t6 where col1='2006-01-17'; -select * from t1 order by col1; -col1 -2006-02-05 -select * from t2 order by col1; -col1 -2006-02-05 -2006-02-25 -select * from t3 order by col1; -col1 -2006-02-05 -2006-02-25 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-01-17'); -insert into t3 values ('2006-01-17'); -insert into t4 values (60,'2006-01-17'); -insert into t5 values (60,'2006-01-17'); -insert into t6 values (60,'2006-01-17'); -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t2 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t3 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t1 drop partition p0; -alter table t2 drop partition p0; -alter table t4 drop partition p0; -alter table t5 drop partition p0; -alter table t6 drop partition p0; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t2 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t3 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t4 order by colint; -colint col1 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with dayofyear(col1) -------------------------------------------------------------------------- -delete from t11 where col1='2006-01-17'; -delete from t22 where col1='2006-01-17'; -delete from t33 where col1='2006-01-17'; -delete from t44 where col1='2006-01-17'; -delete from t55 where col1='2006-01-17'; -delete from t66 where col1='2006-01-17'; -select * from t11 order by col1; -col1 -2006-02-05 -select * from t22 order by col1; -col1 -2006-02-05 -2006-02-25 -select * from t33 order by col1; -col1 -2006-02-05 -2006-02-25 -select * from t44 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -insert into t11 values ('2006-01-17'); -insert into t22 values ('2006-01-17'); -insert into t33 values ('2006-01-17'); -insert into t44 values (60,'2006-01-17'); -insert into t55 values (60,'2006-01-17'); -insert into t66 values (60,'2006-01-17'); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t22 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t33 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t44 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -1 2006-02-03 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t11 drop partition p0; -alter table t22 drop partition p0; -alter table t44 drop partition p0; -alter table t55 drop partition p0; -alter table t66 drop partition p0; -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-05 -select * from t22 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t33 order by col1; -col1 -2006-01-17 -2006-02-05 -2006-02-25 -select * from t44 order by colint; -colint col1 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -------------------------- ----- some alter table end -------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -------------------------------------------------------------------------- --- extract(month from col1) in partition with coltype date ------------------------------------------------------------------------- drop table if exists t1 ; @@ -8489,525 +7982,6 @@ drop table if exists t44 ; drop table if exists t55 ; drop table if exists t66 ; ------------------------------------------------------------------------- ---- second(col1) in partition with coltype char(30) -------------------------------------------------------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -------------------------------------------------------------------------- ---- Create tables with second(col1) -------------------------------------------------------------------------- -create table t1 (col1 char(30)) engine='MYISAM' -partition by range(second(col1)) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t2 (col1 char(30)) engine='MYISAM' -partition by list(second(col1)) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t3 (col1 char(30)) engine='MYISAM' -partition by hash(second(col1)); -create table t4 (colint int, col1 char(30)) engine='MYISAM' -partition by range(colint) -subpartition by hash(second(col1)) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t5 (colint int, col1 char(30)) engine='MYISAM' -partition by list(colint) -subpartition by hash(second(col1)) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t6 (colint int, col1 char(30)) engine='MYISAM' -partition by range(colint) -(partition p0 values less than (second('18:30:14')), -partition p1 values less than maxvalue); -------------------------------------------------------------------------- ---- Access tables with second(col1) -------------------------------------------------------------------------- -insert into t1 values ('09:09:09'); -insert into t1 values ('14:30:20'); -insert into t2 values ('09:09:09'); -insert into t2 values ('14:30:20'); -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 '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 -20 -select * from t1 order by col1; -col1 -09:09:09 -14:30:20 -select * from t2 order by col1; -col1 -09:09:09 -14:30:20 -21:59:22 -select * from t3 order by col1; -col1 -09:09:09 -14:30:20 -21:59:22 -select * from t4 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t5 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t6 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -update t1 set col1='10:22:33' where col1='09:09:09'; -update t2 set col1='10:22:33' where col1='09:09:09'; -update t3 set col1='10:22:33' where col1='09:09:09'; -update t4 set col1='10:22:33' where col1='09:09:09'; -update t5 set col1='10:22:33' where col1='09:09:09'; -update t6 set col1='10:22:33' where col1='09:09:09'; -select * from t1 order by col1; -col1 -10:22:33 -14:30:20 -select * from t2 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t3 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t4 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t5 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t6 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -------------------------------------------------------------------------- ---- Alter tables with second(col1) -------------------------------------------------------------------------- -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -create table t11 engine='MYISAM' as select * from t1; -create table t22 engine='MYISAM' as select * from t2; -create table t33 engine='MYISAM' as select * from t3; -create table t44 engine='MYISAM' as select * from t4; -create table t55 engine='MYISAM' as select * from t5; -create table t66 engine='MYISAM' as select * from t6; -alter table t11 -partition by range(second(col1)) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t22 -partition by list(second(col1)) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t33 -partition by hash(second(col1)); -alter table t44 -partition by range(colint) -subpartition by hash(second(col1)) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t55 -partition by list(colint) -subpartition by hash(second(col1)) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t66 -partition by range(colint) -(partition p0 values less than (second('18:30:14')), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -10:22:33 -14:30:20 -select * from t22 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t33 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t44 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t55 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 ---------------------------- ----- some alter table begin ---------------------------- -alter table t11 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t11 order by col1; -col1 -10:22:33 -14:30:20 -alter table t11 -reorganize partition s1 into -(partition p0 values less than (15), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -10:22:33 -14:30:20 -alter table t55 -partition by list(colint) -subpartition by hash(second(col1)) subpartitions 5 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -show create table t55; -Table Create Table -t55 CREATE TABLE `t55` ( - `colint` int(11) DEFAULT NULL, - `col1` char(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) -SUBPARTITION BY HASH (second(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) */ -select * from t55 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (second('18:30:14')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (second('18:30:14')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with second(col1) -------------------------------------------------------------------------- -delete from t1 where col1='14:30:20'; -delete from t2 where col1='14:30:20'; -delete from t3 where col1='14:30:20'; -delete from t4 where col1='14:30:20'; -delete from t5 where col1='14:30:20'; -delete from t6 where col1='14:30:20'; -select * from t1 order by col1; -col1 -10:22:33 -select * from t2 order by col1; -col1 -10:22:33 -21:59:22 -select * from t3 order by col1; -col1 -10:22:33 -21:59:22 -select * from t4 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t5 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -insert into t1 values ('14:30:20'); -insert into t2 values ('14:30:20'); -insert into t3 values ('14:30:20'); -insert into t4 values (60,'14:30:20'); -insert into t5 values (60,'14:30:20'); -insert into t6 values (60,'14:30:20'); -select * from t1 order by col1; -col1 -10:22:33 -14:30:20 -select * from t2 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t3 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t4 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -select * from t5 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -select * from t6 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -alter table t1 drop partition p0; -alter table t2 drop partition p0; -alter table t4 drop partition p0; -alter table t5 drop partition p0; -alter table t6 drop partition p0; -select * from t1 order by col1; -col1 -10:22:33 -14:30:20 -select * from t2 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t3 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t4 order by colint; -colint col1 -60 14:30:20 -select * from t5 order by colint; -colint col1 -60 14:30:20 -select * from t6 order by colint; -colint col1 -60 14:30:20 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with second(col1) -------------------------------------------------------------------------- -delete from t11 where col1='14:30:20'; -delete from t22 where col1='14:30:20'; -delete from t33 where col1='14:30:20'; -delete from t44 where col1='14:30:20'; -delete from t55 where col1='14:30:20'; -delete from t66 where col1='14:30:20'; -select * from t11 order by col1; -col1 -10:22:33 -select * from t22 order by col1; -col1 -10:22:33 -21:59:22 -select * from t33 order by col1; -col1 -10:22:33 -21:59:22 -select * from t44 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -select * from t55 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -insert into t11 values ('14:30:20'); -insert into t22 values ('14:30:20'); -insert into t33 values ('14:30:20'); -insert into t44 values (60,'14:30:20'); -insert into t55 values (60,'14:30:20'); -insert into t66 values (60,'14:30:20'); -select * from t11 order by col1; -col1 -10:22:33 -14:30:20 -select * from t22 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t33 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t44 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -select * from t55 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -select * from t66 order by colint; -colint col1 -1 09:09:15.000002 -2 04:30:01.000018 -3 00:59:22.000024 -4 05:30:34.000037 -60 14:30:20 -alter table t11 drop partition p0; -alter table t22 drop partition p0; -alter table t44 drop partition p0; -alter table t55 drop partition p0; -alter table t66 drop partition p0; -select * from t11 order by col1; -col1 -10:22:33 -14:30:20 -select * from t22 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t33 order by col1; -col1 -10:22:33 -14:30:20 -21:59:22 -select * from t44 order by colint; -colint col1 -60 14:30:20 -select * from t55 order by colint; -colint col1 -60 14:30:20 -select * from t66 order by colint; -colint col1 -60 14:30:20 -------------------------- ----- some alter table end -------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -------------------------------------------------------------------------- --- month(col1) in partition with coltype date ------------------------------------------------------------------------- drop table if exists t1 ; @@ -10549,1024 +9523,6 @@ drop table if exists t44 ; drop table if exists t55 ; drop table if exists t66 ; ------------------------------------------------------------------------- ---- to_days(col1)-to_days('2006-01-01') in partition with coltype date -------------------------------------------------------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -------------------------------------------------------------------------- ---- Create tables with to_days(col1)-to_days('2006-01-01') -------------------------------------------------------------------------- -create table t1 (col1 date) engine='MYISAM' -partition by range(to_days(col1)-to_days('2006-01-01')) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t2 (col1 date) engine='MYISAM' -partition by list(to_days(col1)-to_days('2006-01-01')) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t3 (col1 date) engine='MYISAM' -partition by hash(to_days(col1)-to_days('2006-01-01')); -create table t4 (colint int, col1 date) engine='MYISAM' -partition by range(colint) -subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t5 (colint int, col1 date) engine='MYISAM' -partition by list(colint) -subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t6 (colint int, col1 date) engine='MYISAM' -partition by range(colint) -(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), -partition p1 values less than maxvalue); -------------------------------------------------------------------------- ---- Access tables with to_days(col1)-to_days('2006-01-01') -------------------------------------------------------------------------- -insert into t1 values ('2006-02-03'); -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-02-03'); -insert into t2 values ('2006-01-17'); -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 '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 -33 -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-03 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-03 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-03 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -update t1 set col1='2006-02-06' where col1='2006-02-03'; -update t2 set col1='2006-02-06' where col1='2006-02-03'; -update t3 set col1='2006-02-06' where col1='2006-02-03'; -update t4 set col1='2006-02-06' where col1='2006-02-03'; -update t5 set col1='2006-02-06' where col1='2006-02-03'; -update t6 set col1='2006-02-06' where col1='2006-02-03'; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Alter tables with to_days(col1)-to_days('2006-01-01') -------------------------------------------------------------------------- -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -create table t11 engine='MYISAM' as select * from t1; -create table t22 engine='MYISAM' as select * from t2; -create table t33 engine='MYISAM' as select * from t3; -create table t44 engine='MYISAM' as select * from t4; -create table t55 engine='MYISAM' as select * from t5; -create table t66 engine='MYISAM' as select * from t6; -alter table t11 -partition by range(to_days(col1)-to_days('2006-01-01')) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t22 -partition by list(to_days(col1)-to_days('2006-01-01')) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t33 -partition by hash(to_days(col1)-to_days('2006-01-01')); -alter table t44 -partition by range(colint) -subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t55 -partition by list(colint) -subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t66 -partition by range(colint) -(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 ---------------------------- ----- some alter table begin ---------------------------- -alter table t11 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -alter table t11 -reorganize partition s1 into -(partition p0 values less than (15), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -alter table t55 -partition by list(colint) -subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 5 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -show create table t55; -Table Create Table -t55 CREATE TABLE `t55` ( - `colint` int(11) DEFAULT NULL, - `col1` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) -SUBPARTITION BY HASH (to_days(col1)-to_days('2006-01-01')) -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) */ -select * from t55 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01') -------------------------------------------------------------------------- -delete from t1 where col1='2006-01-17'; -delete from t2 where col1='2006-01-17'; -delete from t3 where col1='2006-01-17'; -delete from t4 where col1='2006-01-17'; -delete from t5 where col1='2006-01-17'; -delete from t6 where col1='2006-01-17'; -select * from t1 order by col1; -col1 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-01-17'); -insert into t3 values ('2006-01-17'); -insert into t4 values (60,'2006-01-17'); -insert into t5 values (60,'2006-01-17'); -insert into t6 values (60,'2006-01-17'); -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t1 drop partition p0; -alter table t2 drop partition p0; -alter table t4 drop partition p0; -alter table t5 drop partition p0; -alter table t6 drop partition p0; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -60 2006-01-17 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01') -------------------------------------------------------------------------- -delete from t11 where col1='2006-01-17'; -delete from t22 where col1='2006-01-17'; -delete from t33 where col1='2006-01-17'; -delete from t44 where col1='2006-01-17'; -delete from t55 where col1='2006-01-17'; -delete from t66 where col1='2006-01-17'; -select * from t11 order by col1; -col1 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -insert into t11 values ('2006-01-17'); -insert into t22 values ('2006-01-17'); -insert into t33 values ('2006-01-17'); -insert into t44 values (60,'2006-01-17'); -insert into t55 values (60,'2006-01-17'); -insert into t66 values (60,'2006-01-17'); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t11 drop partition p0; -alter table t22 drop partition p0; -alter table t44 drop partition p0; -alter table t55 drop partition p0; -alter table t66 drop partition p0; -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -60 2006-01-17 -------------------------- ----- some alter table end -------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -------------------------------------------------------------------------- ---- datediff(col1, '2006-01-01') in partition with coltype date -------------------------------------------------------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -------------------------------------------------------------------------- ---- Create tables with datediff(col1, '2006-01-01') -------------------------------------------------------------------------- -create table t1 (col1 date) engine='MYISAM' -partition by range(datediff(col1, '2006-01-01')) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t2 (col1 date) engine='MYISAM' -partition by list(datediff(col1, '2006-01-01')) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t3 (col1 date) engine='MYISAM' -partition by hash(datediff(col1, '2006-01-01')); -create table t4 (colint int, col1 date) engine='MYISAM' -partition by range(colint) -subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -create table t5 (colint int, col1 date) engine='MYISAM' -partition by list(colint) -subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -create table t6 (colint int, col1 date) engine='MYISAM' -partition by range(colint) -(partition p0 values less than (datediff('2006-02-02', '2006-01-01')), -partition p1 values less than maxvalue); -------------------------------------------------------------------------- ---- Access tables with datediff(col1, '2006-01-01') -------------------------------------------------------------------------- -insert into t1 values ('2006-02-03'); -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-02-03'); -insert into t2 values ('2006-01-17'); -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 '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 -33 -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-03 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-03 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-03 -select * from t4 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-03 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -update t1 set col1='2006-02-06' where col1='2006-02-03'; -update t2 set col1='2006-02-06' where col1='2006-02-03'; -update t3 set col1='2006-02-06' where col1='2006-02-03'; -update t4 set col1='2006-02-06' where col1='2006-02-03'; -update t5 set col1='2006-02-06' where col1='2006-02-03'; -update t6 set col1='2006-02-06' where col1='2006-02-03'; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t6 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Alter tables with datediff(col1, '2006-01-01') -------------------------------------------------------------------------- -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -create table t11 engine='MYISAM' as select * from t1; -create table t22 engine='MYISAM' as select * from t2; -create table t33 engine='MYISAM' as select * from t3; -create table t44 engine='MYISAM' as select * from t4; -create table t55 engine='MYISAM' as select * from t5; -create table t66 engine='MYISAM' as select * from t6; -alter table t11 -partition by range(datediff(col1, '2006-01-01')) -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t22 -partition by list(datediff(col1, '2006-01-01')) -(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t33 -partition by hash(datediff(col1, '2006-01-01')); -alter table t44 -partition by range(colint) -subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 -(partition p0 values less than (15), -partition p1 values less than maxvalue); -alter table t55 -partition by list(colint) -subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 2 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -alter table t66 -partition by range(colint) -(partition p0 values less than (datediff('2006-02-02', '2006-01-01')), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 ---------------------------- ----- some alter table begin ---------------------------- -alter table t11 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -alter table t11 -reorganize partition s1 into -(partition p0 values less than (15), -partition p1 values less than maxvalue); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -alter table t55 -partition by list(colint) -subpartition by hash(datediff(col1, '2006-01-01')) subpartitions 5 -(partition p0 values in (1,2,3,4,5,6,7,8,9,10), -partition p1 values in (11,12,13,14,15,16,17,18,19,20), -partition p2 values in (21,22,23,24,25,26,27,28,29,30), -partition p3 values in (31,32,33,34,35,36,37,38,39,40), -partition p4 values in (41,42,43,44,45,46,47,48,49,50), -partition p5 values in (51,52,53,54,55,56,57,58,59,60) -); -show create table t55; -Table Create Table -t55 CREATE TABLE `t55` ( - `colint` int(11) DEFAULT NULL, - `col1` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY LIST (colint) -SUBPARTITION BY HASH (datediff(col1, '2006-01-01')) -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) */ -select * from t55 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (datediff('2006-02-02', '2006-01-01')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition p0,p1 into -(partition s1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -alter table t66 -reorganize partition s1 into -(partition p0 values less than (datediff('2006-02-02', '2006-01-01')), -partition p1 values less than maxvalue); -select * from t66 order by colint; -colint col1 -1 2006-02-06 -2 2006-01-17 -3 2006-01-25 -4 2006-02-05 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with datediff(col1, '2006-01-01') -------------------------------------------------------------------------- -delete from t1 where col1='2006-01-17'; -delete from t2 where col1='2006-01-17'; -delete from t3 where col1='2006-01-17'; -delete from t4 where col1='2006-01-17'; -delete from t5 where col1='2006-01-17'; -delete from t6 where col1='2006-01-17'; -select * from t1 order by col1; -col1 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -insert into t1 values ('2006-01-17'); -insert into t2 values ('2006-01-17'); -insert into t3 values ('2006-01-17'); -insert into t4 values (60,'2006-01-17'); -insert into t5 values (60,'2006-01-17'); -insert into t6 values (60,'2006-01-17'); -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t1 drop partition p0; -alter table t2 drop partition p0; -alter table t4 drop partition p0; -alter table t5 drop partition p0; -alter table t6 drop partition p0; -select * from t1 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t2 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t3 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t4 order by colint; -colint col1 -60 2006-01-17 -select * from t5 order by colint; -colint col1 -60 2006-01-17 -select * from t6 order by colint; -colint col1 -60 2006-01-17 -------------------------------------------------------------------------- ---- Delete rows and partitions of tables with datediff(col1, '2006-01-01') -------------------------------------------------------------------------- -delete from t11 where col1='2006-01-17'; -delete from t22 where col1='2006-01-17'; -delete from t33 where col1='2006-01-17'; -delete from t44 where col1='2006-01-17'; -delete from t55 where col1='2006-01-17'; -delete from t66 where col1='2006-01-17'; -select * from t11 order by col1; -col1 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -insert into t11 values ('2006-01-17'); -insert into t22 values ('2006-01-17'); -insert into t33 values ('2006-01-17'); -insert into t44 values (60,'2006-01-17'); -insert into t55 values (60,'2006-01-17'); -insert into t66 values (60,'2006-01-17'); -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -1 2006-02-06 -3 2006-01-25 -4 2006-02-05 -60 2006-01-17 -alter table t11 drop partition p0; -alter table t22 drop partition p0; -alter table t44 drop partition p0; -alter table t55 drop partition p0; -alter table t66 drop partition p0; -select * from t11 order by col1; -col1 -2006-01-17 -2006-02-06 -select * from t22 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t33 order by col1; -col1 -2006-01-17 -2006-01-25 -2006-02-06 -select * from t44 order by colint; -colint col1 -60 2006-01-17 -select * from t55 order by colint; -colint col1 -60 2006-01-17 -select * from t66 order by colint; -colint col1 -60 2006-01-17 -------------------------- ----- some alter table end -------------------------- -drop table if exists t1 ; -drop table if exists t2 ; -drop table if exists t3 ; -drop table if exists t4 ; -drop table if exists t5 ; -drop table if exists t6 ; -drop table if exists t11 ; -drop table if exists t22 ; -drop table if exists t33 ; -drop table if exists t44 ; -drop table if exists t55 ; -drop table if exists t66 ; -------------------------------------------------------------------------- --- weekday(col1) in partition with coltype date ------------------------------------------------------------------------- drop table if exists t1 ; diff --git a/mysql-test/suite/parts/r/partition_auto_increment_innodb.result b/mysql-test/suite/parts/r/partition_auto_increment_innodb.result index 5fd576322d5..34e47f58272 100644 --- a/mysql-test/suite/parts/r/partition_auto_increment_innodb.result +++ b/mysql-test/suite/parts/r/partition_auto_increment_innodb.result @@ -134,7 +134,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a INT NULL AUTO_INCREMENT, @@ -440,7 +440,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */ DROP TABLE t1; diff --git a/mysql-test/suite/perfschema/include/binlog_common.inc b/mysql-test/suite/perfschema/include/binlog_common.inc index 96c01d9a4c8..bbe09de3e19 100644 --- a/mysql-test/suite/perfschema/include/binlog_common.inc +++ b/mysql-test/suite/perfschema/include/binlog_common.inc @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. # # 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 @@ -10,8 +10,8 @@ # 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 +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA # Tests for PERFORMANCE_SCHEMA @@ -19,8 +19,13 @@ RESET MASTER; select count(*) > 0 from performance_schema.setup_instruments; +# Note: +# Do not include records that could depend on +# compiling options (storage engines, SSL), +# to ensure the expected output in the binlog is predictable. update performance_schema.setup_instruments set enabled='NO' - where name like "wait/synch/rwlock/%"; + where name like "wait/synch/rwlock/sql/%" + and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock"); select count(*) > 0 from performance_schema.events_waits_current; @@ -37,13 +42,15 @@ insert into test.t1 insert into test.t2 select name from performance_schema.setup_instruments - where name like "wait/synch/rwlock/%"; + where name like "wait/synch/rwlock/sql/%" + and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock"); drop table test.t1; drop table test.t2; update performance_schema.setup_instruments set enabled='YES' - where name like "wait/synch/rwlock/%"; + where name like "wait/synch/rwlock/sql/%" + and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock"); --source include/show_binlog_events.inc diff --git a/mysql-test/suite/perfschema/r/binlog_mix.result b/mysql-test/suite/perfschema/r/binlog_mix.result index b31b853b06d..3b2ab2bb435 100644 --- a/mysql-test/suite/perfschema/r/binlog_mix.result +++ b/mysql-test/suite/perfschema/r/binlog_mix.result @@ -4,7 +4,8 @@ select count(*) > 0 from performance_schema.setup_instruments; count(*) > 0 1 update performance_schema.setup_instruments set enabled='NO' - where name like "wait/synch/rwlock/%"; + where name like "wait/synch/rwlock/sql/%" + and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock"); select count(*) > 0 from performance_schema.events_waits_current; count(*) > 0 1 @@ -16,16 +17,17 @@ insert into test.t1 select thread_id from performance_schema.events_waits_current; insert into test.t2 select name from performance_schema.setup_instruments -where name like "wait/synch/rwlock/%"; +where name like "wait/synch/rwlock/sql/%" + and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock"); drop table test.t1; drop table test.t2; update performance_schema.setup_instruments set enabled='YES' - where name like "wait/synch/rwlock/%"; + where name like "wait/synch/rwlock/sql/%" + and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock"); show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (performance_schema.setup_instruments) -master-bin.000001 # Update_rows # # table_id: # master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */ @@ -44,6 +46,5 @@ master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server master-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */ master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (performance_schema.setup_instruments) -master-bin.000001 # Update_rows # # table_id: # master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT diff --git a/mysql-test/suite/perfschema/r/binlog_row.result b/mysql-test/suite/perfschema/r/binlog_row.result index 010f2de06e6..644e5d58e23 100644 --- a/mysql-test/suite/perfschema/r/binlog_row.result +++ b/mysql-test/suite/perfschema/r/binlog_row.result @@ -4,7 +4,8 @@ select count(*) > 0 from performance_schema.setup_instruments; count(*) > 0 1 update performance_schema.setup_instruments set enabled='NO' - where name like "wait/synch/rwlock/%"; + where name like "wait/synch/rwlock/sql/%" + and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock"); select count(*) > 0 from performance_schema.events_waits_current; count(*) > 0 1 @@ -16,16 +17,17 @@ insert into test.t1 select thread_id from performance_schema.events_waits_current; insert into test.t2 select name from performance_schema.setup_instruments -where name like "wait/synch/rwlock/%"; +where name like "wait/synch/rwlock/sql/%" + and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock"); drop table test.t1; drop table test.t2; update performance_schema.setup_instruments set enabled='YES' - where name like "wait/synch/rwlock/%"; + where name like "wait/synch/rwlock/sql/%" + and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock"); show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (performance_schema.setup_instruments) -master-bin.000001 # Update_rows # # table_id: # master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */ @@ -44,6 +46,5 @@ master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server master-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */ master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (performance_schema.setup_instruments) -master-bin.000001 # Update_rows # # table_id: # master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT diff --git a/mysql-test/suite/perfschema/r/binlog_stmt.result b/mysql-test/suite/perfschema/r/binlog_stmt.result index 60054ee8a74..3fcecfdd1ca 100644 --- a/mysql-test/suite/perfschema/r/binlog_stmt.result +++ b/mysql-test/suite/perfschema/r/binlog_stmt.result @@ -5,7 +5,8 @@ select count(*) > 0 from performance_schema.setup_instruments; count(*) > 0 1 update performance_schema.setup_instruments set enabled='NO' - where name like "wait/synch/rwlock/%"; + where name like "wait/synch/rwlock/sql/%" + and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock"); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. select count(*) > 0 from performance_schema.events_waits_current; @@ -21,20 +22,23 @@ Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. insert into test.t2 select name from performance_schema.setup_instruments -where name like "wait/synch/rwlock/%"; +where name like "wait/synch/rwlock/sql/%" + and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock"); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. drop table test.t1; drop table test.t2; update performance_schema.setup_instruments set enabled='YES' - where name like "wait/synch/rwlock/%"; + where name like "wait/synch/rwlock/sql/%" + and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock"); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; update performance_schema.setup_instruments set enabled='NO' - where name like "wait/synch/rwlock/%" + where name like "wait/synch/rwlock/sql/%" + and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock") master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */ master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */ @@ -47,11 +51,13 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; insert into test.t2 select name from performance_schema.setup_instruments -where name like "wait/synch/rwlock/%" +where name like "wait/synch/rwlock/sql/%" + and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock") master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ master-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */ master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; update performance_schema.setup_instruments set enabled='YES' - where name like "wait/synch/rwlock/%" + where name like "wait/synch/rwlock/sql/%" + and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock") master-bin.000001 # Query # # COMMIT diff --git a/mysql-test/suite/perfschema/t/binlog_mix.test b/mysql-test/suite/perfschema/t/binlog_mix.test index 4fe7d68b555..5e2c65d6fe4 100644 --- a/mysql-test/suite/perfschema/t/binlog_mix.test +++ b/mysql-test/suite/perfschema/t/binlog_mix.test @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. # # 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 @@ -10,8 +10,8 @@ # 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 +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA # Tests for PERFORMANCE_SCHEMA @@ -19,9 +19,6 @@ --source include/not_embedded.inc --source include/have_perfschema.inc -# See Bug#46896 binlog: case sensitivity of table names ---source include/have_lowercase0.inc - set binlog_format=mixed; --source ../include/binlog_common.inc diff --git a/mysql-test/suite/perfschema/t/binlog_row.test b/mysql-test/suite/perfschema/t/binlog_row.test index c1c1e06d3f0..d09baaa3011 100644 --- a/mysql-test/suite/perfschema/t/binlog_row.test +++ b/mysql-test/suite/perfschema/t/binlog_row.test @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. # # 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 @@ -10,8 +10,8 @@ # 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 +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA # Tests for PERFORMANCE_SCHEMA @@ -19,9 +19,6 @@ --source include/not_embedded.inc --source include/have_perfschema.inc -# See Bug#46896 binlog: case sensitivity of table names ---source include/have_lowercase0.inc - set binlog_format=row; --source ../include/binlog_common.inc diff --git a/mysql-test/suite/perfschema/t/binlog_stmt.test b/mysql-test/suite/perfschema/t/binlog_stmt.test index a0fbc5ef335..46418d5703f 100644 --- a/mysql-test/suite/perfschema/t/binlog_stmt.test +++ b/mysql-test/suite/perfschema/t/binlog_stmt.test @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. # # 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 @@ -10,8 +10,8 @@ # 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 +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA # Tests for PERFORMANCE_SCHEMA diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def index 347b0dff70a..f4806bdba1e 100644 --- a/mysql-test/suite/rpl/t/disabled.def +++ b/mysql-test/suite/rpl/t/disabled.def @@ -15,3 +15,4 @@ rpl_read_only : WL#4284: Setting Read only won't succeed until all m rpl_row_create_table : Bug#51574 2010-02-27 andrei failed different way than earlier with bug#45576 rpl_spec_variables : BUG#47661 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux rpl_log_pos : BUG#55675 2010-09-10 alfranio rpl.rpl_log_pos fails sporadically with error binlog truncated in the middle +rpl_get_master_version_and_clock : Bug#59178 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test index 9da8c759d45..2854f503034 100644 --- a/mysql-test/t/auto_increment.test +++ b/mysql-test/t/auto_increment.test @@ -363,3 +363,20 @@ SET @@SESSION.AUTO_INCREMENT_OFFSET=default; DROP TABLE t1; --echo End of 5.1 tests + +--echo # +--echo # Bug#50619 assert in handler::update_auto_increment +--echo # + +CREATE TABLE t1 (pk INT AUTO_INCREMENT, PRIMARY KEY (pk)); +# This triggered the assert +INSERT INTO t1 VALUES (NULL), (-1), (NULL); +SELECT * FROM t1; +DROP TABLE t1; + +# Check that that true overflow still gives error +CREATE TABLE t1 (pk BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY (pk)); +--error ER_AUTOINC_READ_FAILED +INSERT INTO t1 VALUES (NULL), (18446744073709551615-1), (NULL); +SELECT * FROM t1; +DROP TABLE t1; diff --git a/mysql-test/t/innodb_mysql_sync.test b/mysql-test/t/innodb_mysql_sync.test index 07f75afec40..22c6f3874bc 100644 --- a/mysql-test/t/innodb_mysql_sync.test +++ b/mysql-test/t/innodb_mysql_sync.test @@ -104,6 +104,47 @@ SELECT ((@id := id) - id) FROM t2; KILL @id; SET DEBUG_SYNC= "now SIGNAL killed"; DROP TABLE t1, t2; +disconnect con1; +--source include/wait_until_count_sessions.inc +SET DEBUG_SYNC= "RESET"; + + +--echo # +--echo # Bug#58933 Assertion `thd- >is_error()' fails on shutdown with ongoing +--echo # OPTIMIZE TABLE +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1), (2); + +--echo # Connection con1 +connect (con1,localhost,root); +let $ID= `SELECT connection_id()`; +SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL waiting WAIT_FOR killed'; +--echo # Sending: +--send OPTIMIZE TABLE t1 + +--echo # Connection default +connection default; +SET DEBUG_SYNC= 'now WAIT_FOR waiting'; +--replace_result $ID ID +eval KILL QUERY $ID; +SET DEBUG_SYNC= 'now SIGNAL killed'; + +--echo # Connection con1 +connection con1; +--echo # Reaping: OPTIMIZE TABLE t1 +--reap + +--echo # Connection default +connection default; +DROP TABLE t1; +SET DEBUG_SYNC= 'RESET'; +disconnect con1; # Check that all connections opened by test cases in this file are really diff --git a/mysql-test/t/lowercase_table4.test b/mysql-test/t/lowercase_table4.test index 93956047145..783a4fcae51 100755 --- a/mysql-test/t/lowercase_table4.test +++ b/mysql-test/t/lowercase_table4.test @@ -53,4 +53,56 @@ eval SELECT * FROM XY.T_$tcs LIMIT 1; --enable_query_log
--enable_result_log
DROP DATABASE XY;
+USE TEST;
+
+--echo #
+--echo # Bug55222 Mysqldump table names case bug in REFERENCES clause
+--echo # InnoDB did not handle lower_case_table_names=2 for
+--echo # foreign_table_names and referenced_table_names.
+--echo #
+
+SHOW VARIABLES LIKE 'lower_case_table_names';
+
+--disable_warnings
+DROP TABLE IF EXISTS `Table2`;
+DROP TABLE IF EXISTS `Table1`;
+--disable_warnings
+
+CREATE TABLE `Table1`(c1 INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE `Table2`(c1 INT PRIMARY KEY, c2 INT) ENGINE=InnoDB;
+ALTER TABLE `Table2` ADD CONSTRAINT fk1 FOREIGN KEY(c2) REFERENCES `Table1`(c1);
+query_vertical SHOW CREATE TABLE `Table2`;
+query_vertical SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS;
+DROP TABLE `Table2`;
+DROP TABLE `Table1`;
+
+--disable_warnings
+DROP TABLE IF EXISTS Product_Order;
+DROP TABLE IF EXISTS Product;
+DROP TABLE IF EXISTS Customer;
+--enable_warnings
+
+CREATE TABLE Product (Category INT NOT NULL, Id INT NOT NULL,
+ Price DECIMAL, PRIMARY KEY(Category, Id)) ENGINE=InnoDB;
+CREATE TABLE Customer (Id INT NOT NULL, PRIMARY KEY (Id)) ENGINE=InnoDB;
+CREATE TABLE Product_Order (No INT NOT NULL AUTO_INCREMENT,
+ Product_Category INT NOT NULL,
+ Product_Id INT NOT NULL,
+ Customer_Id INT NOT NULL,
+ PRIMARY KEY(No),
+ INDEX (Product_Category, Product_Id),
+ FOREIGN KEY (Product_Category, Product_Id)
+ REFERENCES Product(Category, Id) ON UPDATE CASCADE ON DELETE RESTRICT,
+ INDEX (Customer_Id),
+ FOREIGN KEY (Customer_Id)
+ REFERENCES Customer(Id)
+ ) ENGINE=INNODB;
+
+query_vertical SHOW CREATE TABLE Product_Order;
+query_vertical SHOW CREATE TABLE Product;
+query_vertical SHOW CREATE TABLE Customer;
+query_vertical SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS;
+DROP TABLE Product_Order;
+DROP TABLE Product;
+DROP TABLE Customer;
diff --git a/mysql-test/t/not_embedded_server.test b/mysql-test/t/not_embedded_server.test index 3fea1f630e0..c1dbba82292 100644 --- a/mysql-test/t/not_embedded_server.test +++ b/mysql-test/t/not_embedded_server.test @@ -4,31 +4,7 @@ -- 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) -## -## 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; +# End of 4.1 tests call mtr.add_suppression("Can't open and lock privilege tables: Table 'host' was not locked with LOCK TABLES"); @@ -46,14 +22,14 @@ SHOW VARIABLES like 'slave_skip_errors'; --echo # FLUSH PRIVILEGES should not implicitly unlock locked tables. --echo # --disable_warnings -drop table if exists t1; +DROP TABLE IF EXISTS t1; --enable_warnings -create table t1 (c1 int); -lock tables t1 read; +CREATE TABLE t1 (c1 INT); +LOCK TABLES t1 READ; --error ER_TABLE_NOT_LOCKED -flush privileges; -unlock tables; -drop table t1; +FLUSH PRIVILEGES; +UNLOCK TABLES; +DROP TABLE t1; --echo # --echo # Bug#54812: assert in Diagnostics_area::set_ok_status during EXPLAIN @@ -83,8 +59,18 @@ connect (con1,localhost,nopriv_user,,); connection con1; --echo connection: con1 +let outfile=$MYSQLTEST_VARDIR/tmp/mytest; +--error 0,1 +--remove_file $outfile +--replace_result $outfile <outfile> --error ER_PROCACCESS_DENIED_ERROR -SELECT MAX(key1) FROM t1 WHERE f() < 1 INTO OUTFILE 'mytest'; +eval SELECT MAX(key1) FROM t1 WHERE f() < 1 INTO OUTFILE '$outfile'; +# A removal of the outfile is necessary, at least today (2010-12-07), because +# the outfile is created even if the SELECT statement fails. +# If the server is improved in the future this may not happen. +# ==> Do not fail if the outfile does not exist. +--error 0,1 +--remove_file $outfile --error ER_PROCACCESS_DENIED_ERROR INSERT INTO t2 SELECT MAX(key1) FROM t1 WHERE f() < 1; diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index cf3dcfadb27..21c385485cc 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -1898,15 +1898,16 @@ while ($cnt) drop table t1; # -# BUG#32272: partition crash 1: enum column +# BUG#32772: partition crash 1: enum column # +# Note that month(int_col) is disallowed after bug#54483. create table t1 ( c0 int, c1 bigint, c2 set('sweet'), key (c2,c1,c0), key(c0) -) engine=myisam partition by hash (month(c0)) partitions 5; +) engine=myisam partition by hash (c0) partitions 5; --disable_warnings insert ignore into t1 set c0 = -6502262, c1 = 3992917, c2 = 35019; diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test index 213778764b5..1e0032a2bfa 100644 --- a/mysql-test/t/partition_error.test +++ b/mysql-test/t/partition_error.test @@ -11,6 +11,667 @@ drop table if exists t1, t2; let $MYSQLD_DATADIR= `SELECT @@datadir`; --echo # +--echo # Bug#54483: valgrind errors when making warnings for multiline inserts +--echo # into partition +--echo # +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARBINARY(10)) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a CHAR(10)) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIMESTAMP) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +CREATE TABLE t1 (a DATE) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +INSERT INTO t1 VALUES ('test'),('a'),('5'); +SHOW WARNINGS; +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +INSERT INTO t1 VALUES ('test'),('a'),('5'); +SHOW WARNINGS; +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +SHOW WARNINGS; + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TO_DAYS(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (TO_DAYS(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (TO_DAYS(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TO_DAYS(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TO_DAYS(a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (DAYOFMONTH(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (DAYOFMONTH(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (DAYOFMONTH(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (DAYOFMONTH(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (DAYOFMONTH(a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (MONTH(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (MONTH(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (MONTH(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (MONTH(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (MONTH(a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (DAYOFYEAR(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (DAYOFYEAR(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (DAYOFYEAR(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (DAYOFYEAR(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (DAYOFYEAR(a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (HOUR(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (HOUR(a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (HOUR(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (HOUR(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (HOUR(a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (MINUTE(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (MINUTE(a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (MINUTE(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (MINUTE(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (MINUTE(a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (QUARTER(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (QUARTER(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (QUARTER(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (QUARTER(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (QUARTER(a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (SECOND(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (SECOND(a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (SECOND(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (SECOND(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (SECOND(a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (YEARWEEK(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (YEARWEEK(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (YEARWEEK(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (YEARWEEK(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (YEARWEEK(a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (WEEKDAY(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (WEEKDAY(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (WEEKDAY(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (WEEKDAY(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (WEEKDAY(a)); + +--echo # TO_SECONDS() is added in 5.5. +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TO_SECONDS(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (TO_SECONDS(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (TO_SECONDS(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TO_SECONDS(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TO_SECONDS(a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (TIME_TO_SEC(a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TIME_TO_SEC(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TIME_TO_SEC(a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (FROM_DAYS(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (FROM_DAYS(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (FROM_DAYS(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TO_DAYS(FROM_DAYS(a))); +--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (FROM_DAYS(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TO_DAYS(FROM_DAYS(a))); +--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (FROM_DAYS(a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (MICROSECOND(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (MICROSECOND(a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (MICROSECOND(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (MICROSECOND(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (MICROSECOND(a)); +--echo # Bug#57071 +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 +(`date` date, + `extracted_week` int, + `yearweek` int, + `week` int, + `default_week_format` int) +PARTITION BY LIST (EXTRACT(WEEK FROM date) % 3) +(PARTITION p0 VALUES IN (0), + PARTITION p1 VALUES IN (1), + PARTITION p2 VALUES IN (2)); +CREATE TABLE t1 +(`date` date, + `extracted_week` int, + `yearweek` int, + `week` int, + `default_week_format` int); +SET @old_default_week_format := @@default_week_format; +SET default_week_format = 0; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 1; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 2; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 3; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 4; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 5; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 6; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 7; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SELECT * FROM t1; +SET default_week_format = @old_default_week_format; +DROP TABLE t1; + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); + +--echo # EXTRACT(WEEK...) is disallowed, see bug#57071. +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME, b DATE) +PARTITION BY HASH (DATEDIFF(a, b)); +CREATE TABLE t1 (a DATE, b DATETIME) +PARTITION BY HASH (DATEDIFF(a, b)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME, b DATE) +PARTITION BY HASH (DATEDIFF(a, b)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE, b VARCHAR(10)) +PARTITION BY HASH (DATEDIFF(a, b)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT, b DATETIME) +PARTITION BY HASH (DATEDIFF(a, b)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (TIME_TO_SEC(a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TIME_TO_SEC(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TIME_TO_SEC(a)); + + +--echo # --echo # Bug#50036: Inconsistent errors when using TIMESTAMP --echo # columns/expressions diff --git a/mysql-test/t/partition_range.test b/mysql-test/t/partition_range.test index 4e2c1b98a70..3ff03248d88 100644 --- a/mysql-test/t/partition_range.test +++ b/mysql-test/t/partition_range.test @@ -30,8 +30,8 @@ DROP TABLE t1; # #BUG#49591, Add proper version number to SHOW CREATE TABLE # -create table t1 (a int) -partition by range (a) +create table t1 (a DATETIME) +partition by range (TO_DAYS(a)) subpartition by hash(to_seconds(a)) (partition p0 values less than (1)); show create table t1; diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index fc3cfc76939..32b1f6bbc90 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -5,9 +5,6 @@ # depends on the presence of the log tables (which are CSV-based). --source include/have_csv.inc -# Save the initial number of concurrent sessions ---source include/count_sessions.inc - # # Test of some show commands # @@ -53,7 +50,7 @@ optimize table t1; optimize table t1; drop table t1; -#show variables; +# show variables; --echo -- Here we enable metadata just to check that the collation of the --echo -- resultset is non-binary for string type. This should be changed @@ -332,6 +329,7 @@ drop table t1; --error ER_DBACCESS_DENIED_ERROR drop database mysqltest; disconnect con1; +--source include/wait_until_disconnected.inc connect (con2,localhost,mysqltest_2,,test); connection con2; @@ -344,6 +342,7 @@ drop table mysqltest.t1; --error ER_DBACCESS_DENIED_ERROR drop database mysqltest; disconnect con2; +--source include/wait_until_disconnected.inc connect (con3,localhost,mysqltest_3,,test); connection con3; @@ -353,6 +352,7 @@ show create database mysqltest; drop table mysqltest.t1; drop database mysqltest; disconnect con3; +--source include/wait_until_disconnected.inc connection default; set names binary; @@ -900,10 +900,12 @@ CREATE TABLE t1(ËÏÌÏÎËÁ1 INT); --let $outfile1=$MYSQLTEST_VARDIR/tmp/show_check.mysqltest1.sql +--source include/count_sessions.inc --echo --echo ---> Dumping mysqltest1 to outfile1 - --exec $MYSQL_DUMP --default-character-set=latin1 --character-sets-dir=$MYSQL_SHAREDIR/charsets --databases mysqltest1 > $outfile1 +# Take care that the additional session caused by MYSQL_DUMP has disappeared. +--source include/wait_until_count_sessions.inc # - Clean mysqltest1; @@ -917,9 +919,12 @@ DROP DATABASE mysqltest1; --echo --echo +--source include/count_sessions.inc --echo ---> Restoring mysqltest1... --exec $MYSQL test < $outfile1 --remove_file $outfile1 +# Take care that the additional session caused by MYSQL has disappeared. +--source include/wait_until_count_sessions.inc # - Check definition of the table. @@ -989,14 +994,14 @@ grant select on `mysqltest`.`t1` to mysqltest_4@localhost; connect (con4,localhost,mysqltest_4,,mysqltest); connection con4; show create database mysqltest; +disconnect con4; +--source include/wait_until_disconnected.inc connection default; delete from mysql.user where user='mysqltest_4'; delete from mysql.db where user='mysqltest_4'; delete from mysql.tables_priv where user='mysqltest_4'; flush privileges; drop database mysqltest; -connection default; -disconnect con4; # # Ensure that show plugin code is tested @@ -1192,6 +1197,7 @@ SHOW ENGINE MYISAM STATUS; --enable_result_log disconnect conn1; +--source include/wait_until_disconnected.inc connection default; DROP USER test_u@localhost; @@ -1214,8 +1220,9 @@ CONNECTION con1; --error ER_QUERY_INTERRUPTED SHOW CREATE TABLE non_existent; -CONNECTION default; DISCONNECT con1; +--source include/wait_until_disconnected.inc +CONNECTION default; --echo End of 5.1 tests @@ -1239,9 +1246,11 @@ connection con1; --echo # This statement used to be blocked. SHOW CREATE TABLE t1; +disconnect con1; +--source include/wait_until_disconnected.inc + --echo # Switching to connection 'default'. connection default; -disconnect con1; UNLOCK TABLES; DROP TABLE t1; @@ -1317,17 +1326,16 @@ connection con1; # Should not block. ALTER TABLE t1 CHARACTER SET = utf8; +disconnect con1; +--source include/wait_until_disconnected.inc + --echo # Connection default connection default; COMMIT; DROP TRIGGER t1_bi; DROP TABLE t1; -disconnect con1; -# Wait till all disconnects are completed ---source include/wait_until_count_sessions.inc - --echo # --echo # Bug#57306 SHOW PROCESSLIST does not display string literals well. --echo # @@ -1352,6 +1360,7 @@ SELECT RELEASE_LOCK('t'); --connection con1 --reap --disconnect con1 +--source include/wait_until_disconnected.inc --connection default SET NAMES latin1; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index d4a995ee181..f60ee247ba7 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -3945,6 +3945,55 @@ SELECT * FROM t2 UNION SELECT * FROM t2 DROP TABLE t1,t2; --enable_result_log +--echo # +--echo # Bug #58818: Incorrect result for IN/ANY subquery +--echo # with HAVING condition +--echo # + +CREATE TABLE t1(i INT); +INSERT INTO t1 VALUES (1), (2), (3); +CREATE TABLE t1s(i INT); +INSERT INTO t1s VALUES (10), (20), (30); +CREATE TABLE t2s(i INT); +INSERT INTO t2s VALUES (100), (200), (300); + +SELECT * FROM t1 +WHERE t1.i NOT IN +( + SELECT STRAIGHT_JOIN t2s.i + FROM + t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i + HAVING t2s.i = 999 +); + +SELECT * FROM t1 +WHERE t1.I IN +( + SELECT STRAIGHT_JOIN t2s.i + FROM + t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i + HAVING t2s.i = 999 +) IS UNKNOWN; + +SELECT * FROM t1 +WHERE NOT t1.I = ANY +( + SELECT STRAIGHT_JOIN t2s.i + FROM + t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i + HAVING t2s.i = 999 +); + +SELECT * FROM t1 + WHERE t1.i = ANY ( + SELECT STRAIGHT_JOIN t2s.i + FROM + t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i + HAVING t2s.i = 999 + ) IS UNKNOWN; + +DROP TABLE t1,t1s,t2s; + --echo End of 5.1 tests --echo # diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test index 6727833eb44..f024dd2567f 100644 --- a/mysql-test/t/subselect4.test +++ b/mysql-test/t/subselect4.test @@ -136,6 +136,16 @@ SELECT * FROM t1 WHERE NULL NOT IN ( SELECT c FROM t2 WHERE c = 1 AND c <> 1 ); DROP TABLE t1, t2, t3, t4, t5; +--echo # +--echo # Bug#58207: invalid memory reads when using default column value and +--echo # tmptable needed +--echo # +CREATE TABLE t(a VARCHAR(245) DEFAULT +'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); +INSERT INTO t VALUES (''),(''),(''),(''),(''),(''),(''),(''),(''),(''),(''); +SELECT * FROM (SELECT default(a) FROM t GROUP BY a) d; +DROP TABLE t; + --echo # --echo # End of 5.1 tests. diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index 596fc5f41ef..c6599517e90 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -1117,3 +1117,70 @@ DROP TABLE t1,t2; --echo End of 5.1 tests + +--echo # +--echo # Bug#57986 ORDER BY clause is not used after a UNION, +--echo # if embedded in a SELECT +--echo # + +CREATE TABLE t1 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL); +CREATE TABLE t2 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL); + + +INSERT INTO t1 (c1, c2) VALUES ('t1a', 1), ('t1a', 2), ('t1a', 3), ('t1b', 2), ('t1b', 1); +INSERT INTO t2 (c1, c2) VALUES ('t2a', 1), ('t2a', 2), ('t2a', 3), ('t2b', 2), ('t2b', 1); + +SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY c2, c1; +SELECT * FROM t1 UNION (SELECT * FROM t2) ORDER BY c2, c1; +SELECT * FROM t1 UNION (SELECT * FROM t2 ORDER BY c2, c1); + +SELECT c1, c2 FROM ( + SELECT c1, c2 FROM t1 + UNION + (SELECT c1, c2 FROM t2) + ORDER BY c2, c1 +) AS res; + +SELECT c1, c2 FROM ( + SELECT c1, c2 FROM t1 + UNION + (SELECT c1, c2 FROM t2) + ORDER BY c2 DESC, c1 LIMIT 1 +) AS res; + +SELECT c1, c2 FROM ( + SELECT c1, c2 FROM t1 + UNION + (SELECT c1, c2 FROM t2 ORDER BY c2 DESC, c1 LIMIT 1) +) AS res; + +SELECT c1, c2 FROM ( + SELECT c1, c2 FROM t1 + UNION + SELECT c1, c2 FROM t2 + ORDER BY c2 DESC, c1 DESC LIMIT 1 +) AS res; + +SELECT c1, c2 FROM ( + ( + (SELECT c1, c2 FROM t1) + UNION + (SELECT c1, c2 FROM t2) + ) + ORDER BY c2 DESC, c1 ASC LIMIT 1 +) AS res; + +DROP TABLE t1, t2; + +--echo # +--echo # Bug #58970 Problem Subquery (without referencing a table) +--echo # and Order By +--echo # + +SELECT(SELECT 0 AS a UNION SELECT 1 AS a ORDER BY a ASC LIMIT 1) AS dev; +SELECT(SELECT 0 AS a UNION SELECT 1 AS a ORDER BY a DESC LIMIT 1) AS dev; +SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a ASC LIMIT 1) AS dev; +SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev; +SELECT(SELECT 1 AS a ORDER BY a) AS dev; +SELECT(SELECT 1 AS a LIMIT 1) AS dev; +SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev; diff --git a/mysys/mf_brkhant.c b/mysys/mf_brkhant.c deleted file mode 100644 index 3573b9973b2..00000000000 --- a/mysys/mf_brkhant.c +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright (C) 2000 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 */ - -/* Dont let the user break when you are doing something important */ -/* Remembers if it got 'SIGINT' and executes it on allow_break */ -/* A static buffer is used; don't call dont_break() twice in a row */ - -#include "mysys_priv.h" -#include "my_static.h" - - /* Set variable that we can't break */ - -#if !defined(THREAD) -void dont_break(void) -{ - my_dont_interrupt=1; - return; -} /* dont_break */ - -void allow_break(void) -{ - { - reg1 int index; - - my_dont_interrupt=0; - if (_my_signals) - { - if (_my_signals > MAX_SIGNALS) - _my_signals=MAX_SIGNALS; - for (index=0 ; index < _my_signals ; index++) - { - if (_my_sig_remember[index].func) /* Safequard */ - { - (*_my_sig_remember[index].func)(_my_sig_remember[index].number); - _my_sig_remember[index].func=0; - } - } - _my_signals=0; - } - } -} /* dont_break */ -#endif - - /* Set old status */ - -#if !defined(THREAD) -void my_remember_signal(int signal_number, sig_handler (*func) (int)) -{ -#ifndef __WIN__ - reg1 int index; - - index=_my_signals++; /* Nobody can break a ++ ? */ - if (index < MAX_SIGNALS) - { - _my_sig_remember[index].number=signal_number; - _my_sig_remember[index].func=func; - } -#endif /* __WIN__ */ -} /* my_remember_signal */ -#endif /* THREAD */ diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index 575581712d4..62e51ffb629 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -55,15 +55,10 @@ static void my_aiowait(my_aio_result *result); #endif #include <errno.h> -#ifdef THREAD #define lock_append_buffer(info) \ mysql_mutex_lock(&(info)->append_buffer_lock) #define unlock_append_buffer(info) \ mysql_mutex_unlock(&(info)->append_buffer_lock) -#else -#define lock_append_buffer(info) -#define unlock_append_buffer(info) -#endif #define IO_ROUND_UP(X) (((X)+IO_SIZE-1) & ~(IO_SIZE-1)) #define IO_ROUND_DN(X) ( (X) & ~(IO_SIZE-1)) @@ -116,11 +111,7 @@ init_functions(IO_CACHE* info) info->write_function = 0; /* Force a core if used */ break; default: - info->read_function = -#ifdef THREAD - info->share ? _my_b_read_r : -#endif - _my_b_read; + info->read_function = info->share ? _my_b_read_r : _my_b_read; info->write_function = _my_b_write; } @@ -193,9 +184,7 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize, } info->disk_writes= 0; -#ifdef THREAD info->share=0; -#endif if (!cachesize && !(cachesize= my_default_record_cache_size)) DBUG_RETURN(1); /* No cache requested */ @@ -263,12 +252,10 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize, { info->append_read_pos = info->write_pos = info->write_buffer; info->write_end = info->write_buffer + info->buffer_length; -#ifdef THREAD mysql_mutex_init(key_IO_CACHE_append_buffer_lock, &info->append_buffer_lock, MY_MUTEX_INIT_FAST); -#endif } -#if defined(SAFE_MUTEX) && defined(THREAD) +#if defined(SAFE_MUTEX) else { /* Clear mutex so that safe_mutex will notice that it's not initialized */ @@ -601,7 +588,6 @@ int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count) } -#ifdef THREAD /* Prepare IO_CACHE for shared use. @@ -1162,7 +1148,6 @@ static void copy_to_read_buffer(IO_CACHE *write_cache, write_length-= copy_length; } } -#endif /*THREAD*/ /* @@ -1579,7 +1564,6 @@ int _my_b_write(register IO_CACHE *info, const uchar *Buffer, size_t Count) if (mysql_file_write(info->file, Buffer, length, info->myflags | MY_NABP)) return info->error= -1; -#ifdef THREAD /* In case of a shared I/O cache with a writer we normally do direct write cache to read cache copy. Simulate this here by direct @@ -1593,7 +1577,6 @@ int _my_b_write(register IO_CACHE *info, const uchar *Buffer, size_t Count) */ if (info->share) copy_to_read_buffer(info, Buffer, length); -#endif Count-=length; Buffer+=length; @@ -1615,13 +1598,11 @@ int my_b_append(register IO_CACHE *info, const uchar *Buffer, size_t Count) { size_t rest_length,length; -#ifdef THREAD /* Assert that we cannot come here with a shared cache. If we do one day, we might need to add a call to copy_to_read_buffer(). */ DBUG_ASSERT(!info->share); -#endif lock_append_buffer(info); rest_length= (size_t) (info->write_end - info->write_pos); @@ -1683,13 +1664,11 @@ int my_block_write(register IO_CACHE *info, const uchar *Buffer, size_t Count, size_t length; int error=0; -#ifdef THREAD /* Assert that we cannot come here with a shared cache. If we do one day, we might need to add a call to copy_to_read_buffer(). */ DBUG_ASSERT(!info->share); -#endif if (pos < info->pos_in_file) { @@ -1735,16 +1714,10 @@ int my_block_write(register IO_CACHE *info, const uchar *Buffer, size_t Count, /* Flush write cache */ -#ifdef THREAD #define LOCK_APPEND_BUFFER if (need_append_buffer_lock) \ lock_append_buffer(info); #define UNLOCK_APPEND_BUFFER if (need_append_buffer_lock) \ unlock_append_buffer(info); -#else -#define LOCK_APPEND_BUFFER -#define UNLOCK_APPEND_BUFFER -#endif - int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock __attribute__((unused))) @@ -1755,10 +1728,8 @@ int my_b_flush_io_cache(IO_CACHE *info, DBUG_ENTER("my_b_flush_io_cache"); DBUG_PRINT("enter", ("cache: 0x%lx", (long) info)); -#ifdef THREAD if (!append_cache) need_append_buffer_lock= 0; -#endif if (info->type == WRITE_CACHE || append_cache) { @@ -1771,7 +1742,6 @@ int my_b_flush_io_cache(IO_CACHE *info, if ((length=(size_t) (info->write_pos - info->write_buffer))) { -#ifdef THREAD /* In case of a shared I/O cache with a writer we do direct write cache to read cache copy. Do it before the write here so that @@ -1780,7 +1750,6 @@ int my_b_flush_io_cache(IO_CACHE *info, */ if (info->share) copy_to_read_buffer(info, info->write_buffer, length); -#endif pos_in_file=info->pos_in_file; /* @@ -1859,13 +1828,11 @@ int end_io_cache(IO_CACHE *info) DBUG_ENTER("end_io_cache"); DBUG_PRINT("enter",("cache: 0x%lx", (ulong) info)); -#ifdef THREAD /* Every thread must call remove_io_thread(). The last one destroys the share elements. */ DBUG_ASSERT(!info->share || !info->share->total_threads); -#endif if ((pre_close=info->pre_close)) { @@ -1884,9 +1851,7 @@ int end_io_cache(IO_CACHE *info) { /* Destroy allocated mutex */ info->type= TYPE_NOT_SET; -#ifdef THREAD mysql_mutex_destroy(&info->append_buffer_lock); -#endif } DBUG_RETURN(error); } /* end_io_cache */ diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c index 7a40ea8a86f..8962a037da0 100644 --- a/mysys/mf_iocache2.c +++ b/mysys/mf_iocache2.c @@ -90,9 +90,8 @@ my_off_t my_b_append_tell(IO_CACHE* info) from messing with the variables that we need in order to provide the answer to the question. */ -#ifdef THREAD mysql_mutex_lock(&info->append_buffer_lock); -#endif + #ifndef DBUG_OFF /* Make sure EOF is where we think it is. Note that we cannot just use @@ -112,9 +111,7 @@ my_off_t my_b_append_tell(IO_CACHE* info) } #endif res = info->end_of_file + (info->write_pos-info->append_read_pos); -#ifdef THREAD mysql_mutex_unlock(&info->append_buffer_lock); -#endif return res; } diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index 9993c636fb1..42cdea65f34 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -225,14 +225,11 @@ KEY_CACHE *dflt_key_cache= &dflt_key_cache_var; #define FLUSH_CACHE 2000 /* sort this many blocks at once */ static int flush_all_key_blocks(KEY_CACHE *keycache); -#ifdef THREAD + static void wait_on_queue(KEYCACHE_WQUEUE *wqueue, mysql_mutex_t *mutex); static void release_whole_queue(KEYCACHE_WQUEUE *wqueue); -#else -#define wait_on_queue(wqueue, mutex) do {} while (0) -#define release_whole_queue(wqueue) do {} while (0) -#endif + static void free_block(KEY_CACHE *keycache, BLOCK_LINK *block); #if !defined(DBUG_OFF) static void test_key_cache(KEY_CACHE *keycache, @@ -285,7 +282,7 @@ static void keycache_debug_print(const char *fmt,...); #endif /* defined(KEYCACHE_DEBUG_LOG) && defined(KEYCACHE_DEBUG) */ #if defined(KEYCACHE_DEBUG) || !defined(DBUG_OFF) -#ifdef THREAD + static long keycache_thread_id; #define KEYCACHE_THREAD_TRACE(l) \ KEYCACHE_DBUG_PRINT(l,("|thread %ld",keycache_thread_id)) @@ -297,11 +294,6 @@ static long keycache_thread_id; #define KEYCACHE_THREAD_TRACE_END(l) \ KEYCACHE_DBUG_PRINT(l,("]thread %ld",keycache_thread_id)) -#else /* THREAD */ -#define KEYCACHE_THREAD_TRACE(l) KEYCACHE_DBUG_PRINT(l,("")) -#define KEYCACHE_THREAD_TRACE_BEGIN(l) KEYCACHE_DBUG_PRINT(l,("")) -#define KEYCACHE_THREAD_TRACE_END(l) KEYCACHE_DBUG_PRINT(l,("")) -#endif /* THREAD */ #else #define KEYCACHE_THREAD_TRACE_BEGIN(l) #define KEYCACHE_THREAD_TRACE_END(l) @@ -583,7 +575,6 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, keycache_pthread_mutex_lock(&keycache->cache_lock); -#ifdef THREAD /* We may need to wait for another thread which is doing a resize already. This cannot happen in the MySQL server though. It allows @@ -596,7 +587,6 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, wait_on_queue(&keycache->resize_queue, &keycache->cache_lock); /* purecov: end */ } -#endif /* Mark the operation in progress. This blocks other threads from doing @@ -625,7 +615,6 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, keycache->resize_in_flush= 0; } -#ifdef THREAD /* Some direct read/write operations (bypassing the cache) may still be unfinished. Wait until they are done. If the key cache can be used, @@ -639,9 +628,6 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, */ while (keycache->cnt_for_resize_op) wait_on_queue(&keycache->waiting_for_resize_cnt, &keycache->cache_lock); -#else - KEYCACHE_DBUG_ASSERT(keycache->cnt_for_resize_op == 0); -#endif /* Free old cache structures, allocate new structures, and initialize @@ -782,8 +768,6 @@ void end_key_cache(KEY_CACHE *keycache, my_bool cleanup) } /* end_key_cache */ -#ifdef THREAD - /* Link a thread into double-linked queue of waiting threads. @@ -963,8 +947,6 @@ static void release_whole_queue(KEYCACHE_WQUEUE *wqueue) wqueue->last_thread= NULL; } -#endif /* THREAD */ - /* Unlink a block from the chain of dirty/clean blocks @@ -1136,7 +1118,7 @@ static void link_block(KEY_CACHE *keycache, BLOCK_LINK *block, my_bool hot, DBUG_ASSERT(block->prev_changed && *block->prev_changed == block); DBUG_ASSERT(!block->next_used); DBUG_ASSERT(!block->prev_used); -#ifdef THREAD + if (!hot && keycache->waiting_for_block.last_thread) { /* Signal that in the LRU warm sub-chain an available block has appeared */ @@ -1196,10 +1178,7 @@ static void link_block(KEY_CACHE *keycache, BLOCK_LINK *block, my_bool hot, #endif return; } -#else /* THREAD */ - KEYCACHE_DBUG_ASSERT(! (!hot && keycache->waiting_for_block.last_thread)); - /* Condition not transformed using DeMorgan, to keep the text identical */ -#endif /* THREAD */ + pins= hot ? &keycache->used_ins : &keycache->used_last; ins= *pins; if (ins) @@ -1421,12 +1400,9 @@ static void remove_reader(BLOCK_LINK *block) DBUG_ASSERT(!block->next_used); DBUG_ASSERT(!block->prev_used); DBUG_ASSERT(block->hash_link->requests); -#ifdef THREAD + if (! --block->hash_link->requests && block->condvar) keycache_pthread_cond_signal(block->condvar); -#else - --block->hash_link->requests; -#endif } @@ -1438,7 +1414,6 @@ static void remove_reader(BLOCK_LINK *block) static void wait_for_readers(KEY_CACHE *keycache, BLOCK_LINK *block) { -#ifdef THREAD struct st_my_thread_var *thread= my_thread_var; DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE)); DBUG_ASSERT(!(block->status & (BLOCK_IN_FLUSH | BLOCK_CHANGED))); @@ -1460,9 +1435,6 @@ static void wait_for_readers(KEY_CACHE *keycache, keycache_pthread_cond_wait(&thread->suspend, &keycache->cache_lock); block->condvar= NULL; } -#else - KEYCACHE_DBUG_ASSERT(block->hash_link->requests == 0); -#endif } @@ -1492,7 +1464,7 @@ static void unlink_hash(KEY_CACHE *keycache, HASH_LINK *hash_link) if ((*hash_link->prev= hash_link->next)) hash_link->next->prev= hash_link->prev; hash_link->block= NULL; -#ifdef THREAD + if (keycache->waiting_for_hash_link.last_thread) { /* Signal that a free hash link has appeared */ @@ -1528,9 +1500,6 @@ static void unlink_hash(KEY_CACHE *keycache, HASH_LINK *hash_link) hash_link); return; } -#else /* THREAD */ - KEYCACHE_DBUG_ASSERT(! (keycache->waiting_for_hash_link.last_thread)); -#endif /* THREAD */ hash_link->next= keycache->free_hash_list; keycache->free_hash_list= hash_link; } @@ -1595,7 +1564,6 @@ restart: } else { -#ifdef THREAD /* Wait for a free hash link */ struct st_my_thread_var *thread= my_thread_var; KEYCACHE_PAGE page; @@ -1609,9 +1577,6 @@ restart: keycache_pthread_cond_wait(&thread->suspend, &keycache->cache_lock); thread->opt_info= NULL; -#else - KEYCACHE_DBUG_ASSERT(0); -#endif goto restart; } hash_link->file= file; @@ -1731,7 +1696,6 @@ restart: - block assigned but not yet read from file (invalid data). */ -#ifdef THREAD if (keycache->in_resize) { /* This is a request during a resize operation */ @@ -1973,9 +1937,6 @@ restart: } DBUG_RETURN(0); } -#else /* THREAD */ - DBUG_ASSERT(!keycache->in_resize); -#endif if (page_status == PAGE_READ && (block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH | @@ -2105,7 +2066,6 @@ restart: from the LRU ring. */ -#ifdef THREAD if (! keycache->used_last) { /* @@ -2138,9 +2098,7 @@ restart: DBUG_ASSERT(!hash_link->block->next_used); DBUG_ASSERT(!hash_link->block->prev_used); } -#else - KEYCACHE_DBUG_ASSERT(keycache->used_last); -#endif + /* If we waited above, hash_link->block has been assigned by link_block(). Otherwise it is still NULL. In the latter case @@ -2610,10 +2568,8 @@ uchar *key_cache_read(KEY_CACHE *keycache, set_if_smaller(read_length, keycache->key_cache_block_size-offset); KEYCACHE_DBUG_ASSERT(read_length > 0); -#ifndef THREAD if (block_length > keycache->key_cache_block_size || offset) return_buffer=0; -#endif /* Request the cache block that matches file/pos. */ keycache->global_cache_r_requests++; @@ -2673,9 +2629,6 @@ uchar *key_cache_read(KEY_CACHE *keycache, /* block status may have added BLOCK_ERROR in the above 'if'. */ if (!(block->status & BLOCK_ERROR)) { -#ifndef THREAD - if (! return_buffer) -#endif { DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE)); #if !defined(SERIALIZED_READ_FROM_CACHE) @@ -2714,20 +2667,6 @@ uchar *key_cache_read(KEY_CACHE *keycache, break; } -#ifndef THREAD - /* This is only true if we where able to read everything in one block */ - if (return_buffer) - { - if (MYSQL_KEYCACHE_READ_DONE_ENABLED()) - { - MYSQL_KEYCACHE_READ_DONE((ulong) (keycache->blocks_used * - keycache->key_cache_block_size), - (ulong) (keycache->blocks_unused * - keycache->key_cache_block_size)); - } - DBUG_RETURN(block->buffer); - } -#endif next_block: buff+= read_length; filepos+= read_length+offset; diff --git a/mysys/mf_keycaches.c b/mysys/mf_keycaches.c index ee4ad025b0b..93b7eab4561 100644 --- a/mysys/mf_keycaches.c +++ b/mysys/mf_keycaches.c @@ -53,9 +53,7 @@ typedef struct st_safe_hash_entry typedef struct st_safe_hash_with_default { -#ifdef THREAD rw_lock_t mutex; -#endif HASH hash; uchar *default_value; SAFE_HASH_ENTRY *root; diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c index 3401c7301e9..dc15014121b 100644 --- a/mysys/my_bitmap.c +++ b/mysys/my_bitmap.c @@ -22,9 +22,6 @@ * the internal size is a set of 32 bit words * the number of bits specified in creation can be any number > 0 * there are THREAD safe versions of most calls called bitmap_lock_* - many of those are not used and not compiled normally but the code - already exist for them in an #ifdef:ed part. These can only be used - if THREAD was specified in bitmap_init TODO: Make assembler THREAD safe versions of these using test-and-set instructions @@ -85,18 +82,14 @@ void create_last_word_mask(MY_BITMAP *map) static inline void bitmap_lock(MY_BITMAP *map __attribute__((unused))) { -#ifdef THREAD if (map->mutex) mysql_mutex_lock(map->mutex); -#endif } static inline void bitmap_unlock(MY_BITMAP *map __attribute__((unused))) { -#ifdef THREAD if (map->mutex) mysql_mutex_unlock(map->mutex); -#endif } @@ -108,30 +101,30 @@ my_bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits, { uint size_in_bytes= bitmap_buffer_size(n_bits); uint extra= 0; -#ifdef THREAD + if (thread_safe) { size_in_bytes= ALIGN_SIZE(size_in_bytes); extra= sizeof(mysql_mutex_t); } map->mutex= 0; -#endif + if (!(buf= (my_bitmap_map*) my_malloc(size_in_bytes+extra, MYF(MY_WME)))) DBUG_RETURN(1); -#ifdef THREAD + if (thread_safe) { map->mutex= (mysql_mutex_t *) ((char*) buf + size_in_bytes); mysql_mutex_init(key_BITMAP_mutex, map->mutex, MY_MUTEX_INIT_FAST); } -#endif + } -#ifdef THREAD + else { DBUG_ASSERT(thread_safe == 0); } -#endif + map->bitmap= buf; map->n_bits= n_bits; @@ -146,10 +139,9 @@ void bitmap_free(MY_BITMAP *map) DBUG_ENTER("bitmap_free"); if (map->bitmap) { -#ifdef THREAD if (map->mutex) mysql_mutex_destroy(map->mutex); -#endif + my_free(map->bitmap); map->bitmap=0; } diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c index 861e4380690..e184c8308fc 100644 --- a/mysys/my_fopen.c +++ b/mysys/my_fopen.c @@ -18,6 +18,10 @@ #include <errno.h> #include "mysys_err.h" +#if defined(__FreeBSD__) +extern int getosreldate(void); +#endif + static void make_ftype(char * to,int flag); /* @@ -89,7 +93,135 @@ FILE *my_fopen(const char *filename, int flags, myf MyFlags) } /* my_fopen */ - /* Close a stream */ +#if defined(_WIN32) + +static FILE *my_win_freopen(const char *path, const char *mode, FILE *stream) +{ + int handle_fd, fd= _fileno(stream); + HANDLE osfh; + + DBUG_ASSERT(path && stream); + + /* Services don't have stdout/stderr on Windows, so _fileno returns -1. */ + if (fd < 0) + { + if (!freopen(path, mode, stream)) + return NULL; + + fd= _fileno(stream); + } + + if ((osfh= CreateFile(path, GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE | + FILE_SHARE_DELETE, NULL, + OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, + NULL)) == INVALID_HANDLE_VALUE) + return NULL; + + if ((handle_fd= _open_osfhandle((intptr_t)osfh, + _O_APPEND | _O_TEXT)) == -1) + { + CloseHandle(osfh); + return NULL; + } + + if (_dup2(handle_fd, fd) < 0) + { + CloseHandle(osfh); + return NULL; + } + + _close(handle_fd); + + return stream; +} + +#elif defined(__FreeBSD__) + +/* No close operation hook. */ + +static int no_close(void *cookie __attribute__((unused))) +{ + return 0; +} + +/* + A hack around a race condition in the implementation of freopen. + + The race condition steams from the fact that the current fd of + the stream is closed before its number is used to duplicate the + new file descriptor. This defeats the desired atomicity of the + close and duplicate of dup2(). + + See PR number 79887 for reference: + http://www.freebsd.org/cgi/query-pr.cgi?pr=79887 +*/ + +static FILE *my_freebsd_freopen(const char *path, const char *mode, FILE *stream) +{ + int old_fd; + FILE *result; + + flockfile(stream); + + old_fd= fileno(stream); + + /* Use a no operation close hook to avoid having the fd closed. */ + stream->_close= no_close; + + /* Relies on the implicit dup2 to close old_fd. */ + result= freopen(path, mode, stream); + + /* If successful, the _close hook was replaced. */ + + if (result == NULL) + close(old_fd); + else + funlockfile(result); + + return result; +} + +#endif + + +/** + Change the file associated with a file stream. + + @param path Path to file. + @param mode Mode of the stream. + @param stream File stream. + + @note + This function is used to redirect stdout and stderr to a file and + subsequently to close and reopen that file for log rotation. + + @retval A FILE pointer on success. Otherwise, NULL. +*/ + +FILE *my_freopen(const char *path, const char *mode, FILE *stream) +{ + FILE *result; + +#if defined(_WIN32) + result= my_win_freopen(path, mode, stream); +#elif defined(__FreeBSD__) + /* + XXX: Once the fix is ported to the stable releases, this should + be dependent upon the specific FreeBSD versions. Check at: + http://www.freebsd.org/cgi/query-pr.cgi?pr=79887 + */ + if (getosreldate() > 900027) + result= freopen(path, mode, stream); + else + result= my_freebsd_freopen(path, mode, stream); +#else + result= freopen(path, mode, stream); +#endif + + return result; +} + /* Close a stream */ int my_fclose(FILE *fd, myf MyFlags) diff --git a/mysys/my_fstream.c b/mysys/my_fstream.c index 0c7e4ef7aa3..83cb0d261c0 100644 --- a/mysys/my_fstream.c +++ b/mysys/my_fstream.c @@ -124,10 +124,9 @@ size_t my_fwrite(FILE *stream, const uchar *Buffer, size_t Count, myf MyFlags) } #endif #if !defined(NO_BACKGROUND) && defined(USE_MY_STREAM) -#ifdef THREAD if (my_thread_var->abort) MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */ -#endif + if ((errno == ENOSPC || errno == EDQUOT) && (MyFlags & MY_WAIT_IF_FULL)) { diff --git a/mysys/my_gethostbyname.c b/mysys/my_gethostbyname.c index 8a9c721c2fb..28ecec13ef2 100644 --- a/mysys/my_gethostbyname.c +++ b/mysys/my_gethostbyname.c @@ -78,9 +78,7 @@ struct hostent *my_gethostbyname_r(const char *name, #else /* !HAVE_GETHOSTBYNAME_R */ -#ifdef THREAD extern mysql_mutex_t LOCK_gethostbyname_r; -#endif /* No gethostbyname_r() function exists. diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 5e66d2fc189..51c45ff1309 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -602,6 +602,24 @@ static char *check_struct_option(char *cur_arg, char *key_name) } } +/** + Parse a boolean command line argument + + "ON", "TRUE" and "1" will return true, + other values will return false. + + @param[in] argument The value argument + @return boolean value +*/ +static my_bool get_bool_argument(const char *argument) +{ + if (!my_strcasecmp(&my_charset_latin1, argument, "true") || + !my_strcasecmp(&my_charset_latin1, argument, "on")) + return 1; + else + return (my_bool) atoi(argument); +} + /* function: setval @@ -629,7 +647,7 @@ static int setval(const struct my_option *opts, void *value, char *argument, switch ((opts->var_type & GET_TYPE_MASK)) { case GET_BOOL: /* If argument differs from 0, enable option, else disable */ - *((my_bool*) value)= (my_bool) atoi(argument) != 0; + *((my_bool*) value)= get_bool_argument(argument); break; case GET_INT: *((int*) value)= (int) getopt_ll(argument, opts, &err); diff --git a/mysys/my_getsystime.c b/mysys/my_getsystime.c index cc5d1b83efb..614f49fc425 100644 --- a/mysys/my_getsystime.c +++ b/mysys/my_getsystime.c @@ -165,7 +165,13 @@ ulonglong my_micro_time_and_time(time_t *time_arg) mysql_mutex_lock(&THR_LOCK_time); cur_gethrtime= gethrtime(); - if ((cur_gethrtime - prev_gethrtime) > DELTA_FOR_SECONDS) + /* + Due to bugs in the Solaris (x86) implementation of gethrtime(), + the time returned by it might not be monotonic. Don't use the + cached time(2) value if this is a case. + */ + if ((prev_gethrtime > cur_gethrtime) || + ((cur_gethrtime - prev_gethrtime) > DELTA_FOR_SECONDS)) { cur_time= time(0); prev_gethrtime= cur_gethrtime; diff --git a/mysys/my_init.c b/mysys/my_init.c index ab6ffef7ac7..f5a2d9ac4bd 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -91,23 +91,22 @@ my_bool my_basic_init(void) instrumented_stdin.m_psi= NULL; /* not yet instrumented */ mysql_stdin= & instrumented_stdin; -#if defined(THREAD) if (my_thread_global_init()) return 1; -# if defined(SAFE_MUTEX) + +#if defined(SAFE_MUTEX) safe_mutex_global_init(); /* Must be called early */ -# endif #endif -#if defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) + +#if defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) fastmutex_global_init(); /* Must be called early */ #endif -#ifdef THREAD + #if defined(HAVE_PTHREAD_INIT) pthread_init(); /* Must be called before DBUG_ENTER */ #endif if (my_thread_basic_global_init()) return 1; -#endif /* $HOME is needed early to parse configuration files located in ~/ */ if ((home_dir= getenv("HOME")) != 0) @@ -138,10 +137,9 @@ my_bool my_init(void) if (my_basic_init()) return 1; -#ifdef THREAD if (my_thread_global_init()) return 1; -#endif /* THREAD */ + { DBUG_ENTER("my_init"); DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown")); @@ -240,7 +238,7 @@ Voluntary context switches %ld, Involuntary context switches %ld\n", { DBUG_END(); /* Must be done before my_thread_end */ } -#ifdef THREAD + my_thread_end(); my_thread_global_end(); #if defined(SAFE_MUTEX) @@ -251,7 +249,6 @@ Voluntary context switches %ld, Involuntary context switches %ld\n", safe_mutex_end((infoflag & (MY_GIVE_INFO | MY_CHECK_ERROR)) ? stderr : (FILE *) 0); #endif /* defined(SAFE_MUTEX) */ -#endif /* THREAD */ #ifdef __WIN__ if (have_tcpip) @@ -518,7 +515,7 @@ PSI_mutex_key key_BITMAP_mutex, key_IO_CACHE_append_buffer_lock, static PSI_mutex_info all_mysys_mutexes[]= { -#if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32) +#if !defined(HAVE_PREAD) && !defined(_WIN32) { &key_my_file_info_mutex, "st_my_file_info:mutex", 0}, #endif /* !defined(HAVE_PREAD) && !defined(_WIN32) */ #if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R) diff --git a/mysys/my_lib.c b/mysys/my_lib.c index 890ff0b5dd1..06f9521a664 100644 --- a/mysys/my_lib.c +++ b/mysys/my_lib.c @@ -41,7 +41,7 @@ # endif #endif -#if defined(THREAD) && defined(HAVE_READDIR_R) +#if defined(HAVE_READDIR_R) #define READDIR(A,B,C) ((errno=readdir_r(A,B,&C)) != 0 || !C) #else #define READDIR(A,B,C) (!(C=readdir(A))) @@ -97,13 +97,12 @@ MY_DIR *my_dir(const char *path, myf MyFlags) DIR *dirp; struct dirent *dp; char tmp_path[FN_REFLEN+1],*tmp_file; -#ifdef THREAD char dirent_tmp[sizeof(struct dirent)+_POSIX_PATH_MAX+1]; -#endif + DBUG_ENTER("my_dir"); DBUG_PRINT("my",("path: '%s' MyFlags: %d",path,MyFlags)); -#if defined(THREAD) && !defined(HAVE_READDIR_R) +#if !defined(HAVE_READDIR_R) mysql_mutex_lock(&THR_LOCK_open); #endif @@ -135,11 +134,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags) tmp_file=strend(tmp_path); -#ifdef THREAD dp= (struct dirent*) dirent_tmp; -#else - dp=0; -#endif while (!(READDIR(dirp,(struct dirent*) dirent_tmp,dp))) { @@ -166,7 +161,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags) } (void) closedir(dirp); -#if defined(THREAD) && !defined(HAVE_READDIR_R) +#if !defined(HAVE_READDIR_R) mysql_mutex_unlock(&THR_LOCK_open); #endif result->dir_entry= (FILEINFO *)dir_entries_storage->buffer; @@ -178,7 +173,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags) DBUG_RETURN(result); error: -#if defined(THREAD) && !defined(HAVE_READDIR_R) +#if !defined(HAVE_READDIR_R) mysql_mutex_unlock(&THR_LOCK_open); #endif my_errno=errno; diff --git a/mysys/my_open.c b/mysys/my_open.c index 8f34ce1c6dc..2aef97b3e34 100644 --- a/mysys/my_open.c +++ b/mysys/my_open.c @@ -89,7 +89,7 @@ int my_close(File fd, myf MyFlags) if ((uint) fd < my_file_limit && my_file_info[fd].type != UNOPEN) { my_free(my_file_info[fd].name); -#if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32) +#if !defined(HAVE_PREAD) && !defined(_WIN32) mysql_mutex_destroy(&my_file_info[fd].mutex); #endif my_file_info[fd].type = UNOPEN; @@ -125,7 +125,7 @@ File my_register_filename(File fd, const char *FileName, enum file_type { if ((uint) fd >= my_file_limit) { -#if defined(THREAD) && !defined(HAVE_PREAD) +#if !defined(HAVE_PREAD) my_errno= EMFILE; #else thread_safe_increment(my_file_opened,&THR_LOCK_open); @@ -140,7 +140,7 @@ File my_register_filename(File fd, const char *FileName, enum file_type my_file_opened++; my_file_total_opened++; my_file_info[fd].type = type_of_file; -#if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32) +#if !defined(HAVE_PREAD) && !defined(_WIN32) mysql_mutex_init(key_my_file_info_mutex, &my_file_info[fd].mutex, MY_MUTEX_INIT_FAST); #endif diff --git a/mysys/my_pread.c b/mysys/my_pread.c index d0a0ddaec66..e006360c11b 100644 --- a/mysys/my_pread.c +++ b/mysys/my_pread.c @@ -85,14 +85,14 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset, DBUG_PRINT("warning",("Read only %d bytes off %u from %d, errno: %d", (int) readbytes, (uint) Count,Filedes,my_errno)); -#ifdef THREAD + if ((readbytes == 0 || readbytes == (size_t) -1) && errno == EINTR) { DBUG_PRINT("debug", ("my_pread() was interrupted and returned %d", (int) readbytes)); continue; /* Interrupted */ } -#endif + if (MyFlags & (MY_WME | MY_FAE | MY_FNABP)) { if (readbytes == (size_t) -1) @@ -173,10 +173,10 @@ size_t my_pwrite(File Filedes, const uchar *Buffer, size_t Count, } DBUG_PRINT("error",("Write only %u bytes", (uint) writtenbytes)); #ifndef NO_BACKGROUND -#ifdef THREAD + if (my_thread_var->abort) MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */ -#endif + if ((my_errno == ENOSPC || my_errno == EDQUOT) && (MyFlags & MY_WAIT_IF_FULL)) { diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c index dee34d10b38..150bde3fb33 100644 --- a/mysys/my_pthread.c +++ b/mysys/my_pthread.c @@ -18,7 +18,6 @@ #define DONT_REMAP_PTHREAD_FUNCTIONS #include "mysys_priv.h" -#ifdef THREAD #include <signal.h> #include <m_string.h> #include <thr_alarm.h> @@ -468,4 +467,3 @@ int pthread_dummy(int ret) { return ret; } -#endif /* THREAD */ diff --git a/mysys/my_read.c b/mysys/my_read.c index 75f9dd64f1d..dbe9006a1d3 100644 --- a/mysys/my_read.c +++ b/mysys/my_read.c @@ -59,14 +59,14 @@ size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags) DBUG_PRINT("warning",("Read only %d bytes off %lu from %d, errno: %d", (int) readbytes, (ulong) Count, Filedes, my_errno)); -#ifdef THREAD + if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR) { DBUG_PRINT("debug", ("my_read() was interrupted and returned %ld", (long) readbytes)); continue; /* Interrupted */ } -#endif + if (MyFlags & (MY_WME | MY_FAE | MY_FNABP)) { if (readbytes == (size_t) -1) diff --git a/mysys/my_static.c b/mysys/my_static.c index d7354555f3d..ec8d66ab0cf 100644 --- a/mysys/my_static.c +++ b/mysys/my_static.c @@ -32,9 +32,7 @@ char curr_dir[FN_REFLEN]= {0}, ulong my_stream_opened=0,my_file_opened=0, my_tmp_file_created=0; ulong my_file_total_opened= 0; int my_umask=0664, my_umask_dir=0777; -#ifndef THREAD -int my_errno=0; -#endif + struct st_my_file_info my_file_info_default[MY_NFILE]; uint my_file_limit= MY_NFILE; struct st_my_file_info *my_file_info= my_file_info_default; diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 045b56b11c2..c4b56cde850 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -22,7 +22,6 @@ #include <m_string.h> #include <signal.h> -#ifdef THREAD pthread_key(struct st_my_thread_var*, THR_KEY_mysys); mysql_mutex_t THR_LOCK_malloc, THR_LOCK_open, THR_LOCK_lock, THR_LOCK_isam, THR_LOCK_myisam, THR_LOCK_heap, @@ -532,4 +531,3 @@ static void install_sigabrt_handler(void) } #endif -#endif /* THREAD */ diff --git a/mysys/my_write.c b/mysys/my_write.c index 3eac1364f46..64f7546620f 100644 --- a/mysys/my_write.c +++ b/mysys/my_write.c @@ -52,10 +52,9 @@ size_t my_write(File Filedes, const uchar *Buffer, size_t Count, myf MyFlags) DBUG_PRINT("error",("Write only %ld bytes, error: %d", (long) writtenbytes, my_errno)); #ifndef NO_BACKGROUND -#ifdef THREAD if (my_thread_var->abort) MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */ -#endif + if ((my_errno == ENOSPC || my_errno == EDQUOT) && (MyFlags & MY_WAIT_IF_FULL)) { diff --git a/mysys/mysys_priv.h b/mysys/mysys_priv.h index 1ae6a9e3a99..4e642b7e3d3 100644 --- a/mysys/mysys_priv.h +++ b/mysys/mysys_priv.h @@ -24,7 +24,6 @@ #include <sys/resource.h> #endif -#ifdef THREAD #include <my_pthread.h> #ifdef HAVE_PSI_INTERFACE @@ -62,9 +61,6 @@ extern PSI_thread_key key_thread_alarm; extern mysql_mutex_t THR_LOCK_malloc, THR_LOCK_open, THR_LOCK_keycache; extern mysql_mutex_t THR_LOCK_lock, THR_LOCK_isam, THR_LOCK_net; extern mysql_mutex_t THR_LOCK_charset, THR_LOCK_time; -#else /* THREAD */ -#include <my_no_pthread.h> -#endif /* THREAD */ #include <mysql/psi/mysql_file.h> diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index 54eef693558..2e427f96bdd 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -18,7 +18,7 @@ #include "mysys_priv.h" #include <my_global.h> -#if defined(THREAD) && !defined(DONT_USE_THR_ALARM) +#if !defined(DONT_USE_THR_ALARM) #include <errno.h> #include <my_pthread.h> #include <signal.h> @@ -686,15 +686,14 @@ void resize_thr_alarm(uint max_alarms) #endif /* __WIN__ */ -#endif /* THREAD */ - +#endif /**************************************************************************** Handling of test case (when compiled with -DMAIN) ***************************************************************************/ #ifdef MAIN -#if defined(THREAD) && !defined(DONT_USE_THR_ALARM) +#if !defined(DONT_USE_THR_ALARM) static mysql_cond_t COND_thread_count; static mysql_mutex_t LOCK_thread_count; @@ -961,17 +960,13 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused))) return 0; } -#else /* THREAD */ +#else /* !defined(DONT_USE_ALARM_THREAD) */ int main(int argc __attribute__((unused)),char **argv __attribute__((unused))) { -#ifndef THREAD - printf("thr_alarm disabled because we are not using threads\n"); -#else printf("thr_alarm disabled with DONT_USE_THR_ALARM\n"); -#endif exit(1); } -#endif /* THREAD */ +#endif /* !defined(DONT_USE_ALARM_THREAD) */ #endif /* MAIN */ diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c index d96d08ea0c3..2ab283e068d 100644 --- a/mysys/thr_lock.c +++ b/mysys/thr_lock.c @@ -74,7 +74,6 @@ one TL_WRITE_DELAYED lock at the same time as multiple read locks. #include "mysys_priv.h" -#ifdef THREAD #include "thr_lock.h" #include <m_string.h> #include <errno.h> @@ -1451,7 +1450,6 @@ void thr_print_locks(void) mysql_mutex_unlock(&THR_LOCK_lock); } -#endif /* THREAD */ /***************************************************************************** ** Test of thread locks @@ -1459,8 +1457,6 @@ void thr_print_locks(void) #ifdef MAIN -#ifdef THREAD - struct st_test { uint lock_nr; enum thr_lock_type lock_type; @@ -1689,13 +1685,4 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused))) return 0; } -#else /* THREAD */ - -int main(int argc __attribute__((unused)),char **argv __attribute__((unused))) -{ - printf("thr_lock disabled because we are not using threads\n"); - exit(1); -} - -#endif /* THREAD */ #endif /* MAIN */ diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c index 00890bc0425..37ced4f7633 100644 --- a/mysys/thr_mutex.c +++ b/mysys/thr_mutex.c @@ -19,7 +19,7 @@ #if defined(TARGET_OS_LINUX) && !defined (__USE_UNIX98) #define __USE_UNIX98 /* To get rw locks under Linux */ #endif -#if defined(THREAD) && defined(SAFE_MUTEX) +#if defined(SAFE_MUTEX) #undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */ #include "mysys_priv.h" #include "my_static.h" @@ -395,9 +395,9 @@ void safe_mutex_end(FILE *file __attribute__((unused))) #endif /* SAFE_MUTEX_DETECT_DESTROY */ } -#endif /* THREAD && SAFE_MUTEX */ +#endif /* SAFE_MUTEX */ -#if defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) +#if defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) #include "mysys_priv.h" #include "my_static.h" @@ -500,4 +500,4 @@ void fastmutex_global_init(void) #endif } -#endif /* defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) */ +#endif /* defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) */ diff --git a/mysys/thr_rwlock.c b/mysys/thr_rwlock.c index 13651221d37..bad80b43eef 100644 --- a/mysys/thr_rwlock.c +++ b/mysys/thr_rwlock.c @@ -16,7 +16,6 @@ /* Synchronization - readers / writer thread locks */ #include "mysys_priv.h" -#if defined(THREAD) #if defined(NEED_MY_RW_LOCK) #include <errno.h> @@ -471,4 +470,3 @@ int rw_pr_unlock(rw_pr_lock_t *rwlock) } -#endif /* defined(THREAD) */ diff --git a/sql-common/client.c b/sql-common/client.c index 3bb626e824a..354c04b717b 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -24,7 +24,6 @@ mysql_real_connect() - Support for reading local file with LOAD DATA LOCAL - SHARED memory handling - - Protection against sigpipe - Prepared statements - Things that only works for the server @@ -70,9 +69,9 @@ my_bool net_flush(NET *net); #include "mysqld_error.h" #include "errmsg.h" #include <violite.h> -#if defined(THREAD) && !defined(__WIN__) +#if !defined(__WIN__) #include <my_pthread.h> /* because of signal() */ -#endif /* defined(THREAD) && !defined(__WIN__) */ +#endif /* !defined(__WIN__) */ #include <sys/stat.h> #include <signal.h> @@ -287,7 +286,7 @@ static int wait_for_data(my_socket fd, uint timeout) { tv.tv_sec = (long) timeout; tv.tv_usec = 0; -#if defined(HPUX10) && defined(THREAD) +#if defined(HPUX10) if ((res = select(fd+1, NULL, (int*) &sfds, NULL, &tv)) > 0) break; #else @@ -731,13 +730,9 @@ cli_safe_read(MYSQL *mysql) { NET *net= &mysql->net; ulong len=0; - init_sigpipe_variables - /* Don't give sigpipe errors if the client doesn't want them */ - set_sigpipe(mysql); if (net->vio != 0) len=my_net_read(net); - reset_sigpipe(mysql); if (len == packet_error || len == 0) { @@ -817,13 +812,9 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command, { NET *net= &mysql->net; my_bool result= 1; - init_sigpipe_variables my_bool stmt_skip= stmt ? stmt->state != MYSQL_STMT_INIT_DONE : FALSE; DBUG_ENTER("cli_advanced_command"); - /* Don't give sigpipe errors if the client doesn't want them */ - set_sigpipe(mysql); - if (mysql->net.vio == 0) { /* Do reconnect if possible */ if (mysql_reconnect(mysql) || stmt_skip) @@ -872,7 +863,6 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command, result= ((mysql->packet_length=cli_safe_read(mysql)) == packet_error ? 1 : 0); end: - reset_sigpipe(mysql); DBUG_PRINT("exit",("result: %d", result)); DBUG_RETURN(result); } @@ -1089,14 +1079,11 @@ void end_server(MYSQL *mysql) DBUG_ENTER("end_server"); if (mysql->net.vio != 0) { - init_sigpipe_variables DBUG_PRINT("info",("Net: %s", vio_description(mysql->net.vio))); #ifdef MYSQL_SERVER slave_io_thread_detach_vio(); #endif - set_sigpipe(mysql); vio_delete(mysql->net.vio); - reset_sigpipe(mysql); mysql->net.vio= 0; /* Marker */ mysql_prune_stmt_list(mysql); } @@ -2939,7 +2926,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, #ifdef HAVE_SYS_UN_H struct sockaddr_un UNIXaddr; #endif - init_sigpipe_variables DBUG_ENTER("mysql_real_connect"); DBUG_PRINT("enter",("host: %s db: %s user: %s (client)", @@ -2954,8 +2940,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, DBUG_RETURN(0); } - /* Don't give sigpipe errors if the client doesn't want them */ - set_sigpipe(mysql); mysql->methods= &client_methods; net->vio = 0; /* If something goes wrong */ mysql->client_flag=0; /* For handshake */ @@ -3465,11 +3449,9 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, #endif DBUG_PRINT("exit", ("Mysql handler: 0x%lx", (long) mysql)); - reset_sigpipe(mysql); DBUG_RETURN(mysql); error: - reset_sigpipe(mysql); DBUG_PRINT("error",("message: %u/%s (%s)", net->last_errno, net->sqlstate, diff --git a/sql-common/client_plugin.c b/sql-common/client_plugin.c index 6114d95cd73..6b4cca8aeea 100644 --- a/sql-common/client_plugin.c +++ b/sql-common/client_plugin.c @@ -31,11 +31,7 @@ #include "mysql.h" #include <my_sys.h> #include <m_string.h> -#ifdef THREAD #include <my_pthread.h> -#else -#include <my_no_pthread.h> -#endif #include <sql_common.h> #include "errmsg.h" @@ -67,9 +63,7 @@ static uint plugin_version[MYSQL_CLIENT_MAX_PLUGINS]= loading the same plugin twice in parallel. */ struct st_client_plugin_int *plugin_list[MYSQL_CLIENT_MAX_PLUGINS]; -#ifdef THREAD static pthread_mutex_t LOCK_load_client_plugin; -#endif static int is_not_initialized(MYSQL *mysql, const char *name) { diff --git a/sql/client_settings.h b/sql/client_settings.h index ff35cff2440..2f242519ef4 100644 --- a/sql/client_settings.h +++ b/sql/client_settings.h @@ -27,9 +27,6 @@ CLIENT_SECURE_CONNECTION | CLIENT_TRANSACTIONS | \ CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION) -#define init_sigpipe_variables -#define set_sigpipe(mysql) -#define reset_sigpipe(mysql) #define read_user_name(A) {} #undef HAVE_SMEM #undef _CUSTOMCONFIG_ diff --git a/sql/filesort.cc b/sql/filesort.cc index 419f18263cc..f888206f730 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB, 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 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 @@ -33,10 +33,6 @@ #include "sql_test.h" // TEST_filesort #include "opt_range.h" // SQL_SELECT -#ifndef THREAD -#define SKIP_DBUG_IN_FILESORT -#endif - /// How to write record_ref. #define WRITE_REF(file,from) \ if (my_b_write((file),(uchar*) (from),param->ref_length)) \ diff --git a/sql/handler.cc b/sql/handler.cc index 4e8af034fd8..783e4d9ae20 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -4759,6 +4759,7 @@ int handler::ha_reset() free_io_cache(table); /* reset the bitmaps to point to defaults */ table->default_column_bitmaps(); + pushed_cond= NULL; DBUG_RETURN(reset()); } diff --git a/sql/item.h b/sql/item.h index 6d10c6a6076..d86e64eac09 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1092,11 +1092,11 @@ public: virtual bool set_no_const_sub(uchar *arg) { return FALSE; } virtual Item *replace_equal_field(uchar * arg) { return this; } /* - Check if an expression value depends on the current timezone. Used by - partitioning code to reject timezone-dependent expressions in a - (sub)partitioning function. + Check if an expression value has allowed arguments, like DATE/DATETIME + for date functions. Also used by partitioning code to reject + timezone-dependent expressions in a (sub)partitioning function. */ - virtual bool is_timezone_dependent_processor(uchar *bool_arg) + virtual bool check_valid_arguments_processor(uchar *bool_arg) { return FALSE; } @@ -1231,7 +1231,7 @@ public: maybe_null= 1; } else - max_length= max_result_length; + max_length= (uint32) max_result_length; } void fix_length_and_charset_datetime(uint32 max_char_length_arg) { diff --git a/sql/item_func.h b/sql/item_func.h index 1139442fe76..937907c9404 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -237,6 +237,7 @@ public: { return (error == E_DEC_OVERFLOW) ? raise_decimal_overflow() : error; } + bool has_timestamp_args() { DBUG_ASSERT(fixed == TRUE); @@ -248,6 +249,45 @@ public: } return FALSE; } + + bool has_date_args() + { + DBUG_ASSERT(fixed == TRUE); + for (uint i= 0; i < arg_count; i++) + { + if (args[i]->type() == Item::FIELD_ITEM && + (args[i]->field_type() == MYSQL_TYPE_DATE || + args[i]->field_type() == MYSQL_TYPE_DATETIME)) + return TRUE; + } + return FALSE; + } + + bool has_time_args() + { + DBUG_ASSERT(fixed == TRUE); + for (uint i= 0; i < arg_count; i++) + { + if (args[i]->type() == Item::FIELD_ITEM && + (args[i]->field_type() == MYSQL_TYPE_TIME || + args[i]->field_type() == MYSQL_TYPE_DATETIME)) + return TRUE; + } + return FALSE; + } + + bool has_datetime_args() + { + DBUG_ASSERT(fixed == TRUE); + for (uint i= 0; i < arg_count; i++) + { + if (args[i]->type() == Item::FIELD_ITEM && + args[i]->field_type() == MYSQL_TYPE_DATETIME) + return TRUE; + } + return FALSE; + } + /* We assume the result of any function that has a TIMESTAMP argument to be timezone-dependent, since a TIMESTAMP value in both numeric and string @@ -256,7 +296,7 @@ public: representation of a TIMESTAMP argument verbatim, and thus does not depend on the timezone. */ - virtual bool is_timezone_dependent_processor(uchar *bool_arg) + virtual bool check_valid_arguments_processor(uchar *bool_arg) { return has_timestamp_args(); } diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 9efe2a54f8b..6b54a088112 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -1116,6 +1116,7 @@ Item_in_subselect::single_value_transformer(JOIN *join, select_lex->having= join->having= and_items(join->having, item); if (join->having == item) item->name= (char*)in_having_cond; + select_lex->having->top_level_item(); select_lex->having_fix_field= 1; /* we do not check join->having->fixed, because Item_and (from and_items) diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 72a5aa0c296..622d6a76e50 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -75,6 +75,10 @@ public: enum_monotonicity_info get_monotonicity_info() const; longlong val_int_endpoint(bool left_endp, bool *incl_endp); bool check_partition_func_processor(uchar *int_arg) {return FALSE;} + bool check_valid_arguments_processor(uchar *int_arg) + { + return !has_date_args(); + } }; @@ -102,6 +106,12 @@ public: *input_version= output_version; return 0; } + + /* Only meaningful with date part and optional time part */ + bool check_valid_arguments_processor(uchar *int_arg) + { + return !has_date_args(); + } }; @@ -118,6 +128,10 @@ public: maybe_null=1; } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} + bool check_valid_arguments_processor(uchar *int_arg) + { + return !has_date_args(); + } }; @@ -142,6 +156,10 @@ public: maybe_null= 1; } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} + bool check_valid_arguments_processor(uchar *int_arg) + { + return !has_date_args(); + } }; @@ -171,6 +189,10 @@ public: maybe_null= 1; } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} + bool check_valid_arguments_processor(uchar *int_arg) + { + return !has_date_args(); + } }; @@ -187,6 +209,10 @@ public: maybe_null=1; } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} + bool check_valid_arguments_processor(uchar *int_arg) + { + return !has_time_args(); + } }; @@ -203,6 +229,10 @@ public: maybe_null=1; } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} + bool check_valid_arguments_processor(uchar *int_arg) + { + return !has_time_args(); + } }; @@ -219,6 +249,10 @@ public: maybe_null=1; } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} + bool check_valid_arguments_processor(uchar *int_arg) + { + return !has_date_args(); + } }; @@ -235,6 +269,10 @@ public: maybe_null=1; } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} + bool check_valid_arguments_processor(uchar *int_arg) + { + return !has_time_args(); + } }; @@ -265,6 +303,10 @@ public: maybe_null=1; } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} + bool check_valid_arguments_processor(uchar *int_arg) + { + return !has_date_args(); + } }; @@ -283,6 +325,10 @@ public: maybe_null=1; } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} + bool check_valid_arguments_processor(uchar *int_arg) + { + return !has_date_args(); + } }; @@ -312,6 +358,10 @@ public: maybe_null= 1; } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} + bool check_valid_arguments_processor(uchar *int_arg) + { + return !has_date_args(); + } }; class Item_func_dayname :public Item_func_weekday @@ -341,7 +391,7 @@ public: (and thus may not be used as a partitioning function) when its argument is NOT of the TIMESTAMP type. */ - bool is_timezone_dependent_processor(uchar *int_arg) + bool check_valid_arguments_processor(uchar *int_arg) { return !has_timestamp_args(); } @@ -366,6 +416,10 @@ public: max_length=10*MY_CHARSET_BIN_MB_MAXLEN; } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} + bool check_valid_arguments_processor(uchar *int_arg) + { + return !has_time_args(); + } }; @@ -621,6 +675,10 @@ public: const char *func_name() const { return "from_days"; } bool get_date(MYSQL_TIME *res, uint fuzzy_date); bool check_partition_func_processor(uchar *int_arg) {return FALSE;} + bool check_valid_arguments_processor(uchar *int_arg) + { + return has_date_args() || has_time_args(); + } }; @@ -746,6 +804,42 @@ class Item_extract :public Item_int_func bool eq(const Item *item, bool binary_cmp) const; virtual void print(String *str, enum_query_type query_type); bool check_partition_func_processor(uchar *int_arg) {return FALSE;} + bool check_valid_arguments_processor(uchar *int_arg) + { + switch (int_type) { + case INTERVAL_YEAR: + case INTERVAL_YEAR_MONTH: + case INTERVAL_QUARTER: + case INTERVAL_MONTH: + /* case INTERVAL_WEEK: Not allowed as partitioning function, bug#57071 */ + case INTERVAL_DAY: + return !has_date_args(); + case INTERVAL_DAY_HOUR: + case INTERVAL_DAY_MINUTE: + case INTERVAL_DAY_SECOND: + case INTERVAL_DAY_MICROSECOND: + return !has_datetime_args(); + case INTERVAL_HOUR: + case INTERVAL_HOUR_MINUTE: + case INTERVAL_HOUR_SECOND: + case INTERVAL_MINUTE: + case INTERVAL_MINUTE_SECOND: + case INTERVAL_SECOND: + case INTERVAL_MICROSECOND: + case INTERVAL_HOUR_MICROSECOND: + case INTERVAL_MINUTE_MICROSECOND: + case INTERVAL_SECOND_MICROSECOND: + return !has_time_args(); + default: + /* + INTERVAL_LAST is only an end marker, + INTERVAL_WEEK depends on default_week_format which is a session + variable and cannot be used for partitioning. See bug#57071. + */ + break; + } + return true; + } }; @@ -991,6 +1085,10 @@ public: maybe_null=1; } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} + bool check_valid_arguments_processor(uchar *int_arg) + { + return !has_time_args(); + } }; diff --git a/sql/log.cc b/sql/log.cc index b9be66f8ce7..7ab4b6b4a61 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -5686,80 +5686,26 @@ void sql_perror(const char *message) } -#ifdef __WIN__ +/* + Change the file associated with two output streams. Used to + redirect stdout and stderr to a file. The streams are reopened + only for appending (writing at end of file). +*/ extern "C" my_bool reopen_fstreams(const char *filename, FILE *outstream, FILE *errstream) { - int handle_fd; - int err_fd, out_fd; - HANDLE osfh; - - DBUG_ASSERT(filename && errstream); - - // Services don't have stdout/stderr on Windows, so _fileno returns -1. - err_fd= _fileno(errstream); - if (err_fd < 0) - { - if (!freopen(filename, "a+", errstream)) - return TRUE; - - setbuf(errstream, NULL); - err_fd= _fileno(errstream); - } - - if (outstream) - { - out_fd= _fileno(outstream); - if (out_fd < 0) - { - if (!freopen(filename, "a+", outstream)) - return TRUE; - out_fd= _fileno(outstream); - } - } - - if ((osfh= CreateFile(filename, GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE | - FILE_SHARE_DELETE, NULL, - OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, - NULL)) == INVALID_HANDLE_VALUE) + if (outstream && !my_freopen(filename, "a", outstream)) return TRUE; - if ((handle_fd= _open_osfhandle((intptr_t)osfh, - _O_APPEND | _O_TEXT)) == -1) - { - CloseHandle(osfh); + if (errstream && !my_freopen(filename, "a", errstream)) return TRUE; - } - if (_dup2(handle_fd, err_fd) < 0) - { - CloseHandle(osfh); - return TRUE; - } - - if (outstream && _dup2(handle_fd, out_fd) < 0) - { - CloseHandle(osfh); - return TRUE; - } - - _close(handle_fd); - return FALSE; -} -#else -extern "C" my_bool reopen_fstreams(const char *filename, - FILE *outstream, FILE *errstream) -{ - if (outstream && !freopen(filename, "a+", outstream)) - return TRUE; - - if (errstream && !freopen(filename, "a+", errstream)) - return TRUE; + /* The error stream must be unbuffered. */ + if (errstream) + setbuf(errstream, NULL); return FALSE; } -#endif /* diff --git a/sql/net_serv.cc b/sql/net_serv.cc index ab88e87be69..d60e2051ccd 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -164,17 +164,7 @@ my_bool net_realloc(NET *net, size_t length) DBUG_ENTER("net_realloc"); DBUG_PRINT("enter",("length: %lu", (ulong) length)); - /* - When compression is off, net->where_b is always 0. - With compression turned on, net->where_b may indicate - that we still have a piece of the previous logical - packet in the buffer, unprocessed. Take it into account - when checking that max_allowed_packet is not exceeded. - This ensures that the client treats max_allowed_packet - limit identically, regardless of compression being on - or off. - */ - if (length >= (net->max_packet_size + net->where_b)) + if (length >= net->max_packet_size) { DBUG_PRINT("error", ("Packet too large. Max size: %lu", net->max_packet_size)); diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index f648d219fac..eb6853751ee 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved. 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 @@ -728,7 +728,7 @@ send_result_message: protocol->store(operator_name, system_charset_info); if (result_code) // either mysql_recreate_table or analyze failed { - DBUG_ASSERT(thd->is_error()); + DBUG_ASSERT(thd->is_error() || thd->killed); if (thd->is_error()) { const char *err_msg= thd->stmt_da->message(); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 9d75af5734a..ab8dfd54768 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -3068,6 +3068,11 @@ retry_share: table->reginfo.lock_type=TL_READ; /* Assume read */ reset: + /* + Check that there is no reference to a condtion from an earlier query + (cf. Bug#58553). + */ + DBUG_ASSERT(table->file->pushed_cond == NULL); table_list->updatable= 1; // It is not derived table nor non-updatable VIEW table_list->table= table; diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index cec047d11fc..0b4f956dd7f 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -1130,12 +1130,13 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table, } /* - We don't allow creating partitions with timezone-dependent expressions as - a (sub)partitioning function, but we want to allow such expressions when - opening existing tables for easier maintenance. This exception should be - deprecated at some point in future so that we always throw an error. + We don't allow creating partitions with expressions with non matching + arguments as a (sub)partitioning function, + but we want to allow such expressions when opening existing tables for + easier maintenance. This exception should be deprecated at some point + in future so that we always throw an error. */ - if (func_expr->walk(&Item::is_timezone_dependent_processor, + if (func_expr->walk(&Item::check_valid_arguments_processor, 0, NULL)) { if (is_create_table_ind) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index fc25e8ee0fa..91ce31636b4 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -6476,7 +6476,6 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) tab->select_cond=sel->cond=tmp; /* Push condition to storage engine if this is enabled and the condition is not guarded */ - tab->table->file->pushed_cond= NULL; if (thd->variables.optimizer_switch & OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) { @@ -10043,7 +10042,12 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, convert_blob_length); if (orig_type == Item::REF_ITEM && orig_modify) ((Item_ref*)orig_item)->set_result_field(result); - if (field->field->eq_def(result)) + /* + Fields that are used as arguments to the DEFAULT() function already have + their data pointers set to the default value during name resulotion. See + Item_default_value::fix_fields. + */ + if (orig_type != Item::DEFAULT_VALUE_ITEM && field->field->eq_def(result)) *default_field= field->field; return result; } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 772496a10d5..064c2b36e17 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -371,7 +371,11 @@ uint explain_filename(THD* thd, Table name length. */ -uint filename_to_tablename(const char *from, char *to, uint to_length) +uint filename_to_tablename(const char *from, char *to, uint to_length +#ifndef DBUG_OFF + , bool stay_quiet +#endif /* DBUG_OFF */ + ) { uint errors; size_t res; @@ -391,7 +395,13 @@ uint filename_to_tablename(const char *from, char *to, uint to_length) { res= (strxnmov(to, to_length, MYSQL50_TABLE_NAME_PREFIX, from, NullS) - to); - sql_print_error("Invalid (old?) table or database name '%s'", from); +#ifndef DBUG_OFF + if (!stay_quiet) { +#endif /* DBUG_OFF */ + sql_print_error("Invalid (old?) table or database name '%s'", from); +#ifndef DBUG_OFF + } +#endif /* DBUG_OFF */ /* TODO: add a stored procedure for fix table and database names, and mention its name in error log. diff --git a/sql/sql_table.h b/sql/sql_table.h index aa5738fd4c9..2924301e6b3 100644 --- a/sql/sql_table.h +++ b/sql/sql_table.h @@ -123,7 +123,11 @@ enum enum_explain_filename_mode #define NO_FRM_RENAME (1 << 2) #define FRM_ONLY (1 << 3) -uint filename_to_tablename(const char *from, char *to, uint to_length); +uint filename_to_tablename(const char *from, char *to, uint to_length +#ifndef DBUG_OFF + , bool stay_quiet = false +#endif /* DBUG_OFF */ + ); 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); bool check_mysql50_prefix(const char *name); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 9aa938437b1..397afd26d8d 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -9396,7 +9396,7 @@ table_factor: ; select_derived_union: - select_derived opt_order_clause opt_limit_clause + select_derived opt_union_order_or_limit | select_derived_union UNION_SYM union_option @@ -9412,7 +9412,7 @@ select_derived_union: */ Lex->pop_context(); } - opt_order_clause opt_limit_clause + opt_union_order_or_limit ; /* The equivalent of select_init2 for nested queries. */ @@ -13862,6 +13862,11 @@ union_opt: | union_order_or_limit { $$= 1; } ; +opt_union_order_or_limit: + /* Empty */ + | union_order_or_limit + ; + union_order_or_limit: { THD *thd= YYTHD; @@ -13909,7 +13914,7 @@ query_specification: ; query_expression_body: - query_specification + query_specification opt_union_order_or_limit | query_expression_body UNION_SYM union_option { @@ -13917,6 +13922,7 @@ query_expression_body: MYSQL_YYABORT; } query_specification + opt_union_order_or_limit { Lex->pop_context(); $$= $1; diff --git a/sql/table.cc b/sql/table.cc index 8cd2e9e9bab..fae044f334a 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1963,8 +1963,8 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, { if (work_part_info_used) tmp= fix_partition_func(thd, outparam, is_create_table); - outparam->part_info->item_free_list= part_func_arena.free_list; } + outparam->part_info->item_free_list= part_func_arena.free_list; partititon_err: if (tmp) { diff --git a/storage/heap/heapdef.h b/storage/heap/heapdef.h index bc3c6bf7239..87866678c2f 100644 --- a/storage/heap/heapdef.h +++ b/storage/heap/heapdef.h @@ -17,9 +17,7 @@ #include <my_base.h> /* This includes global */ C_MODE_START -#ifdef THREAD #include <my_pthread.h> -#endif #include "heap.h" /* Structs & some defines */ #include "my_tree.h" @@ -102,14 +100,11 @@ extern void hp_clear(HP_SHARE *info); extern void hp_clear_keys(HP_SHARE *info); extern uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, key_part_map keypart_map); -#ifdef THREAD + extern mysql_mutex_t THR_LOCK_heap; -#endif #ifdef HAVE_PSI_INTERFACE -#ifdef THREAD extern PSI_mutex_key hp_key_mutex_HP_SHARE_intern_lock; -#endif /* THREAD */ void init_heap_psi_keys(); #endif /* HAVE_PSI_INTERFACE */ diff --git a/storage/heap/hp_block.c b/storage/heap/hp_block.c index 7f6cc1ef90a..41391fba060 100644 --- a/storage/heap/hp_block.c +++ b/storage/heap/hp_block.c @@ -86,7 +86,6 @@ int hp_get_new_block(HP_BLOCK *block, size_t *alloc_length) } else { - dont_break(); /* Dont allow SIGHUP or SIGINT */ if ((uint) i == block->levels) { /* Adding a new level on top of the existing ones. */ @@ -117,7 +116,6 @@ int hp_get_new_block(HP_BLOCK *block, size_t *alloc_length) allocated bytes. Use it as a leaf block. */ block->level_info[0].last_blocks= root; - allow_break(); /* Allow SIGHUP & SIGINT */ } return 0; } diff --git a/storage/heap/hp_create.c b/storage/heap/hp_create.c index bbf649c5e46..67fe0b3136f 100644 --- a/storage/heap/hp_create.c +++ b/storage/heap/hp_create.c @@ -192,11 +192,9 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info, my_free(share); goto err; } -#ifdef THREAD thr_lock_init(&share->lock); mysql_mutex_init(hp_key_mutex_HP_SHARE_intern_lock, &share->intern_lock, MY_MUTEX_INIT_FAST); -#endif if (!create_info->internal_table) { share->open_list.data= (void*) share; @@ -301,10 +299,8 @@ void hp_free(HP_SHARE *share) if (share->open_list.data) /* If not internal table */ heap_share_list= list_delete(heap_share_list, &share->open_list); hp_clear(share); /* Remove blocks from memory */ -#ifdef THREAD thr_lock_delete(&share->lock); mysql_mutex_destroy(&share->intern_lock); -#endif my_free(share->name); my_free(share); return; diff --git a/storage/heap/hp_open.c b/storage/heap/hp_open.c index 12d9bfe1ed3..5ac4da22e0a 100644 --- a/storage/heap/hp_open.c +++ b/storage/heap/hp_open.c @@ -37,9 +37,7 @@ HP_INFO *heap_open_from_share(HP_SHARE *share, int mode) DBUG_RETURN(0); } share->open_count++; -#ifdef THREAD thr_lock_data_init(&share->lock,&info->lock,NULL); -#endif info->s= share; info->lastkey= (uchar*) (info + 1); info->recbuf= (uchar*) (info->lastkey + share->max_key_length); diff --git a/storage/heap/hp_static.c b/storage/heap/hp_static.c index e1ca7d1f445..a58ecb8b754 100644 --- a/storage/heap/hp_static.c +++ b/storage/heap/hp_static.c @@ -25,7 +25,6 @@ LIST *heap_open_list=0,*heap_share_list=0; #ifdef HAVE_PSI_INTERFACE -#ifdef THREAD PSI_mutex_key hp_key_mutex_HP_SHARE_intern_lock; static PSI_mutex_info all_heap_mutexes[]= @@ -36,11 +35,9 @@ static PSI_mutex_info all_heap_mutexes[]= THR_LOCK_heap is part of mysys, not storage/heap. */ }; -#endif /* THREAD */ void init_heap_psi_keys() { -#ifdef THREAD const char* category= "memory"; int count; @@ -49,7 +46,6 @@ void init_heap_psi_keys() count= array_elements(all_heap_mutexes); PSI_server->register_mutex(category, all_heap_mutexes, count); -#endif /* THREAD */ } #endif /* HAVE_PSI_INTERFACE */ diff --git a/storage/heap/hp_test2.c b/storage/heap/hp_test2.c index 3ee903be7ed..af388867c3c 100644 --- a/storage/heap/hp_test2.c +++ b/storage/heap/hp_test2.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000-2003, 2006 MySQL AB +/* Copyright (C) 2000, 2011, Oracle and/or its affiliates. All rights + reserved 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 @@ -656,11 +657,6 @@ static int rnd(int max_value) static sig_handler endprog(int sig_number __attribute__((unused))) { -#ifndef THREAD - if (my_dont_interrupt) - my_remember_signal(sig_number,endprog); - else -#endif { hp_panic(HA_PANIC_CLOSE); my_end(1); diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index fa45cc96687..4bbda0d2477 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -40,10 +40,9 @@ IF(UNIX) ENDIF() ENDIF() -# Enable InnoDB's UNIV_DEBUG if MySQL's WITH_DEBUG is defined -IF(WITH_DEBUG) - ADD_DEFINITIONS("-DUNIV_DEBUG") -ENDIF() +# Enable InnoDB's UNIV_DEBUG for debug builds +SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DUNIV_DEBUG") +SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG") IF(NOT MSVC) # either define HAVE_IB_GCC_ATOMIC_BUILTINS or not @@ -190,7 +189,7 @@ IF(SIZEOF_PTHREAD_T) ENDIF() IF(MSVC) - ADD_DEFINITIONS(-DHAVE_WINDOWS_ATOMICS -DHAVE_IB_PAUSE_INSTRUCTION) + ADD_DEFINITIONS(-DHAVE_WINDOWS_ATOMICS) ENDIF() diff --git a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c index 06cfdf5a798..ff82372b52b 100644 --- a/storage/innobase/btr/btr0btr.c +++ b/storage/innobase/btr/btr0btr.c @@ -664,7 +664,7 @@ btr_page_get_father_node_ptr_func( " to fix the\n" "InnoDB: corruption. If the crash happens at " "the database startup, see\n" - "InnoDB: " REFMAN "forcing-recovery.html about\n" + "InnoDB: " REFMAN "forcing-innodb-recovery.html about\n" "InnoDB: forcing recovery. " "Then dump + drop + reimport.\n", stderr); diff --git a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c index 27f05da6f28..a5ed1964b2e 100644 --- a/storage/innobase/btr/btr0cur.c +++ b/storage/innobase/btr/btr0cur.c @@ -1874,7 +1874,8 @@ btr_cur_update_in_place( NOT call it if index is secondary */ if (!dict_index_is_clust(index) - || row_upd_changes_ord_field_binary(NULL, index, update)) { + || row_upd_changes_ord_field_binary(NULL, NULL, + index, update)) { /* Remove possible hash index pointer to this record */ btr_search_update_hash_on_delete(cursor); @@ -2626,27 +2627,24 @@ ulint btr_cur_del_mark_set_clust_rec( /*===========================*/ ulint flags, /*!< in: undo logging and locking flags */ - btr_cur_t* cursor, /*!< in: cursor */ + buf_block_t* block, /*!< in/out: buffer block of the record */ + rec_t* rec, /*!< in/out: record */ + dict_index_t* index, /*!< in: clustered index of the record */ + const ulint* offsets,/*!< in: rec_get_offsets(rec) */ ibool val, /*!< in: value to set */ que_thr_t* thr, /*!< in: query thread */ mtr_t* mtr) /*!< in: mtr */ { - dict_index_t* index; - buf_block_t* block; roll_ptr_t roll_ptr; ulint err; - rec_t* rec; page_zip_des_t* page_zip; trx_t* trx; - mem_heap_t* heap = NULL; - ulint offsets_[REC_OFFS_NORMAL_SIZE]; - ulint* offsets = offsets_; - rec_offs_init(offsets_); - rec = btr_cur_get_rec(cursor); - index = cursor->index; + ut_ad(dict_index_is_clust(index)); + ut_ad(rec_offs_validate(rec, index, offsets)); ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table)); - offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap); + ut_ad(buf_block_get_frame(block) == page_align(rec)); + ut_ad(page_is_leaf(page_align(rec))); #ifdef UNIV_DEBUG if (btr_cur_print_record_ops && thr) { @@ -2658,13 +2656,12 @@ btr_cur_del_mark_set_clust_rec( ut_ad(dict_index_is_clust(index)); ut_ad(!rec_get_deleted_flag(rec, rec_offs_comp(offsets))); - err = lock_clust_rec_modify_check_and_lock(flags, - btr_cur_get_block(cursor), + err = lock_clust_rec_modify_check_and_lock(flags, block, rec, index, offsets, thr); if (err != DB_SUCCESS) { - goto func_exit; + return(err); } err = trx_undo_report_row_operation(flags, TRX_UNDO_MODIFY_OP, thr, @@ -2672,11 +2669,9 @@ btr_cur_del_mark_set_clust_rec( &roll_ptr); if (err != DB_SUCCESS) { - goto func_exit; + return(err); } - block = btr_cur_get_block(cursor); - if (block->is_hashed) { rw_lock_x_lock(&btr_search_latch); } @@ -2699,10 +2694,6 @@ btr_cur_del_mark_set_clust_rec( btr_cur_del_mark_set_clust_rec_log(flags, rec, index, val, trx, roll_ptr, mtr); -func_exit: - if (UNIV_LIKELY_NULL(heap)) { - mem_heap_free(heap); - } return(err); } @@ -3754,107 +3745,35 @@ btr_cur_set_ownership_of_extern_field( } /*******************************************************************//** -Marks not updated extern fields as not-owned by this record. The ownership -is transferred to the updated record which is inserted elsewhere in the +Marks non-updated off-page fields as disowned by this record. The ownership +must be transferred to the updated record which is inserted elsewhere in the index tree. In purge only the owner of externally stored field is allowed -to free the field. -@return TRUE if BLOB ownership was transferred */ +to free the field. */ UNIV_INTERN -ibool -btr_cur_mark_extern_inherited_fields( -/*=================================*/ +void +btr_cur_disown_inherited_fields( +/*============================*/ page_zip_des_t* page_zip,/*!< in/out: compressed page whose uncompressed part will be updated, or NULL */ rec_t* rec, /*!< in/out: record in a clustered index */ dict_index_t* index, /*!< in: index of the page */ const ulint* offsets,/*!< in: array returned by rec_get_offsets() */ const upd_t* update, /*!< in: update vector */ - mtr_t* mtr) /*!< in: mtr, or NULL if not logged */ + mtr_t* mtr) /*!< in/out: mini-transaction */ { - ulint n; - ulint j; ulint i; - ibool change_ownership = FALSE; - ut_ad(rec_offs_validate(rec, NULL, offsets)); + ut_ad(rec_offs_validate(rec, index, offsets)); ut_ad(!rec_offs_comp(offsets) || !rec_get_node_ptr_flag(rec)); + ut_ad(rec_offs_any_extern(offsets)); + ut_ad(mtr); - if (!rec_offs_any_extern(offsets)) { - - return(FALSE); - } - - n = rec_offs_n_fields(offsets); - - for (i = 0; i < n; i++) { - if (rec_offs_nth_extern(offsets, i)) { - - /* Check it is not in updated fields */ - - if (update) { - for (j = 0; j < upd_get_n_fields(update); - j++) { - if (upd_get_nth_field(update, j) - ->field_no == i) { - - goto updated; - } - } - } - + for (i = 0; i < rec_offs_n_fields(offsets); i++) { + if (rec_offs_nth_extern(offsets, i) + && !upd_get_field_by_field_no(update, i)) { btr_cur_set_ownership_of_extern_field( page_zip, rec, index, offsets, i, FALSE, mtr); - - change_ownership = TRUE; -updated: - ; - } - } - - return(change_ownership); -} - -/*******************************************************************//** -The complement of the previous function: in an update entry may inherit -some externally stored fields from a record. We must mark them as inherited -in entry, so that they are not freed in a rollback. */ -UNIV_INTERN -void -btr_cur_mark_dtuple_inherited_extern( -/*=================================*/ - dtuple_t* entry, /*!< in/out: updated entry to be - inserted to clustered index */ - const upd_t* update) /*!< in: update vector */ -{ - ulint i; - - for (i = 0; i < dtuple_get_n_fields(entry); i++) { - - dfield_t* dfield = dtuple_get_nth_field(entry, i); - byte* data; - ulint len; - ulint j; - - if (!dfield_is_ext(dfield)) { - continue; - } - - /* Check if it is in updated fields */ - - for (j = 0; j < upd_get_n_fields(update); j++) { - if (upd_get_nth_field(update, j)->field_no == i) { - - goto is_updated; - } } - - data = dfield_get_data(dfield); - len = dfield_get_len(dfield); - data[len - BTR_EXTERN_FIELD_REF_SIZE + BTR_EXTERN_LEN] - |= BTR_EXTERN_INHERITED_FLAG; - -is_updated: - ; } } @@ -3894,29 +3813,6 @@ btr_cur_unmark_extern_fields( } /*******************************************************************//** -Marks all extern fields in a dtuple as owned by the record. */ -UNIV_INTERN -void -btr_cur_unmark_dtuple_extern_fields( -/*================================*/ - dtuple_t* entry) /*!< in/out: clustered index entry */ -{ - ulint i; - - for (i = 0; i < dtuple_get_n_fields(entry); i++) { - dfield_t* dfield = dtuple_get_nth_field(entry, i); - - if (dfield_is_ext(dfield)) { - byte* data = dfield_get_data(dfield); - ulint len = dfield_get_len(dfield); - - data[len - BTR_EXTERN_FIELD_REF_SIZE + BTR_EXTERN_LEN] - &= ~BTR_EXTERN_OWNER_FLAG; - } - } -} - -/*******************************************************************//** Flags the data tuple fields that are marked as extern storage in the update vector. We use this function to remember which fields we must mark as extern storage in a record inserted for an update. diff --git a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c index 0fd518ac6a4..af4b747eb30 100644 --- a/storage/innobase/buf/buf0buf.c +++ b/storage/innobase/buf/buf0buf.c @@ -536,7 +536,7 @@ buf_page_is_corrupted( "you may have copied the InnoDB\n" "InnoDB: tablespace but not the InnoDB " "log files. See\n" - "InnoDB: " REFMAN "forcing-recovery.html\n" + "InnoDB: " REFMAN "forcing-innodb-recovery.html\n" "InnoDB: for more information.\n", (ulong) mach_read_from_4(read_buf + FIL_PAGE_OFFSET), @@ -2742,7 +2742,8 @@ buf_page_get_gen( ut_ad(zip_size == fil_space_get_zip_size(space)); ut_ad(ut_is_2pow(zip_size)); #ifndef UNIV_LOG_DEBUG - ut_ad(!ibuf_inside(mtr) || ibuf_page(space, zip_size, offset, NULL)); + ut_ad(!ibuf_inside(mtr) || ibuf_page_low(space, zip_size, offset, + FALSE, file, line, NULL)); #endif buf_pool->stat.n_page_gets++; fold = buf_page_address_fold(space, offset); @@ -4036,7 +4037,7 @@ corrupt: "InnoDB: TABLE to scan your" " table for corruption.\n" "InnoDB: See also " - REFMAN "forcing-recovery.html\n" + REFMAN "forcing-innodb-recovery.html\n" "InnoDB: about forcing recovery.\n", stderr); if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) { @@ -4791,23 +4792,203 @@ buf_get_modified_ratio_pct(void) return(ratio); } +/*******************************************************************//** +Aggregates a pool stats information with the total buffer pool stats */ +static +void +buf_stats_aggregate_pool_info( +/*==========================*/ + buf_pool_info_t* total_info, /*!< in/out: the buffer pool + info to store aggregated + result */ + const buf_pool_info_t* pool_info) /*!< in: individual buffer pool + stats info */ +{ + ut_a(total_info && pool_info); + + /* Nothing to copy if total_info is the same as pool_info */ + if (total_info == pool_info) { + return; + } + + total_info->pool_size += pool_info->pool_size; + total_info->lru_len += pool_info->lru_len; + total_info->old_lru_len += pool_info->old_lru_len; + total_info->free_list_len += pool_info->free_list_len; + total_info->flush_list_len += pool_info->flush_list_len; + total_info->n_pend_unzip += pool_info->n_pend_unzip; + total_info->n_pend_reads += pool_info->n_pend_reads; + total_info->n_pending_flush_lru += pool_info->n_pending_flush_lru; + total_info->n_pending_flush_list += pool_info->n_pending_flush_list; + total_info->n_pending_flush_single_page += + pool_info->n_pending_flush_single_page; + total_info->n_pages_made_young += pool_info->n_pages_made_young; + total_info->n_pages_not_made_young += pool_info->n_pages_not_made_young; + total_info->n_pages_read += pool_info->n_pages_read; + total_info->n_pages_created += pool_info->n_pages_created; + total_info->n_pages_written += pool_info->n_pages_written; + total_info->n_page_gets += pool_info->n_page_gets; + total_info->n_ra_pages_read += pool_info->n_ra_pages_read; + total_info->n_ra_pages_evicted += pool_info->n_ra_pages_evicted; + total_info->page_made_young_rate += pool_info->page_made_young_rate; + total_info->page_not_made_young_rate += + pool_info->page_not_made_young_rate; + total_info->pages_read_rate += pool_info->pages_read_rate; + total_info->pages_created_rate += pool_info->pages_created_rate; + total_info->pages_written_rate += pool_info->pages_written_rate; + total_info->n_page_get_delta += pool_info->n_page_get_delta; + total_info->page_read_delta += pool_info->page_read_delta; + total_info->young_making_delta += pool_info->young_making_delta; + total_info->not_young_making_delta += pool_info->not_young_making_delta; + total_info->pages_readahead_rate += pool_info->pages_readahead_rate; + total_info->pages_evicted_rate += pool_info->pages_evicted_rate; + total_info->unzip_lru_len += pool_info->unzip_lru_len; + total_info->io_sum += pool_info->io_sum; + total_info->io_cur += pool_info->io_cur; + total_info->unzip_sum += pool_info->unzip_sum; + total_info->unzip_cur += pool_info->unzip_cur; +} +/*******************************************************************//** +Collect buffer pool stats information for a buffer pool. Also +record aggregated stats if there are more than one buffer pool +in the server */ +static +void +buf_stats_get_pool_info( +/*====================*/ + buf_pool_t* buf_pool, /*!< in: buffer pool */ + ulint pool_id, /*!< in: buffer pool ID */ + buf_pool_info_t* all_pool_info) /*!< in/out: buffer pool info + to fill */ +{ + buf_pool_info_t* pool_info; + time_t current_time; + double time_elapsed; + + /* Find appropriate pool_info to store stats for this buffer pool */ + pool_info = &all_pool_info[pool_id]; + + buf_pool_mutex_enter(buf_pool); + buf_flush_list_mutex_enter(buf_pool); + + pool_info->pool_unique_id = pool_id; + + pool_info->pool_size = buf_pool->curr_size; + + pool_info->lru_len = UT_LIST_GET_LEN(buf_pool->LRU); + + pool_info->old_lru_len = buf_pool->LRU_old_len; + + pool_info->free_list_len = UT_LIST_GET_LEN(buf_pool->free); + + pool_info->flush_list_len = UT_LIST_GET_LEN(buf_pool->flush_list); + + pool_info->n_pend_unzip = UT_LIST_GET_LEN(buf_pool->unzip_LRU); + + pool_info->n_pend_reads = buf_pool->n_pend_reads; + + pool_info->n_pending_flush_lru = + (buf_pool->n_flush[BUF_FLUSH_LRU] + + buf_pool->init_flush[BUF_FLUSH_LRU]); + + pool_info->n_pending_flush_list = + (buf_pool->n_flush[BUF_FLUSH_LIST] + + buf_pool->init_flush[BUF_FLUSH_LIST]); + + pool_info->n_pending_flush_single_page = + buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]; + + buf_flush_list_mutex_exit(buf_pool); + + current_time = time(NULL); + time_elapsed = 0.001 + difftime(current_time, + buf_pool->last_printout_time); + + pool_info->n_pages_made_young = buf_pool->stat.n_pages_made_young; + + pool_info->n_pages_not_made_young = + buf_pool->stat.n_pages_not_made_young; + + pool_info->n_pages_read = buf_pool->stat.n_pages_read; + + pool_info->n_pages_created = buf_pool->stat.n_pages_created; + + pool_info->n_pages_written = buf_pool->stat.n_pages_written; + + pool_info->n_page_gets = buf_pool->stat.n_page_gets; + + pool_info->n_ra_pages_read = buf_pool->stat.n_ra_pages_read; + + pool_info->n_ra_pages_evicted = buf_pool->stat.n_ra_pages_evicted; + + pool_info->page_made_young_rate = + (buf_pool->stat.n_pages_made_young + - buf_pool->old_stat.n_pages_made_young) / time_elapsed; + + pool_info->page_not_made_young_rate = + (buf_pool->stat.n_pages_not_made_young + - buf_pool->old_stat.n_pages_not_made_young) / time_elapsed; + + pool_info->pages_read_rate = + (buf_pool->stat.n_pages_read + - buf_pool->old_stat.n_pages_read) / time_elapsed; + + pool_info->pages_created_rate = + (buf_pool->stat.n_pages_created + - buf_pool->old_stat.n_pages_created) / time_elapsed; + + pool_info->pages_written_rate = + (buf_pool->stat.n_pages_written + - buf_pool->old_stat.n_pages_written) / time_elapsed; + + pool_info->n_page_get_delta = buf_pool->stat.n_page_gets + - buf_pool->old_stat.n_page_gets; + + if (pool_info->n_page_get_delta) { + pool_info->page_read_delta = buf_pool->stat.n_pages_read + - buf_pool->old_stat.n_pages_read; + + pool_info->young_making_delta = + buf_pool->stat.n_pages_made_young + - buf_pool->old_stat.n_pages_made_young; + + pool_info->not_young_making_delta = + buf_pool->stat.n_pages_not_made_young + - buf_pool->old_stat.n_pages_not_made_young; + } + + pool_info->pages_readahead_rate = + (buf_pool->stat.n_ra_pages_read + - buf_pool->old_stat.n_ra_pages_read) / time_elapsed; + + pool_info->pages_evicted_rate = + (buf_pool->stat.n_ra_pages_evicted + - buf_pool->old_stat.n_ra_pages_evicted) / time_elapsed; + + pool_info->unzip_lru_len = UT_LIST_GET_LEN(buf_pool->unzip_LRU); + + pool_info->io_sum = buf_LRU_stat_sum.io; + + pool_info->io_cur = buf_LRU_stat_cur.io; + + pool_info->unzip_sum = buf_LRU_stat_sum.unzip; + + pool_info->unzip_cur = buf_LRU_stat_cur.unzip; + + buf_refresh_io_stats(buf_pool); + buf_pool_mutex_exit(buf_pool); +} + /*********************************************************************//** Prints info of the buffer i/o. */ UNIV_INTERN void buf_print_io_instance( /*==================*/ - buf_pool_t* buf_pool, /*!< in: buffer pool instance */ + buf_pool_info_t*pool_info, /*!< in: buffer pool info */ FILE* file) /*!< in/out: buffer where to print */ { - time_t current_time; - double time_elapsed; - ulint n_gets_diff; - - ut_ad(buf_pool); - - buf_pool_mutex_enter(buf_pool); - buf_flush_list_mutex_enter(buf_pool); + ut_ad(pool_info); fprintf(file, "Buffer pool size %lu\n" @@ -4817,70 +4998,42 @@ buf_print_io_instance( "Modified db pages %lu\n" "Pending reads %lu\n" "Pending writes: LRU %lu, flush list %lu, single page %lu\n", - (ulong) buf_pool->curr_size, - (ulong) UT_LIST_GET_LEN(buf_pool->free), - (ulong) UT_LIST_GET_LEN(buf_pool->LRU), - (ulong) buf_pool->LRU_old_len, - (ulong) UT_LIST_GET_LEN(buf_pool->flush_list), - (ulong) buf_pool->n_pend_reads, - (ulong) buf_pool->n_flush[BUF_FLUSH_LRU] - + buf_pool->init_flush[BUF_FLUSH_LRU], - (ulong) buf_pool->n_flush[BUF_FLUSH_LIST] - + buf_pool->init_flush[BUF_FLUSH_LIST], - (ulong) buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]); - - buf_flush_list_mutex_exit(buf_pool); - - current_time = time(NULL); - time_elapsed = 0.001 + difftime(current_time, - buf_pool->last_printout_time); + pool_info->pool_size, + pool_info->free_list_len, + pool_info->lru_len, + pool_info->old_lru_len, + pool_info->flush_list_len, + pool_info->n_pend_reads, + pool_info->n_pending_flush_lru, + pool_info->n_pending_flush_list, + pool_info->n_pending_flush_single_page); fprintf(file, "Pages made young %lu, not young %lu\n" "%.2f youngs/s, %.2f non-youngs/s\n" "Pages read %lu, created %lu, written %lu\n" "%.2f reads/s, %.2f creates/s, %.2f writes/s\n", - (ulong) buf_pool->stat.n_pages_made_young, - (ulong) buf_pool->stat.n_pages_not_made_young, - (buf_pool->stat.n_pages_made_young - - buf_pool->old_stat.n_pages_made_young) - / time_elapsed, - (buf_pool->stat.n_pages_not_made_young - - buf_pool->old_stat.n_pages_not_made_young) - / time_elapsed, - (ulong) buf_pool->stat.n_pages_read, - (ulong) buf_pool->stat.n_pages_created, - (ulong) buf_pool->stat.n_pages_written, - (buf_pool->stat.n_pages_read - - buf_pool->old_stat.n_pages_read) - / time_elapsed, - (buf_pool->stat.n_pages_created - - buf_pool->old_stat.n_pages_created) - / time_elapsed, - (buf_pool->stat.n_pages_written - - buf_pool->old_stat.n_pages_written) - / time_elapsed); - - n_gets_diff = buf_pool->stat.n_page_gets - - buf_pool->old_stat.n_page_gets; - - if (n_gets_diff) { + pool_info->n_pages_made_young, + pool_info->n_pages_not_made_young, + pool_info->page_made_young_rate, + pool_info->page_not_made_young_rate, + pool_info->n_pages_read, + pool_info->n_pages_created, + pool_info->n_pages_written, + pool_info->pages_read_rate, + pool_info->pages_created_rate, + pool_info->pages_written_rate); + + if (pool_info->n_page_get_delta) { fprintf(file, "Buffer pool hit rate %lu / 1000," " young-making rate %lu / 1000 not %lu / 1000\n", - (ulong) - (1000 - ((1000 * (buf_pool->stat.n_pages_read - - buf_pool->old_stat.n_pages_read)) - / (buf_pool->stat.n_page_gets - - buf_pool->old_stat.n_page_gets))), - (ulong) - (1000 * (buf_pool->stat.n_pages_made_young - - buf_pool->old_stat.n_pages_made_young) - / n_gets_diff), - (ulong) - (1000 * (buf_pool->stat.n_pages_not_made_young - - buf_pool->old_stat.n_pages_not_made_young) - / n_gets_diff)); + (ulong) (1000 - (1000 * pool_info->page_read_delta + / pool_info->n_page_get_delta)), + (ulong) (1000 * pool_info->young_making_delta + / pool_info->n_page_get_delta), + (ulong) (1000 * pool_info->not_young_making_delta + / pool_info->n_page_get_delta)); } else { fputs("No buffer pool page gets since the last printout\n", file); @@ -4889,25 +5042,17 @@ buf_print_io_instance( /* Statistics about read ahead algorithm */ fprintf(file, "Pages read ahead %.2f/s," " evicted without access %.2f/s\n", - (buf_pool->stat.n_ra_pages_read - - buf_pool->old_stat.n_ra_pages_read) - / time_elapsed, - (buf_pool->stat.n_ra_pages_evicted - - buf_pool->old_stat.n_ra_pages_evicted) - / time_elapsed); + pool_info->pages_readahead_rate, + pool_info->pages_evicted_rate); /* Print some values to help us with visualizing what is happening with LRU eviction. */ fprintf(file, "LRU len: %lu, unzip_LRU len: %lu\n" "I/O sum[%lu]:cur[%lu], unzip sum[%lu]:cur[%lu]\n", - UT_LIST_GET_LEN(buf_pool->LRU), - UT_LIST_GET_LEN(buf_pool->unzip_LRU), - buf_LRU_stat_sum.io, buf_LRU_stat_cur.io, - buf_LRU_stat_sum.unzip, buf_LRU_stat_cur.unzip); - - buf_refresh_io_stats(buf_pool); - buf_pool_mutex_exit(buf_pool); + pool_info->lru_len, pool_info->unzip_lru_len, + pool_info->io_sum, pool_info->io_cur, + pool_info->unzip_sum, pool_info->unzip_cur); } /*********************************************************************//** @@ -4918,14 +5063,58 @@ buf_print_io( /*=========*/ FILE* file) /*!< in/out: buffer where to print */ { - ulint i; + ulint i; + buf_pool_info_t* pool_info; + buf_pool_info_t* pool_info_total; + + /* If srv_buf_pool_instances is greater than 1, allocate + one extra buf_pool_info_t, the last one stores + aggregated/total values from all pools */ + if (srv_buf_pool_instances > 1) { + pool_info = (buf_pool_info_t*) mem_zalloc(( + srv_buf_pool_instances + 1) * sizeof *pool_info); + + pool_info_total = &pool_info[srv_buf_pool_instances]; + } else { + ut_a(srv_buf_pool_instances == 1); + pool_info_total = pool_info = (buf_pool_info_t*) mem_zalloc( + sizeof *pool_info) + } for (i = 0; i < srv_buf_pool_instances; i++) { buf_pool_t* buf_pool; buf_pool = buf_pool_from_array(i); - buf_print_io_instance(buf_pool, file); + + /* Fetch individual buffer pool info and calculate + aggregated stats along the way */ + buf_stats_get_pool_info(buf_pool, i, pool_info); + + /* If we have more than one buffer pool, store + the aggregated stats */ + if (srv_buf_pool_instances > 1) { + buf_stats_aggregate_pool_info(pool_info_total, + &pool_info[i]); + } } + + /* Print the aggreate buffer pool info */ + buf_print_io_instance(pool_info_total, file); + + /* If there are more than one buffer pool, print each individual pool + info */ + if (srv_buf_pool_instances > 1) { + fputs("----------------------\n" + "INDIVIDUAL BUFFER POOL INFO\n" + "----------------------\n", file); + + for (i = 0; i < srv_buf_pool_instances; i++) { + fprintf(file, "---BUFFER POOL %lu\n", i); + buf_print_io_instance(&pool_info[i], file); + } + } + + mem_free(pool_info); } /**********************************************************************//** diff --git a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c index 5b0617f17b1..07a32e55f97 100644 --- a/storage/innobase/buf/buf0flu.c +++ b/storage/innobase/buf/buf0flu.c @@ -88,6 +88,34 @@ ibool buf_flush_validate_low( /*===================*/ buf_pool_t* buf_pool); /*!< in: Buffer pool instance */ + +/******************************************************************//** +Validates the flush list some of the time. +@return TRUE if ok or the check was skipped */ +static +ibool +buf_flush_validate_skip( +/*====================*/ + buf_pool_t* buf_pool) /*!< in: Buffer pool instance */ +{ +/** Try buf_flush_validate_low() every this many times */ +# define BUF_FLUSH_VALIDATE_SKIP 23 + + /** The buf_flush_validate_low() call skip counter. + Use a signed type because of the race condition below. */ + static int buf_flush_validate_count = BUF_FLUSH_VALIDATE_SKIP; + + /* There is a race condition below, but it does not matter, + because this call is only for heuristic purposes. We want to + reduce the call frequency of the costly buf_flush_validate_low() + check in debug builds. */ + if (--buf_flush_validate_count > 0) { + return(TRUE); + } + + buf_flush_validate_count = BUF_FLUSH_VALIDATE_SKIP; + return(buf_flush_validate_low(buf_pool)); +} #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ /******************************************************************//** @@ -293,7 +321,7 @@ buf_flush_insert_into_flush_list( } #endif /* UNIV_DEBUG_VALGRIND */ #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG - ut_a(buf_flush_validate_low(buf_pool)); + ut_a(buf_flush_validate_skip(buf_pool)); #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ buf_flush_list_mutex_exit(buf_pool); @@ -515,7 +543,7 @@ buf_flush_remove( bpage->oldest_modification = 0; #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG - ut_a(buf_flush_validate_low(buf_pool)); + ut_a(buf_flush_validate_skip(buf_pool)); #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ buf_flush_list_mutex_exit(buf_pool); diff --git a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c index 8ad5f2dad83..d819782ac9d 100644 --- a/storage/innobase/buf/buf0lru.c +++ b/storage/innobase/buf/buf0lru.c @@ -2076,6 +2076,7 @@ buf_LRU_stat_update(void) buf_LRU_stat_t* item; buf_pool_t* buf_pool; ibool evict_started = FALSE; + buf_LRU_stat_t cur_stat; /* If we haven't started eviction yet then don't update stats. */ for (i = 0; i < srv_buf_pool_instances; i++) { @@ -2097,12 +2098,19 @@ buf_LRU_stat_update(void) buf_LRU_stat_arr_ind++; buf_LRU_stat_arr_ind %= BUF_LRU_STAT_N_INTERVAL; - /* Add the current value and subtract the obsolete entry. */ - buf_LRU_stat_sum.io += buf_LRU_stat_cur.io - item->io; - buf_LRU_stat_sum.unzip += buf_LRU_stat_cur.unzip - item->unzip; + /* Add the current value and subtract the obsolete entry. + Since buf_LRU_stat_cur is not protected by any mutex, + it can be changing between adding to buf_LRU_stat_sum + and copying to item. Assign it to local variables to make + sure the same value assign to the buf_LRU_stat_sum + and item */ + cur_stat = buf_LRU_stat_cur; + + buf_LRU_stat_sum.io += cur_stat.io - item->io; + buf_LRU_stat_sum.unzip += cur_stat.unzip - item->unzip; /* Put current entry in the array. */ - memcpy(item, &buf_LRU_stat_cur, sizeof *item); + memcpy(item, &cur_stat, sizeof *item); func_exit: /* Clear the current entry. */ diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c index 0d15ad8b716..ee862d8c709 100644 --- a/storage/innobase/dict/dict0dict.c +++ b/storage/innobase/dict/dict0dict.c @@ -52,8 +52,9 @@ UNIV_INTERN dict_index_t* dict_ind_compact; #include "que0que.h" #include "rem0cmp.h" #include "row0merge.h" +#include "srv0srv.h" /* srv_lower_case_table_names */ #include "m_ctype.h" /* my_isspace() */ -#include "ha_prototypes.h" /* innobase_strcasecmp() */ +#include "ha_prototypes.h" /* innobase_strcasecmp(), innobase_casedn_str()*/ #include <ctype.h> @@ -74,6 +75,7 @@ UNIV_INTERN rw_lock_t dict_operation_lock; #ifdef UNIV_PFS_RWLOCK UNIV_INTERN mysql_pfs_key_t dict_operation_lock_key; UNIV_INTERN mysql_pfs_key_t index_tree_rw_lock_key; +UNIV_INTERN mysql_pfs_key_t dict_table_stats_latch_key; #endif /* UNIV_PFS_RWLOCK */ #ifdef UNIV_PFS_MUTEX @@ -714,7 +716,7 @@ dict_init(void) &dict_foreign_err_mutex, SYNC_ANY_LATCH); for (i = 0; i < DICT_TABLE_STATS_LATCHES_SIZE; i++) { - rw_lock_create(PFS_NOT_INSTRUMENTED, + rw_lock_create(dict_table_stats_latch_key, &dict_table_stats_latches[i], SYNC_INDEX_TREE); } } @@ -1080,13 +1082,13 @@ dict_table_rename_in_cache( /* Allocate a longer name buffer; TODO: store buf len to save memory */ - foreign->foreign_table_name - = mem_heap_alloc(foreign->heap, - ut_strlen(table->name) + 1); + foreign->foreign_table_name = mem_heap_strdup( + foreign->heap, table->name); + dict_mem_foreign_table_name_lookup_set(foreign, TRUE); + } else { + strcpy(foreign->foreign_table_name, table->name); + dict_mem_foreign_table_name_lookup_set(foreign, FALSE); } - - strcpy(foreign->foreign_table_name, table->name); - if (strchr(foreign->id, '/')) { ulint db_len; char* old_id; @@ -1152,12 +1154,14 @@ dict_table_rename_in_cache( /* Allocate a longer name buffer; TODO: store buf len to save memory */ - foreign->referenced_table_name = mem_heap_alloc( - foreign->heap, strlen(table->name) + 1); + foreign->referenced_table_name = mem_heap_strdup( + foreign->heap, table->name); + dict_mem_referenced_table_name_lookup_set(foreign, TRUE); + } else { + /* Use the same buffer */ + strcpy(foreign->referenced_table_name, table->name); + dict_mem_referenced_table_name_lookup_set(foreign, FALSE); } - - strcpy(foreign->referenced_table_name, table->name); - foreign = UT_LIST_GET_NEXT(referenced_list, foreign); } @@ -2583,10 +2587,10 @@ dict_foreign_add_to_cache( ut_ad(mutex_own(&(dict_sys->mutex))); for_table = dict_table_check_if_in_cache_low( - foreign->foreign_table_name); + foreign->foreign_table_name_lookup); ref_table = dict_table_check_if_in_cache_low( - foreign->referenced_table_name); + foreign->referenced_table_name_lookup); ut_a(for_table || ref_table); if (for_table) { @@ -2703,7 +2707,7 @@ dict_scan_to( quote = '\0'; } else if (quote) { /* Within quotes: do nothing. */ - } else if (*ptr == '`' || *ptr == '"') { + } else if (*ptr == '`' || *ptr == '"' || *ptr == '\'') { /* Starting quote: remember the quote character. */ quote = *ptr; } else { @@ -3015,19 +3019,25 @@ dict_scan_table_name( memcpy(ref, database_name, database_name_len); ref[database_name_len] = '/'; memcpy(ref + database_name_len + 1, table_name, table_name_len + 1); -#ifndef __WIN__ - if (srv_lower_case_table_names) { -#endif /* !__WIN__ */ - /* The table name is always put to lower case on Windows. */ + + /* Values; 0 = Store and compare as given; case sensitive + 1 = Store and compare in lower; case insensitive + 2 = Store as given, compare in lower; case semi-sensitive */ + if (srv_lower_case_table_names == 2) { innobase_casedn_str(ref); -#ifndef __WIN__ + *table = dict_table_get_low(ref); + memcpy(ref, database_name, database_name_len); + ref[database_name_len] = '/'; + memcpy(ref + database_name_len + 1, table_name, table_name_len + 1); + } else { + if (srv_lower_case_table_names == 1) { + innobase_casedn_str(ref); + } + *table = dict_table_get_low(ref); } -#endif /* !__WIN__ */ *success = TRUE; *ref_name = ref; - *table = dict_table_get_low(ref); - return(ptr); } @@ -3516,8 +3526,10 @@ col_loop1: } foreign->foreign_table = table; - foreign->foreign_table_name = mem_heap_strdup(foreign->heap, - table->name); + foreign->foreign_table_name = mem_heap_strdup( + foreign->heap, table->name); + dict_mem_foreign_table_name_lookup_set(foreign, TRUE); + foreign->foreign_index = index; foreign->n_fields = (unsigned int) i; foreign->foreign_col_names = mem_heap_alloc(foreign->heap, @@ -3774,8 +3786,9 @@ try_find_index: foreign->referenced_index = index; foreign->referenced_table = referenced_table; - foreign->referenced_table_name - = mem_heap_strdup(foreign->heap, referenced_table_name); + foreign->referenced_table_name = mem_heap_strdup( + foreign->heap, referenced_table_name); + dict_mem_referenced_table_name_lookup_set(foreign, TRUE); foreign->referenced_col_names = mem_heap_alloc(foreign->heap, i * sizeof(void*)); @@ -4586,8 +4599,8 @@ dict_print_info_on_foreign_key_in_create_format( fputs(") REFERENCES ", file); - if (dict_tables_have_same_db(foreign->foreign_table_name, - foreign->referenced_table_name)) { + if (dict_tables_have_same_db(foreign->foreign_table_name_lookup, + foreign->referenced_table_name_lookup)) { /* Do not print the database name of the referenced table */ ut_print_name(file, trx, TRUE, dict_remove_db_name( diff --git a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load.c index 5b01669af29..3252e85b358 100644 --- a/storage/innobase/dict/dict0load.c +++ b/storage/innobase/dict/dict0load.c @@ -40,6 +40,7 @@ Created 4/24/1996 Heikki Tuuri #include "rem0cmp.h" #include "srv0start.h" #include "srv0srv.h" +#include "ha_prototypes.h" /* innobase_casedn_str() */ /** Following are six InnoDB system tables */ @@ -435,10 +436,12 @@ dict_process_sys_fields_rec( return(err_msg); } + +#ifdef FOREIGN_NOT_USED /********************************************************************//** This function parses a SYS_FOREIGN record and populate a dict_foreign_t structure with the information from the record. For detail information -about SYS_FOREIGN fields, please refer to dict_load_foreign() function +about SYS_FOREIGN fields, please refer to dict_load_foreign() function. @return error message, or NULL on success */ UNIV_INTERN const char* @@ -466,6 +469,11 @@ dict_process_sys_foreign_rec( err_len: return("incorrect column length in SYS_FOREIGN"); } + + /* This recieves a dict_foreign_t* that points to a stack variable. + So mem_heap_free(foreign->heap) is not used as elsewhere. + Since the heap used here is freed elsewhere, foreign->heap + is not assigned. */ foreign->id = mem_heap_strdupl(heap, (const char*) field, len); rec_get_nth_field_offs_old(rec, 1/*DB_TRX_ID*/, &len); @@ -477,6 +485,9 @@ err_len: goto err_len; } + /* The _lookup versions of the referenced and foreign table names + are not assigned since they are not used in this dict_foreign_t */ + field = rec_get_nth_field_old(rec, 3/*FOR_NAME*/, &len); if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) { goto err_len; @@ -502,6 +513,9 @@ err_len: return(NULL); } +#endif /* FOREIGN_NOT_USED */ + +#ifdef FOREIGN_NOT_USED /********************************************************************//** This function parses a SYS_FOREIGN_COLS record and extract necessary information from the record and return to caller. @@ -565,6 +579,8 @@ err_len: return(NULL); } +#endif /* FOREIGN_NOT_USED */ + /********************************************************************//** Determine the flags of a table described in SYS_TABLES. @return compressed page size in kilobytes; or 0 if the tablespace is @@ -2057,12 +2073,15 @@ dict_load_foreign( foreign->id = mem_heap_strdup(foreign->heap, id); field = rec_get_nth_field_old(rec, 3, &len); + foreign->foreign_table_name = mem_heap_strdupl( foreign->heap, (char*) field, len); + dict_mem_foreign_table_name_lookup_set(foreign, TRUE); field = rec_get_nth_field_old(rec, 4, &len); foreign->referenced_table_name = mem_heap_strdupl( foreign->heap, (char*) field, len); + dict_mem_referenced_table_name_lookup_set(foreign, TRUE); btr_pcur_close(&pcur); mtr_commit(&mtr); @@ -2070,7 +2089,7 @@ dict_load_foreign( dict_load_foreign_cols(id, foreign); ref_table = dict_table_check_if_in_cache_low( - foreign->referenced_table_name); + foreign->referenced_table_name_lookup); /* We could possibly wind up in a deep recursive calls if we call dict_table_get_low() again here if there @@ -2103,7 +2122,7 @@ dict_load_foreign( have to load it so that we are able to make type comparisons in the next function call. */ - for_table = dict_table_get_low(foreign->foreign_table_name); + for_table = dict_table_get_low(foreign->foreign_table_name_lookup); if (for_table && ref_table && check_recursive) { /* This is to record the longest chain of ancesters diff --git a/storage/innobase/dict/dict0mem.c b/storage/innobase/dict/dict0mem.c index bbb8f810f44..8d3d78f3900 100644 --- a/storage/innobase/dict/dict0mem.c +++ b/storage/innobase/dict/dict0mem.c @@ -33,6 +33,8 @@ Created 1/8/1996 Heikki Tuuri #include "data0type.h" #include "mach0data.h" #include "dict0dict.h" +#include "srv0srv.h" /* srv_lower_case_table_names */ +#include "ha_prototypes.h" /* innobase_casedn_str()*/ #ifndef UNIV_HOTBACKUP # include "lock0lock.h" #endif /* !UNIV_HOTBACKUP */ @@ -288,6 +290,60 @@ dict_mem_foreign_create(void) } /**********************************************************************//** +Sets the foreign_table_name_lookup pointer based on the value of +srv_lower_case_table_names. If that is 0 or 1, foreign_table_name_lookup +will point to foreign_table_name. If 2, then another string is allocated +of the heap and set to lower case. */ +UNIV_INTERN +void +dict_mem_foreign_table_name_lookup_set( +/*===================================*/ + dict_foreign_t* foreign, /*!< in/out: foreign struct */ + ibool do_alloc) /*!< in: is an alloc needed */ +{ + if (srv_lower_case_table_names == 2) { + if (do_alloc) { + foreign->foreign_table_name_lookup = mem_heap_alloc( + foreign->heap, + strlen(foreign->foreign_table_name) + 1); + } + strcpy(foreign->foreign_table_name_lookup, + foreign->foreign_table_name); + innobase_casedn_str(foreign->foreign_table_name_lookup); + } else { + foreign->foreign_table_name_lookup + = foreign->foreign_table_name; + } +} + +/**********************************************************************//** +Sets the referenced_table_name_lookup pointer based on the value of +srv_lower_case_table_names. If that is 0 or 1, +referenced_table_name_lookup will point to referenced_table_name. If 2, +then another string is allocated of the heap and set to lower case. */ +UNIV_INTERN +void +dict_mem_referenced_table_name_lookup_set( +/*======================================*/ + dict_foreign_t* foreign, /*!< in/out: foreign struct */ + ibool do_alloc) /*!< in: is an alloc needed */ +{ + if (srv_lower_case_table_names == 2) { + if (do_alloc) { + foreign->referenced_table_name_lookup = mem_heap_alloc( + foreign->heap, + strlen(foreign->referenced_table_name) + 1); + } + strcpy(foreign->referenced_table_name_lookup, + foreign->referenced_table_name); + innobase_casedn_str(foreign->referenced_table_name_lookup); + } else { + foreign->referenced_table_name_lookup + = foreign->referenced_table_name; + } +} + +/**********************************************************************//** Adds a field definition to an index. NOTE: does not take a copy of the column name if the field is a column. The memory occupied by the column name may be released only after publishing the index. */ diff --git a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c index 7f1551b6bb7..6c50b853187 100644 --- a/storage/innobase/fil/fil0fil.c +++ b/storage/innobase/fil/fil0fil.c @@ -299,6 +299,34 @@ struct fil_system_struct { initialized. */ static fil_system_t* fil_system = NULL; +#ifdef UNIV_DEBUG +/** Try fil_validate() every this many times */ +# define FIL_VALIDATE_SKIP 17 + +/******************************************************************//** +Checks the consistency of the tablespace cache some of the time. +@return TRUE if ok or the check was skipped */ +static +ibool +fil_validate_skip(void) +/*===================*/ +{ + /** The fil_validate() call skip counter. Use a signed type + because of the race condition below. */ + static int fil_validate_count = FIL_VALIDATE_SKIP; + + /* There is a race condition below, but it does not matter, + because this call is only for heuristic purposes. We want to + reduce the call frequency of the costly fil_validate() check + in debug builds. */ + if (--fil_validate_count > 0) { + return(TRUE); + } + + fil_validate_count = FIL_VALIDATE_SKIP; + return(fil_validate()); +} +#endif /* UNIV_DEBUG */ /********************************************************************//** NOTE: you must call fil_mutex_enter_and_prepare_for_io() first! @@ -4307,7 +4335,7 @@ fil_io( #if (1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE # error "(1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE" #endif - ut_ad(fil_validate()); + ut_ad(fil_validate_skip()); #ifndef UNIV_HOTBACKUP # ifndef UNIV_LOG_DEBUG /* ibuf bitmap pages must be read in the sync aio mode: */ @@ -4464,7 +4492,7 @@ fil_io( mutex_exit(&fil_system->mutex); - ut_ad(fil_validate()); + ut_ad(fil_validate_skip()); } return(DB_SUCCESS); @@ -4488,7 +4516,7 @@ fil_aio_wait( void* message; ulint type; - ut_ad(fil_validate()); + ut_ad(fil_validate_skip()); if (srv_use_native_aio) { srv_set_io_thread_op_info(segment, "native aio handle"); @@ -4519,7 +4547,7 @@ fil_aio_wait( mutex_exit(&fil_system->mutex); - ut_ad(fil_validate()); + ut_ad(fil_validate_skip()); /* Do the i/o handling */ /* IMPORTANT: since i/o handling for reads will read also the insert diff --git a/storage/innobase/fsp/fsp0fsp.c b/storage/innobase/fsp/fsp0fsp.c index ffe2b21b80c..5bf5411bc6a 100644 --- a/storage/innobase/fsp/fsp0fsp.c +++ b/storage/innobase/fsp/fsp0fsp.c @@ -3321,7 +3321,7 @@ fseg_free_page_low( "InnoDB: database!\n", (ulong) page); crash: fputs("InnoDB: Please refer to\n" - "InnoDB: " REFMAN "forcing-recovery.html\n" + "InnoDB: " REFMAN "forcing-innodb-recovery.html\n" "InnoDB: about forcing recovery.\n", stderr); ut_error; } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 824f12b97b7..ae782426e61 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -285,7 +285,8 @@ static PSI_rwlock_info all_innodb_rwlocks[] = { {&checkpoint_lock_key, "checkpoint_lock", 0}, {&trx_i_s_cache_lock_key, "trx_i_s_cache_lock", 0}, {&trx_purge_latch_key, "trx_purge_latch", 0}, - {&index_tree_rw_lock_key, "index_tree_rw_lock", 0} + {&index_tree_rw_lock_key, "index_tree_rw_lock", 0}, + {&dict_table_stats_latch_key, "dict_table_stats", 0} }; # endif /* UNIV_PFS_RWLOCK */ @@ -2164,13 +2165,13 @@ innobase_init( ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR); -#ifdef UNIV_DEBUG +#ifndef DBUG_OFF static const char test_filename[] = "-@"; char test_tablename[sizeof test_filename + sizeof srv_mysql50_table_name_prefix]; if ((sizeof test_tablename) - 1 != filename_to_tablename(test_filename, test_tablename, - sizeof test_tablename) + sizeof test_tablename, true) || strncmp(test_tablename, srv_mysql50_table_name_prefix, sizeof srv_mysql50_table_name_prefix) @@ -2180,7 +2181,7 @@ innobase_init( sql_print_error("tablename encoding has been changed"); goto error; } -#endif /* UNIV_DEBUG */ +#endif /* DBUG_OFF */ /* Check that values don't overflow on 32-bit systems. */ if (sizeof(ulint) == 4) { @@ -3638,6 +3639,7 @@ ha_innobase::open( UT_NOT_USED(test_if_locked); thd = ha_thd(); + srv_lower_case_table_names = lower_case_table_names; /* Under some cases MySQL seems to call this function while holding btr_search_latch. This breaks the latching order as @@ -6497,10 +6499,11 @@ create_clustered_index_when_no_primary( /*****************************************************************//** Return a display name for the row format @return row format name */ - -const char *get_row_format_name( -/*============================*/ -enum row_type row_format) /*!< in: Row Format */ +UNIV_INTERN +const char* +get_row_format_name( +/*================*/ + enum row_type row_format) /*!< in: Row Format */ { switch (row_format) { case ROW_TYPE_COMPACT: @@ -6515,12 +6518,38 @@ enum row_type row_format) /*!< in: Row Format */ return("DEFAULT"); case ROW_TYPE_FIXED: return("FIXED"); - default: + case ROW_TYPE_PAGE: + case ROW_TYPE_NOT_USED: break; } return("NOT USED"); } +/** If file-per-table is missing, issue warning and set ret false */ +#define CHECK_ERROR_ROW_TYPE_NEEDS_FILE_PER_TABLE \ + if (!srv_file_per_table) { \ + push_warning_printf( \ + thd, MYSQL_ERROR::WARN_LEVEL_WARN, \ + ER_ILLEGAL_HA_CREATE_OPTION, \ + "InnoDB: ROW_FORMAT=%s requires" \ + " innodb_file_per_table.", \ + get_row_format_name(row_format)); \ + ret = FALSE; \ + } + +/** If file-format is Antelope, issue warning and set ret false */ +#define CHECK_ERROR_ROW_TYPE_NEEDS_GT_ANTELOPE \ + if (srv_file_format < DICT_TF_FORMAT_ZIP) { \ + push_warning_printf( \ + thd, MYSQL_ERROR::WARN_LEVEL_WARN, \ + ER_ILLEGAL_HA_CREATE_OPTION, \ + "InnoDB: ROW_FORMAT=%s requires" \ + " innodb_file_format > Antelope.", \ + get_row_format_name(row_format)); \ + ret = FALSE; \ + } + + /*****************************************************************//** Validates the create options. We may build on this function in future. For now, it checks two specifiers: @@ -6538,7 +6567,7 @@ create_options_are_valid( { ibool kbs_specified = FALSE; ibool ret = TRUE; - enum row_type row_type = form->s->row_type; + enum row_type row_format = form->s->row_type; ut_ad(thd != NULL); @@ -6547,23 +6576,6 @@ create_options_are_valid( return(TRUE); } - /* Check for a valid Innodb ROW_FORMAT specifier. For example, - ROW_TYPE_FIXED can be sent to Innodb */ - switch (row_type) { - case ROW_TYPE_COMPACT: - case ROW_TYPE_COMPRESSED: - case ROW_TYPE_DYNAMIC: - case ROW_TYPE_REDUNDANT: - case ROW_TYPE_DEFAULT: - break; - default: - push_warning( - thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: invalid ROW_FORMAT specifier."); - ret = FALSE; - } - ut_ad(form != NULL); ut_ad(create_info != NULL); @@ -6576,7 +6588,23 @@ create_options_are_valid( case 4: case 8: case 16: - /* Valid value. */ + /* Valid KEY_BLOCK_SIZE, check its dependencies. */ + if (!srv_file_per_table) { + push_warning( + thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, + "InnoDB: KEY_BLOCK_SIZE requires" + " innodb_file_per_table."); + ret = FALSE; + } + if (srv_file_format < DICT_TF_FORMAT_ZIP) { + push_warning( + thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, + "InnoDB: KEY_BLOCK_SIZE requires" + " innodb_file_format > Antelope."); + ret = FALSE; + } break; default: push_warning_printf( @@ -6586,72 +6614,43 @@ create_options_are_valid( " Valid values are [1, 2, 4, 8, 16]", create_info->key_block_size); ret = FALSE; + break; } } - /* If KEY_BLOCK_SIZE was specified, check for its - dependencies. */ - if (kbs_specified && !srv_file_per_table) { - push_warning( - thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: KEY_BLOCK_SIZE requires" - " innodb_file_per_table."); - ret = FALSE; - } - - if (kbs_specified && srv_file_format < DICT_TF_FORMAT_ZIP) { - push_warning( - thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: KEY_BLOCK_SIZE requires" - " innodb_file_format > Antelope."); - ret = FALSE; - } - - switch (row_type) { + /* Check for a valid Innodb ROW_FORMAT specifier and + other incompatibilities. */ + switch (row_format) { case ROW_TYPE_COMPRESSED: - case ROW_TYPE_DYNAMIC: - /* These two ROW_FORMATs require srv_file_per_table - and srv_file_format > Antelope */ - if (!srv_file_per_table) { - push_warning_printf( - thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: ROW_FORMAT=%s requires" - " innodb_file_per_table.", - get_row_format_name(row_type)); - ret = FALSE; - } - - if (srv_file_format < DICT_TF_FORMAT_ZIP) { - push_warning_printf( - thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: ROW_FORMAT=%s requires" - " innodb_file_format > Antelope.", - get_row_format_name(row_type)); - ret = FALSE; - } - default: + CHECK_ERROR_ROW_TYPE_NEEDS_FILE_PER_TABLE; + CHECK_ERROR_ROW_TYPE_NEEDS_GT_ANTELOPE; break; - } - - switch (row_type) { - case ROW_TYPE_REDUNDANT: - case ROW_TYPE_COMPACT: case ROW_TYPE_DYNAMIC: - /* KEY_BLOCK_SIZE is only allowed with Compressed or Default */ + CHECK_ERROR_ROW_TYPE_NEEDS_FILE_PER_TABLE; + CHECK_ERROR_ROW_TYPE_NEEDS_GT_ANTELOPE; + /* fall through since dynamic also shuns KBS */ + case ROW_TYPE_COMPACT: + case ROW_TYPE_REDUNDANT: if (kbs_specified) { push_warning_printf( thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_ILLEGAL_HA_CREATE_OPTION, "InnoDB: cannot specify ROW_FORMAT = %s" " with KEY_BLOCK_SIZE.", - get_row_format_name(row_type)); - ret = FALSE; + get_row_format_name(row_format)); + ret = FALSE; } - default: + break; + case ROW_TYPE_DEFAULT: + break; + case ROW_TYPE_FIXED: + case ROW_TYPE_PAGE: + case ROW_TYPE_NOT_USED: + push_warning( + thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, \ + "InnoDB: invalid ROW_FORMAT specifier."); + ret = FALSE; break; } @@ -6702,7 +6701,7 @@ ha_innobase::create( const ulint file_format = srv_file_format; const char* stmt; size_t stmt_len; - enum row_type row_type; + enum row_type row_format; DBUG_ENTER("ha_innobase::create"); @@ -6752,11 +6751,7 @@ ha_innobase::create( trx = innobase_trx_allocate(thd); - if (lower_case_table_names) { - srv_lower_case_table_names = TRUE; - } else { - srv_lower_case_table_names = FALSE; - } + srv_lower_case_table_names = lower_case_table_names; strcpy(name2, name); @@ -6820,20 +6815,19 @@ ha_innobase::create( push_warning_printf( thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: ignoring" - " KEY_BLOCK_SIZE=%lu.", + "InnoDB: ignoring KEY_BLOCK_SIZE=%lu.", create_info->key_block_size); } } - row_type = form->s->row_type; + row_format = form->s->row_type; if (flags) { /* if ROW_FORMAT is set to default, automatically change it to COMPRESSED.*/ - if (row_type == ROW_TYPE_DEFAULT) { - row_type = ROW_TYPE_COMPRESSED; - } else if (row_type != ROW_TYPE_COMPRESSED) { + if (row_format == ROW_TYPE_DEFAULT) { + row_format = ROW_TYPE_COMPRESSED; + } else if (row_format != ROW_TYPE_COMPRESSED) { /* ROW_FORMAT other than COMPRESSED ignores KEY_BLOCK_SIZE. It does not make sense to reject conflicting @@ -6850,7 +6844,7 @@ ha_innobase::create( } } else { /* flags == 0 means no KEY_BLOCK_SIZE.*/ - if (row_type == ROW_TYPE_COMPRESSED) { + if (row_format == ROW_TYPE_COMPRESSED) { /* ROW_FORMAT=COMPRESSED without KEY_BLOCK_SIZE implies half the maximum KEY_BLOCK_SIZE. */ @@ -6865,7 +6859,7 @@ ha_innobase::create( } } - switch (row_type) { + switch (row_format) { case ROW_TYPE_REDUNDANT: break; case ROW_TYPE_COMPRESSED: @@ -6876,25 +6870,25 @@ ha_innobase::create( ER_ILLEGAL_HA_CREATE_OPTION, "InnoDB: ROW_FORMAT=%s requires" " innodb_file_per_table.", - get_row_format_name(row_type)); + get_row_format_name(row_format)); } else if (file_format < DICT_TF_FORMAT_ZIP) { push_warning_printf( thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_ILLEGAL_HA_CREATE_OPTION, "InnoDB: ROW_FORMAT=%s requires" " innodb_file_format > Antelope.", - get_row_format_name(row_type)); + get_row_format_name(row_format)); } else { flags |= DICT_TF_COMPACT - | (DICT_TF_FORMAT_ZIP - << DICT_TF_FORMAT_SHIFT); + | (DICT_TF_FORMAT_ZIP + << DICT_TF_FORMAT_SHIFT); break; } /* fall through */ case ROW_TYPE_NOT_USED: case ROW_TYPE_FIXED: - default: + case ROW_TYPE_PAGE: push_warning( thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_ILLEGAL_HA_CREATE_OPTION, @@ -7035,23 +7029,25 @@ ha_innobase::create( setup at this stage and so we use thd. */ /* We need to copy the AUTOINC value from the old table if - this is an ALTER TABLE or CREATE INDEX because CREATE INDEX - does a table copy too. */ + this is an ALTER|OPTIMIZE TABLE or CREATE INDEX because CREATE INDEX + does a table copy too. If query was one of : + + CREATE TABLE ...AUTO_INCREMENT = x; or + ALTER TABLE...AUTO_INCREMENT = x; or + OPTIMIZE TABLE t; or + CREATE INDEX x on t(...); + + Find out a table definition from the dictionary and get + the current value of the auto increment field. Set a new + value to the auto increment field if the value is greater + than the maximum value in the column. */ if (((create_info->used_fields & HA_CREATE_USED_AUTO) || thd_sql_command(thd) == SQLCOM_ALTER_TABLE + || thd_sql_command(thd) == SQLCOM_OPTIMIZE || thd_sql_command(thd) == SQLCOM_CREATE_INDEX) && create_info->auto_increment_value > 0) { - /* Query was one of : - CREATE TABLE ...AUTO_INCREMENT = x; or - ALTER TABLE...AUTO_INCREMENT = x; or - CREATE INDEX x on t(...); - Find out a table definition from the dictionary and get - the current value of the auto increment field. Set a new - value to the auto increment field if the value is greater - than the maximum value in the column. */ - auto_inc_value = create_info->auto_increment_value; dict_table_autoinc_lock(innobase_table); @@ -7180,11 +7176,7 @@ ha_innobase::delete_table( trx = innobase_trx_allocate(thd); - if (lower_case_table_names) { - srv_lower_case_table_names = TRUE; - } else { - srv_lower_case_table_names = FALSE; - } + srv_lower_case_table_names = lower_case_table_names; name_len = strlen(name); @@ -7307,11 +7299,7 @@ innobase_rename_table( char* norm_to; char* norm_from; - if (lower_case_table_names) { - srv_lower_case_table_names = TRUE; - } else { - srv_lower_case_table_names = FALSE; - } + srv_lower_case_table_names = lower_case_table_names; // Magic number 64 arbitrary norm_to = (char*) my_malloc(strlen(to) + 64, MYF(0)); @@ -7848,14 +7836,14 @@ ha_innobase::info_low( are asked by MySQL to avoid locking. Another reason to avoid the call is that it uses quite a lot of CPU. See Bug#38185. */ - if (flag & HA_STATUS_NO_LOCK || - !(flag & HA_STATUS_VARIABLE_EXTRA)) { + if (flag & HA_STATUS_NO_LOCK + || !(flag & HA_STATUS_VARIABLE_EXTRA)) { /* We do not update delete_length if no locking is requested so the "old" value can remain. delete_length is initialized to 0 in the ha_statistics' constructor. Also we only - need delete_length to be set when - HA_STATUS_VARIABLE_EXTRA is set */ + need delete_length to be set when + HA_STATUS_VARIABLE_EXTRA is set */ } else if (UNIV_UNLIKELY (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE)) { /* Avoid accessing the tablespace if diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 9f0e465a4d9..709274bab16 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -495,8 +495,16 @@ fill_innodb_trx_from_cache( row->trx_mysql_thread_id)); /* trx_query */ - OK(field_store_string(fields[IDX_TRX_QUERY], - row->trx_query)); + if (row->trx_query) { + /* store will do appropriate character set + conversion check */ + fields[IDX_TRX_QUERY]->store( + row->trx_query, strlen(row->trx_query), + row->trx_query_cs); + fields[IDX_TRX_QUERY]->set_notnull(); + } else { + fields[IDX_TRX_QUERY]->set_null(); + } /* trx_operation_state */ OK(field_store_string(fields[IDX_TRX_OPERATION_STATE], diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c index aab0084c214..41eba7cb9f3 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.c +++ b/storage/innobase/ibuf/ibuf0ibuf.c @@ -645,22 +645,49 @@ ibuf_parse_bitmap_init( return(ptr); } #ifndef UNIV_HOTBACKUP +# ifdef UNIV_DEBUG +/** Gets the desired bits for a given page from a bitmap page. +@param page in: bitmap page +@param offset in: page whose bits to get +@param zs in: compressed page size in bytes; 0 for uncompressed pages +@param bit in: IBUF_BITMAP_FREE, IBUF_BITMAP_BUFFERED, ... +@param mtr in: mini-transaction holding an x-latch on the bitmap page +@return value of bits */ +# define ibuf_bitmap_page_get_bits(page, offset, zs, bit, mtr) \ + ibuf_bitmap_page_get_bits_low(page, offset, zs, \ + MTR_MEMO_PAGE_X_FIX, mtr, bit) +# else /* UNIV_DEBUG */ +/** Gets the desired bits for a given page from a bitmap page. +@param page in: bitmap page +@param offset in: page whose bits to get +@param zs in: compressed page size in bytes; 0 for uncompressed pages +@param bit in: IBUF_BITMAP_FREE, IBUF_BITMAP_BUFFERED, ... +@param mtr in: mini-transaction holding an x-latch on the bitmap page +@return value of bits */ +# define ibuf_bitmap_page_get_bits(page, offset, zs, bit, mtr) \ + ibuf_bitmap_page_get_bits_low(page, offset, zs, bit) +# endif /* UNIV_DEBUG */ + /********************************************************************//** Gets the desired bits for a given page from a bitmap page. @return value of bits */ UNIV_INLINE ulint -ibuf_bitmap_page_get_bits( -/*======================*/ +ibuf_bitmap_page_get_bits_low( +/*==========================*/ const page_t* page, /*!< in: bitmap page */ ulint page_no,/*!< in: page whose bits to get */ ulint zip_size,/*!< in: compressed page size in bytes; 0 for uncompressed pages */ - ulint bit, /*!< in: IBUF_BITMAP_FREE, +#ifdef UNIV_DEBUG + ulint latch_type, + /*!< in: MTR_MEMO_PAGE_X_FIX, + MTR_MEMO_BUF_FIX, ... */ + mtr_t* mtr, /*!< in: mini-transaction holding latch_type + on the bitmap page */ +#endif /* UNIV_DEBUG */ + ulint bit) /*!< in: IBUF_BITMAP_FREE, IBUF_BITMAP_BUFFERED, ... */ - mtr_t* mtr __attribute__((unused))) - /*!< in: mtr containing an - x-latch to the bitmap page */ { ulint byte_offset; ulint bit_offset; @@ -672,7 +699,7 @@ ibuf_bitmap_page_get_bits( # error "IBUF_BITS_PER_PAGE % 2 != 0" #endif ut_ad(ut_is_2pow(zip_size)); - ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX)); + ut_ad(mtr_memo_contains_page(mtr, page, latch_type)); if (!zip_size) { bit_offset = (page_no % UNIV_PAGE_SIZE) * IBUF_BITS_PER_PAGE @@ -1098,21 +1125,29 @@ Must not be called when recv_no_ibuf_operations==TRUE. @return TRUE if level 2 or level 3 page */ UNIV_INTERN ibool -ibuf_page( -/*======*/ - ulint space, /*!< in: space id */ - ulint zip_size,/*!< in: compressed page size in bytes, or 0 */ - ulint page_no,/*!< in: page number */ - mtr_t* mtr) /*!< in: mtr which will contain an x-latch to the - bitmap page if the page is not one of the fixed - address ibuf pages, or NULL, in which case a new - transaction is created. */ +ibuf_page_low( +/*==========*/ + ulint space, /*!< in: space id */ + ulint zip_size,/*!< in: compressed page size in bytes, or 0 */ + ulint page_no,/*!< in: page number */ +#ifdef UNIV_DEBUG + ibool x_latch,/*!< in: FALSE if relaxed check + (avoid latching the bitmap page) */ +#endif /* UNIV_DEBUG */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ + mtr_t* mtr) /*!< in: mtr which will contain an + x-latch to the bitmap page if the page + is not one of the fixed address ibuf + pages, or NULL, in which case a new + transaction is created. */ { ibool ret; mtr_t local_mtr; page_t* bitmap_page; ut_ad(!recv_no_ibuf_operations); + ut_ad(x_latch || mtr == NULL); if (ibuf_fixed_addr_page(space, zip_size, page_no)) { @@ -1124,12 +1159,55 @@ ibuf_page( ut_ad(fil_space_get_type(IBUF_SPACE_ID) == FIL_TABLESPACE); +#ifdef UNIV_DEBUG + if (!x_latch) { + mtr_start(&local_mtr); + + /* Get the bitmap page without a page latch, so that + we will not be violating the latching order when + another bitmap page has already been latched by this + thread. The page will be buffer-fixed, and thus it + cannot be removed or relocated while we are looking at + it. The contents of the page could change, but the + IBUF_BITMAP_IBUF bit that we are interested in should + not be modified by any other thread. Nobody should be + calling ibuf_add_free_page() or ibuf_remove_free_page() + while the page is linked to the insert buffer b-tree. */ + + bitmap_page = buf_block_get_frame( + buf_page_get_gen( + space, zip_size, + ibuf_bitmap_page_no_calc(zip_size, page_no), + RW_NO_LATCH, NULL, BUF_GET_NO_LATCH, + file, line, &local_mtr)); +# ifdef UNIV_SYNC_DEBUG + /* This is for tracking Bug #58212. This check and message can + be removed once it has been established that our assumptions + about this condition are correct. The bug was only a one-time + occurrence, unable to repeat since then. */ + void* latch = sync_thread_levels_contains(SYNC_IBUF_BITMAP); + if (latch) { + fprintf(stderr, "Bug#58212 UNIV_SYNC_DEBUG" + " levels %p (%u,%u)\n", + latch, (unsigned) space, (unsigned) page_no); + } +# endif /* UNIV_SYNC_DEBUG */ + ret = ibuf_bitmap_page_get_bits_low( + bitmap_page, page_no, zip_size, + MTR_MEMO_BUF_FIX, &local_mtr, IBUF_BITMAP_IBUF); + + mtr_commit(&local_mtr); + return(ret); + } +#endif /* UNIV_DEBUG */ + if (mtr == NULL) { mtr = &local_mtr; mtr_start(mtr); } - bitmap_page = ibuf_bitmap_get_map_page(space, page_no, zip_size, mtr); + bitmap_page = ibuf_bitmap_get_map_page_func(space, page_no, zip_size, + file, line, mtr); ret = ibuf_bitmap_page_get_bits(bitmap_page, page_no, zip_size, IBUF_BITMAP_IBUF, mtr); diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index 9865ebfbfc2..cb65c6bfab7 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -333,10 +333,14 @@ ulint btr_cur_del_mark_set_clust_rec( /*===========================*/ ulint flags, /*!< in: undo logging and locking flags */ - btr_cur_t* cursor, /*!< in: cursor */ + buf_block_t* block, /*!< in/out: buffer block of the record */ + rec_t* rec, /*!< in/out: record */ + dict_index_t* index, /*!< in: clustered index of the record */ + const ulint* offsets,/*!< in: rec_get_offsets(rec) */ ibool val, /*!< in: value to set */ que_thr_t* thr, /*!< in: query thread */ - mtr_t* mtr); /*!< in: mtr */ + mtr_t* mtr) /*!< in: mtr */ + __attribute__((nonnull)); /***********************************************************//** Sets a secondary index record delete mark to TRUE or FALSE. @return DB_SUCCESS, DB_LOCK_WAIT, or error number */ @@ -469,40 +473,22 @@ btr_estimate_number_of_different_key_vals( /*======================================*/ dict_index_t* index); /*!< in: index */ /*******************************************************************//** -Marks not updated extern fields as not-owned by this record. The ownership -is transferred to the updated record which is inserted elsewhere in the +Marks non-updated off-page fields as disowned by this record. The ownership +must be transferred to the updated record which is inserted elsewhere in the index tree. In purge only the owner of externally stored field is allowed -to free the field. -@return TRUE if BLOB ownership was transferred */ +to free the field. */ UNIV_INTERN -ibool -btr_cur_mark_extern_inherited_fields( -/*=================================*/ +void +btr_cur_disown_inherited_fields( +/*============================*/ page_zip_des_t* page_zip,/*!< in/out: compressed page whose uncompressed part will be updated, or NULL */ rec_t* rec, /*!< in/out: record in a clustered index */ dict_index_t* index, /*!< in: index of the page */ const ulint* offsets,/*!< in: array returned by rec_get_offsets() */ const upd_t* update, /*!< in: update vector */ - mtr_t* mtr); /*!< in: mtr, or NULL if not logged */ -/*******************************************************************//** -The complement of the previous function: in an update entry may inherit -some externally stored fields from a record. We must mark them as inherited -in entry, so that they are not freed in a rollback. */ -UNIV_INTERN -void -btr_cur_mark_dtuple_inherited_extern( -/*=================================*/ - dtuple_t* entry, /*!< in/out: updated entry to be - inserted to clustered index */ - const upd_t* update); /*!< in: update vector */ -/*******************************************************************//** -Marks all extern fields in a dtuple as owned by the record. */ -UNIV_INTERN -void -btr_cur_unmark_dtuple_extern_fields( -/*================================*/ - dtuple_t* entry); /*!< in/out: clustered index entry */ + mtr_t* mtr) /*!< in/out: mini-transaction */ + __attribute__((nonnull(2,3,4,5,6))); /*******************************************************************//** Stores the fields in big_rec_vec to the tablespace and puts pointers to them in rec. The extern flags in rec will have to be set beforehand. diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index a42eba57fd2..46cae25f0f5 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -116,6 +116,76 @@ enum buf_page_state { before putting to the free list */ }; + +/** This structure defines information we will fetch from each buffer pool. It +will be used to print table IO stats */ +struct buf_pool_info_struct{ + /* General buffer pool info */ + ulint pool_unique_id; /*!< Buffer Pool ID */ + ulint pool_size; /*!< Buffer Pool size in pages */ + ulint lru_len; /*!< Length of buf_pool->LRU */ + ulint old_lru_len; /*!< buf_pool->LRU_old_len */ + ulint free_list_len; /*!< Length of buf_pool->free list */ + ulint flush_list_len; /*!< Length of buf_pool->flush_list */ + ulint n_pend_unzip; /*!< buf_pool->n_pend_unzip, pages + pending decompress */ + ulint n_pend_reads; /*!< buf_pool->n_pend_reads, pages + pending read */ + ulint n_pending_flush_lru; /*!< Pages pending flush in LRU */ + ulint n_pending_flush_list; /*!< Pages pending flush in FLUSH + LIST */ + ulint n_pending_flush_single_page;/*!< Pages pending flush in + BUF_FLUSH_SINGLE_PAGE list */ + ulint n_pages_made_young; /*!< number of pages made young */ + ulint n_pages_not_made_young; /*!< number of pages not made young */ + ulint n_pages_read; /*!< buf_pool->n_pages_read */ + ulint n_pages_created; /*!< buf_pool->n_pages_created */ + ulint n_pages_written; /*!< buf_pool->n_pages_written */ + ulint n_page_gets; /*!< buf_pool->n_page_gets */ + ulint n_ra_pages_read; /*!< buf_pool->n_ra_pages_read, number + of pages readahead */ + ulint n_ra_pages_evicted; /*!< buf_pool->n_ra_pages_evicted, + number of readahead pages evicted + without access */ + ulint n_page_get_delta; /*!< num of buffer pool page gets since + last printout */ + + /* Buffer pool access stats */ + double page_made_young_rate; /*!< page made young rate in pages + per second */ + double page_not_made_young_rate;/*!< page not made young rate + in pages per second */ + double pages_read_rate; /*!< num of pages read per second */ + double pages_created_rate; /*!< num of pages create per second */ + double pages_written_rate; /*!< num of pages written per second */ + ulint page_read_delta; /*!< num of pages read since last + printout */ + ulint young_making_delta; /*!< num of pages made young since + last printout */ + ulint not_young_making_delta; /*!< num of pages not make young since + last printout */ + + /* Statistics about read ahead algorithm. */ + double pages_readahead_rate; /*!< readahead rate in pages per + second */ + double pages_evicted_rate; /*!< rate of readahead page evicted + without access, in pages per second */ + + /* Stats about LRU eviction */ + ulint unzip_lru_len; /*!< length of buf_pool->unzip_LRU + list */ + /* Counters for LRU policy */ + ulint io_sum; /*!< buf_LRU_stat_sum.io */ + ulint io_cur; /*!< buf_LRU_stat_cur.io, num of IO + for current interval */ + ulint unzip_sum; /*!< buf_LRU_stat_sum.unzip */ + ulint unzip_cur; /*!< buf_LRU_stat_cur.unzip, num + pages decompressed in current + interval */ +}; + +typedef struct buf_pool_info_struct buf_pool_info_t; + #ifndef UNIV_HOTBACKUP /********************************************************************//** Acquire mutex on all buffer pool instances */ diff --git a/storage/innobase/include/data0data.h b/storage/innobase/include/data0data.h index 11e4027777a..f7bdd29ed90 100644 --- a/storage/innobase/include/data0data.h +++ b/storage/innobase/include/data0data.h @@ -154,14 +154,19 @@ dfield_dup( dfield_t* field, /*!< in/out: data field */ mem_heap_t* heap); /*!< in: memory heap where allocated */ /*********************************************************************//** -Tests if data length and content is equal for two dfields. -@return TRUE if equal */ +Tests if two data fields are equal. +If len==0, tests the data length and content for equality. +If len>0, tests the first len bytes of the content for equality. +@return TRUE if both fields are NULL or if they are equal */ UNIV_INLINE ibool dfield_datas_are_binary_equal( /*==========================*/ const dfield_t* field1, /*!< in: field */ - const dfield_t* field2);/*!< in: field */ + const dfield_t* field2, /*!< in: field */ + ulint len) /*!< in: maximum prefix to compare, + or 0 to compare the whole field length */ + __attribute__((nonnull, warn_unused_result)); /*********************************************************************//** Tests if dfield data length and content is equal to the given. @return TRUE if equal */ diff --git a/storage/innobase/include/data0data.ic b/storage/innobase/include/data0data.ic index 2e3adf4b707..5c0f8039c80 100644 --- a/storage/innobase/include/data0data.ic +++ b/storage/innobase/include/data0data.ic @@ -229,20 +229,30 @@ dfield_dup( } /*********************************************************************//** -Tests if data length and content is equal for two dfields. -@return TRUE if equal */ +Tests if two data fields are equal. +If len==0, tests the data length and content for equality. +If len>0, tests the first len bytes of the content for equality. +@return TRUE if both fields are NULL or if they are equal */ UNIV_INLINE ibool dfield_datas_are_binary_equal( /*==========================*/ const dfield_t* field1, /*!< in: field */ - const dfield_t* field2) /*!< in: field */ + const dfield_t* field2, /*!< in: field */ + ulint len) /*!< in: maximum prefix to compare, + or 0 to compare the whole field length */ { - ulint len; + ulint len2 = len; - len = field1->len; + if (field1->len == UNIV_SQL_NULL || len == 0 || field1->len < len) { + len = field1->len; + } + + if (field2->len == UNIV_SQL_NULL || len2 == 0 || field2->len < len2) { + len2 = field2->len; + } - return(len == field2->len + return(len == len2 && (len == UNIV_SQL_NULL || !memcmp(field1->data, field2->data, len))); } diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index d448e57e395..7526e4dc8dc 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -238,6 +238,26 @@ dict_foreign_t* dict_mem_foreign_create(void); /*=========================*/ +/**********************************************************************//** +Sets the foreign_table_name_lookup pointer based on the value of +srv_lower_case_table_names. */ +UNIV_INTERN +void +dict_mem_foreign_table_name_lookup_set( +/*===================================*/ + dict_foreign_t* foreign, /*!< in/out: foreign struct */ + ibool do_alloc); /*!< in: is an alloc needed */ + +/**********************************************************************//** +Sets the reference_table_name_lookup pointer based on the value of +srv_lower_case_table_names. */ +UNIV_INTERN +void +dict_mem_referenced_table_name_lookup_set( +/*======================================*/ + dict_foreign_t* foreign, /*!< in/out: foreign struct */ + ibool do_alloc); /*!< in: is an alloc needed */ + /** Data structure for a column in a table */ struct dict_col_struct{ /*----------------------*/ @@ -393,10 +413,14 @@ struct dict_foreign_struct{ unsigned type:6; /*!< 0 or DICT_FOREIGN_ON_DELETE_CASCADE or DICT_FOREIGN_ON_DELETE_SET_NULL */ char* foreign_table_name;/*!< foreign table name */ + char* foreign_table_name_lookup; + /*!< foreign table name used for dict lookup */ dict_table_t* foreign_table; /*!< table where the foreign key is */ const char** foreign_col_names;/*!< names of the columns in the foreign key */ char* referenced_table_name;/*!< referenced table name */ + char* referenced_table_name_lookup; + /*!< referenced table name for dict lookup*/ dict_table_t* referenced_table;/*!< table where the referenced key is */ const char** referenced_col_names;/*!< names of the referenced diff --git a/storage/innobase/include/ibuf0ibuf.h b/storage/innobase/include/ibuf0ibuf.h index 66b06575b0d..464571d1ff8 100644 --- a/storage/innobase/include/ibuf0ibuf.h +++ b/storage/innobase/include/ibuf0ibuf.h @@ -253,15 +253,44 @@ Must not be called when recv_no_ibuf_operations==TRUE. @return TRUE if level 2 or level 3 page */ UNIV_INTERN ibool -ibuf_page( -/*======*/ - ulint space, /*!< in: space id */ - ulint zip_size,/*!< in: compressed page size in bytes, or 0 */ - ulint page_no,/*!< in: page number */ - mtr_t* mtr); /*!< in: mtr which will contain an x-latch to the - bitmap page if the page is not one of the fixed - address ibuf pages, or NULL, in which case a new - transaction is created. */ +ibuf_page_low( +/*==========*/ + ulint space, /*!< in: space id */ + ulint zip_size,/*!< in: compressed page size in bytes, or 0 */ + ulint page_no,/*!< in: page number */ +#ifdef UNIV_DEBUG + ibool x_latch,/*!< in: FALSE if relaxed check + (avoid latching the bitmap page) */ +#endif /* UNIV_DEBUG */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ + mtr_t* mtr) /*!< in: mtr which will contain an + x-latch to the bitmap page if the page + is not one of the fixed address ibuf + pages, or NULL, in which case a new + transaction is created. */ + __attribute__((warn_unused_result)); +#ifdef UNIV_DEBUG +/** Checks if a page is a level 2 or 3 page in the ibuf hierarchy of +pages. Must not be called when recv_no_ibuf_operations==TRUE. +@param space tablespace identifier +@param zip_size compressed page size in bytes, or 0 +@param page_no page number +@param mtr mini-transaction or NULL +@return TRUE if level 2 or level 3 page */ +# define ibuf_page(space, zip_size, page_no, mtr) \ + ibuf_page_low(space, zip_size, page_no, TRUE, __FILE__, __LINE__, mtr) +#else /* UVIV_DEBUG */ +/** Checks if a page is a level 2 or 3 page in the ibuf hierarchy of +pages. Must not be called when recv_no_ibuf_operations==TRUE. +@param space tablespace identifier +@param zip_size compressed page size in bytes, or 0 +@param page_no page number +@param mtr mini-transaction or NULL +@return TRUE if level 2 or level 3 page */ +# define ibuf_page(space, zip_size, page_no, mtr) \ + ibuf_page_low(space, zip_size, page_no, __FILE__, __LINE__, mtr) +#endif /* UVIV_DEBUG */ /***********************************************************************//** Frees excess pages from the ibuf free list. This function is called when an OS thread calls fsp services to allocate a new file segment, or a new page to a diff --git a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.ic index cbce2edc661..d214c3fe6c9 100644 --- a/storage/innobase/include/mem0mem.ic +++ b/storage/innobase/include/mem0mem.ic @@ -350,27 +350,27 @@ mem_heap_get_top( ulint n) /*!< in: size of the topmost element */ { mem_block_t* block; - void* buf; + byte* buf; ut_ad(mem_heap_check(heap)); block = UT_LIST_GET_LAST(heap->base); - buf = (byte*)block + mem_block_get_free(block) - MEM_SPACE_NEEDED(n); + buf = (byte*) block + mem_block_get_free(block) - MEM_SPACE_NEEDED(n); #ifdef UNIV_MEM_DEBUG - ut_ad(mem_block_get_start(block) <=(ulint)((byte*)buf - (byte*)block)); + ut_ad(mem_block_get_start(block) <= (ulint) (buf - (byte*) block)); /* In the debug version, advance buf to point at the storage which was given to the caller in the allocation*/ - buf = (byte*)buf + MEM_FIELD_HEADER_SIZE; + buf += MEM_FIELD_HEADER_SIZE; /* Check that the field lengths agree */ - ut_ad(n == (ulint)mem_field_header_get_len(buf)); + ut_ad(n == mem_field_header_get_len(buf)); #endif - return(buf); + return((void*) buf); } /*****************************************************************//** diff --git a/storage/innobase/include/mtr0mtr.ic b/storage/innobase/include/mtr0mtr.ic index fd72b3b75e6..9baf2ae1d48 100644 --- a/storage/innobase/include/mtr0mtr.ic +++ b/storage/innobase/include/mtr0mtr.ic @@ -161,7 +161,7 @@ mtr_memo_contains( while (offset > 0) { offset -= sizeof(mtr_memo_slot_t); - slot = dyn_array_get_element(memo, offset); + slot = (mtr_memo_slot_t*) dyn_array_get_element(memo, offset); if ((object == slot->object) && (type == slot->type)) { diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index 6d95b280330..fb13120a481 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -373,6 +373,7 @@ typedef HANDLE os_file_dir_t; /*!< directory stream */ typedef DIR* os_file_dir_t; /*!< directory stream */ #endif +#ifdef __WIN__ /***********************************************************************//** Gets the operating system version. Currently works only on Windows. @return OS_WIN95, OS_WIN31, OS_WINNT, OS_WIN2000, OS_WINXP, OS_WINVISTA, @@ -381,6 +382,7 @@ UNIV_INTERN ulint os_get_os_version(void); /*===================*/ +#endif /* __WIN__ */ #ifndef UNIV_HOTBACKUP /****************************************************************//** Creates the seek mutexes used in positioned reads and writes. */ diff --git a/storage/innobase/include/row0upd.h b/storage/innobase/include/row0upd.h index 051beb09277..9c2e003c609 100644 --- a/storage/innobase/include/row0upd.h +++ b/storage/innobase/include/row0upd.h @@ -286,10 +286,13 @@ row_upd_changes_ord_field_binary( row and the data values in update are not known when this function is called, e.g., at compile time */ + const row_ext_t*ext, /*!< NULL, or prefixes of the externally + stored columns in the old row */ dict_index_t* index, /*!< in: index of the record */ - const upd_t* update);/*!< in: update vector for the row; NOTE: the + const upd_t* update) /*!< in: update vector for the row; NOTE: the field numbers in this MUST be clustered index positions! */ + __attribute__((nonnull(3,4), warn_unused_result)); /***********************************************************//** Checks if an update vector changes an ordering field of an index record. This function is fast if the update vector is short or the number of ordering @@ -462,11 +465,16 @@ struct upd_node_struct{ #define UPD_NODE_INSERT_CLUSTERED 3 /* clustered index record should be inserted, old record is already delete marked */ -#define UPD_NODE_UPDATE_ALL_SEC 4 /* an ordering field of the clustered +#define UPD_NODE_INSERT_BLOB 4 /* clustered index record should be + inserted, old record is already + delete-marked; non-updated BLOBs + should be inherited by the new record + and disowned by the old record */ +#define UPD_NODE_UPDATE_ALL_SEC 5 /* an ordering field of the clustered index record was changed, or this is a delete operation: should update all the secondary index records */ -#define UPD_NODE_UPDATE_SOME_SEC 5 /* secondary index entries should be +#define UPD_NODE_UPDATE_SOME_SEC 6 /* secondary index entries should be looked at and updated if an ordering field changed */ diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 98b07f5e893..612ff4c6e54 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -71,8 +71,8 @@ at a time */ #define SRV_AUTO_EXTEND_INCREMENT \ (srv_auto_extend_increment * ((1024 * 1024) / UNIV_PAGE_SIZE)) -/* This is set to TRUE if the MySQL user has set it in MySQL */ -extern ibool srv_lower_case_table_names; +/* This is set to the MySQL server value for this variable. */ +extern uint srv_lower_case_table_names; /* Mutex for locking srv_monitor_file */ extern mutex_t srv_monitor_file_mutex; @@ -476,6 +476,14 @@ enum srv_thread_type srv_get_thread_type(void); /*=====================*/ /*********************************************************************//** +Check whether thread type has reserved a slot. +@return slot number or UNDEFINED if not found*/ +UNIV_INTERN +ulint +srv_thread_has_reserved_slot( +/*=========================*/ + enum srv_thread_type type); /*!< in: thread type to check */ +/*********************************************************************//** Sets the info describing an i/o thread current state. */ UNIV_INTERN void diff --git a/storage/innobase/include/sync0rw.h b/storage/innobase/include/sync0rw.h index 70471186f6d..5988fdfb382 100644 --- a/storage/innobase/include/sync0rw.h +++ b/storage/innobase/include/sync0rw.h @@ -122,6 +122,7 @@ extern mysql_pfs_key_t checkpoint_lock_key; extern mysql_pfs_key_t trx_i_s_cache_lock_key; extern mysql_pfs_key_t trx_purge_latch_key; extern mysql_pfs_key_t index_tree_rw_lock_key; +extern mysql_pfs_key_t dict_table_stats_latch_key; #endif /* UNIV_PFS_RWLOCK */ diff --git a/storage/innobase/include/trx0i_s.h b/storage/innobase/include/trx0i_s.h index 8f8b7367fb0..73896a3cb76 100644 --- a/storage/innobase/include/trx0i_s.h +++ b/storage/innobase/include/trx0i_s.h @@ -140,6 +140,9 @@ struct i_s_trx_row_struct { ulint trx_mysql_thread_id; /*!< thd_get_thread_id() */ const char* trx_query; /*!< MySQL statement being executed in the transaction */ + struct charset_info_st* trx_query_cs; + /*!< charset encode the MySQL + statement */ const char* trx_operation_state; /*!< trx_struct::op_info */ ulint trx_tables_in_use;/*!< n_mysql_tables_in_use in trx_struct */ diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 9cf823c2ff3..4470d221da9 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -44,9 +44,14 @@ Created 1/20/1994 Heikki Tuuri #include "hb_univ.i" #endif /* UNIV_HOTBACKUP */ +/* aux macros to convert M into "123" (string) if M is defined like +#define M 123 */ +#define _IB_TO_STR(s) #s +#define IB_TO_STR(s) _IB_TO_STR(s) + #define INNODB_VERSION_MAJOR 1 #define INNODB_VERSION_MINOR 1 -#define INNODB_VERSION_BUGFIX 4 +#define INNODB_VERSION_BUGFIX 5 /* The following is the InnoDB version as shown in SELECT plugin_version FROM information_schema.plugins; @@ -57,16 +62,14 @@ component, i.e. we show M.N.P as M.N */ #define INNODB_VERSION_SHORT \ (INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR) -/* auxiliary macros to help creating the version as string */ -#define __INNODB_VERSION(a, b, c) (#a "." #b "." #c) -#define _INNODB_VERSION(a, b, c) __INNODB_VERSION(a, b, c) - #define INNODB_VERSION_STR \ - _INNODB_VERSION(INNODB_VERSION_MAJOR, \ - INNODB_VERSION_MINOR, \ - INNODB_VERSION_BUGFIX) + IB_TO_STR(INNODB_VERSION_MAJOR) "." \ + IB_TO_STR(INNODB_VERSION_MINOR) "." \ + IB_TO_STR(INNODB_VERSION_BUGFIX) -#define REFMAN "http://dev.mysql.com/doc/refman/5.1/en/" +#define REFMAN "http://dev.mysql.com/doc/refman/" \ + IB_TO_STR(MYSQL_MAJOR_VERSION) "." \ + IB_TO_STR(MYSQL_MINOR_VERSION) "/en/" #ifdef MYSQL_DYNAMIC_PLUGIN /* In the dynamic plugin, redefine some externally visible symbols @@ -250,7 +253,7 @@ easy way to get it to work. See http://bugs.mysql.com/bug.php?id=52263. */ # define UNIV_INTERN #endif -#if (!defined(UNIV_DEBUG) && !defined(UNIV_MUST_NOT_INLINE)) +#ifndef UNIV_MUST_NOT_INLINE /* Definition for inline version */ #ifdef __WIN__ diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index dd59b3eba46..cd5c7ca99f1 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -55,24 +55,24 @@ Created 1/20/1994 Heikki Tuuri typedef time_t ib_time_t; #ifndef UNIV_HOTBACKUP -#if defined(HAVE_IB_PAUSE_INSTRUCTION) -# ifdef WIN32 - /* In the Win32 API, the x86 PAUSE instruction is executed by calling - the YieldProcessor macro defined in WinNT.h. It is a CPU architecture- - independent way by using YieldProcessor.*/ -# define UT_RELAX_CPU() YieldProcessor() -# else - /* According to the gcc info page, asm volatile means that the - instruction has important side-effects and must not be removed. - Also asm volatile may trigger a memory barrier (spilling all registers - to memory). */ -# define UT_RELAX_CPU() __asm__ __volatile__ ("pause") -# endif +#if defined(HAVE_PAUSE_INSTRUCTION) + /* According to the gcc info page, asm volatile means that the + instruction has important side-effects and must not be removed. + Also asm volatile may trigger a memory barrier (spilling all registers + to memory). */ +# define UT_RELAX_CPU() __asm__ __volatile__ ("pause") +#elif defined(HAVE_FAKE_PAUSE_INSTRUCTION) +# define UT_RELAX_CPU() __asm__ __volatile__ ("rep; nop") #elif defined(HAVE_ATOMIC_BUILTINS) # define UT_RELAX_CPU() do { \ volatile lint volatile_var; \ os_compare_and_swap_lint(&volatile_var, 0, 1); \ } while (0) +#elif defined(HAVE_WINDOWS_ATOMICS) + /* In the Win32 API, the x86 PAUSE instruction is executed by calling + the YieldProcessor macro defined in WinNT.h. It is a CPU architecture- + independent way by using YieldProcessor. */ +# define UT_RELAX_CPU() YieldProcessor() #else # define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */ #endif diff --git a/storage/innobase/log/log0recv.c b/storage/innobase/log/log0recv.c index 5d5caf1b48a..f9e0fecb6c6 100644 --- a/storage/innobase/log/log0recv.c +++ b/storage/innobase/log/log0recv.c @@ -2199,7 +2199,7 @@ recv_report_corrupt_log( "InnoDB: far enough in recovery! Please run CHECK TABLE\n" "InnoDB: on your InnoDB tables to check that they are ok!\n" "InnoDB: If mysqld crashes after this recovery, look at\n" - "InnoDB: " REFMAN "forcing-recovery.html\n" + "InnoDB: " REFMAN "forcing-innodb-recovery.html\n" "InnoDB: about forcing recovery.\n", stderr); fflush(stderr); diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c index 93d2f72746d..74dbac3bc96 100644 --- a/storage/innobase/os/os0file.c +++ b/storage/innobase/os/os0file.c @@ -302,6 +302,36 @@ UNIV_INTERN ulint os_n_pending_writes = 0; /** Number of pending read operations */ UNIV_INTERN ulint os_n_pending_reads = 0; +#ifdef UNIV_DEBUG +/**********************************************************************//** +Validates the consistency the aio system some of the time. +@return TRUE if ok or the check was skipped */ +UNIV_INTERN +ibool +os_aio_validate_skip(void) +/*======================*/ +{ +/** Try os_aio_validate() every this many times */ +# define OS_AIO_VALIDATE_SKIP 13 + + /** The os_aio_validate() call skip counter. + Use a signed type because of the race condition below. */ + static int os_aio_validate_count = OS_AIO_VALIDATE_SKIP; + + /* There is a race condition below, but it does not matter, + because this call is only for heuristic purposes. We want to + reduce the call frequency of the costly os_aio_validate() + check in debug builds. */ + if (--os_aio_validate_count > 0) { + return(TRUE); + } + + os_aio_validate_count = OS_AIO_VALIDATE_SKIP; + return(os_aio_validate()); +} +#endif /* UNIV_DEBUG */ + +#ifdef __WIN__ /***********************************************************************//** Gets the operating system version. Currently works only on Windows. @return OS_WIN95, OS_WIN31, OS_WINNT, OS_WIN2000, OS_WINXP, OS_WINVISTA, @@ -311,7 +341,6 @@ ulint os_get_os_version(void) /*===================*/ { -#ifdef __WIN__ OSVERSIONINFO os_info; os_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); @@ -340,12 +369,8 @@ os_get_os_version(void) ut_error; return(0); } -#else - ut_error; - - return(0); -#endif } +#endif /* __WIN__ */ /***********************************************************************//** Retrieves the last error number if an error occurs in a file io function. @@ -4008,7 +4033,7 @@ os_aio_func( ut_ad(n > 0); ut_ad(n % OS_FILE_LOG_BLOCK_SIZE == 0); ut_ad(offset % OS_FILE_LOG_BLOCK_SIZE == 0); - ut_ad(os_aio_validate()); + ut_ad(os_aio_validate_skip()); #ifdef WIN_ASYNC_IO ut_ad((n & 0xFFFFFFFFUL) == n); #endif @@ -4210,7 +4235,7 @@ os_aio_windows_handle( /* NOTE! We only access constant fields in os_aio_array. Therefore we do not have to acquire the protecting mutex yet */ - ut_ad(os_aio_validate()); + ut_ad(os_aio_validate_skip()); ut_ad(segment < array->n_segments); n = array->n_slots / array->n_segments; @@ -4630,7 +4655,7 @@ restart: srv_set_io_thread_op_info(global_segment, "looking for i/o requests (a)"); - ut_ad(os_aio_validate()); + ut_ad(os_aio_validate_skip()); ut_ad(segment < array->n_segments); n = array->n_slots / array->n_segments; diff --git a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c index 09ae80adff4..dbfba358f9f 100644 --- a/storage/innobase/row/row0ins.c +++ b/storage/innobase/row/row0ins.c @@ -1525,7 +1525,7 @@ row_ins_check_foreign_constraints( if (foreign->foreign_index == index) { if (foreign->referenced_table == NULL) { - dict_table_get(foreign->referenced_table_name, + dict_table_get(foreign->referenced_table_name_lookup, FALSE); } diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index 709750fc4e7..63f30276df6 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -632,7 +632,7 @@ handle_new_error: "InnoDB: If the mysqld server crashes" " after the startup or when\n" "InnoDB: you dump the tables, look at\n" - "InnoDB: " REFMAN "forcing-recovery.html" + "InnoDB: " REFMAN "forcing-innodb-recovery.html" " for help.\n", stderr); break; case DB_FOREIGN_EXCEED_MAX_CASCADE: @@ -3163,7 +3163,7 @@ check_next_foreign: if (foreign && trx->check_foreigns && !(drop_db && dict_tables_have_same_db( - name, foreign->foreign_table_name))) { + name, foreign->foreign_table_name_lookup))) { FILE* ef = dict_foreign_err_file; /* We only allow dropping a referenced table if diff --git a/storage/innobase/row/row0purge.c b/storage/innobase/row/row0purge.c index 031b5258e98..08abc8a3e59 100644 --- a/storage/innobase/row/row0purge.c +++ b/storage/innobase/row/row0purge.c @@ -515,7 +515,7 @@ row_purge_upd_exist_or_extern( while (node->index != NULL) { index = node->index; - if (row_upd_changes_ord_field_binary(NULL, node->index, + if (row_upd_changes_ord_field_binary(NULL, NULL, node->index, node->update)) { /* Build the older version of the index entry */ entry = row_build_index_entry(node->row, NULL, diff --git a/storage/innobase/row/row0umod.c b/storage/innobase/row/row0umod.c index aef653b3150..0d4c42b958c 100644 --- a/storage/innobase/row/row0umod.c +++ b/storage/innobase/row/row0umod.c @@ -693,19 +693,18 @@ row_undo_mod_upd_exist_sec( while (node->index != NULL) { index = node->index; - if (row_upd_changes_ord_field_binary(node->row, node->index, - node->update)) { + if (row_upd_changes_ord_field_binary( + node->row, node->ext, node->index, node->update)) { /* Build the newest version of the index entry */ entry = row_build_index_entry(node->row, node->ext, index, heap); if (UNIV_UNLIKELY(!entry)) { /* The server must have crashed in - row_upd_clust_rec_by_insert(), in - row_ins_index_entry_low() before - btr_store_big_rec_extern_fields() - has written the externally stored columns - (BLOBs) of the new clustered index entry. */ + row_upd_clust_rec_by_insert() before + the updated externally stored columns (BLOBs) + of the new clustered index entry were + written. */ /* The table must be in DYNAMIC or COMPRESSED format. REDUNDANT and COMPACT formats diff --git a/storage/innobase/row/row0upd.c b/storage/innobase/row/row0upd.c index 81750938f58..03ed40c6647 100644 --- a/storage/innobase/row/row0upd.c +++ b/storage/innobase/row/row0upd.c @@ -238,7 +238,7 @@ row_upd_check_references_constraints( foreign->n_fields))) { if (foreign->foreign_table == NULL) { - dict_table_get(foreign->foreign_table_name, + dict_table_get(foreign->foreign_table_name_lookup, FALSE); } @@ -1198,20 +1198,21 @@ row_upd_changes_ord_field_binary( row and the data values in update are not known when this function is called, e.g., at compile time */ + const row_ext_t*ext, /*!< NULL, or prefixes of the externally + stored columns in the old row */ dict_index_t* index, /*!< in: index of the record */ const upd_t* update) /*!< in: update vector for the row; NOTE: the field numbers in this MUST be clustered index positions! */ { - ulint n_unique; - ulint n_upd_fields; - ulint i, j; - dict_index_t* clust_index; + ulint n_unique; + ulint i; + const dict_index_t* clust_index; - ut_ad(update && index); + ut_ad(update); + ut_ad(index); n_unique = dict_index_get_n_unique(index); - n_upd_fields = upd_get_n_fields(update); clust_index = dict_table_get_first_index(index->table); @@ -1219,33 +1220,72 @@ row_upd_changes_ord_field_binary( const dict_field_t* ind_field; const dict_col_t* col; - ulint col_pos; ulint col_no; + const upd_field_t* upd_field; + const dfield_t* dfield; + dfield_t dfield_ext; + ulint dfield_len; + const byte* buf; ind_field = dict_index_get_nth_field(index, i); col = dict_field_get_col(ind_field); - col_pos = dict_col_get_clust_pos(col, clust_index); col_no = dict_col_get_no(col); - for (j = 0; j < n_upd_fields; j++) { + upd_field = upd_get_field_by_field_no( + update, dict_col_get_clust_pos(col, clust_index)); - const upd_field_t* upd_field - = upd_get_nth_field(update, j); + if (upd_field == NULL) { + continue; + } - /* Note that if the index field is a column prefix - then it may be that row does not contain an externally - stored part of the column value, and we cannot compare - the datas */ + if (row == NULL) { + ut_ad(ext == NULL); + return(TRUE); + } - if (col_pos == upd_field->field_no - && (row == NULL - || ind_field->prefix_len > 0 - || !dfield_datas_are_binary_equal( - dtuple_get_nth_field(row, col_no), - &(upd_field->new_val)))) { + dfield = dtuple_get_nth_field(row, col_no); - return(TRUE); + /* This treatment of column prefix indexes is loosely + based on row_build_index_entry(). */ + + if (UNIV_LIKELY(ind_field->prefix_len == 0) + || dfield_is_null(dfield)) { + /* do nothing special */ + } else if (UNIV_LIKELY_NULL(ext)) { + /* See if the column is stored externally. */ + buf = row_ext_lookup(ext, col_no, &dfield_len); + + ut_ad(col->ord_part); + + if (UNIV_LIKELY_NULL(buf)) { + if (UNIV_UNLIKELY(buf == field_ref_zero)) { + /* This should never happen, but + we try to fail safe here. */ + ut_ad(0); + return(TRUE); + } + + goto copy_dfield; } + } else if (dfield_is_ext(dfield)) { + dfield_len = dfield_get_len(dfield); + ut_a(dfield_len > BTR_EXTERN_FIELD_REF_SIZE); + dfield_len -= BTR_EXTERN_FIELD_REF_SIZE; + ut_a(dict_index_is_clust(index) + || ind_field->prefix_len <= dfield_len); + buf = dfield_get_data(dfield); +copy_dfield: + ut_a(dfield_len > 0); + dfield_copy(&dfield_ext, dfield); + dfield_set_data(&dfield_ext, buf, dfield_len); + dfield = &dfield_ext; + } + + if (!dfield_datas_are_binary_equal( + dfield, &upd_field->new_val, + ind_field->prefix_len)) { + + return(TRUE); } } @@ -1329,7 +1369,7 @@ row_upd_changes_first_fields_binary( if (col_pos == upd_field->field_no && !dfield_datas_are_binary_equal( dtuple_get_nth_field(entry, i), - &(upd_field->new_val))) { + &upd_field->new_val, 0)) { return(TRUE); } @@ -1596,14 +1636,99 @@ row_upd_sec_step( ut_ad(!dict_index_is_clust(node->index)); if (node->state == UPD_NODE_UPDATE_ALL_SEC - || row_upd_changes_ord_field_binary(node->row, node->index, - node->update)) { + || row_upd_changes_ord_field_binary(node->row, node->ext, + node->index, node->update)) { return(row_upd_sec_index_entry(node, thr)); } return(DB_SUCCESS); } +#ifdef UNIV_DEBUG +# define row_upd_clust_rec_by_insert_inherit(rec,offsets,entry,update) \ + row_upd_clust_rec_by_insert_inherit_func(rec,offsets,entry,update) +#else /* UNIV_DEBUG */ +# define row_upd_clust_rec_by_insert_inherit(rec,offsets,entry,update) \ + row_upd_clust_rec_by_insert_inherit_func(entry,update) +#endif /* UNIV_DEBUG */ +/*******************************************************************//** +Mark non-updated off-page columns inherited when the primary key is +updated. We must mark them as inherited in entry, so that they are not +freed in a rollback. A limited version of this function used to be +called btr_cur_mark_dtuple_inherited_extern(). +@return TRUE if any columns were inherited */ +static __attribute__((warn_unused_result)) +ibool +row_upd_clust_rec_by_insert_inherit_func( +/*=====================================*/ +#ifdef UNIV_DEBUG + const rec_t* rec, /*!< in: old record, or NULL */ + const ulint* offsets,/*!< in: rec_get_offsets(rec), or NULL */ +#endif /* UNIV_DEBUG */ + dtuple_t* entry, /*!< in/out: updated entry to be + inserted into the clustered index */ + const upd_t* update) /*!< in: update vector */ +{ + ibool inherit = FALSE; + ulint i; + + ut_ad(!rec == !offsets); + ut_ad(!rec || rec_offs_any_extern(offsets)); + + for (i = 0; i < dtuple_get_n_fields(entry); i++) { + dfield_t* dfield = dtuple_get_nth_field(entry, i); + byte* data; + ulint len; + + ut_ad(!offsets + || !rec_offs_nth_extern(offsets, i) + == !dfield_is_ext(dfield) + || upd_get_field_by_field_no(update, i)); + if (!dfield_is_ext(dfield) + || upd_get_field_by_field_no(update, i)) { + continue; + } + +#ifdef UNIV_DEBUG + if (UNIV_LIKELY(rec != NULL)) { + const byte* rec_data + = rec_get_nth_field(rec, offsets, i, &len); + ut_ad(len == dfield_get_len(dfield)); + ut_ad(len != UNIV_SQL_NULL); + ut_ad(len >= BTR_EXTERN_FIELD_REF_SIZE); + + rec_data += len - BTR_EXTERN_FIELD_REF_SIZE; + + /* The pointer must not be zero. */ + ut_ad(memcmp(rec_data, field_ref_zero, + BTR_EXTERN_FIELD_REF_SIZE)); + /* The BLOB must be owned. */ + ut_ad(!(rec_data[BTR_EXTERN_LEN] + & BTR_EXTERN_OWNER_FLAG)); + } +#endif /* UNIV_DEBUG */ + + len = dfield_get_len(dfield); + ut_a(len != UNIV_SQL_NULL); + ut_a(len >= BTR_EXTERN_FIELD_REF_SIZE); + data = dfield_get_data(dfield); + data += len - BTR_EXTERN_FIELD_REF_SIZE; + /* The pointer must not be zero. */ + ut_a(memcmp(data, field_ref_zero, BTR_EXTERN_FIELD_REF_SIZE)); + /* The BLOB must be owned. */ + ut_a(!(data[BTR_EXTERN_LEN] & BTR_EXTERN_OWNER_FLAG)); + + data[BTR_EXTERN_LEN] |= BTR_EXTERN_INHERITED_FLAG; + /* The BTR_EXTERN_INHERITED_FLAG only matters in + rollback. Purge will always free the extern fields of + a delete-marked row. */ + + inherit = TRUE; + } + + return(inherit); +} + /***********************************************************//** Marks the clustered index record deleted and inserts the updated version of the record to the index. This function should be used when the ordering @@ -1622,14 +1747,16 @@ row_upd_clust_rec_by_insert( a foreign key constraint */ mtr_t* mtr) /*!< in/out: mtr; gets committed here */ { - mem_heap_t* heap = NULL; + mem_heap_t* heap; btr_pcur_t* pcur; btr_cur_t* btr_cur; trx_t* trx; dict_table_t* table; dtuple_t* entry; ulint err; - ibool change_ownership = FALSE; + ibool change_ownership = FALSE; + rec_t* rec; + ulint* offsets = NULL; ut_ad(node); ut_ad(dict_index_is_clust(index)); @@ -1639,34 +1766,64 @@ row_upd_clust_rec_by_insert( pcur = node->pcur; btr_cur = btr_pcur_get_btr_cur(pcur); - if (node->state != UPD_NODE_INSERT_CLUSTERED) { - rec_t* rec; - dict_index_t* index; - ulint offsets_[REC_OFFS_NORMAL_SIZE]; - ulint* offsets; - rec_offs_init(offsets_); + heap = mem_heap_create(1000); + + entry = row_build_index_entry(node->upd_row, node->upd_ext, + index, heap); + ut_a(entry); - err = btr_cur_del_mark_set_clust_rec(BTR_NO_LOCKING_FLAG, - btr_cur, TRUE, thr, mtr); + row_upd_index_entry_sys_field(entry, index, DATA_TRX_ID, trx->id); + + switch (node->state) { + default: + ut_error; + case UPD_NODE_INSERT_BLOB: + /* A lock wait occurred in row_ins_index_entry() in + the previous invocation of this function. Mark the + off-page columns in the entry inherited. */ + + change_ownership = row_upd_clust_rec_by_insert_inherit( + NULL, NULL, entry, node->update); + ut_a(change_ownership); + /* fall through */ + case UPD_NODE_INSERT_CLUSTERED: + /* A lock wait occurred in row_ins_index_entry() in + the previous invocation of this function. */ + break; + case UPD_NODE_UPDATE_CLUSTERED: + /* This is the first invocation of the function where + we update the primary key. Delete-mark the old record + in the clustered index and prepare to insert a new entry. */ + rec = btr_cur_get_rec(btr_cur); + offsets = rec_get_offsets(rec, index, NULL, + ULINT_UNDEFINED, &heap); + ut_ad(page_rec_is_user_rec(rec)); + + err = btr_cur_del_mark_set_clust_rec( + BTR_NO_LOCKING_FLAG, btr_cur_get_block(btr_cur), + rec, index, offsets, TRUE, thr, mtr); if (err != DB_SUCCESS) { +err_exit: mtr_commit(mtr); + mem_heap_free(heap); return(err); } - /* Mark as not-owned the externally stored fields which the new - row inherits from the delete marked record: purge should not - free those externally stored fields even if the delete marked - record is removed from the index tree, or updated. */ + /* If the the new row inherits externally stored + fields (off-page columns a.k.a. BLOBs) from the + delete-marked old record, mark them disowned by the + old record and owned by the new entry. */ - rec = btr_cur_get_rec(btr_cur); - index = dict_table_get_first_index(table); - offsets = rec_get_offsets(rec, index, offsets_, - ULINT_UNDEFINED, &heap); - change_ownership = btr_cur_mark_extern_inherited_fields( - btr_cur_get_page_zip(btr_cur), - rec, index, offsets, node->update, mtr); - if (referenced) { + if (rec_offs_any_extern(offsets)) { + change_ownership = row_upd_clust_rec_by_insert_inherit( + rec, offsets, entry, node->update); + + if (change_ownership) { + btr_pcur_store_position(pcur, mtr); + } + } + if (referenced) { /* NOTE that the following call loses the position of pcur ! */ @@ -1674,48 +1831,49 @@ row_upd_clust_rec_by_insert( node, pcur, table, index, offsets, thr, mtr); if (err != DB_SUCCESS) { - - mtr_commit(mtr); - - if (UNIV_LIKELY_NULL(heap)) { - mem_heap_free(heap); - } - - return(err); + goto err_exit; } } } mtr_commit(mtr); - if (!heap) { - heap = mem_heap_create(500); - } - node->state = UPD_NODE_INSERT_CLUSTERED; + err = row_ins_index_entry(index, entry, + node->upd_ext ? node->upd_ext->n_ext : 0, + TRUE, thr); + node->state = change_ownership + ? UPD_NODE_INSERT_BLOB + : UPD_NODE_INSERT_CLUSTERED; - entry = row_build_index_entry(node->upd_row, node->upd_ext, - index, heap); - ut_a(entry); + if (err == DB_SUCCESS && change_ownership) { + /* Mark the non-updated fields disowned by the old record. */ - row_upd_index_entry_sys_field(entry, index, DATA_TRX_ID, trx->id); + /* NOTE: this transaction has an x-lock on the record + and therefore other transactions cannot modify the + record when we have no latch on the page. In addition, + we assume that other query threads of the same + transaction do not modify the record in the meantime. + Therefore we can assert that the restoration of the + cursor succeeds. */ - if (change_ownership) { - /* If we return from a lock wait, for example, we may have - extern fields marked as not-owned in entry (marked in the - if-branch above). We must unmark them, take the ownership - back. */ + mtr_start(mtr); + + if (!btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur, mtr)) { + ut_error; + } - btr_cur_unmark_dtuple_extern_fields(entry); + rec = btr_cur_get_rec(btr_cur); + offsets = rec_get_offsets(rec, index, offsets, + ULINT_UNDEFINED, &heap); + ut_ad(page_rec_is_user_rec(rec)); - /* We must mark non-updated extern fields in entry as - inherited, so that a possible rollback will not free them. */ + btr_cur_disown_inherited_fields( + btr_cur_get_page_zip(btr_cur), + rec, index, offsets, node->update, mtr); - btr_cur_mark_dtuple_inherited_extern(entry, node->update); + mtr_commit(mtr); } - err = row_ins_index_entry(index, entry, - node->upd_ext ? node->upd_ext->n_ext : 0, - TRUE, thr); mem_heap_free(heap); return(err); @@ -1860,8 +2018,9 @@ row_upd_del_mark_clust_rec( /* Mark the clustered index record deleted; we do not have to check locks, because we assume that we have an x-lock on the record */ - err = btr_cur_del_mark_set_clust_rec(BTR_NO_LOCKING_FLAG, - btr_cur, TRUE, thr, mtr); + err = btr_cur_del_mark_set_clust_rec( + BTR_NO_LOCKING_FLAG, btr_cur_get_block(btr_cur), + btr_cur_get_rec(btr_cur), index, offsets, TRUE, thr, mtr); if (err == DB_SUCCESS && referenced) { /* NOTE that the following call loses the position of pcur ! */ @@ -2006,7 +2165,8 @@ exit_func: row_upd_store_row(node); - if (row_upd_changes_ord_field_binary(node->row, index, node->update)) { + if (row_upd_changes_ord_field_binary(node->row, node->ext, index, + node->update)) { /* Update causes an ordering field (ordering fields within the B-tree) of the clustered index record to change: perform @@ -2076,7 +2236,8 @@ row_upd( } if (node->state == UPD_NODE_UPDATE_CLUSTERED - || node->state == UPD_NODE_INSERT_CLUSTERED) { + || node->state == UPD_NODE_INSERT_CLUSTERED + || node->state == UPD_NODE_INSERT_BLOB) { log_free_check(); err = row_upd_clust_step(node, thr); diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c index 14fe7e57859..e19e75f27a5 100644 --- a/storage/innobase/srv/srv0srv.c +++ b/storage/innobase/srv/srv0srv.c @@ -87,9 +87,11 @@ Created 10/8/1995 Heikki Tuuri #include "mysql/plugin.h" #include "mysql/service_thd_wait.h" -/* This is set to TRUE if the MySQL user has set it in MySQL; currently -affects only FOREIGN KEY definition parsing */ -UNIV_INTERN ibool srv_lower_case_table_names = FALSE; +/* This is set to the MySQL server value for this variable. It is only +needed for FOREIGN KEY definition parsing since FOREIGN KEY names are not +stored in the server metadata. The server stores and enforces it for +regular database and table names.*/ +UNIV_INTERN uint srv_lower_case_table_names = 0; /* The following counter is incremented whenever there is some user activity in the server */ @@ -831,6 +833,7 @@ srv_table_reserve_slot( ut_a(type > 0); ut_a(type <= SRV_MASTER); + ut_ad(mutex_own(&kernel_mutex)); i = 0; slot = srv_table_get_nth_slot(i); @@ -980,6 +983,37 @@ srv_get_thread_type(void) } /*********************************************************************//** +Check whether thread type has reserved a slot. Return the first slot that +is found. This works because we currently have only 1 thread of each type. +@return slot number or ULINT_UNDEFINED if not found*/ +UNIV_INTERN +ulint +srv_thread_has_reserved_slot( +/*=========================*/ + enum srv_thread_type type) /*!< in: thread type to check */ +{ + ulint i; + ulint slot_no = ULINT_UNDEFINED; + + mutex_enter(&kernel_mutex); + + for (i = 0; i < OS_THREAD_MAX_N; i++) { + srv_slot_t* slot; + + slot = srv_table_get_nth_slot(i); + + if (slot->in_use && slot->type == type) { + slot_no = i; + break; + } + } + + mutex_exit(&kernel_mutex); + + return(slot_no); +} + +/*********************************************************************//** Initializes the server. */ UNIV_INTERN void @@ -2627,10 +2661,10 @@ srv_master_thread( srv_main_thread_process_no = os_proc_get_number(); srv_main_thread_id = os_thread_pf(os_thread_get_curr_id()); - srv_table_reserve_slot(SRV_MASTER); - mutex_enter(&kernel_mutex); + srv_table_reserve_slot(SRV_MASTER); + srv_n_threads_active[SRV_MASTER]++; mutex_exit(&kernel_mutex); diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c index d7ea3d5d3da..acb448a1a67 100644 --- a/storage/innobase/srv/srv0start.c +++ b/storage/innobase/srv/srv0start.c @@ -1026,26 +1026,35 @@ innobase_start_or_create_for_mysql(void) on Mac OS X 10.3 or later. */ struct utsname utsname; if (uname(&utsname)) { - fputs("InnoDB: cannot determine Mac OS X version!\n", stderr); + ut_print_timestamp(stderr); + fputs(" InnoDB: cannot determine Mac OS X version!\n", stderr); } else { srv_have_fullfsync = strcmp(utsname.release, "7.") >= 0; } if (!srv_have_fullfsync) { - fputs("InnoDB: On Mac OS X, fsync() may be" - " broken on internal drives,\n" - "InnoDB: making transactions unsafe!\n", stderr); + ut_print_timestamp(stderr); + fputs(" InnoDB: On Mac OS X, fsync() may be " + "broken on internal drives,\n", stderr); + ut_print_timestamp(stderr); + fputs(" InnoDB: making transactions unsafe!\n", stderr); } # endif /* F_FULLFSYNC */ #endif /* HAVE_DARWIN_THREADS */ if (sizeof(ulint) != sizeof(void*)) { + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Error: size of InnoDB's ulint is %lu," - " but size of void* is %lu.\n" - "InnoDB: The sizes should be the same" - " so that on a 64-bit platform you can\n" - "InnoDB: allocate more than 4 GB of memory.", - (ulong)sizeof(ulint), (ulong)sizeof(void*)); + " InnoDB: Error: size of InnoDB's ulint is %lu, " + "but size of void*\n", (ulong) sizeof(ulint)); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: is %lu. The sizes should be the same " + "so that on a 64-bit\n", + (ulong) sizeof(void*)); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: platforms you can allocate more than 4 GB " + "of memory.\n"); } /* System tables are created in tablespace 0. Thus, we must @@ -1054,53 +1063,68 @@ innobase_start_or_create_for_mysql(void) innodb_file_per_table) until this function has returned. */ srv_file_per_table = FALSE; #ifdef UNIV_DEBUG + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n"); + " InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n"); #endif #ifdef UNIV_IBUF_DEBUG + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n" + " InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n"); # ifdef UNIV_IBUF_COUNT_DEBUG - "InnoDB: !!!!!!!! UNIV_IBUF_COUNT_DEBUG switched on !!!!!!!!!\n" - "InnoDB: Crash recovery will fail with UNIV_IBUF_COUNT_DEBUG\n" + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: !!!!!!!! UNIV_IBUF_COUNT_DEBUG switched on " + "!!!!!!!!!\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Crash recovery will fail with UNIV_IBUF_COUNT_DEBUG\n"); # endif - ); #endif #ifdef UNIV_SYNC_DEBUG + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n"); + " InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n"); #endif #ifdef UNIV_SEARCH_DEBUG + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!\n"); + " InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!\n"); #endif #ifdef UNIV_LOG_LSN_DEBUG + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!\n"); + " InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!\n"); #endif /* UNIV_LOG_LSN_DEBUG */ #ifdef UNIV_MEM_DEBUG + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n"); + " InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n"); #endif if (UNIV_LIKELY(srv_use_sys_malloc)) { + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: The InnoDB memory heap is disabled\n"); + " InnoDB: The InnoDB memory heap is disabled\n"); } - fputs("InnoDB: " IB_ATOMICS_STARTUP_MSG - "\nInnoDB: Compressed tables use zlib " ZLIB_VERSION + ut_print_timestamp(stderr); + fputs(" InnoDB: " IB_ATOMICS_STARTUP_MSG "\n", stderr); + + ut_print_timestamp(stderr); + fputs(" InnoDB: Compressed tables use zlib " ZLIB_VERSION #ifdef UNIV_ZIP_DEBUG " with validation" #endif /* UNIV_ZIP_DEBUG */ + "\n" , stderr); #ifdef UNIV_ZIP_COPY - " and extra copying" + ut_print_timestamp(stderr); + fputs(" InnoDB: and extra copying\n", stderr); #endif /* UNIV_ZIP_COPY */ - "\n" , stderr); /* Since InnoDB does not currently clean up all its internal data structures in MySQL Embedded Server Library server_end(), we @@ -1108,13 +1132,17 @@ innobase_start_or_create_for_mysql(void) second time during the process lifetime. */ if (srv_start_has_been_called) { - fprintf(stderr, - "InnoDB: Error: startup called second time" - " during the process lifetime.\n" - "InnoDB: In the MySQL Embedded Server Library" - " you cannot call server_init()\n" - "InnoDB: more than once during" - " the process lifetime.\n"); + ut_print_timestamp(stderr); + fprintf(stderr, " InnoDB: Error: startup called second time " + "during the process\n"); + ut_print_timestamp(stderr); + fprintf(stderr, " InnoDB: lifetime. In the MySQL Embedded " + "Server Library you\n"); + ut_print_timestamp(stderr); + fprintf(stderr, " InnoDB: cannot call server_init() more " + "than once during the\n"); + ut_print_timestamp(stderr); + fprintf(stderr, " InnoDB: process lifetime.\n"); } srv_start_has_been_called = TRUE; @@ -1158,7 +1186,7 @@ innobase_start_or_create_for_mysql(void) if (srv_use_native_aio) { ut_print_timestamp(stderr); fprintf(stderr, - " InnoDB: Using Linux native AIO\n"); + " InnoDB: Using Linux native AIO\n"); } #else /* Currently native AIO is supported only on windows and linux @@ -1203,8 +1231,9 @@ innobase_start_or_create_for_mysql(void) srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED; #endif } else { + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Unrecognized value %s for" + " InnoDB: Unrecognized value %s for" " innodb_flush_method\n", srv_file_flush_method_str); return(DB_ERROR); @@ -1285,7 +1314,8 @@ innobase_start_or_create_for_mysql(void) we'll emit a message telling the user that this parameter is now deprecated. */ if (srv_n_file_io_threads != 4) { - fprintf(stderr, "InnoDB: Warning:" + ut_print_timestamp(stderr); + fprintf(stderr, " InnoDB: Warning:" " innodb_file_io_threads is deprecated." " Please use innodb_read_io_threads and" " innodb_write_io_threads instead\n"); @@ -1316,7 +1346,7 @@ innobase_start_or_create_for_mysql(void) /* Print time to initialize the buffer pool */ ut_print_timestamp(stderr); fprintf(stderr, - " InnoDB: Initializing buffer pool, size ="); + " InnoDB: Initializing buffer pool, size ="); if (srv_buf_pool_size >= 1024 * 1024 * 1024) { fprintf(stderr, @@ -1332,11 +1362,12 @@ innobase_start_or_create_for_mysql(void) ut_print_timestamp(stderr); fprintf(stderr, - " InnoDB: Completed initialization of buffer pool\n"); + " InnoDB: Completed initialization of buffer pool\n"); if (err != DB_SUCCESS) { + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Fatal error: cannot allocate the memory" + " InnoDB: Fatal error: cannot allocate memory" " for the buffer pool\n"); return(DB_ERROR); @@ -1348,7 +1379,8 @@ innobase_start_or_create_for_mysql(void) if (srv_buf_pool_size <= 5 * 1024 * 1024) { - fprintf(stderr, "InnoDB: Warning: Small buffer pool size " + ut_print_timestamp(stderr); + fprintf(stderr, " InnoDB: Warning: Small buffer pool size " "(%luM), the flst_validate() debug function " "can cause a deadlock if the buffer pool fills up.\n", srv_buf_pool_size / 1024 / 1024); @@ -1370,18 +1402,19 @@ innobase_start_or_create_for_mysql(void) #ifdef UNIV_LOG_ARCHIVE if (0 != ut_strcmp(srv_log_group_home_dirs[0], srv_arch_dir)) { - fprintf(stderr, - "InnoDB: Error: you must set the log group" - " home dir in my.cnf the\n" - "InnoDB: same as log arch dir.\n"); + ut_print_timestamp(stderr); + fprintf(stderr, " InnoDB: Error: you must set the log group home dir in my.cnf\n"); + ut_print_timestamp(stderr); + fprintf(stderr, " InnoDB: the same as log arch dir.\n"); return(DB_ERROR); } #endif /* UNIV_LOG_ARCHIVE */ if (srv_n_log_files * srv_log_file_size >= 262144) { + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Error: combined size of log files" + " InnoDB: Error: combined size of log files" " must be < 4 GB\n"); return(DB_ERROR); @@ -1392,10 +1425,13 @@ innobase_start_or_create_for_mysql(void) for (i = 0; i < srv_n_data_files; i++) { #ifndef __WIN__ if (sizeof(off_t) < 5 && srv_data_file_sizes[i] >= 262144) { + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Error: file size must be < 4 GB" + " with this MySQL binary\n"); + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Error: file size must be < 4 GB" - " with this MySQL binary\n" - "InnoDB: and operating system combination," + " InnoDB: and operating system combination," " in some OS's < 2 GB\n"); return(DB_ERROR); @@ -1405,8 +1441,9 @@ innobase_start_or_create_for_mysql(void) } if (sum_of_new_sizes < 10485760 / UNIV_PAGE_SIZE) { + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Error: tablespace size must be" + " InnoDB: Error: tablespace size must be" " at least 10 MB\n"); return(DB_ERROR); @@ -1419,19 +1456,32 @@ innobase_start_or_create_for_mysql(void) &min_flushed_lsn, &max_flushed_lsn, &sum_of_new_sizes); if (err != DB_SUCCESS) { + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Could not open or create data files.\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: If you tried to add new data files," + " and it failed here,\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: you should now edit innodb_data_file_path" + " in my.cnf back\n"); + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Could not open or create data files.\n" - "InnoDB: If you tried to add new data files," - " and it failed here,\n" - "InnoDB: you should now edit innodb_data_file_path" - " in my.cnf back\n" - "InnoDB: to what it was, and remove the" - " new ibdata files InnoDB created\n" - "InnoDB: in this failed attempt. InnoDB only wrote" - " those files full of\n" - "InnoDB: zeros, but did not yet use them in any way." - " But be careful: do not\n" - "InnoDB: remove old data files" + " InnoDB: to what it was, and remove the" + " new ibdata files InnoDB created\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: in this failed attempt. InnoDB only wrote" + " those files full of\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: zeros, but did not yet use them in any way." + " But be careful: do not\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: remove old data files" " which contain your precious data!\n"); return((int) err); @@ -1457,18 +1507,29 @@ innobase_start_or_create_for_mysql(void) } if ((log_opened && create_new_db) || (log_opened && log_created)) { + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Error: all log files must be" + " created at the same time.\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: All log files must be" + " created also in database creation.\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: If you want bigger or smaller" + " log files, shut down the\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: database and make sure there" + " were no errors in shutdown.\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Then delete the existing log files." + " Edit the .cnf file\n"); + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Error: all log files must be" - " created at the same time.\n" - "InnoDB: All log files must be" - " created also in database creation.\n" - "InnoDB: If you want bigger or smaller" - " log files, shut down the\n" - "InnoDB: database and make sure there" - " were no errors in shutdown.\n" - "InnoDB: Then delete the existing log files." - " Edit the .cnf file\n" - "InnoDB: and start the database again.\n"); + " InnoDB: and start the database again.\n"); return(DB_ERROR); } @@ -1489,27 +1550,41 @@ innobase_start_or_create_for_mysql(void) || max_arch_log_no != min_arch_log_no #endif /* UNIV_LOG_ARCHIVE */ ) { + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Cannot initialize created" + " log files because\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: data files were not in sync" + " with each other\n"); + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Cannot initialize created" - " log files because\n" - "InnoDB: data files were not in sync" - " with each other\n" - "InnoDB: or the data files are corrupt.\n"); + " InnoDB: or the data files are corrupt.\n"); return(DB_ERROR); } if (max_flushed_lsn < (ib_uint64_t) 1000) { + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Cannot initialize created" + " log files because\n"); + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Cannot initialize created" - " log files because\n" - "InnoDB: data files are corrupt," - " or new data files were\n" - "InnoDB: created when the database" - " was started previous\n" - "InnoDB: time but the database" - " was not shut down\n" - "InnoDB: normally after that.\n"); + " InnoDB: data files are corrupt," + " or new data files were\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: created when the database" + " was started previous\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: time but the database" + " was not shut down\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: normally after that.\n"); return(DB_ERROR); } @@ -1548,8 +1623,9 @@ innobase_start_or_create_for_mysql(void) #ifdef UNIV_LOG_ARCHIVE } else if (srv_archive_recovery) { + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Starting archive" + " InnoDB: Starting archive" " recovery from a backup...\n"); err = recv_recovery_from_archive_start( min_flushed_lsn, srv_archive_recovery_limit_lsn, @@ -1757,6 +1833,24 @@ innobase_start_or_create_for_mysql(void) os_thread_create(&srv_purge_thread, NULL, NULL); } + /* Wait for the purge and master thread to startup. */ + + while (srv_shutdown_state == SRV_SHUTDOWN_NONE) { + if (srv_thread_has_reserved_slot(SRV_MASTER) == ULINT_UNDEFINED + || (srv_n_purge_threads == 1 + && srv_thread_has_reserved_slot(SRV_WORKER) + == ULINT_UNDEFINED)) { + + ut_print_timestamp(stderr); + fprintf(stderr, " InnoDB: " + "Waiting for the background threads to " + "start\n"); + os_thread_sleep(1000000); + } else { + break; + } + } + #ifdef UNIV_DEBUG /* buf_debug_prints = TRUE; */ #endif /* UNIV_DEBUG */ @@ -1771,11 +1865,14 @@ innobase_start_or_create_for_mysql(void) if (!srv_auto_extend_last_data_file && sum_of_data_file_sizes != tablespace_size_in_header) { + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Error: tablespace size" + " stored in header is %lu pages, but\n", + (ulong) tablespace_size_in_header); + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Error: tablespace size" - " stored in header is %lu pages, but\n" "InnoDB: the sum of data file sizes is %lu pages\n", - (ulong) tablespace_size_in_header, (ulong) sum_of_data_file_sizes); if (srv_force_recovery == 0 @@ -1783,16 +1880,25 @@ innobase_start_or_create_for_mysql(void) /* This is a fatal error, the tail of a tablespace is missing */ + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Cannot start InnoDB." + " The tail of the system tablespace is\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: missing. Have you edited" + " innodb_data_file_path in my.cnf in an\n"); + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Cannot start InnoDB." - " The tail of the system tablespace is\n" - "InnoDB: missing. Have you edited" - " innodb_data_file_path in my.cnf in an\n" - "InnoDB: inappropriate way, removing" - " ibdata files from there?\n" - "InnoDB: You can set innodb_force_recovery=1" - " in my.cnf to force\n" - "InnoDB: a startup if you are trying" + " InnoDB: inappropriate way, removing" + " ibdata files from there?\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: You can set innodb_force_recovery=1" + " in my.cnf to force\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: a startup if you are trying" " to recover a badly corrupt database.\n"); return(DB_ERROR); @@ -1802,26 +1908,38 @@ innobase_start_or_create_for_mysql(void) if (srv_auto_extend_last_data_file && sum_of_data_file_sizes < tablespace_size_in_header) { + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Error: tablespace size stored in header" - " is %lu pages, but\n" - "InnoDB: the sum of data file sizes" + " InnoDB: Error: tablespace size stored in header" + " is %lu pages, but\n", + (ulong) tablespace_size_in_header); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: the sum of data file sizes" " is only %lu pages\n", - (ulong) tablespace_size_in_header, (ulong) sum_of_data_file_sizes); if (srv_force_recovery == 0) { + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Cannot start InnoDB. The tail of" + " the system tablespace is\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: missing. Have you edited" + " innodb_data_file_path in my.cnf in an\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: inappropriate way, removing" + " ibdata files from there?\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: You can set innodb_force_recovery=1" + " in my.cnf to force\n"); + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Cannot start InnoDB. The tail of" - " the system tablespace is\n" - "InnoDB: missing. Have you edited" - " innodb_data_file_path in my.cnf in an\n" - "InnoDB: inappropriate way, removing" - " ibdata files from there?\n" - "InnoDB: You can set innodb_force_recovery=1" - " in my.cnf to force\n" - "InnoDB: a startup if you are trying to" + " InnoDB: a startup if you are trying to" " recover a badly corrupt database.\n"); return(DB_ERROR); @@ -1832,10 +1950,13 @@ innobase_start_or_create_for_mysql(void) os_fast_mutex_init(&srv_os_test_mutex); if (0 != os_fast_mutex_trylock(&srv_os_test_mutex)) { + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Error: pthread_mutex_trylock returns" - " an unexpected value on\n" - "InnoDB: success! Cannot continue.\n"); + " InnoDB: Error: pthread_mutex_trylock returns" + " an unexpected value on\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: success! Cannot continue.\n"); exit(1); } @@ -1850,14 +1971,15 @@ innobase_start_or_create_for_mysql(void) if (srv_print_verbose_log) { ut_print_timestamp(stderr); fprintf(stderr, - " InnoDB: %s started; " + " InnoDB: %s started; " "log sequence number %llu\n", INNODB_VERSION_STR, srv_start_lsn); } if (srv_force_recovery > 0) { + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: !!! innodb_force_recovery" + " InnoDB: !!! innodb_force_recovery" " is set to %lu !!!\n", (ulong) srv_force_recovery); } @@ -1878,12 +2000,17 @@ innobase_start_or_create_for_mysql(void) 4.1.1. It is essential that the insert buffer is emptied here! */ + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: You are upgrading to an" + " InnoDB version which allows multiple\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: tablespaces. Wait that purge" + " and insert buffer merge run to\n"); + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: You are upgrading to an" - " InnoDB version which allows multiple\n" - "InnoDB: tablespaces. Wait that purge" - " and insert buffer merge run to\n" - "InnoDB: completion...\n"); + " InnoDB: completion...\n"); for (;;) { os_thread_sleep(1000000); @@ -1895,21 +2022,29 @@ innobase_start_or_create_for_mysql(void) break; } } + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Full purge and insert buffer merge" + " InnoDB: Full purge and insert buffer merge" " completed.\n"); trx_sys_mark_upgraded_to_multiple_tablespaces(); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: You have now successfully upgraded" + " to the multiple tablespaces\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: format. You should NOT DOWNGRADE" + " to an earlier version of\n"); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: InnoDB! But if you absolutely need to" + " downgrade, see\n"); + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: You have now successfully upgraded" - " to the multiple tablespaces\n" - "InnoDB: format. You should NOT DOWNGRADE" - " to an earlier version of\n" - "InnoDB: InnoDB! But if you absolutely need to" - " downgrade, see\n" - "InnoDB: " REFMAN "multiple-tablespaces.html\n" - "InnoDB: for instructions.\n"); + " InnoDB: " REFMAN "multiple-tablespaces.html\n" + " InnoDB: for instructions.\n"); } if (srv_force_recovery == 0) { diff --git a/storage/innobase/sync/sync0arr.c b/storage/innobase/sync/sync0arr.c index 753ebd958ac..ce9d42c4921 100644 --- a/storage/innobase/sync/sync0arr.c +++ b/storage/innobase/sync/sync0arr.c @@ -590,9 +590,6 @@ sync_array_deadlock_step( ulint depth) /*!< in: recursion depth */ { sync_cell_t* new; - ibool ret; - - depth++; if (pass != 0) { /* If pass != 0, then we do not know which threads are @@ -604,7 +601,7 @@ sync_array_deadlock_step( new = sync_array_find_thread(arr, thread); - if (new == start) { + if (UNIV_UNLIKELY(new == start)) { /* Stop running of other threads */ ut_dbg_stop_threads = TRUE; @@ -616,11 +613,7 @@ sync_array_deadlock_step( return(TRUE); } else if (new) { - ret = sync_array_detect_deadlock(arr, start, new, depth); - - if (ret) { - return(TRUE); - } + return(sync_array_detect_deadlock(arr, start, new, depth + 1)); } return(FALSE); } @@ -930,12 +923,25 @@ sync_array_print_long_waits(void) ulint fatal_timeout = srv_fatal_semaphore_wait_threshold; ibool fatal = FALSE; +#ifdef UNIV_DEBUG_VALGRIND + /* Increase the timeouts if running under valgrind because it executes + extremely slowly. UNIV_DEBUG_VALGRIND does not necessary mean that + we are running under valgrind but we have no better way to tell. + See Bug#58432 innodb.innodb_bug56143 fails under valgrind + for an example */ +# define SYNC_ARRAY_TIMEOUT 2400 + fatal_timeout *= 10; +#else +# define SYNC_ARRAY_TIMEOUT 240 +#endif + for (i = 0; i < sync_primary_wait_array->n_cells; i++) { cell = sync_array_get_nth_cell(sync_primary_wait_array, i); if (cell->wait_object != NULL && cell->waiting - && difftime(time(NULL), cell->reservation_time) > 240) { + && difftime(time(NULL), cell->reservation_time) + > SYNC_ARRAY_TIMEOUT) { fputs("InnoDB: Warning: a long semaphore wait:\n", stderr); sync_array_cell_print(stderr, cell); @@ -977,6 +983,8 @@ sync_array_print_long_waits(void) " to the standard error stream\n"); } +#undef SYNC_ARRAY_TIMEOUT + return(fatal); } diff --git a/storage/innobase/trx/trx0i_s.c b/storage/innobase/trx/trx0i_s.c index 8b11e706180..aff49e20726 100644 --- a/storage/innobase/trx/trx0i_s.c +++ b/storage/innobase/trx/trx0i_s.c @@ -442,7 +442,7 @@ i_s_locks_row_validate( /* record lock */ ut_ad(!strcmp("RECORD", row->lock_type)); ut_ad(row->lock_index != NULL); - ut_ad(row->lock_data != NULL); + /* row->lock_data == NULL if buf_page_try_get() == NULL */ ut_ad(row->lock_page != ULINT_UNDEFINED); ut_ad(row->lock_rec != ULINT_UNDEFINED); } @@ -508,7 +508,6 @@ fill_trx_row( stmt = innobase_get_stmt(trx->mysql_thd, &stmt_len); if (stmt != NULL) { - char query[TRX_I_S_TRX_QUERY_MAX_LEN + 1]; if (stmt_len > TRX_I_S_TRX_QUERY_MAX_LEN) { @@ -522,6 +521,8 @@ fill_trx_row( cache->storage, stmt, stmt_len + 1, MAX_ALLOWED_FOR_STORAGE(cache)); + row->trx_query_cs = innobase_get_charset(trx->mysql_thd); + if (row->trx_query == NULL) { return(FALSE); diff --git a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c index 26498a1b712..101f225a06f 100644 --- a/storage/innobase/trx/trx0sys.c +++ b/storage/innobase/trx/trx0sys.c @@ -1160,7 +1160,7 @@ trx_sys_file_format_max_check( ut_print_timestamp(stderr); fprintf(stderr, - " InnoDB: highest supported file format is %s.\n", + " InnoDB: highest supported file format is %s.\n", trx_sys_file_format_id_to_name(DICT_TF_FORMAT_MAX)); if (format_id > DICT_TF_FORMAT_MAX) { @@ -1169,7 +1169,7 @@ trx_sys_file_format_max_check( ut_print_timestamp(stderr); fprintf(stderr, - " InnoDB: %s: the system tablespace is in a file " + " InnoDB: %s: the system tablespace is in a file " "format that this version doesn't support - %s\n", ((max_format_id <= DICT_TF_FORMAT_MAX) ? "Error" : "Warning"), diff --git a/storage/innobase/ut/ut0dbg.c b/storage/innobase/ut/ut0dbg.c index e79217d5b86..42ad8c03762 100644 --- a/storage/innobase/ut/ut0dbg.c +++ b/storage/innobase/ut/ut0dbg.c @@ -74,7 +74,7 @@ ut_dbg_assertion_failed( " or crashes, even\n" "InnoDB: immediately after the mysqld startup, there may be\n" "InnoDB: corruption in the InnoDB tablespace. Please refer to\n" - "InnoDB: " REFMAN "forcing-recovery.html\n" + "InnoDB: " REFMAN "forcing-innodb-recovery.html\n" "InnoDB: about forcing recovery.\n", stderr); #if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT) ut_dbg_stop_threads = TRUE; diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index c4bb6d7dbd4..c7b6b2239ce 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -168,10 +168,9 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type, Also we likely need to lock mutex here (in both cases with protocol and push_warning). */ -#ifdef THREAD if (param->need_print_msg_lock) mysql_mutex_lock(¶m->print_msg_mutex); -#endif + protocol->prepare_for_resend(); protocol->store(name, length, system_charset_info); protocol->store(param->op_name, system_charset_info); @@ -180,10 +179,10 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type, if (protocol->write()) sql_print_error("Failed on my_net_write, writing to stderr instead: %s\n", msgbuf); -#ifdef THREAD + if (param->need_print_msg_lock) mysql_mutex_unlock(¶m->print_msg_mutex); -#endif + return; } diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index 79a8105f823..5d8a7c3daef 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -99,9 +99,7 @@ void myisamchk_init(MI_CHECK *param) param->max_record_length= LONGLONG_MAX; param->key_cache_block_size= KEY_CACHE_BLOCK_SIZE; param->stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL; -#ifdef THREAD param->need_print_msg_lock= 0; -#endif } /* Check the status flags for the table */ @@ -2631,9 +2629,6 @@ err: int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, const char * name, int rep_quick) { -#ifndef THREAD - return mi_repair_by_sort(param, info, name, rep_quick); -#else int got_error; uint i,key, total_key_length, istep; ulong rec_length; @@ -3122,7 +3117,6 @@ err: share->pack.header_length=0; } DBUG_RETURN(got_error); -#endif /* THREAD */ } /* Read next record and return next key */ diff --git a/storage/myisam/mi_close.c b/storage/myisam/mi_close.c index 51408ab191c..105ee3810cd 100644 --- a/storage/myisam/mi_close.c +++ b/storage/myisam/mi_close.c @@ -91,7 +91,6 @@ int mi_close(register MI_INFO *info) my_free(share->decode_trees); my_free(share->decode_tables); } -#ifdef THREAD thr_lock_delete(&share->lock); mysql_mutex_destroy(&share->intern_lock); { @@ -102,7 +101,6 @@ int mi_close(register MI_INFO *info) mysql_rwlock_destroy(&share->key_root_lock[i]); } } -#endif my_free(info->s); } mysql_mutex_unlock(&THR_LOCK_myisam); diff --git a/storage/myisam/mi_delete.c b/storage/myisam/mi_delete.c index 9314148cd8c..5fa7cba7d5e 100644 --- a/storage/myisam/mi_delete.c +++ b/storage/myisam/mi_delete.c @@ -102,7 +102,7 @@ int mi_delete(MI_INFO *info,const uchar *record) mi_sizestore(lastpos,info->lastpos); myisam_log_command(MI_LOG_DELETE,info,(uchar*) lastpos,sizeof(lastpos),0); (void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE); - allow_break(); /* Allow SIGHUP & SIGINT */ + if (info->invalidator != 0) { DBUG_PRINT("info", ("invalidator... '%s' (delete)", info->filename)); @@ -122,7 +122,6 @@ err: } (void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE); info->update|=HA_STATE_WRITTEN; /* Buffer changed */ - allow_break(); /* Allow SIGHUP & SIGINT */ my_errno=save_errno; if (save_errno == HA_ERR_KEY_NOT_FOUND) { diff --git a/storage/myisam/mi_delete_all.c b/storage/myisam/mi_delete_all.c index 7a2e24189e6..cc610b73839 100644 --- a/storage/myisam/mi_delete_all.c +++ b/storage/myisam/mi_delete_all.c @@ -66,7 +66,6 @@ int mi_delete_all_rows(MI_INFO *info) if (share->file_map) mi_dynmap_file(info, (my_off_t) 0); #endif - allow_break(); /* Allow SIGHUP & SIGINT */ DBUG_RETURN(0); err: @@ -74,7 +73,6 @@ err: int save_errno=my_errno; (void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE); info->update|=HA_STATE_WRITTEN; /* Buffer changed */ - allow_break(); /* Allow SIGHUP & SIGINT */ DBUG_RETURN(my_errno=save_errno); } } /* mi_delete */ diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c index f429edd2759..8b407a36d6f 100644 --- a/storage/myisam/mi_dynrec.c +++ b/storage/myisam/mi_dynrec.c @@ -39,13 +39,11 @@ static int delete_dynamic_record(MI_INFO *info,my_off_t filepos, static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos, uint length); -#ifdef THREAD /* Play it safe; We have a small stack when using threads */ #undef my_alloca #undef my_afree #define my_alloca(A) my_malloc((A),MYF(0)) #define my_afree(A) my_free((A)) -#endif /* Interface function from MI_INFO */ @@ -1579,9 +1577,6 @@ int _mi_cmp_dynamic_record(register MI_INFO *info, register const uchar *record) MI_BLOCK_INFO block_info; DBUG_ENTER("_mi_cmp_dynamic_record"); - /* We are going to do changes; dont let anybody disturb */ - dont_break(); /* Dont allow SIGHUP or SIGINT */ - if (info->opt_flag & WRITE_CACHE_USED) { info->update&= ~(HA_STATE_WRITE_AT_END | HA_STATE_EXTEND_BLOCK); diff --git a/storage/myisam/mi_log.c b/storage/myisam/mi_log.c index 5af4a057a95..4b207f48e1c 100644 --- a/storage/myisam/mi_log.c +++ b/storage/myisam/mi_log.c @@ -24,11 +24,7 @@ #endif #undef GETPID /* For HPUX */ -#ifdef THREAD #define GETPID() (log_type == 1 ? (long) myisam_pid : (long) my_thread_dbug_id()) -#else -#define GETPID() myisam_pid -#endif /* Activate logging if flag is 1 and reset logging if flag is 0 */ diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index e3c29909067..6efcfd8862f 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -286,9 +286,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) &share->state.key_root,keys*sizeof(my_off_t), &share->state.key_del, (share->state.header.max_block_size_index*sizeof(my_off_t)), -#ifdef THREAD &share->key_root_lock, sizeof(mysql_rwlock_t)*keys, -#endif &share->mmap_lock, sizeof(mysql_rwlock_t), NullS)) goto err; @@ -498,7 +496,6 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) my_afree(disk_cache); mi_setup_functions(share); share->is_log_table= FALSE; -#ifdef THREAD thr_lock_init(&share->lock); mysql_mutex_init(mi_key_mutex_MYISAM_SHARE_intern_lock, &share->intern_lock, MY_MUTEX_INIT_FAST); @@ -528,7 +525,6 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) share->lock.check_status=mi_check_status; } } -#endif /* Memory mapping can only be requested after initializing intern_lock. */ @@ -625,9 +621,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) bzero(info.rec_buff, mi_get_rec_buff_len(&info, info.rec_buff)); *m_info=info; -#ifdef THREAD thr_lock_data_init(&share->lock,&m_info->lock,(void*) m_info); -#endif m_info->open_list.data=(void*) m_info; myisam_open_list=list_add(myisam_open_list,&m_info->open_list); diff --git a/storage/myisam/mi_static.c b/storage/myisam/mi_static.c index 55967fc9001..711287ca16f 100644 --- a/storage/myisam/mi_static.c +++ b/storage/myisam/mi_static.c @@ -32,7 +32,7 @@ File myisam_log_file= -1; uint myisam_quick_table_bits=9; ulong myisam_block_size= MI_KEY_BLOCK_LENGTH; /* Best by test */ my_bool myisam_flush=0, myisam_delay_key_write=0, myisam_single_user=0; -#if defined(THREAD) && !defined(DONT_USE_RW_LOCKS) +#if !defined(DONT_USE_RW_LOCKS) ulong myisam_concurrent_insert= 2; #else ulong myisam_concurrent_insert= 0; diff --git a/storage/myisam/mi_statrec.c b/storage/myisam/mi_statrec.c index f83afa3c886..bf791726aa9 100644 --- a/storage/myisam/mi_statrec.c +++ b/storage/myisam/mi_statrec.c @@ -114,9 +114,6 @@ int _mi_cmp_static_record(register MI_INFO *info, register const uchar *old) { DBUG_ENTER("_mi_cmp_static_record"); - /* We are going to do changes; dont let anybody disturb */ - dont_break(); /* Dont allow SIGHUP or SIGINT */ - if (info->opt_flag & WRITE_CACHE_USED) { if (flush_io_cache(&info->rec_cache)) diff --git a/storage/myisam/mi_update.c b/storage/myisam/mi_update.c index b538bcd0bb1..a9aad421235 100644 --- a/storage/myisam/mi_update.c +++ b/storage/myisam/mi_update.c @@ -179,7 +179,6 @@ int mi_update(register MI_INFO *info, const uchar *oldrec, uchar *newrec) there is no index change there could be data change. */ (void) _mi_writeinfo(info, WRITEINFO_UPDATE_KEYFILE); - allow_break(); /* Allow SIGHUP & SIGINT */ if (info->invalidator != 0) { DBUG_PRINT("info", ("invalidator... '%s' (update)", info->filename)); @@ -230,7 +229,6 @@ err: err_end: myisam_log_record(MI_LOG_UPDATE,info,newrec,info->lastpos,my_errno); (void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE); - allow_break(); /* Allow SIGHUP & SIGINT */ if (save_errno == HA_ERR_KEY_NOT_FOUND) { mi_print_error(info->s, HA_ERR_CRASHED); diff --git a/storage/myisam/mi_write.c b/storage/myisam/mi_write.c index bd56bb04f65..f3fbb7206e2 100644 --- a/storage/myisam/mi_write.c +++ b/storage/myisam/mi_write.c @@ -60,7 +60,7 @@ int mi_write(MI_INFO *info, uchar *record) } if (_mi_readinfo(info,F_WRLCK,1)) DBUG_RETURN(my_errno); - dont_break(); /* Dont allow SIGHUP or SIGINT */ + filepos= ((share->state.dellink != HA_OFFSET_ERROR && !info->append_insert_at_end) ? share->state.dellink : @@ -169,7 +169,6 @@ int mi_write(MI_INFO *info, uchar *record) if (share->is_log_table) mi_update_status((void*) info); - allow_break(); /* Allow SIGHUP & SIGINT */ DBUG_RETURN(0); err: @@ -228,7 +227,6 @@ err2: save_errno=my_errno; myisam_log_record(MI_LOG_WRITE,info,record,filepos,my_errno); (void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE); - allow_break(); /* Allow SIGHUP & SIGINT */ DBUG_RETURN(my_errno=save_errno); } /* mi_write */ diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h index c7f0cb27a40..133d0cec9eb 100644 --- a/storage/myisam/myisamdef.h +++ b/storage/myisam/myisamdef.h @@ -18,12 +18,8 @@ #include "myisam.h" /* Structs & some defines */ #include "myisampack.h" /* packing of keys */ #include <my_tree.h> -#ifdef THREAD #include <my_pthread.h> #include <thr_lock.h> -#else -#include <my_no_pthread.h> -#endif #include <mysql/psi/mysql_file.h> /* undef map from my_nosys; We need test-if-disk full */ @@ -211,11 +207,10 @@ typedef struct st_mi_isam_share { /* Shared between opens */ not_flushed, temporary,delay_key_write, concurrent_insert; -#ifdef THREAD + THR_LOCK lock; mysql_mutex_t intern_lock; /* Locking for use with _locking */ mysql_rwlock_t *key_root_lock; -#endif my_off_t mmaped_length; uint nonmmaped_inserts; /* counter of writing in non-mmaped area */ @@ -298,9 +293,7 @@ struct st_myisam_info { #ifdef __WIN__ my_bool owned_by_merge; /* This MyISAM table is part of a merge union */ #endif -#ifdef THREAD THR_LOCK_DATA lock; -#endif uchar *rtree_recursion_state; /* For RTREE */ int rtree_recursion_depth; }; @@ -461,10 +454,9 @@ typedef struct st_mi_sort_param #define MI_UNIQUE_HASH_TYPE HA_KEYTYPE_ULONG_INT #define mi_unique_store(A,B) mi_int4store((A),(B)) -#ifdef THREAD extern mysql_mutex_t THR_LOCK_myisam; -#endif -#if !defined(THREAD) || defined(DONT_USE_RW_LOCKS) + +#if defined(DONT_USE_RW_LOCKS) #define mysql_rwlock_wrlock(A) {} #define mysql_rwlock_rdlock(A) {} #define mysql_rwlock_unlock(A) {} @@ -774,9 +766,7 @@ void mi_check_print_info(MI_CHECK *param, const char *fmt,...); int flush_pending_blocks(MI_SORT_PARAM *param); int sort_ft_buf_flush(MI_SORT_PARAM *sort_param); int thr_write_keys(MI_SORT_PARAM *sort_param); -#ifdef THREAD pthread_handler_t thr_find_all_keys(void *arg); -#endif int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file); int sort_write_record(MI_SORT_PARAM *sort_param); diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c index 9532b9f0474..6630b99dd9c 100644 --- a/storage/myisam/sort.c +++ b/storage/myisam/sort.c @@ -302,7 +302,6 @@ static ha_rows find_all_keys(MI_SORT_PARAM *info, uint keys, } /* find_all_keys */ -#ifdef THREAD /* Search after all keys and place them in a temp. file */ pthread_handler_t thr_find_all_keys(void *arg) @@ -637,7 +636,6 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) my_free(mergebuf); DBUG_RETURN(got_error); } -#endif /* THREAD */ /* Write all keys in memory to file for later merge */ diff --git a/storage/myisammrg/myrg_def.h b/storage/myisammrg/myrg_def.h index b916243be21..9bc0881b212 100644 --- a/storage/myisammrg/myrg_def.h +++ b/storage/myisammrg/myrg_def.h @@ -23,9 +23,7 @@ extern LIST *myrg_open_list; -#ifdef THREAD extern mysql_mutex_t THR_LOCK_open; -#endif int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag); int _myrg_mi_read_record(MI_INFO *info, uchar *buf); diff --git a/tests/thread_test.c b/tests/thread_test.c index c243a3a7321..4edfe59772c 100644 --- a/tests/thread_test.c +++ b/tests/thread_test.c @@ -15,15 +15,6 @@ #include <my_global.h> -#ifndef THREAD - -int main(int argc __attribute__((unused)), char **argv __attribute__((unused))) -{ - printf("This test must be compiled with multithread support to work\n"); - exit(1); -} -#else - #include <my_sys.h> #include <my_pthread.h> #include "mysql.h" @@ -254,4 +245,3 @@ int main(int argc, char **argv) return 0; /* Keep some compilers happy */ } -#endif /* THREAD */ |