diff options
165 files changed, 3364 insertions, 1399 deletions
diff --git a/.gitattributes b/.gitattributes index 2e238207619..b62a174c5e5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12,12 +12,16 @@ # These files should be checked out as is *.result -text -whitespace +*.dat -text -whitespace + storage/connect/mysql-test/connect/std_data/*.txt -text -storage/connect/mysql-test/connect/std_data/*.dat -text # Denote all files that are truly binary and should not be modified. *.png binary *.jpg binary +*.frm binary +*.MYD binary +*.MYI binary *.c diff=cpp *.h diff=cpp diff --git a/.gitignore b/.gitignore index e7871c66357..fc2d98c9be2 100644 --- a/.gitignore +++ b/.gitignore @@ -175,7 +175,6 @@ storage/tokudb/ft-index/ft/log_print.cc storage/tokudb/ft-index/ft/logformat storage/tokudb/ft-index/ft/ftverify storage/tokudb/ft-index/ft/tdb-recover -storage/tokudb/ft-index/ft/tdb_logprint storage/tokudb/ft-index/ft/tokuftdump storage/tokudb/ft-index/portability/merge_archives_tokuportability_static.cmake storage/tokudb/ft-index/portability/toku_config.h @@ -186,11 +185,11 @@ storage/tokudb/ft-index/toku_include/toku_config.h storage/tokudb/ft-index/tools/ba_replay storage/tokudb/ft-index/tools/ftverify storage/tokudb/ft-index/tools/tdb-recover -storage/tokudb/ft-index/tools/tdb_logprint storage/tokudb/ft-index/tools/tokudb_dump storage/tokudb/ft-index/tools/tokudb_gen storage/tokudb/ft-index/tools/tokudb_load storage/tokudb/ft-index/tools/tokuftdump +storage/tokudb/ft-index/tools/tokuft_logprint storage/tokudb/ft-index/xz/ support-files/MySQL-shared-compat.spec support-files/binary-configure diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 7ec2812d233..ead4127dad6 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -54,6 +54,7 @@ static char *opt_plugin_dir= 0, *opt_default_auth= 0; static int first_error = 0; static char *opt_skip_database; DYNAMIC_ARRAY tables4repair, tables4rebuild, alter_table_cmds; +DYNAMIC_ARRAY views4repair; static char *shared_memory_base_name=0; static uint opt_protocol=0; @@ -877,11 +878,19 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view) switch (what_to_do) { case DO_CHECK: op = "CHECK"; - if (opt_quick) end = strmov(end, " QUICK"); - if (opt_fast) end = strmov(end, " FAST"); - if (opt_medium_check) end = strmov(end, " MEDIUM"); /* Default */ - if (opt_extended) end = strmov(end, " EXTENDED"); - if (opt_check_only_changed) end = strmov(end, " CHANGED"); + if (view) + { + if (opt_fast || opt_check_only_changed) + DBUG_RETURN(0); + } + else + { + if (opt_quick) end = strmov(end, " QUICK"); + if (opt_fast) end = strmov(end, " FAST"); + if (opt_extended) end = strmov(end, " EXTENDED"); + if (opt_medium_check) end = strmov(end, " MEDIUM"); /* Default */ + if (opt_check_only_changed) end = strmov(end, " CHANGED"); + } if (opt_upgrade) end = strmov(end, " FOR UPGRADE"); break; case DO_REPAIR: @@ -966,6 +975,7 @@ static void print_result() uint length_of_db; uint i; my_bool found_error=0, table_rebuild=0; + DYNAMIC_ARRAY *array4repair= &tables4repair; DBUG_ENTER("print_result"); res = mysql_use_result(sock); @@ -1002,9 +1012,10 @@ static void print_result() else { char *table_name= prev + (length_of_db+1); - insert_dynamic(&tables4repair, table_name); + insert_dynamic(array4repair, table_name); } } + array4repair= &tables4repair; found_error=0; table_rebuild=0; prev_alter[0]= 0; @@ -1020,8 +1031,11 @@ static void print_result() we have to run upgrade on it. In this case we write a nicer message than "Please do "REPAIR TABLE""... */ - if (!strcmp(row[2],"error") && strstr(row[3],"REPAIR TABLE")) + if (!strcmp(row[2],"error") && strstr(row[3],"REPAIR ")) + { printf("%-50s %s", row[0], "Needs upgrade"); + array4repair= strstr(row[3], "VIEW") ? &views4repair : &tables4repair; + } else printf("%s\n%-9s: %s", row[0], row[2], row[3]); if (opt_auto_repair && strcmp(row[2],"note")) @@ -1052,7 +1066,7 @@ static void print_result() else { char *table_name= prev + (length_of_db+1); - insert_dynamic(&tables4repair, table_name); + insert_dynamic(array4repair, table_name); } } mysql_free_result(res); @@ -1172,6 +1186,8 @@ int main(int argc, char **argv) if (opt_auto_repair && (my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16, 64, MYF(0)) || + my_init_dynamic_array(&views4repair, sizeof(char)*(NAME_LEN*2+2),16, + 64, MYF(0)) || my_init_dynamic_array(&tables4rebuild, sizeof(char)*(NAME_LEN*2+2),16, 64, MYF(0)) || my_init_dynamic_array(&alter_table_cmds, MAX_ALTER_STR_SIZE, 0, 1, @@ -1202,6 +1218,13 @@ int main(int argc, char **argv) rebuild_table((char*) dynamic_array_ptr(&tables4rebuild, i)); for (i = 0; i < alter_table_cmds.elements ; i++) run_query((char*) dynamic_array_ptr(&alter_table_cmds, i), 1); + if (!opt_silent && views4repair.elements) + puts("\nRepairing views"); + for (i = 0; i < views4repair.elements ; i++) + { + char *name= (char*) dynamic_array_ptr(&views4repair, i); + handle_request_for_tables(name, fixed_name_length(name), TRUE); + } } ret= MY_TEST(first_error); @@ -1209,8 +1232,10 @@ int main(int argc, char **argv) dbDisconnect(current_host); if (opt_auto_repair) { + delete_dynamic(&views4repair); delete_dynamic(&tables4repair); delete_dynamic(&tables4rebuild); + delete_dynamic(&alter_table_cmds); } end1: my_free(opt_password); diff --git a/cmake/do_abi_check.cmake b/cmake/do_abi_check.cmake index c831aaf8b52..c0ffce353f3 100644 --- a/cmake/do_abi_check.cmake +++ b/cmake/do_abi_check.cmake @@ -58,7 +58,7 @@ FOREACH(file ${ABI_HEADERS}) EXECUTE_PROCESS( COMMAND ${COMPILER} - -E -nostdinc -dI -DMYSQL_ABI_CHECK -I${SOURCE_DIR}/include + -E -nostdinc -DMYSQL_ABI_CHECK -I${SOURCE_DIR}/include -I${BINARY_DIR}/include -I${SOURCE_DIR}/include/mysql -I${SOURCE_DIR}/sql ${file} ERROR_QUIET OUTPUT_FILE ${tmpfile}) diff --git a/cmake/make_dist.cmake.in b/cmake/make_dist.cmake.in index c561baaa415..f35d16834b6 100644 --- a/cmake/make_dist.cmake.in +++ b/cmake/make_dist.cmake.in @@ -1,4 +1,4 @@ -# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2015, Oracle and/or its affiliates. # # 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 @@ -60,9 +60,9 @@ IF(NOT GIT_EXECUTABLE) # Save bison output first. CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.cc - ${CMAKE_BINARY_DIR}/sql_yacc.cc COPY_ONLY) + ${CMAKE_BINARY_DIR}/sql_yacc.cc COPYONLY) CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.h - ${CMAKE_BINARY_DIR}/sql_yacc.h COPY_ONLY) + ${CMAKE_BINARY_DIR}/sql_yacc.h COPYONLY) IF(CMAKE_GENERATOR MATCHES "Makefiles") # make clean @@ -74,9 +74,9 @@ IF(NOT GIT_EXECUTABLE) # Restore bison output CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql_yacc.cc - ${CMAKE_BINARY_DIR}/sql/sql_yacc.cc COPY_ONLY) + ${CMAKE_BINARY_DIR}/sql/sql_yacc.cc COPYONLY) CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql_yacc.h - ${CMAKE_BINARY_DIR}/sql/sql_yacc.h COPY_ONLY) + ${CMAKE_BINARY_DIR}/sql/sql_yacc.h COPYONLY) FILE(REMOVE ${CMAKE_BINARY_DIR}/sql_yacc.cc) FILE(REMOVE ${CMAKE_BINARY_DIR}/sql_yacc.h) ENDIF() diff --git a/cmd-line-utils/libedit/el_terminal.h b/cmd-line-utils/libedit/el_terminal.h index 807c651783e..db0bb94fa93 100644 --- a/cmd-line-utils/libedit/el_terminal.h +++ b/cmd-line-utils/libedit/el_terminal.h @@ -1,7 +1,7 @@ /* $NetBSD: terminal.h,v 1.3 2011/07/29 23:44:45 christos Exp $ */ /*- - * Copyright (c) 1992, 1993 + * Copyright (c) 1992, 2015 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by @@ -103,7 +103,7 @@ protected int terminal_settc(EditLine *, int, const Char **); protected int terminal_gettc(EditLine *, int, char **); protected int terminal_telltc(EditLine *, int, const Char **); protected int terminal_echotc(EditLine *, int, const Char **); -protected void terminal_writec(EditLine *, Int); +protected int terminal_writec(EditLine *, Int); protected int terminal__putc(EditLine *, Int); protected void terminal__flush(EditLine *); diff --git a/cmd-line-utils/libedit/emacs.c b/cmd-line-utils/libedit/emacs.c index 554d3970485..1f1033a1cb7 100644 --- a/cmd-line-utils/libedit/emacs.c +++ b/cmd-line-utils/libedit/emacs.c @@ -1,7 +1,7 @@ /* $NetBSD: emacs.c,v 1.25 2011/07/29 15:16:33 christos Exp $ */ /*- - * Copyright (c) 1992, 1993 + * Copyright (c) 1992, 2015 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by @@ -58,8 +58,10 @@ em_delete_or_list(EditLine *el, Int c) /* if I'm at the end */ if (el->el_line.cursor == el->el_line.buffer) { /* and the beginning */ - terminal_writec(el, c); /* then do an EOF */ - return CC_EOF; + if(!(terminal_writec(el, c))) /* then do an EOF */ + return CC_EOF; + else + return CC_ERROR; } else { /* * Here we could list completions, but it is an diff --git a/cmd-line-utils/libedit/terminal.c b/cmd-line-utils/libedit/terminal.c index fb5600a4140..18b789a8bea 100644 --- a/cmd-line-utils/libedit/terminal.c +++ b/cmd-line-utils/libedit/terminal.c @@ -1,7 +1,7 @@ /* $NetBSD: terminal.c,v 1.10 2011/10/04 15:27:04 christos Exp $ */ /*- - * Copyright (c) 1992, 1993 + * Copyright (c) 1992, 2015 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by @@ -1271,14 +1271,19 @@ terminal__flush(EditLine *el) /* terminal_writec(): * Write the given character out, in a human readable form */ -protected void +protected int terminal_writec(EditLine *el, Int c) { Char visbuf[VISUAL_WIDTH_MAX +1]; ssize_t vcnt = ct_visual_char(visbuf, VISUAL_WIDTH_MAX, c); - visbuf[vcnt] = '\0'; - terminal_overwrite(el, visbuf, (size_t)vcnt); - terminal__flush(el); + if(vcnt == -1) + return 1; /* Error due to insufficient space */ + else { + visbuf[vcnt] = '\0'; + terminal_overwrite(el, visbuf, (size_t)vcnt); + terminal__flush(el); + return 0; + } } diff --git a/cmd-line-utils/libedit/vi.c b/cmd-line-utils/libedit/vi.c index 9a4b97a977e..41242030a98 100644 --- a/cmd-line-utils/libedit/vi.c +++ b/cmd-line-utils/libedit/vi.c @@ -1,7 +1,7 @@ /* $NetBSD: vi.c,v 1.41 2011/10/04 15:27:04 christos Exp $ */ /*- - * Copyright (c) 1992, 1993 + * Copyright (c) 1992, 2015 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by @@ -607,8 +607,10 @@ vi_list_or_eof(EditLine *el, Int c) if (el->el_line.cursor == el->el_line.lastchar) { if (el->el_line.cursor == el->el_line.buffer) { - terminal_writec(el, c); /* then do a EOF */ - return CC_EOF; + if(!(terminal_writec(el, c))) /* then do a EOF */ + return CC_EOF; + else + return CC_ERROR; } else { /* * Here we could list completions, but it is an diff --git a/config.h.cmake b/config.h.cmake index 6a0527719f9..9651a833a57 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -202,7 +202,7 @@ #cmakedefine HAVE_MADVISE 1 #cmakedefine HAVE_DECL_MADVISE 1 #cmakedefine HAVE_DECL_TGOTO 1 -#cmakedefine HAVE_DECL_MHA_MAPSIZE_VA +#cmakedefine HAVE_DECL_MHA_MAPSIZE_VA 1 #cmakedefine HAVE_MALLINFO 1 #cmakedefine HAVE_MEMCPY 1 #cmakedefine HAVE_MEMMOVE 1 @@ -395,7 +395,7 @@ #cmakedefine SOCKET_SIZE_TYPE @SOCKET_SIZE_TYPE@ -#cmakedefine HAVE_MBSTATE_T +#cmakedefine HAVE_MBSTATE_T 1 #define MAX_INDEXES 64 @@ -430,15 +430,15 @@ #cmakedefine HAVE_WCTYPE_H 1 #cmakedefine HAVE_WCHAR_H 1 #cmakedefine HAVE_LANGINFO_H 1 -#cmakedefine HAVE_MBRLEN -#cmakedefine HAVE_MBSCMP -#cmakedefine HAVE_MBSRTOWCS -#cmakedefine HAVE_WCRTOMB -#cmakedefine HAVE_MBRTOWC -#cmakedefine HAVE_WCSCOLL -#cmakedefine HAVE_WCSDUP -#cmakedefine HAVE_WCWIDTH -#cmakedefine HAVE_WCTYPE +#cmakedefine HAVE_MBRLEN 1 +#cmakedefine HAVE_MBSCMP 1 +#cmakedefine HAVE_MBSRTOWCS 1 +#cmakedefine HAVE_WCRTOMB 1 +#cmakedefine HAVE_MBRTOWC 1 +#cmakedefine HAVE_WCSCOLL 1 +#cmakedefine HAVE_WCSDUP 1 +#cmakedefine HAVE_WCWIDTH 1 +#cmakedefine HAVE_WCTYPE 1 #cmakedefine HAVE_ISWLOWER 1 #cmakedefine HAVE_ISWUPPER 1 #cmakedefine HAVE_TOWLOWER 1 @@ -452,7 +452,7 @@ #cmakedefine HAVE_STRCASECMP 1 #cmakedefine HAVE_STRNCASECMP 1 #cmakedefine HAVE_STRDUP 1 -#cmakedefine HAVE_LANGINFO_CODESET +#cmakedefine HAVE_LANGINFO_CODESET 1 #cmakedefine HAVE_TCGETATTR 1 #cmakedefine HAVE_FLOCKFILE 1 diff --git a/debian/dist/Debian/control b/debian/dist/Debian/control index ffede25ccc4..8c236dae897 100644 --- a/debian/dist/Debian/control +++ b/debian/dist/Debian/control @@ -4,7 +4,12 @@ Priority: optional Maintainer: MariaDB Developers <maria-developers@lists.launchpad.net> XSBC-Original-Maintainer: Maria Developers <maria-developers@lists.launchpad.net> Uploaders: MariaDB Developers <maria-developers@lists.launchpad.net> -Build-Depends: libtool (>= 1.4.2-7), procps | hurd, debhelper, file (>= 3.28), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath, automake1.9, doxygen, texlive-latex-base, ghostscript | gs-gpl, dpatch, gawk, bison, lsb-release, hardening-wrapper, ${CMAKE_DEP}libaio-dev, libjemalloc-dev (>= 3.0.0) +Build-Depends: procps | hurd, debhelper, libncurses5-dev (>= 5.0-6), + perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), + zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, + libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath, + dpatch, gawk, bison, lsb-release, hardening-wrapper, + ${CMAKE_DEP}libaio-dev, libjemalloc-dev (>= 3.0.0) Standards-Version: 3.8.3 Homepage: http://mariadb.org/ Vcs-Browser: http://bazaar.launchpad.net/~maria-captains/maria/10.0/files diff --git a/debian/dist/Ubuntu/control b/debian/dist/Ubuntu/control index 02ace29b67b..37c1fc29e00 100644 --- a/debian/dist/Ubuntu/control +++ b/debian/dist/Ubuntu/control @@ -4,7 +4,12 @@ Priority: optional Maintainer: MariaDB Developers <maria-developers@lists.launchpad.net> XSBC-Original-Maintainer: Maria Developers <maria-developers@lists.launchpad.net> Uploaders: MariaDB Developers <maria-developers@lists.launchpad.net> -Build-Depends: libtool (>= 1.4.2-7), procps | hurd, debhelper, file (>= 3.28), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath, automake1.9, doxygen, texlive-latex-base, ghostscript | gs-gpl, dpatch, gawk, bison, lsb-release, hardening-wrapper, ${CMAKE_DEP}libaio-dev, libjemalloc-dev (>= 3.0.0) +Build-Depends: procps | hurd, debhelper, libncurses5-dev (>= 5.0-6), + perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), + zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, + libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath, + dpatch, gawk, bison, lsb-release, hardening-wrapper, + ${CMAKE_DEP}libaio-dev, libjemalloc-dev (>= 3.0.0) Standards-Version: 3.8.2 Homepage: http://mariadb.org/ Vcs-Browser: http://bazaar.launchpad.net/~maria-captains/maria/10.0/files diff --git a/include/mysql.h.pp b/include/mysql.h.pp index f2c040b694c..2c8e47b454f 100644 --- a/include/mysql.h.pp +++ b/include/mysql.h.pp @@ -1,7 +1,5 @@ typedef char my_bool; typedef int my_socket; -#include "mysql_version.h" -#include "mysql_com.h" enum enum_server_command { COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST, @@ -145,7 +143,6 @@ void get_tty_password_buff(const char *opt_message, char *to, size_t length); const char *mysql_errno_to_sqlstate(unsigned int mysql_errno); my_bool my_thread_init(void); void my_thread_end(void); -#include "mysql_time.h" typedef long my_time_t; enum enum_mysql_timestamp_type { @@ -159,7 +156,6 @@ typedef struct st_mysql_time my_bool neg; enum enum_mysql_timestamp_type time_type; } MYSQL_TIME; -#include "my_list.h" typedef struct st_list { struct st_list *prev,*next; void *data; @@ -201,8 +197,6 @@ typedef struct st_mysql_field { typedef char **MYSQL_ROW; typedef unsigned int MYSQL_FIELD_OFFSET; typedef unsigned long long my_ulonglong; -#include "typelib.h" -#include "my_alloc.h" typedef struct st_used_mem { struct st_used_mem *next; @@ -246,7 +240,6 @@ typedef struct st_mysql_rows { unsigned long length; } MYSQL_ROWS; typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; -#include "my_alloc.h" typedef struct embedded_query_result EMBEDDED_QUERY_RESULT; typedef struct st_mysql_data { MYSQL_ROWS *data; diff --git a/include/mysql/client_plugin.h.pp b/include/mysql/client_plugin.h.pp index f3a0b5769df..b6ba9cf08ad 100644 --- a/include/mysql/client_plugin.h.pp +++ b/include/mysql/client_plugin.h.pp @@ -3,7 +3,6 @@ struct st_mysql_client_plugin int type; unsigned int interface_version; const char *name; const char *author; const char *desc; unsigned int version[3]; const char *license; void *mysql_api; int (*init)(char *, size_t, int, va_list); int (*deinit)(); int (*options)(const char *option, const void *); }; struct st_mysql; -#include <mysql/plugin_auth_common.h> typedef struct st_plugin_vio_info { enum { MYSQL_VIO_INVALID, MYSQL_VIO_TCP, MYSQL_VIO_SOCKET, @@ -24,7 +23,6 @@ struct st_mysql_client_plugin_AUTHENTICATION int type; unsigned int interface_version; const char *name; const char *author; const char *desc; unsigned int version[3]; const char *license; void *mysql_api; int (*init)(char *, size_t, int, va_list); int (*deinit)(); int (*options)(const char *option, const void *); int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, struct st_mysql *mysql); }; -#include <mysql/auth_dialog_client.h> struct st_mysql; typedef char *(*mysql_authentication_dialog_ask_t)(struct st_mysql *mysql, int type, const char *prompt, char *buf, int buf_len); diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp index 98fd089570d..2f8edfe192f 100644 --- a/include/mysql/plugin_audit.h.pp +++ b/include/mysql/plugin_audit.h.pp @@ -1,15 +1,11 @@ -#include "plugin.h" typedef char my_bool; typedef void * MYSQL_PLUGIN; -#include <mysql/services.h> -#include <mysql/service_my_snprintf.h> extern struct my_snprintf_service_st { size_t (*my_snprintf_type)(char*, size_t, const char*, ...); size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list); } *my_snprintf_service; size_t my_snprintf(char* to, size_t n, const char* fmt, ...); size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap); -#include <mysql/service_thd_alloc.h> struct st_mysql_lex_string { char *str; @@ -33,7 +29,6 @@ void *thd_memdup(void* thd, const void* str, unsigned int size); MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str, const char *str, unsigned int size, int allocate_lex_string); -#include <mysql/service_thd_wait.h> typedef enum _thd_wait_type_e { THD_WAIT_SLEEP= 1, THD_WAIT_DISKIO= 2, @@ -54,7 +49,6 @@ extern struct thd_wait_service_st { } *thd_wait_service; void thd_wait_begin(void* thd, int wait_type); void thd_wait_end(void* thd); -#include <mysql/service_progress_report.h> extern struct progress_report_service_st { void (*thd_progress_init_func)(void* thd, unsigned int max_stage); void (*thd_progress_report_func)(void* thd, @@ -75,9 +69,7 @@ void thd_progress_next_stage(void* thd); void thd_progress_end(void* thd); const char *set_thd_proc_info(void*, const char * info, const char *func, const char *file, unsigned int line); -#include <mysql/service_debug_sync.h> extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t); -#include <mysql/service_kill_statement.h> enum thd_kill_levels { THD_IS_NOT_KILLED=0, THD_ABORT_SOFTLY=50, @@ -87,8 +79,6 @@ extern struct kill_statement_service_st { enum thd_kill_levels (*thd_kill_level_func)(const void*); } *thd_kill_statement_service; enum thd_kill_levels thd_kill_level(const void*); -#include <mysql/service_thd_timezone.h> -#include "mysql_time.h" typedef long my_time_t; enum enum_mysql_timestamp_type { @@ -108,14 +98,12 @@ extern struct thd_timezone_service_st { } *thd_timezone_service; my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode); void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t); -#include <mysql/service_sha1.h> extern struct my_sha1_service_st { void (*my_sha1_type)(unsigned char*, const char*, size_t); void (*my_sha1_multi_type)(unsigned char*, ...); } *my_sha1_service; void my_sha1(unsigned char*, const char*, size_t); void my_sha1_multi(unsigned char*, ...); -#include <mysql/service_logger.h> typedef struct logger_handle_st LOGGER_HANDLE; extern struct logger_service_st { void (*logger_init_mutexes)(); @@ -137,14 +125,12 @@ extern struct logger_service_st { int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...); int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size); int logger_rotate(LOGGER_HANDLE *log); -#include <mysql/service_thd_autoinc.h> extern struct thd_autoinc_service_st { void (*thd_get_autoinc_func)(const void* thd, unsigned long* off, unsigned long* inc); } *thd_autoinc_service; void thd_get_autoinc(const void* thd, unsigned long* off, unsigned long* inc); -#include <mysql/service_thd_error_context.h> extern struct thd_error_context_service_st { const char *(*thd_get_error_message_func)(const void* thd); unsigned int (*thd_get_error_number_func)(const void* thd); @@ -223,8 +209,6 @@ struct st_maria_plugin const char *version_info; unsigned int maturity; }; -#include "plugin_ftparser.h" -#include "plugin.h" enum enum_ftparser_mode { MYSQL_FTPARSER_SIMPLE_MODE= 0, diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp index 6d52c5be7f0..d052c550896 100644 --- a/include/mysql/plugin_auth.h.pp +++ b/include/mysql/plugin_auth.h.pp @@ -1,15 +1,11 @@ -#include <mysql/plugin.h> typedef char my_bool; typedef void * MYSQL_PLUGIN; -#include <mysql/services.h> -#include <mysql/service_my_snprintf.h> extern struct my_snprintf_service_st { size_t (*my_snprintf_type)(char*, size_t, const char*, ...); size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list); } *my_snprintf_service; size_t my_snprintf(char* to, size_t n, const char* fmt, ...); size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap); -#include <mysql/service_thd_alloc.h> struct st_mysql_lex_string { char *str; @@ -33,7 +29,6 @@ void *thd_memdup(void* thd, const void* str, unsigned int size); MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str, const char *str, unsigned int size, int allocate_lex_string); -#include <mysql/service_thd_wait.h> typedef enum _thd_wait_type_e { THD_WAIT_SLEEP= 1, THD_WAIT_DISKIO= 2, @@ -54,7 +49,6 @@ extern struct thd_wait_service_st { } *thd_wait_service; void thd_wait_begin(void* thd, int wait_type); void thd_wait_end(void* thd); -#include <mysql/service_progress_report.h> extern struct progress_report_service_st { void (*thd_progress_init_func)(void* thd, unsigned int max_stage); void (*thd_progress_report_func)(void* thd, @@ -75,9 +69,7 @@ void thd_progress_next_stage(void* thd); void thd_progress_end(void* thd); const char *set_thd_proc_info(void*, const char * info, const char *func, const char *file, unsigned int line); -#include <mysql/service_debug_sync.h> extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t); -#include <mysql/service_kill_statement.h> enum thd_kill_levels { THD_IS_NOT_KILLED=0, THD_ABORT_SOFTLY=50, @@ -87,8 +79,6 @@ extern struct kill_statement_service_st { enum thd_kill_levels (*thd_kill_level_func)(const void*); } *thd_kill_statement_service; enum thd_kill_levels thd_kill_level(const void*); -#include <mysql/service_thd_timezone.h> -#include "mysql_time.h" typedef long my_time_t; enum enum_mysql_timestamp_type { @@ -108,14 +98,12 @@ extern struct thd_timezone_service_st { } *thd_timezone_service; my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode); void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t); -#include <mysql/service_sha1.h> extern struct my_sha1_service_st { void (*my_sha1_type)(unsigned char*, const char*, size_t); void (*my_sha1_multi_type)(unsigned char*, ...); } *my_sha1_service; void my_sha1(unsigned char*, const char*, size_t); void my_sha1_multi(unsigned char*, ...); -#include <mysql/service_logger.h> typedef struct logger_handle_st LOGGER_HANDLE; extern struct logger_service_st { void (*logger_init_mutexes)(); @@ -137,14 +125,12 @@ extern struct logger_service_st { int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...); int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size); int logger_rotate(LOGGER_HANDLE *log); -#include <mysql/service_thd_autoinc.h> extern struct thd_autoinc_service_st { void (*thd_get_autoinc_func)(const void* thd, unsigned long* off, unsigned long* inc); } *thd_autoinc_service; void thd_get_autoinc(const void* thd, unsigned long* off, unsigned long* inc); -#include <mysql/service_thd_error_context.h> extern struct thd_error_context_service_st { const char *(*thd_get_error_message_func)(const void* thd); unsigned int (*thd_get_error_number_func)(const void* thd); @@ -223,8 +209,6 @@ struct st_maria_plugin const char *version_info; unsigned int maturity; }; -#include "plugin_ftparser.h" -#include "plugin.h" enum enum_ftparser_mode { MYSQL_FTPARSER_SIMPLE_MODE= 0, @@ -314,7 +298,6 @@ void *thd_get_ha_data(const void* thd, const struct handlerton *hton); void thd_set_ha_data(void* thd, const struct handlerton *hton, const void *ha_data); void thd_wakeup_subsequent_commits(void* thd, int wakeup_error); -#include <mysql/plugin_auth_common.h> typedef struct st_plugin_vio_info { enum { MYSQL_VIO_INVALID, MYSQL_VIO_TCP, MYSQL_VIO_SOCKET, diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp index cb3e7cafc97..45eb06974f4 100644 --- a/include/mysql/plugin_ftparser.h.pp +++ b/include/mysql/plugin_ftparser.h.pp @@ -1,15 +1,11 @@ -#include "plugin.h" typedef char my_bool; typedef void * MYSQL_PLUGIN; -#include <mysql/services.h> -#include <mysql/service_my_snprintf.h> extern struct my_snprintf_service_st { size_t (*my_snprintf_type)(char*, size_t, const char*, ...); size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list); } *my_snprintf_service; size_t my_snprintf(char* to, size_t n, const char* fmt, ...); size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap); -#include <mysql/service_thd_alloc.h> struct st_mysql_lex_string { char *str; @@ -33,7 +29,6 @@ void *thd_memdup(void* thd, const void* str, unsigned int size); MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str, const char *str, unsigned int size, int allocate_lex_string); -#include <mysql/service_thd_wait.h> typedef enum _thd_wait_type_e { THD_WAIT_SLEEP= 1, THD_WAIT_DISKIO= 2, @@ -54,7 +49,6 @@ extern struct thd_wait_service_st { } *thd_wait_service; void thd_wait_begin(void* thd, int wait_type); void thd_wait_end(void* thd); -#include <mysql/service_progress_report.h> extern struct progress_report_service_st { void (*thd_progress_init_func)(void* thd, unsigned int max_stage); void (*thd_progress_report_func)(void* thd, @@ -75,9 +69,7 @@ void thd_progress_next_stage(void* thd); void thd_progress_end(void* thd); const char *set_thd_proc_info(void*, const char * info, const char *func, const char *file, unsigned int line); -#include <mysql/service_debug_sync.h> extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t); -#include <mysql/service_kill_statement.h> enum thd_kill_levels { THD_IS_NOT_KILLED=0, THD_ABORT_SOFTLY=50, @@ -87,8 +79,6 @@ extern struct kill_statement_service_st { enum thd_kill_levels (*thd_kill_level_func)(const void*); } *thd_kill_statement_service; enum thd_kill_levels thd_kill_level(const void*); -#include <mysql/service_thd_timezone.h> -#include "mysql_time.h" typedef long my_time_t; enum enum_mysql_timestamp_type { @@ -108,14 +98,12 @@ extern struct thd_timezone_service_st { } *thd_timezone_service; my_time_t thd_TIME_to_gmt_sec(void* thd, const MYSQL_TIME *ltime, unsigned int *errcode); void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t); -#include <mysql/service_sha1.h> extern struct my_sha1_service_st { void (*my_sha1_type)(unsigned char*, const char*, size_t); void (*my_sha1_multi_type)(unsigned char*, ...); } *my_sha1_service; void my_sha1(unsigned char*, const char*, size_t); void my_sha1_multi(unsigned char*, ...); -#include <mysql/service_logger.h> typedef struct logger_handle_st LOGGER_HANDLE; extern struct logger_service_st { void (*logger_init_mutexes)(); @@ -137,14 +125,12 @@ extern struct logger_service_st { int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...); int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size); int logger_rotate(LOGGER_HANDLE *log); -#include <mysql/service_thd_autoinc.h> extern struct thd_autoinc_service_st { void (*thd_get_autoinc_func)(const void* thd, unsigned long* off, unsigned long* inc); } *thd_autoinc_service; void thd_get_autoinc(const void* thd, unsigned long* off, unsigned long* inc); -#include <mysql/service_thd_error_context.h> extern struct thd_error_context_service_st { const char *(*thd_get_error_message_func)(const void* thd); unsigned int (*thd_get_error_number_func)(const void* thd); @@ -223,7 +209,6 @@ struct st_maria_plugin const char *version_info; unsigned int maturity; }; -#include "plugin_ftparser.h" struct st_mysql_daemon { int interface_version; diff --git a/include/mysql/psi/psi_abi_v1.h.pp b/include/mysql/psi/psi_abi_v1.h.pp index 898b9871d2e..e9b514feb8a 100644 --- a/include/mysql/psi/psi_abi_v1.h.pp +++ b/include/mysql/psi/psi_abi_v1.h.pp @@ -1,4 +1,3 @@ -#include "mysql/psi/psi.h" C_MODE_START struct TABLE_SHARE; struct sql_digest_storage; diff --git a/include/mysql/psi/psi_abi_v2.h.pp b/include/mysql/psi/psi_abi_v2.h.pp index c3dba0a9b76..4e81fd66ca4 100644 --- a/include/mysql/psi/psi_abi_v2.h.pp +++ b/include/mysql/psi/psi_abi_v2.h.pp @@ -1,4 +1,3 @@ -#include "mysql/psi/psi.h" C_MODE_START struct TABLE_SHARE; struct sql_digest_storage; diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index 9dd58bebbbe..7dfc572b281 100644 --- a/libmysql/CMakeLists.txt +++ b/libmysql/CMakeLists.txt @@ -381,7 +381,7 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux") CONFIGURE_FILE( ${VERSION_SCRIPT_TEMPLATE} ${CMAKE_CURRENT_BINARY_DIR}/libmysql_versions.ld - @ONLY@ + @ONLY ) SET(VERSION_SCRIPT_LINK_FLAGS "-Wl,${CMAKE_CURRENT_BINARY_DIR}/libmysql_versions.ld") diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index ef957c54f45..1f44d67661b 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -6040,6 +6040,21 @@ DROP TABLE t1; # End of ctype_utf8_ilseq.inc # # +# MDEV-8067 correct fix for MySQL Bug # 19699237: UNINITIALIZED VARIABLE IN ITEM_FIELD::STR_RESULT +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8); +CREATE TABLE t2 (a VARCHAR(10) CHARACTER SET latin1); +INSERT INTO t1 VALUES ('aaa'); +INSERT INTO t2 VALUES ('aaa'); +SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2); +(SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2) +1 +INSERT INTO t1 VALUES ('aaa'); +INSERT INTO t2 VALUES ('aaa'); +SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2); +ERROR 21000: Subquery returns more than 1 row +DROP TABLE t1, t2; +# # End of 5.5 tests # # diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result index cc4e8074395..04ab385bca6 100644 --- a/mysql-test/r/dyncol.result +++ b/mysql-test/r/dyncol.result @@ -1455,6 +1455,12 @@ Warnings: Warning 1918 Encountered illegal value '18446744073709552001' when converting to INT Note 1105 Cast to signed converted positive out-of-range integer to it's negative complement # +# MDEV-7505 - Too large scale in DECIMAL dynamic column getter crashes +# mysqld +# +SELECT COLUMN_GET(`x`, 'y' AS DECIMAL(5,34)); +ERROR 42000: Too big scale 34 specified for ''y''. Maximum is 30. +# # test of symbolic names # # creation test (names) diff --git a/mysql-test/r/empty_server_name-8224.result b/mysql-test/r/empty_server_name-8224.result new file mode 100644 index 00000000000..6423114470d --- /dev/null +++ b/mysql-test/r/empty_server_name-8224.result @@ -0,0 +1 @@ +create server '' foreign data wrapper w2 options (host '127.0.0.1'); diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 9f5eb053cb7..38abbfef261 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -2342,7 +2342,7 @@ DROP TABLE t1; create table t1 (a int, b int); insert into t1 values (1,11), (1,12), (2,22),(2,23), (4,44),(4,45); create table t2 (c int, d int); -insert into t2 values (1,11), (1,12), (2,22),(2,23), (4,44),(4,45); +insert into t2 values (1,11), (2,22), (4,44); select distinct a,sum(b), (select d from t2 where c=a order by max(b) limit 1) from t1 group by a order by max(b); a sum(b) (select d from t2 where c=a order by max(b) limit 1) 1 23 11 diff --git a/mysql-test/r/information_schema2.result b/mysql-test/r/information_schema2.result index 60a20944839..f82301699a7 100644 --- a/mysql-test/r/information_schema2.result +++ b/mysql-test/r/information_schema2.result @@ -6,3 +6,15 @@ select variable_name from information_schema.session_variables where variable_na (select variable_name from information_schema.session_variables where variable_name = 'basedir'); variable_name BASEDIR +create table t1 (a char); +insert t1 values ('a'),('t'),('z'); +flush status; +select a, exists (select 1 from information_schema.columns where table_schema=concat('tes',a)) from t1; +a exists (select 1 from information_schema.columns where table_schema=concat('tes',a)) +a 0 +t 1 +z 0 +show status like 'created_tmp_tables'; +Variable_name Value +Created_tmp_tables 43 +drop table t1; diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 3a6fa9a4673..5506e4e419c 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -2527,6 +2527,17 @@ test.t1 check error Size of indexfile is: 1024 Should be: 2048 test.t1 check warning Size of datafile is: 14 Should be: 7 test.t1 check error Corrupt DROP TABLE t1; +# +# MDEV-3870 - Valgrind warnings on OPTIMIZE MyISAM or Aria TABLE with +# disabled keys +# +CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (4),(3),(1),(0); +ALTER TABLE t1 DISABLE KEYS; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +DROP TABLE t1; show variables like 'myisam_block_size'; Variable_name Value myisam_block_size 1024 diff --git a/mysql-test/r/mysql_tzinfo_to_sql_symlink.result b/mysql-test/r/mysql_tzinfo_to_sql_symlink.result index dda732937ee..f127e756987 100644 --- a/mysql-test/r/mysql_tzinfo_to_sql_symlink.result +++ b/mysql-test/r/mysql_tzinfo_to_sql_symlink.result @@ -60,3 +60,12 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, # TRUNCATE TABLE time_zone_leap_second; ALTER TABLE time_zone_leap_second ORDER BY Transition_time; +# +# MDEV-6236 - [PATCH] mysql_tzinfo_to_sql may produce invalid SQL +# +TRUNCATE TABLE time_zone; +TRUNCATE TABLE time_zone_name; +TRUNCATE TABLE time_zone_transition; +TRUNCATE TABLE time_zone_transition_type; +ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; +ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; diff --git a/mysql-test/r/mysql_upgrade_view.result b/mysql-test/r/mysql_upgrade_view.result index 37c9c926149..63f86af3591 100644 --- a/mysql-test/r/mysql_upgrade_view.result +++ b/mysql-test/r/mysql_upgrade_view.result @@ -3,6 +3,41 @@ drop table if exists t1,v1,v2,v3,v4,v1badcheck; drop view if exists t1,v1,v2,v3,v4,v1badcheck; create table t1(a int); create table kv(k varchar(30) NOT NULL PRIMARY KEY,v varchar(50)); +create view v1 as select 1; +repair table t1 quick; +Table Op Msg_type Msg_text +test.t1 repair status OK +repair table t1 extended; +Table Op Msg_type Msg_text +test.t1 repair status OK +repair table t1 use_frm; +Table Op Msg_type Msg_text +test.t1 repair status OK +repair table t1 from mysql; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'from mysql' at line 1 +repair view v1 quick; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'quick' at line 1 +repair view v1 extended; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'extended' at line 1 +repair view v1 use_frm; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'use_frm' at line 1 +repair view v1 from mysql; +Table Op Msg_type Msg_text +test.v1 repair status OK +check view v1 quick; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'quick' at line 1 +check view v1 fast; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'fast' at line 1 +check view v1 medium; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'medium' at line 1 +check view v1 extended; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'extended' at line 1 +check view v1 changed; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'changed' at line 1 +check view v1 for upgrade; +Table Op Msg_type Msg_text +test.v1 check status OK +drop view v1; flush tables; check view v1; Table Op Msg_type Msg_text diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index 2d4a053b3a2..b4bcdc495ae 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -347,3 +347,26 @@ CREATE TABLE test.`t.1` (id int); mysqlcheck test t.1 test.t.1 OK drop table test.`t.1`; +create view v1 as select 1; +mysqlcheck --process-views test +test.v1 OK +mysqlcheck --process-views --extended test +test.v1 OK +mysqlcheck --process-views --fast test +mysqlcheck --process-views --quick test +test.v1 OK +mysqlcheck --process-views --check-only-changed test +mysqlcheck --process-views --medium-check test +test.v1 OK +mysqlcheck --process-views --check-upgrade test +test.v1 OK +drop view v1; +create table t1(a int); +mysqlcheck --process-views --check-upgrade --auto-repair test +test.t1 OK +test.v1 Needs upgrade + +Repairing views +test.v1 OK +drop view v1; +drop table t1; diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result index 92c9c01db2d..798e3b9a6bf 100644 --- a/mysql-test/r/partition_innodb.result +++ b/mysql-test/r/partition_innodb.result @@ -380,33 +380,33 @@ DROP TABLE t1; create table t1 (a int) engine=innodb partition by hash(a) ; show table status like 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 InnoDB 10 Compact 2 8192 16384 0 0 # NULL NULL NULL NULL latin1_swedish_ci NULL partitioned +t1 InnoDB 10 Compact 2 8192 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned drop table t1; create table t1 (a int) engine = innodb partition by key (a); show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 InnoDB 10 Compact 2 8192 16384 0 0 # NULL NULL NULL NULL latin1_swedish_ci NULL partitioned +t1 InnoDB 10 Compact 2 8192 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned insert into t1 values (0), (1), (2), (3); show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 InnoDB 10 Compact 4 4096 16384 0 0 # NULL NULL NULL NULL latin1_swedish_ci NULL partitioned +t1 InnoDB 10 Compact 4 4096 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned drop table t1; create table t1 (a int auto_increment primary key) engine = innodb partition by key (a); show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 InnoDB 10 Compact 2 8192 16384 0 0 # 1 NULL NULL NULL latin1_swedish_ci NULL partitioned +t1 InnoDB 10 Compact 2 8192 16384 0 0 # 1 # NULL NULL latin1_swedish_ci NULL partitioned insert into t1 values (NULL), (NULL), (NULL), (NULL); show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 InnoDB 10 Compact 4 4096 16384 0 0 # 5 NULL NULL NULL latin1_swedish_ci NULL partitioned +t1 InnoDB 10 Compact 4 4096 16384 0 0 # 5 # NULL NULL latin1_swedish_ci NULL partitioned insert into t1 values (NULL), (NULL), (NULL), (NULL); show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 InnoDB 10 Compact 8 2048 16384 0 0 # 9 NULL NULL NULL latin1_swedish_ci NULL partitioned +t1 InnoDB 10 Compact 8 2048 16384 0 0 # 9 # NULL NULL latin1_swedish_ci NULL partitioned drop table t1; create table t1 (a int) partition by key (a) @@ -588,6 +588,17 @@ a b 0 1 DROP TABLE t1; # +# Bug #17299181 CREATE_TIME AND UPDATE_TIME ARE +# WRONG FOR PARTITIONED TABLES +# +CREATE TABLE t1 (a int, PRIMARY KEY (a)) ENGINE=InnoDB +PARTITION BY HASH (a) PARTITIONS 2; +SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE +CREATE_TIME IS NOT NULL AND TABLE_NAME='t1'; +COUNT(*) +1 +DROP TABLE t1; +# # BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET == # SAVE_READ_SET # diff --git a/mysql-test/r/range_innodb.result b/mysql-test/r/range_innodb.result new file mode 100644 index 00000000000..794e6c7b3cc --- /dev/null +++ b/mysql-test/r/range_innodb.result @@ -0,0 +1,39 @@ +# +# Range optimizer (and related) tests that need InnoDB. +# +drop table if exists t0, t1, t2; +# +# MDEV-6735: Range checked for each record used with key +# +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 + D.a * 1000 +from t0 A, t0 B, t0 C, t0 D; +create table t2 ( +a int, +b int, +filler1 char(100), +filler2 char(100), +filler3 char(100), +filler4 char(100), +key(a), +key(b) +) engine=innodb; +insert into t2 +select +a,a, +repeat('0123456789', 10), +repeat('0123456789', 10), +repeat('0123456789', 10), +repeat('0123456789', 10) +from t1; +analyze table t2; +Table Op Msg_type Msg_text +test.t2 analyze status OK +# The following must not use "Range checked for each record": +explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 10 +1 SIMPLE t2 range a,b b 5 NULL 201 Using where; Using join buffer (flat, BNL join) +drop table t0,t1,t2; diff --git a/mysql-test/r/ssl_7937,nossl.result b/mysql-test/r/ssl_7937,nossl.result new file mode 100644 index 00000000000..72693233bc8 --- /dev/null +++ b/mysql-test/r/ssl_7937,nossl.result @@ -0,0 +1,15 @@ +create procedure have_ssl() +select if(variable_value > '','yes','no') as 'have_ssl' + from information_schema.session_status +where variable_name='ssl_cipher'; +mysql --ssl-ca=cacert.pem -e "call test.have_ssl()" +have_ssl +no +mysql --ssl -e "call test.have_ssl()" +have_ssl +no +mysql --ssl-ca=cacert.pem --ssl-verify-server-cert -e "call test.have_ssl()" +ERROR 2026 (HY000): SSL connection error: SSL is required, but the server does not support it +mysql --ssl --ssl-verify-server-cert -e "call test.have_ssl()" +ERROR 2026 (HY000): SSL connection error: SSL is required, but the server does not support it +drop procedure have_ssl; diff --git a/mysql-test/r/ssl_7937.result b/mysql-test/r/ssl_7937.result new file mode 100644 index 00000000000..a94ca3b3529 --- /dev/null +++ b/mysql-test/r/ssl_7937.result @@ -0,0 +1,16 @@ +create procedure have_ssl() +select if(variable_value > '','yes','no') as 'have_ssl' + from information_schema.session_status +where variable_name='ssl_cipher'; +mysql --ssl-ca=cacert.pem -e "call test.have_ssl()" +have_ssl +yes +mysql --ssl -e "call test.have_ssl()" +have_ssl +yes +mysql --ssl-ca=cacert.pem --ssl-verify-server-cert -e "call test.have_ssl()" +have_ssl +yes +mysql --ssl --ssl-verify-server-cert -e "call test.have_ssl()" +ERROR 2026 (HY000): SSL connection error: Failed to verify the server certificate +drop procedure have_ssl; diff --git a/mysql-test/r/truncate-stale-6500.result b/mysql-test/r/truncate-stale-6500.result new file mode 100644 index 00000000000..b6222716953 --- /dev/null +++ b/mysql-test/r/truncate-stale-6500.result @@ -0,0 +1,33 @@ +SET GLOBAL query_cache_size=1024*1024*8; +CREATE TABLE `test` ( +`uniqueId` INT NOT NULL, +`partitionId` INT NOT NULL, +PRIMARY KEY (`uniqueId`,`partitionId`) +) ENGINE=InnoDB PARTITION BY LIST (partitionId) ( +PARTITION p01 VALUES IN (1), +PARTITION p02 VALUES IN (2) +); +INSERT INTO `test`(`uniqueId`,`partitionId`) VALUES(407237055, 2); +SELECT * FROM `test`; +uniqueId partitionId +407237055 2 +#Confirms 1 row in partition 'p02' +SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS FROM information_schema.PARTITIONS where TABLE_NAME = 'test'; +TABLE_NAME PARTITION_NAME TABLE_ROWS +test p01 0 +test p02 1 +ALTER TABLE `test` TRUNCATE PARTITION `p02`; +#Confirms no more rows in partition 'p02' +SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS FROM information_schema.PARTITIONS where TABLE_NAME = 'test'; +TABLE_NAME PARTITION_NAME TABLE_ROWS +test p01 0 +test p02 0 +#Before the patch, this returned the previously existing values. +SELECT * FROM `test`; +uniqueId partitionId +SELECT SQL_CACHE * FROM `test`; +uniqueId partitionId +SELECT SQL_NO_CACHE * FROM `test`; +uniqueId partitionId +DROP TABLE test; +SET GLOBAL query_cache_size=DEFAULT; diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result index f8649f030bb..cde8816dee4 100644 --- a/mysql-test/r/type_decimal.result +++ b/mysql-test/r/type_decimal.result @@ -994,3 +994,24 @@ GROUP BY t2.col0 WHERE CONCAT(t1.col1, CAST(subq.col0 AS DECIMAL)); 1 DROP TABLE t1, t2; +# +# Start of 5.5 tests +# +# +# MDEV-8267 Add /*old*/ comment into I_S.COLUMN_TYPE for old DECIMAL +# +SHOW CREATE TABLE t1dec102; +Table Create Table +t1dec102 CREATE TABLE `t1dec102` ( + `a` decimal(10,2)/*old*/ DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SHOW COLUMNS FROM t1dec102; +Field Type Null Key Default Extra +a decimal(10,2)/*old*/ YES NULL +SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1dec102'; +COLUMN_NAME DATA_TYPE COLUMN_TYPE +a decimal decimal(10,2)/*old*/ +DROP TABLE t1dec102; +# +# End of 5.5 tests +# diff --git a/mysql-test/r/update_innodb.result b/mysql-test/r/update_innodb.result new file mode 100644 index 00000000000..88c86c50625 --- /dev/null +++ b/mysql-test/r/update_innodb.result @@ -0,0 +1,31 @@ +CREATE TABLE `t1` ( +`c1` int(11) NOT NULL, +`c2` datetime DEFAULT NULL, +PRIMARY KEY (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +CREATE TABLE `t2` ( +`c0` varchar(10) NOT NULL, +`c1` int(11) NOT NULL, +`c2` int(11) NOT NULL, +PRIMARY KEY (`c0`,`c1`), +KEY `c1` (`c1`), +KEY `c2` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +CREATE TABLE `t3` ( +`id` int(11) unsigned NOT NULL AUTO_INCREMENT, +`c1` datetime NOT NULL, +`c2` bigint(20) NOT NULL, +`c3` int(4) unsigned NOT NULL, +PRIMARY KEY (`id`), +KEY `c2` (`c2`), +KEY `c3` (`c3`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +CREATE TABLE `t4` ( +`c1` int(11) NOT NULL, +`c2` bigint(20) DEFAULT NULL, +`c3` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select `t4`.`c1` AS `c1`,`t4`.`c2` AS `c2`,`t4`.`c3` AS `c3` from `t4`; +UPDATE t1 a JOIN t2 b ON a.c1 = b.c1 JOIN v1 vw ON b.c2 = vw.c1 JOIN t3 del ON vw.c2 = del.c2 SET a.c2 = ( SELECT max(t.c1) FROM t3 t, v1 i WHERE del.c2 = t.c2 AND vw.c3 = i.c3 AND t.c3 = 4 ) WHERE a.c2 IS NULL OR a.c2 < '2011-05-01'; +drop view v1; +drop table t1,t2,t3,t4; diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 083ed9686d4..d534cf4023a 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -5409,6 +5409,24 @@ create view v2 as select t2.* from (t2 left join v1 using (id)); update t3 left join v2 using (id) set flag=flag+1; drop view v2, v1; drop table t1, t2, t3; +# +# MDEV-7207 - ALTER VIEW does not change ALGORITM +# +create table t1 (a int, b int); +create algorithm=temptable view v2 (c) as select b+1 from t1; +show create view v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci +alter algorithm=undefined view v2 (c) as select b+1 from t1; +show create view v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci +alter algorithm=merge view v2 (c) as select b+1 from t1; +show create view v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci +drop view v2; +drop table t1; # ----------------------------------------------------------------- # -- End of 5.5 tests. # ----------------------------------------------------------------- diff --git a/mysql-test/std_data/old_decimal/t1dec102.MYD b/mysql-test/std_data/old_decimal/t1dec102.MYD new file mode 100644 index 00000000000..59e43854d4a --- /dev/null +++ b/mysql-test/std_data/old_decimal/t1dec102.MYD @@ -0,0 +1 @@ +ý 123.45ý 123.46ý 123.47
\ No newline at end of file diff --git a/mysql-test/std_data/old_decimal/t1dec102.MYI b/mysql-test/std_data/old_decimal/t1dec102.MYI Binary files differnew file mode 100644 index 00000000000..e0b2d4a003c --- /dev/null +++ b/mysql-test/std_data/old_decimal/t1dec102.MYI diff --git a/mysql-test/std_data/old_decimal/t1dec102.frm b/mysql-test/std_data/old_decimal/t1dec102.frm Binary files differnew file mode 100644 index 00000000000..652cfc3bbac --- /dev/null +++ b/mysql-test/std_data/old_decimal/t1dec102.frm diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result index f24cd30167c..86c4c68d02b 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result @@ -327,6 +327,18 @@ INSERT INTO t2 SET a=1; INSERT INTO t2 SET b=1; UPDATE t1, t2 SET t1.a=10, t2.a=20; DROP TABLE t1,t2; +INSERT INTO t1dec102 VALUES (-999.99); +INSERT INTO t1dec102 VALUES (0); +INSERT INTO t1dec102 VALUES (999.99); +SELECT * FROM t1dec102 ORDER BY a; +a +-999.99 +0.00 +123.45 +123.46 +123.47 +999.99 +DROP TABLE t1dec102; flush logs; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; @@ -4554,6 +4566,62 @@ SET TIMESTAMP=1000000000/*!*/; DROP TABLE `t1`,`t2` /* generated by server */ /*!*/; # at # +#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-317 +/*!100001 SET @@session.gtid_seq_no=317*//*!*/; +BEGIN +/*!*/; +# at # +# at # +#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1dec102` mapped to number # +#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F +### INSERT INTO `test`.`t1dec102` +### SET +### @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # at # +#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-318 +/*!100001 SET @@session.gtid_seq_no=318*//*!*/; +BEGIN +/*!*/; +# at # +# at # +#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1dec102` mapped to number # +#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F +### INSERT INTO `test`.`t1dec102` +### SET +### @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # at # +#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-319 +/*!100001 SET @@session.gtid_seq_no=319*//*!*/; +BEGIN +/*!*/; +# at # +# at # +#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1dec102` mapped to number # +#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F +### INSERT INTO `test`.`t1dec102` +### SET +### @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # at # +#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-320 +/*!100001 SET @@session.gtid_seq_no=320*//*!*/; +# at # +#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +DROP TABLE `t1dec102` /* generated by server */ +/*!*/; +# at # #010909 4:46:40 server id 1 end_log_pos # Rotate to master-bin.000002 pos: 4 DELIMITER ; # End of log file diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test index 9b41c63d195..9609a9af384 100644 --- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test @@ -438,9 +438,20 @@ INSERT INTO t2 SET b=1; UPDATE t1, t2 SET t1.a=10, t2.a=20; DROP TABLE t1,t2; +let $MYSQLD_DATADIR= `select @@datadir`; + +--copy_file std_data/old_decimal/t1dec102.frm $MYSQLD_DATADIR/test/t1dec102.frm +--copy_file std_data/old_decimal/t1dec102.MYD $MYSQLD_DATADIR/test/t1dec102.MYD +--copy_file std_data/old_decimal/t1dec102.MYI $MYSQLD_DATADIR/test/t1dec102.MYI + +INSERT INTO t1dec102 VALUES (-999.99); +INSERT INTO t1dec102 VALUES (0); +INSERT INTO t1dec102 VALUES (999.99); +SELECT * FROM t1dec102 ORDER BY a; +DROP TABLE t1dec102; + flush logs; -let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/ --exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 diff --git a/mysql-test/suite/innodb/r/xa_recovery.result b/mysql-test/suite/innodb/r/xa_recovery.result new file mode 100644 index 00000000000..84cb37ef7c9 --- /dev/null +++ b/mysql-test/suite/innodb/r/xa_recovery.result @@ -0,0 +1,17 @@ +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +XA START 'x'; +UPDATE t1 set a=2; +XA END 'x'; +XA PREPARE 'x'; +call mtr.add_suppression("Found 1 prepared XA transactions"); +SELECT * FROM t1 LOCK IN SHARE MODE; +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT * FROM t1; +a +2 +XA ROLLBACK 'x'; +SELECT * FROM t1; +a +1 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/foreign-keys.test b/mysql-test/suite/innodb/t/foreign-keys.test index 8ee96347208..2d586e2d6be 100644 --- a/mysql-test/suite/innodb/t/foreign-keys.test +++ b/mysql-test/suite/innodb/t/foreign-keys.test @@ -1,11 +1,6 @@ --source include/have_innodb.inc --source include/have_debug.inc -if (`select plugin_auth_version <= "5.5.39-MariaDB-36.0" from information_schema.plugins where plugin_name='innodb'`) -{ - --skip Not fixed in XtraDB as of 5.5.39-MariaDB-36.0 or earlier -} - --echo # --echo # Bug #19471516 SERVER CRASHES WHEN EXECUTING ALTER TABLE --echo # ADD FOREIGN KEY diff --git a/mysql-test/suite/innodb/t/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test index fd40b50ebbc..a8dda12cadd 100644 --- a/mysql-test/suite/innodb/t/innodb-autoinc.test +++ b/mysql-test/suite/innodb/t/innodb-autoinc.test @@ -1,8 +1,3 @@ -if (`select plugin_auth_version <= "5.5.37-MariaDB-34.0" from information_schema.plugins where plugin_name='innodb'`) -{ - --skip Not fixed in XtraDB as of 5.5.37-MariaDB-34.0 or earlier -} - --source include/have_innodb.inc # embedded server ignores 'delayed', so skip this -- source include/not_embedded.inc diff --git a/mysql-test/suite/innodb/t/insert_debug.test b/mysql-test/suite/innodb/t/insert_debug.test index 666b634bef9..36ceba2ee8b 100644 --- a/mysql-test/suite/innodb/t/insert_debug.test +++ b/mysql-test/suite/innodb/t/insert_debug.test @@ -2,11 +2,6 @@ --source include/have_debug.inc --source include/have_partition.inc -if (`select plugin_auth_version < "5.6.22" from information_schema.plugins where plugin_name='innodb'`) -{ - --skip Not fixed in InnoDB/XtraDB as of 5.6.21 or earlier -} - --echo # --echo # Bug#19904003 INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG=1 --echo # CAUSES INFINITE PAGE SPLIT diff --git a/mysql-test/suite/innodb/t/sp_temp_table.test b/mysql-test/suite/innodb/t/sp_temp_table.test index 9a6be85fd7e..b2883f551b9 100644 --- a/mysql-test/suite/innodb/t/sp_temp_table.test +++ b/mysql-test/suite/innodb/t/sp_temp_table.test @@ -1,11 +1,6 @@ --source include/have_innodb.inc --source include/big_test.inc -if (`select plugin_auth_version < "5.6.22" from information_schema.plugins where plugin_name='innodb'`) -{ - --skip Not fixed in InnoDB/XtraDB as of 5.6.21 or earlier -} - --echo # --echo # Bug #19306524 FAILING ASSERTION WITH TEMP TABLE FOR A PROCEDURE --echo # CALLED FROM A FUNCTION diff --git a/mysql-test/suite/innodb/t/strict_mode.test b/mysql-test/suite/innodb/t/strict_mode.test index 9b115091f84..86b56a09c0e 100644 --- a/mysql-test/suite/innodb/t/strict_mode.test +++ b/mysql-test/suite/innodb/t/strict_mode.test @@ -1,10 +1,5 @@ --source include/have_innodb.inc -if (`select plugin_auth_version <= "5.5.40-MariaDB-36.1" from information_schema.plugins where plugin_name='innodb'`) -{ - --skip Not fixed in XtraDB as of 5.5.40-MariaDB-36.1 or earlier -} - --echo # --echo # Bug #17852083 PRINT A WARNING WHEN DDL HAS AN ERROR IN --echo # INNODB_STRICT_MODE = 1 diff --git a/mysql-test/suite/innodb/t/xa_recovery.test b/mysql-test/suite/innodb/t/xa_recovery.test new file mode 100644 index 00000000000..837b33cb3c4 --- /dev/null +++ b/mysql-test/suite/innodb/t/xa_recovery.test @@ -0,0 +1,47 @@ +if (`select plugin_auth_version <= "5.6.24" from information_schema.plugins where plugin_name='innodb'`) +{ + --skip Not fixed in InnoDB as of 5.6.24 or earlier +} +--source include/have_innodb.inc +# Embedded server does not support restarting. +--source include/not_embedded.inc + +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +connect (con1,localhost,root); +XA START 'x'; UPDATE t1 set a=2; XA END 'x'; XA PREPARE 'x'; +connection default; + +call mtr.add_suppression("Found 1 prepared XA transactions"); + +# Kill and restart the server. +-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +-- shutdown_server 0 +-- source include/wait_until_disconnected.inc + +-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +-- enable_reconnect +-- source include/wait_until_connected_again.inc +-- disable_reconnect + +disconnect con1; +connect (con1,localhost,root); +--send SELECT * FROM t1 LOCK IN SHARE MODE + +connection default; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = 'Sending data' and + info = 'SELECT * FROM t1 LOCK IN SHARE MODE'; +--source include/wait_condition.inc + +--source include/restart_mysqld.inc + +disconnect con1; + +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT * FROM t1; +XA ROLLBACK 'x'; +SELECT * FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/maria/optimize.result b/mysql-test/suite/maria/optimize.result index 9cce55d6199..a78e8e469aa 100644 --- a/mysql-test/suite/maria/optimize.result +++ b/mysql-test/suite/maria/optimize.result @@ -6,3 +6,14 @@ OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK drop table t1; +# +# MDEV-3870 - Valgrind warnings on OPTIMIZE MyISAM or Aria TABLE with +# disabled keys +# +CREATE TABLE t1 (a INT, KEY(a)) ENGINE=Aria; +INSERT INTO t1 VALUES (4),(3),(1),(0); +ALTER TABLE t1 DISABLE KEYS; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +DROP TABLE t1; diff --git a/mysql-test/suite/maria/optimize.test b/mysql-test/suite/maria/optimize.test index 6b310b1d1a6..b1fc250cd29 100644 --- a/mysql-test/suite/maria/optimize.test +++ b/mysql-test/suite/maria/optimize.test @@ -160,3 +160,13 @@ INSERT /*! IGNORE */ INTO t1 VALUES ('urxjxqvwabikpugvexxbxdpxjkeqiuhhuadbcuhoz check table t1; OPTIMIZE TABLE t1; drop table t1; + +--echo # +--echo # MDEV-3870 - Valgrind warnings on OPTIMIZE MyISAM or Aria TABLE with +--echo # disabled keys +--echo # +CREATE TABLE t1 (a INT, KEY(a)) ENGINE=Aria; +INSERT INTO t1 VALUES (4),(3),(1),(0); +ALTER TABLE t1 DISABLE KEYS; +OPTIMIZE TABLE t1; +DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_debug_sync_innodb.result b/mysql-test/suite/parts/r/partition_debug_sync_innodb.result index 268db30bda0..77129d6bebb 100644 --- a/mysql-test/suite/parts/r/partition_debug_sync_innodb.result +++ b/mysql-test/suite/parts/r/partition_debug_sync_innodb.result @@ -58,7 +58,10 @@ t1.frm t1.par SET DEBUG_SYNC='before_open_in_get_all_tables SIGNAL parked WAIT_FOR open'; SET DEBUG_SYNC='partition_open_error SIGNAL alter WAIT_FOR finish'; -SELECT * FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test'; +SELECT TABLE_SCHEMA, TABLE_NAME, PARTITION_NAME, PARTITION_ORDINAL_POSITION, +PARTITION_DESCRIPTION, TABLE_ROWS +FROM INFORMATION_SCHEMA.PARTITIONS +WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test'; SET DEBUG_SYNC = 'now WAIT_FOR parked'; # When waiting for the name lock in get_all_tables in sql_show.cc # this will not be concurrent any more, thus the TIMEOUT @@ -70,9 +73,9 @@ ALTER TABLE t1 REORGANIZE PARTITION p0 INTO PARTITION p10 VALUES LESS THAN MAXVALUE); Warnings: Warning 1639 debug sync point wait timed out -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -def test t1 p0 NULL 1 NULL RANGE NULL a NULL 10 1 16384 16384 NULL 0 0 NULL NULL NULL NULL default NULL -def test t1 p10 NULL 2 NULL RANGE NULL a NULL MAXVALUE 3 5461 16384 NULL 0 0 NULL NULL NULL NULL default NULL +TABLE_SCHEMA TABLE_NAME PARTITION_NAME PARTITION_ORDINAL_POSITION PARTITION_DESCRIPTION TABLE_ROWS +test t1 p0 1 10 1 +test t1 p10 2 MAXVALUE 3 t1#P#p0.ibd t1#P#p10.ibd t1.frm diff --git a/mysql-test/suite/parts/t/partition_debug_sync_innodb.test b/mysql-test/suite/parts/t/partition_debug_sync_innodb.test index fce26132030..df9c06011c2 100644 --- a/mysql-test/suite/parts/t/partition_debug_sync_innodb.test +++ b/mysql-test/suite/parts/t/partition_debug_sync_innodb.test @@ -62,7 +62,10 @@ SHOW CREATE TABLE t1; SET DEBUG_SYNC='before_open_in_get_all_tables SIGNAL parked WAIT_FOR open'; SET DEBUG_SYNC='partition_open_error SIGNAL alter WAIT_FOR finish'; send -SELECT * FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test'; +SELECT TABLE_SCHEMA, TABLE_NAME, PARTITION_NAME, PARTITION_ORDINAL_POSITION, + PARTITION_DESCRIPTION, TABLE_ROWS +FROM INFORMATION_SCHEMA.PARTITIONS +WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test'; connect (con1, localhost, root,,); SET DEBUG_SYNC = 'now WAIT_FOR parked'; diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result index 09dcc06c848..bf71e518f97 100644 --- a/mysql-test/suite/plugins/r/server_audit.result +++ b/mysql-test/suite/plugins/r/server_audit.result @@ -45,6 +45,11 @@ id 2 alter table t1 rename renamed_t1; set global server_audit_events='connect,query'; +select 1, +2, +3; +1 2 3 +1 2 3 insert into t2 values (1), (2); select * from t2; id @@ -157,6 +162,8 @@ id CREATE USER u1 IDENTIFIED BY 'pwd-123'; GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; SET PASSWORD FOR u1 = PASSWORD('pwd 098'); +SET PASSWORD FOR u1=<secret>; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '=<secret>' at line 1 CREATE USER u3 IDENTIFIED BY ''; drop user u1, u2, u3; select 2; @@ -246,6 +253,7 @@ TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,index_stats, TIME,HOSTNAME,root,localhost,ID,ID,RENAME,test,t1|test.renamed_t1, TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'alter table t1 rename renamed_t1',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_events=\'connect,query\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select 1, 2, 3',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t2 values (1), (2)',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t2',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t_doesnt_exist',ID @@ -329,6 +337,7 @@ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'/*comment*/ select 2',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u1 IDENTIFIED BY *****',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'GRANT ALL ON sa_db TO u2 IDENTIFIED BY *****',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1 = PASSWORD(*****)',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1=<secret>',ID TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_events=\'\'',0 diff --git a/mysql-test/suite/plugins/r/thread_pool_server_audit.result b/mysql-test/suite/plugins/r/thread_pool_server_audit.result new file mode 100644 index 00000000000..bf71e518f97 --- /dev/null +++ b/mysql-test/suite/plugins/r/thread_pool_server_audit.result @@ -0,0 +1,367 @@ +install plugin server_audit soname 'server_audit'; +show variables like 'server_audit%'; +Variable_name Value +server_audit_events +server_audit_excl_users +server_audit_file_path server_audit.log +server_audit_file_rotate_now OFF +server_audit_file_rotate_size 1000000 +server_audit_file_rotations 9 +server_audit_incl_users +server_audit_logging OFF +server_audit_mode 0 +server_audit_output_type file +server_audit_query_log_limit 1024 +server_audit_syslog_facility LOG_USER +server_audit_syslog_ident mysql-server_auditing +server_audit_syslog_info +server_audit_syslog_priority LOG_INFO +set global server_audit_file_path=null; +set global server_audit_incl_users=null; +set global server_audit_file_path='server_audit.log'; +set global server_audit_output_type=file; +set global server_audit_logging=on; +connect(localhost,no_such_user,,mysql,MASTER_PORT,MASTER_SOCKET); +ERROR 28000: Access denied for user 'no_such_user'@'localhost' (using password: NO) +set global server_audit_incl_users='odin, dva, tri'; +create table t1 (id int); +set global server_audit_incl_users='odin, root, dva, tri'; +create table t2 (id int); +set global server_audit_excl_users='odin, dva, tri'; +Warnings: +Warning 1 User 'odin' is in the server_audit_incl_users, so wasn't added. +Warning 1 User 'dva' is in the server_audit_incl_users, so wasn't added. +Warning 1 User 'tri' is in the server_audit_incl_users, so wasn't added. +insert into t1 values (1), (2); +select * from t1; +id +1 +2 +set global server_audit_incl_users='odin, root, dva, tri'; +insert into t2 values (1), (2); +select * from t2; +id +1 +2 +alter table t1 rename renamed_t1; +set global server_audit_events='connect,query'; +select 1, +2, +3; +1 2 3 +1 2 3 +insert into t2 values (1), (2); +select * from t2; +id +1 +2 +1 +2 +select * from t_doesnt_exist; +ERROR 42S02: Table 'test.t_doesnt_exist' doesn't exist +syntax_error_query; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'syntax_error_query' at line 1 +drop table renamed_t1, t2; +show variables like 'server_audit%'; +Variable_name Value +server_audit_events CONNECT,QUERY +server_audit_excl_users +server_audit_file_path server_audit.log +server_audit_file_rotate_now OFF +server_audit_file_rotate_size 1000000 +server_audit_file_rotations 9 +server_audit_incl_users odin, root, dva, tri +server_audit_logging ON +server_audit_mode 0 +server_audit_output_type file +server_audit_query_log_limit 1024 +server_audit_syslog_facility LOG_USER +server_audit_syslog_ident mysql-server_auditing +server_audit_syslog_info +server_audit_syslog_priority LOG_INFO +set global server_audit_mode=1; +set global server_audit_events=''; +create database sa_db; +create table t1 (id2 int); +insert into t1 values (1), (2); +select * from t1; +id2 +1 +2 +drop table t1; +use sa_db; +create table sa_t1(id int); +insert into sa_t1 values (1), (2); +drop table sa_t1; +drop database sa_db; +create database sa_db; +use sa_db; +CREATE USER u1 IDENTIFIED BY 'pwd-123'; +GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; +SET PASSWORD FOR u1 = PASSWORD('pwd 098'); +CREATE USER u3 IDENTIFIED BY ''; +drop user u1, u2, u3; +set global server_audit_events='query_ddl'; +create table t1(id int); +insert into t1 values (1), (2); +select * from t1; +id +1 +2 +select 2; +2 +2 +(select 2); +2 +2 +/*! select 2*/; +2 +2 +/*comment*/ select 2; +2 +2 +drop table t1; +set global server_audit_events='query_ddl,query_dml'; +create table t1(id int); +insert into t1 values (1), (2); +select * from t1; +id +1 +2 +select 2; +2 +2 +drop table t1; +set global server_audit_events='query_dml'; +create table t1(id int); +insert into t1 values (1), (2); +select * from t1; +id +1 +2 +select 2; +2 +2 +(select 2); +2 +2 +/*! select 2*/; +2 +2 +/*comment*/ select 2; +2 +2 +drop table t1; +set global server_audit_events='query_dcl'; +create table t1(id int); +insert into t1 values (1), (2); +select * from t1; +id +1 +2 +CREATE USER u1 IDENTIFIED BY 'pwd-123'; +GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; +SET PASSWORD FOR u1 = PASSWORD('pwd 098'); +SET PASSWORD FOR u1=<secret>; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '=<secret>' at line 1 +CREATE USER u3 IDENTIFIED BY ''; +drop user u1, u2, u3; +select 2; +2 +2 +(select 2); +2 +2 +/*! select 2*/; +2 +2 +/*comment*/ select 2; +2 +2 +drop table t1; +set global server_audit_events=''; +set global server_audit_query_log_limit= 15; +select (1), (2), (3), (4); +1 2 3 4 +1 2 3 4 +select 'A', 'B', 'C', 'D'; +A B C D +A B C D +set global server_audit_query_log_limit= 1024; +drop database sa_db; +set global server_audit_file_path='.'; +show status like 'server_audit_current_log'; +Variable_name Value +Server_audit_current_log HOME_DIR/server_audit.log +set global server_audit_file_path=''; +show status like 'server_audit_current_log'; +Variable_name Value +Server_audit_current_log server_audit.log +set global server_audit_file_path=' '; +show status like 'server_audit_current_log'; +Variable_name Value +Server_audit_current_log server_audit.log +set global server_audit_file_path='nonexisting_dir/'; +Warnings: +Warning 1 SERVER AUDIT plugin can't create file 'nonexisting_dir/'. +show status like 'server_audit_current_log'; +Variable_name Value +Server_audit_current_log server_audit.log +show variables like 'server_audit%'; +Variable_name Value +server_audit_events +server_audit_excl_users +server_audit_file_path +server_audit_file_rotate_now OFF +server_audit_file_rotate_size 1000000 +server_audit_file_rotations 9 +server_audit_incl_users odin, root, dva, tri +server_audit_logging ON +server_audit_mode 1 +server_audit_output_type file +server_audit_query_log_limit 1024 +server_audit_syslog_facility LOG_USER +server_audit_syslog_ident mysql-server_auditing +server_audit_syslog_info +server_audit_syslog_priority LOG_INFO +uninstall plugin server_audit; +Warnings: +Warning 1620 Plugin is busy and will be uninstalled on shutdown +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_logging=on',0 +TIME,HOSTNAME,root,localhost,ID,0,CONNECT,mysql,,0 +TIME,HOSTNAME,root,localhost,ID,0,DISCONNECT,mysql,,0 +TIME,HOSTNAME,no_such_user,localhost,ID,0,FAILED_CONNECT,,,ID +TIME,HOSTNAME,no_such_user,localhost,ID,0,DISCONNECT,,,0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_incl_users=\'odin, root, dva, tri\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,CREATE,test,t2, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create table t2 (id int)',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_excl_users=\'odin, dva, tri\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'SHOW WARNINGS',0 +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,test,t1, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t1 values (1), (2)',0 +TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t1, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t1',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_incl_users=\'odin, root, dva, tri\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,test,t2, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t2 values (1), (2)',0 +TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t2, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t2',0 +TIME,HOSTNAME,root,localhost,ID,ID,ALTER,test,t1, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,table_stats, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,column_stats, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,index_stats, +TIME,HOSTNAME,root,localhost,ID,ID,RENAME,test,t1|test.renamed_t1, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'alter table t1 rename renamed_t1',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_events=\'connect,query\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select 1, 2, 3',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t2 values (1), (2)',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t2',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t_doesnt_exist',ID +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'syntax_error_query',ID +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'drop table renamed_t1, t2',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show variables like \'server_audit%\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_mode=1',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_events=\'\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create database sa_db',0 +TIME,HOSTNAME,root,localhost,ID,0,CONNECT,test,,0 +TIME,HOSTNAME,root,localhost,ID,ID,CREATE,test,t1, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create table t1 (id2 int)',0 +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,test,t1, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t1 values (1), (2)',0 +TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t1, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t1',0 +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,table_stats, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,column_stats, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,index_stats, +TIME,HOSTNAME,root,localhost,ID,ID,DROP,test,t1, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'drop table t1',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'use sa_db',0 +TIME,HOSTNAME,root,localhost,ID,ID,CREATE,sa_db,sa_t1, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table sa_t1(id int)',0 +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,sa_db,sa_t1, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into sa_t1 values (1), (2)',0 +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,table_stats, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,column_stats, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,index_stats, +TIME,HOSTNAME,root,localhost,ID,ID,DROP,sa_db,sa_t1, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop table sa_t1',0 +TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,proc, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proc, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,event, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop database sa_db',0 +TIME,HOSTNAME,root,localhost,ID,0,DISCONNECT,sa_db,,0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create database sa_db',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'use sa_db',0 +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u1 IDENTIFIED BY *****',0 +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'GRANT ALL ON sa_db TO u2 IDENTIFIED BY *****',0 +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1 = PASSWORD(*****)',0 +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0 +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table t1(id int)',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop table t1',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table t1(id int)',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into t1 values (1), (2)',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select * from t1',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select 2',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop table t1',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into t1 values (1), (2)',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select * from t1',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select 2',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'(select 2)',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'/*! select 2*/',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'/*comment*/ select 2',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u1 IDENTIFIED BY *****',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'GRANT ALL ON sa_db TO u2 IDENTIFIED BY *****',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1 = PASSWORD(*****)',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1=<secret>',ID +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_events=\'\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global serv',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select (1), (2)',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select \'A\', ',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_query_log_limit= 1024',0 +TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,proc, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proc, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,event, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop database sa_db',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'.\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'.\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\' \'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\' \'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'nonexisting_dir/\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'nonexisting_dir/\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SHOW WARNINGS',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show variables like \'server_audit%\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,plugin, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'uninstall plugin server_audit',0 diff --git a/mysql-test/suite/plugins/t/server_audit.test b/mysql-test/suite/plugins/t/server_audit.test index 787861d3327..52428909c3b 100644 --- a/mysql-test/suite/plugins/t/server_audit.test +++ b/mysql-test/suite/plugins/t/server_audit.test @@ -13,6 +13,7 @@ set global server_audit_incl_users=null; set global server_audit_file_path='server_audit.log'; set global server_audit_output_type=file; set global server_audit_logging=on; +--sleep 2 connect (con1,localhost,root,,mysql); connection default; disconnect con1; @@ -35,6 +36,9 @@ insert into t2 values (1), (2); select * from t2; alter table t1 rename renamed_t1; set global server_audit_events='connect,query'; +select 1, + 2, + 3; insert into t2 values (1), (2); select * from t2; --error ER_NO_SUCH_TABLE @@ -103,6 +107,8 @@ select * from t1; CREATE USER u1 IDENTIFIED BY 'pwd-123'; GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; SET PASSWORD FOR u1 = PASSWORD('pwd 098'); +--error 1064 +SET PASSWORD FOR u1=<secret>; CREATE USER u3 IDENTIFIED BY ''; drop user u1, u2, u3; select 2; diff --git a/mysql-test/suite/plugins/t/thread_pool_server_audit.opt b/mysql-test/suite/plugins/t/thread_pool_server_audit.opt new file mode 100644 index 00000000000..30953d0c574 --- /dev/null +++ b/mysql-test/suite/plugins/t/thread_pool_server_audit.opt @@ -0,0 +1,2 @@ +--thread_handling=pool-of-threads + diff --git a/mysql-test/suite/plugins/t/thread_pool_server_audit.test b/mysql-test/suite/plugins/t/thread_pool_server_audit.test new file mode 100644 index 00000000000..626d4136c47 --- /dev/null +++ b/mysql-test/suite/plugins/t/thread_pool_server_audit.test @@ -0,0 +1,144 @@ +--source include/not_embedded.inc +--source include/have_pool_of_threads.inc + +if (!$SERVER_AUDIT_SO) { + skip No SERVER_AUDIT plugin; +} + +install plugin server_audit soname 'server_audit'; + +show variables like 'server_audit%'; +set global server_audit_file_path=null; +set global server_audit_incl_users=null; +set global server_audit_file_path='server_audit.log'; +set global server_audit_output_type=file; +set global server_audit_logging=on; +--sleep 2 +connect (con1,localhost,root,,mysql); +connection default; +disconnect con1; +--sleep 2 +--sleep 2 +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +--error ER_ACCESS_DENIED_ERROR +connect (con1,localhost,no_such_user,,mysql); +connection default; +--sleep 2 +set global server_audit_incl_users='odin, dva, tri'; +create table t1 (id int); +set global server_audit_incl_users='odin, root, dva, tri'; +create table t2 (id int); +set global server_audit_excl_users='odin, dva, tri'; +insert into t1 values (1), (2); +select * from t1; +set global server_audit_incl_users='odin, root, dva, tri'; +insert into t2 values (1), (2); +select * from t2; +alter table t1 rename renamed_t1; +set global server_audit_events='connect,query'; +select 1, + 2, + 3; +insert into t2 values (1), (2); +select * from t2; +--error ER_NO_SUCH_TABLE +select * from t_doesnt_exist; +--error 1064 +syntax_error_query; +drop table renamed_t1, t2; +show variables like 'server_audit%'; +set global server_audit_mode=1; +set global server_audit_events=''; +create database sa_db; +--sleep 2 +connect (con1,localhost,root,,test); +connection con1; +--sleep 2 +--sleep 2 +create table t1 (id2 int); +insert into t1 values (1), (2); +select * from t1; +drop table t1; +use sa_db; +create table sa_t1(id int); +insert into sa_t1 values (1), (2); +drop table sa_t1; +drop database sa_db; +connection default; +disconnect con1; +--sleep 2 +--sleep 2 +create database sa_db; +use sa_db; +CREATE USER u1 IDENTIFIED BY 'pwd-123'; +GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; +SET PASSWORD FOR u1 = PASSWORD('pwd 098'); +CREATE USER u3 IDENTIFIED BY ''; +drop user u1, u2, u3; + +set global server_audit_events='query_ddl'; +create table t1(id int); +insert into t1 values (1), (2); +select * from t1; +select 2; +(select 2); +/*! select 2*/; +/*comment*/ select 2; +drop table t1; +set global server_audit_events='query_ddl,query_dml'; +create table t1(id int); +insert into t1 values (1), (2); +select * from t1; +select 2; +drop table t1; +set global server_audit_events='query_dml'; +create table t1(id int); +insert into t1 values (1), (2); +select * from t1; +select 2; +(select 2); +/*! select 2*/; +/*comment*/ select 2; +drop table t1; +set global server_audit_events='query_dcl'; +create table t1(id int); +insert into t1 values (1), (2); +select * from t1; +CREATE USER u1 IDENTIFIED BY 'pwd-123'; +GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; +SET PASSWORD FOR u1 = PASSWORD('pwd 098'); +--error 1064 +SET PASSWORD FOR u1=<secret>; +CREATE USER u3 IDENTIFIED BY ''; +drop user u1, u2, u3; +select 2; +(select 2); +/*! select 2*/; +/*comment*/ select 2; +drop table t1; +set global server_audit_events=''; + +set global server_audit_query_log_limit= 15; +select (1), (2), (3), (4); +select 'A', 'B', 'C', 'D'; +set global server_audit_query_log_limit= 1024; +drop database sa_db; + +set global server_audit_file_path='.'; +--replace_regex /\.[\\\/]/HOME_DIR\// +show status like 'server_audit_current_log'; +set global server_audit_file_path=''; +show status like 'server_audit_current_log'; +set global server_audit_file_path=' '; +show status like 'server_audit_current_log'; +set global server_audit_file_path='nonexisting_dir/'; +show status like 'server_audit_current_log'; +show variables like 'server_audit%'; +uninstall plugin server_audit; + +let $MYSQLD_DATADIR= `SELECT @@datadir`; +# replace the timestamp and the hostname with constant values +--replace_regex /[0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9]\,[^,]*\,/TIME,HOSTNAME,/ /\,[1-9][0-9]*\,/,1,/ /\,[1-9][0-9]*/,ID/ +cat_file $MYSQLD_DATADIR/server_audit.log; +remove_file $MYSQLD_DATADIR/server_audit.log; + diff --git a/mysql-test/suite/rpl/r/rpl_old_decimal.result b/mysql-test/suite/rpl/r/rpl_old_decimal.result new file mode 100644 index 00000000000..3e2fa3bf241 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_old_decimal.result @@ -0,0 +1,9 @@ +include/master-slave.inc +[connection master] +CREATE TABLE t1dec102 (a DECIMAL(10,2)); +INSERT INTO t1dec102 VALUES(999.99); +call mtr.add_suppression("Slave SQL.*Column 0 of table .* cannot be converted from type.* Error_code: 1677"); +include/wait_for_slave_sql_error_and_skip.inc [errno=1677] +Last_SQL_Error = 'Column 0 of table 'test.t1dec102' cannot be converted from type 'decimal(0,?)/*old*/' to type 'decimal(10,2)'' +DROP TABLE t1dec102; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result b/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result index 550b3f596e5..0264c9421fc 100644 --- a/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result +++ b/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result @@ -182,6 +182,11 @@ DROP USER test_3@localhost; ERROR HY000: Table 'user' was not locked with LOCK TABLES INSERT INTO t2 VALUES ("DROP USER test_3@localhost with table locked"); UNLOCK TABLE; +CREATE DATABASE db; +CREATE TABLE db.t1 LIKE t2; +CREATE TABLE t3 LIKE t2; +DROP TABLE t3; +DROP DATABASE db; DROP USER test_3@localhost; DROP FUNCTION f2; DROP PROCEDURE p2; diff --git a/mysql-test/suite/rpl/t/rpl_old_decimal.test b/mysql-test/suite/rpl/t/rpl_old_decimal.test new file mode 100644 index 00000000000..79fd2754079 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_old_decimal.test @@ -0,0 +1,25 @@ +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + + +--connection slave +CREATE TABLE t1dec102 (a DECIMAL(10,2)); + +--connection master +let $MYSQLD_DATADIR= `select @@datadir`; + +--copy_file std_data/old_decimal/t1dec102.frm $MYSQLD_DATADIR/test/t1dec102.frm +--copy_file std_data/old_decimal/t1dec102.MYD $MYSQLD_DATADIR/test/t1dec102.MYD +--copy_file std_data/old_decimal/t1dec102.MYI $MYSQLD_DATADIR/test/t1dec102.MYI +INSERT INTO t1dec102 VALUES(999.99); + +--let $slave_sql_errno=1677 +--let $show_slave_sql_error= 1 +call mtr.add_suppression("Slave SQL.*Column 0 of table .* cannot be converted from type.* Error_code: 1677"); +--source include/wait_for_slave_sql_error_and_skip.inc + +--connection master +DROP TABLE t1dec102; +--sync_slave_with_master + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test b/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test index e9cc098857e..bc4119f332f 100644 --- a/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test +++ b/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test @@ -150,6 +150,16 @@ DROP USER test_3@localhost; INSERT INTO t2 VALUES ("DROP USER test_3@localhost with table locked"); UNLOCK TABLE; + +# Bug #20439913 CREATE TABLE DB.TABLE LIKE TMPTABLE IS +# BINLOGGED INCORRECTLY - BREAKS A SLAVE +CREATE DATABASE db; +CREATE TABLE db.t1 LIKE t2; +CREATE TABLE t3 LIKE t2; +DROP TABLE t3; +DROP DATABASE db; +# end of Bug #20439913 test + DROP USER test_3@localhost; DROP FUNCTION f2; DROP PROCEDURE p2; diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test index f988292b21e..11634e1e0c7 100644 --- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test @@ -2,11 +2,6 @@ # This is a debug variable for now -- source include/have_debug.inc -if (`select plugin_auth_version <= "5.6.10" from information_schema.plugins where plugin_name='innodb'`) -{ - --skip Not fixed in InnoDB 5.6.10 or earlier -} - SELECT @@global.innodb_buffer_pool_evict; SET GLOBAL innodb_buffer_pool_evict = 'uncompressed'; diff --git a/mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test b/mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test index 782fb475140..85ae2358db5 100644 --- a/mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test @@ -1,8 +1,3 @@ -if (`select plugin_auth_version <= "5.5.37-MariaDB-34.0" from information_schema.plugins where plugin_name='innodb'`) -{ - --skip Not fixed in XtraDB as of 5.5.37-MariaDB-34.0 or earlier -} - # # 2010-01-27 - Added # diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 28e5852b4c1..fcd19c112e9 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1636,6 +1636,22 @@ SET NAMES utf8 COLLATE utf8_general_ci; --source include/ctype_utf8_ilseq.inc --echo # +--echo # MDEV-8067 correct fix for MySQL Bug # 19699237: UNINITIALIZED VARIABLE IN ITEM_FIELD::STR_RESULT +--echo # +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8); +CREATE TABLE t2 (a VARCHAR(10) CHARACTER SET latin1); +INSERT INTO t1 VALUES ('aaa'); +INSERT INTO t2 VALUES ('aaa'); +SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2); +INSERT INTO t1 VALUES ('aaa'); +INSERT INTO t2 VALUES ('aaa'); +# Running the below query crashed with two rows +--error ER_SUBQUERY_NO_1_ROW +SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2); +DROP TABLE t1, t2; + + +--echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/dyncol.test b/mysql-test/t/dyncol.test index 65a94dcb49e..86dcee8148a 100644 --- a/mysql-test/t/dyncol.test +++ b/mysql-test/t/dyncol.test @@ -657,6 +657,13 @@ SELECT select column_get(column_create(1, "18446744073709552001" as char), 1 as int); --echo # +--echo # MDEV-7505 - Too large scale in DECIMAL dynamic column getter crashes +--echo # mysqld +--echo # +--error ER_TOO_BIG_SCALE +SELECT COLUMN_GET(`x`, 'y' AS DECIMAL(5,34)); + +--echo # --echo # test of symbolic names --echo # --echo # creation test (names) diff --git a/mysql-test/t/empty_server_name-8224.test b/mysql-test/t/empty_server_name-8224.test new file mode 100644 index 00000000000..528bce5dac5 --- /dev/null +++ b/mysql-test/t/empty_server_name-8224.test @@ -0,0 +1,9 @@ +# +# MDEV-8224 Server crashes in get_server_from_table_to_cache on empty name +# +--source include/not_embedded.inc +create server '' foreign data wrapper w2 options (host '127.0.0.1'); +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--shutdown_server 10 +--source include/wait_until_disconnected.inc +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index dfb7f28ab28..4b992faa306 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1522,7 +1522,7 @@ DROP TABLE t1; create table t1 (a int, b int); insert into t1 values (1,11), (1,12), (2,22),(2,23), (4,44),(4,45); create table t2 (c int, d int); -insert into t2 values (1,11), (1,12), (2,22),(2,23), (4,44),(4,45); +insert into t2 values (1,11), (2,22), (4,44); select distinct a,sum(b), (select d from t2 where c=a order by max(b) limit 1) from t1 group by a order by max(b); drop table t1, t2; diff --git a/mysql-test/t/information_schema2.test b/mysql-test/t/information_schema2.test index c2479087f47..d577cdc1e4d 100644 --- a/mysql-test/t/information_schema2.test +++ b/mysql-test/t/information_schema2.test @@ -7,3 +7,16 @@ select variable_name from information_schema.session_status where variable_name select variable_name from information_schema.session_variables where variable_name = (select variable_name from information_schema.session_variables where variable_name = 'basedir'); +# +# information_schema tables inside subqueries, they should not be re-populated +# (i_s.columns needs to scan i_s itself, creating a tmp table for every i_s +# table. if it's re-populated, it'll do that multiple times) +# +create table t1 (a char); +insert t1 values ('a'),('t'),('z'); +flush status; +select a, exists (select 1 from information_schema.columns where table_schema=concat('tes',a)) from t1; +# fix the result in ps-protocol +--replace_result 44 43 +show status like 'created_tmp_tables'; +drop table t1; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 6c9371eed25..9ac49a9063d 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1751,6 +1751,16 @@ CHECK TABLE t1; DROP TABLE t1; +--echo # +--echo # MDEV-3870 - Valgrind warnings on OPTIMIZE MyISAM or Aria TABLE with +--echo # disabled keys +--echo # +CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (4),(3),(1),(0); +ALTER TABLE t1 DISABLE KEYS; +OPTIMIZE TABLE t1; +DROP TABLE t1; + # # Check some variables # diff --git a/mysql-test/t/mysql_tzinfo_to_sql_symlink.test b/mysql-test/t/mysql_tzinfo_to_sql_symlink.test index 1ba4e91be3c..8ca82b87e30 100644 --- a/mysql-test/t/mysql_tzinfo_to_sql_symlink.test +++ b/mysql-test/t/mysql_tzinfo_to_sql_symlink.test @@ -37,3 +37,14 @@ # --exec rm -rf $MYSQLTEST_VARDIR/zoneinfo + +--echo # +--echo # MDEV-6236 - [PATCH] mysql_tzinfo_to_sql may produce invalid SQL +--echo # +--exec mkdir $MYSQLTEST_VARDIR/zoneinfo +--copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/Factory + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>&1 + +--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo diff --git a/mysql-test/t/mysql_upgrade_view.test b/mysql-test/t/mysql_upgrade_view.test index 3ecf66d70a5..7a098aa701b 100644 --- a/mysql-test/t/mysql_upgrade_view.test +++ b/mysql-test/t/mysql_upgrade_view.test @@ -8,6 +8,35 @@ drop view if exists t1,v1,v2,v3,v4,v1badcheck; create table t1(a int); create table kv(k varchar(30) NOT NULL PRIMARY KEY,v varchar(50)); +create view v1 as select 1; + +repair table t1 quick; +repair table t1 extended; +repair table t1 use_frm; +--error ER_PARSE_ERROR +repair table t1 from mysql; + +--error ER_PARSE_ERROR +repair view v1 quick; +--error ER_PARSE_ERROR +repair view v1 extended; +--error ER_PARSE_ERROR +repair view v1 use_frm; +repair view v1 from mysql; + +--error ER_PARSE_ERROR +check view v1 quick; +--error ER_PARSE_ERROR +check view v1 fast; +--error ER_PARSE_ERROR +check view v1 medium; +--error ER_PARSE_ERROR +check view v1 extended; +--error ER_PARSE_ERROR +check view v1 changed; +check view v1 for upgrade; + +drop view v1; let $MYSQLD_DATADIR= `select @@datadir`; diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test index e2733089f18..6cd0265f89a 100644 --- a/mysql-test/t/mysqlcheck.test +++ b/mysql-test/t/mysqlcheck.test @@ -8,6 +8,7 @@ call mtr.add_suppression("Invalid .old.. table or database name"); # check that CSV engine was compiled in, as the result of the test # depends on the presence of the log tables (which are CSV-based). --source include/have_csv.inc +let $MYSQLD_DATADIR= `select @@datadir`; # # Clean up after previous tests @@ -66,7 +67,6 @@ create table t_bug25347 (a int) engine=myisam; create view v_bug25347 as select * from t_bug25347; insert into t_bug25347 values (1),(2),(3); flush tables; -let $MYSQLD_DATADIR= `select @@datadir`; --echo removing and creating --remove_file $MYSQLD_DATADIR/d_bug25347/t_bug25347.MYI --write_file $MYSQLD_DATADIR/d_bug25347/t_bug25347.MYI @@ -119,7 +119,6 @@ DROP TABLE t1, t2; create table t1(a int) engine=myisam; create view v1 as select * from t1; show tables; -let $MYSQLD_DATADIR= `select @@datadir`; --copy_file $MYSQLD_DATADIR/test/v1.frm $MYSQLD_DATADIR/test/v-1.frm show tables; --exec $MYSQL_CHECK --check-upgrade --databases test @@ -164,24 +163,23 @@ CREATE TABLE `#mysql50#c@d` (a INT) engine=myisam; CREATE TABLE t1 (a INT) engine=myisam; # Create 5.0 like triggers -let $MYSQLTEST_VARDIR= `select @@datadir`; ---write_file $MYSQLTEST_VARDIR/a@b/c@d.TRG +--write_file $MYSQLD_DATADIR/a@b/c@d.TRG TYPE=TRIGGERS triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON `c@d` FOR EACH ROW SET NEW.a = 10 * NEW.a' sql_modes=0 definers='root@localhost' EOF ---write_file $MYSQLTEST_VARDIR/a@b/tr1.TRN +--write_file $MYSQLD_DATADIR/a@b/tr1.TRN TYPE=TRIGGERNAME trigger_table=c@d EOF ---write_file $MYSQLTEST_VARDIR/a@b/t1.TRG +--write_file $MYSQLD_DATADIR/a@b/t1.TRG TYPE=TRIGGERS triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr2 BEFORE INSERT ON `a@b`.t1 FOR EACH ROW SET NEW.a = 100 * NEW.a' sql_modes=0 definers='root@localhost' EOF ---write_file $MYSQLTEST_VARDIR/a@b/tr2.TRN +--write_file $MYSQLD_DATADIR/a@b/tr2.TRN TYPE=TRIGGERNAME trigger_table=t1 EOF @@ -255,7 +253,6 @@ INSERT INTO bug47205 VALUES ("foobar"); FLUSH TABLE bug47205; --echo # Replace the FRM with a 5.0 FRM that will require upgrade -let $MYSQLD_DATADIR= `select @@datadir`; --remove_file $MYSQLD_DATADIR/test/bug47205.frm --copy_file std_data/bug47205.frm $MYSQLD_DATADIR/test/bug47205.frm @@ -279,7 +276,6 @@ CREATE TABLE bug47205(a VARCHAR(20) PRIMARY KEY) FLUSH TABLE bug47205; --echo # Replace the FRM with a 5.0 FRM that will require upgrade -let $MYSQLD_DATADIR= `select @@datadir`; --remove_file $MYSQLD_DATADIR/test/bug47205.frm --copy_file std_data/bug47205.frm $MYSQLD_DATADIR/test/bug47205.frm @@ -322,3 +318,34 @@ CREATE TABLE test.`t.1` (id int); --exec $MYSQL_CHECK test t.1 drop table test.`t.1`; + +# +# MDEV-8123 mysqlcheck: new --process-views option conflicts with --quick, --extended and such +# +create view v1 as select 1; +--echo mysqlcheck --process-views test +--exec $MYSQL_CHECK --process-views test +--echo mysqlcheck --process-views --extended test +--exec $MYSQL_CHECK --process-views --extended test +--echo mysqlcheck --process-views --fast test +--exec $MYSQL_CHECK --process-views --fast test +--echo mysqlcheck --process-views --quick test +--exec $MYSQL_CHECK --process-views --quick test +--echo mysqlcheck --process-views --check-only-changed test +--exec $MYSQL_CHECK --process-views --check-only-changed test +--echo mysqlcheck --process-views --medium-check test +--exec $MYSQL_CHECK --process-views --medium-check test +--echo mysqlcheck --process-views --check-upgrade test +--exec $MYSQL_CHECK --process-views --check-upgrade test +drop view v1; + + +# +# MDEV-8124 mysqlcheck: --auto-repair runs REPAIR TABLE instead of REPAIR VIEW on views +# +create table t1(a int); +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1.frm $MYSQLD_DATADIR/test/v1.frm +--echo mysqlcheck --process-views --check-upgrade --auto-repair test +--exec $MYSQL_CHECK --process-views --check-upgrade --auto-repair test +drop view v1; +drop table t1; diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test index a74e95ab65b..af140611c91 100644 --- a/mysql-test/t/partition_innodb.test +++ b/mysql-test/t/partition_innodb.test @@ -1,3 +1,7 @@ +if (`select plugin_auth_version <= "5.6.24" from information_schema.plugins where plugin_name='innodb'`) +{ + --skip Not fixed in InnoDB as of 5.6.24 or earlier +} --source include/not_embedded.inc --source include/have_partition.inc --source include/have_innodb.inc @@ -403,7 +407,7 @@ DROP TABLE t1; create table t1 (a int) engine=innodb partition by hash(a) ; # Data_free for InnoDB tablespace varies depending on which # tests have been run before this one ---replace_column 10 # +--replace_column 10 # 12 # show table status like 't1'; drop table t1; @@ -415,12 +419,12 @@ engine = innodb partition by key (a); # Data_free for InnoDB tablespace varies depending on which # tests have been run before this one ---replace_column 10 # +--replace_column 10 # 12 # show table status; insert into t1 values (0), (1), (2), (3); # Data_free for InnoDB tablespace varies depending on which # tests have been run before this one ---replace_column 10 # +--replace_column 10 # 12 # show table status; drop table t1; @@ -429,17 +433,17 @@ engine = innodb partition by key (a); # Data_free for InnoDB tablespace varies depending on which # tests have been run before this one ---replace_column 10 # +--replace_column 10 # 12 # show table status; insert into t1 values (NULL), (NULL), (NULL), (NULL); # Data_free for InnoDB tablespace varies depending on which # tests have been run before this one ---replace_column 10 # +--replace_column 10 # 12 # show table status; insert into t1 values (NULL), (NULL), (NULL), (NULL); # Data_free for InnoDB tablespace varies depending on which # tests have been run before this one ---replace_column 10 # +--replace_column 10 # 12 # show table status; drop table t1; @@ -675,6 +679,18 @@ ALTER TABLE t1 ADD UNIQUE KEY (b); SHOW CREATE TABLE t1; SELECT * FROM t1; DROP TABLE t1; +--echo # +--echo # Bug #17299181 CREATE_TIME AND UPDATE_TIME ARE +--echo # WRONG FOR PARTITIONED TABLES +--echo # + +CREATE TABLE t1 (a int, PRIMARY KEY (a)) ENGINE=InnoDB +PARTITION BY HASH (a) PARTITIONS 2; + +SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE +CREATE_TIME IS NOT NULL AND TABLE_NAME='t1'; + +DROP TABLE t1; --echo # --echo # BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET == diff --git a/mysql-test/t/range_innodb.test b/mysql-test/t/range_innodb.test new file mode 100644 index 00000000000..f76794814ef --- /dev/null +++ b/mysql-test/t/range_innodb.test @@ -0,0 +1,47 @@ +--echo # +--echo # Range optimizer (and related) tests that need InnoDB. +--echo # + +--source include/have_innodb.inc + +--disable_warnings +drop table if exists t0, t1, t2; +--enable_warnings + +--echo # +--echo # MDEV-6735: Range checked for each record used with key +--echo # + +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 + D.a * 1000 +from t0 A, t0 B, t0 C, t0 D; + +create table t2 ( + a int, + b int, + filler1 char(100), + filler2 char(100), + filler3 char(100), + filler4 char(100), + key(a), + key(b) +) engine=innodb; + +insert into t2 +select + a,a, + repeat('0123456789', 10), + repeat('0123456789', 10), + repeat('0123456789', 10), + repeat('0123456789', 10) +from t1; + +analyze table t2; +--echo # The following must not use "Range checked for each record": +explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250; + +drop table t0,t1,t2; + diff --git a/mysql-test/t/ssl_7937.combinations b/mysql-test/t/ssl_7937.combinations new file mode 100644 index 00000000000..46a45686a9b --- /dev/null +++ b/mysql-test/t/ssl_7937.combinations @@ -0,0 +1,5 @@ +[ssl] +--loose-enable-ssl + +[nossl] +--loose-disable-ssl diff --git a/mysql-test/t/ssl_7937.test b/mysql-test/t/ssl_7937.test new file mode 100644 index 00000000000..d593b9d936d --- /dev/null +++ b/mysql-test/t/ssl_7937.test @@ -0,0 +1,35 @@ +# +# MDEV-7937: Enforce SSL when --ssl client option is used +# + +source include/have_ssl_crypto_functs.inc; + +# create a procedure instead of SHOW STATUS LIKE 'ssl_cipher' +# because the cipher depends on openssl (or yassl) version, +# and it's actual value doesn't matter here anyway +create procedure have_ssl() + select if(variable_value > '','yes','no') as 'have_ssl' + from information_schema.session_status + where variable_name='ssl_cipher'; + +--disable_abort_on_error +--echo mysql --ssl-ca=cacert.pem -e "call test.have_ssl()" +--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem -e "call test.have_ssl()" 2>&1 +--echo mysql --ssl -e "call test.have_ssl()" +--exec $MYSQL --ssl -e "call test.have_ssl()" 2>&1 +--echo mysql --ssl-ca=cacert.pem --ssl-verify-server-cert -e "call test.have_ssl()" +--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1 + +--echo mysql --ssl --ssl-verify-server-cert -e "call test.have_ssl()" +# this is the test where certificate verification fails. +# but yassl doesn't support certificate verification, so +# we fake the test result for yassl +let yassl=`select variable_value='Unknown' from information_schema.session_status where variable_name='Ssl_session_cache_mode'`; +if (!$yassl) { + --exec $MYSQL --ssl --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1 +} +if ($yassl) { + --echo ERROR 2026 (HY000): SSL connection error: Failed to verify the server certificate +} + +drop procedure have_ssl; diff --git a/mysql-test/t/truncate-stale-6500.test b/mysql-test/t/truncate-stale-6500.test new file mode 100644 index 00000000000..47dffb1966d --- /dev/null +++ b/mysql-test/t/truncate-stale-6500.test @@ -0,0 +1,32 @@ +--source include/have_innodb.inc +--source include/have_partition.inc + +SET GLOBAL query_cache_size=1024*1024*8; +CREATE TABLE `test` ( + `uniqueId` INT NOT NULL, + `partitionId` INT NOT NULL, + PRIMARY KEY (`uniqueId`,`partitionId`) +) ENGINE=InnoDB PARTITION BY LIST (partitionId) ( + PARTITION p01 VALUES IN (1), + PARTITION p02 VALUES IN (2) +); + + +INSERT INTO `test`(`uniqueId`,`partitionId`) VALUES(407237055, 2); + +SELECT * FROM `test`; + +--echo #Confirms 1 row in partition 'p02' +SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS FROM information_schema.PARTITIONS where TABLE_NAME = 'test'; +ALTER TABLE `test` TRUNCATE PARTITION `p02`; + +--echo #Confirms no more rows in partition 'p02' +SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS FROM information_schema.PARTITIONS where TABLE_NAME = 'test'; + +--echo #Before the patch, this returned the previously existing values. +SELECT * FROM `test`; +SELECT SQL_CACHE * FROM `test`; +SELECT SQL_NO_CACHE * FROM `test`; + +DROP TABLE test; +SET GLOBAL query_cache_size=DEFAULT; diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test index 1d4ef345747..659e75270ca 100644 --- a/mysql-test/t/type_decimal.test +++ b/mysql-test/t/type_decimal.test @@ -583,3 +583,27 @@ JOIN WHERE CONCAT(t1.col1, CAST(subq.col0 AS DECIMAL)); DROP TABLE t1, t2; + + +--echo # +--echo # Start of 5.5 tests +--echo # + +--echo # +--echo # MDEV-8267 Add /*old*/ comment into I_S.COLUMN_TYPE for old DECIMAL +--echo # + +let $MYSQLD_DATADIR= `select @@datadir`; + +--copy_file std_data/old_decimal/t1dec102.frm $MYSQLD_DATADIR/test/t1dec102.frm +--copy_file std_data/old_decimal/t1dec102.MYD $MYSQLD_DATADIR/test/t1dec102.MYD +--copy_file std_data/old_decimal/t1dec102.MYI $MYSQLD_DATADIR/test/t1dec102.MYI + +SHOW CREATE TABLE t1dec102; +SHOW COLUMNS FROM t1dec102; +SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1dec102'; +DROP TABLE t1dec102; + +--echo # +--echo # End of 5.5 tests +--echo # diff --git a/mysql-test/t/update_innodb.test b/mysql-test/t/update_innodb.test new file mode 100644 index 00000000000..67c356c4e2e --- /dev/null +++ b/mysql-test/t/update_innodb.test @@ -0,0 +1,39 @@ +--source include/have_innodb.inc + +CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` datetime DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `t2` ( + `c0` varchar(10) NOT NULL, + `c1` int(11) NOT NULL, + `c2` int(11) NOT NULL, + PRIMARY KEY (`c0`,`c1`), + KEY `c1` (`c1`), + KEY `c2` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `t3` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `c1` datetime NOT NULL, + `c2` bigint(20) NOT NULL, + `c3` int(4) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `c2` (`c2`), + KEY `c3` (`c3`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `t4` ( + `c1` int(11) NOT NULL, + `c2` bigint(20) DEFAULT NULL, + `c3` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + + CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select `t4`.`c1` AS `c1`,`t4`.`c2` AS `c2`,`t4`.`c3` AS `c3` from `t4`; + +UPDATE t1 a JOIN t2 b ON a.c1 = b.c1 JOIN v1 vw ON b.c2 = vw.c1 JOIN t3 del ON vw.c2 = del.c2 SET a.c2 = ( SELECT max(t.c1) FROM t3 t, v1 i WHERE del.c2 = t.c2 AND vw.c3 = i.c3 AND t.c3 = 4 ) WHERE a.c2 IS NULL OR a.c2 < '2011-05-01'; + +drop view v1; +drop table t1,t2,t3,t4; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 84d7da548b2..e95194e3f2c 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -5367,6 +5367,19 @@ update t3 left join v2 using (id) set flag=flag+1; drop view v2, v1; drop table t1, t2, t3; +--echo # +--echo # MDEV-7207 - ALTER VIEW does not change ALGORITM +--echo # +create table t1 (a int, b int); +create algorithm=temptable view v2 (c) as select b+1 from t1; +show create view v2; +alter algorithm=undefined view v2 (c) as select b+1 from t1; +show create view v2; +alter algorithm=merge view v2 (c) as select b+1 from t1; +show create view v2; +drop view v2; +drop table t1; + --echo # ----------------------------------------------------------------- --echo # -- End of 5.5 tests. --echo # ----------------------------------------------------------------- diff --git a/packaging/WiX/CPackWixConfig.cmake b/packaging/WiX/CPackWixConfig.cmake index c782b7cd17a..9caae8375d8 100644 --- a/packaging/WiX/CPackWixConfig.cmake +++ b/packaging/WiX/CPackWixConfig.cmake @@ -1,119 +1,119 @@ -# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-IF(ESSENTIALS)
- SET(CPACK_COMPONENTS_USED "Server;Client;DataFiles")
- SET(CPACK_WIX_UI "WixUI_InstallDir")
- IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
- SET(CPACK_PACKAGE_FILE_NAME "mysql-essential-${VERSION}-winx64")
- ELSE()
- SET(CPACK_PACKAGE_FILE_NAME "mysql-essential-${VERSION}-win32")
- ENDIF()
-ELSE()
- SET(CPACK_COMPONENTS_USED
- "Server;Client;DataFiles;Development;SharedLibraries;Documentation;IniFiles;Readme;Server_Scripts;DebugBinaries")
-ENDIF()
-
-
-# Some components like Embedded are optional
-# We will build MSI without embedded if it was not selected for build
-#(need to modify CPACK_COMPONENTS_ALL for that)
-SET(CPACK_ALL)
-FOREACH(comp1 ${CPACK_COMPONENTS_USED})
- SET(found)
- FOREACH(comp2 ${CPACK_COMPONENTS_ALL})
- IF(comp1 STREQUAL comp2)
- SET(found 1)
- BREAK()
- ENDIF()
- ENDFOREACH()
- IF(found)
- SET(CPACK_ALL ${CPACK_ALL} ${comp1})
- ENDIF()
-ENDFOREACH()
-SET(CPACK_COMPONENTS_ALL ${CPACK_ALL})
-
-# Always install (hidden), includes Readme files
-SET(CPACK_COMPONENT_GROUP_ALWAYSINSTALL_HIDDEN 1)
-SET(CPACK_COMPONENT_README_GROUP "AlwaysInstall")
-
-# Feature MySQL Server
-SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DISPLAY_NAME "MySQL Server")
-SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_EXPANDED "1")
-SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DESCRIPTION "Install MySQL Server")
- # Subfeature "Server" (hidden)
- SET(CPACK_COMPONENT_SERVER_GROUP "MySQLServer")
- SET(CPACK_COMPONENT_SERVER_HIDDEN 1)
- # Subfeature "Client"
- SET(CPACK_COMPONENT_CLIENT_GROUP "MySQLServer")
- SET(CPACK_COMPONENT_CLIENT_DISPLAY_NAME "Client Programs")
- SET(CPACK_COMPONENT_CLIENT_DESCRIPTION
- "Various helpful (commandline) tools including the mysql command line client" )
- # Subfeature "Debug binaries"
- SET(CPACK_COMPONENT_DEBUGBINARIES_GROUP "MySQLServer")
- SET(CPACK_COMPONENT_DEBUGBINARIES_DISPLAY_NAME "Debug binaries")
- SET(CPACK_COMPONENT_DEBUGBINARIES_DESCRIPTION
- "Debug/trace versions of executables and libraries" )
- #SET(CPACK_COMPONENT_DEBUGBINARIES_WIX_LEVEL 2)
-
-
- #Subfeature "Data Files"
- SET(CPACK_COMPONENT_DATAFILES_GROUP "MySQLServer")
- SET(CPACK_COMPONENT_DATAFILES_DISPLAY_NAME "Server data files")
- SET(CPACK_COMPONENT_DATAFILES_DESCRIPTION "Server data files" )
- SET(CPACK_COMPONENT_DATAFILES_HIDDEN 1)
-
-
-#Feature "Devel"
-SET(CPACK_COMPONENT_GROUP_DEVEL_DISPLAY_NAME "Development Components")
-SET(CPACK_COMPONENT_GROUP_DEVEL_DESCRIPTION "Installs C/C++ header files and libraries")
- #Subfeature "Development"
- SET(CPACK_COMPONENT_DEVELOPMENT_GROUP "Devel")
- SET(CPACK_COMPONENT_DEVELOPMENT_HIDDEN 1)
-
- #Subfeature "Shared libraries"
- SET(CPACK_COMPONENT_SHAREDLIBRARIES_GROUP "Devel")
- SET(CPACK_COMPONENT_SHAREDLIBRARIES_DISPLAY_NAME "Client C API library (shared)")
- SET(CPACK_COMPONENT_SHAREDLIBRARIES_DESCRIPTION "Installs shared client library")
-
- #Subfeature "Embedded"
- SET(CPACK_COMPONENT_EMBEDDED_GROUP "Devel")
- SET(CPACK_COMPONENT_EMBEDDED_DISPLAY_NAME "Embedded server library")
- SET(CPACK_COMPONENT_EMBEDDED_DESCRIPTION "Installs embedded server library")
- SET(CPACK_COMPONENT_EMBEDDED_WIX_LEVEL 2)
-
-#Feature Debug Symbols
-SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_DISPLAY_NAME "Debug Symbols")
-SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_DESCRIPTION "Installs Debug Symbols")
-SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_WIX_LEVEL 2)
- SET(CPACK_COMPONENT_DEBUGINFO_GROUP "DebugSymbols")
- SET(CPACK_COMPONENT_DEBUGINFO_HIDDEN 1)
-
-#Feature Documentation
-SET(CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "Documentation")
-SET(CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION "Installs documentation")
-SET(CPACK_COMPONENT_DOCUMENTATION_WIX_LEVEL 2)
-
-#Feature tests
-SET(CPACK_COMPONENT_TEST_DISPLAY_NAME "Tests")
-SET(CPACK_COMPONENT_TEST_DESCRIPTION "Installs unittests (requires Perl to run)")
-SET(CPACK_COMPONENT_TEST_WIX_LEVEL 2)
-
-
-#Feature Misc (hidden, installs only if everything is installed)
-SET(CPACK_COMPONENT_GROUP_MISC_HIDDEN 1)
-SET(CPACK_COMPONENT_GROUP_MISC_WIX_LEVEL 100)
- SET(CPACK_COMPONENT_INIFILES_GROUP "Misc")
- SET(CPACK_COMPONENT_SERVER_SCRIPTS_GROUP "Misc")
+# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +IF(ESSENTIALS) + SET(CPACK_COMPONENTS_USED "Server;Client;DataFiles") + SET(CPACK_WIX_UI "WixUI_InstallDir") + IF(CMAKE_SIZEOF_VOID_P MATCHES 8) + SET(CPACK_PACKAGE_FILE_NAME "mysql-essential-${VERSION}-winx64") + ELSE() + SET(CPACK_PACKAGE_FILE_NAME "mysql-essential-${VERSION}-win32") + ENDIF() +ELSE() + SET(CPACK_COMPONENTS_USED + "Server;Client;DataFiles;Development;SharedLibraries;Documentation;IniFiles;Readme;Server_Scripts;DebugBinaries") +ENDIF() + + +# Some components like Embedded are optional +# We will build MSI without embedded if it was not selected for build +#(need to modify CPACK_COMPONENTS_ALL for that) +SET(CPACK_ALL) +FOREACH(comp1 ${CPACK_COMPONENTS_USED}) + SET(found) + FOREACH(comp2 ${CPACK_COMPONENTS_ALL}) + IF(comp1 STREQUAL comp2) + SET(found 1) + BREAK() + ENDIF() + ENDFOREACH() + IF(found) + SET(CPACK_ALL ${CPACK_ALL} ${comp1}) + ENDIF() +ENDFOREACH() +SET(CPACK_COMPONENTS_ALL ${CPACK_ALL}) + +# Always install (hidden), includes Readme files +SET(CPACK_COMPONENT_GROUP_ALWAYSINSTALL_HIDDEN 1) +SET(CPACK_COMPONENT_README_GROUP "AlwaysInstall") + +# Feature MySQL Server +SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DISPLAY_NAME "MySQL Server") +SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_EXPANDED "1") +SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DESCRIPTION "Install MySQL Server") + # Subfeature "Server" (hidden) + SET(CPACK_COMPONENT_SERVER_GROUP "MySQLServer") + SET(CPACK_COMPONENT_SERVER_HIDDEN 1) + # Subfeature "Client" + SET(CPACK_COMPONENT_CLIENT_GROUP "MySQLServer") + SET(CPACK_COMPONENT_CLIENT_DISPLAY_NAME "Client Programs") + SET(CPACK_COMPONENT_CLIENT_DESCRIPTION + "Various helpful (commandline) tools including the mysql command line client" ) + # Subfeature "Debug binaries" + SET(CPACK_COMPONENT_DEBUGBINARIES_GROUP "MySQLServer") + SET(CPACK_COMPONENT_DEBUGBINARIES_DISPLAY_NAME "Debug binaries") + SET(CPACK_COMPONENT_DEBUGBINARIES_DESCRIPTION + "Debug/trace versions of executables and libraries" ) + #SET(CPACK_COMPONENT_DEBUGBINARIES_WIX_LEVEL 2) + + + #Subfeature "Data Files" + SET(CPACK_COMPONENT_DATAFILES_GROUP "MySQLServer") + SET(CPACK_COMPONENT_DATAFILES_DISPLAY_NAME "Server data files") + SET(CPACK_COMPONENT_DATAFILES_DESCRIPTION "Server data files" ) + SET(CPACK_COMPONENT_DATAFILES_HIDDEN 1) + + +#Feature "Devel" +SET(CPACK_COMPONENT_GROUP_DEVEL_DISPLAY_NAME "Development Components") +SET(CPACK_COMPONENT_GROUP_DEVEL_DESCRIPTION "Installs C/C++ header files and libraries") + #Subfeature "Development" + SET(CPACK_COMPONENT_DEVELOPMENT_GROUP "Devel") + SET(CPACK_COMPONENT_DEVELOPMENT_HIDDEN 1) + + #Subfeature "Shared libraries" + SET(CPACK_COMPONENT_SHAREDLIBRARIES_GROUP "Devel") + SET(CPACK_COMPONENT_SHAREDLIBRARIES_DISPLAY_NAME "Client C API library (shared)") + SET(CPACK_COMPONENT_SHAREDLIBRARIES_DESCRIPTION "Installs shared client library") + + #Subfeature "Embedded" + SET(CPACK_COMPONENT_EMBEDDED_GROUP "Devel") + SET(CPACK_COMPONENT_EMBEDDED_DISPLAY_NAME "Embedded server library") + SET(CPACK_COMPONENT_EMBEDDED_DESCRIPTION "Installs embedded server library") + SET(CPACK_COMPONENT_EMBEDDED_WIX_LEVEL 2) + +#Feature Debug Symbols +SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_DISPLAY_NAME "Debug Symbols") +SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_DESCRIPTION "Installs Debug Symbols") +SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_WIX_LEVEL 2) + SET(CPACK_COMPONENT_DEBUGINFO_GROUP "DebugSymbols") + SET(CPACK_COMPONENT_DEBUGINFO_HIDDEN 1) + +#Feature Documentation +SET(CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "Documentation") +SET(CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION "Installs documentation") +SET(CPACK_COMPONENT_DOCUMENTATION_WIX_LEVEL 2) + +#Feature tests +SET(CPACK_COMPONENT_TEST_DISPLAY_NAME "Tests") +SET(CPACK_COMPONENT_TEST_DESCRIPTION "Installs unittests (requires Perl to run)") +SET(CPACK_COMPONENT_TEST_WIX_LEVEL 2) + + +#Feature Misc (hidden, installs only if everything is installed) +SET(CPACK_COMPONENT_GROUP_MISC_HIDDEN 1) +SET(CPACK_COMPONENT_GROUP_MISC_WIX_LEVEL 100) + SET(CPACK_COMPONENT_INIFILES_GROUP "Misc") + SET(CPACK_COMPONENT_SERVER_SCRIPTS_GROUP "Misc") diff --git a/packaging/WiX/create_msi.cmake.in b/packaging/WiX/create_msi.cmake.in index 8de271fc1cf..d0a8f0046cf 100644 --- a/packaging/WiX/create_msi.cmake.in +++ b/packaging/WiX/create_msi.cmake.in @@ -1,398 +1,398 @@ -# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@")
-SET(CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
-SET(CANDLE_EXECUTABLE "@CANDLE_EXECUTABLE@")
-SET(LIGHT_EXECUTABLE "@LIGHT_EXECUTABLE@")
-SET(CMAKE_COMMAND "@CMAKE_COMMAND@")
-SET(CMAKE_CFG_INTDIR "@CMAKE_CFG_INTDIR@")
-SET(VERSION "@VERSION@")
-SET(MAJOR_VERSION "@MAJOR_VERSION@")
-SET(MINOR_VERSION "@MINOR_VERSION@")
-SET(PATCH_VERSION "@PATCH_VERSION@")
-SET(CMAKE_SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@)
-SET(MANUFACTURER "@MANUFACTURER@")
-SET(WIXCA_LOCATION "@WIXCA_LOCATION@")
-SET(COPYING_RTF "@COPYING_RTF@")
-SET(CPACK_WIX_CONFIG "@CPACK_WIX_CONFIG@")
-SET(CPACK_WIX_INCLUDE "@CPACK_WIX_INCLUDE@")
-
-LIST(APPEND EXCLUDE_DIRS
- bin/debug
- data/test
- lib/plugin/debug
- mysql-test
- scripts
- sql-bench
-)
-
-LIST(APPEND EXCLUDE_FILES
- bin/echo.exe
- bin/mysql_client_test_embedded.exe
- bin/mysqld-debug.exe
- bin/mysqltest_embedded.exe
- bin/replace.exe
- lib/debug/mysqlserver.lib
- lib/libmysqld.dll
- lib/libmysqld.lib
- lib/mysqlserver.lib
- lib/mysqlservices.lib
-)
-
-IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
- SET(Win64 " Win64='yes'")
- SET(Platform x64)
- SET(PlatformProgramFilesFolder ProgramFiles64Folder)
-ELSE()
- SET(Platform x86)
- SET(PlatformProgramFilesFolder ProgramFilesFolder)
- SET(Win64)
-ENDIF()
-
-SET(ENV{VS_UNICODE_OUTPUT})
-
-# Switch off the monolithic install
-EXECUTE_PROCESS(
- COMMAND ${CMAKE_COMMAND} -DCPACK_MONOLITHIC_INSTALL=0 ${CMAKE_BINARY_DIR}
- OUTPUT_QUIET
-)
-
-INCLUDE(${CMAKE_BINARY_DIR}/CPackConfig.cmake)
-
-IF(CPACK_WIX_CONFIG)
- INCLUDE(${CPACK_WIX_CONFIG})
-ENDIF()
-
-IF(NOT CPACK_WIX_UI)
- SET(CPACK_WIX_UI "WixUI_Mondo_Custom")
-ENDIF()
-
-SET(WIX_FEATURES)
-FOREACH(comp ${CPACK_COMPONENTS_ALL})
- STRING(TOUPPER "${comp}" comp_upper)
- IF(NOT CPACK_COMPONENT_${comp_upper}_GROUP)
- SET(WIX_FEATURE_${comp_upper}_COMPONENTS "${comp}")
- SET(CPACK_COMPONENT_${comp_upper}_HIDDEN 1)
- SET(CPACK_COMPONENT_GROUP_${comp_upper}_DISPLAY_NAME ${CPACK_COMPONENT_${comp_upper}_DISPLAY_NAME})
- SET(CPACK_COMPONENT_GROUP_${comp_upper}_DESCRIPTION ${CPACK_COMPONENT_${comp_upper}_DESCRIPTION})
- SET(CPACK_COMPONENT_GROUP_${comp_upper}_WIX_LEVEL ${CPACK_COMPONENT_${comp_upper}_WIX_LEVEL})
- SET(WIX_FEATURES ${WIX_FEATURES} WIX_FEATURE_${comp_upper})
- ELSE()
- SET(FEATURE_NAME WIX_FEATURE_${CPACK_COMPONENT_${comp_upper}_GROUP})
- SET(WIX_FEATURES ${WIX_FEATURES} ${FEATURE_NAME})
- LIST(APPEND ${FEATURE_NAME}_COMPONENTS ${comp})
- ENDIF()
-ENDFOREACH()
-
-LIST(REMOVE_DUPLICATES WIX_FEATURES)
-
-SET(CPACK_WIX_FEATURES)
-
-FOREACH(f ${WIX_FEATURES})
- STRING(TOUPPER "${f}" f_upper)
- STRING(REPLACE "WIX_FEATURE_" "" f_upper ${f_upper})
- IF (CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
- SET(TITLE ${CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME})
- ELSE()
- SET(TITLE CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
- ENDIF()
-
- IF (CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
- SET(DESCRIPTION ${CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION})
- ELSE()
- SET(DESCRIPTION CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
- ENDIF()
- IF(CPACK_COMPONENT_${f_upper}_WIX_LEVEL)
- SET(Level ${CPACK_COMPONENT_${f_upper}_WIX_LEVEL})
- ELSE()
- SET(Level 1)
- ENDIF()
- IF(CPACK_COMPONENT_GROUP_${f_upper}_HIDDEN)
- SET(DISPLAY "Display='hidden'")
- SET(TITLE ${f_upper})
- SET(DESCRIPTION ${f_upper})
- ELSE()
- SET(DISPLAY)
- IF(CPACK_COMPONENT_GROUP_${f_upper}_EXPANDED)
- SET(DISPLAY "Display='expand'")
- ENDIF()
- IF (CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
- SET(TITLE ${CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME})
- ELSE()
- SET(TITLE CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
- ENDIF()
- IF (CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
- SET(DESCRIPTION ${CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION})
- ELSE()
- SET(DESCRIPTION CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
- ENDIF()
- ENDIF()
-
- SET(CPACK_WIX_FEATURES
- "${CPACK_WIX_FEATURES}
- <Feature Id='${f_upper}'
- Title='${TITLE}'
- Description='${DESCRIPTION}'
- ConfigurableDirectory='INSTALLDIR'
- Level='${Level}' ${DISPLAY} >"
- )
- FOREACH(c ${${f}_COMPONENTS})
- STRING(TOUPPER "${c}" c_upper)
- IF (CPACK_COMPONENT_${c_upper}_DISPLAY_NAME)
- SET(TITLE ${CPACK_COMPONENT_${c_upper}_DISPLAY_NAME})
- ELSE()
- SET(TITLE CPACK_COMPONENT_${c_upper}_DISPLAY_NAME)
- ENDIF()
-
- IF (CPACK_COMPONENT_${c_upper}_DESCRIPTION)
- SET(DESCRIPTION ${CPACK_COMPONENT_${c_upper}_DESCRIPTION})
- ELSE()
- SET(DESCRIPTION CPACK_COMPONENT_${c_upper}_DESCRIPTION)
- ENDIF()
- IF(CPACK_COMPONENT_${c_upper}_WIX_LEVEL)
- SET(Level ${CPACK_COMPONENT_${c_upper}_WIX_LEVEL})
- ELSE()
- SET(Level 1)
- ENDIF()
- IF(CPACK_COMPONENT_${c_upper}_HIDDEN)
- SET(CPACK_WIX_FEATURES
- "${CPACK_WIX_FEATURES}
- <ComponentGroupRef Id='componentgroup.${c}'/>")
- ELSE()
- SET(CPACK_WIX_FEATURES
- "${CPACK_WIX_FEATURES}
- <Feature Id='${c}'
- Title='${TITLE}'
- Description='${DESCRIPTION}'
- ConfigurableDirectory='INSTALLDIR'
- Level='${Level}'>
- <ComponentGroupRef Id='componentgroup.${c}'/>
- </Feature>")
- ENDIF()
-
- ENDFOREACH()
- SET(CPACK_WIX_FEATURES
- "${CPACK_WIX_FEATURES}
- </Feature>
- ")
-ENDFOREACH()
-
-
-IF(CMAKE_INSTALL_CONFIG_NAME)
- STRING(REPLACE "${CMAKE_CFG_INTDIR}" "${CMAKE_INSTALL_CONFIG_NAME}"
- WIXCA_LOCATION "${WIXCA_LOCATION}")
- SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_INSTALL_CONFIG_NAME}")
-ENDIF()
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_server.wxs.in
- ${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs)
-
-
-FOREACH(comp ${CPACK_COMPONENTS_ALL})
- SET(ENV{DESTDIR} testinstall/${comp})
- SET(DIRS ${DIRS} testinstall/${comp})
- EXECUTE_PROCESS(
- COMMAND ${CMAKE_COMMAND} ${CONFIG_PARAM} -DCMAKE_INSTALL_COMPONENT=${comp}
- -DCMAKE_INSTALL_PREFIX= -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
- OUTPUT_QUIET
- )
-ENDFOREACH()
-
-MACRO(GENERATE_GUID VarName)
- EXECUTE_PROCESS(COMMAND uuidgen -c
- OUTPUT_VARIABLE ${VarName}
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-ENDMACRO()
-
-SET(INC_VAR 0)
-MACRO(MAKE_WIX_IDENTIFIER str varname)
- STRING(REPLACE "/" "." ${varname} "${str}")
- STRING(REGEX REPLACE "[^a-zA-Z_0-9.]" "_" ${varname} "${${varname}}")
- STRING(LENGTH "${${varname}}" len)
- # Identifier should be smaller than 72 character
- # We have to cut down the length to 70 chars, since we add 2 char prefix
- # pretty often
- IF(len GREATER 70)
- STRING(SUBSTRING "${${varname}}" 0 67 shortstr)
- MATH(EXPR INC_VAR ${INC_VAR}+1)
- SET(${varname} "${shortstr}${INC_VAR}")
- ENDIF()
-ENDMACRO()
-
-
-FUNCTION(TRAVERSE_FILES dir topdir file file_comp dir_root)
- FILE(RELATIVE_PATH dir_rel ${topdir} ${dir})
- IF(dir_rel)
- LIST(FIND EXCLUDE_DIRS ${dir_rel} TO_EXCLUDE)
- IF(NOT TO_EXCLUDE EQUAL -1)
- MESSAGE(STATUS "excluding directory: ${dir_rel}")
- RETURN()
- ENDIF()
- ENDIF()
- FILE(GLOB all_files ${dir}/*)
- IF(NOT all_files)
- RETURN()
- ENDIF()
- IF(dir_rel)
- MAKE_DIRECTORY(${dir_root}/${dir_rel})
- MAKE_WIX_IDENTIFIER("${dir_rel}" id)
- SET(DirectoryRefId "D.${id}")
- ELSE()
- SET(DirectoryRefId "INSTALLDIR")
- ENDIF()
- FILE(APPEND ${file} "<DirectoryRef Id='${DirectoryRefId}'>\n")
-
- SET(NONEXEFILES)
- FOREACH(f ${all_files})
- IF(NOT IS_DIRECTORY ${f})
- FILE(RELATIVE_PATH rel ${topdir} ${f})
- SET(TO_EXCLUDE)
- IF(rel MATCHES "\\.pdb$")
- SET(TO_EXCLUDE TRUE)
- ELSE()
- LIST(FIND EXCLUDE_FILES ${rel} RES)
- IF(NOT RES EQUAL -1)
- SET(TO_EXCLUDE TRUE)
- ENDIF()
- ENDIF()
- IF(TO_EXCLUDE)
- MESSAGE(STATUS "excluding file: ${rel}")
- ELSE()
- MAKE_WIX_IDENTIFIER("${rel}" id)
- FILE(TO_NATIVE_PATH ${f} f_native)
- GET_FILENAME_COMPONENT(f_ext "${f}" EXT)
- # According to MSDN each DLL or EXE should be in the own component
- IF(f_ext MATCHES ".exe" OR f_ext MATCHES ".dll")
-
- FILE(APPEND ${file} " <Component Id='C.${id}' Guid='*' ${Win64}>\n")
- FILE(APPEND ${file} " <File Id='F.${id}' KeyPath='yes' Source='${f_native}'/>\n")
- FILE(APPEND ${file} " </Component>\n")
- FILE(APPEND ${file_comp} " <ComponentRef Id='C.${id}'/>\n")
- ELSE()
- SET(NONEXEFILES "${NONEXEFILES}\n<File Id='F.${id}' Source='${f_native}'/>" )
- ENDIF()
- ENDIF()
- ENDIF()
- ENDFOREACH()
- FILE(APPEND ${file} "</DirectoryRef>\n")
- IF(NONEXEFILES)
- GENERATE_GUID(guid)
- SET(ComponentId "C._files_${COMP_NAME}.${DirectoryRefId}")
- FILE(APPEND ${file}
- "<DirectoryRef Id='${DirectoryRefId}'>\n<Component Guid='${guid}' Id='${ComponentId}' ${Win64}>${NONEXEFILES}\n</Component></DirectoryRef>\n")
- FILE(APPEND ${file_comp} " <ComponentRef Id='${ComponentId}'/>\n")
- ENDIF()
- FOREACH(f ${all_files})
- IF(IS_DIRECTORY ${f})
- TRAVERSE_FILES(${f} ${topdir} ${file} ${file_comp} ${dir_root})
- ENDIF()
- ENDFOREACH()
-ENDFUNCTION()
-
-FUNCTION(TRAVERSE_DIRECTORIES dir topdir file prefix)
- FILE(RELATIVE_PATH rel ${topdir} ${dir})
- IF(rel)
- MAKE_WIX_IDENTIFIER("${rel}" id)
- GET_FILENAME_COMPONENT(name ${dir} NAME)
- FILE(APPEND ${file} "${prefix}<Directory Id='D.${id}' Name='${name}'>\n")
- ENDIF()
- FILE(GLOB all_files ${dir}/*)
- FOREACH(f ${all_files})
- IF(IS_DIRECTORY ${f})
- TRAVERSE_DIRECTORIES(${f} ${topdir} ${file} "${prefix} ")
- ENDIF()
- ENDFOREACH()
- IF(rel)
- FILE(APPEND ${file} "${prefix}</Directory>\n")
- ENDIF()
-ENDFUNCTION()
-
-SET(CPACK_WIX_COMPONENTS)
-SET(CPACK_WIX_COMPONENT_GROUPS)
-GET_FILENAME_COMPONENT(abs . ABSOLUTE)
-FOREACH(d ${DIRS})
- GET_FILENAME_COMPONENT(d ${d} ABSOLUTE)
- GET_FILENAME_COMPONENT(d_name ${d} NAME)
- FILE(WRITE ${abs}/${d_name}_component_group.wxs "<ComponentGroup Id='componentgroup.${d_name}'>")
- SET(COMP_NAME ${d_name})
- TRAVERSE_FILES(${d} ${d} ${abs}/${d_name}.wxs ${abs}/${d_name}_component_group.wxs "${abs}/dirs")
- FILE(APPEND ${abs}/${d_name}_component_group.wxs "</ComponentGroup>")
- IF(EXISTS ${d_name}.wxs)
- FILE(READ ${d_name}.wxs WIX_TMP)
- SET(CPACK_WIX_COMPONENTS "${CPACK_WIX_COMPONENTS}\n${WIX_TMP}")
- FILE(REMOVE ${d_name}.wxs)
- ENDIF()
-
- FILE(READ ${d_name}_component_group.wxs WIX_TMP)
-
- SET(CPACK_WIX_COMPONENT_GROUPS "${CPACK_WIX_COMPONENT_GROUPS}\n${WIX_TMP}")
- FILE(REMOVE ${d_name}_component_group.wxs)
-ENDFOREACH()
-
-FILE(WRITE directories.wxs "<DirectoryRef Id='INSTALLDIR'>\n")
-TRAVERSE_DIRECTORIES(${abs}/dirs ${abs}/dirs directories.wxs "")
-FILE(APPEND directories.wxs "</DirectoryRef>\n")
-
-FILE(READ directories.wxs CPACK_WIX_DIRECTORIES)
-FILE(REMOVE directories.wxs)
-
-
-FOREACH(src ${CPACK_WIX_INCLUDE})
-SET(CPACK_WIX_INCLUDES
-"${CPACK_WIX_INCLUDES}
- <?include ${src}?>"
-)
-ENDFOREACH()
-
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_server.wxs.in
- ${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs)
-
-SET(EXTRA_CANDLE_ARGS)
-IF("$ENV{EXTRA_CANDLE_ARGS}")
- SET(EXTRA_CANDLE_ARGS "$ENV{EXTRA_CANDLE_ARGS}")
-ENDIF()
-
-SET(EXTRA_LIGHT_ARGS)
-IF("$ENV{EXTRA_LIGHT_ARGS}")
- SET(EXTRA_LIGHT_ARGS "$ENV{EXTRA_LIGHT_ARGS}")
-ENDIF()
-
-FILE(REMOVE mysql_server.wixobj)
-EXECUTE_PROCESS(
- COMMAND ${CANDLE_EXECUTABLE} -ext WixUtilExtension mysql_server.wxs ${EXTRA_CANDLE_ARGS}
- RESULT_VARIABLE CANDLE_RESULT
-)
-
-IF(CANDLE_RESULT)
- MESSAGE(FATAL_ERROR "ERROR: can't run candle")
-ENDIF()
-
-EXECUTE_PROCESS(
- COMMAND ${LIGHT_EXECUTABLE} -ext WixUIExtension -ext WixUtilExtension
- mysql_server.wixobj -out ${CPACK_PACKAGE_FILE_NAME}.msi
- ${EXTRA_LIGHT_ARGS}
- RESULT_VARIABLE LIGHT_RESULT
-)
-
-IF(LIGHT_RESULT)
- MESSAGE(FATAL_ERROR "ERROR: can't run light")
-ENDIF()
-
-# Switch monolithic install on again
-EXECUTE_PROCESS(
- COMMAND ${CMAKE_COMMAND} -DCPACK_MONOLITHIC_INSTALL=1 ${CMAKE_BINARY_DIR}
-)
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@") +SET(CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@") +SET(CANDLE_EXECUTABLE "@CANDLE_EXECUTABLE@") +SET(LIGHT_EXECUTABLE "@LIGHT_EXECUTABLE@") +SET(CMAKE_COMMAND "@CMAKE_COMMAND@") +SET(CMAKE_CFG_INTDIR "@CMAKE_CFG_INTDIR@") +SET(VERSION "@VERSION@") +SET(MAJOR_VERSION "@MAJOR_VERSION@") +SET(MINOR_VERSION "@MINOR_VERSION@") +SET(PATCH_VERSION "@PATCH_VERSION@") +SET(CMAKE_SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@) +SET(MANUFACTURER "@MANUFACTURER@") +SET(WIXCA_LOCATION "@WIXCA_LOCATION@") +SET(COPYING_RTF "@COPYING_RTF@") +SET(CPACK_WIX_CONFIG "@CPACK_WIX_CONFIG@") +SET(CPACK_WIX_INCLUDE "@CPACK_WIX_INCLUDE@") + +LIST(APPEND EXCLUDE_DIRS + bin/debug + data/test + lib/plugin/debug + mysql-test + scripts + sql-bench +) + +LIST(APPEND EXCLUDE_FILES + bin/echo.exe + bin/mysql_client_test_embedded.exe + bin/mysqld-debug.exe + bin/mysqltest_embedded.exe + bin/replace.exe + lib/debug/mysqlserver.lib + lib/libmysqld.dll + lib/libmysqld.lib + lib/mysqlserver.lib + lib/mysqlservices.lib +) + +IF(CMAKE_SIZEOF_VOID_P EQUAL 8) + SET(Win64 " Win64='yes'") + SET(Platform x64) + SET(PlatformProgramFilesFolder ProgramFiles64Folder) +ELSE() + SET(Platform x86) + SET(PlatformProgramFilesFolder ProgramFilesFolder) + SET(Win64) +ENDIF() + +SET(ENV{VS_UNICODE_OUTPUT}) + +# Switch off the monolithic install +EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -DCPACK_MONOLITHIC_INSTALL=0 ${CMAKE_BINARY_DIR} + OUTPUT_QUIET +) + +INCLUDE(${CMAKE_BINARY_DIR}/CPackConfig.cmake) + +IF(CPACK_WIX_CONFIG) + INCLUDE(${CPACK_WIX_CONFIG}) +ENDIF() + +IF(NOT CPACK_WIX_UI) + SET(CPACK_WIX_UI "WixUI_Mondo_Custom") +ENDIF() + +SET(WIX_FEATURES) +FOREACH(comp ${CPACK_COMPONENTS_ALL}) + STRING(TOUPPER "${comp}" comp_upper) + IF(NOT CPACK_COMPONENT_${comp_upper}_GROUP) + SET(WIX_FEATURE_${comp_upper}_COMPONENTS "${comp}") + SET(CPACK_COMPONENT_${comp_upper}_HIDDEN 1) + SET(CPACK_COMPONENT_GROUP_${comp_upper}_DISPLAY_NAME ${CPACK_COMPONENT_${comp_upper}_DISPLAY_NAME}) + SET(CPACK_COMPONENT_GROUP_${comp_upper}_DESCRIPTION ${CPACK_COMPONENT_${comp_upper}_DESCRIPTION}) + SET(CPACK_COMPONENT_GROUP_${comp_upper}_WIX_LEVEL ${CPACK_COMPONENT_${comp_upper}_WIX_LEVEL}) + SET(WIX_FEATURES ${WIX_FEATURES} WIX_FEATURE_${comp_upper}) + ELSE() + SET(FEATURE_NAME WIX_FEATURE_${CPACK_COMPONENT_${comp_upper}_GROUP}) + SET(WIX_FEATURES ${WIX_FEATURES} ${FEATURE_NAME}) + LIST(APPEND ${FEATURE_NAME}_COMPONENTS ${comp}) + ENDIF() +ENDFOREACH() + +LIST(REMOVE_DUPLICATES WIX_FEATURES) + +SET(CPACK_WIX_FEATURES) + +FOREACH(f ${WIX_FEATURES}) + STRING(TOUPPER "${f}" f_upper) + STRING(REPLACE "WIX_FEATURE_" "" f_upper ${f_upper}) + IF (CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME) + SET(TITLE ${CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME}) + ELSE() + SET(TITLE CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME) + ENDIF() + + IF (CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION) + SET(DESCRIPTION ${CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION}) + ELSE() + SET(DESCRIPTION CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION) + ENDIF() + IF(CPACK_COMPONENT_${f_upper}_WIX_LEVEL) + SET(Level ${CPACK_COMPONENT_${f_upper}_WIX_LEVEL}) + ELSE() + SET(Level 1) + ENDIF() + IF(CPACK_COMPONENT_GROUP_${f_upper}_HIDDEN) + SET(DISPLAY "Display='hidden'") + SET(TITLE ${f_upper}) + SET(DESCRIPTION ${f_upper}) + ELSE() + SET(DISPLAY) + IF(CPACK_COMPONENT_GROUP_${f_upper}_EXPANDED) + SET(DISPLAY "Display='expand'") + ENDIF() + IF (CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME) + SET(TITLE ${CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME}) + ELSE() + SET(TITLE CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME) + ENDIF() + IF (CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION) + SET(DESCRIPTION ${CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION}) + ELSE() + SET(DESCRIPTION CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION) + ENDIF() + ENDIF() + + SET(CPACK_WIX_FEATURES + "${CPACK_WIX_FEATURES} + <Feature Id='${f_upper}' + Title='${TITLE}' + Description='${DESCRIPTION}' + ConfigurableDirectory='INSTALLDIR' + Level='${Level}' ${DISPLAY} >" + ) + FOREACH(c ${${f}_COMPONENTS}) + STRING(TOUPPER "${c}" c_upper) + IF (CPACK_COMPONENT_${c_upper}_DISPLAY_NAME) + SET(TITLE ${CPACK_COMPONENT_${c_upper}_DISPLAY_NAME}) + ELSE() + SET(TITLE CPACK_COMPONENT_${c_upper}_DISPLAY_NAME) + ENDIF() + + IF (CPACK_COMPONENT_${c_upper}_DESCRIPTION) + SET(DESCRIPTION ${CPACK_COMPONENT_${c_upper}_DESCRIPTION}) + ELSE() + SET(DESCRIPTION CPACK_COMPONENT_${c_upper}_DESCRIPTION) + ENDIF() + IF(CPACK_COMPONENT_${c_upper}_WIX_LEVEL) + SET(Level ${CPACK_COMPONENT_${c_upper}_WIX_LEVEL}) + ELSE() + SET(Level 1) + ENDIF() + IF(CPACK_COMPONENT_${c_upper}_HIDDEN) + SET(CPACK_WIX_FEATURES + "${CPACK_WIX_FEATURES} + <ComponentGroupRef Id='componentgroup.${c}'/>") + ELSE() + SET(CPACK_WIX_FEATURES + "${CPACK_WIX_FEATURES} + <Feature Id='${c}' + Title='${TITLE}' + Description='${DESCRIPTION}' + ConfigurableDirectory='INSTALLDIR' + Level='${Level}'> + <ComponentGroupRef Id='componentgroup.${c}'/> + </Feature>") + ENDIF() + + ENDFOREACH() + SET(CPACK_WIX_FEATURES + "${CPACK_WIX_FEATURES} + </Feature> + ") +ENDFOREACH() + + +IF(CMAKE_INSTALL_CONFIG_NAME) + STRING(REPLACE "${CMAKE_CFG_INTDIR}" "${CMAKE_INSTALL_CONFIG_NAME}" + WIXCA_LOCATION "${WIXCA_LOCATION}") + SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_INSTALL_CONFIG_NAME}") +ENDIF() + +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_server.wxs.in + ${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs) + + +FOREACH(comp ${CPACK_COMPONENTS_ALL}) + SET(ENV{DESTDIR} testinstall/${comp}) + SET(DIRS ${DIRS} testinstall/${comp}) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} ${CONFIG_PARAM} -DCMAKE_INSTALL_COMPONENT=${comp} + -DCMAKE_INSTALL_PREFIX= -P ${CMAKE_BINARY_DIR}/cmake_install.cmake + OUTPUT_QUIET + ) +ENDFOREACH() + +MACRO(GENERATE_GUID VarName) + EXECUTE_PROCESS(COMMAND uuidgen -c + OUTPUT_VARIABLE ${VarName} + OUTPUT_STRIP_TRAILING_WHITESPACE) +ENDMACRO() + +SET(INC_VAR 0) +MACRO(MAKE_WIX_IDENTIFIER str varname) + STRING(REPLACE "/" "." ${varname} "${str}") + STRING(REGEX REPLACE "[^a-zA-Z_0-9.]" "_" ${varname} "${${varname}}") + STRING(LENGTH "${${varname}}" len) + # Identifier should be smaller than 72 character + # We have to cut down the length to 70 chars, since we add 2 char prefix + # pretty often + IF(len GREATER 70) + STRING(SUBSTRING "${${varname}}" 0 67 shortstr) + MATH(EXPR INC_VAR ${INC_VAR}+1) + SET(${varname} "${shortstr}${INC_VAR}") + ENDIF() +ENDMACRO() + + +FUNCTION(TRAVERSE_FILES dir topdir file file_comp dir_root) + FILE(RELATIVE_PATH dir_rel ${topdir} ${dir}) + IF(dir_rel) + LIST(FIND EXCLUDE_DIRS ${dir_rel} TO_EXCLUDE) + IF(NOT TO_EXCLUDE EQUAL -1) + MESSAGE(STATUS "excluding directory: ${dir_rel}") + RETURN() + ENDIF() + ENDIF() + FILE(GLOB all_files ${dir}/*) + IF(NOT all_files) + RETURN() + ENDIF() + IF(dir_rel) + MAKE_DIRECTORY(${dir_root}/${dir_rel}) + MAKE_WIX_IDENTIFIER("${dir_rel}" id) + SET(DirectoryRefId "D.${id}") + ELSE() + SET(DirectoryRefId "INSTALLDIR") + ENDIF() + FILE(APPEND ${file} "<DirectoryRef Id='${DirectoryRefId}'>\n") + + SET(NONEXEFILES) + FOREACH(f ${all_files}) + IF(NOT IS_DIRECTORY ${f}) + FILE(RELATIVE_PATH rel ${topdir} ${f}) + SET(TO_EXCLUDE) + IF(rel MATCHES "\\.pdb$") + SET(TO_EXCLUDE TRUE) + ELSE() + LIST(FIND EXCLUDE_FILES ${rel} RES) + IF(NOT RES EQUAL -1) + SET(TO_EXCLUDE TRUE) + ENDIF() + ENDIF() + IF(TO_EXCLUDE) + MESSAGE(STATUS "excluding file: ${rel}") + ELSE() + MAKE_WIX_IDENTIFIER("${rel}" id) + FILE(TO_NATIVE_PATH ${f} f_native) + GET_FILENAME_COMPONENT(f_ext "${f}" EXT) + # According to MSDN each DLL or EXE should be in the own component + IF(f_ext MATCHES ".exe" OR f_ext MATCHES ".dll") + + FILE(APPEND ${file} " <Component Id='C.${id}' Guid='*' ${Win64}>\n") + FILE(APPEND ${file} " <File Id='F.${id}' KeyPath='yes' Source='${f_native}'/>\n") + FILE(APPEND ${file} " </Component>\n") + FILE(APPEND ${file_comp} " <ComponentRef Id='C.${id}'/>\n") + ELSE() + SET(NONEXEFILES "${NONEXEFILES}\n<File Id='F.${id}' Source='${f_native}'/>" ) + ENDIF() + ENDIF() + ENDIF() + ENDFOREACH() + FILE(APPEND ${file} "</DirectoryRef>\n") + IF(NONEXEFILES) + GENERATE_GUID(guid) + SET(ComponentId "C._files_${COMP_NAME}.${DirectoryRefId}") + FILE(APPEND ${file} + "<DirectoryRef Id='${DirectoryRefId}'>\n<Component Guid='${guid}' Id='${ComponentId}' ${Win64}>${NONEXEFILES}\n</Component></DirectoryRef>\n") + FILE(APPEND ${file_comp} " <ComponentRef Id='${ComponentId}'/>\n") + ENDIF() + FOREACH(f ${all_files}) + IF(IS_DIRECTORY ${f}) + TRAVERSE_FILES(${f} ${topdir} ${file} ${file_comp} ${dir_root}) + ENDIF() + ENDFOREACH() +ENDFUNCTION() + +FUNCTION(TRAVERSE_DIRECTORIES dir topdir file prefix) + FILE(RELATIVE_PATH rel ${topdir} ${dir}) + IF(rel) + MAKE_WIX_IDENTIFIER("${rel}" id) + GET_FILENAME_COMPONENT(name ${dir} NAME) + FILE(APPEND ${file} "${prefix}<Directory Id='D.${id}' Name='${name}'>\n") + ENDIF() + FILE(GLOB all_files ${dir}/*) + FOREACH(f ${all_files}) + IF(IS_DIRECTORY ${f}) + TRAVERSE_DIRECTORIES(${f} ${topdir} ${file} "${prefix} ") + ENDIF() + ENDFOREACH() + IF(rel) + FILE(APPEND ${file} "${prefix}</Directory>\n") + ENDIF() +ENDFUNCTION() + +SET(CPACK_WIX_COMPONENTS) +SET(CPACK_WIX_COMPONENT_GROUPS) +GET_FILENAME_COMPONENT(abs . ABSOLUTE) +FOREACH(d ${DIRS}) + GET_FILENAME_COMPONENT(d ${d} ABSOLUTE) + GET_FILENAME_COMPONENT(d_name ${d} NAME) + FILE(WRITE ${abs}/${d_name}_component_group.wxs "<ComponentGroup Id='componentgroup.${d_name}'>") + SET(COMP_NAME ${d_name}) + TRAVERSE_FILES(${d} ${d} ${abs}/${d_name}.wxs ${abs}/${d_name}_component_group.wxs "${abs}/dirs") + FILE(APPEND ${abs}/${d_name}_component_group.wxs "</ComponentGroup>") + IF(EXISTS ${d_name}.wxs) + FILE(READ ${d_name}.wxs WIX_TMP) + SET(CPACK_WIX_COMPONENTS "${CPACK_WIX_COMPONENTS}\n${WIX_TMP}") + FILE(REMOVE ${d_name}.wxs) + ENDIF() + + FILE(READ ${d_name}_component_group.wxs WIX_TMP) + + SET(CPACK_WIX_COMPONENT_GROUPS "${CPACK_WIX_COMPONENT_GROUPS}\n${WIX_TMP}") + FILE(REMOVE ${d_name}_component_group.wxs) +ENDFOREACH() + +FILE(WRITE directories.wxs "<DirectoryRef Id='INSTALLDIR'>\n") +TRAVERSE_DIRECTORIES(${abs}/dirs ${abs}/dirs directories.wxs "") +FILE(APPEND directories.wxs "</DirectoryRef>\n") + +FILE(READ directories.wxs CPACK_WIX_DIRECTORIES) +FILE(REMOVE directories.wxs) + + +FOREACH(src ${CPACK_WIX_INCLUDE}) +SET(CPACK_WIX_INCLUDES +"${CPACK_WIX_INCLUDES} + <?include ${src}?>" +) +ENDFOREACH() + + +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_server.wxs.in + ${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs) + +SET(EXTRA_CANDLE_ARGS) +IF("$ENV{EXTRA_CANDLE_ARGS}") + SET(EXTRA_CANDLE_ARGS "$ENV{EXTRA_CANDLE_ARGS}") +ENDIF() + +SET(EXTRA_LIGHT_ARGS) +IF("$ENV{EXTRA_LIGHT_ARGS}") + SET(EXTRA_LIGHT_ARGS "$ENV{EXTRA_LIGHT_ARGS}") +ENDIF() + +FILE(REMOVE mysql_server.wixobj) +EXECUTE_PROCESS( + COMMAND ${CANDLE_EXECUTABLE} -ext WixUtilExtension mysql_server.wxs ${EXTRA_CANDLE_ARGS} + RESULT_VARIABLE CANDLE_RESULT +) + +IF(CANDLE_RESULT) + MESSAGE(FATAL_ERROR "ERROR: can't run candle") +ENDIF() + +EXECUTE_PROCESS( + COMMAND ${LIGHT_EXECUTABLE} -ext WixUIExtension -ext WixUtilExtension + mysql_server.wixobj -out ${CPACK_PACKAGE_FILE_NAME}.msi + ${EXTRA_LIGHT_ARGS} + RESULT_VARIABLE LIGHT_RESULT +) + +IF(LIGHT_RESULT) + MESSAGE(FATAL_ERROR "ERROR: can't run light") +ENDIF() + +# Switch monolithic install on again +EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -DCPACK_MONOLITHIC_INSTALL=1 ${CMAKE_BINARY_DIR} +) diff --git a/packaging/WiX/custom_ui.wxs b/packaging/WiX/custom_ui.wxs index a28c3c9b8a1..0ccd30f6754 100644 --- a/packaging/WiX/custom_ui.wxs +++ b/packaging/WiX/custom_ui.wxs @@ -1,115 +1,115 @@ -<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
- xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
-
-<!--
- Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--->
-
- <UI Id="WixUI_Mondo_Custom">
- <Dialog Id="CustomWelcomeDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
- <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
- <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
- </Control>
- <Control Id="Next" Type="PushButton" X="220" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
- <Publish Event="NewDialog" Value="LicenseAgreementDlg">NOT OLDERVERSIONBEINGUPGRADED</Publish>
- <Publish Event="NewDialog" Value="UpgradeDlg">OLDERVERSIONBEINGUPGRADED</Publish>
- </Control>
- <Control Id="Back" Type="PushButton" X="156" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" Disabled="yes" />
- <Control Id="Description" Type="Text" X="135" Y="80" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgDescription)" />
- <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgTitle)" />
- <Control Id="CopyrightText" Type="Text" X="135" Y="200" Width="220" Height="40" Transparent="yes" Text="Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved." />
- <Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="!(loc.WelcomeDlgBitmap)" />
- <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
- </Dialog>
-
- <Dialog Id="UpgradeDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
- <Control Id="Install" Type="PushButton" ElevationShield="yes" X="212" Y="243" Width="80" Height="17" Default="yes" Text="Upgrade">
- <Publish Event="EndDialog" Value="Return"><![CDATA[OutOfDiskSpace <> 1]]></Publish>
- <Publish Event="SpawnDialog" Value="OutOfRbDiskDlg">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND (PROMPTROLLBACKCOST="P" OR NOT PROMPTROLLBACKCOST)</Publish>
- <Publish Event="EndDialog" Value="Return">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish>
- <Publish Event="EnableRollback" Value="False">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish>
- <Publish Event="SpawnDialog" Value="OutOfDiskDlg">(OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 1) OR (OutOfDiskSpace = 1 AND PROMPTROLLBACKCOST="F")</Publish>
- </Control>
- <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
- <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
- </Control>
- <Control Id="Back" Type="PushButton" X="156" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)">
- <Condition Action="default">WixUI_InstallMode = "Remove"</Condition>
- </Control>
- <Control Id="InstallTitle" Type="Text" X="15" Y="15" Width="300" Height="15" Transparent="yes" NoPrefix="yes" Hidden="yes" Text="!(loc.VerifyReadyDlgInstallTitle)">
- <Condition Action="show">NOT Installed</Condition>
- </Control>
- <Control Id="InstallText" Type="Text" X="25" Y="70" Width="320" Height="80" Hidden="yes" Text="!(loc.VerifyReadyDlgInstallText)">
- <Condition Action="show">NOT Installed</Condition>
- </Control>
- <Control Id="UpgradeText" Type="Text" X="25" Y="70" Width="320" Height="80" Hidden="no" NoPrefix="yes"
- Text="Click Upgrade to upgrade your installation from version [OLDERVERSION] to version [ProductVersion]. Click Cancel to exit the upgrade."/>
- <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.VerifyReadyDlgBannerBitmap)" />
- <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
- <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
- </Dialog>
-
- <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
- <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
- <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
-
- <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
- <Property Id="WixUI_Mode" Value="Mondo" />
-
- <DialogRef Id="ErrorDlg" />
- <DialogRef Id="FatalError" />
- <DialogRef Id="FilesInUse" />
- <DialogRef Id="MsiRMFilesInUse" />
- <DialogRef Id="PrepareDlg" />
- <DialogRef Id="ProgressDlg" />
- <DialogRef Id="ResumeDlg" />
- <DialogRef Id="UserExit" />
-
- <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
-
- <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="CustomWelcomeDlg">1</Publish>
- <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg" Order="2">LicenseAccepted = "1"</Publish>
-
- <Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
- <Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
- <Publish Dialog="SetupTypeDlg" Control="CustomButton" Event="NewDialog" Value="CustomizeDlg">1</Publish>
- <Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
-
- <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1">WixUI_InstallMode = "Change"</Publish>
- <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallCustom"</Publish>
- <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
-
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">WixUI_InstallMode = "InstallCustom"</Publish>
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish>
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="3">WixUI_InstallMode = "Change"</Publish>
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="4">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish>
-
- <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
-
- <Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" Event="NewDialog" Value="CustomizeDlg">1</Publish>
- <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
- <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
- <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
-
- <Publish Dialog="UpgradeDlg" Control="Back" Event="NewDialog" Value="CustomWelcomeDlg">1</Publish>
-
- <InstallUISequence>
- <Show Dialog="CustomWelcomeDlg" Before="ProgressDlg">NOT Installed</Show>
- </InstallUISequence>
- </UI>
-
- <UIRef Id="WixUI_Common" />
-</Include>
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi" + xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"> + +<!-- + Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +--> + + <UI Id="WixUI_Mondo_Custom"> + <Dialog Id="CustomWelcomeDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes"> + <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)"> + <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish> + </Control> + <Control Id="Next" Type="PushButton" X="220" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)"> + <Publish Event="NewDialog" Value="LicenseAgreementDlg">NOT OLDERVERSIONBEINGUPGRADED</Publish> + <Publish Event="NewDialog" Value="UpgradeDlg">OLDERVERSIONBEINGUPGRADED</Publish> + </Control> + <Control Id="Back" Type="PushButton" X="156" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" Disabled="yes" /> + <Control Id="Description" Type="Text" X="135" Y="80" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgDescription)" /> + <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgTitle)" /> + <Control Id="CopyrightText" Type="Text" X="135" Y="200" Width="220" Height="40" Transparent="yes" Text="Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved." /> + <Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="!(loc.WelcomeDlgBitmap)" /> + <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" /> + </Dialog> + + <Dialog Id="UpgradeDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes"> + <Control Id="Install" Type="PushButton" ElevationShield="yes" X="212" Y="243" Width="80" Height="17" Default="yes" Text="Upgrade"> + <Publish Event="EndDialog" Value="Return"><![CDATA[OutOfDiskSpace <> 1]]></Publish> + <Publish Event="SpawnDialog" Value="OutOfRbDiskDlg">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND (PROMPTROLLBACKCOST="P" OR NOT PROMPTROLLBACKCOST)</Publish> + <Publish Event="EndDialog" Value="Return">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish> + <Publish Event="EnableRollback" Value="False">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish> + <Publish Event="SpawnDialog" Value="OutOfDiskDlg">(OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 1) OR (OutOfDiskSpace = 1 AND PROMPTROLLBACKCOST="F")</Publish> + </Control> + <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)"> + <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish> + </Control> + <Control Id="Back" Type="PushButton" X="156" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)"> + <Condition Action="default">WixUI_InstallMode = "Remove"</Condition> + </Control> + <Control Id="InstallTitle" Type="Text" X="15" Y="15" Width="300" Height="15" Transparent="yes" NoPrefix="yes" Hidden="yes" Text="!(loc.VerifyReadyDlgInstallTitle)"> + <Condition Action="show">NOT Installed</Condition> + </Control> + <Control Id="InstallText" Type="Text" X="25" Y="70" Width="320" Height="80" Hidden="yes" Text="!(loc.VerifyReadyDlgInstallText)"> + <Condition Action="show">NOT Installed</Condition> + </Control> + <Control Id="UpgradeText" Type="Text" X="25" Y="70" Width="320" Height="80" Hidden="no" NoPrefix="yes" + Text="Click Upgrade to upgrade your installation from version [OLDERVERSION] to version [ProductVersion]. Click Cancel to exit the upgrade."/> + <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.VerifyReadyDlgBannerBitmap)" /> + <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" /> + <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" /> + </Dialog> + + <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" /> + <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" /> + <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" /> + + <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" /> + <Property Id="WixUI_Mode" Value="Mondo" /> + + <DialogRef Id="ErrorDlg" /> + <DialogRef Id="FatalError" /> + <DialogRef Id="FilesInUse" /> + <DialogRef Id="MsiRMFilesInUse" /> + <DialogRef Id="PrepareDlg" /> + <DialogRef Id="ProgressDlg" /> + <DialogRef Id="ResumeDlg" /> + <DialogRef Id="UserExit" /> + + <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish> + + <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="CustomWelcomeDlg">1</Publish> + <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg" Order="2">LicenseAccepted = "1"</Publish> + + <Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish> + <Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish> + <Publish Dialog="SetupTypeDlg" Control="CustomButton" Event="NewDialog" Value="CustomizeDlg">1</Publish> + <Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish> + + <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1">WixUI_InstallMode = "Change"</Publish> + <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallCustom"</Publish> + <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish> + + <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">WixUI_InstallMode = "InstallCustom"</Publish> + <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish> + <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="3">WixUI_InstallMode = "Change"</Publish> + <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="4">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish> + + <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish> + + <Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" Event="NewDialog" Value="CustomizeDlg">1</Publish> + <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish> + <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish> + <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish> + + <Publish Dialog="UpgradeDlg" Control="Back" Event="NewDialog" Value="CustomWelcomeDlg">1</Publish> + + <InstallUISequence> + <Show Dialog="CustomWelcomeDlg" Before="ProgressDlg">NOT Installed</Show> + </InstallUISequence> + </UI> + + <UIRef Id="WixUI_Common" /> +</Include> diff --git a/packaging/WiX/extra.wxs.in b/packaging/WiX/extra.wxs.in index 91bf3f64b8e..92a79064d54 100644 --- a/packaging/WiX/extra.wxs.in +++ b/packaging/WiX/extra.wxs.in @@ -1,81 +1,81 @@ -<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
- xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
-
-<!--
- Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--->
-
- <!-- Datafiles that installation will copy to CommonAppData (initial database)
- They are declared Permanent and NeverOverwrite since it is user data -->
- <DirectoryRef Id='TARGETDIR'>
- <Directory Id="CommonAppDataFolder">
- <Directory Id="datadir.mysql" Name="MySQL">
- <Directory Id="datadir.mysql.mysqlserver"
- Name="MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@">
- <Directory Id="DATADIR" Name=".">
- <Component Id="component.datadir" Guid="d3491319-5dbc-4477-95f3-4f809ef1dd2d">
- <CreateFolder>
- <util:PermissionEx User="[LogonUser]" GenericAll="yes" />
- </CreateFolder>
- </Component>
- <Directory Id="datadir.mysql.mysqlserver.data" Name="data">
- <Directory Id="datadir.mysql.mysqlserver.data.mysql" Name="mysql">
- <Component Id="component.datadir.mysql"
- Guid="19ec0f1f-1a7f-424e-a788-b09346c0a709"
- Permanent="yes" NeverOverwrite="yes">
- <CreateFolder>
- <util:PermissionEx User="[LogonUser]" GenericAll="yes" />
- </CreateFolder>
- @DATADIR_MYSQL_FILES@
- </Component>
- </Directory>
- <Directory Id="datadir.mysql.mysqlserver.data.performance_schema"
- Name="performance_schema">
- <Component Id="component.datadir.performance_schema"
- Guid="af2a6776-2655-431f-a748-9e9f4645acc3"
- Permanent="yes" NeverOverwrite="yes">
- <CreateFolder>
- <util:PermissionEx User="[LogonUser]" GenericAll="yes" />
- </CreateFolder>
- @DATADIR_PERFORMANCE_SCHEMA_FILES@
- </Component>
- </Directory>
- <Directory Id="datadir.mysql.mysqlserver.data.test" Name="test">
- <Component Id="component.datadir.test" Guid="52fa9f0a-fcd1-420a-b2ac-95a8f70ad20a">
- <CreateFolder/>
- </Component>
- </Directory>
- </Directory>
- </Directory>
- </Directory>
- </Directory>
- </Directory>
- </DirectoryRef>
-
- <Feature Id='UserEditableDataFiles'
- Title='Server data files'
- Description='Server data files'
- ConfigurableDirectory='DATADIR'
- Level='1'>
- <ComponentRef Id="component.datadir"/>
- <ComponentRef Id="component.datadir.mysql"/>
- <ComponentRef Id="component.datadir.performance_schema"/>
- <ComponentRef Id="component.datadir.test"/>
- </Feature>
-</Include>
-
-
-
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi" + xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"> + +<!-- + Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +--> + + <!-- Datafiles that installation will copy to CommonAppData (initial database) + They are declared Permanent and NeverOverwrite since it is user data --> + <DirectoryRef Id='TARGETDIR'> + <Directory Id="CommonAppDataFolder"> + <Directory Id="datadir.mysql" Name="MySQL"> + <Directory Id="datadir.mysql.mysqlserver" + Name="MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@"> + <Directory Id="DATADIR" Name="."> + <Component Id="component.datadir" Guid="d3491319-5dbc-4477-95f3-4f809ef1dd2d"> + <CreateFolder> + <util:PermissionEx User="[LogonUser]" GenericAll="yes" /> + </CreateFolder> + </Component> + <Directory Id="datadir.mysql.mysqlserver.data" Name="data"> + <Directory Id="datadir.mysql.mysqlserver.data.mysql" Name="mysql"> + <Component Id="component.datadir.mysql" + Guid="19ec0f1f-1a7f-424e-a788-b09346c0a709" + Permanent="yes" NeverOverwrite="yes"> + <CreateFolder> + <util:PermissionEx User="[LogonUser]" GenericAll="yes" /> + </CreateFolder> + @DATADIR_MYSQL_FILES@ + </Component> + </Directory> + <Directory Id="datadir.mysql.mysqlserver.data.performance_schema" + Name="performance_schema"> + <Component Id="component.datadir.performance_schema" + Guid="af2a6776-2655-431f-a748-9e9f4645acc3" + Permanent="yes" NeverOverwrite="yes"> + <CreateFolder> + <util:PermissionEx User="[LogonUser]" GenericAll="yes" /> + </CreateFolder> + @DATADIR_PERFORMANCE_SCHEMA_FILES@ + </Component> + </Directory> + <Directory Id="datadir.mysql.mysqlserver.data.test" Name="test"> + <Component Id="component.datadir.test" Guid="52fa9f0a-fcd1-420a-b2ac-95a8f70ad20a"> + <CreateFolder/> + </Component> + </Directory> + </Directory> + </Directory> + </Directory> + </Directory> + </Directory> + </DirectoryRef> + + <Feature Id='UserEditableDataFiles' + Title='Server data files' + Description='Server data files' + ConfigurableDirectory='DATADIR' + Level='1'> + <ComponentRef Id="component.datadir"/> + <ComponentRef Id="component.datadir.mysql"/> + <ComponentRef Id="component.datadir.performance_schema"/> + <ComponentRef Id="component.datadir.test"/> + </Feature> +</Include> + + + diff --git a/packaging/WiX/mysql_server.wxs.in b/packaging/WiX/mysql_server.wxs.in index 1802baedf3b..1e7c20468ef 100644 --- a/packaging/WiX/mysql_server.wxs.in +++ b/packaging/WiX/mysql_server.wxs.in @@ -1,196 +1,196 @@ -<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
- xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
-
-<!--
- Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--->
-
- <Product
- Id="*"
- UpgradeCode="49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3"
- Name="MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@"
- Version="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
- Language="1033"
- Manufacturer="@MANUFACTURER@">
-
- <Package Id='*'
- Keywords='Installer'
- Description="MySQL Database Server"
- Manufacturer='@MANUFACTURER@'
- InstallerVersion='200'
- Languages='1033'
- Compressed='yes'
- SummaryCodepage='1252'
- Platform='@Platform@'
- InstallScope="perMachine"/>
-
- <Media Id='1' Cabinet='product.cab' EmbedCab='yes' />
-
- <!-- Upgrade -->
- <Upgrade Id="49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3">
- <UpgradeVersion
- Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.0"
- IncludeMinimum="yes"
- Maximum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
- IncludeMaximum="yes"
- Property="OLDERVERSIONBEINGUPGRADED"
- MigrateFeatures="yes"
- />
- <UpgradeVersion
- Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
- IncludeMinimum="no"
- OnlyDetect="yes"
- Property="NEWERVERSIONDETECTED" />
- </Upgrade>
- <Condition Message="A later version of [ProductName] is already installed. Setup will now exit.">
- NOT NEWERVERSIONDETECTED OR Installed
- </Condition>
- <InstallExecuteSequence>
- <RemoveExistingProducts After="InstallInitialize"/>
- </InstallExecuteSequence>
-
- <!-- Save/restore install location -->
- <CustomAction Id="SaveTargetDir" Property="ARPINSTALLLOCATION" Value="[INSTALLDIR]" />
- <InstallExecuteSequence>
- <Custom Action="SaveTargetDir" After="InstallValidate">
- NOT
- Installed
- </Custom>
- </InstallExecuteSequence>
- <InstallUISequence>
- <!-- App search is what does FindInstallLocation, and it is dependent on FindRelatedProducts -->
- <AppSearch After="FindRelatedProducts"/>
- </InstallUISequence>
-
- <!-- Find previous installation -->
- <Property Id="INSTALLDIR">
- <RegistrySearch Id="FindInstallLocation"
- Root="HKLM"
- Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
- Name="InstallLocation"
- Type="raw" />
- </Property>
- <?if @Platform@ != "x64" ?>
- <Property Id="OLDERVERSION">
- <RegistrySearch Id="FindOlderVersion"
- Root="HKLM"
- Win64 = "no"
- Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
- Name="DisplayVersion"
- Type="raw" />
- </Property>
- <?else ?>
- <Property Id="OLDERVERSION">
- <RegistrySearch Id="FindOlderVersion"
- Root="HKLM"
- Win64 = "yes"
- Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
- Name="DisplayVersion"
- Type="raw" />
- </Property>
- <?endif ?>
- <Property Id="DATADIR">
- <RegistrySearch Id="FindDataDir"
- Root="HKLM"
- Key="SOFTWARE\MySQL AB\[ProductName]"
- Name="DataLocation"
- Type="raw" />
- </Property>
- <Property Id="INSTALLDIR2">
- <RegistrySearch Id="FindInstallLocation2"
- Root="HKLM"
- Key="SOFTWARE\MySQL AB\[ProductName]"
- Name="Location"
- Type="raw" />
- </Property>
- <CustomAction Id="SetInstallDir2" Property="INSTALLDIR" Value="[INSTALLDIR2]" />
- <InstallUISequence>
- <Custom Action="SetInstallDir2" After="AppSearch">INSTALLDIR2</Custom>
- </InstallUISequence>
-
-
- <!-- UI -->
- <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"></Property>
- <UIRef Id="@CPACK_WIX_UI@" />
- <UIRef Id="WixUI_ErrorProgressText" />
- <WixVariable
- Id="WixUIBannerBmp"
- Value="@CMAKE_CURRENT_SOURCE_DIR@/AdminHeader.jpg" />
- <WixVariable
- Id="WixUIDialogBmp"
- Value="@CMAKE_CURRENT_SOURCE_DIR@/AdminBackground.jpg" />
- <Icon
- Id="icon.ico"
- SourceFile="@CMAKE_CURRENT_SOURCE_DIR@/MySQLServer.ico"/>
- <Property
- Id="ARPPRODUCTICON"
- Value="icon.ico" />
-
- <!-- License -->
- <WixVariable
- Id="WixUILicenseRtf"
- Value="@COPYING_RTF@"/>
-
- <!-- How to remove the service on uninstall -->
- <Binary Id='wixca.dll' SourceFile='@WIXCA_LOCATION@' />
- <CustomAction Id="UnregisterProperty" Property="UnregisterService" Value="[INSTALLDIR]" Return="check" />
- <CustomAction Id="UnregisterPropertySilent" Property="UnregisterServiceSilently" Value="[INSTALLDIR]" Return="check" />
- <CustomAction Id="UnregisterService"
- BinaryKey="wixca.dll"
- DllEntry="RemoveService"
- Execute="deferred"
- Impersonate="no"
- Return="check" />
- <CustomAction Id="UnregisterServiceSilently"
- BinaryKey="wixca.dll"
- DllEntry="RemoveServiceNoninteractive"
- Execute="deferred"
- Impersonate="no"
- Return="check" />
- <InstallExecuteSequence>
- <Custom Action="UnregisterProperty" After="InstallInitialize">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL"</Custom>
- <Custom Action="UnregisterPropertySilent" After="InstallInitialize">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL"</Custom>
- <Custom Action="UnregisterService" After="UnregisterProperty">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL" And UILevel>4</Custom>
- <Custom Action="UnregisterServiceSilently" After="UnregisterPropertySilent">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL" And UILevel<=4</Custom>
- </InstallExecuteSequence>
-
- <!-- Installation root-->
- <Directory Id='TARGETDIR' Name='SourceDir'>
- <Directory Id='@PlatformProgramFilesFolder@'>
- <Directory Id='directory.MySQL' Name='MySQL'>
- <Directory Id='INSTALLDIR' Name='MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@'>
- </Directory>
- </Directory>
- </Directory>
- </Directory>
-
- <!-- CPACK_WIX_FEATURES -->
- @CPACK_WIX_FEATURES@
-
- <!-- CPACK_WIX_DIRECTORIES -->
- @CPACK_WIX_DIRECTORIES@
-
- <!--CPACK_WIX_COMPONENTS-->
- @CPACK_WIX_COMPONENTS@
-
- <!--CPACK_WIX_COMPONENTS_GROUPS -->
- @CPACK_WIX_COMPONENT_GROUPS@
-
- <!--CPACK_WIX_INCLUDES -->
- @CPACK_WIX_INCLUDES@
- </Product>
-
-</Wix>
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" + xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"> + +<!-- + Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +--> + + <Product + Id="*" + UpgradeCode="49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3" + Name="MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@" + Version="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@" + Language="1033" + Manufacturer="@MANUFACTURER@"> + + <Package Id='*' + Keywords='Installer' + Description="MySQL Database Server" + Manufacturer='@MANUFACTURER@' + InstallerVersion='200' + Languages='1033' + Compressed='yes' + SummaryCodepage='1252' + Platform='@Platform@' + InstallScope="perMachine"/> + + <Media Id='1' Cabinet='product.cab' EmbedCab='yes' /> + + <!-- Upgrade --> + <Upgrade Id="49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3"> + <UpgradeVersion + Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.0" + IncludeMinimum="yes" + Maximum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@" + IncludeMaximum="yes" + Property="OLDERVERSIONBEINGUPGRADED" + MigrateFeatures="yes" + /> + <UpgradeVersion + Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@" + IncludeMinimum="no" + OnlyDetect="yes" + Property="NEWERVERSIONDETECTED" /> + </Upgrade> + <Condition Message="A later version of [ProductName] is already installed. Setup will now exit."> + NOT NEWERVERSIONDETECTED OR Installed + </Condition> + <InstallExecuteSequence> + <RemoveExistingProducts After="InstallInitialize"/> + </InstallExecuteSequence> + + <!-- Save/restore install location --> + <CustomAction Id="SaveTargetDir" Property="ARPINSTALLLOCATION" Value="[INSTALLDIR]" /> + <InstallExecuteSequence> + <Custom Action="SaveTargetDir" After="InstallValidate"> + NOT + Installed + </Custom> + </InstallExecuteSequence> + <InstallUISequence> + <!-- App search is what does FindInstallLocation, and it is dependent on FindRelatedProducts --> + <AppSearch After="FindRelatedProducts"/> + </InstallUISequence> + + <!-- Find previous installation --> + <Property Id="INSTALLDIR"> + <RegistrySearch Id="FindInstallLocation" + Root="HKLM" + Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]" + Name="InstallLocation" + Type="raw" /> + </Property> + <?if @Platform@ != "x64" ?> + <Property Id="OLDERVERSION"> + <RegistrySearch Id="FindOlderVersion" + Root="HKLM" + Win64 = "no" + Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]" + Name="DisplayVersion" + Type="raw" /> + </Property> + <?else ?> + <Property Id="OLDERVERSION"> + <RegistrySearch Id="FindOlderVersion" + Root="HKLM" + Win64 = "yes" + Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]" + Name="DisplayVersion" + Type="raw" /> + </Property> + <?endif ?> + <Property Id="DATADIR"> + <RegistrySearch Id="FindDataDir" + Root="HKLM" + Key="SOFTWARE\MySQL AB\[ProductName]" + Name="DataLocation" + Type="raw" /> + </Property> + <Property Id="INSTALLDIR2"> + <RegistrySearch Id="FindInstallLocation2" + Root="HKLM" + Key="SOFTWARE\MySQL AB\[ProductName]" + Name="Location" + Type="raw" /> + </Property> + <CustomAction Id="SetInstallDir2" Property="INSTALLDIR" Value="[INSTALLDIR2]" /> + <InstallUISequence> + <Custom Action="SetInstallDir2" After="AppSearch">INSTALLDIR2</Custom> + </InstallUISequence> + + + <!-- UI --> + <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"></Property> + <UIRef Id="@CPACK_WIX_UI@" /> + <UIRef Id="WixUI_ErrorProgressText" /> + <WixVariable + Id="WixUIBannerBmp" + Value="@CMAKE_CURRENT_SOURCE_DIR@/AdminHeader.jpg" /> + <WixVariable + Id="WixUIDialogBmp" + Value="@CMAKE_CURRENT_SOURCE_DIR@/AdminBackground.jpg" /> + <Icon + Id="icon.ico" + SourceFile="@CMAKE_CURRENT_SOURCE_DIR@/MySQLServer.ico"/> + <Property + Id="ARPPRODUCTICON" + Value="icon.ico" /> + + <!-- License --> + <WixVariable + Id="WixUILicenseRtf" + Value="@COPYING_RTF@"/> + + <!-- How to remove the service on uninstall --> + <Binary Id='wixca.dll' SourceFile='@WIXCA_LOCATION@' /> + <CustomAction Id="UnregisterProperty" Property="UnregisterService" Value="[INSTALLDIR]" Return="check" /> + <CustomAction Id="UnregisterPropertySilent" Property="UnregisterServiceSilently" Value="[INSTALLDIR]" Return="check" /> + <CustomAction Id="UnregisterService" + BinaryKey="wixca.dll" + DllEntry="RemoveService" + Execute="deferred" + Impersonate="no" + Return="check" /> + <CustomAction Id="UnregisterServiceSilently" + BinaryKey="wixca.dll" + DllEntry="RemoveServiceNoninteractive" + Execute="deferred" + Impersonate="no" + Return="check" /> + <InstallExecuteSequence> + <Custom Action="UnregisterProperty" After="InstallInitialize">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL"</Custom> + <Custom Action="UnregisterPropertySilent" After="InstallInitialize">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL"</Custom> + <Custom Action="UnregisterService" After="UnregisterProperty">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL" And UILevel>4</Custom> + <Custom Action="UnregisterServiceSilently" After="UnregisterPropertySilent">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL" And UILevel<=4</Custom> + </InstallExecuteSequence> + + <!-- Installation root--> + <Directory Id='TARGETDIR' Name='SourceDir'> + <Directory Id='@PlatformProgramFilesFolder@'> + <Directory Id='directory.MySQL' Name='MySQL'> + <Directory Id='INSTALLDIR' Name='MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@'> + </Directory> + </Directory> + </Directory> + </Directory> + + <!-- CPACK_WIX_FEATURES --> + @CPACK_WIX_FEATURES@ + + <!-- CPACK_WIX_DIRECTORIES --> + @CPACK_WIX_DIRECTORIES@ + + <!--CPACK_WIX_COMPONENTS--> + @CPACK_WIX_COMPONENTS@ + + <!--CPACK_WIX_COMPONENTS_GROUPS --> + @CPACK_WIX_COMPONENT_GROUPS@ + + <!--CPACK_WIX_INCLUDES --> + @CPACK_WIX_INCLUDES@ + </Product> + +</Wix> diff --git a/packaging/rpm-oel/mysql.spec.in b/packaging/rpm-oel/mysql.spec.in index d8cf49fe993..bb232fb404d 100644 --- a/packaging/rpm-oel/mysql.spec.in +++ b/packaging/rpm-oel/mysql.spec.in @@ -1,4 +1,4 @@ -# Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -370,7 +370,7 @@ Obsoletes: mariadb-embedded Obsoletes: MySQL-embedded < %{version}-%{release} Obsoletes: mysql-embedded < %{version}-%{release} Provides: mysql-embedded = %{version}-%{release} -Provides: mysql-emdedded%{?_isa} = %{version}-%{release} +Provides: mysql-embedded%{?_isa} = %{version}-%{release} %description embedded This package contains the MySQL server as an embedded library. diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c index 84626c02f8c..1c91c66759d 100644 --- a/plugin/server_audit/server_audit.c +++ b/plugin/server_audit/server_audit.c @@ -1128,6 +1128,8 @@ static size_t escape_string(const char *str, unsigned int len, *(result++)= '\\'; *(result++)= '\\'; } + else if (is_space(*str)) + *(result++)= ' '; else *(result++)= *str; str++; @@ -1183,9 +1185,15 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len, for (c=0; c<d_len; c++) result[c]= is_space(str[c]) ? ' ' : str[c]; - memmove(result + d_len, "*****", 5); - result+= d_len + 5; - b_char= *(next_s++); + if (*next_s) + { + memmove(result + d_len, "*****", 5); + result+= d_len + 5; + b_char= *(next_s++); + } + else + result+= d_len; + while (*next_s) { if (*next_s == b_char) diff --git a/sql-common/client.c b/sql-common/client.c index c180986cbe9..acfdd8531e2 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1848,6 +1848,7 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) , mysql_options(mysql, MYSQL_OPT_SSL_CAPATH, capath) | mysql_options(mysql, MYSQL_OPT_SSL_CIPHER, cipher) ? 1 : 0); + mysql->options.use_ssl= TRUE; #endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */ DBUG_RETURN(result); } @@ -2652,16 +2653,10 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio, mysql->client_flag|= CLIENT_MULTI_RESULTS; #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) - if (mysql->options.ssl_key || mysql->options.ssl_cert || - mysql->options.ssl_ca || mysql->options.ssl_capath || - mysql->options.ssl_cipher || - (mysql->options.extension && - (mysql->options.extension->ssl_crl || - mysql->options.extension->ssl_crlpath))) - mysql->options.use_ssl= 1; if (mysql->options.use_ssl) mysql->client_flag|= CLIENT_SSL; #endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY*/ + if (mpvio->db) mysql->client_flag|= CLIENT_CONNECT_WITH_DB; @@ -2690,6 +2685,23 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio, end= buff+5; } #ifdef HAVE_OPENSSL + + /* + If client uses ssl and client also has to verify the server + certificate, a ssl connection is required. + If the server does not support ssl, we abort the connection. + */ + if (mysql->options.use_ssl && + (mysql->client_flag & CLIENT_SSL_VERIFY_SERVER_CERT) && + !(mysql->server_capabilities & CLIENT_SSL)) + { + set_mysql_extended_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate, + ER(CR_SSL_CONNECTION_ERROR), + "SSL is required, but the server does not " + "support it"); + goto error; + } + if (mysql->client_flag & CLIENT_SSL) { /* Do the SSL layering. */ diff --git a/sql/field.cc b/sql/field.cc index 31d8b46e587..ba677975de1 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2633,7 +2633,7 @@ void Field_decimal::sql_type(String &res) const if (dec) tmp--; res.length(cs->cset->snprintf(cs,(char*) res.ptr(),res.alloced_length(), - "decimal(%d,%d)",tmp,dec)); + "decimal(%d,%d)/*old*/",tmp,dec)); add_zerofill_and_unsigned(res); } @@ -7923,6 +7923,14 @@ err_exit: return -1; } +Field::geometry_type Field_geom::geometry_type_merge(geometry_type a, + geometry_type b) +{ + if (a == b) + return a; + return Field::GEOM_GEOMETRY; +} + #endif /*HAVE_SPATIAL*/ /**************************************************************************** diff --git a/sql/field.h b/sql/field.h index a52bd01395a..97a820e9470 100644 --- a/sql/field.h +++ b/sql/field.h @@ -2591,6 +2591,7 @@ public: int reset(void) { return Field_blob::reset() || !maybe_null(); } geometry_type get_geometry_type() { return geom_type; }; + static geometry_type geometry_type_merge(geometry_type, geometry_type); }; #endif /*HAVE_SPATIAL*/ diff --git a/sql/filesort.cc b/sql/filesort.cc index 027437fca67..a545bb623c0 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -1,5 +1,5 @@ -/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2009, 2014, Monty Program Ab. +/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. + Copyright (c) 2009, 2015, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index 73513ac9f40..64ae31ce231 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -1,5 +1,4 @@ -/* Copyright (c) 2006, 2013, Oracle and/or its affiliates. - Copyright (c) 2012, 2013, Monty Proram Ab. +/* Copyright (c) 2006, 2015, Oracle and/or its affiliates. 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 @@ -2529,7 +2528,8 @@ ndbcluster_check_if_local_tables_in_db(THD *thd, const char *dbname) char path[FN_REFLEN + 1]; build_table_filename(path, sizeof(path) - 1, dbname, "", "", 0); - if (find_files(thd, &files, dbname, path, NullS, 0) != FIND_FILES_OK) + if (find_files(thd, &files, dbname, path, NullS, 0, NULL) != + FIND_FILES_OK) { DBUG_PRINT("info", ("Failed to find files")); DBUG_RETURN(true); diff --git a/sql/item.cc b/sql/item.cc index a465c2d4e36..bffa7e2990d 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1179,6 +1179,42 @@ Item *Item::safe_charset_converter(CHARSET_INFO *tocs) /** + Some pieces of the code do not support changing of + Item_cache to other Item types. + + Example: + Item_singlerow_subselect has "Item_cache **row". + Creating of Item_func_conv_charset followed by THD::change_item_tree() + should not change row[i] from Item_cache directly to Item_func_conv_charset, because Item_singlerow_subselect + because Item_singlerow_subselect later calls Item_cache-specific methods, + e.g. row[i]->store() and row[i]->cache_value(). + + Let's wrap Item_func_conv_charset in a new Item_cache, + so the Item_cache-specific methods can still be used for + Item_singlerow_subselect::row[i] safely. + + As a bonus we cache the converted value, instead of converting every time + + TODO: we should eventually check all other use cases of change_item_tree(). + Perhaps some more potentially dangerous substitution examples exist. +*/ +Item *Item_cache::safe_charset_converter(CHARSET_INFO *tocs) +{ + if (!example) + return Item::safe_charset_converter(tocs); + Item *conv= example->safe_charset_converter(tocs); + if (conv == example) + return this; + Item_cache *cache; + if (!conv || !(cache= new Item_cache_str(conv))) + return NULL; // Safe conversion is not possible, or OEM + cache->setup(conv); + cache->fixed= false; // Make Item::fix_fields() happy + return cache; +} + + +/** @details Created mostly for mysql_prepare_table(). Important when a string ENUM/SET column is described with a numeric default value: @@ -9471,6 +9507,11 @@ bool Item_type_holder::join_types(THD *thd, Item *item) item_decimals= 0; decimals= MY_MAX(decimals, item_decimals); } + + if (fld_type == FIELD_TYPE_GEOMETRY) + geometry_type= + Field_geom::geometry_type_merge(geometry_type, item->get_geometry_type()); + if (Field::result_merge_type(fld_type) == DECIMAL_RESULT) { decimals= MY_MIN(MY_MAX(decimals, item->decimals), DECIMAL_MAX_SCALE); diff --git a/sql/item.h b/sql/item.h index ce757749217..171bdb05310 100644 --- a/sql/item.h +++ b/sql/item.h @@ -4477,7 +4477,6 @@ class Item_cache: public Item_basic_constant { protected: Item *example; - table_map used_table_map; /** Field that this object will get value from. This is used by index-based subquery engines to detect and remove the equality injected @@ -4495,7 +4494,7 @@ protected: bool value_cached; public: Item_cache(): - example(0), used_table_map(0), cached_field(0), + example(0), cached_field(0), cached_field_type(MYSQL_TYPE_STRING), value_cached(0) { @@ -4504,7 +4503,7 @@ public: null_value= 1; } Item_cache(enum_field_types field_type_arg): - example(0), used_table_map(0), cached_field(0), + example(0), cached_field(0), cached_field_type(field_type_arg), value_cached(0) { @@ -4513,8 +4512,6 @@ public: null_value= 1; } - void set_used_tables(table_map map) { used_table_map= map; } - virtual bool allocate(uint i) { return 0; } virtual bool setup(Item *item) { @@ -4531,7 +4528,6 @@ public: enum_field_types field_type() const { return cached_field_type; } static Item_cache* get_cache(const Item *item); static Item_cache* get_cache(const Item* item, const Item_result type); - table_map used_tables() const { return used_table_map; } virtual void keep_array() {} virtual void print(String *str, enum_query_type query_type); bool eq_def(Field *field) @@ -4582,6 +4578,7 @@ public: return TRUE; return (this->*processor)(arg); } + virtual Item *safe_charset_converter(CHARSET_INFO *tocs); }; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 32a19341895..972ae5afb16 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -5122,6 +5122,16 @@ null: void Item_dyncol_get::print(String *str, enum_query_type query_type) { + /* + Parent cast doesn't exist yet, only print dynamic column name. This happens + when called from create_func_cast() / wrong_precision_error(). + */ + if (!str->length()) + { + args[1]->print(str, query_type); + return; + } + /* see create_func_dyncol_get */ DBUG_ASSERT(str->length() >= 5); DBUG_ASSERT(strncmp(str->ptr() + str->length() - 5, "cast(", 5) == 0); diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 21f14ae8435..1c5682417a5 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1,5 +1,5 @@ -/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2008, 2014, SkySQL Ab. +/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. + Copyright (c) 2008, 2015, MariaDB 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 @@ -3311,7 +3311,19 @@ void Item_func_group_concat::cleanup() } DBUG_ASSERT(tree == 0); } - + /* + As the ORDER structures pointed to by the elements of the + 'order' array may be modified in find_order_in_list() called + from Item_func_group_concat::setup() to point to runtime + created objects, we need to reset them back to the original + arguments of the function. + */ + ORDER **order_ptr= order; + for (uint i= 0; i < arg_count_order; i++) + { + (*order_ptr)->item= &args[arg_count_field + i]; + order_ptr++; + } DBUG_VOID_RETURN; } diff --git a/sql/log.h b/sql/log.h index d3540aa4499..48970f7452a 100644 --- a/sql/log.h +++ b/sql/log.h @@ -990,11 +990,9 @@ uint purge_log_get_error_code(int res); int vprint_msg_to_log(enum loglevel level, const char *format, va_list args); void sql_print_error(const char *format, ...); -void sql_print_warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2); -void sql_print_information(const char *format, ...) - ATTRIBUTE_FORMAT(printf, 1, 2); -typedef void (*sql_print_message_func)(const char *format, ...) - ATTRIBUTE_FORMAT_FPTR(printf, 1, 2); +void sql_print_warning(const char *format, ...); +void sql_print_information(const char *format, ...); +typedef void (*sql_print_message_func)(const char *format, ...); extern sql_print_message_func sql_print_message_handlers[]; int error_log_print(enum loglevel level, const char *format, diff --git a/sql/log_event.cc b/sql/log_event.cc index 29cb10c0abf..69b981f3f47 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2406,6 +2406,12 @@ log_event_print_value(IO_CACHE *file, const uchar *ptr, my_snprintf(typestr, typestr_length, "STRING(%d)", length); return my_b_write_quoted_with_length(file, ptr, length); + case MYSQL_TYPE_DECIMAL: + my_b_printf(file, + "!! Old DECIMAL (mysql-4.1 or earlier). " + "Not enough metadata to display the value. "); + break; + default: { char tmp[5]; diff --git a/sql/message.rc b/sql/message.rc index 116522b7d48..0885a897e6f 100644 --- a/sql/message.rc +++ b/sql/message.rc @@ -1,2 +1,2 @@ -LANGUAGE 0x9,0x1
-1 11 MSG00001.bin
+LANGUAGE 0x9,0x1 +1 11 MSG00001.bin diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc index 9067f1e4253..146bf3b0c0e 100644 --- a/sql/rpl_utility.cc +++ b/sql/rpl_utility.cc @@ -452,7 +452,7 @@ void show_sql_type(enum_field_types type, uint16 metadata, String *str, CHARSET_ CHARSET_INFO *cs= str->charset(); uint32 length= cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(), - "decimal(%d,?)", metadata); + "decimal(%d,?)/*old*/", metadata); str->length(length); } break; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 619bd4bd98f..13b8625ebe6 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -8015,9 +8015,10 @@ bool setup_tables(THD *thd, Name_resolution_context *context, if (select_lex->first_cond_optimization) { leaves.empty(); - if (!select_lex->is_prep_leaf_list_saved) + if (select_lex->prep_leaf_list_state != SELECT_LEX::SAVED) { make_leaves_list(leaves, tables, full_table_list, first_select_table); + select_lex->prep_leaf_list_state= SELECT_LEX::READY; select_lex->leaf_tables_exec.empty(); } else diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 807b028a4b1..0202b4493ac 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -1122,7 +1122,7 @@ bool setup_connection_thread_globals(THD *thd) bool login_connection(THD *thd) { NET *net= &thd->net; - int error; + int error= 0; DBUG_ENTER("login_connection"); DBUG_PRINT("info", ("login_connection called by thread %lu", thd->thread_id)); @@ -1141,7 +1141,8 @@ bool login_connection(THD *thd) my_sleep(1000); /* must wait after eof() */ #endif statistic_increment(aborted_connects,&LOCK_status); - DBUG_RETURN(1); + error=1; + goto exit; } /* Connect completed, set read/write timeouts back to default */ my_net_set_read_timeout(net, thd->variables.net_read_timeout); @@ -1151,10 +1152,13 @@ bool login_connection(THD *thd) if (increment_connection_count(thd, TRUE)) { my_error(ER_OUTOFMEMORY, MYF(0), 2*sizeof(USER_STATS)); - DBUG_RETURN(1); + error= 1; + goto exit; } - DBUG_RETURN(0); +exit: + mysql_audit_notify_connection_connect(thd); + DBUG_RETURN(error); } @@ -1295,7 +1299,6 @@ bool thd_prepare_connection(THD *thd) bool rc; lex_start(thd); rc= login_connection(thd); - mysql_audit_notify_connection_connect(thd); if (rc) return rc; diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index d8f40897a59..2026d5f5059 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -556,6 +556,7 @@ void lex_start(THD *thd) lex->is_lex_started= TRUE; lex->used_tables= 0; + lex->only_view= FALSE; lex->reset_slave_info.all= false; lex->limit_rows_examined= 0; lex->limit_rows_examined_cnt= ULONGLONG_MAX; @@ -1873,7 +1874,7 @@ void st_select_lex::init_query() exclude_from_table_unique_test= no_wrap_view_item= FALSE; nest_level= 0; link_next= 0; - is_prep_leaf_list_saved= FALSE; + prep_leaf_list_state= UNINIT; have_merged_subqueries= FALSE; bzero((char*) expr_cache_may_be_used, sizeof(expr_cache_may_be_used)); m_non_agg_field_used= false; @@ -4152,12 +4153,22 @@ bool st_select_lex::save_prep_leaf_tables(THD *thd) { List_iterator_fast<TABLE_LIST> li(leaf_tables); TABLE_LIST *table; + + /* + Check that the SELECT_LEX was really prepared and so tables are setup. + + It can be subquery in SET clause of UPDATE which was not prepared yet, so + its tables are not yet setup and ready for storing. + */ + if (prep_leaf_list_state != READY) + return FALSE; + while ((table= li++)) { if (leaf_tables_prep.push_back(table)) return TRUE; } - is_prep_leaf_list_saved= TRUE; + prep_leaf_list_state= SAVED; for (SELECT_LEX_UNIT *u= first_inner_unit(); u; u= u->next_unit()) { for (SELECT_LEX *sl= u->first_select(); sl; sl= sl->next_select()) diff --git a/sql/sql_lex.h b/sql/sql_lex.h index b17f0f4ec63..dcd8ddfce91 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -733,7 +733,8 @@ public: List<TABLE_LIST> leaf_tables; List<TABLE_LIST> leaf_tables_exec; List<TABLE_LIST> leaf_tables_prep; - bool is_prep_leaf_list_saved; + enum leaf_list_state {UNINIT, READY, SAVED}; + enum leaf_list_state prep_leaf_list_state; uint insert_tables; st_select_lex *merged_into; /* select which this select is merged into */ /* (not 0 only for views/derived tables) */ diff --git a/sql/sql_partition_admin.cc b/sql/sql_partition_admin.cc index 8c59febeb77..87803c220ea 100644 --- a/sql/sql_partition_admin.cc +++ b/sql/sql_partition_admin.cc @@ -824,9 +824,16 @@ bool Sql_cmd_alter_table_truncate_partition::execute(THD *thd) log. The exception is a unimplemented truncate method or failure before any call to handler::truncate() is done. Also, it is logged in statement format, regardless of the binlog format. + + Since we've changed data within the table, we also have to invalidate + the query cache for it. */ - if (error != HA_ERR_WRONG_COMMAND && binlog_stmt) - error|= write_bin_log(thd, !error, thd->query(), thd->query_length()); + if (error != HA_ERR_WRONG_COMMAND) + { + query_cache_invalidate3(thd, first_table, FALSE); + if (binlog_stmt) + error|= write_bin_log(thd, !error, thd->query(), thd->query_length()); + } /* A locked table ticket was upgraded to a exclusive lock. After the diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 7fbd6b63490..dc408703da4 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -264,13 +264,14 @@ public: { TRASH(ptr_arg, size); } sys_var_pluginvar(sys_var_chain *chain, const char *name_arg, - struct st_mysql_sys_var *plugin_var_arg) + struct st_mysql_sys_var *plugin_var_arg, + struct st_plugin_int *plugin_arg) :sys_var(chain, name_arg, plugin_var_arg->comment, (plugin_var_arg->flags & PLUGIN_VAR_THDLOCAL ? SESSION : GLOBAL) | (plugin_var_arg->flags & PLUGIN_VAR_READONLY ? READONLY : 0), 0, -1, NO_ARG, pluginvar_show_type(plugin_var_arg), 0, 0, VARIABLE_NOT_IN_BINLOG, NULL, NULL, NULL), - plugin_var(plugin_var_arg) + plugin(plugin_arg), plugin_var(plugin_var_arg) { plugin_var->name= name_arg; } sys_var_pluginvar *cast_pluginvar() { return this; } bool check_update_type(Item_result type); @@ -1413,22 +1414,6 @@ static int plugin_initialize(MEM_ROOT *tmp_root, struct st_plugin_int *plugin, goto err; } - /* - set the plugin attribute of plugin's sys vars so they are pointing - to the active plugin - */ - if (plugin->system_vars) - { - sys_var_pluginvar *var= plugin->system_vars->cast_pluginvar(); - for (;;) - { - var->plugin= plugin; - if (!var->next) - break; - var= var->next->cast_pluginvar(); - } - } - ret= 0; err: @@ -3961,7 +3946,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp, continue; tmp_backup[tmp->nbackups++].save(&o->name); if ((var= find_bookmark(plugin_name.str, o->name, o->flags))) - v= new (mem_root) sys_var_pluginvar(&chain, var->key + 1, o); + v= new (mem_root) sys_var_pluginvar(&chain, var->key + 1, o, tmp); else { len= plugin_name.length + strlen(o->name) + 2; @@ -3969,7 +3954,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp, strxmov(varname, plugin_name.str, "-", o->name, NullS); my_casedn_str(&my_charset_latin1, varname); convert_dash_to_underscore(varname, len-1); - v= new (mem_root) sys_var_pluginvar(&chain, varname, o); + v= new (mem_root) sys_var_pluginvar(&chain, varname, o, tmp); } DBUG_ASSERT(v); /* check that an object was actually constructed */ } /* end for */ diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 2aeddf2415d..e0f560f0b3a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -9736,10 +9736,24 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) if (!sel->quick_keys.is_subset(tab->checked_keys) || !sel->needed_reg.is_subset(tab->checked_keys)) { + /* + "Range checked for each record" is a "last resort" access method + that should only be used when the other option is a cross-product + join. + + We use the following condition (it's approximate): + 1. There are potential keys for (sel->needed_reg) + 2. There were no possible ways to construct a quick select, or + the quick select would be more expensive than the full table + scan. + */ tab->use_quick= (!sel->needed_reg.is_clear_all() && (sel->quick_keys.is_clear_all() || - (sel->quick && - (sel->quick->records >= 100L)))) ? + (sel->quick && + sel->quick->read_time > + tab->table->file->scan_time() + + tab->table->file->stats.records/TIME_FOR_COMPARE + ))) ? 2 : 1; sel->read_tables= used_tables & ~current_map; sel->quick_keys.clear_all(); diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc index 2b0576ffba9..8d5bb2b596d 100644 --- a/sql/sql_servers.cc +++ b/sql/sql_servers.cc @@ -326,7 +326,8 @@ get_server_from_table_to_cache(TABLE *table) table->use_all_columns(); /* get each field into the server struct ptr */ - server->server_name= get_field(&mem, table->field[0]); + ptr= get_field(&mem, table->field[0]); + server->server_name= ptr ? ptr : blank; server->server_name_length= (uint) strlen(server->server_name); ptr= get_field(&mem, table->field[1]); server->host= ptr ? ptr : blank; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index b566029740a..2413cb5ba53 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1,5 +1,5 @@ -/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2009, 2014, SkySQL Ab. +/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. + Copyright (c) 2009, 2015, MariaDB 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 @@ -2301,7 +2301,8 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) Security_context *tmp_sctx= tmp->security_ctx; struct st_my_thread_var *mysys_var; if ((tmp->vio_ok() || tmp->system_thread) && - (!user || (tmp_sctx->user && !strcmp(tmp_sctx->user, user)))) + (!user || (!tmp->system_thread && + tmp_sctx->user && !strcmp(tmp_sctx->user, user)))) { thread_info *thd_info= new thread_info; @@ -2679,7 +2680,8 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond) ulonglong max_counter; if ((!tmp->vio_ok() && !tmp->system_thread) || - (user && (!tmp_sctx->user || strcmp(tmp_sctx->user, user)))) + (user && (tmp->system_thread || !tmp_sctx->user || + strcmp(tmp_sctx->user, user)))) continue; restore_record(table, s->default_values); @@ -8099,15 +8101,20 @@ bool get_schema_tables_result(JOIN *join, TABLE_LIST *table_list= tab->table->pos_in_table_list; if (table_list->schema_table && thd->fill_information_schema_tables()) { +#if MYSQL_VERSION_ID > 100105 +#error I_S tables only need to be re-populated if make_cond_for_info_schema() will preserve outer fields bool is_subselect= (&lex->unit != lex->current_select->master_unit() && lex->current_select->master_unit()->item); +#else +#define is_subselect false +#endif /* A value of 0 indicates a dummy implementation */ if (table_list->schema_table->fill_table == 0) continue; /* skip I_S optimizations specific to get_all_tables */ - if (thd->lex->describe && + if (lex->describe && (table_list->schema_table->fill_table != get_all_tables)) continue; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 817ab6e8967..da2a220d3f1 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -5478,7 +5478,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, if (!table->view) { int result __attribute__((unused))= - show_create_table(thd, table, &query, create_info, WITHOUT_DB_NAME); + show_create_table(thd, table, &query, create_info, WITH_DB_NAME); DBUG_ASSERT(result == 0); // show_create_table() always return 0 do_logging= FALSE; diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 41647a7262f..a63d8a51a86 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -225,7 +225,7 @@ fill_defined_view_parts (THD *thd, TABLE_LIST *view) view->definer.user= decoy.definer.user; lex->definer= &view->definer; } - if (lex->create_view_algorithm == DTYPE_ALGORITHM_UNDEFINED) + if (lex->create_view_algorithm == VIEW_ALGORITHM_INHERIT) lex->create_view_algorithm= (uint8) decoy.algorithm; if (lex->create_view_suid == VIEW_SUID_DEFAULT) lex->create_view_suid= decoy.view_suid ? diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 9c7898b1b02..d980de7e1a5 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -7142,7 +7142,7 @@ alter: my_error(ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW"); MYSQL_YYABORT; } - lex->create_view_algorithm= DTYPE_ALGORITHM_UNDEFINED; + lex->create_view_algorithm= VIEW_ALGORITHM_INHERIT; lex->create_view_mode= VIEW_ALTER; } view_tail @@ -7912,8 +7912,13 @@ opt_checksum_type: | EXTENDED_SYM { Lex->check_opt.flags= T_EXTEND; } ; +repair_table_or_view: + table_or_tables table_list opt_mi_repair_type + | VIEW_SYM { Lex->only_view= TRUE; } table_list opt_view_repair_type + ; + repair: - REPAIR opt_no_write_to_binlog table_or_view + REPAIR opt_no_write_to_binlog { LEX *lex=Lex; lex->sql_command = SQLCOM_REPAIR; @@ -7923,18 +7928,9 @@ repair: /* Will be overriden during execution. */ YYPS->m_lock_type= TL_UNLOCK; } - table_list opt_mi_repair_type + repair_table_or_view { LEX* lex= thd->lex; - if ((lex->only_view && - ((lex->check_opt.flags & (T_QUICK | T_EXTEND)) || - (lex->check_opt.sql_flags & TT_USEFRM))) || - (!lex->only_view && - (lex->check_opt.sql_flags & TT_FROM_MYSQL))) - { - my_parse_error(ER(ER_SYNTAX_ERROR)); - MYSQL_YYABORT; - } DBUG_ASSERT(!lex->m_sql_cmd); lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_repair_table(); if (lex->m_sql_cmd == NULL) @@ -7956,6 +7952,10 @@ mi_repair_type: QUICK { Lex->check_opt.flags|= T_QUICK; } | EXTENDED_SYM { Lex->check_opt.flags|= T_EXTEND; } | USE_FRM { Lex->check_opt.sql_flags|= TT_USEFRM; } + ; + +opt_view_repair_type: + /* empty */ { } | FROM MYSQL_SYM { Lex->check_opt.sql_flags|= TT_FROM_MYSQL; } ; @@ -8075,30 +8075,27 @@ binlog_base64_event: } ; -check: - CHECK_SYM table_or_view +check_view_or_table: + table_or_tables table_list opt_mi_check_type + | VIEW_SYM { Lex->only_view= TRUE; } table_list opt_view_check_type + ; + +check: CHECK_SYM { LEX *lex=Lex; - if (lex->sphead) - { - my_error(ER_SP_BADSTATEMENT, MYF(0), "CHECK"); - MYSQL_YYABORT; - } lex->sql_command = SQLCOM_CHECK; lex->check_opt.init(); lex->alter_info.reset(); /* Will be overriden during execution. */ YYPS->m_lock_type= TL_UNLOCK; } - table_list opt_mi_check_type + check_view_or_table { LEX* lex= thd->lex; - if (lex->only_view && - (lex->check_opt.flags & (T_QUICK | T_FAST | T_EXTEND | - T_CHECK_ONLY_CHANGED))) + if (lex->sphead) { - my_parse_error(ER(ER_SYNTAX_ERROR)); + my_error(ER_SP_BADSTATEMENT, MYF(0), "CHECK"); MYSQL_YYABORT; } DBUG_ASSERT(!lex->m_sql_cmd); @@ -8127,6 +8124,11 @@ mi_check_type: | FOR_SYM UPGRADE_SYM { Lex->check_opt.sql_flags|= TT_FOR_UPGRADE; } ; +opt_view_check_type: + /* empty */ { } + | FOR_SYM UPGRADE_SYM { Lex->check_opt.sql_flags|= TT_FOR_UPGRADE; } + ; + optimize: OPTIMIZE opt_no_write_to_binlog table_or_tables { @@ -8208,7 +8210,6 @@ keycache: LEX *lex=Lex; lex->sql_command= SQLCOM_ASSIGN_TO_KEYCACHE; lex->ident= $6; - lex->only_view= FALSE; } ; @@ -8253,7 +8254,6 @@ preload: LEX *lex=Lex; lex->sql_command=SQLCOM_PRELOAD_KEYS; lex->alter_info.reset(); - lex->only_view= FALSE; } preload_list_or_parts {} @@ -12540,7 +12540,6 @@ show_param: lex->sql_command = SQLCOM_SHOW_CREATE; if (!lex->select_lex.add_table_to_list(thd, $3, NULL,0)) MYSQL_YYABORT; - lex->only_view= 0; lex->create_info.storage_media= HA_SM_DEFAULT; } | CREATE VIEW_SYM table_ident @@ -14858,13 +14857,8 @@ lock: ; table_or_tables: - TABLE_SYM { Lex->only_view= FALSE; } - | TABLES { Lex->only_view= FALSE; } - ; - -table_or_view: - table_or_tables - | VIEW_SYM { Lex->only_view= TRUE; } + TABLE_SYM { } + | TABLES { } ; table_lock_list: diff --git a/sql/table.h b/sql/table.h index df7fd852a76..39faa8b9765 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1541,6 +1541,8 @@ typedef struct st_schema_table #define DT_PHASES_MATERIALIZE (DT_COMMON | DT_MATERIALIZE) #define VIEW_ALGORITHM_UNDEFINED 0 +/* Special value for ALTER VIEW: inherit original algorithm. */ +#define VIEW_ALGORITHM_INHERIT DTYPE_VIEW #define VIEW_ALGORITHM_MERGE (DTYPE_VIEW | DTYPE_MERGE) #define VIEW_ALGORITHM_TMPTABLE (DTYPE_VIEW | DTYPE_MATERIALIZE) diff --git a/sql/tztime.cc b/sql/tztime.cc index d3b4fec6335..6486e9b2018 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -2523,7 +2523,8 @@ scan_tz_dir(char * name_end, uint symlink_recursion_level, uint verbose) for (i= 0; i < cur_dir->number_of_files; i++) { - if (cur_dir->dir_entry[i].name[0] != '.') + if (cur_dir->dir_entry[i].name[0] != '.' && + strcmp(cur_dir->dir_entry[i].name, "Factory")) { name_end_tmp= strmake(name_end, cur_dir->dir_entry[i].name, FN_REFLEN - (name_end - fullname)); diff --git a/sql/winservice.h b/sql/winservice.h index fca7b129de5..c3e2bfe1b20 100644 --- a/sql/winservice.h +++ b/sql/winservice.h @@ -1,40 +1,40 @@ -/*
- Copyright (c) 2011, 2012, Monty Program Ab
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/*
- Extract properties of a windows service binary path
-*/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <windows.h>
-typedef struct mysqld_service_properties_st
-{
- char mysqld_exe[MAX_PATH];
- char inifile[MAX_PATH];
- char datadir[MAX_PATH];
- int version_major;
- int version_minor;
- int version_patch;
-} mysqld_service_properties;
-
-extern int get_mysql_service_properties(const wchar_t *bin_path,
- mysqld_service_properties *props);
-
-#ifdef __cplusplus
-}
-#endif
+/* + Copyright (c) 2011, 2012, Monty Program Ab + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Extract properties of a windows service binary path +*/ +#ifdef __cplusplus +extern "C" { +#endif + +#include <windows.h> +typedef struct mysqld_service_properties_st +{ + char mysqld_exe[MAX_PATH]; + char inifile[MAX_PATH]; + char datadir[MAX_PATH]; + int version_major; + int version_minor; + int version_patch; +} mysqld_service_properties; + +extern int get_mysql_service_properties(const wchar_t *bin_path, + mysqld_service_properties *props); + +#ifdef __cplusplus +} +#endif diff --git a/storage/federatedx/README.windows b/storage/federatedx/README.windows index 3f1f2a3c79a..74de15c6521 100644 --- a/storage/federatedx/README.windows +++ b/storage/federatedx/README.windows @@ -1,23 +1,23 @@ -The following files are changed in order to build a new engine on Windows:
-
-- Update win\configure.js with
-case "WITH_FEDERATEDX_STORAGE_ENGINE":
-to make sure it will pass WITH_FEDERATEDX_STORAGE_ENGINE in.
-
-- Update CMakeFiles.txt under mysql root:
- IF(WITH_FEDERATEDX_STORAGE_ENGINE)
- ADD_DEFINITIONS(-D WITH_FEDERATEDX_STORAGE_ENGINE)
- SET (mysql_plugin_defs
- "${mysql_plugin_defs},builtin_skeleton_plugin")
- ENDIF(WITH_FEDERATEDX_STORAGE_ENGINE)
-
- and,
-
- IF(WITH_FEDERATEDX_STORAGE_ENGINE)
- ADD_SUBDIRECTORY(storage/skeleton/src)
- ENDIF(WITH_FEDERATEDX_STORAGE_ENGINE)
-
- - Update CMakeFiles.txt under sql:
- IF(WITH_FEDERATEDX_STORAGE_ENGINE)
- TARGET_LINK_LIBRARIES(mysqld skeleton)
- ENDIF(WITH_FEDERATEDX_STORAGE_ENGINE)
+The following files are changed in order to build a new engine on Windows: + +- Update win\configure.js with +case "WITH_FEDERATEDX_STORAGE_ENGINE": +to make sure it will pass WITH_FEDERATEDX_STORAGE_ENGINE in. + +- Update CMakeFiles.txt under mysql root: + IF(WITH_FEDERATEDX_STORAGE_ENGINE) + ADD_DEFINITIONS(-D WITH_FEDERATEDX_STORAGE_ENGINE) + SET (mysql_plugin_defs + "${mysql_plugin_defs},builtin_skeleton_plugin") + ENDIF(WITH_FEDERATEDX_STORAGE_ENGINE) + + and, + + IF(WITH_FEDERATEDX_STORAGE_ENGINE) + ADD_SUBDIRECTORY(storage/skeleton/src) + ENDIF(WITH_FEDERATEDX_STORAGE_ENGINE) + + - Update CMakeFiles.txt under sql: + IF(WITH_FEDERATEDX_STORAGE_ENGINE) + TARGET_LINK_LIBRARIES(mysqld skeleton) + ENDIF(WITH_FEDERATEDX_STORAGE_ENGINE) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index af112bcf000..ab1e408f4e3 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -8187,6 +8187,11 @@ ha_innobase::general_fetch( DBUG_ENTER("general_fetch"); + /* If transaction is not startted do not continue, instead return a error code. */ + if(!(prebuilt->sql_stat_start || (prebuilt->trx && prebuilt->trx->state == 1))) { + DBUG_RETURN(HA_ERR_END_OF_FILE); + } + ut_a(prebuilt->trx == thd_to_trx(user_thd)); innobase_srv_conc_enter_innodb(prebuilt->trx); diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index 0a89babb205..73c5b2be503 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -3119,10 +3119,8 @@ int maria_sort_index(HA_CHECK *param, register MARIA_HA *info, char *name) for (key= 0,keyinfo= &share->keyinfo[0]; key < share->base.keys ; key++,keyinfo++) { - if (! maria_is_key_active(share->state.key_map, key)) - continue; - - if (share->state.key_root[key] != HA_OFFSET_ERROR) + if (maria_is_key_active(share->state.key_map, key) && + share->state.key_root[key] != HA_OFFSET_ERROR) { index_pos[key]=param->new_file_pos; /* Write first block here */ if (sort_one_index(param,info,keyinfo,share->state.key_root[key], diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index b79d6c891f1..178fff6a204 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -1944,16 +1944,8 @@ int mi_sort_index(HA_CHECK *param, register MI_INFO *info, char * name) for (key= 0,keyinfo= &share->keyinfo[0]; key < share->base.keys ; key++,keyinfo++) { - if (! mi_is_key_active(info->s->state.key_map, key)) - { - /* Since the key is not active, this should not be read, but we - initialize it anyway to silence a Valgrind warn when passing that - chunk of memory to pwrite(). */ - index_pos[key]= HA_OFFSET_ERROR; - continue; - } - - if (share->state.key_root[key] != HA_OFFSET_ERROR) + if (mi_is_key_active(info->s->state.key_map, key) && + share->state.key_root[key] != HA_OFFSET_ERROR) { index_pos[key]=param->new_file_pos; /* Write first block here */ if (sort_one_index(param,info,keyinfo,share->state.key_root[key], diff --git a/storage/myisam/rt_split.c b/storage/myisam/rt_split.c index 9ab0bd99201..be61734e01c 100644 --- a/storage/myisam/rt_split.c +++ b/storage/myisam/rt_split.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2002, 2010, Oracle and/or its affiliates + Copyright (c) 2002, 2015, Oracle and/or its affiliates 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 @@ -69,6 +69,10 @@ static double mbr_join_square(const double *a, const double *b, int n_dim) b += 2; }while (a != end); + /* Check for infinity or NaN */ + if (my_isinf(square) || isnan(square)) + square = DBL_MAX; + return square; } @@ -103,6 +107,9 @@ static void pick_seeds(SplitStruct *node, int n_entries, double max_d = -DBL_MAX; double d; + *seed_a = node; + *seed_b = node + 1; + for (cur1 = node; cur1 < lim1; ++cur1) { for (cur2=cur1 + 1; cur2 < lim2; ++cur2) diff --git a/storage/sphinx/mysql-test/sphinx/my.cnf b/storage/sphinx/mysql-test/sphinx/my.cnf index a3789a065bf..f60380b7171 100644 --- a/storage/sphinx/mysql-test/sphinx/my.cnf +++ b/storage/sphinx/mysql-test/sphinx/my.cnf @@ -16,7 +16,6 @@ mem_limit = 32M [searchd] read_timeout = 5 max_children = 30 -max_matches = 1000 seamless_rotate = 1 preopen_indexes = 0 unlink_old = 1 @@ -24,7 +23,7 @@ log = @ENV.MYSQLTEST_VARDIR/searchd/sphinx-searchd.log query_log = @ENV.MYSQLTEST_VARDIR/searchd/sphinx-query.log #log-error = @ENV.MYSQLTEST_VARDIR/searchd/sphinx.log pid_file = @ENV.MYSQLTEST_VARDIR/run/searchd.pid -port = @ENV.SPHINXSEARCH_PORT +listen = @ENV.SPHINXSEARCH_PORT [ENV] SPHINXSEARCH_PORT = @OPT.port diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt index 7768930e89c..57a43930eb7 100644 --- a/storage/tokudb/CMakeLists.txt +++ b/storage/tokudb/CMakeLists.txt @@ -25,7 +25,7 @@ IF (HAVE_WVLA) ENDIF() ############################################ -SET(TOKUDB_VERSION "tokudb-7.5.6") +SET(TOKUDB_VERSION "tokudb-7.5.7") SET(TOKUDB_DEB_FILES "usr/lib/mysql/plugin/ha_tokudb.so\netc/mysql/conf.d/tokudb.cnf\nusr/bin/tokuftdump\nusr/share/doc/mariadb-server-10.0/README-TOKUDB\nusr/share/doc/mariadb-server-10.0/README.md" PARENT_SCOPE) SET(USE_BDB OFF CACHE BOOL "") MARK_AS_ADVANCED(BUILDNAME) diff --git a/storage/tokudb/ft-index/buildheader/make_tdb.cc b/storage/tokudb/ft-index/buildheader/make_tdb.cc index 3f9a721d9aa..53706649231 100644 --- a/storage/tokudb/ft-index/buildheader/make_tdb.cc +++ b/storage/tokudb/ft-index/buildheader/make_tdb.cc @@ -587,6 +587,7 @@ static void print_db_txn_struct (void) { "uint64_t (*get_client_id)(DB_TXN *)", "bool (*is_prepared)(DB_TXN *)", "DB_TXN *(*get_child)(DB_TXN *)", + "uint64_t (*get_start_time)(DB_TXN *)", NULL}; sort_and_dump_fields("db_txn", false, extra); } @@ -786,7 +787,7 @@ int main (int argc, char *const argv[] __attribute__((__unused__))) { printf("typedef void (*lock_timeout_callback)(DB *db, uint64_t requesting_txnid, const DBT *left_key, const DBT *right_key, uint64_t blocking_txnid);\n"); printf("typedef int (*iterate_row_locks_callback)(DB **db, DBT *left_key, DBT *right_key, void *extra);\n"); - printf("typedef int (*iterate_transactions_callback)(uint64_t txnid, uint64_t client_id, iterate_row_locks_callback cb, void *locks_extra, void *extra);\n"); + printf("typedef int (*iterate_transactions_callback)(DB_TXN *dbtxn, iterate_row_locks_callback cb, void *locks_extra, void *extra);\n"); printf("typedef int (*iterate_requests_callback)(DB *db, uint64_t requesting_txnid, const DBT *left_key, const DBT *right_key, uint64_t blocking_txnid, uint64_t start_time, void *extra);\n"); print_db_env_struct(); print_db_key_range_struct(); diff --git a/storage/tokudb/ft-index/ft/ft-verify.cc b/storage/tokudb/ft-index/ft/ft-verify.cc index d9606f37604..0a85136816f 100644 --- a/storage/tokudb/ft-index/ft/ft-verify.cc +++ b/storage/tokudb/ft-index/ft/ft-verify.cc @@ -160,10 +160,14 @@ get_ith_key_dbt (BASEMENTNODE bn, int i) { #define VERIFY_ASSERTION(predicate, i, string) ({ \ if(!(predicate)) { \ - (void) verbose; \ - if (true) { \ - fprintf(stderr, "%s:%d: Looking at child %d of block %" PRId64 ": %s\n", __FILE__, __LINE__, i, blocknum.b, string); \ - } \ + fprintf(stderr, "%s:%d: Looking at child %d of block %" PRId64 ": %s\n", __FILE__, __LINE__, i, blocknum.b, string); \ + result = TOKUDB_NEEDS_REPAIR; \ + if (!keep_going_on_failure) goto done; \ + }}) + +#define VERIFY_ASSERTION_BASEMENT(predicate, bn, entry, string) ({ \ + if(!(predicate)) { \ + fprintf(stderr, "%s:%d: Looking at block %" PRId64 " bn %d entry %d: %s\n", __FILE__, __LINE__, blocknum.b, bn, entry, string); \ result = TOKUDB_NEEDS_REPAIR; \ if (!keep_going_on_failure) goto done; \ }}) @@ -201,7 +205,6 @@ struct verify_message_tree_extra { int verify_message_tree(const int32_t &offset, const uint32_t UU(idx), struct verify_message_tree_extra *const e) __attribute__((nonnull(3))); int verify_message_tree(const int32_t &offset, const uint32_t UU(idx), struct verify_message_tree_extra *const e) { - int verbose = e->verbose; BLOCKNUM blocknum = e->blocknum; int keep_going_on_failure = e->keep_going_on_failure; int result = 0; @@ -236,7 +239,6 @@ int error_on_iter(const int32_t &UU(offset), const uint32_t UU(idx), void *UU(e) int verify_marked_messages(const int32_t &offset, const uint32_t UU(idx), struct verify_message_tree_extra *const e) __attribute__((nonnull(3))); int verify_marked_messages(const int32_t &offset, const uint32_t UU(idx), struct verify_message_tree_extra *const e) { - int verbose = e->verbose; BLOCKNUM blocknum = e->blocknum; int keep_going_on_failure = e->keep_going_on_failure; int result = 0; @@ -462,16 +464,16 @@ toku_verify_ftnode_internal(FT_HANDLE ft_handle, DBT kdbt = get_ith_key_dbt(bn, j); if (curr_less_pivot) { int compare = compare_pairs(ft_handle, curr_less_pivot, &kdbt); - VERIFY_ASSERTION(compare < 0, j, "The leafentry is >= the lower-bound pivot"); + VERIFY_ASSERTION_BASEMENT(compare < 0, i, j, "The leafentry is >= the lower-bound pivot"); } if (curr_geq_pivot) { int compare = compare_pairs(ft_handle, curr_geq_pivot, &kdbt); - VERIFY_ASSERTION(compare >= 0, j, "The leafentry is < the upper-bound pivot"); + VERIFY_ASSERTION_BASEMENT(compare >= 0, i, j, "The leafentry is < the upper-bound pivot"); } if (0 < j) { DBT prev_key_dbt = get_ith_key_dbt(bn, j-1); int compare = compare_pairs(ft_handle, &prev_key_dbt, &kdbt); - VERIFY_ASSERTION(compare < 0, j, "Adjacent leafentries are out of order"); + VERIFY_ASSERTION_BASEMENT(compare < 0, i, j, "Adjacent leafentries are out of order"); } } } diff --git a/storage/tokudb/ft-index/ft/logger/recover.cc b/storage/tokudb/ft-index/ft/logger/recover.cc index cae7397651d..680485201da 100644 --- a/storage/tokudb/ft-index/ft/logger/recover.cc +++ b/storage/tokudb/ft-index/ft/logger/recover.cc @@ -111,7 +111,8 @@ int tokuft_recovery_trace = 0; // turn on recovery tracing, d #endif // time in seconds between recovery progress reports -#define TOKUDB_RECOVERY_PROGRESS_TIME 15 +#define TOKUFT_RECOVERY_PROGRESS_TIME 15 +time_t tokuft_recovery_progress_time = TOKUFT_RECOVERY_PROGRESS_TIME; enum ss { BACKWARD_NEWER_CHECKPOINT_END = 1, @@ -325,14 +326,12 @@ static int recover_env_init (RECOVER_ENV renv, } static void recover_env_cleanup (RECOVER_ENV renv) { - int r; - invariant_zero(renv->fmap.filenums->size()); file_map_destroy(&renv->fmap); if (renv->destroy_logger_at_end) { toku_logger_close_rollback(renv->logger); - r = toku_logger_close(&renv->logger); + int r = toku_logger_close(&renv->logger); assert(r == 0); } else { toku_logger_write_log_files(renv->logger, true); @@ -749,6 +748,36 @@ static int toku_recover_backward_xbegin (struct logtype_xbegin *UU(l), RECOVER_E return 0; } +struct toku_txn_progress_extra { + time_t tlast; + LSN lsn; + const char *type; + TXNID_PAIR xid; + uint64_t last_total; +}; + +static void toku_recover_txn_progress(TOKU_TXN_PROGRESS txn_progress, void *extra) { + toku_txn_progress_extra *txn_progress_extra = static_cast<toku_txn_progress_extra *>(extra); + if (txn_progress_extra->last_total == 0) + txn_progress_extra->last_total = txn_progress->entries_total; + else + assert(txn_progress_extra->last_total == txn_progress->entries_total); + time_t tnow = time(NULL); + if (tnow - txn_progress_extra->tlast >= tokuft_recovery_progress_time) { + txn_progress_extra->tlast = tnow; + fprintf(stderr, "%.24s TokuFT ", ctime(&tnow)); + if (txn_progress_extra->lsn.lsn != 0) + fprintf(stderr, "lsn %" PRIu64 " ", txn_progress_extra->lsn.lsn); + fprintf(stderr, "%s xid %" PRIu64 ":%" PRIu64 " ", + txn_progress_extra->type, txn_progress_extra->xid.parent_id64, txn_progress_extra->xid.child_id64); + fprintf(stderr, "%" PRIu64 "/%" PRIu64 " ", + txn_progress->entries_processed, txn_progress->entries_total); + if (txn_progress->entries_total > 0) + fprintf(stderr, "%.0f%% ", ((double) txn_progress->entries_processed / (double) txn_progress->entries_total) * 100.0); + fprintf(stderr, "\n"); + } +} + static int toku_recover_xcommit (struct logtype_xcommit *l, RECOVER_ENV renv) { // find the transaction by transaction id TOKUTXN txn = NULL; @@ -756,8 +785,8 @@ static int toku_recover_xcommit (struct logtype_xcommit *l, RECOVER_ENV renv) { assert(txn!=NULL); // commit the transaction - int r = toku_txn_commit_with_lsn(txn, true, l->lsn, - NULL, NULL); + toku_txn_progress_extra extra = { time(NULL), l->lsn, "commit", l->xid }; + int r = toku_txn_commit_with_lsn(txn, true, l->lsn, toku_recover_txn_progress, &extra); assert(r == 0); // close the transaction @@ -799,7 +828,8 @@ static int toku_recover_xabort (struct logtype_xabort *l, RECOVER_ENV renv) { assert(txn!=NULL); // abort the transaction - r = toku_txn_abort_with_lsn(txn, l->lsn, NULL, NULL); + toku_txn_progress_extra extra = { time(NULL), l->lsn, "abort", l->xid }; + r = toku_txn_abort_with_lsn(txn, l->lsn, toku_recover_txn_progress, &extra); assert(r == 0); // close the transaction @@ -1301,7 +1331,6 @@ static int is_txn_unprepared(TOKUTXN txn, void* extra) { return 0; } - static int find_an_unprepared_txn (RECOVER_ENV renv, TOKUTXN *txnp) { TOKUTXN txn = nullptr; int r = toku_txn_manager_iter_over_live_root_txns( @@ -1326,6 +1355,7 @@ static int call_prepare_txn_callback_iter(TOKUTXN txn, void* extra) { } static void recover_abort_live_txn(TOKUTXN txn) { + fprintf(stderr, "%s %" PRIu64 "\n", __FUNCTION__, txn->txnid.parent_id64); // recursively abort all children first if (txn->child != NULL) { recover_abort_live_txn(txn->child); @@ -1333,7 +1363,8 @@ static void recover_abort_live_txn(TOKUTXN txn) { // sanity check that the recursive call successfully NULLs out txn->child invariant(txn->child == NULL); // abort the transaction - int r = toku_txn_abort_txn(txn, NULL, NULL); + toku_txn_progress_extra extra = { time(NULL), ZERO_LSN, "abort live", txn->txnid }; + int r = toku_txn_abort_txn(txn, toku_recover_txn_progress, &extra); assert(r == 0); // close the transaction @@ -1451,9 +1482,10 @@ static int do_recovery(RECOVER_ENV renv, const char *env_dir, const char *log_di // trace progress if ((i % 1000) == 0) { tnow = time(NULL); - if (tnow - tlast >= TOKUDB_RECOVERY_PROGRESS_TIME) { + if (tnow - tlast >= tokuft_recovery_progress_time) { thislsn = toku_log_entry_get_lsn(le); - fprintf(stderr, "%.24s TokuFT recovery scanning backward from %" PRIu64 " at %" PRIu64 " (%s)\n", ctime(&tnow), lastlsn.lsn, thislsn.lsn, recover_state(renv)); + fprintf(stderr, "%.24s TokuFT recovery scanning backward from %" PRIu64 " at %" PRIu64 " (%s)\n", + ctime(&tnow), lastlsn.lsn, thislsn.lsn, recover_state(renv)); tlast = tnow; } } @@ -1482,16 +1514,18 @@ static int do_recovery(RECOVER_ENV renv, const char *env_dir, const char *log_di assert(le); thislsn = toku_log_entry_get_lsn(le); tnow = time(NULL); - fprintf(stderr, "%.24s TokuFT recovery starts scanning forward to %" PRIu64 " from %" PRIu64 " left %" PRIu64 " (%s)\n", ctime(&tnow), lastlsn.lsn, thislsn.lsn, lastlsn.lsn - thislsn.lsn, recover_state(renv)); + fprintf(stderr, "%.24s TokuFT recovery starts scanning forward to %" PRIu64 " from %" PRIu64 " left %" PRIu64 " (%s)\n", + ctime(&tnow), lastlsn.lsn, thislsn.lsn, lastlsn.lsn - thislsn.lsn, recover_state(renv)); for (unsigned i=0; 1; i++) { // trace progress if ((i % 1000) == 0) { tnow = time(NULL); - if (tnow - tlast >= TOKUDB_RECOVERY_PROGRESS_TIME) { + if (tnow - tlast >= tokuft_recovery_progress_time) { thislsn = toku_log_entry_get_lsn(le); - fprintf(stderr, "%.24s TokuFT recovery scanning forward to %" PRIu64 " at %" PRIu64 " left %" PRIu64 " (%s)\n", ctime(&tnow), lastlsn.lsn, thislsn.lsn, lastlsn.lsn - thislsn.lsn, recover_state(renv)); + fprintf(stderr, "%.24s TokuFT recovery scanning forward to %" PRIu64 " at %" PRIu64 " left %" PRIu64 " (%s)\n", + ctime(&tnow), lastlsn.lsn, thislsn.lsn, lastlsn.lsn - thislsn.lsn, recover_state(renv)); tlast = tnow; } } diff --git a/storage/tokudb/ft-index/ft/txn/txn.cc b/storage/tokudb/ft-index/ft/txn/txn.cc index 18d5a6b67dd..922c955a6b5 100644 --- a/storage/tokudb/ft-index/ft/txn/txn.cc +++ b/storage/tokudb/ft-index/ft/txn/txn.cc @@ -344,6 +344,7 @@ static txn_child_manager tcm; .state = TOKUTXN_LIVE, .num_pin = 0, .client_id = 0, + .start_time = time(NULL), }; TOKUTXN result = NULL; @@ -787,6 +788,10 @@ void toku_txn_set_client_id(TOKUTXN txn, uint64_t client_id) { txn->client_id = client_id; } +time_t toku_txn_get_start_time(struct tokutxn *txn) { + return txn->start_time; +} + int toku_txn_reads_txnid(TXNID txnid, TOKUTXN txn) { int r = 0; TXNID oldest_live_in_snapshot = toku_get_oldest_in_live_root_txn_list(txn); diff --git a/storage/tokudb/ft-index/ft/txn/txn.h b/storage/tokudb/ft-index/ft/txn/txn.h index 6381b5a7779..4f2778bf858 100644 --- a/storage/tokudb/ft-index/ft/txn/txn.h +++ b/storage/tokudb/ft-index/ft/txn/txn.h @@ -253,6 +253,7 @@ struct tokutxn { uint32_t num_pin; // number of threads (all hot indexes) that want this // txn to not transition to commit or abort uint64_t client_id; + time_t start_time; }; typedef struct tokutxn *TOKUTXN; @@ -368,6 +369,8 @@ bool toku_txn_has_spilled_rollback(struct tokutxn *txn); uint64_t toku_txn_get_client_id(struct tokutxn *txn); void toku_txn_set_client_id(struct tokutxn *txn, uint64_t client_id); +time_t toku_txn_get_start_time(struct tokutxn *txn); + // // This function is used by the leafentry iterators. // returns TOKUDB_ACCEPT if live transaction context is allowed to read a value diff --git a/storage/tokudb/ft-index/src/tests/test_iterate_live_transactions.cc b/storage/tokudb/ft-index/src/tests/test_iterate_live_transactions.cc index dd00ddeeb9a..c104c5c8541 100644 --- a/storage/tokudb/ft-index/src/tests/test_iterate_live_transactions.cc +++ b/storage/tokudb/ft-index/src/tests/test_iterate_live_transactions.cc @@ -104,9 +104,11 @@ struct iterate_extra { bool visited_txn[3]; }; -static int iterate_callback(uint64_t txnid, uint64_t client_id, +static int iterate_callback(DB_TXN *txn, iterate_row_locks_callback iterate_locks, void *locks_extra, void *extra) { + uint64_t txnid = txn->id64(txn); + uint64_t client_id = txn->get_client_id(txn); iterate_extra *info = reinterpret_cast<iterate_extra *>(extra); DB *db; DBT left_key, right_key; diff --git a/storage/tokudb/ft-index/src/tests/test_stress0.cc b/storage/tokudb/ft-index/src/tests/test_stress0.cc index 5dbca08db48..26192d851aa 100644 --- a/storage/tokudb/ft-index/src/tests/test_stress0.cc +++ b/storage/tokudb/ft-index/src/tests/test_stress0.cc @@ -140,9 +140,11 @@ static int UU() iterate_pending_lock_requests_op(DB_TXN *UU(txn), ARG arg, void return r; } -static int iterate_txns(uint64_t txnid, uint64_t client_id, +static int iterate_txns(DB_TXN *txn, iterate_row_locks_callback iterate_locks, void *locks_extra, void *extra) { + uint64_t txnid = txn->id64(txn); + uint64_t client_id = txn->get_client_id(txn); invariant_null(extra); invariant(txnid > 0); invariant(client_id == 0); diff --git a/storage/tokudb/ft-index/src/ydb.cc b/storage/tokudb/ft-index/src/ydb.cc index 85445a67eef..ab15a44489e 100644 --- a/storage/tokudb/ft-index/src/ydb.cc +++ b/storage/tokudb/ft-index/src/ydb.cc @@ -2492,24 +2492,21 @@ struct iter_txns_callback_extra { }; static int iter_txns_callback(TOKUTXN txn, void *extra) { + int r = 0; iter_txns_callback_extra *info = reinterpret_cast<iter_txns_callback_extra *>(extra); - DB_TXN *dbtxn = toku_txn_get_container_db_txn(txn); invariant_notnull(dbtxn); + if (db_txn_struct_i(dbtxn)->tokutxn == txn) { // make sure that the dbtxn is fully initialized + toku_mutex_lock(&db_txn_struct_i(dbtxn)->txn_mutex); + toku_pthread_rwlock_rdlock(&info->env->i->open_dbs_rwlock); - toku_mutex_lock(&db_txn_struct_i(dbtxn)->txn_mutex); - toku_pthread_rwlock_rdlock(&info->env->i->open_dbs_rwlock); - - iter_txn_row_locks_callback_extra e(info->env, &db_txn_struct_i(dbtxn)->lt_map); - const int r = info->callback(toku_txn_get_txnid(txn).parent_id64, - toku_txn_get_client_id(txn), - iter_txn_row_locks_callback, - &e, - info->extra); + iter_txn_row_locks_callback_extra e(info->env, &db_txn_struct_i(dbtxn)->lt_map); + r = info->callback(dbtxn, iter_txn_row_locks_callback, &e, info->extra); - toku_pthread_rwlock_rdunlock(&info->env->i->open_dbs_rwlock); - toku_mutex_unlock(&db_txn_struct_i(dbtxn)->txn_mutex); + toku_pthread_rwlock_rdunlock(&info->env->i->open_dbs_rwlock); + toku_mutex_unlock(&db_txn_struct_i(dbtxn)->txn_mutex); + } return r; } diff --git a/storage/tokudb/ft-index/src/ydb_txn.cc b/storage/tokudb/ft-index/src/ydb_txn.cc index 82903849535..885c6b713b2 100644 --- a/storage/tokudb/ft-index/src/ydb_txn.cc +++ b/storage/tokudb/ft-index/src/ydb_txn.cc @@ -433,6 +433,11 @@ static DB_TXN *toku_txn_get_child(DB_TXN *txn) { return db_txn_struct_i(txn)->child; } +static uint64_t toku_txn_get_start_time(DB_TXN *txn) { + TOKUTXN ttxn = db_txn_struct_i(txn)->tokutxn; + return toku_txn_get_start_time(ttxn); +} + static inline void txn_func_init(DB_TXN *txn) { #define STXN(name) txn->name = locked_txn_ ## name STXN(abort); @@ -451,6 +456,7 @@ static inline void txn_func_init(DB_TXN *txn) { txn->id64 = toku_txn_id64; txn->is_prepared = toku_txn_is_prepared; txn->get_child = toku_txn_get_child; + txn->get_start_time = toku_txn_get_start_time; } // diff --git a/storage/tokudb/ft-index/tools/CMakeLists.txt b/storage/tokudb/ft-index/tools/CMakeLists.txt index 71c44df9acd..f745517d84e 100644 --- a/storage/tokudb/ft-index/tools/CMakeLists.txt +++ b/storage/tokudb/ft-index/tools/CMakeLists.txt @@ -1,6 +1,6 @@ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE DONT_DEPRECATE_ERRNO) -set(tools tokudb_dump tokuftdump tdb_logprint tdb-recover ftverify ba_replay) +set(tools tokudb_dump tokuftdump tokuft_logprint tdb-recover ftverify ba_replay) foreach(tool ${tools}) add_executable(${tool} ${tool}.cc) add_dependencies(${tool} install_tdb_h) @@ -12,9 +12,6 @@ endforeach(tool) # link in math.h library just for this tool. target_link_libraries(ftverify m) -install( - TARGETS tokuftdump - DESTINATION ${INSTALL_BINDIR} - COMPONENT Server - ) +install(TARGETS tokuftdump DESTINATION ${INSTALL_BINDIR} COMPONENT Server) +install(TARGETS tokuft_logprint DESTINATION ${INSTALL_BINDIR} COMPONENT Server) diff --git a/storage/tokudb/ft-index/tools/tdb_logprint.cc b/storage/tokudb/ft-index/tools/tokuft_logprint.cc index 15a28632cfb..1dd7581b9f5 100644 --- a/storage/tokudb/ft-index/tools/tdb_logprint.cc +++ b/storage/tokudb/ft-index/tools/tokuft_logprint.cc @@ -91,8 +91,6 @@ PATENT RIGHTS GRANT: /* Dump the log from stdin to stdout. */ -#include <config.h> - #include "ft/log_header.h" #include "ft/logger/logger.h" diff --git a/storage/tokudb/ft-index/tools/tokuftdump.cc b/storage/tokudb/ft-index/tools/tokuftdump.cc index d680a3dd0d0..14c3c31a061 100644 --- a/storage/tokudb/ft-index/tools/tokuftdump.cc +++ b/storage/tokudb/ft-index/tools/tokuftdump.cc @@ -250,6 +250,8 @@ static int64_t getRootNode(FT ft) { } static int print_le(const void* key, const uint32_t keylen, const LEAFENTRY &le, const uint32_t idx UU(), void *const ai UU()) { + unsigned int *le_index = (unsigned int *) ai; + printf("%u: ", *le_index); *le_index += 1; print_klpair(stdout, key, keylen, le); printf("\n"); return 0; @@ -539,7 +541,8 @@ ok: printf(" n_bytes_in_buffer= %" PRIu64 "", BLB_DATA(n, i)->get_disk_size()); printf(" items_in_buffer=%u\n", BLB_DATA(n, i)->num_klpairs()); if (do_dump_data) { - BLB_DATA(n, i)->iterate<void, print_le>(NULL); + unsigned int le_index = 0; + BLB_DATA(n, i)->iterate<void, print_le>(&le_index); } } } @@ -938,6 +941,7 @@ static void run_iteractive_loop(int fd, FT ft, CACHEFILE cf) { } else if (strcmp(fields[0], "header") == 0) { toku_ft_free(ft); open_header(fd, &ft, cf); + dump_header(ft); } else if (strcmp(fields[0], "rn") == 0||strcmp(fields[0], "rootNode")==0||strcmp(fields[0], "rootnode") == 0) { printf("Root node :%d\n",root); } else if (strcmp(fields[0], "block") == 0 && nfields == 2) { diff --git a/storage/tokudb/ft-index/util/scoped_malloc.cc b/storage/tokudb/ft-index/util/scoped_malloc.cc index 551bd944beb..15d4fb3e52e 100644 --- a/storage/tokudb/ft-index/util/scoped_malloc.cc +++ b/storage/tokudb/ft-index/util/scoped_malloc.cc @@ -145,6 +145,9 @@ namespace toku { } void destroy() { +#if TOKU_SCOPED_MALLOC_DEBUG + printf("%s %p %p\n", __FUNCTION__, this, m_stack); +#endif if (m_stack != NULL) { toku_free(m_stack); m_stack = NULL; @@ -167,13 +170,17 @@ namespace toku { static void destroy_and_deregister(void *key) { invariant_notnull(key); tl_stack *st = reinterpret_cast<tl_stack *>(key); - st->destroy(); + size_t n = 0; toku_mutex_lock(&global_stack_set_mutex); - invariant_notnull(global_stack_set); - size_t n = global_stack_set->erase(st); - invariant(n == 1); + if (global_stack_set) { + n = global_stack_set->erase(st); + } toku_mutex_unlock(&global_stack_set_mutex); + + if (n == 1) { + st->destroy(); // destroy the stack if this function erased it from the set. otherwise, somebody else destroyed it. + } } // Allocate 'size' bytes and return a pointer to the first byte @@ -244,6 +251,11 @@ void toku_scoped_malloc_init(void) { } void toku_scoped_malloc_destroy(void) { + toku_scoped_malloc_destroy_key(); + toku_scoped_malloc_destroy_set(); +} + +void toku_scoped_malloc_destroy_set(void) { toku_mutex_lock(&toku::global_stack_set_mutex); invariant_notnull(toku::global_stack_set); // Destroy any tl_stacks that were registered as thread locals but did not @@ -254,10 +266,11 @@ void toku_scoped_malloc_destroy(void) { (*i)->destroy(); } delete toku::global_stack_set; + toku::global_stack_set = nullptr; toku_mutex_unlock(&toku::global_stack_set_mutex); +} - // We're deregistering the destructor key here. When this thread exits, - // the tl_stack destructor won't get called, so we need to do that first. +void toku_scoped_malloc_destroy_key(void) { int r = pthread_key_delete(toku::tl_stack_destroy_pthread_key); invariant_zero(r); } diff --git a/storage/tokudb/ft-index/util/scoped_malloc.h b/storage/tokudb/ft-index/util/scoped_malloc.h index dbd919d155e..0233b0f1aa5 100644 --- a/storage/tokudb/ft-index/util/scoped_malloc.h +++ b/storage/tokudb/ft-index/util/scoped_malloc.h @@ -151,3 +151,7 @@ void toku_scoped_malloc_init(void); void toku_scoped_malloc_destroy(void); +void toku_scoped_malloc_destroy_set(void); + +void toku_scoped_malloc_destroy_key(void); + diff --git a/storage/tokudb/ft-index/util/tests/sm-basic.cc b/storage/tokudb/ft-index/util/tests/sm-basic.cc new file mode 100644 index 00000000000..5df64294721 --- /dev/null +++ b/storage/tokudb/ft-index/util/tests/sm-basic.cc @@ -0,0 +1,127 @@ +/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4: +#ident "$Id$" +/* +COPYING CONDITIONS NOTICE: + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation, and provided that the + following conditions are met: + + * Redistributions of source code must retain this COPYING + CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the + DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the + PATENT MARKING NOTICE (below), and the PATENT RIGHTS + GRANT (below). + + * Redistributions in binary form must reproduce this COPYING + CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the + DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the + PATENT MARKING NOTICE (below), and the PATENT RIGHTS + GRANT (below) in the documentation and/or other materials + provided with the distribution. + + 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-1301, USA. + +COPYRIGHT NOTICE: + + TokuFT, Tokutek Fractal Tree Indexing Library. + Copyright (C) 2007-2013 Tokutek, Inc. + +DISCLAIMER: + + 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. + +UNIVERSITY PATENT NOTICE: + + The technology is licensed by the Massachusetts Institute of + Technology, Rutgers State University of New Jersey, and the Research + Foundation of State University of New York at Stony Brook under + United States of America Serial No. 11/760379 and to the patents + and/or patent applications resulting from it. + +PATENT MARKING NOTICE: + + This software is covered by US Patent No. 8,185,551. + This software is covered by US Patent No. 8,489,638. + +PATENT RIGHTS GRANT: + + "THIS IMPLEMENTATION" means the copyrightable works distributed by + Tokutek as part of the Fractal Tree project. + + "PATENT CLAIMS" means the claims of patents that are owned or + licensable by Tokutek, both currently or in the future; and that in + the absence of this license would be infringed by THIS + IMPLEMENTATION or by using or running THIS IMPLEMENTATION. + + "PATENT CHALLENGE" shall mean a challenge to the validity, + patentability, enforceability and/or non-infringement of any of the + PATENT CLAIMS or otherwise opposing any of the PATENT CLAIMS. + + Tokutek hereby grants to you, for the term and geographical scope of + the PATENT CLAIMS, a non-exclusive, no-charge, royalty-free, + irrevocable (except as stated in this section) patent license to + make, have made, use, offer to sell, sell, import, transfer, and + otherwise run, modify, and propagate the contents of THIS + IMPLEMENTATION, where such license applies only to the PATENT + CLAIMS. This grant does not include claims that would be infringed + only as a consequence of further modifications of THIS + IMPLEMENTATION. If you or your agent or licensee institute or order + or agree to the institution of patent litigation against any entity + (including a cross-claim or counterclaim in a lawsuit) alleging that + THIS IMPLEMENTATION constitutes direct or contributory patent + infringement, or inducement of patent infringement, then any rights + granted to you under this License shall terminate as of the date + such litigation is filed. If you or your agent or exclusive + licensee institute or order or agree to the institution of a PATENT + CHALLENGE, then Tokutek may terminate any rights granted to you + under this License. +*/ + +// test that basic scoped malloc works with a thread + +#ident "Copyright (c) 2015 Tokutek Inc. All rights reserved." +#include <toku_portability.h> +#include <toku_assert.h> +#include <toku_pthread.h> +#include <util/scoped_malloc.h> + +static void sm_test(void) { + toku::scoped_malloc a(1); + { + toku::scoped_malloc b(2); + { + toku::scoped_malloc c(3); + } + } +} + +static void *sm_test_f(void *arg) { + sm_test(); + return arg; +} + +int main(void) { + toku_scoped_malloc_init(); + + // run the test + toku_pthread_t tid; + int r; + r = toku_pthread_create(&tid, NULL, sm_test_f, NULL); + assert_zero(r); + void *ret; + r = toku_pthread_join(tid, &ret); + assert_zero(r); + + toku_scoped_malloc_destroy(); + + return 0; +} diff --git a/storage/tokudb/ft-index/util/tests/sm-crash-double-free.cc b/storage/tokudb/ft-index/util/tests/sm-crash-double-free.cc new file mode 100644 index 00000000000..653d4148fd0 --- /dev/null +++ b/storage/tokudb/ft-index/util/tests/sm-crash-double-free.cc @@ -0,0 +1,128 @@ +/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4: +#ident "$Id$" +/* +COPYING CONDITIONS NOTICE: + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation, and provided that the + following conditions are met: + + * Redistributions of source code must retain this COPYING + CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the + DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the + PATENT MARKING NOTICE (below), and the PATENT RIGHTS + GRANT (below). + + * Redistributions in binary form must reproduce this COPYING + CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the + DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the + PATENT MARKING NOTICE (below), and the PATENT RIGHTS + GRANT (below) in the documentation and/or other materials + provided with the distribution. + + 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-1301, USA. + +COPYRIGHT NOTICE: + + TokuFT, Tokutek Fractal Tree Indexing Library. + Copyright (C) 2007-2013 Tokutek, Inc. + +DISCLAIMER: + + 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. + +UNIVERSITY PATENT NOTICE: + + The technology is licensed by the Massachusetts Institute of + Technology, Rutgers State University of New Jersey, and the Research + Foundation of State University of New York at Stony Brook under + United States of America Serial No. 11/760379 and to the patents + and/or patent applications resulting from it. + +PATENT MARKING NOTICE: + + This software is covered by US Patent No. 8,185,551. + This software is covered by US Patent No. 8,489,638. + +PATENT RIGHTS GRANT: + + "THIS IMPLEMENTATION" means the copyrightable works distributed by + Tokutek as part of the Fractal Tree project. + + "PATENT CLAIMS" means the claims of patents that are owned or + licensable by Tokutek, both currently or in the future; and that in + the absence of this license would be infringed by THIS + IMPLEMENTATION or by using or running THIS IMPLEMENTATION. + + "PATENT CHALLENGE" shall mean a challenge to the validity, + patentability, enforceability and/or non-infringement of any of the + PATENT CLAIMS or otherwise opposing any of the PATENT CLAIMS. + + Tokutek hereby grants to you, for the term and geographical scope of + the PATENT CLAIMS, a non-exclusive, no-charge, royalty-free, + irrevocable (except as stated in this section) patent license to + make, have made, use, offer to sell, sell, import, transfer, and + otherwise run, modify, and propagate the contents of THIS + IMPLEMENTATION, where such license applies only to the PATENT + CLAIMS. This grant does not include claims that would be infringed + only as a consequence of further modifications of THIS + IMPLEMENTATION. If you or your agent or licensee institute or order + or agree to the institution of patent litigation against any entity + (including a cross-claim or counterclaim in a lawsuit) alleging that + THIS IMPLEMENTATION constitutes direct or contributory patent + infringement, or inducement of patent infringement, then any rights + granted to you under this License shall terminate as of the date + such litigation is filed. If you or your agent or exclusive + licensee institute or order or agree to the institution of a PATENT + CHALLENGE, then Tokutek may terminate any rights granted to you + under this License. +*/ + +// force a race between the scoped malloc global destructor and a thread variable destructor + +#ident "Copyright (c) 2015 Tokutek Inc. All rights reserved." +#define TOKU_SCOPED_MALLOC_DEBUG 1 +#include <toku_portability.h> +#include <toku_assert.h> +#include <toku_pthread.h> +#include <toku_race_tools.h> +#include <util/scoped_malloc.h> + +volatile int state = 0; + +static void sm_test(void) { + toku::scoped_malloc a(1); +} + +static void *sm_test_f(void *arg) { + sm_test(); + state = 1; + while (state != 2) sleep(1); + return arg; +} + +int main(void) { + TOKU_VALGRIND_HG_DISABLE_CHECKING(&state, sizeof state); + state = 0; + toku_scoped_malloc_init(); + toku_pthread_t tid; + int r; + r = toku_pthread_create(&tid, NULL, sm_test_f, NULL); + assert_zero(r); + void *ret; + while (state != 1) sleep(1); + toku_scoped_malloc_destroy_set(); + state = 2; + r = toku_pthread_join(tid, &ret); + assert_zero(r); + toku_scoped_malloc_destroy_key(); + return 0; +} diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc index d6c74aeb1d1..1b022cd3468 100644 --- a/storage/tokudb/ha_tokudb.cc +++ b/storage/tokudb/ha_tokudb.cc @@ -6204,6 +6204,12 @@ int ha_tokudb::external_lock(THD * thd, int lock_type) { if (error) { goto cleanup; } thd_set_ha_data(thd, tokudb_hton, trx); } + + if (tokudb_debug & TOKUDB_DEBUG_TXN) { + TOKUDB_HANDLER_TRACE("trx %p %p %p %p %u %u", trx->all, trx->stmt, trx->sp_level, trx->sub_sp_level, + trx->tokudb_lock_count, trx->create_lock_count); + } + if (trx->all == NULL) { trx->sp_level = NULL; } @@ -6212,22 +6218,16 @@ int ha_tokudb::external_lock(THD * thd, int lock_type) { if (lock_type == F_WRLCK) { use_write_locks = true; } - if (!trx->tokudb_lock_count++) { - if (trx->stmt) { - if (tokudb_debug & TOKUDB_DEBUG_TXN) { - TOKUDB_HANDLER_TRACE("stmt already set %p %p %p %p", trx->all, trx->stmt, trx->sp_level, trx->sub_sp_level); - } - } else { - assert(trx->stmt == 0); - transaction = NULL; // Safety - error = create_txn(thd, trx); - if (error) { - trx->tokudb_lock_count--; // We didn't get the lock - goto cleanup; - } + if (!trx->stmt) { + transaction = NULL; // Safety + error = create_txn(thd, trx); + if (error) { + goto cleanup; } + trx->create_lock_count = trx->tokudb_lock_count; } transaction = trx->sub_sp_level; + trx->tokudb_lock_count++; } else { tokudb_pthread_mutex_lock(&share->mutex); @@ -6242,21 +6242,24 @@ int ha_tokudb::external_lock(THD * thd, int lock_type) { added_rows = 0; deleted_rows = 0; share->rows_from_locked_table = 0; - if (trx->tokudb_lock_count > 0 && !--trx->tokudb_lock_count) { - if (trx->stmt) { - /* - F_UNLCK is done without a transaction commit / rollback. - This happens if the thread didn't update any rows - We must in this case commit the work to keep the row locks - */ - DBUG_PRINT("trans", ("commiting non-updating transaction")); - reset_stmt_progress(&trx->stmt_progress); - commit_txn(trx->stmt, 0); - trx->stmt = NULL; - trx->sub_sp_level = NULL; + if (trx->tokudb_lock_count > 0) { + if (--trx->tokudb_lock_count <= trx->create_lock_count) { + trx->create_lock_count = 0; + if (trx->stmt) { + /* + F_UNLCK is done without a transaction commit / rollback. + This happens if the thread didn't update any rows + We must in this case commit the work to keep the row locks + */ + DBUG_PRINT("trans", ("commiting non-updating transaction")); + reset_stmt_progress(&trx->stmt_progress); + commit_txn(trx->stmt, 0); + trx->stmt = NULL; + trx->sub_sp_level = NULL; + } } + transaction = NULL; } - transaction = NULL; } cleanup: if (tokudb_debug & TOKUDB_DEBUG_LOCK) @@ -6271,8 +6274,9 @@ cleanup: */ int ha_tokudb::start_stmt(THD * thd, thr_lock_type lock_type) { TOKUDB_HANDLER_DBUG_ENTER("cmd %d lock %d %s", thd_sql_command(thd), lock_type, share->table_name); - if (0) + if (tokudb_debug & TOKUDB_DEBUG_LOCK) { TOKUDB_HANDLER_TRACE("q %s", thd->query()); + } int error = 0; tokudb_trx_data *trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton); @@ -6282,6 +6286,11 @@ int ha_tokudb::start_stmt(THD * thd, thr_lock_type lock_type) { thd_set_ha_data(thd, tokudb_hton, trx); } + if (tokudb_debug & TOKUDB_DEBUG_TXN) { + TOKUDB_HANDLER_TRACE("trx %p %p %p %p %u %u", trx->all, trx->stmt, trx->sp_level, trx->sub_sp_level, + trx->tokudb_lock_count, trx->create_lock_count); + } + /* note that trx->stmt may have been already initialized as start_stmt() is called for *each table* not for each storage engine, @@ -6292,9 +6301,7 @@ int ha_tokudb::start_stmt(THD * thd, thr_lock_type lock_type) { if (error) { goto cleanup; } - if (tokudb_debug & TOKUDB_DEBUG_TXN) { - TOKUDB_HANDLER_TRACE("%p %p %p %p %u", trx->all, trx->stmt, trx->sp_level, trx->sub_sp_level, trx->tokudb_lock_count); - } + trx->create_lock_count = trx->tokudb_lock_count; } else { if (tokudb_debug & TOKUDB_DEBUG_TXN) { diff --git a/storage/tokudb/ha_tokudb_admin.cc b/storage/tokudb/ha_tokudb_admin.cc index b109cd1b976..42205c6d6be 100644 --- a/storage/tokudb/ha_tokudb_admin.cc +++ b/storage/tokudb/ha_tokudb_admin.cc @@ -121,9 +121,10 @@ static int analyze_progress(void *v_extra, uint64_t rows) { progress_time = (float) (t_now - t_start) / (float) t_limit; char *write_status_msg = extra->write_status_msg; TABLE_SHARE *table_share = extra->table_share; - sprintf(write_status_msg, "%s.%s.%s %u of %u %.lf%% rows %.lf%% time", - table_share->db.str, table_share->table_name.str, extra->key_name, - extra->key_i, table_share->keys, progress_rows * 100.0, progress_time * 100.0); + sprintf(write_status_msg, "%.*s.%.*s.%s %u of %u %.lf%% rows %.lf%% time", + (int) table_share->db.length, table_share->db.str, + (int) table_share->table_name.length, table_share->table_name.str, + extra->key_name, extra->key_i, table_share->keys, progress_rows * 100.0, progress_time * 100.0); thd_proc_info(thd, write_status_msg); return 0; } @@ -338,8 +339,10 @@ static int ha_tokudb_check_progress(void *extra, float progress) { static void ha_tokudb_check_info(THD *thd, TABLE *table, const char *msg) { if (thd->vio_ok()) { - char tablename[256]; - snprintf(tablename, sizeof tablename, "%s.%s", table->s->db.str, table->s->table_name.str); + char tablename[table->s->db.length + 1 + table->s->table_name.length + 1]; + snprintf(tablename, sizeof tablename, "%.*s.%.*s", + (int) table->s->db.length, table->s->db.str, + (int) table->s->table_name.length, table->s->table_name.str); thd->protocol->prepare_for_resend(); thd->protocol->store(tablename, strlen(tablename), system_charset_info); thd->protocol->store("check", 5, system_charset_info); @@ -388,6 +391,11 @@ int ha_tokudb::check(THD *thd, HA_CHECK_OPT *check_opt) { } struct check_context check_context = { thd }; r = db->verify_with_progress(db, ha_tokudb_check_progress, &check_context, (tokudb_debug & TOKUDB_DEBUG_CHECK) != 0, keep_going); + if (r != 0) { + char msg[32 + strlen(kname)]; + sprintf(msg, "Corrupt %s", kname); + ha_tokudb_check_info(thd, table, msg); + } snprintf(write_status_msg, sizeof write_status_msg, "%s key=%s %u result=%d", share->table_name, kname, i, r); thd_proc_info(thd, write_status_msg); if (tokudb_debug & TOKUDB_DEBUG_CHECK) { diff --git a/storage/tokudb/ha_tokudb_alter_56.cc b/storage/tokudb/ha_tokudb_alter_56.cc index cae50446fa0..213b58459bc 100644 --- a/storage/tokudb/ha_tokudb_alter_56.cc +++ b/storage/tokudb/ha_tokudb_alter_56.cc @@ -784,13 +784,16 @@ bool ha_tokudb::commit_inplace_alter_table(TABLE *altered_table, Alter_inplace_i assert(trx->tokudb_lock_count > 0); // for partitioned tables, we use a single transaction to do all of the partition changes. the tokudb_lock_count // is a reference count for each of the handlers to the same transaction. obviously, we want to only abort once. - if (!--trx->tokudb_lock_count) { - abort_txn(ctx->alter_txn); - ctx->alter_txn = NULL; - trx->stmt = NULL; - trx->sub_sp_level = NULL; + if (trx->tokudb_lock_count > 0) { + if (--trx->tokudb_lock_count <= trx->create_lock_count) { + trx->create_lock_count = 0; + abort_txn(ctx->alter_txn); + ctx->alter_txn = NULL; + trx->stmt = NULL; + trx->sub_sp_level = NULL; + } + transaction = NULL; } - transaction = NULL; if (ctx->add_index_changed) { restore_add_index(table, ha_alter_info->index_add_count, ctx->incremented_num_DBs, ctx->modified_DBs); diff --git a/storage/tokudb/hatoku_defines.h b/storage/tokudb/hatoku_defines.h index c816902a697..bc3d890fffe 100644 --- a/storage/tokudb/hatoku_defines.h +++ b/storage/tokudb/hatoku_defines.h @@ -355,6 +355,7 @@ typedef struct st_tokudb_trx_data { DB_TXN *sp_level; DB_TXN *sub_sp_level; uint tokudb_lock_count; + uint create_lock_count; tokudb_stmt_progress stmt_progress; bool checkpoint_lock_taken; LIST *handlers; diff --git a/storage/tokudb/hatoku_hton.cc b/storage/tokudb/hatoku_hton.cc index 5dada7777a0..a804fc80489 100644 --- a/storage/tokudb/hatoku_hton.cc +++ b/storage/tokudb/hatoku_hton.cc @@ -1714,6 +1714,8 @@ static int tokudb_fractal_tree_info(TABLE *table, THD *thd) { error = tmp_cursor->c_get(tmp_cursor, &curr_key, &curr_val, DB_NEXT); if (!error) { error = tokudb_report_fractal_tree_info_for_db(&curr_key, &curr_val, table, thd); + if (error) + error = 0; // ignore read uncommitted errors } if (!error && thd_killed(thd)) error = ER_QUERY_INTERRUPTED; @@ -1992,7 +1994,9 @@ struct tokudb_search_txn_extra { uint64_t match_client_id; }; -static int tokudb_search_txn_callback(uint64_t txn_id, uint64_t client_id, iterate_row_locks_callback iterate_locks, void *locks_extra, void *extra) { +static int tokudb_search_txn_callback(DB_TXN *txn, iterate_row_locks_callback iterate_locks, void *locks_extra, void *extra) { + uint64_t txn_id = txn->id64(txn); + uint64_t client_id = txn->get_client_id(txn); struct tokudb_search_txn_extra *e = reinterpret_cast<struct tokudb_search_txn_extra *>(extra); if (e->match_txn_id == txn_id) { e->match_found = true; @@ -2124,6 +2128,7 @@ static struct st_mysql_information_schema tokudb_trx_information_schema = { MYSQ static ST_FIELD_INFO tokudb_trx_field_info[] = { {"trx_id", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE }, {"trx_mysql_thread_id", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE }, + {"trx_time", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE }, {NULL, 0, MYSQL_TYPE_NULL, 0, 0, NULL, SKIP_OPEN_TABLE} }; @@ -2132,12 +2137,17 @@ struct tokudb_trx_extra { TABLE *table; }; -static int tokudb_trx_callback(uint64_t txn_id, uint64_t client_id, iterate_row_locks_callback iterate_locks, void *locks_extra, void *extra) { +static int tokudb_trx_callback(DB_TXN *txn, iterate_row_locks_callback iterate_locks, void *locks_extra, void *extra) { + uint64_t txn_id = txn->id64(txn); + uint64_t client_id = txn->get_client_id(txn); + uint64_t start_time = txn->get_start_time(txn); struct tokudb_trx_extra *e = reinterpret_cast<struct tokudb_trx_extra *>(extra); THD *thd = e->thd; TABLE *table = e->table; table->field[0]->store(txn_id, false); table->field[1]->store(client_id, false); + uint64_t tnow = (uint64_t) time(NULL); + table->field[2]->store(tnow >= start_time ? tnow - start_time : 0, false); int error = schema_table_store_record(thd, table); if (!error && thd_killed(thd)) error = ER_QUERY_INTERRUPTED; @@ -2285,7 +2295,9 @@ struct tokudb_locks_extra { TABLE *table; }; -static int tokudb_locks_callback(uint64_t txn_id, uint64_t client_id, iterate_row_locks_callback iterate_locks, void *locks_extra, void *extra) { +static int tokudb_locks_callback(DB_TXN *txn, iterate_row_locks_callback iterate_locks, void *locks_extra, void *extra) { + uint64_t txn_id = txn->id64(txn); + uint64_t client_id = txn->get_client_id(txn); struct tokudb_locks_extra *e = reinterpret_cast<struct tokudb_locks_extra *>(extra); THD *thd = e->thd; TABLE *table = e->table; diff --git a/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_released.result b/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_released.result index 018900c7b98..190581eddae 100644 --- a/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_released.result +++ b/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_released.result @@ -2,7 +2,7 @@ set default_storage_engine='tokudb'; set tokudb_prelock_empty=false; drop table if exists t; create table t (id int primary key); -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; trx_id trx_mysql_thread_id select * from information_schema.tokudb_locks; locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name @@ -19,7 +19,7 @@ TRX_ID MYSQL_ID ./test/t-main 0001000000 0001000000 test t main select * from information_schema.tokudb_lock_waits; requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time lock_waits_table_schema lock_waits_table_name lock_waits_table_dictionary_name REQUEST_TRX_ID BLOCK_TRX_ID ./test/t-main 0001000000 0001000000 LOCK_WAITS_START_TIME test t main -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; trx_id trx_mysql_thread_id TRX_ID MYSQL_ID TRX_ID MYSQL_ID @@ -31,7 +31,7 @@ select * from information_schema.tokudb_lock_waits; requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time lock_waits_table_schema lock_waits_table_name lock_waits_table_dictionary_name ERROR 23000: Duplicate entry '1' for key 'PRIMARY' commit; -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; trx_id trx_mysql_thread_id select * from information_schema.tokudb_locks; locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name @@ -48,7 +48,7 @@ TRX_ID MYSQL_ID ./test/t-main 0001000000 0001000000 test t main select * from information_schema.tokudb_lock_waits; requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time lock_waits_table_schema lock_waits_table_name lock_waits_table_dictionary_name REQUEST_TRX_ID BLOCK_TRX_ID ./test/t-main 0001000000 0001000000 LOCK_WAITS_START_TIME test t main -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; trx_id trx_mysql_thread_id TRX_ID MYSQL_ID TRX_ID MYSQL_ID @@ -59,7 +59,7 @@ TRX_ID MYSQL_ID ./test/t-main 0001000000 0001000000 test t main select * from information_schema.tokudb_lock_waits; requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time lock_waits_table_schema lock_waits_table_name lock_waits_table_dictionary_name commit; -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; trx_id trx_mysql_thread_id select * from information_schema.tokudb_locks; locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name diff --git a/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_timeout.result b/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_timeout.result index b9fca50b507..13cdad7a438 100644 --- a/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_timeout.result +++ b/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_lock_waits_timeout.result @@ -2,7 +2,7 @@ set default_storage_engine='tokudb'; set tokudb_prelock_empty=false; drop table if exists t; create table t (id int primary key); -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; trx_id trx_mysql_thread_id select * from information_schema.tokudb_locks; locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name @@ -19,7 +19,7 @@ TRX_ID MYSQL_ID ./test/t-main 0001000000 0001000000 test t main select * from information_schema.tokudb_lock_waits; requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time lock_waits_table_schema lock_waits_table_name lock_waits_table_dictionary_name REQUEST_TRX_ID BLOCK_TRX_ID ./test/t-main 0001000000 0001000000 LOCK_WAITS_START_TIME test t main -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; trx_id trx_mysql_thread_id TRX_ID MYSQL_ID TRX_ID MYSQL_ID @@ -30,7 +30,7 @@ select * from information_schema.tokudb_lock_waits; requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time lock_waits_table_schema lock_waits_table_name lock_waits_table_dictionary_name ERROR HY000: Lock wait timeout exceeded; try restarting transaction commit; -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; trx_id trx_mysql_thread_id select * from information_schema.tokudb_locks; locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name diff --git a/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_trx.result b/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_trx.result index e4c1adcca19..63e4816e16e 100644 --- a/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_trx.result +++ b/storage/tokudb/mysql-test/tokudb/r/i_s_tokudb_trx.result @@ -1,23 +1,23 @@ set default_storage_engine='tokudb'; set tokudb_prelock_empty=false; drop table if exists t; -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; trx_id trx_mysql_thread_id set autocommit=0; create table t (id int primary key); insert into t values (1); -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; trx_id trx_mysql_thread_id TXN_ID_DEFAULT CLIENT_ID_DEFAULT commit; -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; trx_id trx_mysql_thread_id set autocommit=0; insert into t values (2); -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; trx_id trx_mysql_thread_id TXN_ID_A CLIENT_ID_A commit; -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; trx_id trx_mysql_thread_id drop table t; diff --git a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test index c4f9ccefe5c..0f712000527 100644 --- a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test +++ b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test @@ -13,7 +13,7 @@ create table t (id int primary key); # verify that txn_a insert (1) blocks txn_b insert (1) and txn_b gets a duplicate key error # should be empty -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; select * from information_schema.tokudb_locks; select * from information_schema.tokudb_lock_waits; @@ -43,7 +43,7 @@ select * from information_schema.tokudb_lock_waits; # should find the presence of two transactions replace_column 1 TRX_ID 2 MYSQL_ID; -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; connection conn_a; commit; @@ -66,7 +66,7 @@ disconnect conn_b; # verify that the lock on the 2nd transaction has been released # should be be empty -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; select * from information_schema.tokudb_locks; select * from information_schema.tokudb_lock_waits; @@ -96,7 +96,7 @@ select * from information_schema.tokudb_lock_waits; # should find the presence of two transactions replace_column 1 TRX_ID 2 MYSQL_ID; -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; connection conn_a; commit; @@ -116,7 +116,7 @@ disconnect conn_b; # verify that the lock on the 2nd transaction has been released # should be be empty -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; select * from information_schema.tokudb_locks; select * from information_schema.tokudb_lock_waits; diff --git a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_timeout.test b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_timeout.test index 75929fa3b3d..3011443fa04 100644 --- a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_timeout.test +++ b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_timeout.test @@ -10,7 +10,7 @@ enable_warnings; create table t (id int primary key); # should be empty -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; select * from information_schema.tokudb_locks; select * from information_schema.tokudb_lock_waits; @@ -40,7 +40,7 @@ select * from information_schema.tokudb_lock_waits; # should find the presence of two transactions replace_column 1 TRX_ID 2 MYSQL_ID; -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; connection conn_a; sleep 5; # sleep longer than the lock timer to force a lock timeout on txn_b @@ -61,7 +61,7 @@ disconnect conn_a; disconnect conn_b; # should be be empty -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; select * from information_schema.tokudb_locks; select * from information_schema.tokudb_lock_waits; diff --git a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_trx.test b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_trx.test index b1d5c7e5009..d3c2636ba54 100644 --- a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_trx.test +++ b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_trx.test @@ -8,7 +8,7 @@ drop table if exists t; enable_warnings; # should be empty -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; # should have my txn let $default_id=`select connection_id()`; @@ -16,11 +16,11 @@ set autocommit=0; create table t (id int primary key); insert into t values (1); replace_column 1 TXN_ID_DEFAULT 2 CLIENT_ID_DEFAULT; -eval select * from information_schema.tokudb_trx; +eval select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; # should be empty commit; -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; connect(conn_a,localhost,root,,); let a_id=`select connection_id()`; @@ -29,13 +29,13 @@ insert into t values (2); connection default; replace_column 1 TXN_ID_A 2 CLIENT_ID_A; -eval select * from information_schema.tokudb_trx; +eval select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; connection conn_a; commit; connection default; # should be empty -select * from information_schema.tokudb_trx; +select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; disconnect conn_a; diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db805.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db805.result new file mode 100644 index 00000000000..1bc0372f1b8 --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db805.result @@ -0,0 +1,18 @@ +drop table if exists t1,t3; +create table t3(a3 int,b3 decimal(0,0),c3 int,d3 int,primary key(a3,b3)) engine=TOKUDB; +LOCK TABLES t3 WRITE; +create temporary table t1(f1 int,index(f1)) engine=innodb; +INSERT INTO t1 VALUES(1),(1),(1); +select * from t1; +f1 +1 +1 +1 +ALTER TABLE t1 engine=TOKUDB; +select * from t1; +f1 +1 +1 +1 +unlock tables; +drop table t1,t3; diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db806.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db806.result new file mode 100644 index 00000000000..ae87dbab281 --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db806.result @@ -0,0 +1,9 @@ +drop table if exists t1,t3; +CREATE TABLE t3(a int,c int,d int)engine=TOKUDB; +lock table t3 read; +create temporary table t1 engine=tokudb as SELECT 1; +select * from t1; +1 +1 +unlock tables; +drop table t1,t3; diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db811.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db811.result new file mode 100644 index 00000000000..1d26f43c9dd --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db811.result @@ -0,0 +1,14 @@ +drop table if exists t2,t3,t4; +CREATE TABLE t3(a INT,b INT,UNIQUE KEY (a,b)) engine=TOKUDB; +CREATE TABLE t4(c1 FLOAT ZEROFILL) engine=innodb; +CREATE TABLE t2(a int KEY,b CHAR (1)) engine=TOKUDB PARTITION BY HASH (a) PARTITIONS 13; +LOCK TABLES t4 WRITE,t3 WRITE,t2 WRITE; +INSERT INTO t2(a)VALUES (REPEAT(0,1)); +ALTER TABLE t2 ADD COLUMN(c INT); +alter table t4 add column c int; +UPDATE t2 SET a=1; +select * from t2; +a b c +1 NULL NULL +unlock tables; +drop table t2,t3,t4; diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db811s.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db811s.result new file mode 100644 index 00000000000..0a50e63e037 --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db811s.result @@ -0,0 +1,14 @@ +drop table if exists t2,t3,t4; +CREATE TABLE t3(a INT,b INT,UNIQUE KEY (a,b)) engine=TOKUDB; +CREATE TABLE t4(c1 FLOAT ZEROFILL) engine=innodb; +CREATE TABLE t2(a int KEY,b CHAR (1)) engine=TOKUDB PARTITION BY HASH (a) PARTITIONS 1; +LOCK TABLES t4 WRITE,t3 WRITE,t2 WRITE; +INSERT INTO t2(a)VALUES (REPEAT(0,1)); +ALTER TABLE t2 ADD COLUMN(c INT); +alter table t4 add column c int; +UPDATE t2 SET a=1; +select * from t2; +a b c +1 NULL NULL +unlock tables; +drop table t2,t3,t4; diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db823.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db823.result new file mode 100644 index 00000000000..d94da5c0673 --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db823.result @@ -0,0 +1,11 @@ +drop table if exists s,t; +create table s (id int) engine=tokudb; +lock tables s write; +create temporary table t (id int, key(id)) engine=innodb; +insert into t values (1); +alter table t engine=tokudb; +select * from t; +id +1 +unlock tables; +drop table s, t; diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/tokudb718.result b/storage/tokudb/mysql-test/tokudb_bugs/r/tokudb718.result index e63f73caf20..0cf75d40847 100644 --- a/storage/tokudb/mysql-test/tokudb_bugs/r/tokudb718.result +++ b/storage/tokudb/mysql-test/tokudb_bugs/r/tokudb718.result @@ -3,7 +3,8 @@ drop table if exists t; create table t (id int primary key); begin; insert into t values (1),(2); -select * from information_schema.tokudb_fractal_tree_info; -ERROR HY000: Got error -30994 "Internal error < 0 (Not system error)" from storage engine TokuDB +select dictionary_name from information_schema.tokudb_fractal_tree_info; +dictionary_name +./test/t-status commit; drop table t; diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/db805.test b/storage/tokudb/mysql-test/tokudb_bugs/t/db805.test new file mode 100644 index 00000000000..1114de6b325 --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_bugs/t/db805.test @@ -0,0 +1,17 @@ +# DB-805 test that conversion of t1 from innodb to tokudb can write rows +source include/have_tokudb.inc; +source include/have_innodb.inc; +disable_warnings; +drop table if exists t1,t3; +enable_warnings; + +create table t3(a3 int,b3 decimal(0,0),c3 int,d3 int,primary key(a3,b3)) engine=TOKUDB; +LOCK TABLES t3 WRITE; +create temporary table t1(f1 int,index(f1)) engine=innodb; +INSERT INTO t1 VALUES(1),(1),(1); +select * from t1; +ALTER TABLE t1 engine=TOKUDB; +select * from t1; +unlock tables; + +drop table t1,t3; diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/db806.test b/storage/tokudb/mysql-test/tokudb_bugs/t/db806.test new file mode 100644 index 00000000000..3815e59f78c --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_bugs/t/db806.test @@ -0,0 +1,13 @@ +# DB-806 test that lock tables and create select can write rows to the new table +source include/have_tokudb.inc; +disable_warnings; +drop table if exists t1,t3; +enable_warnings; + +CREATE TABLE t3(a int,c int,d int)engine=TOKUDB; +lock table t3 read; +create temporary table t1 engine=tokudb as SELECT 1; +select * from t1; +unlock tables; + +drop table t1,t3;
\ No newline at end of file diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/db811.test b/storage/tokudb/mysql-test/tokudb_bugs/t/db811.test new file mode 100644 index 00000000000..509f482765e --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_bugs/t/db811.test @@ -0,0 +1,22 @@ +# DB-811 test that alter table t2 updates both the schema (FRM) and the data (tokudb files) + +source include/have_tokudb.inc; +source include/have_innodb.inc; +source include/have_partition.inc; +disable_warnings; +drop table if exists t2,t3,t4; +enable_warnings; + +CREATE TABLE t3(a INT,b INT,UNIQUE KEY (a,b)) engine=TOKUDB; +CREATE TABLE t4(c1 FLOAT ZEROFILL) engine=innodb; +CREATE TABLE t2(a int KEY,b CHAR (1)) engine=TOKUDB PARTITION BY HASH (a) PARTITIONS 13; +LOCK TABLES t4 WRITE,t3 WRITE,t2 WRITE; +INSERT INTO t2(a)VALUES (REPEAT(0,1)); +ALTER TABLE t2 ADD COLUMN(c INT); +alter table t4 add column c int; +UPDATE t2 SET a=1; +select * from t2; +unlock tables; + +drop table t2,t3,t4; + diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/db811s.test b/storage/tokudb/mysql-test/tokudb_bugs/t/db811s.test new file mode 100644 index 00000000000..5b8c6ed79d3 --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_bugs/t/db811s.test @@ -0,0 +1,22 @@ +# DB-811 test that alter table t2 updates both the schema (FRM) and the data (tokudb files) + +source include/have_tokudb.inc; +source include/have_innodb.inc; +source include/have_partition.inc; +disable_warnings; +drop table if exists t2,t3,t4; +enable_warnings; + +CREATE TABLE t3(a INT,b INT,UNIQUE KEY (a,b)) engine=TOKUDB; +CREATE TABLE t4(c1 FLOAT ZEROFILL) engine=innodb; +CREATE TABLE t2(a int KEY,b CHAR (1)) engine=TOKUDB PARTITION BY HASH (a) PARTITIONS 1; +LOCK TABLES t4 WRITE,t3 WRITE,t2 WRITE; +INSERT INTO t2(a)VALUES (REPEAT(0,1)); +ALTER TABLE t2 ADD COLUMN(c INT); +alter table t4 add column c int; +UPDATE t2 SET a=1; +select * from t2; +unlock tables; + +drop table t2,t3,t4; + diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/db823.test b/storage/tokudb/mysql-test/tokudb_bugs/t/db823.test new file mode 100644 index 00000000000..2e01c0e5797 --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_bugs/t/db823.test @@ -0,0 +1,16 @@ +# test DB-823 +# test that the conversion of table t from innodb to tokudb succeeds. +source include/have_tokudb.inc; +source include/have_innodb.inc; +disable_warnings; +drop table if exists s,t; +enable_warnings; +create table s (id int) engine=tokudb; +lock tables s write; +create temporary table t (id int, key(id)) engine=innodb; +insert into t values (1); +alter table t engine=tokudb; +select * from t; +unlock tables; +drop table s, t; + diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/tokudb718.test b/storage/tokudb/mysql-test/tokudb_bugs/t/tokudb718.test index 415bb7a2332..735a88afed8 100644 --- a/storage/tokudb/mysql-test/tokudb_bugs/t/tokudb718.test +++ b/storage/tokudb/mysql-test/tokudb_bugs/t/tokudb718.test @@ -7,7 +7,6 @@ enable_warnings; create table t (id int primary key); begin; insert into t values (1),(2); ---error 1030 -select * from information_schema.tokudb_fractal_tree_info; +select dictionary_name from information_schema.tokudb_fractal_tree_info; commit; drop table t; diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 6b8fd6a1798..72cc8c87e09 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -8830,6 +8830,11 @@ ha_innobase::general_fetch( DBUG_ENTER("general_fetch"); + /* If transaction is not startted do not continue, instead return a error code. */ + if(!(prebuilt->sql_stat_start || (prebuilt->trx && prebuilt->trx->state == 1))) { + DBUG_RETURN(HA_ERR_END_OF_FILE); + } + if (UNIV_UNLIKELY(srv_pass_corrupt_table <= 1 && share && share->ib_table && share->ib_table->is_corrupt)) { DBUG_RETURN(HA_ERR_CRASHED); diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index e45573a6d77..aaeed444e2f 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -1,4 +1,4 @@ -# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -427,7 +427,7 @@ Obsoletes: MySQL-embedded-pro Obsoletes: MySQL-embedded-classic MySQL-embedded-community MySQL-embedded-enterprise Obsoletes: MySQL-embedded-advanced-gpl MySQL-embedded-enterprise-gpl Provides: mysql-embedded = %{version}-%{release} -Provides: mysql-emdedded%{?_isa} = %{version}-%{release} +Provides: mysql-embedded%{?_isa} = %{version}-%{release} %description -n MySQL-embedded%{product_suffix} This package contains the MySQL server as an embedded library. diff --git a/win/packaging/CPackWixConfig.cmake b/win/packaging/CPackWixConfig.cmake index 474c207891c..58a2ef44eef 100644 --- a/win/packaging/CPackWixConfig.cmake +++ b/win/packaging/CPackWixConfig.cmake @@ -68,7 +68,6 @@ SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DESCRIPTION "Install server") SET(CPACK_COMPONENT_CONNECT-ENGINE_DESCRIPTION "Server data files" ) SET(CPACK_COMPONENT_CONNECT-ENGINE_HIDDEN 1) - #Feature "Devel" SET(CPACK_COMPONENT_GROUP_DEVEL_DISPLAY_NAME "Development Components") SET(CPACK_COMPONENT_GROUP_DEVEL_DESCRIPTION "Installs C/C++ header files and libraries") |