diff --git a/client/mysqltest.cc b/client/mysqltest.cc index f7cf82bc9b2..0327a6bd91e 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -3883,9 +3883,9 @@ void do_move_file(struct st_command *command) is_sub_path(ds_to_file.str, to_plen, vardir)) || (is_sub_path(ds_from_file.str, from_plen, tmpdir) && is_sub_path(ds_to_file.str, to_plen, tmpdir)))) { - report_or_die("Paths '%s' and '%s' are not both under MYSQLTEST_VARDIR '%s'" - "or both under MYSQL_TMP_DIR '%s'", - ds_from_file, ds_to_file, vardir, tmpdir); + report_or_die("Paths '%s' and '%s' are not both under " + "MYSQLTEST_VARDIR '%s' or both under MYSQL_TMP_DIR '%s'", + ds_from_file.str, ds_to_file.str, vardir, tmpdir); DBUG_VOID_RETURN; } diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index 95e0908f2d1..96087e60d48 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -229,7 +229,8 @@ IF(WITH_WSREP) SETA(CPACK_RPM_server_PACKAGE_REQUIRES "galera-4" "rsync" "grep" "gawk" "iproute" "coreutils" "findutils" "tar") - SETA(CPACK_RPM_server_PACKAGE_RECOMMENDS "lsof") + SETA(CPACK_RPM_server_PACKAGE_RECOMMENDS "lsof" "socat") + SETA(CPACK_RPM_test_PACKAGE_REQUIRES "socat") ENDIF() SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-prein.sh) diff --git a/cmake/os/FreeBSD.cmake b/cmake/os/FreeBSD.cmake index 9eccdd90c34..c15ae715241 100644 --- a/cmake/os/FreeBSD.cmake +++ b/cmake/os/FreeBSD.cmake @@ -20,9 +20,6 @@ # #Legacy option, maybe not needed anymore , taken as is from autotools build # ADD_DEFINITIONS(-DNET_RETRY_COUNT=1000000) -# The below was used for really old versions of FreeBSD, roughly: before 5.1.9 -# ADD_DEFINITIONS(-DHAVE_BROKEN_REALPATH) - # Find libexecinfo (library that contains backtrace_symbols etc) SET(EXECINFO_ROOT /usr/local CACHE INTERNAL "Where to find execinfo library and header") INCLUDE_DIRECTORIES(${EXECINFO_ROOT}/include) diff --git a/config.h.cmake b/config.h.cmake index 1f7d6b7940e..4fb2f7f8ddf 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -196,6 +196,7 @@ #cmakedefine HAVE_PTHREAD_ATTR_GETSTACKSIZE 1 #cmakedefine HAVE_PTHREAD_ATTR_SETSCOPE 1 #cmakedefine HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 +#cmakedefine HAVE_PTHREAD_GETATTR_NP 1 #cmakedefine HAVE_PTHREAD_CONDATTR_CREATE 1 #cmakedefine HAVE_PTHREAD_GETAFFINITY_NP 1 #cmakedefine HAVE_PTHREAD_KEY_DELETE 1 diff --git a/configure.cmake b/configure.cmake index 7d345645b85..0aaac0c5321 100644 --- a/configure.cmake +++ b/configure.cmake @@ -379,6 +379,7 @@ CHECK_FUNCTION_EXISTS (pthread_attr_getguardsize HAVE_PTHREAD_ATTR_GETGUARDSIZE) CHECK_FUNCTION_EXISTS (pthread_attr_setstacksize HAVE_PTHREAD_ATTR_SETSTACKSIZE) CHECK_FUNCTION_EXISTS (pthread_condattr_create HAVE_PTHREAD_CONDATTR_CREATE) CHECK_FUNCTION_EXISTS (pthread_getaffinity_np HAVE_PTHREAD_GETAFFINITY_NP) +CHECK_FUNCTION_EXISTS (pthread_getattr_np HAVE_PTHREAD_GETATTR_NP) CHECK_FUNCTION_EXISTS (pthread_key_delete HAVE_PTHREAD_KEY_DELETE) CHECK_FUNCTION_EXISTS (pthread_rwlock_rdlock HAVE_PTHREAD_RWLOCK_RDLOCK) CHECK_FUNCTION_EXISTS (pthread_sigmask HAVE_PTHREAD_SIGMASK) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 87018b8b5e4..4534bfb58b7 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -6867,7 +6867,6 @@ void handle_options(int argc, char **argv, char ***argv_server, } static int main_low(char** argv); -static int get_exepath(char *buf, size_t size, const char *argv0); /* ================= main =================== */ int main(int argc, char **argv) @@ -6878,8 +6877,8 @@ int main(int argc, char **argv) my_getopt_prefix_matching= 0; - if (get_exepath(mariabackup_exe,FN_REFLEN, argv[0])) - strncpy(mariabackup_exe,argv[0], FN_REFLEN-1); + if (my_get_exepath(mariabackup_exe, FN_REFLEN, argv[0])) + strncpy(mariabackup_exe, argv[0], FN_REFLEN-1); if (argc > 1 ) @@ -7176,32 +7175,6 @@ static int main_low(char** argv) } -static int get_exepath(char *buf, size_t size, const char *argv0) -{ -#ifdef _WIN32 - DWORD ret = GetModuleFileNameA(NULL, buf, (DWORD)size); - if (ret > 0) - return 0; -#elif defined(__linux__) - ssize_t ret = readlink("/proc/self/exe", buf, size-1); - if(ret > 0) - return 0; -#elif defined(__APPLE__) - size_t ret = proc_pidpath(getpid(), buf, static_cast(size)); - if (ret > 0) { - buf[ret] = 0; - return 0; - } -#elif defined(__FreeBSD__) - int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1}; - if (sysctl(mib, 4, buf, &size, NULL, 0) == 0) { - return 0; - } -#endif - - return my_realpath(buf, argv0, 0); -} - #if defined (__SANITIZE_ADDRESS__) && defined (__linux__) /* Avoid LeakSanitizer's false positives. */ diff --git a/include/m_string.h b/include/m_string.h index ba2e90de4d0..6f7314cf985 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -285,12 +285,19 @@ static inline void safe_strcpy(char *dst, size_t dst_size, const char *src) static inline int safe_strcpy_truncated(char *dst, size_t dst_size, const char *src) { - DBUG_ASSERT(dst_size > 0); - strncpy(dst, src, dst_size); - if (dst[dst_size - 1]) + DBUG_ASSERT(dst_size > 0); + if (dst_size == 0) + return 1; + /* + We do not want to use strncpy() as we do not want to rely on + strncpy() filling the unused dst with 0. + We cannot use strmake() here as it in debug mode fills the buffers + with 'Z'. + */ + if (strnmov(dst, src, dst_size) == dst+dst_size) { - dst[dst_size - 1]= 0; + dst[dst_size-1]= 0; return 1; } return 0; @@ -306,7 +313,7 @@ static inline int safe_strcpy_truncated(char *dst, size_t dst_size, static inline int safe_strcat(char *dst, size_t dst_size, const char *src) { size_t init_len= strlen(dst); - if (init_len > dst_size) + if (init_len >= dst_size) return 1; return safe_strcpy_truncated(dst + init_len, dst_size - init_len, src); } diff --git a/include/my_global.h b/include/my_global.h index d6af6e8b938..295e29f6fe3 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -823,7 +823,6 @@ typedef long long my_ptrdiff_t; #define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A), sizeof(double))) #define ADD_TO_PTR(ptr,size,type) (type) ((uchar*) (ptr)+size) #define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((uchar*) (A) - (uchar*) (B)) -#define PREV_BITS(type,A) ((type) (((type) 1 << (A)) -1)) /* Custom version of standard offsetof() macro which can be used to get diff --git a/include/my_stack_alloc.h b/include/my_stack_alloc.h index 95e746d6fe7..796bb69f877 100644 --- a/include/my_stack_alloc.h +++ b/include/my_stack_alloc.h @@ -17,6 +17,65 @@ #ifndef _my_stack_alloc_h #define _my_stack_alloc_h +#ifdef _MSC_VER +#include // For MSVC-specific intrinsics +#else +#include +#endif + + +/* + Get the address of the current stack. + This will fallback to using an estimate for the stack pointer + in the cases where either the compiler or the architecture is + not supported. +*/ + +static inline void *my_get_stack_pointer(void *default_stack) +{ + void *stack_ptr= NULL; + +#if defined(__GNUC__) || defined(__clang__) /* GCC and Clang compilers */ +#if defined(__i386__) /* Intel x86 (32-bit) */ + __asm__ volatile ("movl %%esp, %0" : "=r" (stack_ptr)); +#elif defined(__x86_64__) /* Intel x86-64 (64-bit) */ + __asm__ volatile ("movq %%rsp, %0" : "=r" (stack_ptr)); +#elif defined(__powerpc__) /* PowerPC (32-bit) */ + __asm__ volatile ("mr %0, 1" : "=r" (stack_ptr)); /* GPR1 is the stack pointer */ +#elif defined(__ppc64__) /* PowerPC (64-bit) */ + __asm__ volatile ("mr %0, 1" : "=r" (stack_ptr)); +#elif defined(__arm__) /* ARM 32-bit */ + __asm__ volatile ("mov %0, sp" : "=r" (stack_ptr)); +#elif defined(__aarch64__) /* ARM 64-bit */ + __asm__ volatile ("mov %0, sp" : "=r" (stack_ptr)); +#elif defined(__sparc__) /* SPARC 32-bit */ + __asm__ volatile ("mov %%sp, %0" : "=r" (stack_ptr)); +#elif defined(__sparc64__) /* SPARC 64-bit */ + __asm__ volatile ("mov %%sp, %0" : "=r" (stack_ptr)); +#elif defined(__s390x__) + stack_ptr= __builtin_frame_address(0); +#else + /* Generic fallback for unsupported architectures in GCC/Clang */ + stack_ptr= default_stack ? default_stack : (void*) &stack_ptr; +#endif +#elif defined(_MSC_VER) /* MSVC compiler (Intel only) */ +#if defined(_M_IX86) /* Intel x86 (32-bit) */ + __asm { mov stack_ptr, esp } +#elif defined(_M_X64) /* Intel x86-64 (64-bit) */ + /* rsp can’t be accessed directly in MSVC x64 */ + stack_ptr= _AddressOfReturnAddress(); +#else + /* Generic fallback for unsupported architectures in MSVC */ + stack_ptr= default_stack ? default_stack : (void*) &stack_ptr; +#endif +#else + /* Generic fallback for unsupported compilers */ + stack_ptr= default_stack ? default_stack : (void*) &stack_ptr; +#endif + return stack_ptr; +} + + /* Do allocation through alloca if there is enough stack available. If not, use my_malloc() instead. @@ -42,7 +101,7 @@ /* Allocate small blocks as long as there is this much left */ #define STACK_ALLOC_SMALL_BLOCK 1024*32 -/* Allocate small blocks as long as there is this much left */ +/* Allocate small blocks as long as the block size is not bigger than */ #define STACK_ALLOC_SMALL_BLOCK_SIZE 4096 /* @@ -56,11 +115,11 @@ do \ { \ size_t alloc_size= (size); \ - size_t stack_left= available_stack_size(&alloc_size, (stack_end)); \ - if (stack_left > alloc_size && \ - (STACK_ALLOC_BIG_BLOCK < stack_left - alloc_size || \ - ((STACK_ALLOC_SMALL_BLOCK < stack_left - alloc_size) && \ - (STACK_ALLOC_SMALL_BLOCK_SIZE <= alloc_size)))) \ + void *stack= my_get_stack_pointer(0); \ + size_t stack_left= available_stack_size(stack, (stack_end)); \ + if (stack_left > alloc_size + STACK_ALLOC_SMALL_BLOCK && \ + (stack_left > alloc_size + STACK_ALLOC_BIG_BLOCK || \ + (STACK_ALLOC_SMALL_BLOCK_SIZE >= alloc_size))) \ { \ (must_be_freed)= 0; \ (res)= alloca(size); \ @@ -90,3 +149,16 @@ static inline void stack_alloc_free(void *res, my_bool must_be_freed) my_free(res); } #endif /* _my_stack_alloc_h */ + + +/* Get start and end of stack */ + +/* + This is used in the case when we not know the exact stack start + and have to estimate stack start with get_stack_pointer() +*/ +#define MY_STACK_SAFE_MARGIN 8192 + +extern void my_get_stack_bounds(void **stack_start, void **stack_end, + void *fallback_stack_start, + size_t fallback_stack_size); diff --git a/include/my_sys.h b/include/my_sys.h index d58e53d0bf3..76101a9dd9c 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -654,6 +654,8 @@ extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,myf MyFlags); extern my_off_t my_ftell(FILE *stream,myf MyFlags); extern void (*my_sleep_for_space)(unsigned int seconds); +extern int my_get_exepath(char *buf, size_t size, const char *argv0); + /* implemented in my_memmem.c */ extern void *my_memmem(const void *haystack, size_t haystacklen, const void *needle, size_t needlelen); diff --git a/libmariadb b/libmariadb index 3b29ff9c913..3f2196d84e2 160000 --- a/libmariadb +++ b/libmariadb @@ -1 +1 @@ -Subproject commit 3b29ff9c91344263183fcb2aa2ac4d634e501a7f +Subproject commit 3f2196d84e20dd89c682fde6154849ec5bb36c85 diff --git a/mysql-test/lib/My/SafeProcess/Base.pm b/mysql-test/lib/My/SafeProcess/Base.pm index 1cd01cb0ca9..91ebdc8fe11 100644 --- a/mysql-test/lib/My/SafeProcess/Base.pm +++ b/mysql-test/lib/My/SafeProcess/Base.pm @@ -114,6 +114,10 @@ sub create_process { lock($win32_spawn_lock); + # STDOUT/STDERR are temporarily reassigned, avoid prevent + # output from another thread + lock($mtr_report::flush_lock); + #printf STDERR "stdin %d, stdout %d, stderr %d\n", # fileno STDIN, fileno STDOUT, fileno STDERR; diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm index 0c3c45f3b18..308dbb77a3e 100644 --- a/mysql-test/lib/mtr_report.pm +++ b/mysql-test/lib/mtr_report.pm @@ -88,7 +88,7 @@ sub flush_out { } use if $^O eq "MSWin32", "threads::shared"; -my $flush_lock :shared; +our $flush_lock :shared; # Print to stdout sub print_out { diff --git a/mysql-test/main/connect.result b/mysql-test/main/connect.result index e84a93317ab..2b8be7b0518 100644 --- a/mysql-test/main/connect.result +++ b/mysql-test/main/connect.result @@ -461,11 +461,13 @@ Connection_errors_max_connections 0 Connection_errors_peer_address 0 Connection_errors_select 0 Connection_errors_tcpwrap 0 +show global status like 'Threads_connected'; +Variable_name Value +Threads_connected 1 set @max_con.save= @@max_connections; set global max_connections= 10; # ERROR 1040 # ERROR 1040 -connection default; show global status like 'Connection_errors%'; Variable_name Value Connection_errors_accept 0 diff --git a/mysql-test/main/connect.test b/mysql-test/main/connect.test index ab69d32eedf..6370c6991ae 100644 --- a/mysql-test/main/connect.test +++ b/mysql-test/main/connect.test @@ -517,6 +517,7 @@ SET GLOBAL connect_timeout= @save_connect_timeout; flush status; show global status like 'Connection_errors%'; +show global status like 'Threads_connected'; set @max_con.save= @@max_connections; set global max_connections= 10; @@ -534,9 +535,25 @@ while ($n) --dec $n } +connection default; +let $n= 10; +let $c= 12; +while ($n) +{ + disconnect con$c; + --dec $n + --dec $c +} + +# Wait until all connections has terminated to ensure +# that Connection_errors is correct + +let $status_var=Threads_connected; +let $status_var_value= 1; +--source include/wait_for_status_var.inc + --enable_result_log --enable_query_log ---connection default show global status like 'Connection_errors%'; set global max_connections= @max_con.save; diff --git a/mysql-test/main/ctype_gbk_export_import.result b/mysql-test/main/ctype_gbk_export_import.result index 664f515b35c..73c8f12c319 100644 --- a/mysql-test/main/ctype_gbk_export_import.result +++ b/mysql-test/main/ctype_gbk_export_import.result @@ -304,14 +304,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=auto } @@ -324,14 +324,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET gbk} @@ -344,14 +344,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 3F5C BAD-TEXT-UTF8 -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 3F5C5C BAD-TEXT-UTF8 -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET utf8} @@ -384,14 +384,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=gbk } @@ -404,14 +404,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET gbk} @@ -424,14 +424,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 3F5C BAD-TEXT-UTF8 -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 3F5C5C BAD-TEXT-UTF8 -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET utf8} @@ -464,14 +464,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=utf8 } @@ -484,14 +484,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET gbk} @@ -504,14 +504,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 3F5C BAD-TEXT-UTF8 -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 3F5C5C BAD-TEXT-UTF8 -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET utf8} @@ -1264,14 +1264,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=auto } @@ -1284,14 +1284,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET gbk} @@ -1304,14 +1304,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 3F5C BAD-TEXT-UTF8 -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 3F5C5C BAD-TEXT-UTF8 -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET utf8} @@ -1344,14 +1344,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=gbk } @@ -1364,14 +1364,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET gbk} @@ -1384,14 +1384,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 3F5C BAD-TEXT-UTF8 -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 3F5C5C BAD-TEXT-UTF8 -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET utf8} @@ -1424,14 +1424,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=utf8 } @@ -1444,14 +1444,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET gbk} @@ -1464,14 +1464,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 3F5C BAD-TEXT-UTF8 -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 3F5C5C BAD-TEXT-UTF8 -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET utf8} @@ -1984,8 +1984,8 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 EE5C a2 E9978B3F BAD-TEXT-UTF8 -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 EE5C5C @@ -2004,8 +2004,8 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 EE5C a2 E9978B3F BAD-TEXT-UTF8 -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 EE5C5C @@ -2024,14 +2024,14 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 E9A0AB -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 E9A0AB5C -b1 EE5C5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C5C +eol 24 --- --- End of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=auto CHARACTER SET utf8} @@ -2064,8 +2064,8 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 EE5C a2 E9978B3F BAD-TEXT-UTF8 -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 EE5C5C @@ -2084,8 +2084,8 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 EE5C a2 E9978B3F BAD-TEXT-UTF8 -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 EE5C5C @@ -2104,14 +2104,14 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 E9A0AB -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 E9A0AB5C -b1 EE5C5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C5C +eol 24 --- --- End of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=gbk CHARACTER SET utf8} @@ -2144,8 +2144,8 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 EE5C a2 E9978B3F BAD-TEXT-UTF8 -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 EE5C5C @@ -2164,8 +2164,8 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 EE5C a2 E9978B3F BAD-TEXT-UTF8 -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 EE5C5C @@ -2184,14 +2184,14 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 E9A0AB -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 E9A0AB5C -b1 EE5C5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C5C +eol 24 --- --- End of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=utf8 CHARACTER SET utf8} @@ -2224,14 +2224,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=auto } @@ -2244,14 +2244,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET gbk} @@ -2264,14 +2264,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 3F5C BAD-TEXT-UTF8 -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 3F5C5C BAD-TEXT-UTF8 -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET utf8} @@ -2304,14 +2304,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=gbk } @@ -2324,14 +2324,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET gbk} @@ -2344,14 +2344,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 3F5C BAD-TEXT-UTF8 -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 3F5C5C BAD-TEXT-UTF8 -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET utf8} @@ -2384,14 +2384,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=utf8 } @@ -2404,14 +2404,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET gbk} @@ -2424,14 +2424,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 3F5C BAD-TEXT-UTF8 -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 3F5C5C BAD-TEXT-UTF8 -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET utf8} @@ -2704,8 +2704,8 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 EE5C a2 E9978B3F BAD-TEXT-UTF8 -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 EE5C5C @@ -2724,8 +2724,8 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 EE5C a2 E9978B3F BAD-TEXT-UTF8 -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 EE5C5C @@ -2744,14 +2744,14 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 E9A0AB -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 E9A0AB5C -b1 EE5C5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C5C +eol 24 --- --- End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=auto CHARACTER SET utf8} @@ -2784,8 +2784,8 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 EE5C a2 E9978B3F BAD-TEXT-UTF8 -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 EE5C5C @@ -2804,8 +2804,8 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 EE5C a2 E9978B3F BAD-TEXT-UTF8 -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 EE5C5C @@ -2824,14 +2824,14 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 E9A0AB -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 E9A0AB5C -b1 EE5C5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C5C +eol 24 --- --- End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=gbk CHARACTER SET utf8} @@ -2864,8 +2864,8 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 EE5C a2 E9978B3F BAD-TEXT-UTF8 -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 EE5C5C @@ -2884,8 +2884,8 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 EE5C a2 E9978B3F BAD-TEXT-UTF8 -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 EE5C5C @@ -2904,14 +2904,14 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 E9A0AB -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 E9A0AB5C -b1 EE5C5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C5C +eol 24 --- --- End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=utf8 CHARACTER SET utf8} @@ -2947,8 +2947,8 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 EE5C a2 E9978B3F BAD-TEXT-UTF8 -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 EE5C5C @@ -2967,8 +2967,8 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 EE5C a2 E9978B3F BAD-TEXT-UTF8 -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 EE5C5C @@ -2987,14 +2987,14 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 E9A0AB -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 E9A0AB5C -b1 EE5C5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C5C +eol 24 --- --- End of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=auto CHARACTER SET utf8} @@ -3027,8 +3027,8 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 EE5C a2 E9978B3F BAD-TEXT-UTF8 -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 EE5C5C @@ -3047,8 +3047,8 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 EE5C a2 E9978B3F BAD-TEXT-UTF8 -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 EE5C5C @@ -3067,14 +3067,14 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 E9A0AB -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 E9A0AB5C -b1 EE5C5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C5C +eol 24 --- --- End of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=binary CHARACTER SET utf8} @@ -3107,8 +3107,8 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 EE5C a2 E9978B3F BAD-TEXT-UTF8 -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 EE5C5C @@ -3127,8 +3127,8 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 EE5C a2 E9978B3F BAD-TEXT-UTF8 -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 EE5C5C @@ -3147,14 +3147,14 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 E9A0AB -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 E9A0AB5C -b1 EE5C5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C5C +eol 24 --- --- End of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=gbk CHARACTER SET utf8} @@ -3187,8 +3187,8 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 EE5C a2 E9978B3F BAD-TEXT-UTF8 -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 EE5C5C @@ -3207,8 +3207,8 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 EE5C a2 E9978B3F BAD-TEXT-UTF8 -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 EE5C5C @@ -3227,14 +3227,14 @@ file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 E9A0AB -b1 EE5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C +eol 24 --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 E9A0AB5C -b1 EE5C5C0924 BAD-BLOB -eol BAD-EOL +b1 EE5C5C +eol 24 --- --- End of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=utf8 CHARACTER SET utf8} @@ -3267,14 +3267,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=auto } @@ -3287,14 +3287,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=auto CHARACTER SET gbk} @@ -3307,14 +3307,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 3F5C BAD-TEXT-UTF8 -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 3F5C5C BAD-TEXT-UTF8 -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=auto CHARACTER SET utf8} @@ -3347,14 +3347,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=binary } @@ -3367,14 +3367,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=binary CHARACTER SET gbk} @@ -3387,14 +3387,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 3F5C BAD-TEXT-UTF8 -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 3F5C5C BAD-TEXT-UTF8 -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=binary CHARACTER SET utf8} @@ -3427,14 +3427,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=gbk } @@ -3447,14 +3447,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=gbk CHARACTER SET gbk} @@ -3467,14 +3467,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 3F5C BAD-TEXT-UTF8 -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 3F5C5C BAD-TEXT-UTF8 -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=gbk CHARACTER SET utf8} @@ -3507,14 +3507,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=utf8 } @@ -3527,14 +3527,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 EE5C a2 E9A0AB -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 EE5C5C a2 E9A0AB5C -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=utf8 CHARACTER SET gbk} @@ -3547,14 +3547,14 @@ file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24| id 1 a1 3F5C BAD-TEXT-GBK a2 3F5C BAD-TEXT-UTF8 -b1 EE5C -eol 24 +b1 EE0924 BAD-BLOB +eol BAD-EOL --- --- id 2 a1 3F5C5C BAD-TEXT-GBK a2 3F5C5C BAD-TEXT-UTF8 -b1 EE5C5C -eol 24 +b1 EE5C0924 BAD-BLOB +eol BAD-EOL --- --- End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=utf8 CHARACTER SET utf8} diff --git a/mysql-test/main/derived_cond_pushdown.result b/mysql-test/main/derived_cond_pushdown.result index 3858861113c..974e419cefc 100644 --- a/mysql-test/main/derived_cond_pushdown.result +++ b/mysql-test/main/derived_cond_pushdown.result @@ -19053,4 +19053,31 @@ EXPLAIN } } drop table t1, t2; +# +# MDEV-35276: Assertion failure in find_producing_item upon a query +# from a view +# +# Note: for all followng queries with DEFAULT(f) hishdown is +# prohibited +CREATE VIEW v AS select 0 AS f; +SELECT * FROM v WHERE f = DEFAULT(f); +f +0 +CREATE TABLE t1 (c int DEFAULT 0); +insert into t1 values (0), (1); +SELECT * FROM v,t1 WHERE f = DEFAULT(c); +f c +0 0 +0 1 +ALTER TABLE t1 ALTER c SET DEFAULT 1; +SELECT * FROM v,t1 WHERE f = DEFAULT(c); +f c +drop table t1; +create table t1 (a int, c int DEFAULT a); +insert into t1 values (0, -1), (1, -2); +SELECT * FROM v,t1 WHERE f = DEFAULT(c); +f a c +0 0 -1 +DROP VIEW v; +DROP TABLE t1; # End of 10.5 tests diff --git a/mysql-test/main/derived_cond_pushdown.test b/mysql-test/main/derived_cond_pushdown.test index 0f23f0f747f..a46788b3de0 100644 --- a/mysql-test/main/derived_cond_pushdown.test +++ b/mysql-test/main/derived_cond_pushdown.test @@ -4189,4 +4189,34 @@ execute stmt; drop table t1, t2; +--echo # +--echo # MDEV-35276: Assertion failure in find_producing_item upon a query +--echo # from a view +--echo # +--echo # Note: for all followng queries with DEFAULT(f) hishdown is +--echo # prohibited + +CREATE VIEW v AS select 0 AS f; + +SELECT * FROM v WHERE f = DEFAULT(f); + +CREATE TABLE t1 (c int DEFAULT 0); +insert into t1 values (0), (1); + +SELECT * FROM v,t1 WHERE f = DEFAULT(c); + +ALTER TABLE t1 ALTER c SET DEFAULT 1; + +SELECT * FROM v,t1 WHERE f = DEFAULT(c); + +drop table t1; +create table t1 (a int, c int DEFAULT a); +insert into t1 values (0, -1), (1, -2); + +SELECT * FROM v,t1 WHERE f = DEFAULT(c); + +DROP VIEW v; +DROP TABLE t1; + + --echo # End of 10.5 tests diff --git a/mysql-test/main/enforce_storage_engine.result b/mysql-test/main/enforce_storage_engine.result index cc91daa73b9..37f22cf4331 100644 --- a/mysql-test/main/enforce_storage_engine.result +++ b/mysql-test/main/enforce_storage_engine.result @@ -45,7 +45,7 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci INSERT INTO t1 values (1,'abba'); CREATE TABLE t2 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=Memory; -ERROR 42000: Unknown storage engine 'MEMORY' +ERROR HY000: The MariaDB server is running with the NO_ENGINE_SUBSTITUTION option so it cannot execute this statement SET SESSION sql_mode=''; SET SESSION enforce_storage_engine=MyISAM; select @@session.enforce_storage_engine; diff --git a/mysql-test/main/enforce_storage_engine.test b/mysql-test/main/enforce_storage_engine.test index 7768ed1bf46..55bba15a343 100644 --- a/mysql-test/main/enforce_storage_engine.test +++ b/mysql-test/main/enforce_storage_engine.test @@ -26,7 +26,7 @@ CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISA SHOW CREATE TABLE t1; INSERT INTO t1 values (1,'abba'); ---error 1286 +--error ER_OPTION_PREVENTS_STATEMENT CREATE TABLE t2 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=Memory; SET SESSION sql_mode=''; diff --git a/mysql-test/main/enforce_storage_engine_opt.result b/mysql-test/main/enforce_storage_engine_opt.result index 5f709427457..ba18a1bf169 100644 --- a/mysql-test/main/enforce_storage_engine_opt.result +++ b/mysql-test/main/enforce_storage_engine_opt.result @@ -11,5 +11,5 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci set session sql_mode='no_engine_substitution'; create table t2 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory; -ERROR 42000: Unknown storage engine 'MEMORY' +ERROR HY000: The MariaDB server is running with the NO_ENGINE_SUBSTITUTION option so it cannot execute this statement drop table t1; diff --git a/mysql-test/main/enforce_storage_engine_opt.test b/mysql-test/main/enforce_storage_engine_opt.test index 7ca7f94d3dc..90c4a44a452 100644 --- a/mysql-test/main/enforce_storage_engine_opt.test +++ b/mysql-test/main/enforce_storage_engine_opt.test @@ -2,6 +2,6 @@ SET SQL_MODE=""; create table t1 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory; show create table t1; set session sql_mode='no_engine_substitution'; ---error 1286 +--error ER_OPTION_PREVENTS_STATEMENT create table t2 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory; drop table t1; diff --git a/mysql-test/main/grant5.result b/mysql-test/main/grant5.result index 96ae5873ce4..5aeedb89409 100644 --- a/mysql-test/main/grant5.result +++ b/mysql-test/main/grant5.result @@ -174,7 +174,7 @@ drop user 'O\'Brien'@'localhost'; # CREATE USER 'test-user'; CREATE ROLE `r``o'l"e`; -select user from mysql.user where is_role='Y'; +select user as User from mysql.user where is_role='Y'; User r`o'l"e GRANT `r``o'l"e` TO 'test-user'; @@ -346,7 +346,7 @@ ERROR HY000: Password hash should be a 41-digit hexadecimal number set password for u7@h = old_password('pwd'); create user u8@h identified with 'mysql_old_password'; set password for u8@h = '78a302dd267f6044'; -select user,host,plugin,authentication_string from mysql.user where host='h'; +select user as User,host as Host,plugin,authentication_string from mysql.user where host='h'; User Host plugin authentication_string u1 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD u2 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD @@ -392,7 +392,7 @@ grant select on *.* to u5@h; grant select on *.* to u6@h; grant select on *.* to u7@h; grant select on *.* to u8@h; -select user,select_priv,plugin,authentication_string from mysql.user where user like 'u_'; +select user as User,select_priv as Select_priv,plugin,authentication_string from mysql.user where user like 'u_'; User Select_priv plugin authentication_string u1 Y mysql_native_password bad u2 Y mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD diff --git a/mysql-test/main/grant5.test b/mysql-test/main/grant5.test index 48cc3087ffc..a33cecbfc6d 100644 --- a/mysql-test/main/grant5.test +++ b/mysql-test/main/grant5.test @@ -131,7 +131,7 @@ drop user 'O\'Brien'@'localhost'; CREATE USER 'test-user'; CREATE ROLE `r``o'l"e`; -select user from mysql.user where is_role='Y'; +select user as User from mysql.user where is_role='Y'; GRANT `r``o'l"e` TO 'test-user'; SET DEFAULT ROLE `r``o'l"e` FOR 'test-user'; # it is expected that quotes won't be shown correctly @@ -310,7 +310,7 @@ set password for u7@h = old_password('pwd'); create user u8@h identified with 'mysql_old_password'; eval set password for u8@h = '$p'; sorted_result; -select user,host,plugin,authentication_string from mysql.user where host='h'; +select user as User,host as Host,plugin,authentication_string from mysql.user where host='h'; # test with invalid entries update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'bad') where user='u1'; update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'bad') where user='u5'; @@ -332,7 +332,7 @@ grant select on *.* to u5@h; grant select on *.* to u6@h; grant select on *.* to u7@h; grant select on *.* to u8@h; -select user,select_priv,plugin,authentication_string from mysql.user where user like 'u_'; +select user as User,select_priv as Select_priv,plugin,authentication_string from mysql.user where user like 'u_'; # but they still can be dropped drop user u1@h, u2@h, u3@h, u4@h, u5@h, u6@h, u7@h, u8@h; diff --git a/mysql-test/main/group_by.result b/mysql-test/main/group_by.result index 897e684936f..0a012e203a1 100644 --- a/mysql-test/main/group_by.result +++ b/mysql-test/main/group_by.result @@ -2987,3 +2987,15 @@ drop table t20, t21, t22; # # End of 10.3 tests # +# +# MDEV-29351 SIGSEGV when doing forward reference of item in select list +# +CREATE TABLE t1 (a INT); +UPDATE t1 SET c=1 ORDER BY (SELECT c); +ERROR 42S22: Reference 'c' not supported (forward reference in item list) +UPDATE t1 SET c=1 ORDER BY (SELECT c); +ERROR 42S22: Reference 'c' not supported (forward reference in item list) +DROP TABLE t1; +# +# End of 10.5 tests +# diff --git a/mysql-test/main/group_by.test b/mysql-test/main/group_by.test index 6c2b99c90be..eaa0d060fe9 100644 --- a/mysql-test/main/group_by.test +++ b/mysql-test/main/group_by.test @@ -2140,3 +2140,18 @@ drop table t20, t21, t22; --echo # --echo # End of 10.3 tests --echo # + +--echo # +--echo # MDEV-29351 SIGSEGV when doing forward reference of item in select list +--echo # + +CREATE TABLE t1 (a INT); +--error ER_ILLEGAL_REFERENCE +UPDATE t1 SET c=1 ORDER BY (SELECT c); +--error ER_ILLEGAL_REFERENCE +UPDATE t1 SET c=1 ORDER BY (SELECT c); +DROP TABLE t1; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/mysql-test/main/join_optimizer.result b/mysql-test/main/join_optimizer.result index ad7267ab665..238825ec46f 100644 --- a/mysql-test/main/join_optimizer.result +++ b/mysql-test/main/join_optimizer.result @@ -35,3 +35,25 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE a ALL NULL NULL NULL NULL 2 Using where 1 SIMPLE g ref groups_dt groups_dt 70 const,test.a.type 13 Using index condition drop table t0,t1,t2,t3; +# +# MDEV-35253: xa_prepare_unlock_unmodified fails: shift exponent 32 is too large +# +set @create= +concat("create table t1(", +(select group_concat(concat("col",seq, " int")) from seq_1_to_32), +",\n index idx1(", +(select group_concat(concat("col",seq)) from seq_1_to_32), +")\n)" + ); +$create_tbl; +insert into t1() values (),(),(); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +# Must not produce a "shift exponent 32 is too large" runtime ubsan error +explain select * from t1 where col1=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx1 idx1 5 const 1 Using index +drop table t1; +End of 10.5 tests diff --git a/mysql-test/main/join_optimizer.test b/mysql-test/main/join_optimizer.test index e5f6181944d..1c55304a2b0 100644 --- a/mysql-test/main/join_optimizer.test +++ b/mysql-test/main/join_optimizer.test @@ -45,3 +45,27 @@ SELECT STRAIGHT_JOIN g.id FROM t2 a, t3 g USE INDEX(groups_dt) WHERE g.domain = 'queue' AND g.type = a.type; drop table t0,t1,t2,t3; + +--echo # +--echo # MDEV-35253: xa_prepare_unlock_unmodified fails: shift exponent 32 is too large +--echo # +--source include/have_sequence.inc +set @create= + concat("create table t1(", + (select group_concat(concat("col",seq, " int")) from seq_1_to_32), + ",\n index idx1(", + (select group_concat(concat("col",seq)) from seq_1_to_32), + ")\n)" + ); + +let $create_tbl=`select @create`; +evalp $create_tbl; +insert into t1() values (),(),(); +analyze table t1; + +--echo # Must not produce a "shift exponent 32 is too large" runtime ubsan error +explain select * from t1 where col1=1; + +drop table t1; + +--echo End of 10.5 tests diff --git a/mysql-test/main/loaddata.result b/mysql-test/main/loaddata.result index d00eb034505..f54192bec03 100644 --- a/mysql-test/main/loaddata.result +++ b/mysql-test/main/loaddata.result @@ -686,3 +686,40 @@ SELECT * FROM t1; id 1 DROP TABLE t1; +# +# MDEV-34883: LOAD DATA INFILE with geometry data fails +# +CREATE OR REPLACE TABLE t1 ( +p point NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +INSERT INTO t1 VALUES (GeomFromText('POINT(37.646944 -75.761111)')); +SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.tsv' FROM t1; +CREATE OR REPLACE TABLE t2 LIKE t1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.tsv' INTO TABLE t2; +drop table t1, t2; +CREATE OR REPLACE TABLE t1 ( +p point NOT NULL, +chr char(20) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +INSERT INTO t1 VALUES (GeomFromText('POINT(37.646944 -75.761111)'),"їєі"); +SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.tsv' FROM t1; +CREATE OR REPLACE TABLE t2 LIKE t1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.tsv' INTO TABLE t2 CHARACTER SET latin1; +select ST_AsText(p), chr from t1; +ST_AsText(p) chr +POINT(37.646944 -75.761111) їєі +# incorrect string (but correct geom) +select ST_AsText(p), chr from t2; +ST_AsText(p) chr +POINT(37.646944 -75.761111) їєі +delete from t2; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.tsv' INTO TABLE t2 CHARACTER SET utf8mb4; +select ST_AsText(p), chr from t1; +ST_AsText(p) chr +POINT(37.646944 -75.761111) їєі +# all is correct +select ST_AsText(p), chr from t2; +ST_AsText(p) chr +POINT(37.646944 -75.761111) їєі +drop table t1, t2; +# End of 10.5 tests diff --git a/mysql-test/main/loaddata.test b/mysql-test/main/loaddata.test index ef1496787d4..a625415ad8e 100644 --- a/mysql-test/main/loaddata.test +++ b/mysql-test/main/loaddata.test @@ -832,3 +832,61 @@ CREATE TABLE t1 (id integer not null auto_increment primary key); LOAD DATA INFILE '../../std_data/loaddata/nl.txt' INTO TABLE t1 FIELDS TERMINATED BY ''; SELECT * FROM t1; DROP TABLE t1; + + +--echo # +--echo # MDEV-34883: LOAD DATA INFILE with geometry data fails +--echo # + +CREATE OR REPLACE TABLE t1 ( + p point NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +INSERT INTO t1 VALUES (GeomFromText('POINT(37.646944 -75.761111)')); + +--disable_ps2_protocol +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1.tsv' FROM t1; +--enable_ps2_protocol + +CREATE OR REPLACE TABLE t2 LIKE t1; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/t1.tsv' INTO TABLE t2; + +--remove_file '$MYSQLTEST_VARDIR/tmp/t1.tsv' +drop table t1, t2; + + +CREATE OR REPLACE TABLE t1 ( + p point NOT NULL, + chr char(20) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +INSERT INTO t1 VALUES (GeomFromText('POINT(37.646944 -75.761111)'),"їєі"); +--disable_ps2_protocol +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1.tsv' FROM t1; +--enable_ps2_protocol + +CREATE OR REPLACE TABLE t2 LIKE t1; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/t1.tsv' INTO TABLE t2 CHARACTER SET latin1; + +select ST_AsText(p), chr from t1; +--echo # incorrect string (but correct geom) +select ST_AsText(p), chr from t2; + +delete from t2; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/t1.tsv' INTO TABLE t2 CHARACTER SET utf8mb4; + +select ST_AsText(p), chr from t1; +--echo # all is correct +select ST_AsText(p), chr from t2; + +--remove_file '$MYSQLTEST_VARDIR/tmp/t1.tsv' +drop table t1, t2; + +--echo # End of 10.5 tests diff --git a/mysql-test/main/plugin.result b/mysql-test/main/plugin.result index 092e817c48e..5a78057292b 100644 --- a/mysql-test/main/plugin.result +++ b/mysql-test/main/plugin.result @@ -216,7 +216,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `VAROPT`=33 +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `varopt`=33 drop table t1; SET @@SQL_MODE=@OLD_SQL_MODE; select 1; diff --git a/mysql-test/main/ps_mem_leaks.result b/mysql-test/main/ps_mem_leaks.result index c5b1a744ebf..fa4f7e36ed9 100644 --- a/mysql-test/main/ps_mem_leaks.result +++ b/mysql-test/main/ps_mem_leaks.result @@ -325,6 +325,19 @@ PREPARE stmt FROM "UPDATE t SET a = 0 LIMIT ?"; EXECUTE stmt USING 0; EXECUTE stmt USING 1; DROP TABLE t; +# +# MDEV-35249: Assertion `(mem_root->flags & 4) == 0' failed in convert_subq_to_jtbm +# +CREATE TABLE t (a INT, b INT, c INT); +INSERT INTO t VALUES (1,2,3),(4,5,6); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t; +CREATE VIEW v2 AS SELECT * FROM v1; +PREPARE stmt FROM 'UPDATE t SET a = 0 WHERE b IN (SELECT c FROM v2)'; +EXECUTE stmt; +EXECUTE stmt; +DROP VIEW v2; +DROP VIEW v1; +DROP TABLE t; # End of 10.5 tests # # MDEV-33769: Memory leak found in the test main.rownum run with --ps-protocol against a server built with the option -DWITH_PROTECT_STATEMENT_MEMROOT diff --git a/mysql-test/main/ps_mem_leaks.test b/mysql-test/main/ps_mem_leaks.test index b7d560e2016..3374519908f 100644 --- a/mysql-test/main/ps_mem_leaks.test +++ b/mysql-test/main/ps_mem_leaks.test @@ -323,6 +323,23 @@ EXECUTE stmt USING 1; # CLeanup DROP TABLE t; +--echo # +--echo # MDEV-35249: Assertion `(mem_root->flags & 4) == 0' failed in convert_subq_to_jtbm +--echo # + +CREATE TABLE t (a INT, b INT, c INT); +INSERT INTO t VALUES (1,2,3),(4,5,6); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t; +CREATE VIEW v2 AS SELECT * FROM v1; +PREPARE stmt FROM 'UPDATE t SET a = 0 WHERE b IN (SELECT c FROM v2)'; +EXECUTE stmt; +EXECUTE stmt; + +# Cleanup +DROP VIEW v2; +DROP VIEW v1; +DROP TABLE t; + --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/trigger.result b/mysql-test/main/trigger.result index 4e814323c07..72834aff19a 100644 --- a/mysql-test/main/trigger.result +++ b/mysql-test/main/trigger.result @@ -2448,9 +2448,17 @@ SELECT * FROM t1; a b total 10 20 30 DROP TABLE t1; -# # End of 10.3 tests # +# MDEV-32022 ERROR 1054 (42S22): Unknown column 'X' in 'NEW' in trigger +# +create table t1 (m set('sms') not null); +create table t2 (i int); +create table t3 (j int); +create trigger t1 after insert on t1 for each row insert ignore into t2 select t3.j from t3 join (select 'sms' as method) m on find_in_set(m.method, new.m); +insert into t1 values ('sms'); +drop table t1, t2, t3; +# End of 10.5 tests # # Test dropping orphan .trn file # @@ -2486,6 +2494,4 @@ Error 1360 Trigger does not exist Warning 4181 Dropped orphan trigger 't1_trg', originally created for table: 't1' drop trigger t1_trg_2; drop table t1; -# # End of 10.6 tests -# diff --git a/mysql-test/main/trigger.test b/mysql-test/main/trigger.test index 35682080237..1928355b079 100644 --- a/mysql-test/main/trigger.test +++ b/mysql-test/main/trigger.test @@ -2788,9 +2788,19 @@ INSERT INTO t1 (a,b) VALUES (10, 20); SELECT * FROM t1; DROP TABLE t1; ---echo # --echo # End of 10.3 tests + --echo # +--echo # MDEV-32022 ERROR 1054 (42S22): Unknown column 'X' in 'NEW' in trigger +--echo # +create table t1 (m set('sms') not null); +create table t2 (i int); +create table t3 (j int); +create trigger t1 after insert on t1 for each row insert ignore into t2 select t3.j from t3 join (select 'sms' as method) m on find_in_set(m.method, new.m); +insert into t1 values ('sms'); +drop table t1, t2, t3; + +--echo # End of 10.5 tests --echo # --echo # Test dropping orphan .trn file @@ -2833,6 +2843,4 @@ drop trigger t1_trg_2; drop table t1; --remove_file $MYSQLD_DATADIR/test/t1_trg.TMP ---echo # --echo # End of 10.6 tests ---echo # diff --git a/mysql-test/suite/galera/galera_4nodes.cnf b/mysql-test/suite/galera/galera_4nodes.cnf index 4be5b496370..090b8953bff 100644 --- a/mysql-test/suite/galera/galera_4nodes.cnf +++ b/mysql-test/suite/galera/galera_4nodes.cnf @@ -10,6 +10,7 @@ wsrep-provider=@ENV.WSREP_PROVIDER # enforce read-committed characteristics across the cluster # wsrep-causal-reads=ON wsrep-sync-wait=15 +wsrep-debug=1 [mysqld.1] wsrep-on=1 @@ -17,7 +18,7 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address=gcomm:// -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S' wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' @@ -29,7 +30,7 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S' wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' @@ -41,7 +42,7 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S' wsrep_node_address='127.0.0.1:@mysqld.3.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' @@ -53,7 +54,7 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S' wsrep_node_address='127.0.0.1:@mysqld.4.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port' diff --git a/mysql-test/suite/galera/r/enforce_storage_engine.result b/mysql-test/suite/galera/r/enforce_storage_engine.result index 1a453241427..8f6c6d4bfc4 100644 --- a/mysql-test/suite/galera/r/enforce_storage_engine.result +++ b/mysql-test/suite/galera/r/enforce_storage_engine.result @@ -8,7 +8,7 @@ connection node_1; SET @@enforce_storage_engine=INNODB; CREATE TABLE t1(i INT) ENGINE=INNODB; CREATE TABLE t2(i INT) ENGINE=MYISAM; -ERROR 42000: Unknown storage engine 'MyISAM' +ERROR HY000: The MariaDB server is running with the NO_ENGINE_SUBSTITUTION option so it cannot execute this statement INSERT INTO t1 VALUES(1); connection node_2; SHOW TABLES; diff --git a/mysql-test/suite/galera/r/galera_vote_rejoin_dml.result b/mysql-test/suite/galera/r/galera_vote_rejoin_dml.result index bf73fe73f59..e6c603ccdea 100644 --- a/mysql-test/suite/galera/r/galera_vote_rejoin_dml.result +++ b/mysql-test/suite/galera/r/galera_vote_rejoin_dml.result @@ -6,6 +6,8 @@ connection node_1; connection node_2; connection node_3; connection node_4; +connection node_1; +SET GLOBAL wsrep_provider_options = 'pc.weight=2'; connection node_3; SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1'; connection node_1; @@ -44,7 +46,8 @@ COUNT(*) = 0 1 CALL mtr.add_suppression("mariadbd: Can't find record in 't1'"); CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows"); -CALL mtr.add_suppression("WSREP: Event 3 Delete_rows_v1 apply failed: 120, seqno [0-9]*"); +CALL mtr.add_suppression("WSREP: Event 3 Delete_rows_v1 apply failed: 120, seqno "); +SET GLOBAL wsrep_provider_options = 'pc.weight=1'; connection node_2; SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A'; COUNT(*) = 1 @@ -54,7 +57,7 @@ COUNT(*) = 0 1 CALL mtr.add_suppression("mariadbd: Can't find record in 't1'"); CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows"); -CALL mtr.add_suppression("WSREP: Event 3 Delete_rows_v1 apply failed: 120, seqno [0-9]*"); +CALL mtr.add_suppression("WSREP: Event 3 Delete_rows_v1 apply failed: 120, seqno "); connection node_3; SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A'; COUNT(*) = 1 diff --git a/mysql-test/suite/galera/r/galera_wan.result b/mysql-test/suite/galera/r/galera_wan.result index 0021b509bf2..21cd5258590 100644 --- a/mysql-test/suite/galera/r/galera_wan.result +++ b/mysql-test/suite/galera/r/galera_wan.result @@ -8,16 +8,30 @@ SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_N VARIABLE_VALUE = 4 1 connection node_1; -CREATE TABLE t1 (f1 INTEGER); +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=INNODB; connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; connection node_3; +SELECT COUNT(*) AS EXPECT_0 FROM t1; +EXPECT_0 +0 INSERT INTO t1 VALUES (1); +SELECT COUNT(*) AS EXPECT_1 FROM t1; +EXPECT_1 +1 +connection node_2; +SELECT COUNT(*) AS EXPECT_1 FROM t1; +EXPECT_1 +1 +connection node_1; +SELECT COUNT(*) AS EXPECT_1 FROM t1; +EXPECT_1 +1 connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4; connection node_4; +SELECT COUNT(*) AS EXPECT_1 FROM t1; +EXPECT_1 +1 SELECT VARIABLE_VALUE LIKE '%gmcast.segment = 3%' FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'wsrep_provider_options'; VARIABLE_VALUE LIKE '%gmcast.segment = 3%' 1 -SELECT COUNT(*) = 1 FROM t1; -COUNT(*) = 1 -1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/enforce_storage_engine.test b/mysql-test/suite/galera/t/enforce_storage_engine.test index 5f07dd53a3e..0e20d443c2a 100644 --- a/mysql-test/suite/galera/t/enforce_storage_engine.test +++ b/mysql-test/suite/galera/t/enforce_storage_engine.test @@ -13,7 +13,7 @@ --connection node_1 SET @@enforce_storage_engine=INNODB; CREATE TABLE t1(i INT) ENGINE=INNODB; ---error ER_UNKNOWN_STORAGE_ENGINE +--error ER_OPTION_PREVENTS_STATEMENT CREATE TABLE t2(i INT) ENGINE=MYISAM; INSERT INTO t1 VALUES(1); diff --git a/mysql-test/suite/galera/t/galera_vote_rejoin_dml.cnf b/mysql-test/suite/galera/t/galera_vote_rejoin_dml.cnf index af445b25372..8f80180799c 100644 --- a/mysql-test/suite/galera/t/galera_vote_rejoin_dml.cnf +++ b/mysql-test/suite/galera/t/galera_vote_rejoin_dml.cnf @@ -2,6 +2,7 @@ [mysqld] wsrep-ignore-apply-errors=0 +loose-galera-vote-rejoin-dml=0 [ENV] galera_cluster_size=4 diff --git a/mysql-test/suite/galera/t/galera_vote_rejoin_dml.test b/mysql-test/suite/galera/t/galera_vote_rejoin_dml.test index c170bec1a37..11c84d0c5d6 100644 --- a/mysql-test/suite/galera/t/galera_vote_rejoin_dml.test +++ b/mysql-test/suite/galera/t/galera_vote_rejoin_dml.test @@ -5,6 +5,10 @@ --source include/galera_cluster.inc --source include/big_test.inc +--source include/force_restart.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc --let $node_1=node_1 --let $node_2=node_2 @@ -12,6 +16,9 @@ --let $node_4=node_4 --source include/auto_increment_offset_save.inc +--connection node_1 +SET GLOBAL wsrep_provider_options = 'pc.weight=2'; + # Isolate node #3 --connection node_3 SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1'; @@ -30,6 +37,7 @@ INSERT INTO t1 VALUES (1, 'A'); SET SESSION wsrep_on=OFF; INSERT INTO t1 VALUES (2, 'B'); SET SESSION wsrep_on=ON; +--source include/galera_wait_ready.inc DELETE FROM t1 WHERE f1 = 2; # Wait for node #4 to be voted out @@ -75,14 +83,15 @@ SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A'; SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B'; CALL mtr.add_suppression("mariadbd: Can't find record in 't1'"); CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows"); -CALL mtr.add_suppression("WSREP: Event 3 Delete_rows_v1 apply failed: 120, seqno [0-9]*"); +CALL mtr.add_suppression("WSREP: Event 3 Delete_rows_v1 apply failed: 120, seqno "); +SET GLOBAL wsrep_provider_options = 'pc.weight=1'; --connection node_2 SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A'; SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B'; CALL mtr.add_suppression("mariadbd: Can't find record in 't1'"); CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows"); -CALL mtr.add_suppression("WSREP: Event 3 Delete_rows_v1 apply failed: 120, seqno [0-9]*"); +CALL mtr.add_suppression("WSREP: Event 3 Delete_rows_v1 apply failed: 120, seqno "); --connection node_3 SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A'; diff --git a/mysql-test/suite/galera/t/galera_wan.cnf b/mysql-test/suite/galera/t/galera_wan.cnf index 0effd59403b..df1d55928dc 100644 --- a/mysql-test/suite/galera/t/galera_wan.cnf +++ b/mysql-test/suite/galera/t/galera_wan.cnf @@ -1,5 +1,8 @@ !include ../galera_4nodes.cnf +[mysqld] +loose-galera-wan=1 + [mysqld.1] wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M;gmcast.segment=1' diff --git a/mysql-test/suite/galera/t/galera_wan.test b/mysql-test/suite/galera/t/galera_wan.test index b3dc190dc06..73be33fa33d 100644 --- a/mysql-test/suite/galera/t/galera_wan.test +++ b/mysql-test/suite/galera/t/galera_wan.test @@ -8,31 +8,35 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/force_restart.inc CALL mtr.add_suppression("WSREP: Stray state UUID msg:"); CALL mtr.add_suppression("Sending JOIN failed: "); CALL mtr.add_suppression("WSREP: .* sending install message failed: Socket is not connected"); CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); +--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --connection node_1 -CREATE TABLE t1 (f1 INTEGER); +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=INNODB; --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connection node_3 ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1'; ---source include/wait_condition.inc +SELECT COUNT(*) AS EXPECT_0 FROM t1; INSERT INTO t1 VALUES (1); +SELECT COUNT(*) AS EXPECT_1 FROM t1; + +--connection node_2 +SELECT COUNT(*) AS EXPECT_1 FROM t1; + +--connection node_1 +SELECT COUNT(*) AS EXPECT_1 FROM t1; --connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 --connection node_4 ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1'; ---source include/wait_condition.inc ---let $wait_condition = SELECT COUNT(*) = 1 FROM t1; ---source include/wait_condition.inc +SELECT COUNT(*) AS EXPECT_1 FROM t1; + SELECT VARIABLE_VALUE LIKE '%gmcast.segment = 3%' FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'wsrep_provider_options'; - -SELECT COUNT(*) = 1 FROM t1; - DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_wan_restart_ist.cnf b/mysql-test/suite/galera/t/galera_wan_restart_ist.cnf index 3f7d2a2448f..0a230f5324f 100644 --- a/mysql-test/suite/galera/t/galera_wan_restart_ist.cnf +++ b/mysql-test/suite/galera/t/galera_wan_restart_ist.cnf @@ -1,5 +1,8 @@ !include ../galera_4nodes.cnf +[mysqld] +loose-galera-wan-restart-ist=1 + [mysqld.1] wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.segment=1' diff --git a/mysql-test/suite/galera/t/galera_wan_restart_ist.test b/mysql-test/suite/galera/t/galera_wan_restart_ist.test index 8a011d60851..be04c69f919 100644 --- a/mysql-test/suite/galera/t/galera_wan_restart_ist.test +++ b/mysql-test/suite/galera/t/galera_wan_restart_ist.test @@ -15,6 +15,9 @@ --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 +--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 @@ -22,9 +25,6 @@ --let $node_4=node_4 --source include/auto_increment_offset_save.inc ---let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ---source include/wait_condition.inc - SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --connection node_1 diff --git a/mysql-test/suite/galera/t/galera_wan_restart_sst.cnf b/mysql-test/suite/galera/t/galera_wan_restart_sst.cnf index 3f7d2a2448f..202aa4ce1c8 100644 --- a/mysql-test/suite/galera/t/galera_wan_restart_sst.cnf +++ b/mysql-test/suite/galera/t/galera_wan_restart_sst.cnf @@ -1,5 +1,8 @@ !include ../galera_4nodes.cnf +[mysqld] +loose-galera-wan-restart-sst=1 + [mysqld.1] wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.segment=1' diff --git a/mysql-test/suite/galera/t/galera_wan_restart_sst.test b/mysql-test/suite/galera/t/galera_wan_restart_sst.test index 7a8c0df4946..8485c0db2a7 100644 --- a/mysql-test/suite/galera/t/galera_wan_restart_sst.test +++ b/mysql-test/suite/galera/t/galera_wan_restart_sst.test @@ -11,10 +11,14 @@ --source include/big_test.inc --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/force_restart.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 +--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 @@ -22,8 +26,6 @@ --let $node_4=node_4 --source include/auto_increment_offset_save.inc ---let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ---source include/wait_condition.inc SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --connection node_1 diff --git a/mysql-test/suite/innodb/r/create_like.result b/mysql-test/suite/innodb/r/create_like.result new file mode 100644 index 00000000000..16d7c9f63bc --- /dev/null +++ b/mysql-test/suite/innodb/r/create_like.result @@ -0,0 +1,21 @@ +# +# MDEV-35144 CREATE TABLE ... LIKE uses current innodb_compression_default instead of the create value +# +set innodb_compression_default= off; +create table t1 (a int, b blob) engine=innodb; +set innodb_compression_default= on; +create table s_import like t1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` blob DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +show create table s_import; +Table Create Table +s_import CREATE TABLE `s_import` ( + `a` int(11) DEFAULT NULL, + `b` blob DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1,s_import; +# End of 10.5 tests diff --git a/mysql-test/suite/innodb/r/create_select.result b/mysql-test/suite/innodb/r/create_select.result index f5db880816e..183705680bd 100644 --- a/mysql-test/suite/innodb/r/create_select.result +++ b/mysql-test/suite/innodb/r/create_select.result @@ -8,3 +8,13 @@ connection default; ERROR 70100: Query execution was interrupted CREATE TABLE t1 (a SERIAL) ENGINE=InnoDB; DROP TABLE t1; +# End of 10.2 tests +# +# MDEV-35236 Assertion `(mem_root->flags & 4) == 0' failed in safe_lexcstrdup_root +# +prepare stmt from 'create or replace table t engine=innodb select 1 as f'; +set innodb_compression_default=on; +execute stmt; +execute stmt; +drop table t; +# End of 10.5 tests diff --git a/mysql-test/suite/innodb/r/instant_alter_bugs.result b/mysql-test/suite/innodb/r/instant_alter_bugs.result index 52d0bbe901b..1da714cdedf 100644 --- a/mysql-test/suite/innodb/r/instant_alter_bugs.result +++ b/mysql-test/suite/innodb/r/instant_alter_bugs.result @@ -526,6 +526,15 @@ c INT as (b) VIRTUAL)ENGINE=InnoDB CHARACTER SET utf32; ALTER TABLE t1 DROP COLUMN a; ALTER TABLE t1 DROP COLUMN c; DROP TABLE t1; +# +# MDEV-35122 Incorrect NULL value handling for instantly +# dropped BLOB columns +# +CREATE TABLE t1 (c1 INT, c2 BLOB, c3 BLOB NOT NULL) ROW_FORMAT=REDUNDANT,ENGINE=InnoDB; +ALTER TABLE t1 DROP c2; +ALTER TABLE t1 DROP c3; +INSERT INTO t1 VALUES(1); +DROP TABLE t1; # End of 10.5 tests # End of 10.6 tests SET GLOBAL innodb_stats_persistent = @save_stats_persistent; diff --git a/mysql-test/suite/innodb/r/log_file_name.result b/mysql-test/suite/innodb/r/log_file_name.result index a7f8cc8c7b2..32fbbc8821e 100644 --- a/mysql-test/suite/innodb/r/log_file_name.result +++ b/mysql-test/suite/innodb/r/log_file_name.result @@ -50,6 +50,7 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /InnoDB: Could not measure the size of single-table tablespace file '.*test/t2\.ibd'/ in mysqld.1.err # restart SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' diff --git a/mysql-test/suite/innodb/r/page_compression_windows.result b/mysql-test/suite/innodb/r/page_compression_windows.result new file mode 100644 index 00000000000..229050db913 --- /dev/null +++ b/mysql-test/suite/innodb/r/page_compression_windows.result @@ -0,0 +1,6 @@ +create table t_compressed(b longblob) engine=InnoDB page_compressed=1; +insert into t_compressed values(repeat(1,1000000)); +select allocated_size < file_size from information_schema.innodb_sys_tablespaces where name='test/t_compressed'; +allocated_size < file_size +1 +drop table t_compressed; diff --git a/mysql-test/suite/innodb/t/create_like.test b/mysql-test/suite/innodb/t/create_like.test new file mode 100644 index 00000000000..d348de7ebc8 --- /dev/null +++ b/mysql-test/suite/innodb/t/create_like.test @@ -0,0 +1,16 @@ +--source include/have_innodb.inc +--echo # +--echo # MDEV-35144 CREATE TABLE ... LIKE uses current innodb_compression_default instead of the create value +--echo # + +set innodb_compression_default= off; +create table t1 (a int, b blob) engine=innodb; +set innodb_compression_default= on; +create table s_import like t1; + +show create table t1; +show create table s_import; + +DROP TABLE t1,s_import; + +--echo # End of 10.5 tests diff --git a/mysql-test/suite/innodb/t/create_select.test b/mysql-test/suite/innodb/t/create_select.test index 8103902e5f6..053db79b8f4 100644 --- a/mysql-test/suite/innodb/t/create_select.test +++ b/mysql-test/suite/innodb/t/create_select.test @@ -26,3 +26,16 @@ reap; CREATE TABLE t1 (a SERIAL) ENGINE=InnoDB; DROP TABLE t1; --source include/wait_until_count_sessions.inc + +--echo # End of 10.2 tests + +--echo # +--echo # MDEV-35236 Assertion `(mem_root->flags & 4) == 0' failed in safe_lexcstrdup_root +--echo # +prepare stmt from 'create or replace table t engine=innodb select 1 as f'; +set innodb_compression_default=on; +execute stmt; +execute stmt; +drop table t; + +--echo # End of 10.5 tests diff --git a/mysql-test/suite/innodb/t/instant_alter_bugs.test b/mysql-test/suite/innodb/t/instant_alter_bugs.test index f7841c1e4ef..dcdcd07700e 100644 --- a/mysql-test/suite/innodb/t/instant_alter_bugs.test +++ b/mysql-test/suite/innodb/t/instant_alter_bugs.test @@ -567,6 +567,16 @@ ALTER TABLE t1 DROP COLUMN a; ALTER TABLE t1 DROP COLUMN c; DROP TABLE t1; +--echo # +--echo # MDEV-35122 Incorrect NULL value handling for instantly +--echo # dropped BLOB columns +--echo # +CREATE TABLE t1 (c1 INT, c2 BLOB, c3 BLOB NOT NULL) ROW_FORMAT=REDUNDANT,ENGINE=InnoDB; +ALTER TABLE t1 DROP c2; +ALTER TABLE t1 DROP c3; +INSERT INTO t1 VALUES(1); +DROP TABLE t1; + --echo # End of 10.5 tests --echo # End of 10.6 tests diff --git a/mysql-test/suite/innodb/t/log_file_name.test b/mysql-test/suite/innodb/t/log_file_name.test index 350a1f7562a..d2951d8ede3 100644 --- a/mysql-test/suite/innodb/t/log_file_name.test +++ b/mysql-test/suite/innodb/t/log_file_name.test @@ -94,6 +94,7 @@ let SEARCH_PATTERN= InnoDB: Set innodb_force_recovery=1 to ignore this and to pe --source include/start_mysqld.inc eval $check_no_innodb; +--let $on_linux= `select @@version_compile_os LIKE 'Linux%'` --source include/shutdown_mysqld.inc let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t[12].ibd. @@ -107,9 +108,18 @@ let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t[12].ibd. --source include/start_mysqld.inc eval $check_no_innodb; --source include/shutdown_mysqld.inc -# On Windows, this error message is not output when t2.ibd is a directory! -#let SEARCH_PATTERN= \[Note\] InnoDB: Cannot read first page of .*t2.ibd; -#--source include/search_pattern_in_file.inc + +--let SEARCH_PATTERN= InnoDB: Could not measure the size of single-table tablespace file '.*test/t2\\.ibd' +if (!$on_linux) +{ +# os_file_get_size() would succeed on a directory. +--echo FOUND 1 /$SEARCH_PATTERN/ in mysqld.1.err +} +if ($on_linux) +{ +# lseek() reports EINVAL when invoked on a directory. +--source include/search_pattern_in_file.inc +} --rmdir $MYSQLD_DATADIR/test/t2.ibd @@ -148,10 +158,11 @@ DROP TABLE t0; --disable_query_log # The following are for the orphan file t0.ibd or for the directory t2.ibd: call mtr.add_suppression("InnoDB: Operating system error number [0-9]* in a file operation"); -call mtr.add_suppression("InnoDB: Error number [0-9]* means '(File exists|Is a directory)'"); +call mtr.add_suppression("InnoDB: Error number [0-9]* means '(File exists|Is a directory|Invalid argument)'"); call mtr.add_suppression("InnoDB: Cannot create file '.*t0.ibd'"); call mtr.add_suppression("InnoDB: The file '.*t0\.ibd' already exists"); call mtr.add_suppression("InnoDB: Cannot open datafile for read-write: '.*t2\.ibd'"); +call mtr.add_suppression("InnoDB: Could not measure the size of single-table tablespace file '.*test/t2\\.ibd'"); # The following are for aborted startup without --innodb-force-recovery: call mtr.add_suppression("InnoDB: Tablespace .* was not found at .*test"); call mtr.add_suppression("InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace"); diff --git a/mysql-test/suite/innodb/t/page_compression_windows.opt b/mysql-test/suite/innodb/t/page_compression_windows.opt new file mode 100644 index 00000000000..66bceccc683 --- /dev/null +++ b/mysql-test/suite/innodb/t/page_compression_windows.opt @@ -0,0 +1 @@ +--innodb-sys-tablespaces diff --git a/mysql-test/suite/innodb/t/page_compression_windows.test b/mysql-test/suite/innodb/t/page_compression_windows.test new file mode 100644 index 00000000000..4400afd6171 --- /dev/null +++ b/mysql-test/suite/innodb/t/page_compression_windows.test @@ -0,0 +1,7 @@ +--source include/have_innodb.inc +--source include/windows.inc +create table t_compressed(b longblob) engine=InnoDB page_compressed=1; +insert into t_compressed values(repeat(1,1000000)); +# Check that compression worked, i.e allocated size (physical file size) < logical file size +select allocated_size < file_size from information_schema.innodb_sys_tablespaces where name='test/t_compressed'; +drop table t_compressed; diff --git a/mysql-test/suite/innodb_fts/r/fulltext.result b/mysql-test/suite/innodb_fts/r/fulltext.result index e638b45d4b1..60b74d46d3c 100644 --- a/mysql-test/suite/innodb_fts/r/fulltext.result +++ b/mysql-test/suite/innodb_fts/r/fulltext.result @@ -784,3 +784,28 @@ f1 MATCH(f1) AGAINST ("test" IN BOOLEAN MODE) test 0.000000001885928302414186 DROP TABLE t1; # End of 10.3 tests +# +# MDEV-35183 ADD FULLTEXT INDEX unnecessarily DROPS FTS +# COMMON TABLES +# +CREATE TABLE t1 ( +ID INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), book VARCHAR(200), +FULLTEXT fidx(title)) ENGINE = InnoDB; +INSERT INTO t1(title) VALUES('database'); +ALTER TABLE t1 DROP INDEX fidx; +select space into @common_space from information_schema.innodb_sys_tables where name like "test/FTS_%_CONFIG"; +ALTER TABLE t1 ADD FULLTEXT fidx_1(book); +select space=@common_space from information_schema.innodb_sys_tables where name like "test/FTS_%_CONFIG"; +space=@common_space +1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `ID` int(10) unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(200) DEFAULT NULL, + `book` varchar(200) DEFAULT NULL, + PRIMARY KEY (`ID`), + FULLTEXT KEY `fidx_1` (`book`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/t/fulltext.test b/mysql-test/suite/innodb_fts/t/fulltext.test index 3ddc1856b7f..02a9f32dbed 100644 --- a/mysql-test/suite/innodb_fts/t/fulltext.test +++ b/mysql-test/suite/innodb_fts/t/fulltext.test @@ -803,3 +803,19 @@ SELECT f1, MATCH(f1) AGAINST ("test" IN BOOLEAN MODE) FROM t1; DROP TABLE t1; --echo # End of 10.3 tests + +--echo # +--echo # MDEV-35183 ADD FULLTEXT INDEX unnecessarily DROPS FTS +--echo # COMMON TABLES +--echo # +CREATE TABLE t1 ( + ID INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, + title VARCHAR(200), book VARCHAR(200), + FULLTEXT fidx(title)) ENGINE = InnoDB; +INSERT INTO t1(title) VALUES('database'); +ALTER TABLE t1 DROP INDEX fidx; +select space into @common_space from information_schema.innodb_sys_tables where name like "test/FTS_%_CONFIG"; +ALTER TABLE t1 ADD FULLTEXT fidx_1(book); +select space=@common_space from information_schema.innodb_sys_tables where name like "test/FTS_%_CONFIG"; +SHOW CREATE TABLE t1; +DROP TABLE t1; diff --git a/mysql-test/suite/sql_sequence/alter.result b/mysql-test/suite/sql_sequence/alter.result index 75da828c59c..15b3ed72af6 100644 --- a/mysql-test/suite/sql_sequence/alter.result +++ b/mysql-test/suite/sql_sequence/alter.result @@ -302,16 +302,91 @@ drop sequence s; # End of 10.4 tests # # +# MDEV-32350 Can't selectively restore sequences using innodb tables from +# backup +# +create sequence s2 engine=innodb; +alter table s2 discard tablespace; +SELECT NEXTVAL(s2); +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB +create sequence s1 engine=innodb; +select * from s1; +next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count +1 1 9223372036854775806 1 1 1000 0 0 +flush tables s1 for export; +unlock tables; +select * from s2; +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB +SELECT NEXTVAL(s2); +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB +alter sequence s2 restart; +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB +alter table s2 import tablespace; +select * from s2; +next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count +1 1 9223372036854775806 1 1 1000 0 0 +SELECT NEXTVAL(s2); +NEXTVAL(s2) +1 +select NEXTVAL(s1); +NEXTVAL(s1) +1 +flush table s1,s2; +select * from s1; +next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count +1001 1 9223372036854775806 1 1 1000 0 0 +select * from s2; +next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count +1001 1 9223372036854775806 1 1 1000 0 0 +drop sequence s1,s2; +# +# MDEV-35144 CREATE TABLE ... LIKE uses current innodb_compression_default instead of the create value +# +set @@innodb_compression_default= off; +create or replace sequence s engine=innodb; +set @@innodb_compression_default= on; +create or replace table s_import like s; +show create table s; +Table Create Table +s CREATE TABLE `s` ( + `next_not_cached_value` bigint(21) NOT NULL, + `minimum_value` bigint(21) NOT NULL, + `maximum_value` bigint(21) NOT NULL, + `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used', + `increment` bigint(21) NOT NULL COMMENT 'increment value', + `cache_size` bigint(21) unsigned NOT NULL, + `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed', + `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done' +) ENGINE=InnoDB SEQUENCE=1 +show create table s_import; +Table Create Table +s_import CREATE TABLE `s_import` ( + `next_not_cached_value` bigint(21) NOT NULL, + `minimum_value` bigint(21) NOT NULL, + `maximum_value` bigint(21) NOT NULL, + `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used', + `increment` bigint(21) NOT NULL COMMENT 'increment value', + `cache_size` bigint(21) unsigned NOT NULL, + `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed', + `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done' +) ENGINE=InnoDB SEQUENCE=1 +alter table s_import discard tablespace; +flush table s for export; +UNLOCK TABLES; +alter table s_import import tablespace; +drop table s,s_import; +# End of 10.5 tests +# # MDEV-31607 ER_DUP_KEY in mysql.table_stats upon REANME on sequence # CREATE SEQUENCE s1 ENGINE=InnoDB; CREATE SEQUENCE s2 ENGINE=InnoDB; SHOW CREATE SEQUENCE s1; Table Create Table -s1 CREATE SEQUENCE `s1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB +s1 CREATE SEQUENCE `s1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB `PAGE_COMPRESSED`='ON' SHOW CREATE SEQUENCE s2; Table Create Table -s2 CREATE SEQUENCE `s2` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB +s2 CREATE SEQUENCE `s2` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB `PAGE_COMPRESSED`='ON' DROP SEQUENCE s2; RENAME TABLE s1 TO s2; DROP SEQUENCE s2; diff --git a/mysql-test/suite/sql_sequence/alter.test b/mysql-test/suite/sql_sequence/alter.test index 7b14055d892..9ee2f222312 100644 --- a/mysql-test/suite/sql_sequence/alter.test +++ b/mysql-test/suite/sql_sequence/alter.test @@ -202,6 +202,63 @@ drop sequence s; --echo # End of 10.4 tests --echo # +--echo # +--echo # MDEV-32350 Can't selectively restore sequences using innodb tables from +--echo # backup +--echo # + +--disable_ps_protocol + +create sequence s2 engine=innodb; +alter table s2 discard tablespace; +--error ER_GET_ERRNO +SELECT NEXTVAL(s2); +create sequence s1 engine=innodb; +select * from s1; +flush tables s1 for export; +--let $MYSQLD_DATADIR= `select @@datadir` +--move_file $MYSQLD_DATADIR/test/s1.cfg $MYSQLD_DATADIR/test/s2.cfg +--copy_file $MYSQLD_DATADIR/test/s1.ibd $MYSQLD_DATADIR/test/s2.ibd +unlock tables; +--error ER_GET_ERRNO +select * from s2; +--error ER_GET_ERRNO +SELECT NEXTVAL(s2); +--error ER_GET_ERRNO +alter sequence s2 restart; +alter table s2 import tablespace; +select * from s2; +SELECT NEXTVAL(s2); +select NEXTVAL(s1); +flush table s1,s2; +select * from s1; +select * from s2; +drop sequence s1,s2; + +--enable_ps_protocol + +--echo # +--echo # MDEV-35144 CREATE TABLE ... LIKE uses current innodb_compression_default instead of the create value +--echo # + +set @@innodb_compression_default= off; +create or replace sequence s engine=innodb; +set @@innodb_compression_default= on; +create or replace table s_import like s; + +show create table s; +show create table s_import; + +alter table s_import discard tablespace; +flush table s for export; +--copy_file $MYSQLD_DATADIR/test/s.ibd $MYSQLD_DATADIR/test/s_import.ibd +--copy_file $MYSQLD_DATADIR/test/s.cfg $MYSQLD_DATADIR/test/s_import.cfg +UNLOCK TABLES; +alter table s_import import tablespace; +drop table s,s_import; + +--echo # End of 10.5 tests + --echo # --echo # MDEV-31607 ER_DUP_KEY in mysql.table_stats upon REANME on sequence --echo # diff --git a/mysql-test/suite/sql_sequence/create.result b/mysql-test/suite/sql_sequence/create.result index 9d601a9e551..847a842ab95 100644 --- a/mysql-test/suite/sql_sequence/create.result +++ b/mysql-test/suite/sql_sequence/create.result @@ -724,3 +724,34 @@ ERROR HY000: Sequence 'test.s' table structure is invalid (Wrong number of colum # # End of 10.4 test # +# +# Ensure that SHOW CREATE TABLE shows used table options +# +SET @@innodb_compression_default=ON; +CREATE TABLE seq ( +`next_not_cached_value` bigint(21) NOT NULL, +`minimum_value` bigint(21) NOT NULL, +`maximum_value` bigint(21) NOT NULL, +`start_value` bigint(21) NOT NULL, +`increment` bigint(21) NOT NULL, +`cache_size` bigint(21) unsigned NOT NULL, +`cycle_option` tinyint(1) unsigned NOT NULL, +`cycle_count` bigint(21) NOT NULL +) engine=innodb,sequence=1; +show create sequence seq; +Table Create Table +seq CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB `PAGE_COMPRESSED`='ON' +show create table seq; +Table Create Table +seq CREATE TABLE `seq` ( + `next_not_cached_value` bigint(21) NOT NULL, + `minimum_value` bigint(21) NOT NULL, + `maximum_value` bigint(21) NOT NULL, + `start_value` bigint(21) NOT NULL, + `increment` bigint(21) NOT NULL, + `cache_size` bigint(21) unsigned NOT NULL, + `cycle_option` tinyint(1) unsigned NOT NULL, + `cycle_count` bigint(21) NOT NULL +) ENGINE=InnoDB SEQUENCE=1 `PAGE_COMPRESSED`='ON' +drop sequence seq; +SET @@innodb_compression_default=DEFAULT; diff --git a/mysql-test/suite/sql_sequence/create.test b/mysql-test/suite/sql_sequence/create.test index 4cece26de8e..625f3083487 100644 --- a/mysql-test/suite/sql_sequence/create.test +++ b/mysql-test/suite/sql_sequence/create.test @@ -565,3 +565,23 @@ create table s sequence=1 as select 1; --echo # --echo # End of 10.4 test --echo # + +--echo # +--echo # Ensure that SHOW CREATE TABLE shows used table options +--echo # + +SET @@innodb_compression_default=ON; +CREATE TABLE seq ( + `next_not_cached_value` bigint(21) NOT NULL, + `minimum_value` bigint(21) NOT NULL, + `maximum_value` bigint(21) NOT NULL, + `start_value` bigint(21) NOT NULL, + `increment` bigint(21) NOT NULL, + `cache_size` bigint(21) unsigned NOT NULL, + `cycle_option` tinyint(1) unsigned NOT NULL, + `cycle_count` bigint(21) NOT NULL +) engine=innodb,sequence=1; +show create sequence seq; +show create table seq; +drop sequence seq; +SET @@innodb_compression_default=DEFAULT; diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt index ed7fa22a0ac..0253d4471da 100644 --- a/mysys/CMakeLists.txt +++ b/mysys/CMakeLists.txt @@ -27,6 +27,7 @@ SET(MYSYS_SOURCES array.c charset-def.c charset.c my_default.c my_alloc.c my_bit.c my_bitmap.c my_chsize.c my_compress.c my_copy.c my_create.c my_delete.c my_div.c my_error.c my_file.c my_fopen.c my_fstream.c + my_getexe.c my_gethwaddr.c my_getopt.c my_getsystime.c my_getwd.c my_compare.c my_init.c my_lib.c my_lock.c my_malloc.c my_mess.c my_mkdir.c my_mmap.c my_once.c my_open.c my_pread.c my_pthread.c @@ -35,7 +36,7 @@ SET(MYSYS_SOURCES array.c charset-def.c charset.c my_default.c my_basename.c my_write.c ptr_cmp.c queues.c stacktrace.c string.c thr_alarm.c thr_lock.c thr_mutex.c - thr_rwlock.c thr_timer.c + thr_rwlock.c thr_timer.c my_stack.c tree.c typelib.c base64.c my_memmem.c my_getpagesize.c guess_malloc_library.c diff --git a/mysys/my_getexe.c b/mysys/my_getexe.c new file mode 100644 index 00000000000..cb843ca7271 --- /dev/null +++ b/mysys/my_getexe.c @@ -0,0 +1,66 @@ +/* Copyright (c) 2017, MariaDB Plc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ + +#include +#include + +#ifdef _WIN32 +#elif defined(__linux__) +#include +#elif defined(__APPLE__) +#include +#elif defined(__FreeBSD__) +#include +#elif defined(__NetBSD__) +#include +#include +#endif + +/** Fill the buffer with the executable program name +@param[out] buf buffer to place obtained executable name. +@param[in] size size available in the buffer. +@param[in] argv0 the argv0 from which the executable argv might be used. +@return 0, for successful filling of buf, non-zero for failure. */ +int my_get_exepath(char *buf, size_t size, const char *argv0) +{ +#ifdef _WIN32 + DWORD ret = GetModuleFileNameA(NULL, buf, (DWORD)size); + if (ret > 0) + return 0; +#elif defined(__linux__) + ssize_t ret = readlink("/proc/self/exe", buf, size-1); + if(ret > 0) + return 0; +#elif defined(__APPLE__) + size_t ret = proc_pidpath(getpid(), buf, (uint32_t)size); + if (ret > 0) { + buf[ret] = 0; + return 0; + } +#elif defined(__FreeBSD__) + int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1}; + if (sysctl(mib, 4, buf, &size, NULL, 0) == 0) { + return 0; + } +#elif defined(__NetBSD__) + int mib[4] = {CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME }; + if (sysctl(mib, 4, buf, &size, NULL, 0) == 0) + return 0; +#endif + + if (argv0) + return my_realpath(buf, argv0, 0); + return 1; +} diff --git a/mysys/my_stack.c b/mysys/my_stack.c new file mode 100644 index 00000000000..3eec01092ac --- /dev/null +++ b/mysys/my_stack.c @@ -0,0 +1,95 @@ +/* Copyright 2024 MariaDB corporation AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA +*/ + + +/* + Get start and end of stack + + Note that the code depends on STACK_DIRECTION that is defined by cmake. + In general, STACK_DIRECTION should be 1 except in case of + an upward-growing stack that can happen on sparc or hpux platforms. +*/ + + +#include "my_global.h" +#include "my_sys.h" +#include "my_stack_alloc.h" + +#ifdef _WIN_ +#include +#include +#include +#endif + +/* Get start and end of stack */ + +extern void my_get_stack_bounds(void **stack_start, void **stack_end, + void *fallback_stack_start, + size_t fallback_stack_size) +{ +#if defined(__GNUC__) || defined(__clang__) /* GCC or Clang compilers */ + size_t stack_size; +#if defined(HAVE_PTHREAD_GETATTR_NP) + /* POSIX-compliant system (Linux, macOS, etc.) */ + pthread_attr_t attr; + pthread_t thread= pthread_self(); + void *stack_base; + + /* Get the thread attributes */ + if (pthread_getattr_np(thread, &attr) == 0) + { + /* Get stack base and size */ + pthread_attr_getstack(&attr, &stack_base, &stack_size); + /* + stack_base points to start of the stack region to which the + stack grows to + */ + *stack_start= stack_base - stack_size * STACK_DIRECTION; + pthread_attr_destroy(&attr); /* Clean up */ + } + else + { + /* + Fallback: + Use the current stack pointer as an approximation of the start + */ + *stack_start= my_get_stack_pointer(fallback_stack_start); + stack_size= (fallback_stack_size - + MY_MIN(fallback_stack_size, MY_STACK_SAFE_MARGIN)); + } +#else + /* Platform does not have pthread_getattr_np */ + *stack_start= my_get_stack_pointer(fallback_stack_start); + stack_size= (fallback_stack_size - + MY_MIN(fallback_stack_size, MY_STACK_SAFE_MARGIN)); +#endif /* defined(HAVE_PTHREAD_GETATTR_NP) */ + *stack_end= *stack_start + stack_size * STACK_DIRECTION; + +#elif defined(_MSC_VER) && defined(_WIN32) + /* Windows platform (MSVC) */ + NT_TIB* teb= (NT_TIB*)NtCurrentTeb(); + + *stack_start= teb->StackBase; /* Start of the stack */ + *stack_end= teb->StackLimit; /* End of the stack (stack limit) */ +#else + /* Unsupported platform / compiler */ + *stack_start= my_get_stack_pointer(fallback_stack_start); + *stack_end= (*stack_start + + (fallback_stack_size - + MY_MIN(fallback_stack_size, MY_STACK_SAFE_MARGIN)) * + STACK_DIRECTON); +#endif /* defined(__GNUC__) || defined(__clang__) */ +} diff --git a/mysys/my_symlink.c b/mysys/my_symlink.c index 8238e501e7f..57d4e9749b4 100644 --- a/mysys/my_symlink.c +++ b/mysys/my_symlink.c @@ -141,7 +141,7 @@ int my_is_symlink(const char *filename __attribute__((unused))) int my_realpath(char *to, const char *filename, myf MyFlags) { -#if defined(HAVE_REALPATH) && !defined(HAVE_BROKEN_REALPATH) +#if defined(HAVE_REALPATH) int result=0; char buff[BUFF_LEN]; char *ptr; diff --git a/sql/create_options.cc b/sql/create_options.cc index 5437de0f0c3..673487d4bb6 100644 --- a/sql/create_options.cc +++ b/sql/create_options.cc @@ -117,15 +117,13 @@ static bool report_unknown_option(THD *thd, engine_option_value *val, #define value_ptr(STRUCT,OPT) ((char*)(STRUCT) + (OPT)->offset) -static bool set_one_value(ha_create_table_option *opt, - THD *thd, const LEX_CSTRING *value, void *base, - bool suppress_warning, - MEM_ROOT *root) +static bool set_one_value(ha_create_table_option *opt, THD *thd, + const LEX_CSTRING *value, void *base, + bool suppress_warning, MEM_ROOT *root) { DBUG_ENTER("set_one_value"); DBUG_PRINT("enter", ("opt: %p type: %u name '%s' value: '%s'", - opt, - opt->type, opt->name, + opt, opt->type, opt->name, (value->str ? value->str : ""))); switch (opt->type) { @@ -141,10 +139,9 @@ static bool set_one_value(ha_create_table_option *opt, DBUG_RETURN(0); } - my_option optp= - { opt->name, 1, 0, (uchar **)val, 0, 0, GET_ULL, + my_option optp= { opt->name, 1, 0, (uchar **)val, 0, 0, GET_ULL, REQUIRED_ARG, (longlong)opt->def_value, (longlong)opt->min_value, - opt->max_value, 0, (long) opt->block_size, 0}; + opt->max_value, 0, (long) opt->block_size, 0 }; ulonglong orig_val= strtoull(value->str, NULL, 10); my_bool unused; @@ -236,6 +233,73 @@ static bool set_one_value(ha_create_table_option *opt, static const size_t ha_option_type_sizeof[]= { sizeof(ulonglong), sizeof(char *), sizeof(uint), sizeof(bool)}; +/** + Appends values of sysvar-based options if needed + + @param thd thread handler + @param option_list list of options given by user + @param rules list of option description by engine + @param root MEM_ROOT where allocate memory + + @retval TRUE Error + @retval FALSE OK +*/ + +bool extend_option_list(THD* thd, handlerton *hton, bool create, + engine_option_value **option_list, + ha_create_table_option *rules) +{ + DBUG_ENTER("extend_option_list"); + MEM_ROOT *root= thd->mem_root; + bool extended= false; + + for (ha_create_table_option *opt= rules; rules && opt->name; opt++) + { + if (opt->var) + { + engine_option_value *found= NULL, *last; + for (engine_option_value *val= *option_list; val; val= val->next) + { + last= val; + if (!system_charset_info->strnncoll(opt->name, opt->name_length, + val->name.str, val->name.length)) + found= val; // find the last matching + } + if (found ? !found->value.str : create) + { + /* add the current value of the corresponding sysvar to the list */ + sys_var *sysvar= find_hton_sysvar(hton, opt->var); + DBUG_ASSERT(sysvar); + + if (!sysvar->session_is_default(thd)) + { + StringBuffer<256> sbuf(system_charset_info); + String *str= sysvar->val_str(&sbuf, thd, OPT_SESSION, &null_clex_str); + DBUG_ASSERT(str); + + LEX_CSTRING name= { opt->name, opt->name_length }; + LEX_CSTRING value= safe_lexcstrdup_root(root, str->to_lex_cstring()); + if (found) + found->value= value; + else + { + if (!extended) + { + if (*option_list) + thd->register_item_tree_change((Item**)&(last->next)); + extended= true; + } + new (root) engine_option_value(name, value, + opt->type != HA_OPTION_TYPE_ULL, option_list, &last); + } + } + } + } + } + DBUG_RETURN(FALSE); +} + + /** Creates option structure and parses list of options in it @@ -250,7 +314,7 @@ static const size_t ha_option_type_sizeof[]= @retval FALSE OK */ -bool parse_option_list(THD* thd, handlerton *hton, void *option_struct_arg, +bool parse_option_list(THD* thd, void *option_struct_arg, engine_option_value **option_list, ha_create_table_option *rules, bool suppress_warning, MEM_ROOT *root) @@ -296,58 +360,8 @@ bool parse_option_list(THD* thd, handlerton *hton, void *option_struct_arg, break; } if (!seen || (opt->var && !last->value.str)) - { - LEX_CSTRING default_val= null_clex_str; - - /* - Okay, here's the logic for sysvar options: - 1. When we parse CREATE TABLE and sysvar option was not explicitly - mentioned we add it to the list as if it was specified with the - *current* value of the underlying sysvar. - 2. But only if the underlying sysvar value is different from the - sysvar's default. - 3. If it's ALTER TABLE or CREATE_SEQUENCE and the sysvar option was - not explicitly mentioned - do nothing, do not add it to the list. - 4. But if it was ALTER TABLE with sysvar option = DEFAULT, we - add it to the list (under the same condition #2). - 5. If we're here parsing the option list from the .frm file - for a normal open_table() and the sysvar option was not there - - do not add it to the list (makes no sense anyway) and - use the *default* value of the underlying sysvar. Because - sysvar value can change, but it should not affect existing tables. - This is how it's implemented: the current sysvar value is added - to the list if suppress_warning is FALSE (meaning a table is created, - that is CREATE TABLE or ALTER TABLE) and it's actually a CREATE TABLE - command or it's an ALTER TABLE and the option was seen (=DEFAULT). - - Note that if the option was set explicitly (not =DEFAULT) it wouldn't - have passes the if() condition above. - */ - if (!suppress_warning && opt->var && - (thd->lex->sql_command == SQLCOM_CREATE_TABLE || seen)) - { - // take a value from the variable and add it to the list - sys_var *sysvar= find_hton_sysvar(hton, opt->var); - DBUG_ASSERT(sysvar); - - if (!sysvar->session_is_default(thd)) - { - char buf[256]; - String sbuf(buf, sizeof(buf), system_charset_info), *str; - if ((str= sysvar->val_str(&sbuf, thd, OPT_SESSION, &null_clex_str))) - { - LEX_CSTRING name= { opt->name, opt->name_length }; - default_val.str= strmake_root(root, str->ptr(), str->length()); - default_val.length= str->length(); - val= new (root) engine_option_value(name, default_val, - opt->type != HA_OPTION_TYPE_ULL, option_list, &last); - val->parsed= true; - } - } - } - set_one_value(opt, thd, &default_val, *option_struct, + set_one_value(opt, thd, &null_clex_str, *option_struct, suppress_warning, root); - } } for (val= *option_list; val; val= val->next) @@ -474,13 +488,13 @@ bool parse_engine_table_options(THD *thd, handlerton *ht, TABLE_SHARE *share) MEM_ROOT *root= &share->mem_root; DBUG_ENTER("parse_engine_table_options"); - if (parse_option_list(thd, ht, &share->option_struct, & share->option_list, + if (parse_option_list(thd, &share->option_struct, & share->option_list, ht->table_options, TRUE, root)) DBUG_RETURN(TRUE); for (Field **field= share->field; *field; field++) { - if (parse_option_list(thd, ht, &(*field)->option_struct, + if (parse_option_list(thd, &(*field)->option_struct, & (*field)->option_list, ht->field_options, TRUE, root)) DBUG_RETURN(TRUE); @@ -488,7 +502,7 @@ bool parse_engine_table_options(THD *thd, handlerton *ht, TABLE_SHARE *share) for (uint index= 0; index < share->keys; index ++) { - if (parse_option_list(thd, ht, &share->key_info[index].option_struct, + if (parse_option_list(thd, &share->key_info[index].option_struct, & share->key_info[index].option_list, ht->index_options, TRUE, root)) DBUG_RETURN(TRUE); @@ -799,4 +813,3 @@ bool is_engine_option_known(engine_option_value *opt, } return false; } - diff --git a/sql/create_options.h b/sql/create_options.h index ce64516794b..a8eece58a22 100644 --- a/sql/create_options.h +++ b/sql/create_options.h @@ -83,10 +83,14 @@ class Create_field; bool resolve_sysvar_table_options(handlerton *hton); void free_sysvar_table_options(handlerton *hton); bool parse_engine_table_options(THD *thd, handlerton *ht, TABLE_SHARE *share); -bool parse_option_list(THD* thd, handlerton *hton, void *option_struct, +bool parse_option_list(THD* thd, void *option_struct, engine_option_value **option_list, ha_create_table_option *rules, bool suppress_warning, MEM_ROOT *root); +bool extend_option_list(THD* thd, handlerton *hton, bool create, + engine_option_value **option_list, + ha_create_table_option *rules); + bool engine_table_options_frm_read(const uchar *buff, size_t length, TABLE_SHARE *share); engine_option_value *merge_engine_table_options(engine_option_value *source, diff --git a/sql/ddl_log.cc b/sql/ddl_log.cc index f42bf961732..b210f68a203 100644 --- a/sql/ddl_log.cc +++ b/sql/ddl_log.cc @@ -2727,7 +2727,6 @@ int ddl_log_execute_recovery() DBUG_RETURN(1); } original_thd= current_thd; // Probably NULL - thd->thread_stack= (char*) &thd; thd->store_globals(); thd->init(); // Needed for error messages diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc index 97529bd9809..b48c3a1ae80 100644 --- a/sql/event_scheduler.cc +++ b/sql/event_scheduler.cc @@ -219,12 +219,10 @@ pre_init_event_thread(THD* thd) pthread_handler_t event_scheduler_thread(void *arg) { - /* needs to be first for thread_stack */ THD *thd= (THD *) ((struct scheduler_param *) arg)->thd; Event_scheduler *scheduler= ((struct scheduler_param *) arg)->scheduler; bool res; - - thd->thread_stack= (char *)&thd; // remember where our stack is + thd->reset_stack(); mysql_thread_set_psi_id(thd->thread_id); @@ -285,8 +283,6 @@ event_worker_thread(void *arg) void Event_worker_thread::run(THD *thd, Event_queue_element_for_exec *event) { - /* needs to be first for thread_stack */ - char my_stack; Event_job_data job_data; bool res; @@ -302,7 +298,6 @@ Event_worker_thread::run(THD *thd, Event_queue_element_for_exec *event) thd->charset(), NULL); #endif - thd->thread_stack= &my_stack; // remember where our stack is res= post_init_event_thread(thd); DBUG_ENTER("Event_worker_thread::run"); diff --git a/sql/events.cc b/sql/events.cc index f06068e84e8..bab58436f10 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -898,12 +898,6 @@ Events::init(THD *thd, bool opt_noacl_or_bootstrap) res= TRUE; goto end; } - /* - The thread stack does not start from this function but we cannot - guess the real value. So better some value that doesn't assert than - no value. - */ - thd->thread_stack= (char*) &thd; thd->store_globals(); /* Set current time for the thread that handles events. diff --git a/sql/ha_sequence.cc b/sql/ha_sequence.cc index 92b307ff217..3803042bec5 100644 --- a/sql/ha_sequence.cc +++ b/sql/ha_sequence.cc @@ -367,6 +367,21 @@ int ha_sequence::external_lock(THD *thd, int lock_type) return error; } +int ha_sequence::discard_or_import_tablespace(my_bool discard) +{ + int error= file->discard_or_import_tablespace(discard); + if (!error && !discard) + { + /* Doing import table space. Read the imported values */ + if (!(error= table->s->sequence->read_stored_values(table))) + { + table->s->sequence->initialized= SEQUENCE::SEQ_READY_TO_USE; + memcpy(table->record[1], table->s->default_values, table->s->reclength); + } + } + return error; +} + /* Squence engine error deal method */ diff --git a/sql/ha_sequence.h b/sql/ha_sequence.h index ac64c978b5b..0a3ff86a121 100644 --- a/sql/ha_sequence.h +++ b/sql/ha_sequence.h @@ -65,6 +65,8 @@ public: ha_sequence(handlerton *hton, TABLE_SHARE *share); ~ha_sequence(); + virtual handlerton *storage_ht() const override + { return file->ht; } /* virtual function that are re-implemented for sequence */ int open(const char *name, int mode, uint test_if_locked) override; @@ -143,7 +145,7 @@ public: { file->unbind_psi(); } void rebind_psi() override { file->rebind_psi(); } - + int discard_or_import_tablespace(my_bool discard) override; bool auto_repair(int error) const override { return file->auto_repair(error); } int repair(THD* thd, HA_CHECK_OPT* check_opt) override diff --git a/sql/handler.h b/sql/handler.h index 7b6c21927ac..778a40fa73c 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -5181,6 +5181,12 @@ public: virtual handlerton *partition_ht() const { return ht; } virtual bool partition_engine() { return 0;} + /* + Used with 'wrapper' engines, like SEQUENCE, to access to the + underlaying engine used for storage. + */ + virtual handlerton *storage_ht() const + { return ht; } inline int ha_write_tmp_row(uchar *buf); inline int ha_delete_tmp_row(uchar *buf); inline int ha_update_tmp_row(const uchar * old_data, uchar * new_data); diff --git a/sql/item.cc b/sql/item.cc index 2f1cc9014fd..310ab5e3131 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -7961,6 +7961,7 @@ static Item *find_producing_item(Item *item, st_select_lex *sel) { DBUG_ASSERT(item->type() == Item::FIELD_ITEM || + item->type() == Item::TRIGGER_FIELD_ITEM || (item->type() == Item::REF_ITEM && ((Item_ref *) item)->ref_type() == Item_ref::VIEW_REF)); Item_field *field_item= NULL; @@ -9745,7 +9746,8 @@ bool Item_default_value::fix_fields(THD *thd, Item **items) void Item_default_value::cleanup() { - delete field; // Free cached blob data + if (!m_share_field) + delete field; // Free cached blob data Item_field::cleanup(); } diff --git a/sql/item.h b/sql/item.h index 3ae206370f0..59212e5db68 100644 --- a/sql/item.h +++ b/sql/item.h @@ -6906,8 +6906,9 @@ public: class Item_default_value : public Item_field { - bool vcol_assignment_ok; - bool m_associated= false; + bool vcol_assignment_ok:1; + bool m_associated:1; + bool m_share_field:1; void calculate(); public: @@ -6915,7 +6916,11 @@ public: Item_default_value(THD *thd, Name_resolution_context *context_arg, Item *a, bool vcol_assignment_arg) : Item_field(thd, context_arg), - vcol_assignment_ok(vcol_assignment_arg), arg(a) {} + vcol_assignment_ok(vcol_assignment_arg), arg(a) + { + m_associated= false; + m_share_field= false; + } Type type() const override { return DEFAULT_VALUE_ITEM; } bool eq(const Item *item, bool binary_cmp) const override; bool fix_fields(THD *, Item **) override; @@ -6975,6 +6980,10 @@ public: } Item *transform(THD *thd, Item_transformer transformer, uchar *args) override; + Item *derived_field_transformer_for_having(THD *thd, uchar *arg) override + { return NULL; } + Item *derived_field_transformer_for_where(THD *thd, uchar *arg) override + { return NULL; } Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, const Tmp_field_param *param) override; @@ -6984,7 +6993,13 @@ public: */ bool associate_with_target_field(THD *thd, Item_field *field) override; Item *do_get_copy(THD *thd) const override - { return get_item_copy(thd, this); } + { + Item_default_value *new_item= + (Item_default_value *) get_item_copy(thd, this); + // This is a copy so do not manage the field and should not delete it + new_item->m_share_field= 1; + return new_item; + } Item* do_build_clone(THD *thd) const override { return get_copy(thd); } private: bool tie_field(THD *thd); @@ -7230,6 +7245,9 @@ Item_trigger_field(THD *thd, Name_resolution_context *context_arg, Item *copy_or_same(THD *) override { return this; } Item *get_tmp_table_item(THD *thd) override { return copy_or_same(thd); } void cleanup() override; + Item *do_get_copy(THD *thd) const override + { return get_item_copy(thd, this); } + Item *do_build_clone(THD *thd) const override { return get_copy(thd); } private: void set_required_privilege(bool rw) override; diff --git a/sql/log.cc b/sql/log.cc index 512be2e2a6d..a58dff0b545 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -10650,7 +10650,6 @@ binlog_background_thread(void *arg __attribute__((unused))) thd= new THD(next_thread_id()); thd->system_thread= SYSTEM_THREAD_BINLOG_BACKGROUND; - thd->thread_stack= (char*) &thd; /* Set approximate stack start */ thd->store_globals(); thd->security_ctx->skip_grants(); thd->set_command(COM_DAEMON); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 1f764fd0912..c0a519e9038 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5550,6 +5550,26 @@ static void test_lc_time_sz() #endif//DBUG_OFF +static void run_main_loop() +{ + select_thread=pthread_self(); + mysql_mutex_lock(&LOCK_start_thread); + select_thread_in_use=1; + mysql_mutex_unlock(&LOCK_start_thread); + +#ifdef _WIN32 + handle_connections_win(); +#else + handle_connections_sockets(); + + mysql_mutex_lock(&LOCK_start_thread); + select_thread_in_use=0; + mysql_cond_broadcast(&COND_start_thread); + mysql_mutex_unlock(&LOCK_start_thread); +#endif /* _WIN32 */ +} + + int mysqld_main(int argc, char **argv) { #ifndef _WIN32 @@ -5740,9 +5760,6 @@ int mysqld_main(int argc, char **argv) SYSVAR_AUTOSIZE(my_thread_stack_size, new_thread_stack_size); } - select_thread=pthread_self(); - select_thread_in_use=1; - #ifdef HAVE_LIBWRAP libwrapName= my_progname+dirname_length(my_progname); openlog(libwrapName, LOG_PID, LOG_AUTH); @@ -5796,7 +5813,6 @@ int mysqld_main(int argc, char **argv) // Recover and exit. if (wsrep_recovery) { - select_thread_in_use= 0; if (WSREP_ON) wsrep_recover(); else @@ -5869,7 +5885,6 @@ int mysqld_main(int argc, char **argv) if (opt_bootstrap) { - select_thread_in_use= 0; // Allow 'kill' to work int bootstrap_error= bootstrap(mysql_stdin); if (!abort_loop) unireg_abort(bootstrap_error); @@ -5909,12 +5924,11 @@ int mysqld_main(int argc, char **argv) mysqld_port, MYSQL_COMPILATION_COMMENT); else { - char real_server_version[2 * SERVER_VERSION_LENGTH + 10]; + char real_server_version[2 * SERVER_VERSION_LENGTH + 10], *pos; - set_server_version(real_server_version, sizeof(real_server_version)); - safe_strcat(real_server_version, sizeof(real_server_version), "' as '"); - safe_strcat(real_server_version, sizeof(real_server_version), - server_version); + pos= set_server_version(real_server_version, sizeof(real_server_version)-1); + strxnmov(pos, sizeof(real_server_version) - 1 - (pos-real_server_version), + "' as '", server_version, NullS); sql_print_information(ER_DEFAULT(ER_STARTUP), my_progname, real_server_version, @@ -5944,16 +5958,7 @@ int mysqld_main(int argc, char **argv) /* Memory used when everything is setup */ start_memory_used= global_status_var.global_memory_used; -#ifdef _WIN32 - handle_connections_win(); -#else - handle_connections_sockets(); - - mysql_mutex_lock(&LOCK_start_thread); - select_thread_in_use=0; - mysql_cond_broadcast(&COND_start_thread); - mysql_mutex_unlock(&LOCK_start_thread); -#endif /* _WIN32 */ + run_main_loop(); /* Shutdown requested */ char *user= shutdown_user.load(std::memory_order_relaxed); @@ -7723,7 +7728,7 @@ static int mysql_init_variables(void) /* Things reset to zero */ opt_skip_slave_start= opt_reckless_slave = 0; mysql_home[0]= pidfile_name[0]= log_error_file[0]= 0; -#if defined(HAVE_REALPATH) && !defined(HAVE_valgrind) && !defined(HAVE_BROKEN_REALPATH) +#if defined(HAVE_REALPATH) && !defined(HAVE_valgrind) /* We can only test for sub paths if my_symlink.c is using realpath */ mysys_test_invalid_symlink= path_starts_from_data_home_dir; #endif @@ -7823,6 +7828,8 @@ static int mysql_init_variables(void) lc_messages= (char*) "en_US"; lc_time_names_name= (char*) "en_US"; + have_symlink= SHOW_OPTION_YES; + /* Variables that depends on compile options */ #ifndef DBUG_OFF default_dbug_option=IF_WIN("d:t:i:O,\\mariadbd.trace", @@ -7846,11 +7853,6 @@ static int mysql_init_variables(void) #else have_openssl= have_ssl= SHOW_OPTION_NO; #endif -#ifdef HAVE_BROKEN_REALPATH - have_symlink=SHOW_OPTION_NO; -#else - have_symlink=SHOW_OPTION_YES; -#endif #ifdef HAVE_DLOPEN have_dlopen=SHOW_OPTION_YES; #else @@ -8641,7 +8643,7 @@ static int get_options(int *argc_ptr, char ***argv_ptr) global_system_variables.sql_mode= expand_sql_mode(global_system_variables.sql_mode); -#if !defined(HAVE_REALPATH) || defined(HAVE_BROKEN_REALPATH) +#if !defined(HAVE_REALPATH) my_use_symdir=0; my_disable_symlinks=1; have_symlink=SHOW_OPTION_NO; @@ -8777,7 +8779,7 @@ static int get_options(int *argc_ptr, char ***argv_ptr) (MYSQL_SERVER_SUFFIX is set by the compilation environment) */ -void set_server_version(char *buf, size_t size) +char *set_server_version(char *buf, size_t size) { bool is_log= opt_log || global_system_variables.sql_log_slow || opt_bin_log; bool is_debug= IF_DBUG(!strstr(MYSQL_SERVER_SUFFIX_STR, "-debug"), 0); @@ -8786,14 +8788,14 @@ void set_server_version(char *buf, size_t size) !strstr(MYSQL_SERVER_SUFFIX_STR, "-valgrind") ? "-valgrind" : #endif ""; - strxnmov(buf, size - 1, - MYSQL_SERVER_VERSION, - MYSQL_SERVER_SUFFIX_STR, - IF_EMBEDDED("-embedded", ""), - is_valgrind, - is_debug ? "-debug" : "", - is_log ? "-log" : "", - NullS); + return strxnmov(buf, size - 1, + MYSQL_SERVER_VERSION, + MYSQL_SERVER_SUFFIX_STR, + IF_EMBEDDED("-embedded", ""), + is_valgrind, + is_debug ? "-debug" : "", + is_log ? "-log" : "", + NullS); } diff --git a/sql/mysqld.h b/sql/mysqld.h index 46fa2698795..66b2a757c14 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -937,7 +937,7 @@ inline void table_case_convert(char * name, uint length) files_charset_info->casedn(name, length, name, length); } -extern void set_server_version(char *buf, size_t size); +extern char *set_server_version(char *buf, size_t size); #define current_thd _current_thd() void set_current_thd(THD *thd); diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index fa3379e30b4..3381d84776f 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -2764,7 +2764,8 @@ bool find_eq_ref_candidate(TABLE *table, table_map sj_inner_tables) keyuse++; } while (keyuse->key == key && keyuse->table == table); - if (bound_parts == PREV_BITS(uint, keyinfo->user_defined_key_parts)) + if (bound_parts == PREV_BITS(key_part_map, + keyinfo->user_defined_key_parts)) return TRUE; } else diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index faceeb6e325..fac87d6b310 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -1112,7 +1112,6 @@ bool Master_info_index::init_all_master_info() } thd= new THD(next_thread_id()); /* Needed by start_slave_threads */ - thd->thread_stack= (char*) &thd; thd->store_globals(); reinit_io_cache(&index_file, READ_CACHE, 0L,0,0); diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc index 92d424e952c..e59c1de7a7c 100644 --- a/sql/rpl_parallel.cc +++ b/sql/rpl_parallel.cc @@ -1197,7 +1197,6 @@ handle_rpl_parallel_thread(void *arg) my_thread_init(); thd = new THD(next_thread_id()); - thd->thread_stack = (char*)&thd; server_threads.insert(thd); set_current_thd(thd); pthread_detach_this_thread(); diff --git a/sql/semisync_master_ack_receiver.cc b/sql/semisync_master_ack_receiver.cc index bcc5bda8220..2aba358f1e7 100644 --- a/sql/semisync_master_ack_receiver.cc +++ b/sql/semisync_master_ack_receiver.cc @@ -251,7 +251,6 @@ void Ack_receiver::run() sql_print_information("Starting ack receiver thread"); thd->system_thread= SYSTEM_THREAD_SEMISYNC_MASTER_BACKGROUND; - thd->thread_stack= (char*) &thd; thd->store_globals(); thd->security_ctx->skip_grants(); thd->set_command(COM_DAEMON); diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index fab73fe0495..954510df367 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -7648,6 +7648,7 @@ ER_ACCESS_DENIED_NO_PASSWORD_ERROR 28000 ukr "Доступ заборонено для користувача: '%s'@'%s'" ER_SET_PASSWORD_AUTH_PLUGIN + chi "SET PASSWORD不适用于通过%s插件验证的用户" eng "SET PASSWORD is not applicable for users authenticating via %s plugin" ukr "SET PASSWORD не можна застосувати для користувачів, що автентифікуються з допомогою плагінy %s" diff --git a/sql/slave.cc b/sql/slave.cc index fb9f3fb1803..7a89edc0bc0 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -368,7 +368,6 @@ end: static THD *new_bg_THD() { THD *thd= new THD(next_thread_id()); - thd->thread_stack= (char*) &thd; thd->store_globals(); thd->system_thread = SYSTEM_THREAD_SLAVE_BACKGROUND; thd->security_ctx->skip_grants(); @@ -629,7 +628,6 @@ int init_slave() { int error; THD *thd= new THD(next_thread_id()); - thd->thread_stack= (char*) &thd; thd->store_globals(); error= start_slave_threads(0, /* No active thd */ @@ -4767,7 +4765,12 @@ pthread_handler_t handle_slave_io(void *arg) thd->set_psi(PSI_CALL_get_thread()); pthread_detach_this_thread(); - thd->thread_stack= (char*) &thd; // remember where our stack is + /* + Remember where our stack is. This is needed for this function as + there are a lot of stack variables. It will be fixed in store_globals() + called by init_slave_thread(). + */ + thd->thread_stack= (void*) &thd; // remember where our stack is mi->clear_error(); if (init_slave_thread(thd, mi, SLAVE_THD_IO)) { @@ -5412,7 +5415,7 @@ pthread_handler_t handle_slave_sql(void *arg) serial_rgi= new rpl_group_info(rli); thd = new THD(next_thread_id()); // note that contructor of THD uses DBUG_ ! - thd->thread_stack = (char*)&thd; // remember where our stack is + thd->thread_stack= (void*) &thd; // Big stack, remember where our stack is thd->system_thread_info.rpl_sql_info= &sql_info; DBUG_ASSERT(rli->inited); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index be231247a09..d4e21ebbc37 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2531,7 +2531,6 @@ bool acl_init(bool dont_read_acl_tables) */ if (!(thd=new THD(0))) DBUG_RETURN(1); /* purecov: inspected */ - thd->thread_stack= (char*) &thd; thd->store_globals(); /* It is safe to call acl_reload() since acl_* arrays and hashes which @@ -7966,7 +7965,6 @@ bool grant_init() if (!(thd= new THD(0))) DBUG_RETURN(1); /* purecov: deadcode */ - thd->thread_stack= (char*) &thd; thd->store_globals(); return_val= grant_reload(thd); delete thd; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 0ddf0740fdf..cd418eecab2 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -9091,17 +9091,17 @@ fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, Field **ptr, my_bool mysql_rm_tmp_tables(void) { + THD *thd; uint i, idx; char path[FN_REFLEN], *tmpdir, path_copy[FN_REFLEN]; MY_DIR *dirp; FILEINFO *file; TABLE_SHARE share; - THD *thd; DBUG_ENTER("mysql_rm_tmp_tables"); if (!(thd= new THD(0))) DBUG_RETURN(1); - thd->thread_stack= (char*) &thd; + thd->thread_stack= (void*) &thd; // Big stack thd->store_globals(); for (i=0; i<=mysql_tmpdir_list.max; i++) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index bf2a4f80302..c51cef47126 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -2246,12 +2246,6 @@ void THD::reset_killed() void THD::store_globals() { - /* - Assert that thread_stack is initialized: it's necessary to be able - to track stack overrun. - */ - DBUG_ASSERT(thread_stack); - set_current_thd(this); /* mysys_var is concurrently readable by a killer thread. @@ -2283,8 +2277,11 @@ void THD::store_globals() os_thread_id= 0; #endif real_id= pthread_self(); // For debugging - mysys_var->stack_ends_here= thread_stack + // for consistency, see libevent_thread_proc - STACK_DIRECTION * (long)my_thread_stack_size; + + /* Set stack start and stack end */ + my_get_stack_bounds(&thread_stack, &mysys_var->stack_ends_here, + thread_stack, my_thread_stack_size); + if (net.vio) { net.thd= this; @@ -2296,6 +2293,7 @@ void THD::store_globals() thr_lock_info_init(&lock_info, mysys_var); } + /** Untie THD from current thread @@ -5065,7 +5063,6 @@ TABLE *find_fk_open_table(THD *thd, const char *db, size_t db_len, MYSQL_THD create_thd() { THD *thd= new THD(next_thread_id()); - thd->thread_stack= (char*) &thd; thd->store_globals(); thd->set_command(COM_DAEMON); thd->system_thread= SYSTEM_THREAD_GENERIC; @@ -5145,7 +5142,6 @@ void *thd_attach_thd(MYSQL_THD thd) auto save_mysysvar= pthread_getspecific(THR_KEY_mysys); pthread_setspecific(THR_KEY_mysys, thd->mysys_var); - thd->thread_stack= (char *) &thd; thd->store_globals(); return save_mysysvar; } diff --git a/sql/sql_class.h b/sql/sql_class.h index 3d2cab9b0f9..da04c80e9e9 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -2826,7 +2826,7 @@ public: A pointer to the stack frame of handle_one_connection(), which is called first in the thread for handling a client */ - char *thread_stack; + void *thread_stack; /** Currently selected catalog. @@ -3915,6 +3915,10 @@ public: void free_connection(); void reset_for_reuse(); void store_globals(); + void reset_stack() + { + thread_stack= 0; + } void reset_globals(); bool trace_started() { @@ -4616,14 +4620,19 @@ public: return !stmt_arena->is_conventional(); } + void register_item_tree_change(Item **place) + { + /* TODO: check for OOM condition here */ + if (is_item_tree_change_register_required()) + nocheck_register_item_tree_change(place, *place, mem_root); + } + void change_item_tree(Item **place, Item *new_value) { DBUG_ENTER("THD::change_item_tree"); DBUG_PRINT("enter", ("Register: %p (%p) <- %p", *place, place, new_value)); - /* TODO: check for OOM condition here */ - if (is_item_tree_change_register_required()) - nocheck_register_item_tree_change(place, *place, mem_root); + register_item_tree_change(place); *place= new_value; DBUG_VOID_RETURN; } diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 4c1085c8825..4f37e5bf6bf 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -1387,16 +1387,6 @@ void do_handle_one_connection(CONNECT *connect, bool put_in_cache) thd->thr_create_utime= thr_create_utime; /* We need to set this because of time_out_user_resource_limits */ thd->start_utime= thr_create_utime; - - /* - handle_one_connection() is normally the only way a thread would - start and would always be on the very high end of the stack , - therefore, the thread stack always starts at the address of the - first local variable of handle_one_connection, which is thd. We - need to know the start of the stack so that we could check for - stack overruns. - */ - thd->thread_stack= (char*) &thd; setup_connection_thread_globals(thd); for (;;) diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index d17af093897..8ad771926b2 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -398,9 +398,10 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, if (returning) (void) result->prepare(returning->item_list, NULL); - if (thd->lex->current_select->first_cond_optimization) + if (!thd->lex->current_select->leaf_tables_saved) { thd->lex->current_select->save_leaf_tables(thd); + thd->lex->current_select->leaf_tables_saved= true; thd->lex->current_select->first_cond_optimization= 0; } /* check ORDER BY even if it can be ignored */ @@ -523,6 +524,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, { thd->lex->current_select->save_leaf_tables(thd); thd->lex->current_select->leaf_tables_saved= true; + thd->lex->current_select->first_cond_optimization= 0; } my_ok(thd, 0); @@ -561,6 +563,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, { thd->lex->current_select->save_leaf_tables(thd); thd->lex->current_select->leaf_tables_saved= true; + thd->lex->current_select->first_cond_optimization= 0; } my_ok(thd, 0); @@ -941,6 +944,7 @@ cleanup: { thd->lex->current_select->save_leaf_tables(thd); thd->lex->current_select->leaf_tables_saved= true; + thd->lex->current_select->first_cond_optimization= 0; } delete deltempfile; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index a07df381075..0837449071d 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -3234,7 +3234,6 @@ pthread_handler_t handle_delayed_insert(void *arg) else { DBUG_ENTER("handle_delayed_insert"); - thd->thread_stack= (char*) &thd; if (init_thr_lock()) { thd->get_stmt_da()->set_error_status(ER_OUT_OF_RESOURCES); diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index bb3986f15fe..51a42106382 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -3662,7 +3662,7 @@ bool st_select_lex::setup_ref_array(THD *thd, uint order_group_num) return false; Item **array= static_cast( - thd->active_stmt_arena_to_use()->alloc(sizeof(Item*) * n_elems)); + thd->active_stmt_arena_to_use()->calloc(sizeof(Item*) * n_elems)); if (likely(array != NULL)) ref_pointer_array= Ref_ptr_array(array, n_elems); return array == NULL; diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 1fb69191670..3dfd1399f14 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -247,7 +247,7 @@ public: String &field_term,String &line_start,String &line_term, String &enclosed,int escape,bool get_it_from_net, bool is_fifo); ~READ_INFO(); - int read_field(); + int read_field(CHARSET_INFO *cs); int read_fixed_length(void); int next_line(void); char unescape(char chr); @@ -1134,7 +1134,15 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, { uint length; uchar *pos; - if (read_info.read_field()) + CHARSET_INFO *cs; + /* + Avoiding of handling binary data as a text + */ + if(item->charset_for_protocol() == &my_charset_bin) + cs= &my_charset_bin; + else + cs= read_info.charset(); + if (read_info.read_field(cs)) break; /* If this line is to be skipped we don't want to fill field or var */ @@ -1507,7 +1515,7 @@ inline bool READ_INFO::terminator(const uchar *ptr, uint length) must make sure to use escapes properly. */ -int READ_INFO::read_field() +int READ_INFO::read_field(CHARSET_INFO *cs) { int chr,found_enclosed_char; @@ -1543,7 +1551,7 @@ int READ_INFO::read_field() for (;;) { // Make sure we have enough space for the longest multi-byte character. - while (data.length() + charset()->mbmaxlen <= data.alloced_length()) + while (data.length() + cs->mbmaxlen <= data.alloced_length()) { chr = GET; if (chr == my_b_EOF) @@ -1629,7 +1637,7 @@ int READ_INFO::read_field() } } data.append(chr); - if (charset()->use_mb() && read_mbtail(&data)) + if (cs->use_mb() && read_mbtail(&data)) goto found_eof; } /* diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index b031ea1184a..bfb1720d077 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1004,7 +1004,6 @@ int bootstrap(MYSQL_FILE *file) #endif /* The following must be called before DBUG_ENTER */ - thd->thread_stack= (char*) &thd; thd->store_globals(); thd->security_ctx->user= (char*) my_strdup(key_memory_MPVIO_EXT_auth_info, @@ -7600,7 +7599,9 @@ check_stack_overrun(THD *thd, long margin, uchar *buf __attribute__((unused))) #ifndef __SANITIZE_ADDRESS__ long stack_used; DBUG_ASSERT(thd == current_thd); - if ((stack_used= available_stack_size(thd->thread_stack, &stack_used)) >= + DBUG_ASSERT(thd->thread_stack); + if ((stack_used= available_stack_size(thd->thread_stack, + my_get_stack_pointer(&stack_used))) >= (long) (my_thread_stack_size - margin)) { thd->is_fatal_error= 1; diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 6945941344b..605ffc36a3d 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1892,7 +1892,7 @@ static void plugin_load(MEM_ROOT *tmp_root) if (global_system_variables.log_warnings >= 9) sql_print_information("Initializing installed plugins"); - new_thd->thread_stack= (char*) &tables; + new_thd->thread_stack= (void*) &tables; // Big stack new_thd->store_globals(); new_thd->db= MYSQL_SCHEMA_NAME; bzero((char*) &new_thd->net, sizeof(new_thd->net)); diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 9ea89670625..9c8969b289e 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -6290,7 +6290,7 @@ loc_advanced_command(MYSQL *mysql, enum enum_server_command command, { THD *thd_orig= current_thd; set_current_thd(p->thd); - p->thd->thread_stack= (char*) &result; + p->thd->thread_stack= (void*) &result; // Big stack p->thd->set_time(); result= execute_server_code(p->thd, (const char *)arg, arg_length); p->thd->cleanup_after_query(); @@ -6470,7 +6470,6 @@ extern "C" MYSQL *mysql_real_connect_local(MYSQL *mysql) new_thd= new THD(0); local_connection_thread_count++; - new_thd->thread_stack= (char*) &thd_orig; new_thd->store_globals(); new_thd->security_ctx->skip_grants(); new_thd->query_cache_is_applicable= 0; diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc index 0a11b100c44..1a0141aa1a2 100644 --- a/sql/sql_reload.cc +++ b/sql/sql_reload.cc @@ -89,10 +89,7 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options, allocate temporary THD for execution of acl_reload()/grant_reload(). */ if (unlikely(!thd) && (thd= (tmp_thd= new THD(0)))) - { - thd->thread_stack= (char*) &tmp_thd; thd->store_globals(); - } if (likely(thd)) { diff --git a/sql/sql_select.cc b/sql/sql_select.cc index be18a0bc2ae..9b9ffa85b11 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8286,7 +8286,7 @@ best_access_path(JOIN *join, loose_scan_opt.check_ref_access_part1(s, key, start_key, found_part); /* Check if we found full key */ - const key_part_map all_key_parts= PREV_BITS(uint, key_parts); + const key_part_map all_key_parts= PREV_BITS(key_part_map, key_parts); if (found_part == all_key_parts && !ref_or_null_part) { /* use eq key */ max_key_part= (uint) ~0; @@ -8426,7 +8426,8 @@ best_access_path(JOIN *join, */ if ((found_part & 1) && (!(table->file->index_flags(key, 0, 0) & HA_ONLY_WHOLE_INDEX) || - found_part == PREV_BITS(uint,keyinfo->user_defined_key_parts))) + found_part == PREV_BITS(key_part_map, + keyinfo->user_defined_key_parts))) { max_key_part= max_part_bit(found_part); bool all_used_equalities_are_const; @@ -24801,7 +24802,7 @@ static int test_if_order_by_key(JOIN *join, if (have_pk_suffix && reverse == 0 && // all were =const so far key_parts == table->key_info[idx].ext_key_parts && - table->const_key_parts[pk] == PREV_BITS(uint, + table->const_key_parts[pk] == PREV_BITS(key_part_map, table->key_info[pk]. user_defined_key_parts)) { diff --git a/sql/sql_select.h b/sql/sql_select.h index 94a9acd9aee..6ecaf44c547 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -2584,4 +2584,15 @@ void propagate_new_equalities(THD *thd, Item *cond, COND_EQUAL *inherited, bool *is_simplifiable_cond); +template T prev_bits(T n_bits) +{ + if (!n_bits) + return 0; + T tmp= ((T)1 << (n_bits - 1)); + return (tmp - 1) | tmp; +} +// A wrapper for the above function: +#define PREV_BITS(type, A) prev_bits(A) + + #endif /* SQL_SELECT_INCLUDED */ diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc index b1d59aac984..273a22f9292 100644 --- a/sql/sql_sequence.cc +++ b/sql/sql_sequence.cc @@ -529,7 +529,30 @@ int SEQUENCE::read_initial_values(TABLE *table) /* - Do the actiual reading of data from sequence table and + This class is here to allow one to use import table space on sequences +*/ + +class Silence_table_space_errors : public Internal_error_handler +{ +public: + Silence_table_space_errors() {} + ~Silence_table_space_errors() override = default; + bool handle_condition(THD *thd, + uint sql_errno, + const char* sql_state, + Sql_condition::enum_warning_level *level, + const char* msg, + Sql_condition ** cond_hdl) override + { + if (sql_errno == ER_TABLESPACE_DISCARDED || HA_ERR_TABLESPACE_MISSING) + return true; // Silence it + return false; + } +}; + + +/* + Do the actual reading of data from sequence table and update values in the sequence object. Called once from when table is opened @@ -538,14 +561,21 @@ int SEQUENCE::read_initial_values(TABLE *table) int SEQUENCE::read_stored_values(TABLE *table) { int error; + Silence_table_space_errors error_handler; + THD *thd= table->in_use; DBUG_ENTER("SEQUENCE::read_stored_values"); + thd->push_internal_handler(&error_handler); + MY_BITMAP *save_read_set= tmp_use_all_columns(table, &table->read_set); error= table->file->ha_read_first_row(table->record[0], MAX_KEY); tmp_restore_column_map(&table->read_set, save_read_set); if (unlikely(error)) { + thd->pop_internal_handler(); + if (error == HA_ERR_TABLESPACE_MISSING && thd->tablespace_op) + DBUG_RETURN(0); // Ignore error for ALTER TABLESPACE table->file->print_error(error, MYF(0)); DBUG_RETURN(error); } @@ -553,6 +583,7 @@ int SEQUENCE::read_stored_values(TABLE *table) adjust_values(reserved_until); all_values_used= 0; + thd->pop_internal_handler(); DBUG_RETURN(0); } @@ -775,8 +806,9 @@ longlong SEQUENCE::next_value(TABLE *table, bool second_round, int *error) DBUG_RETURN(next_value(table, 1, error)); } - if (unlikely((*error= write(table, thd->variables.binlog_row_image != - BINLOG_ROW_IMAGE_MINIMAL)))) + if (unlikely((*error= write(table, + (thd->variables.binlog_row_image != + BINLOG_ROW_IMAGE_MINIMAL))))) { reserved_until= org_reserved_until; next_free_value= res_value; diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc index d63b0d66a5e..6e59feddc3b 100644 --- a/sql/sql_servers.cc +++ b/sql/sql_servers.cc @@ -251,7 +251,6 @@ bool servers_init(bool dont_read_servers_table) */ if (!(thd=new THD(0))) DBUG_RETURN(TRUE); - thd->thread_stack= (char*) &thd; thd->store_globals(); /* It is safe to call servers_reload() since servers_* arrays and hashes which diff --git a/sql/sql_show.cc b/sql/sql_show.cc index f323b42a84f..cb2d2d9eaaf 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1859,7 +1859,7 @@ static void add_table_options(THD *thd, TABLE *table, hton= table->part_info->default_engine_type; else #endif - hton= table->file->ht; + hton= table->file->storage_ht(); bzero((char*) &create_info, sizeof(create_info)); /* Allow update_create_info to update row type, page checksums and options */ diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 54be2f96cdc..45f737812e4 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2785,7 +2785,10 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, sql_field->offset= record_offset; if (MTYP_TYPENR(sql_field->unireg_check) == Field::NEXT_NUMBER) auto_increment++; - if (parse_option_list(thd, create_info->db_type, &sql_field->option_struct, + extend_option_list(thd, create_info->db_type, !sql_field->field, + &sql_field->option_list, + create_info->db_type->field_options); + if (parse_option_list(thd, &sql_field->option_struct, &sql_field->option_list, create_info->db_type->field_options, FALSE, thd->mem_root)) @@ -3061,7 +3064,9 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, key_info->usable_key_parts= key_number; key_info->algorithm= key->key_create_info.algorithm; key_info->option_list= key->option_list; - if (parse_option_list(thd, create_info->db_type, &key_info->option_struct, + extend_option_list(thd, create_info->db_type, !key->old, + &key_info->option_list, create_info->db_type->index_options); + if (parse_option_list(thd, &key_info->option_struct, &key_info->option_list, create_info->db_type->index_options, FALSE, thd->mem_root)) @@ -3653,10 +3658,12 @@ without_overlaps_err: push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_OPTION, ER_THD(thd, ER_UNKNOWN_OPTION), "transactional"); - if (parse_option_list(thd, file->partition_ht(), &create_info->option_struct, - &create_info->option_list, - file->partition_ht()->table_options, FALSE, - thd->mem_root)) + extend_option_list(thd, file->partition_ht(), + !thd->lex->create_like() && create_table_mode > C_ALTER_TABLE, + &create_info->option_list, file->partition_ht()->table_options); + if (parse_option_list(thd, &create_info->option_struct, + &create_info->option_list, + file->partition_ht()->table_options, FALSE, thd->mem_root)) DBUG_RETURN(TRUE); DBUG_EXECUTE_IF("key", @@ -11942,8 +11949,7 @@ bool check_engine(THD *thd, const char *db_name, { if (no_substitution) { - const char *engine_name= ha_resolve_storage_engine_name(req_engine); - my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), engine_name); + my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "NO_ENGINE_SUBSTITUTION"); DBUG_RETURN(TRUE); } *new_engine= enf_engine; diff --git a/sql/sql_table.h b/sql/sql_table.h index 19276aa4650..7f0c7eac377 100644 --- a/sql/sql_table.h +++ b/sql/sql_table.h @@ -121,9 +121,9 @@ bool add_keyword_to_query(THD *thd, String *result, const LEX_CSTRING *keyword, */ #define C_CREATE_SELECT(X) ((X) > 0 ? (X) : 0) #define C_ORDINARY_CREATE 0 -#define C_ALTER_TABLE -1 -#define C_ALTER_TABLE_FRM_ONLY -2 -#define C_ASSISTED_DISCOVERY -3 +#define C_ASSISTED_DISCOVERY -1 +#define C_ALTER_TABLE -2 +#define C_ALTER_TABLE_FRM_ONLY -3 int mysql_create_table_no_lock(THD *thd, DDL_LOG_STATE *ddl_log_state, diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index 02f068e9bbc..f5eab105335 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -179,7 +179,7 @@ void udf_init() DBUG_VOID_RETURN; } initialized = 1; - new_thd->thread_stack= (char*) &new_thd; + new_thd->thread_stack= (void*) &new_thd; // Big stack new_thd->store_globals(); new_thd->set_db(&MYSQL_SCHEMA_NAME); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 2103961f068..93743f2eabd 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -575,6 +575,7 @@ int mysql_update(THD *thd, { thd->lex->current_select->save_leaf_tables(thd); thd->lex->current_select->leaf_tables_saved= true; + thd->lex->current_select->first_cond_optimization= 0; } my_ok(thd); // No matching records @@ -612,6 +613,7 @@ int mysql_update(THD *thd, { thd->lex->current_select->save_leaf_tables(thd); thd->lex->current_select->leaf_tables_saved= true; + thd->lex->current_select->first_cond_optimization= 0; } my_ok(thd); // No matching records @@ -1392,6 +1394,7 @@ update_end: { thd->lex->current_select->save_leaf_tables(thd); thd->lex->current_select->leaf_tables_saved= true; + thd->lex->current_select->first_cond_optimization= 0; } *found_return= found; *updated_return= updated; diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc index 0e45c6757f1..407d73b0533 100644 --- a/sql/threadpool_common.cc +++ b/sql/threadpool_common.cc @@ -196,13 +196,13 @@ static void thread_attach(THD* thd) wsrep_wait_rollback_complete_and_acquire_ownership(thd); #endif /* WITH_WSREP */ set_mysys_var(thd->mysys_var); - thd->thread_stack=(char*)&thd; + const OS_thread_info *tinfo= get_os_thread_info(); + set_current_thd(thd); - auto tinfo= get_os_thread_info(); + my_get_stack_bounds(&thd->thread_stack, &thd->mysys_var->stack_ends_here, + (void*) &tinfo, my_thread_stack_size); thd->real_id= tinfo->self; thd->os_thread_id= tinfo->thread_id; - DBUG_ASSERT(thd->mysys_var == my_thread_var); - thd->mysys_var->stack_ends_here= thd->thread_stack + tinfo->stack_size; PSI_CALL_set_thread(thd->get_psi()); } diff --git a/sql/tztime.cc b/sql/tztime.cc index 0e9dcbbe6de..65fe8814c10 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -1621,7 +1621,7 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap) */ if (!(thd= new THD(0))) DBUG_RETURN(1); - thd->thread_stack= (char*) &thd; + thd->thread_stack= (void*) &thd; // Big stack thd->store_globals(); /* Init all memory structures that require explicit destruction */ diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 0c8fa2e7c0b..ea608c5d636 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -3701,7 +3701,6 @@ void* start_wsrep_THD(void *arg) (long long)thd->thread_id)); /* now that we've called my_thread_init(), it is safe to call DBUG_* */ - thd->thread_stack= (char*) &thd; wsrep_assign_from_threadvars(thd); wsrep_store_threadvars(thd); diff --git a/sql/wsrep_schema.cc b/sql/wsrep_schema.cc index 7910c6577cb..6afe1771667 100644 --- a/sql/wsrep_schema.cc +++ b/sql/wsrep_schema.cc @@ -710,7 +710,6 @@ int Wsrep_schema::init() WSREP_ERROR("Unable to get thd"); DBUG_RETURN(1); } - thd->thread_stack= (char*)&thd; wsrep_init_thd_for_schema(thd); if (Wsrep_schema_impl::execute_SQL(thd, create_cluster_table_str.c_str(), diff --git a/sql/wsrep_server_service.cc b/sql/wsrep_server_service.cc index 5717c5af997..08ed9bd366f 100644 --- a/sql/wsrep_server_service.cc +++ b/sql/wsrep_server_service.cc @@ -34,7 +34,7 @@ #include "sql_base.h" /* close_thread_tables */ #include "debug_sync.h" -static void init_service_thd(THD* thd, char* thread_stack) +static void init_service_thd(THD* thd, void* thread_stack) { thd->thread_stack= thread_stack; thd->real_id= pthread_self(); diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index c87ce785500..e0d4324a93b 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -740,7 +740,6 @@ err: unireg_abort(1); } - thd->thread_stack= (char*) &thd; thd->security_ctx->skip_grants(); thd->system_thread= SYSTEM_THREAD_GENERIC; thd->real_id= pthread_self(); diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc index ede2c906d5a..52c415e2bf4 100644 --- a/sql/wsrep_thd.cc +++ b/sql/wsrep_thd.cc @@ -162,7 +162,7 @@ static void wsrep_rollback_high_priority(THD *thd, THD *rollbacker) { WSREP_DEBUG("Rollbacker aborting SR applier thd (%llu %lu)", thd->thread_id, thd->real_id); - char* orig_thread_stack= thd->thread_stack; + void* orig_thread_stack= thd->thread_stack; thd->thread_stack= rollbacker->thread_stack; DBUG_ASSERT(thd->wsrep_cs().mode() == Wsrep_client_state::m_high_priority); /* Must be streaming and must have been removed from the @@ -193,7 +193,7 @@ static void wsrep_rollback_local(THD *thd, THD *rollbacker) { WSREP_DEBUG("Rollbacker aborting local thd (%llu %lu)", thd->thread_id, thd->real_id); - char* orig_thread_stack= thd->thread_stack; + void* orig_thread_stack= thd->thread_stack; thd->thread_stack= rollbacker->thread_stack; if (thd->wsrep_trx().is_streaming()) { diff --git a/sql/wsrep_utils.cc b/sql/wsrep_utils.cc index ecb88eae597..a8098b560e6 100644 --- a/sql/wsrep_utils.cc +++ b/sql/wsrep_utils.cc @@ -424,7 +424,6 @@ thd::thd (my_bool won, bool system_thread) : init(), ptr(new THD(0)) { if (ptr) { - ptr->thread_stack= (char*) &ptr; wsrep_assign_from_threadvars(ptr); wsrep_store_threadvars(ptr); ptr->variables.option_bits&= ~OPTION_BIN_LOG; // disable binlog diff --git a/storage/connect/tabfmt.cpp b/storage/connect/tabfmt.cpp index 05799cb3d87..443d5a9c87f 100644 --- a/storage/connect/tabfmt.cpp +++ b/storage/connect/tabfmt.cpp @@ -856,6 +856,7 @@ bool TDBCSV::SkipHeader(PGLOBAL g) int hlen = 0; bool q = Qot && Quoted > 0; PCOLDEF cdp; + char *pos, *end; // Estimate the length of the header list for (cdp = To_Def->GetCols(); cdp; cdp = cdp->GetNext()) { @@ -871,23 +872,26 @@ bool TDBCSV::SkipHeader(PGLOBAL g) // File is empty, write a header record memset(To_Line, 0, Lrecl); + pos= To_Line; + end= To_Line + Lrecl-1; // The column order in the file is given by the offset value for (i = 1; i <= n; i++) for (cdp = To_Def->GetCols(); cdp; cdp = cdp->GetNext()) if (cdp->GetOffset() == i) { - if (q) - To_Line[strlen(To_Line)] = Qot; + if (q && pos < end) + *pos++= Qot; - safe_strcat(To_Line, Lrecl, cdp->GetName()); + pos= strnmov(pos, cdp->GetName(), (size_t) (end-pos)); - if (q) - To_Line[strlen(To_Line)] = Qot; + if (q && pos < end) + *pos++= Qot; - if (i < n) - To_Line[strlen(To_Line)] = Sep; + if (i < n && pos < end) + *pos++= Sep; } // endif Offset + *pos= 0; rc = (Txfp->WriteBuffer(g) == RC_FX); } // endif !FileLength diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 65fe3255309..a4d50db2e52 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -1191,7 +1191,7 @@ err_exit: if (create_new_db) { - node->find_metadata(node->handle); + node->find_metadata(); continue; } if (skip_read) @@ -2079,7 +2079,7 @@ err_exit: FIL_TYPE_TABLESPACE, crypt_data, mode, true)) { fil_node_t* node = space->add(path, file, size, false, true); - IF_WIN(node->find_metadata(), node->find_metadata(file, true)); + node->find_metadata(IF_WIN(,true)); mysql_mutex_unlock(&fil_system.mutex); mtr.start(); mtr.set_named_space(space); diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index beb219d0046..c164956d9a0 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -6467,6 +6467,7 @@ prepare_inplace_alter_table_dict( dberr_t error = DB_SUCCESS; ulint num_fts_index; dict_add_v_col_t* add_v = NULL; + bool fts_instance_created = false; ha_innobase_inplace_ctx*ctx; DBUG_ENTER("prepare_inplace_alter_table_dict"); @@ -6738,6 +6739,7 @@ new_clustered_failed: {new_table_name, tablen + partlen}, nullptr, n_cols + n_v_cols, n_v_cols, flags, flags2); + fts_instance_created = (ctx->new_table->fts != nullptr); /* The rebuilt indexed_table will use the renamed column names. */ ctx->col_names = NULL; @@ -6931,6 +6933,7 @@ wrong_column_name: ctx->new_table->fts = fts_create( ctx->new_table); ctx->new_table->fts->doc_col = fts_doc_id_col; + fts_instance_created = true; } /* Check if we need to update mtypes of legacy GIS columns. @@ -7399,8 +7402,12 @@ error_handling_drop_uncached: goto error_handling; } - if (!ctx->new_table->fts - || ib_vector_size(ctx->new_table->fts->indexes) == 0) { + + /* If table rebuild happens or fulltext index are + being added when common tables doesn't exist then + do create new fulltext common tables else use the + existing fulltext common tables */ + if (fts_instance_created) { error = fts_create_common_tables( ctx->trx, ctx->new_table, true); @@ -7411,6 +7418,9 @@ error_handling_drop_uncached: if (error != DB_SUCCESS) { goto error_handling; } + } + + if (!ib_vector_size(ctx->new_table->fts->indexes)) { error = innobase_fts_load_stopword( ctx->new_table, ctx->trx, diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 7e000147b2f..ea99df56c2c 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -1135,14 +1135,8 @@ struct fil_node_t final @param no_lsn whether to skip the FIL_PAGE_LSN check @return whether the page was found valid */ bool read_page0(const byte *dpage, bool no_lsn) noexcept; - - /** Determine some file metadata when creating or reading the file. - @param file the file that is being created, or OS_FILE_CLOSED */ - void find_metadata(os_file_t file= OS_FILE_CLOSED -#ifndef _WIN32 - , bool create= false, struct stat *statbuf= nullptr -#endif - ); + /** Determine some file metadata when creating or reading the file. */ + void find_metadata(IF_WIN(,bool create= false)) noexcept; /** Close the file handle. */ void close(); diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index 9fd42ebf70f..2c4f05f5e01 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -864,35 +864,13 @@ os_file_get_size( const char* filename) MY_ATTRIBUTE((warn_unused_result)); -/** Gets a file size. -@param[in] file handle to a file -@return file size, or (os_offset_t) -1 on failure */ -os_offset_t -os_file_get_size( - os_file_t file) - MY_ATTRIBUTE((warn_unused_result)); - -/** Extend a file. - -On Windows, extending a file allocates blocks for the file, -unless the file is sparse. - -On Unix, we will extend the file with ftruncate(), if -file needs to be sparse. Otherwise posix_fallocate() is used -when available, and if not, binary zeroes are added to the end -of file. - -@param[in] name file name -@param[in] file file handle -@param[in] size desired file size -@param[in] sparse whether to create a sparse file (no preallocating) -@return whether the operation succeeded */ -bool -os_file_set_size( - const char* name, - os_file_t file, - os_offset_t size, - bool is_sparse = false) +/** Determine the logical size of a file. +This may change the current write position of the file to the end of the file. +(Not currently a problem; InnoDB typically uses positioned I/O.) +@param file handle to an open file +@return file size, in octets +@retval -1 on failure */ +os_offset_t os_file_get_size(os_file_t file) noexcept MY_ATTRIBUTE((warn_unused_result)); /** Truncates a file at its current position. @@ -1124,11 +1102,25 @@ If file is normal, file system allocates storage. @param[in] size size to preserve in bytes @return true if success */ bool -os_file_change_size_win32( +os_file_set_size( const char* pathname, os_file_t file, os_offset_t size); +inline bool +os_file_set_size(const char* name, os_file_t file, os_offset_t size, bool) +{ + return os_file_set_size(name, file, size); +} +#else +/** Extend a file by appending NUL. +@param[in] name file name +@param[in] file file handle +@param[in] size desired file size +@param[in] sparse whether to create a sparse file with ftruncate() +@return whether the operation succeeded */ +bool os_file_set_size(const char *name, os_file_t file, os_offset_t size, + bool is_sparse= false) noexcept; #endif /*_WIN32 */ /** Free storage space associated with a section of the file. diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index f7d5e4c5ad4..669570219e2 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -48,9 +48,6 @@ Created 10/21/1995 Heikki Tuuri #include "srv0start.h" #include "fil0fil.h" #include "fsp0fsp.h" -#ifdef HAVE_LINUX_UNISTD_H -#include "unistd.h" -#endif #include "buf0dblwr.h" #include @@ -72,10 +69,12 @@ Created 10/21/1995 Heikki Tuuri #endif #ifdef _WIN32 -#include +# include +#else +# include #endif -// my_test_if_atomic_write() , my_win_secattr() +// my_test_if_atomic_write(), my_win_file_secattr() #include #include @@ -1457,16 +1456,9 @@ bool os_file_close_func(os_file_t file) return false; } -/** Gets a file size. -@param[in] file handle to an open file -@return file size, or (os_offset_t) -1 on failure */ -os_offset_t -os_file_get_size(os_file_t file) +os_offset_t os_file_get_size(os_file_t file) noexcept { - struct stat statbuf; - if (fstat(file, &statbuf)) return os_offset_t(-1); - MSAN_STAT_WORKAROUND(&statbuf); - return statbuf.st_size; + return lseek(file, 0, SEEK_END); } /** Gets a file size. @@ -1605,6 +1597,110 @@ os_file_set_eof( return(!ftruncate(fileno(file), ftell(file))); } +bool os_file_set_size(const char *name, os_file_t file, os_offset_t size, + bool is_sparse) noexcept +{ + ut_ad(!(size & 4095)); + + if (is_sparse) { + bool success = !ftruncate(file, size); + if (!success) { + sql_print_error("InnoDB: ftruncate of file %s" + " to %llu bytes failed with error %d", + name, size, errno); + } + return success; + } + +# ifdef HAVE_POSIX_FALLOCATE + int err; + os_offset_t current_size; + do { + current_size = os_file_get_size(file); + if (current_size == os_offset_t(-1)) { + err = errno; + } else { + if (current_size >= size) { + return true; + } + current_size &= ~4095ULL; +# ifdef __linux__ + if (!fallocate(file, 0, current_size, + size - current_size)) { + err = 0; + break; + } + + err = errno; +# else + err = posix_fallocate(file, current_size, + size - current_size); +# endif + } + } while (err == EINTR + && srv_shutdown_state <= SRV_SHUTDOWN_INITIATED); + + switch (err) { + case 0: + return true; + default: + sql_print_error("InnoDB: preallocating %llu" + " bytes for file %s failed with error %d", + size, name, err); + /* fall through */ + case EINTR: + errno = err; + return false; + case EINVAL: + case EOPNOTSUPP: + /* fall back to the code below */ + break; + } +# else /* HAVE_POSIX_ALLOCATE */ + os_offset_t current_size = os_file_get_size(file); +# endif /* HAVE_POSIX_ALLOCATE */ + + current_size &= ~4095ULL; + + if (current_size >= size) { + return true; + } + + /* Write up to 1 megabyte at a time. */ + ulint buf_size = std::min(64, + ulint(size >> srv_page_size_shift)) + << srv_page_size_shift; + + /* Align the buffer for possible raw i/o */ + byte* buf = static_cast(aligned_malloc(buf_size, + srv_page_size)); + /* Write buffer full of zeros */ + memset(buf, 0, buf_size); + + while (current_size < size + && srv_shutdown_state <= SRV_SHUTDOWN_INITIATED) { + ulint n_bytes; + + if (size - current_size < (os_offset_t) buf_size) { + n_bytes = (ulint) (size - current_size); + } else { + n_bytes = buf_size; + } + + if (os_file_write(IORequestWrite, name, + file, buf, current_size, n_bytes) != + DB_SUCCESS) { + break; + } + + current_size += n_bytes; + } + + aligned_free(buf); + + return current_size >= size && os_file_flush(file); +} + #else /* !_WIN32 */ #include @@ -2474,21 +2570,12 @@ bool os_file_close_func(os_file_t file) return true; } -/** Gets a file size. -@param[in] file Handle to a file -@return file size, or (os_offset_t) -1 on failure */ -os_offset_t -os_file_get_size( - os_file_t file) +os_offset_t os_file_get_size(os_file_t file) noexcept { - DWORD high; - DWORD low = GetFileSize(file, &high); - - if (low == 0xFFFFFFFF && GetLastError() != NO_ERROR) { - return((os_offset_t) -1); - } - - return(os_offset_t(low | (os_offset_t(high) << 32))); + DWORD high, low= GetFileSize(file, &high); + if (low == 0xFFFFFFFF && GetLastError() != NO_ERROR) + return os_offset_t(-1); + return os_offset_t{low} | os_offset_t{high} << 32; } /** Gets a file size. @@ -2630,24 +2717,8 @@ bool os_file_set_sparse_win32(os_file_t file, bool is_sparse) FSCTL_SET_SPARSE, &sparse_buffer, sizeof(sparse_buffer), 0, 0,&temp); } - -/** -Change file size on Windows. - -If file is extended, the bytes between old and new EOF -are zeros. - -If file is sparse, "virtual" block is added at the end of -allocated area. - -If file is normal, file system allocates storage. - -@param[in] pathname file path -@param[in] file file handle -@param[in] size size to preserve in bytes -@return true if success */ bool -os_file_change_size_win32( +os_file_set_size( const char* pathname, os_file_t file, os_offset_t size) @@ -3068,163 +3139,6 @@ static bool os_is_sparse_file_supported(os_file_t fh) #endif /* _WIN32 */ } -/** Extend a file. - -On Windows, extending a file allocates blocks for the file, -unless the file is sparse. - -On Unix, we will extend the file with ftruncate(), if -file needs to be sparse. Otherwise posix_fallocate() is used -when available, and if not, binary zeroes are added to the end -of file. - -@param[in] name file name -@param[in] file file handle -@param[in] size desired file size -@param[in] sparse whether to create a sparse file (no preallocating) -@return whether the operation succeeded */ -bool -os_file_set_size( - const char* name, - os_file_t file, - os_offset_t size, - bool is_sparse) -{ - ut_ad(!(size & 4095)); - -#ifdef _WIN32 - /* On Windows, changing file size works well and as expected for both - sparse and normal files. - - However, 10.2 up until 10.2.9 made every file sparse in innodb, - causing NTFS fragmentation issues(MDEV-13941). We try to undo - the damage, and unsparse the file.*/ - - if (!is_sparse && os_is_sparse_file_supported(file)) { - if (!os_file_set_sparse_win32(file, false)) - /* Unsparsing file failed. Fallback to writing binary - zeros, to avoid even higher fragmentation.*/ - goto fallback; - } - - return os_file_change_size_win32(name, file, size); - -fallback: -#else - struct stat statbuf; - - if (is_sparse) { - bool success = !ftruncate(file, size); - if (!success) { - ib::error() << "ftruncate of file " << name << " to " - << size << " bytes failed with error " - << errno; - } - return(success); - } - -# ifdef HAVE_POSIX_FALLOCATE - int err; - do { - if (fstat(file, &statbuf)) { - err = errno; - } else { - MSAN_STAT_WORKAROUND(&statbuf); - os_offset_t current_size = statbuf.st_size; - if (current_size >= size) { - return true; - } - current_size &= ~4095ULL; -# ifdef __linux__ - if (!fallocate(file, 0, current_size, - size - current_size)) { - err = 0; - break; - } - - err = errno; -# else - err = posix_fallocate(file, current_size, - size - current_size); -# endif - } - } while (err == EINTR - && srv_shutdown_state <= SRV_SHUTDOWN_INITIATED); - - switch (err) { - case 0: - return true; - default: - ib::error() << "preallocating " - << size << " bytes for file " << name - << " failed with error " << err; - /* fall through */ - case EINTR: - errno = err; - return false; - case EINVAL: - case EOPNOTSUPP: - /* fall back to the code below */ - break; - } -# endif /* HAVE_POSIX_ALLOCATE */ -#endif /* _WIN32*/ - -#ifdef _WIN32 - os_offset_t current_size = os_file_get_size(file); - FILE_STORAGE_INFO info; - if (GetFileInformationByHandleEx(file, FileStorageInfo, &info, - sizeof info)) { - if (info.LogicalBytesPerSector) { - current_size &= ~os_offset_t(info.LogicalBytesPerSector - - 1); - } - } -#else - if (fstat(file, &statbuf)) { - return false; - } - os_offset_t current_size = statbuf.st_size & ~4095ULL; -#endif - if (current_size >= size) { - return true; - } - - /* Write up to 1 megabyte at a time. */ - ulint buf_size = ut_min(ulint(64), - ulint(size >> srv_page_size_shift)) - << srv_page_size_shift; - - /* Align the buffer for possible raw i/o */ - byte* buf = static_cast(aligned_malloc(buf_size, - srv_page_size)); - /* Write buffer full of zeros */ - memset(buf, 0, buf_size); - - while (current_size < size - && srv_shutdown_state <= SRV_SHUTDOWN_INITIATED) { - ulint n_bytes; - - if (size - current_size < (os_offset_t) buf_size) { - n_bytes = (ulint) (size - current_size); - } else { - n_bytes = buf_size; - } - - if (os_file_write(IORequestWrite, name, - file, buf, current_size, n_bytes) != - DB_SUCCESS) { - break; - } - - current_size += n_bytes; - } - - aligned_free(buf); - - return(current_size >= size && os_file_flush(file)); -} - /** Truncate a file to a specified size in bytes. @param[in] pathname file path @param[in] file file to be truncated @@ -3249,7 +3163,7 @@ os_file_truncate( } #ifdef _WIN32 - return(os_file_change_size_win32(pathname, file, size)); + return os_file_set_size(pathname, file, size); #else /* _WIN32 */ return(os_file_truncate_posix(pathname, file, size)); #endif /* _WIN32 */ @@ -4022,17 +3936,10 @@ static bool is_file_on_ssd(HANDLE handle, char *file_path) #endif -void fil_node_t::find_metadata(os_file_t file -#ifndef _WIN32 - , bool create, struct stat *statbuf -#endif - ) +void fil_node_t::find_metadata(IF_WIN(,bool create)) noexcept { - if (!is_open()) - { - handle= file; - ut_ad(is_open()); - } + ut_ad(is_open()); + os_file_t file= handle; if (!space->is_compressed()) punch_hole= 0; @@ -4048,33 +3955,40 @@ void fil_node_t::find_metadata(os_file_t file block_size= info.PhysicalBytesPerSectorForAtomicity; else block_size= 512; -#else - struct stat sbuf; - if (!statbuf && !fstat(file, &sbuf)) - { - MSAN_STAT_WORKAROUND(&sbuf); - statbuf= &sbuf; - } - if (statbuf) - block_size= statbuf->st_blksize; -# ifdef __linux__ - on_ssd= statbuf && fil_system.is_ssd(statbuf->st_dev); -# endif -#endif - if (space->purpose != FIL_TYPE_TABLESPACE) { /* For temporary tablespace or during IMPORT TABLESPACE, we disable neighbour flushing and do not care about atomicity. */ on_ssd= true; atomic_write= true; + return; } - else - /* On Windows, all single sector writes are atomic, as per - WriteFile() documentation on MSDN. */ - atomic_write= srv_use_atomic_writes && - IF_WIN(srv_page_size == block_size, - my_test_if_atomic_write(file, space->physical_size())); +#else + if (space->purpose != FIL_TYPE_TABLESPACE) + { + /* For temporary tablespace or during IMPORT TABLESPACE, we + disable neighbour flushing and do not care about atomicity. */ + on_ssd= true; + atomic_write= true; + if (space->purpose == FIL_TYPE_TEMPORARY || !space->is_compressed()) + return; + } + struct stat statbuf; + if (!fstat(file, &statbuf)) + { + MSAN_STAT_WORKAROUND(&statbuf); + block_size= statbuf.st_blksize; +# ifdef __linux__ + on_ssd= fil_system.is_ssd(statbuf.st_dev); +# endif + } +#endif + + /* On Windows, all single sector writes are atomic, as per + WriteFile() documentation on MSDN. */ + atomic_write= srv_use_atomic_writes && + IF_WIN(srv_page_size == block_size, + my_test_if_atomic_write(file, space->physical_size())); } /** Read the first page of a data file. @@ -4084,16 +3998,9 @@ bool fil_node_t::read_page0(const byte *dpage, bool no_lsn) noexcept mysql_mutex_assert_owner(&fil_system.mutex); ut_ad(!dpage || no_lsn); const unsigned psize= space->physical_size(); -#ifndef _WIN32 - struct stat statbuf; - if (fstat(handle, &statbuf)) - return false; - MSAN_STAT_WORKAROUND(&statbuf); - os_offset_t size_bytes= statbuf.st_size; -#else os_offset_t size_bytes= os_file_get_size(handle); - ut_a(size_bytes != (os_offset_t) -1); -#endif + if (size_bytes == os_offset_t(-1)) + return false; const uint32_t min_size= FIL_IBD_FILE_INITIAL_SIZE * psize; if (size_bytes < min_size) @@ -4202,7 +4109,7 @@ bool fil_node_t::read_page0(const byte *dpage, bool no_lsn) noexcept space->free_len= free_len; } - IF_WIN(find_metadata(), find_metadata(handle, false, &statbuf)); + find_metadata(); /* Truncate the size to a multiple of extent size. */ ulint mask= psize * FSP_EXTENT_SIZE - 1; diff --git a/storage/innobase/row/row0row.cc b/storage/innobase/row/row0row.cc index 1e3c61f3cf3..29aa31a3374 100644 --- a/storage/innobase/row/row0row.cc +++ b/storage/innobase/row/row0row.cc @@ -250,6 +250,14 @@ row_build_index_entry_low( dict_col_copy_type(f.col, &dfield->type); if (f.col->is_nullable()) { dfield_set_null(dfield); + if (f.col->mtype == DATA_BINARY + && !dict_table_is_comp(index->table)) { + /* In case of redundant row format, + if the non-fixed dropped column + is null then set the length of the + field data type as 0 */ + dfield->type.len= 0; + } } else { dfield_set_data(dfield, field_ref_zero, f.fixed_len); diff --git a/unittest/mysys/CMakeLists.txt b/unittest/mysys/CMakeLists.txt index 9dd5e5dbd9c..e35f9d72062 100644 --- a/unittest/mysys/CMakeLists.txt +++ b/unittest/mysys/CMakeLists.txt @@ -15,7 +15,7 @@ MY_ADD_TESTS(bitmap base64 my_atomic my_rdtsc lf my_malloc my_getopt dynstring byte_order - queues stacktrace crc32 LINK_LIBRARIES mysys) + queues stacktrace stack_allocation crc32 LINK_LIBRARIES mysys) MY_ADD_TESTS(my_vsnprintf LINK_LIBRARIES strings mysys) MY_ADD_TESTS(aes LINK_LIBRARIES mysys mysys_ssl) ADD_DEFINITIONS(${SSL_DEFINES}) diff --git a/unittest/mysys/stack_allocation-t.c b/unittest/mysys/stack_allocation-t.c new file mode 100644 index 00000000000..2b044c80f42 --- /dev/null +++ b/unittest/mysys/stack_allocation-t.c @@ -0,0 +1,120 @@ +/* Copyright (c) 2024, MariaDB Corporation. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ + +#include +#include +#include +#include +#include +#include + +/* + Test of stack detection + The test is run with a stacks of STACK_ALLOC_SMALL_BLOCK_SIZE+1 and + STACK_ALLOC_SMALL_BLOCK_SIZE-1. + This is becasue of the function alloc_on_stack() has + different limits of how much it will allocate from the stack + based on the allocation size. +*/ + +/* + Common stack size in MariaDB. Cannot be bigger than system default + stack (common is 8M) +*/ +size_t my_stack_size= 299008; +size_t stack_allocation_total= 0; +extern long call_counter; +long call_counter; + +ATTRIBUTE_NOINLINE +int test_stack(void *stack_start, void *stack_end, int iteration, size_t stack_allocation) +{ + void *res, *stack; + my_bool must_be_freed; + + stack= my_get_stack_pointer(&must_be_freed); + if (stack_start < stack_end) + { + if (stack < stack_start || stack > stack_end) + return 1; + } + else + { + if (stack < stack_end || stack > stack_start) + return 1; + } + alloc_on_stack(stack_end, res, must_be_freed, stack_allocation); + bfill(res, stack_allocation, (char) iteration); + if (!must_be_freed) + { + stack_allocation_total+= stack_allocation; + test_stack(stack_start, stack_end, iteration+1, stack_allocation); + } + else + my_free(res); /* Was allocated with my_malloc */ + call_counter++; /* Avoid tail recursion optimization */ + return 0; +} + +void test_stack_detection(int stage, size_t stack_allocation) +{ + void *stack_start, *stack_end; + int res; + my_get_stack_bounds(&stack_start, &stack_end, + (void*) &stack_start, my_stack_size); + stack_allocation_total= 0; + res= test_stack(stack_start, stack_end, 1, stack_allocation); + if (!res) + ok(1, "%llu bytes allocated on stack of size %ld with %lu alloc size", + (unsigned long long) stack_allocation_total, + (long) available_stack_size(stack_start, stack_end), + (unsigned long) stack_allocation); + else + ok(0, "stack checking failed"); +} + +pthread_handler_t thread_stack_check(void *arg __attribute__((unused))) +{ + my_thread_init(); + test_stack_detection(1, STACK_ALLOC_SMALL_BLOCK_SIZE-1); + test_stack_detection(2, STACK_ALLOC_SMALL_BLOCK_SIZE+1); + my_thread_end(); + pthread_exit(0); + return 0; +} + +int main(int argc __attribute__((unused)), char **argv) +{ + pthread_attr_t thr_attr; + pthread_t check_thread; + void *value; + + MY_INIT(argv[0]); + + plan(4); + test_stack_detection(3, STACK_ALLOC_SMALL_BLOCK_SIZE-1); + test_stack_detection(4, STACK_ALLOC_SMALL_BLOCK_SIZE+1); + + /* Create a thread and run the same test */ + (void) pthread_attr_init(&thr_attr); + pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_SYSTEM); + (void) my_setstacksize(&thr_attr, my_stack_size); + pthread_create(&check_thread, &thr_attr, thread_stack_check, 0); + pthread_join(check_thread, &value); + (void) pthread_attr_destroy(&thr_attr); + + my_end(0); + return exit_status(); +} diff --git a/wsrep-lib b/wsrep-lib index 31db8476768..1c61b809d1e 160000 --- a/wsrep-lib +++ b/wsrep-lib @@ -1 +1 @@ -Subproject commit 31db8476768ba68296ad91b6785bb06a6a9abf71 +Subproject commit 1c61b809d1e1d03771dcad689d3a084e17c6b6c3