diff --git a/.bzrignore b/.bzrignore index 71dde1f3204..060ecf37a07 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1463,4 +1463,4 @@ storage/tokudb/ft-index/utils/tokudb_gen storage/tokudb/ft-index/utils/tokudb_load storage/connect/connect.cnf storage/cassandra/cassandra.cnf -libmysql/libmysql.version +libmysql/libmysql_versions.ld diff --git a/CMakeLists.txt b/CMakeLists.txt index 60b46f7a8b8..eb6ce6c726f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,6 +153,7 @@ INCLUDE(readline) INCLUDE(libutils) INCLUDE(dtrace) INCLUDE(jemalloc) +INCLUDE(pcre) INCLUDE(ctest) INCLUDE(plugin) INCLUDE(install_macros) @@ -177,6 +178,81 @@ MARK_AS_ADVANCED(CYBOZU BACKUP_TEST WITHOUT_SERVER DISABLE_SHARED) OPTION(NOT_FOR_DISTRIBUTION "Allow linking with GPLv2-incompatible system libraries. Only set it you never plan to distribute the resulting binaries" OFF) +include(CheckCSourceCompiles) +include(CheckCXXSourceCompiles) +# We need some extra FAIL_REGEX patterns +# Note that CHECK_C_SOURCE_COMPILES is a misnomer, it will also link. +MACRO (MY_CHECK_C_COMPILER_FLAG FLAG RESULT) + SET(SAVE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${FLAG}") + CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${RESULT} + FAIL_REGEX "argument unused during compilation" + FAIL_REGEX "unsupported .*option" + FAIL_REGEX "unknown .*option" + FAIL_REGEX "unrecognized .*option" + FAIL_REGEX "ignoring unknown option" + FAIL_REGEX "[Ww]arning: [Oo]ption" + ) + SET(CMAKE_REQUIRED_FLAGS "${SAVE_CMAKE_REQUIRED_FLAGS}") +ENDMACRO() + +MACRO (MY_CHECK_CXX_COMPILER_FLAG FLAG RESULT) + SET(SAVE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${FLAG}") + CHECK_CXX_SOURCE_COMPILES("int main(void) { return 0; }" ${RESULT} + FAIL_REGEX "argument unused during compilation" + FAIL_REGEX "unsupported .*option" + FAIL_REGEX "unknown .*option" + FAIL_REGEX "unrecognized .*option" + FAIL_REGEX "ignoring unknown option" + FAIL_REGEX "[Ww]arning: [Oo]ption" + ) + SET(CMAKE_REQUIRED_FLAGS "${SAVE_CMAKE_REQUIRED_FLAGS}") +ENDMACRO() + +OPTION(WITH_ASAN "Enable address sanitizer" OFF) +IF (WITH_ASAN) + # gcc 4.8.1 and new versions of clang + MY_CHECK_C_COMPILER_FLAG("-fsanitize=address" HAVE_C_FSANITIZE) + MY_CHECK_CXX_COMPILER_FLAG("-fsanitize=address" HAVE_CXX_FSANITIZE) + + IF(HAVE_C_FSANITIZE AND HAVE_CXX_FSANITIZE) + # We switch on basic optimization also for debug builds. + # With optimization we may get some warnings, so we switch off -Werror + SET(CMAKE_C_FLAGS_DEBUG + "${CMAKE_C_FLAGS_DEBUG} -fsanitize=address -O1 -Wno-error -fPIC") + SET(CMAKE_C_FLAGS_RELWITHDEBINFO + "${CMAKE_C_FLAGS_RELWITHDEBINFO} -fsanitize=address -fPIC") + SET(CMAKE_CXX_FLAGS_DEBUG + "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address -O1 -Wno-error -fPIC") + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO + "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fsanitize=address -fPIC") + SET(WITH_ASAN_OK 1) + ELSE() + # older versions of clang + MY_CHECK_C_COMPILER_FLAG("-faddress-sanitizer" HAVE_C_FADDRESS) + MY_CHECK_CXX_COMPILER_FLAG("-faddress-sanitizer" HAVE_CXX_FFADDRESS) + + IF(HAVE_C_FADDRESS AND HAVE_CXX_FFADDRESS) + # We switch on basic optimization also for debug builds. + SET(CMAKE_C_FLAGS_DEBUG + "${CMAKE_C_FLAGS_DEBUG} -faddress-sanitizer -O1 -fPIC") + SET(CMAKE_C_FLAGS_RELWITHDEBINFO + "${CMAKE_C_FLAGS_RELWITHDEBINFO} -faddress-sanitizer -fPIC") + SET(CMAKE_CXX_FLAGS_DEBUG + "${CMAKE_CXX_FLAGS_DEBUG} -faddress-sanitizer -O1 -fPIC") + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO + "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -faddress-sanitizer -fPIC") + SET(WITH_ASAN_OK 1) + ENDIF() + ENDIF() + + IF(NOT WITH_ASAN_OK) + MESSAGE(FATAL_ERROR "Do not know how to enable address sanitizer") + ENDIF() +ENDIF() + + OPTION(ENABLE_DEBUG_SYNC "Enable debug sync (debug builds only)" ON) IF(ENABLE_DEBUG_SYNC) SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC") @@ -261,13 +337,25 @@ SET(PLUGINDIR "${DEFAULT_MYSQL_HOME}/${INSTALL_PLUGINDIR}") IF(INSTALL_SYSCONFDIR) SET(DEFAULT_SYSCONFDIR "${INSTALL_SYSCONFDIR}") ENDIF() + +OPTION(TMPDIR +"PATH to MySQL TMP dir. If unspecified, defaults to P_tmpdir in " OFF) IF(TMPDIR) - SET(DEFAULT_TMPDIR "${TMPDIR}") + # Quote it, to make it a const char string. + SET(DEFAULT_TMPDIR "\"${TMPDIR}\"") +ELSE() + # Do not quote it, to refer to the P_tmpdir macro in . + SET(DEFAULT_TMPDIR "P_tmpdir") ENDIF() # Run platform tests INCLUDE(configure.cmake) +# Find header files from the bundled libraries +# (jemalloc, yassl, readline, pcre, etc) +# before the ones installed in the system +SET(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON) + # Common defines and includes ADD_DEFINITIONS(-DHAVE_CONFIG_H) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/include) @@ -279,8 +367,11 @@ MYSQL_CHECK_SSL() # Add readline or libedit. MYSQL_CHECK_READLINE() +SET(MALLOC_LIBRARY "system") CHECK_JEMALLOC() +CHECK_PCRE() + # # Setup maintainer mode options. Platform checks are # not run with the warning options as to not perturb fragile checks @@ -316,7 +407,6 @@ ADD_SUBDIRECTORY(include) ADD_SUBDIRECTORY(dbug) ADD_SUBDIRECTORY(strings) ADD_SUBDIRECTORY(vio) -ADD_SUBDIRECTORY(pcre) ADD_SUBDIRECTORY(mysys) ADD_SUBDIRECTORY(mysys_ssl) ADD_SUBDIRECTORY(libmysql) @@ -347,6 +437,7 @@ IF(NOT WITHOUT_SERVER) ADD_SUBDIRECTORY(internal) ENDIF() ADD_SUBDIRECTORY(packaging/rpm-uln) + ADD_SUBDIRECTORY(packaging/rpm-oel) ENDIF() IF(UNIX) diff --git a/VERSION b/VERSION index d6948a3c5c5..e1550f11d09 100644 --- a/VERSION +++ b/VERSION @@ -4,5 +4,5 @@ # MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=0 -MYSQL_VERSION_PATCH=7 +MYSQL_VERSION_PATCH=9 MYSQL_VERSION_EXTRA= diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 7f725e09006..1bf466c1e47 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -15,8 +15,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include - ${CMAKE_BINARY_DIR}/pcre - ${CMAKE_SOURCE_DIR}/pcre + ${PCRE_INCLUDES} ${CMAKE_SOURCE_DIR}/mysys_ssl ${ZLIB_INCLUDE_DIR} ${SSL_INCLUDE_DIRS} diff --git a/client/mysql.cc b/client/mysql.cc index 19383d9a382..b95f5742a11 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -915,6 +915,7 @@ static COMMANDS commands[] = { { "MAKE_SET", 0, 0, 0, ""}, { "MAKEDATE", 0, 0, 0, ""}, { "MAKETIME", 0, 0, 0, ""}, + { "MASTER_GTID_WAIT", 0, 0, 0, ""}, { "MASTER_POS_WAIT", 0, 0, 0, ""}, { "MAX", 0, 0, 0, ""}, { "MBRCONTAINS", 0, 0, 0, ""}, @@ -1227,7 +1228,7 @@ int main(int argc,char *argv[]) put_info("Welcome to the MariaDB monitor. Commands end with ; or \\g.", INFO_INFO); - sprintf((char*) glob_buffer.ptr(), + my_snprintf((char*) glob_buffer.ptr(), glob_buffer.alloced_length(), "Your %s connection id is %lu\nServer version: %s\n", mysql_get_server_name(&mysql), mysql_thread_id(&mysql), server_version_string(&mysql)); @@ -1411,7 +1412,8 @@ sig_handler window_resize(int sig) struct winsize window_size; if (ioctl(fileno(stdin), TIOCGWINSZ, &window_size) == 0) - terminal_width= window_size.ws_col; + if (window_size.ws_col > 0) + terminal_width= window_size.ws_col; } #endif @@ -1675,8 +1677,9 @@ static void usage(int version) return; puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); printf("Usage: %s [OPTIONS] [database]\n", my_progname); - my_print_help(my_long_options); print_defaults("my", load_default_groups); + puts(""); + my_print_help(my_long_options); my_print_variables(my_long_options); } diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c index c3fa1a49e81..99da157f8c6 100644 --- a/client/mysql_plugin.c +++ b/client/mysql_plugin.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2011, 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 @@ -857,7 +857,7 @@ static int process_options(int argc, char *argv[], char *operation) strncat(buff, FN_DIRSEP, sizeof(buff) - strlen(buff) - 1); #endif buff[sizeof(buff) - 1]= 0; - my_delete(opt_basedir, MYF(0)); + my_free(opt_basedir); opt_basedir= my_strdup(buff, MYF(MY_FAE)); } } diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 5f9a06dc07f..ec49134a111 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -22,7 +22,7 @@ #include /* ORACLE_WELCOME_COPYRIGHT_NOTICE */ -#define VER "1.3" +#define VER "1.3a" #ifdef HAVE_SYS_WAIT_H #include @@ -164,6 +164,15 @@ static struct my_option my_long_options[]= }; +static const char *load_default_groups[]= +{ + "client", /* Read settings how to connect to server */ + "mysql_upgrade", /* Read special settings for mysql_upgrade */ + "client-server", /* Reads settings common between client & server */ + "client-mariadb", /* Read mariadb unique client settings */ + 0 +}; + static void free_used_memory(void) { /* Free memory allocated by 'load_defaults' */ @@ -180,6 +189,7 @@ static void die(const char *fmt, ...) DBUG_ENTER("die"); /* Print the error message */ + fflush(stdout); va_start(args, fmt); if (fmt) { @@ -259,8 +269,11 @@ get_one_option(int optid, const struct my_option *opt, printf("%s Ver %s Distrib %s, for %s (%s)\n", my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); - puts("MariaDB utility for upgrading databases to new MariaDB versions.\n"); + puts("MariaDB utility for upgrading databases to new MariaDB versions."); + print_defaults("my", load_default_groups); + puts(""); my_print_help(my_long_options); + my_print_variables(my_long_options); die(0); break; @@ -736,6 +749,7 @@ static int run_mysqlcheck_upgrade(void) !opt_silent || opt_verbose ? "--verbose": "", opt_silent ? "--silent": "", opt_write_binlog ? "--write-binlog" : "--skip-write-binlog", + "2>&1", NULL); } @@ -754,6 +768,7 @@ static int run_mysqlcheck_fixnames(void) opt_verbose ? "--verbose": "", opt_silent ? "--silent": "", opt_write_binlog ? "--write-binlog" : "--skip-write-binlog", + "2>&1", NULL); } @@ -874,14 +889,11 @@ static int run_sql_fix_privilege_tables(void) } -static const char *load_default_groups[]= +static void print_error(const char *error_msg, DYNAMIC_STRING *output) { - "client", /* Read settings how to connect to server */ - "mysql_upgrade", /* Read special settings for mysql_upgrade */ - "client-server", /* Reads settings common between client & server */ - "client-mariadb", /* Read mariadb unique client settings */ - 0 -}; + fprintf(stderr, "%s\n", error_msg); + fprintf(stderr, "%s", output->str); +} /* Convert the specified version string into the numeric format. */ @@ -914,6 +926,8 @@ static int check_version_match(void) &ds_version, FALSE) || extract_variable_from_show(&ds_version, version_str)) { + print_error("Version check failed. Got the following error when calling " + "the 'mysql' command line client", &ds_version); dynstr_free(&ds_version); return 1; /* Query failed */ } @@ -982,7 +996,8 @@ int main(int argc, char **argv) } else { - printf("The --upgrade-system-tables option was used, databases won't be touched.\n"); + if (!opt_silent) + printf("The --upgrade-system-tables option was used, databases won't be touched.\n"); } /* diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 71bc37a4161..bd5d2eac4e5 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -1230,9 +1230,10 @@ static void usage(void) puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); puts("Administration program for the mysqld daemon."); printf("Usage: %s [OPTIONS] command command....\n", my_progname); + print_defaults("my",load_default_groups); + puts(""); my_print_help(my_long_options); my_print_variables(my_long_options); - print_defaults("my",load_default_groups); puts("\nWhere command is a one or more of: (Commands may be shortened)\n\ create databasename Create a new database\n\ debug Instruct server to write debug information to log\n\ diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 498f174f7cb..319be9111aa 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1546,6 +1546,8 @@ static void usage() Dumps a MySQL binary log in a format usable for viewing or for piping to\n\ the mysql command line client.\n\n"); printf("Usage: %s [options] log-files\n", my_progname); + print_defaults("my",load_groups); + puts(""); my_print_help(my_options); my_print_variables(my_options); } diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index ab9cbfb14c9..57b7ce09ab5 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -250,6 +250,7 @@ static void usage(void) puts("http://kb.askmonty.org/v/mysqlcheck for latest information about"); puts("this program."); print_defaults("my", load_default_groups); + puts(""); my_print_help(my_long_options); my_print_variables(my_long_options); DBUG_VOID_RETURN; @@ -1046,7 +1047,7 @@ int main(int argc, char **argv) for (i = 0; i < alter_table_cmds.elements ; i++) run_query((char*) dynamic_array_ptr(&alter_table_cmds, i)); } - ret= test(first_error); + ret= MY_TEST(first_error); end: dbDisconnect(current_host); diff --git a/client/mysqldump.c b/client/mysqldump.c index a29f3f367bd..a0222f370b3 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -39,7 +39,7 @@ ** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov */ -#define DUMP_VERSION "10.14" +#define DUMP_VERSION "10.15" #include #include @@ -137,6 +137,12 @@ static uint opt_slave_data; static uint my_end_arg; static char * opt_mysql_unix_port=0; static int first_error=0; +/* + multi_source is 0 if old server or 2 if server that support multi source + This is choosen this was as multi_source has 2 extra columns first in + SHOW ALL SLAVES STATUS. +*/ +static uint multi_source= 0; static DYNAMIC_STRING extended_row; #include FILE *md_result_file= 0; @@ -160,6 +166,8 @@ static void dynstr_set_checked(DYNAMIC_STRING *str, const char *init_str); static void dynstr_append_mem_checked(DYNAMIC_STRING *str, const char *append, uint length); static void dynstr_realloc_checked(DYNAMIC_STRING *str, ulong additional_size); + +static int do_start_slave_sql(MYSQL *mysql_con); /* Constant for detection of default value of default_charset. If default_charset is equal to mysql_universal_client_charset, then @@ -612,7 +620,8 @@ static void usage(void) puts("Dumping structure and contents of MySQL databases and tables."); short_usage_sub(); print_defaults("my",load_default_groups); - my_print_help(my_long_options); + puts(""); +my_print_help(my_long_options); my_print_variables(my_long_options); } /* usage */ @@ -1493,6 +1502,8 @@ static void free_resources() static void maybe_exit(int error) { + if (opt_slave_data) + do_start_slave_sql(mysql); if (!first_error) first_error= error; if (ignore_errors) @@ -3648,7 +3659,8 @@ static void dump_table(char *table, char *db) field->type == MYSQL_TYPE_BLOB || field->type == MYSQL_TYPE_LONG_BLOB || field->type == MYSQL_TYPE_MEDIUM_BLOB || - field->type == MYSQL_TYPE_TINY_BLOB)) ? 1 : 0; + field->type == MYSQL_TYPE_TINY_BLOB || + field->type == MYSQL_TYPE_GEOMETRY)) ? 1 : 0; if (extended_insert && !opt_xml) { if (i == 0) @@ -3992,7 +4004,13 @@ static int dump_tablespaces(char* ts_where) char *ubs; char *endsemi; DBUG_ENTER("dump_tablespaces"); - + + /* + Try to turn off semi-join optimization (if that fails, this is a + pre-optimizer_switch server, and the old query plan is ok for us. + */ + mysql_query(mysql, "set optimizer_switch='semijoin=off'"); + init_dynamic_string_checked(&sqlbuf, "SELECT LOGFILE_GROUP_NAME," " FILE_NAME," @@ -4152,6 +4170,8 @@ static int dump_tablespaces(char* ts_where) mysql_free_result(tableres); dynstr_free(&sqlbuf); + mysql_query(mysql, "set optimizer_switch=default"); + DBUG_RETURN(0); } @@ -4734,7 +4754,8 @@ static int do_show_master_status(MYSQL *mysql_con, int consistent_binlog_pos) } else { - if (mysql_query_with_error_report(mysql_con, &master, "SHOW MASTER STATUS")) + if (mysql_query_with_error_report(mysql_con, &master, + "SHOW MASTER STATUS")) return 1; row= mysql_fetch_row(master); @@ -4779,29 +4800,37 @@ static int do_show_master_status(MYSQL *mysql_con, int consistent_binlog_pos) static int do_stop_slave_sql(MYSQL *mysql_con) { MYSQL_RES *slave; - /* We need to check if the slave sql is running in the first place */ - if (mysql_query_with_error_report(mysql_con, &slave, "SHOW SLAVE STATUS")) + MYSQL_ROW row; + + if (mysql_query_with_error_report(mysql_con, &slave, + multi_source ? + "SHOW ALL SLAVES STATUS" : + "SHOW SLAVE STATUS")) return(1); - else + + /* Loop over all slaves */ + while ((row= mysql_fetch_row(slave))) { - MYSQL_ROW row= mysql_fetch_row(slave); - if (row && row[11]) + if (row[11 + multi_source]) { /* if SLAVE SQL is not running, we don't stop it */ - if (!strcmp(row[11],"No")) + if (strcmp(row[11 + multi_source], "No")) { - mysql_free_result(slave); - /* Silently assume that they don't have the slave running */ - return(0); + char query[160]; + if (multi_source) + sprintf(query, "STOP SLAVE '%.80s' SQL_THREAD", row[0]); + else + strmov(query, "STOP SLAVE SQL_THREAD"); + + if (mysql_query_with_error_report(mysql_con, 0, query)) + { + mysql_free_result(slave); + return 1; + } } } } mysql_free_result(slave); - - /* now, stop slave if running */ - if (mysql_query_with_error_report(mysql_con, 0, "STOP SLAVE SQL_THREAD")) - return(1); - return(0); } @@ -4810,7 +4839,10 @@ static int add_stop_slave(void) if (opt_comments) fprintf(md_result_file, "\n--\n-- stop slave statement to make a recovery dump)\n--\n\n"); - fprintf(md_result_file, "STOP SLAVE;\n"); + if (multi_source) + fprintf(md_result_file, "STOP ALL SLAVES;\n"); + else + fprintf(md_result_file, "STOP SLAVE;\n"); return(0); } @@ -4819,16 +4851,24 @@ static int add_slave_statements(void) if (opt_comments) fprintf(md_result_file, "\n--\n-- start slave statement to make a recovery dump)\n--\n\n"); - fprintf(md_result_file, "START SLAVE;\n"); + if (multi_source) + fprintf(md_result_file, "START ALL SLAVES;\n"); + else + fprintf(md_result_file, "START SLAVE;\n"); return(0); } static int do_show_slave_status(MYSQL *mysql_con) { MYSQL_RES *UNINIT_VAR(slave); + MYSQL_ROW row; const char *comment_prefix= (opt_slave_data == MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL) ? "-- " : ""; - if (mysql_query_with_error_report(mysql_con, &slave, "SHOW SLAVE STATUS")) + + if (mysql_query_with_error_report(mysql_con, &slave, + multi_source ? + "SHOW ALL SLAVES STATUS" : + "SHOW SLAVE STATUS")) { if (!ignore_errors) { @@ -4838,10 +4878,10 @@ static int do_show_slave_status(MYSQL *mysql_con) mysql_free_result(slave); return 1; } - else + + while ((row= mysql_fetch_row(slave))) { - MYSQL_ROW row= mysql_fetch_row(slave); - if (row && row[9] && row[21]) + if (row[9 + multi_source] && row[21 + multi_source]) { /* SHOW MASTER STATUS reports file and position */ if (opt_comments) @@ -4849,54 +4889,70 @@ static int do_show_slave_status(MYSQL *mysql_con) "\n--\n-- Position to start replication or point-in-time " "recovery from (the master of this slave)\n--\n\n"); - fprintf(md_result_file, "%sCHANGE MASTER TO ", comment_prefix); - + if (multi_source) + fprintf(md_result_file, "%sCHANGE MASTER '%.80s' TO ", + comment_prefix, row[0]); + else + fprintf(md_result_file, "%sCHANGE MASTER TO ", comment_prefix); + if (opt_include_master_host_port) { - if (row[1]) - fprintf(md_result_file, "MASTER_HOST='%s', ", row[1]); + if (row[1 + multi_source]) + fprintf(md_result_file, "MASTER_HOST='%s', ", row[1 + multi_source]); if (row[3]) - fprintf(md_result_file, "MASTER_PORT=%s, ", row[3]); + fprintf(md_result_file, "MASTER_PORT=%s, ", row[3 + multi_source]); } fprintf(md_result_file, - "MASTER_LOG_FILE='%s', MASTER_LOG_POS=%s;\n", row[9], row[21]); + "MASTER_LOG_FILE='%s', MASTER_LOG_POS=%s;\n", + row[9 + multi_source], row[21 + multi_source]); check_io(md_result_file); } - mysql_free_result(slave); } + mysql_free_result(slave); return 0; } static int do_start_slave_sql(MYSQL *mysql_con) { MYSQL_RES *slave; + MYSQL_ROW row; + int error= 0; + DBUG_ENTER("do_start_slave_sql"); + /* We need to check if the slave sql is stopped in the first place */ - if (mysql_query_with_error_report(mysql_con, &slave, "SHOW SLAVE STATUS")) - return(1); - else + if (mysql_query_with_error_report(mysql_con, &slave, + multi_source ? + "SHOW ALL SLAVES STATUS" : + "SHOW SLAVE STATUS")) + DBUG_RETURN(1); + + while ((row= mysql_fetch_row(slave))) { - MYSQL_ROW row= mysql_fetch_row(slave); - if (row && row[11]) + DBUG_PRINT("info", ("Connection: '%s' status: '%s'", + multi_source ? row[0] : "", row[11 + multi_source])); + if (row[11 + multi_source]) { /* if SLAVE SQL is not running, we don't start it */ - if (!strcmp(row[11],"Yes")) + if (strcmp(row[11 + multi_source], "Yes")) { - mysql_free_result(slave); - /* Silently assume that they don't have the slave running */ - return(0); + char query[160]; + if (multi_source) + sprintf(query, "START SLAVE '%.80s'", row[0]); + else + strmov(query, "START SLAVE"); + + if (mysql_query_with_error_report(mysql_con, 0, query)) + { + fprintf(stderr, "%s: Error: Unable to start slave '%s'\n", + my_progname_short, multi_source ? row[0] : ""); + error= 1; + } } } } mysql_free_result(slave); - - /* now, start slave if stopped */ - if (mysql_query_with_error_report(mysql_con, 0, "START SLAVE")) - { - fprintf(stderr, "%s: Error: Unable to start slave\n", my_progname_short); - return 1; - } - return(0); + DBUG_RETURN(error); } @@ -5574,6 +5630,10 @@ int main(int argc, char **argv) if (!path) write_header(md_result_file, *argv); + /* Check if the server support multi source */ + if (mysql_get_server_version(mysql) >= 100000) + multi_source= 2; + if (opt_slave_data && do_stop_slave_sql(mysql)) goto err; @@ -5653,10 +5713,6 @@ int main(int argc, char **argv) dump_databases(argv); } - /* if --dump-slave , start the slave sql thread */ - if (opt_slave_data && do_start_slave_sql(mysql)) - goto err; - /* add 'START SLAVE' to end of dump */ if (opt_slave_apply && add_slave_statements()) goto err; @@ -5672,9 +5728,6 @@ int main(int argc, char **argv) if (opt_delete_master_logs && purge_bin_logs_to(mysql, bin_log_name)) goto err; -#ifdef HAVE_SMEM - my_free(shared_memory_base_name); -#endif /* No reason to explicitely COMMIT the transaction, neither to explicitely UNLOCK TABLES: these will be automatically be done by the server when we @@ -5682,6 +5735,14 @@ int main(int argc, char **argv) server. */ err: + /* if --dump-slave , start the slave sql thread */ + if (opt_slave_data && do_start_slave_sql(mysql)) + goto err; + +#ifdef HAVE_SMEM + my_free(shared_memory_base_name); +#endif + dbDisconnect(current_host); if (!path) write_footer(md_result_file); diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 60e42c305aa..af0d86b1ed5 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -216,8 +216,9 @@ If one uses sockets to connect to the MySQL server, the server will open and\n\ read the text file directly. In other cases the client will open the text\n\ file. The SQL command 'LOAD DATA INFILE' is used to import the rows.\n"); - printf("\nUsage: %s [OPTIONS] database textfile...",my_progname); + printf("\nUsage: %s [OPTIONS] database textfile...\n",my_progname); print_defaults("my",load_default_groups); + puts(""); my_print_help(my_long_options); my_print_variables(my_long_options); } diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 58e679365de..d1ffb6a4876 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -286,6 +286,7 @@ If no table is given, then all matching tables in database are shown.\n\ If no column is given, then all matching columns and column types in table\n\ are shown."); print_defaults("my",load_default_groups); + puts(""); my_print_help(my_long_options); my_print_variables(my_long_options); } diff --git a/client/mysqlslap.c b/client/mysqlslap.c index e4c118bf990..3ba5eb80a07 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -739,7 +739,9 @@ static void usage(void) puts("Run a query multiple times against the server.\n"); printf("Usage: %s [OPTIONS]\n",my_progname); print_defaults("my",load_default_groups); + puts(""); my_print_help(my_long_options); + my_print_variables(my_long_options); } diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 4307293f6f1..3304af3981d 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -528,6 +528,7 @@ struct st_command { char *query, *query_buf,*first_argument,*last_argument,*end; DYNAMIC_STRING content; + DYNAMIC_STRING eval_query; int first_word_len, query_len; my_bool abort_on_error, used_replace; struct st_expected_errors expected_errors; @@ -1399,6 +1400,8 @@ void free_used_memory() { struct st_command **q= dynamic_element(&q_lines, i, struct st_command**); my_free((*q)->query_buf); + if ((*q)->eval_query.str) + dynstr_free(&(*q)->eval_query); if ((*q)->content.str) dynstr_free(&(*q)->content); my_free((*q)); @@ -7030,8 +7033,9 @@ void usage() puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); printf("Runs a test against the mysql server and compares output with a results file.\n\n"); printf("Usage: %s [OPTIONS] [database] < test_file\n", my_progname); + print_defaults("my",load_default_groups); + puts(""); my_print_help(my_long_options); - printf(" --no-defaults Don't read default options from any options file.\n"); my_print_variables(my_long_options); } @@ -8341,7 +8345,6 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) DYNAMIC_STRING ds_result; DYNAMIC_STRING ds_sorted; DYNAMIC_STRING ds_warnings; - DYNAMIC_STRING eval_query; char *query; int query_len; my_bool view_created= 0, sp_created= 0; @@ -8364,10 +8367,14 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) if (command->type == Q_EVAL || command->type == Q_SEND_EVAL || command->type == Q_EVALP) { - init_dynamic_string(&eval_query, "", command->query_len+256, 1024); - do_eval(&eval_query, command->query, command->end, FALSE); - query = eval_query.str; - query_len = eval_query.length; + if (!command->eval_query.str) + init_dynamic_string(&command->eval_query, "", command->query_len + 256, + 1024); + else + dynstr_set(&command->eval_query, 0); + do_eval(&command->eval_query, command->query, command->end, FALSE); + query= command->eval_query.str; + query_len= command->eval_query.length; } else { @@ -8535,8 +8542,6 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) dynstr_free(&ds_warnings); ds_warn= 0; - if (command->type == Q_EVAL || command->type == Q_SEND_EVAL) - dynstr_free(&eval_query); if (display_result_sorted) { @@ -8583,7 +8588,7 @@ char *re_eprint(int err) { static char epbuf[100]; size_t len __attribute__((unused))= - regerror(REG_ITOA|err, (regex_t *)NULL, epbuf, sizeof(epbuf)); + regerror(err, (regex_t *)NULL, epbuf, sizeof(epbuf)); assert(len <= sizeof(epbuf)); return(epbuf); } @@ -8940,7 +8945,7 @@ int main(int argc, char **argv) my_init_dynamic_array(&q_lines, sizeof(struct st_command*), 1024, 1024, MYF(0)); if (my_hash_init2(&var_hash, 64, charset_info, - 128, 0, 0, get_var_key, var_free, MYF(0))) + 128, 0, 0, get_var_key, 0, var_free, MYF(0))) die("Variable hash initialization failed"); var_set_string("MYSQL_SERVER_VERSION", MYSQL_SERVER_VERSION); diff --git a/cmake/CPackRPM.cmake b/cmake/CPackRPM.cmake new file mode 100644 index 00000000000..1d22387d098 --- /dev/null +++ b/cmake/CPackRPM.cmake @@ -0,0 +1,16 @@ +# +# Wrapper for CPackRPM.cmake +# + +# load the original CPackRPM.cmake +set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) +unset(CMAKE_MODULE_PATH) +include(CPackRPM) +set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH}) + +# per-component cleanup +foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV) + unset(TMP_RPM_${_RPM_SPEC_HEADER}) + unset(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) +endforeach() + diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index ebca9f14c31..1d77da2710b 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -47,10 +47,10 @@ FUNCTION (INSTALL_DEBUG_SYMBOLS) ) IF(NOT ARG_COMPONENT) - MESSAGE(FATAL_ERROR "No COMPONENT passed to INSTALL_DEBUG_SYMBOLS") + SET(ARG_COMPONENT DebugBinaries) ENDIF() IF(NOT ARG_INSTALL_LOCATION) - MESSAGE(FATAL_ERROR "No INSTALL_LOCATION passed to INSTALL_DEBUG_SYMBOLS") + SET(ARG_INSTALL_LOCATION lib) ENDIF() SET(targets ${ARG_DEFAULT_ARGS}) FOREACH(target ${targets}) @@ -420,6 +420,7 @@ FUNCTION(INSTALL_MYSQL_TEST from to) PATTERN "*.vcxproj.filters" EXCLUDE PATTERN "*.vcxproj.user" EXCLUDE PATTERN "CTest" EXCLUDE + PATTERN "*~" EXCLUDE ) ENDIF() ENDFUNCTION() diff --git a/cmake/jemalloc.cmake b/cmake/jemalloc.cmake index bc6bf60781d..b677f226266 100644 --- a/cmake/jemalloc.cmake +++ b/cmake/jemalloc.cmake @@ -46,13 +46,14 @@ ELSE() ENDIF() SET(WITH_JEMALLOC ${WITH_JEMALLOC_DEFAULT} CACHE STRING - "Which jemalloc to use (possible values are 'no', 'bundled', 'system', 'yes' (system if possible, otherwise bundled)") + "Which jemalloc to use. Possible values are 'no', 'bundled', 'system', 'yes' (system if possible, otherwise bundled)") MACRO (CHECK_JEMALLOC) IF(WITH_JEMALLOC STREQUAL "system" OR WITH_JEMALLOC STREQUAL "yes") CHECK_LIBRARY_EXISTS(jemalloc malloc_stats_print "" HAVE_JEMALLOC) IF (HAVE_JEMALLOC) SET(LIBJEMALLOC jemalloc) + SET(MALLOC_LIBRARY "system jemalloc") ELSEIF (WITH_JEMALLOC STREQUAL "system") MESSAGE(FATAL_ERROR "system jemalloc is not found") ELSEIF (WITH_JEMALLOC STREQUAL "yes") @@ -61,5 +62,6 @@ MACRO (CHECK_JEMALLOC) ENDIF() IF(WITH_JEMALLOC STREQUAL "bundled" OR trybundled) USE_BUNDLED_JEMALLOC() + SET(MALLOC_LIBRARY "bundled jemalloc") ENDIF() ENDMACRO() diff --git a/cmake/mysql_add_executable.cmake b/cmake/mysql_add_executable.cmake index b1e1d3129e6..0c93fb179f5 100644 --- a/cmake/mysql_add_executable.cmake +++ b/cmake/mysql_add_executable.cmake @@ -1,48 +1,48 @@ -# Copyright (c) 2009, 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 - -# Add executable plus some additional MySQL specific stuff -# Usage (same as for standard CMake's ADD_EXECUTABLE) -# -# MYSQL_ADD_EXECUTABLE(target source1...sourceN) -# -# MySQL specifics: -# - instruct CPack to install executable under ${CMAKE_INSTALL_PREFIX}/bin directory -# On Windows : -# - add version resource -# - instruct CPack to do autenticode signing if SIGNCODE is set - -INCLUDE(cmake_parse_arguments) - -FUNCTION (MYSQL_ADD_EXECUTABLE) - # Pass-through arguments for ADD_EXECUTABLE - MYSQL_PARSE_ARGUMENTS(ARG - "WIN32;MACOSX_BUNDLE;EXCLUDE_FROM_ALL;DESTINATION;COMPONENT" - "" - ${ARGN} - ) - LIST(GET ARG_DEFAULT_ARGS 0 target) - LIST(REMOVE_AT ARG_DEFAULT_ARGS 0) - - SET(sources ${ARG_DEFAULT_ARGS}) - ADD_VERSION_INFO(${target} EXECUTABLE sources) - ADD_EXECUTABLE(${target} ${ARG_WIN32} ${ARG_MACOSX_BUNDLE} ${ARG_EXCLUDE_FROM_ALL} ${sources}) - # tell CPack where to install - IF(NOT ARG_EXCLUDE_FROM_ALL) - IF(NOT ARG_DESTINATION) - SET(ARG_DESTINATION ${INSTALL_BINDIR}) +# Copyright (c) 2009, 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 + +# Add executable plus some additional MySQL specific stuff +# Usage (same as for standard CMake's ADD_EXECUTABLE) +# +# MYSQL_ADD_EXECUTABLE(target source1...sourceN) +# +# MySQL specifics: +# - instruct CPack to install executable under ${CMAKE_INSTALL_PREFIX}/bin directory +# On Windows : +# - add version resource +# - instruct CPack to do autenticode signing if SIGNCODE is set + +INCLUDE(cmake_parse_arguments) + +FUNCTION (MYSQL_ADD_EXECUTABLE) + # Pass-through arguments for ADD_EXECUTABLE + MYSQL_PARSE_ARGUMENTS(ARG + "WIN32;MACOSX_BUNDLE;EXCLUDE_FROM_ALL;DESTINATION;COMPONENT" + "" + ${ARGN} + ) + LIST(GET ARG_DEFAULT_ARGS 0 target) + LIST(REMOVE_AT ARG_DEFAULT_ARGS 0) + + SET(sources ${ARG_DEFAULT_ARGS}) + ADD_VERSION_INFO(${target} EXECUTABLE sources) + ADD_EXECUTABLE(${target} ${ARG_WIN32} ${ARG_MACOSX_BUNDLE} ${ARG_EXCLUDE_FROM_ALL} ${sources}) + # tell CPack where to install + IF(NOT ARG_EXCLUDE_FROM_ALL) + IF(NOT ARG_DESTINATION) + SET(ARG_DESTINATION ${INSTALL_BINDIR}) ENDIF() IF(ARG_COMPONENT) SET(COMP COMPONENT ${ARG_COMPONENT}) @@ -50,7 +50,7 @@ FUNCTION (MYSQL_ADD_EXECUTABLE) SET(COMP COMPONENT ${MYSQL_INSTALL_COMPONENT}) ELSE() SET(COMP COMPONENT Client) - ENDIF() - MYSQL_INSTALL_TARGETS(${target} DESTINATION ${ARG_DESTINATION} ${COMP}) - ENDIF() + ENDIF() + MYSQL_INSTALL_TARGETS(${target} DESTINATION ${ARG_DESTINATION} ${COMP}) + ENDIF() ENDFUNCTION() diff --git a/cmake/os/Linux.cmake b/cmake/os/Linux.cmake index 36d7ade66a7..b0680d92a1b 100644 --- a/cmake/os/Linux.cmake +++ b/cmake/os/Linux.cmake @@ -1,5 +1,5 @@ -# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# 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 @@ -34,7 +34,10 @@ ENDFOREACH() # Ensure we have clean build for shared libraries # without unresolved symbols -SET(LINK_FLAG_NO_UNDEFINED "-Wl,--no-undefined") +# Not supported with AddressSanitizer +IF(NOT WITH_ASAN) + SET(LINK_FLAG_NO_UNDEFINED "-Wl,--no-undefined") +ENDIF() # 64 bit file offset support flag SET(_FILE_OFFSET_BITS 64) diff --git a/cmake/pcre.cmake b/cmake/pcre.cmake new file mode 100644 index 00000000000..45d9bc01ddb --- /dev/null +++ b/cmake/pcre.cmake @@ -0,0 +1,16 @@ +SET(WITH_PCRE "auto" CACHE STRING + "Which pcre to use (possible values are 'bundled', 'system', or 'auto')") + +MACRO (CHECK_PCRE) + IF(WITH_PCRE STREQUAL "system" OR WITH_PCRE STREQUAL "auto") + CHECK_LIBRARY_EXISTS(pcre pcre_stack_guard "" HAVE_PCRE) + ENDIF() + IF(NOT HAVE_PCRE) + IF (WITH_PCRE STREQUAL "system") + MESSAGE(FATAL_ERROR "system pcre is not found or unusable") + ENDIF() + SET(PCRE_INCLUDES ${CMAKE_BINARY_DIR}/pcre ${CMAKE_SOURCE_DIR}/pcre) + ADD_SUBDIRECTORY(pcre) + ENDIF() +ENDMACRO() + diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index d0847f1f84e..07372849a10 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -37,8 +37,7 @@ MACRO(MYSQL_ADD_PLUGIN) # Add common include directories INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/sql - ${CMAKE_BINARY_DIR}/pcre - ${CMAKE_SOURCE_DIR}/pcre + ${PCRE_INCLUDES} ${SSL_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}) diff --git a/cmake/versioninfo.rc.in b/cmake/versioninfo.rc.in index 6eb853936d2..cd880b917e0 100644 --- a/cmake/versioninfo.rc.in +++ b/cmake/versioninfo.rc.in @@ -1,38 +1,38 @@ -// Copyright (c) 2009, 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 - -#include -VS_VERSION_INFO VERSIONINFO -FILEVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH_VERSION@,@TINY_VERSION@ -PRODUCTVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH_VERSION@,@TINY_VERSION@ -FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -FILEFLAGS 0 -FILEOS VOS__WINDOWS32 -FILETYPE @FILETYPE@ -FILESUBTYPE VFT2_UNKNOWN -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904E4" - BEGIN - VALUE "FileVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@.@TINY_VERSION@\0" - VALUE "ProductVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@.@TINY_VERSION@\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END +// Copyright (c) 2009, 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 + +#include +VS_VERSION_INFO VERSIONINFO +FILEVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH_VERSION@,@TINY_VERSION@ +PRODUCTVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH_VERSION@,@TINY_VERSION@ +FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +FILEFLAGS 0 +FILEOS VOS__WINDOWS32 +FILETYPE @FILETYPE@ +FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "FileVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@.@TINY_VERSION@\0" + VALUE "ProductVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@.@TINY_VERSION@\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END diff --git a/cmake/zlib.cmake b/cmake/zlib.cmake index d2e78dd7049..03d2c542ba4 100644 --- a/cmake/zlib.cmake +++ b/cmake/zlib.cmake @@ -1,5 +1,4 @@ -# Copyright (c) 2009 Sun Microsystems, Inc. -# Use is subject to license terms. +# Copyright (c) 2009, 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 diff --git a/config.h.cmake b/config.h.cmake index d09be63894e..06c18da66c8 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -1,4 +1,4 @@ -/* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2009, 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 @@ -618,7 +618,7 @@ #cmakedefine DEFAULT_CHARSET_HOME "@DEFAULT_CHARSET_HOME@" #cmakedefine PLUGINDIR "@PLUGINDIR@" #cmakedefine DEFAULT_SYSCONFDIR "@DEFAULT_SYSCONFDIR@" -#cmakedefine DEFAULT_TMPDIR "@DEFAULT_TMPDIR@" +#cmakedefine DEFAULT_TMPDIR @DEFAULT_TMPDIR@ #cmakedefine SO_EXT "@CMAKE_SHARED_MODULE_SUFFIX@" @@ -636,6 +636,7 @@ #define VERSION "@VERSION@" #define PROTOCOL_VERSION 10 +#define MALLOC_LIBRARY "@MALLOC_LIBRARY@" /* time_t related defines */ diff --git a/configure.cmake b/configure.cmake index 911cb38c454..7ec87f6e9a8 100644 --- a/configure.cmake +++ b/configure.cmake @@ -140,6 +140,10 @@ IF(UNIX) SET(CMAKE_REQUIRED_LIBRARIES ${LIBM} ${LIBNSL} ${LIBBIND} ${LIBCRYPT} ${LIBSOCKET} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT} ${LIBEXECINFO}) + # Need explicit pthread for gcc -fsanitize=address + IF(CMAKE_USE_PTHREADS_INIT AND CMAKE_C_FLAGS MATCHES "-fsanitize=") + SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} pthread) + ENDIF() IF(CMAKE_REQUIRED_LIBRARIES) LIST(REMOVE_DUPLICATES CMAKE_REQUIRED_LIBRARIES) diff --git a/debian/dist/Debian/control b/debian/dist/Debian/control index 0f7155c6ee7..cb4164fabf3 100644 --- a/debian/dist/Debian/control +++ b/debian/dist/Debian/control @@ -73,4 +73,4 @@ Depends: mariadb-test-10.0 (= ${source:Version}) Description: MariaDB database regression test suite (metapackage depending on the latest version) This is an empty package that depends on the current "best" version of mariadb-test (currently mariadb-test-10.0), as determined by the MariaDB - maintainers. \ No newline at end of file + maintainers. diff --git a/debian/dist/Debian/mariadb-galera-server-10.0.files.in b/debian/dist/Debian/mariadb-galera-server-10.0.files.in index 4c2d448adae..8080db1d29d 100644 --- a/debian/dist/Debian/mariadb-galera-server-10.0.files.in +++ b/debian/dist/Debian/mariadb-galera-server-10.0.files.in @@ -3,8 +3,7 @@ usr/lib/mysql/plugin/auth_pam.so usr/lib/mysql/plugin/auth_socket.so usr/lib/mysql/plugin/ha_sequence.so usr/lib/mysql/plugin/ha_sphinx.so -usr/lib/mysql/plugin/ha_xtradb.so -usr/lib/mysql/plugin/ha_oqgraph.so +usr/lib/mysql/plugin/ha_innodb.so usr/lib/mysql/plugin/handlersocket.so usr/lib/mysql/plugin/locales.so usr/lib/mysql/plugin/metadata_lock_info.so diff --git a/debian/dist/Ubuntu/control b/debian/dist/Ubuntu/control index 42eeadd7e8a..1d07dffb50e 100644 --- a/debian/dist/Ubuntu/control +++ b/debian/dist/Ubuntu/control @@ -73,4 +73,4 @@ Depends: mariadb-test-10.0 (= ${source:Version}) Description: MariaDB database regression test suite (metapackage depending on the latest version) This is an empty package that depends on the current "best" version of mariadb-test (currently mariadb-test-10.0), as determined by the MariaDB - maintainers. \ No newline at end of file + maintainers. diff --git a/debian/dist/Ubuntu/mariadb-galera-server-10.0.files.in b/debian/dist/Ubuntu/mariadb-galera-server-10.0.files.in index 14388f44c1d..52ce01efb39 100644 --- a/debian/dist/Ubuntu/mariadb-galera-server-10.0.files.in +++ b/debian/dist/Ubuntu/mariadb-galera-server-10.0.files.in @@ -3,8 +3,7 @@ usr/lib/mysql/plugin/auth_pam.so usr/lib/mysql/plugin/auth_socket.so usr/lib/mysql/plugin/ha_sequence.so usr/lib/mysql/plugin/ha_sphinx.so -usr/lib/mysql/plugin/ha_xtradb.so -usr/lib/mysql/plugin/ha_oqgraph.so +usr/lib/mysql/plugin/ha_innodb.so usr/lib/mysql/plugin/handlersocket.so usr/lib/mysql/plugin/locales.so usr/lib/mysql/plugin/metadata_lock_info.so diff --git a/debian/patches/33_scripts__mysql_create_system_tables__no_test.dpatch b/debian/patches/33_scripts__mysql_create_system_tables__no_test.dpatch index 615261713b0..7ce692a96b0 100755 --- a/debian/patches/33_scripts__mysql_create_system_tables__no_test.dpatch +++ b/debian/patches/33_scripts__mysql_create_system_tables__no_test.dpatch @@ -10,21 +10,30 @@ @DPATCH@ --- old/scripts/mysql_system_tables_data.sql 2008-12-04 22:59:44.000000000 +0100 +++ new/scripts/mysql_system_tables_data.sql 2008-12-04 23:00:07.000000000 +0100 -@@ -31,8 +31,6 @@ - -- Fill "db" table with default grants for anyone to - -- access database 'test' and 'test_%' if "db" table didn't exist - CREATE TEMPORARY TABLE tmp_db LIKE db; +@@ -26,16 +26,6 @@ + -- a plain character + SELECT LOWER( REPLACE((SELECT REPLACE(@@hostname,'_','\_')),'%','\%') )INTO @current_hostname; + +- +--- Fill "db" table with default grants for anyone to +--- access database 'test' and 'test_%' if "db" table didn't exist +-CREATE TEMPORARY TABLE tmp_db LIKE db; -INSERT INTO tmp_db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y'); -INSERT INTO tmp_db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y'); - INSERT INTO db SELECT * FROM tmp_db WHERE @had_db_table=0; - DROP TABLE tmp_db; - -@@ -44,8 +42,6 @@ - REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N' FROM dual WHERE LOWER( @current_hostname) != 'localhost'; +-INSERT INTO db SELECT * FROM tmp_db WHERE @had_db_table=0; +-DROP TABLE tmp_db; +- +- + -- Fill "user" table with default users allowing root access + -- from local machine if "user" table didn't exist before + CREATE TEMPORARY TABLE tmp_user LIKE user; +@@ -43,8 +33,6 @@ INSERT INTO tmp_user VALUES ('localhost' + REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N' FROM dual WHERE @current_hostname != 'localhost'; REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N'); REPLACE INTO tmp_user VALUES ('::1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N'); -INSERT INTO tmp_user (host,user) VALUES ('localhost',''); --INSERT INTO tmp_user (host,user) SELECT @current_hostname,'' FROM dual WHERE LOWER(@current_hostname ) != 'localhost'; +-INSERT INTO tmp_user (host,user) SELECT @current_hostname,'' FROM dual WHERE @current_hostname != 'localhost'; INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0; DROP TABLE tmp_user; + diff --git a/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch b/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch index 81c1baf4375..5a9c3a59698 100755 --- a/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch +++ b/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch @@ -9,7 +9,7 @@ --- a/scripts/mysqld_safe.sh 2013-01-11 16:02:41 +0000 +++ b/scripts/mysqld_safe.sh 2013-01-11 16:03:14 +0000 -@@ -30,7 +30,6 @@ +@@ -32,7 +32,6 @@ err_log= syslog_tag_mysqld=mysqld syslog_tag_mysqld_safe=mysqld_safe @@ -17,7 +17,7 @@ # MySQL-specific environment variable. First off, it's not really a umask, # it's the desired mode. Second, it follows umask(2), not umask(3) in that -@@ -156,7 +155,7 @@ +@@ -163,7 +162,7 @@ eval_log_error () { # sed buffers output (only GNU sed supports a -u (unbuffered) option) # which means that messages may not get sent to syslog until the # mysqld process quits. @@ -26,7 +26,7 @@ ;; *) echo "Internal program error (non-fatal):" \ -@@ -758,6 +757,13 @@ +@@ -805,6 +804,13 @@ then fi # diff --git a/debian/patches/41_scripts__mysql_install_db.sh__no_test.dpatch b/debian/patches/41_scripts__mysql_install_db.sh__no_test.dpatch index d4e67b321b0..5ab8ab3d3d7 100755 --- a/debian/patches/41_scripts__mysql_install_db.sh__no_test.dpatch +++ b/debian/patches/41_scripts__mysql_install_db.sh__no_test.dpatch @@ -9,12 +9,12 @@ --- mysql-dfsg-5.1-5.1.23rc.orig/scripts/mysql_install_db.sh 2008-01-29 22:41:20.000000000 +0100 +++ mysql-dfsg-5.1-5.1.23rc/scripts/mysql_install_db.sh 2008-02-28 10:08:11.000000000 +0100 -@@ -306,7 +306,7 @@ +@@ -372,7 +372,7 @@ then fi # Create database directories -for dir in "$ldata" "$ldata/mysql" "$ldata/test" +for dir in "$ldata" "$ldata/mysql" do - if test ! -d $dir + if test ! -d "$dir" then diff --git a/debian/patches/44_scripts__mysql_config__libs.dpatch b/debian/patches/44_scripts__mysql_config__libs.dpatch index 1c15200aead..a8569617dba 100755 --- a/debian/patches/44_scripts__mysql_config__libs.dpatch +++ b/debian/patches/44_scripts__mysql_config__libs.dpatch @@ -8,7 +8,7 @@ diff -Nur mysql-dfsg-5.1-5.1.31.orig/scripts/mysql_config.sh mysql-dfsg-5.1-5.1.31/scripts/mysql_config.sh --- mysql-dfsg-5.1-5.1.31.orig/scripts/mysql_config.sh 2009-01-19 17:30:55.000000000 +0100 +++ mysql-dfsg-5.1-5.1.31/scripts/mysql_config.sh 2009-02-08 17:17:48.000000000 +0100 -@@ -110,10 +110,10 @@ +@@ -106,10 +106,10 @@ fi # Create options # We intentionally add a space to the beginning and end of lib strings, simplifies replace later diff --git a/debian/patches/50_mysql-test__db_test.dpatch b/debian/patches/50_mysql-test__db_test.dpatch index fe356ae46ef..670afbf14ac 100755 --- a/debian/patches/50_mysql-test__db_test.dpatch +++ b/debian/patches/50_mysql-test__db_test.dpatch @@ -10,9 +10,9 @@ --- old/mysql-test/mysql-test-run.pl 2009-06-16 14:24:09.000000000 +0200 +++ new/mysql-test/mysql-test-run.pl 2009-07-04 00:03:34.000000000 +0200 -@@ -2717,6 +2717,11 @@ +@@ -3578,6 +3578,11 @@ sub mysql_install_db { mtr_appendfile_to_file("$sql_dir/mysql_system_tables_data.sql", - $bootstrap_sql_file); + $bootstrap_sql_file); + mtr_tofile($bootstrap_sql_file, "-- Debian removed the default privileges on the 'test' database\n"); + mtr_tofile($bootstrap_sql_file, "INSERT INTO mysql.db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y');\n"); diff --git a/debian/po/it.po b/debian/po/it.po index ec6751b2574..0feaa77a45f 100644 --- a/debian/po/it.po +++ b/debian/po/it.po @@ -1,8 +1,8 @@ -# Italian (it) translation of debconf templates for mysql-dfsg-5.1 -# Copyright (C) 2009 Software in the Public Interest -# This file is distributed under the same license as the mysql-dfsg-5.1 package. -# Luca Monducci , 2006 - 2009. -# +# Italian (it) translation of debconf templates for mysql-dfsg-5.1 +# Copyright (C) 2009 Software in the Public Interest +# This file is distributed under the same license as the mysql-dfsg-5.1 package. +# Luca Monducci , 2006 - 2009. +# msgid "" msgstr "" "Project-Id-Version: mysql-dfsg-5.1 5.1.37 italian debconf templates\n" @@ -177,9 +177,6 @@ msgstr "" #. Description #: ../mariadb-galera-server-10.0.templates:8001 #, fuzzy -#| msgid "" -#| "Please read the /usr/share/doc/mariadb-server-10.0/README.Debian file for " -#| "more information." msgid "" "Please read the /usr/share/doc/mariadb-server-10.0/README.Debian file for " "more information." diff --git a/debian/po/sv.po b/debian/po/sv.po index 586dd7f460f..fe21df1e229 100644 --- a/debian/po/sv.po +++ b/debian/po/sv.po @@ -1,9 +1,9 @@ -# Translation of mysql-dfsg-5.1 debconf template to Swedish -# Copyright (C) 2009 Martin Bagge -# This file is distributed under the same license as the mysql-dfsg-5.1 package. -# -# Andreas Henriksson , 2007 -# Martin Bagge , 2009 +# Translation of mysql-dfsg-5.1 debconf template to Swedish +# Copyright (C) 2009 Martin Bagge +# This file is distributed under the same license as the mysql-dfsg-5.1 package. +# +# Andreas Henriksson , 2007 +# Martin Bagge , 2009 msgid "" msgstr "" "Project-Id-Version: mysql-dfsg-5.1 5.0.21-3\n" @@ -178,9 +178,6 @@ msgstr "Du bör kontrollera kontots lösenord efter installationen av paketet." #. Description #: ../mariadb-galera-server-10.0.templates:8001 #, fuzzy -#| msgid "" -#| "Please read the /usr/share/doc/mariadb-server-10.0/README.Debian file for " -#| "more information." msgid "" "Please read the /usr/share/doc/mariadb-server-10.0/README.Debian file for " "more information." diff --git a/extra/jemalloc/ChangeLog b/extra/jemalloc/ChangeLog index fc096d8f42f..4f03fc141cb 100644 --- a/extra/jemalloc/ChangeLog +++ b/extra/jemalloc/ChangeLog @@ -6,6 +6,15 @@ found in the git revision history: http://www.canonware.com/cgi-bin/gitweb.cgi?p=jemalloc.git git://canonware.com/jemalloc.git +* 3.3.1a (December 27, 2013) + + Bug fixes from 3.4.1 + - Fix Valgrind integration flaws that caused Valgrind warnings about reads of + uninitialized memory in: + + arena chunk headers + + internal zero-initialized data structures (relevant to tcache and prof + code) + * 3.3.1 (March 6, 2013) This version fixes bugs that are typically encountered only when utilizing diff --git a/extra/jemalloc/include/jemalloc/internal/arena.h b/extra/jemalloc/include/jemalloc/internal/arena.h index f2c18f43543..bbcfedacead 100644 --- a/extra/jemalloc/include/jemalloc/internal/arena.h +++ b/extra/jemalloc/include/jemalloc/internal/arena.h @@ -441,6 +441,7 @@ void arena_postfork_child(arena_t *arena); #ifndef JEMALLOC_ENABLE_INLINE arena_chunk_map_t *arena_mapp_get(arena_chunk_t *chunk, size_t pageind); size_t *arena_mapbitsp_get(arena_chunk_t *chunk, size_t pageind); +size_t arena_mapbitsp_read(size_t *mapbitsp); size_t arena_mapbits_get(arena_chunk_t *chunk, size_t pageind); size_t arena_mapbits_unallocated_size_get(arena_chunk_t *chunk, size_t pageind); @@ -451,6 +452,7 @@ size_t arena_mapbits_dirty_get(arena_chunk_t *chunk, size_t pageind); size_t arena_mapbits_unzeroed_get(arena_chunk_t *chunk, size_t pageind); size_t arena_mapbits_large_get(arena_chunk_t *chunk, size_t pageind); size_t arena_mapbits_allocated_get(arena_chunk_t *chunk, size_t pageind); +void arena_mapbitsp_write(size_t *mapbitsp, size_t mapbits); void arena_mapbits_unallocated_set(arena_chunk_t *chunk, size_t pageind, size_t size, size_t flags); void arena_mapbits_unallocated_size_set(arena_chunk_t *chunk, size_t pageind, @@ -497,11 +499,18 @@ arena_mapbitsp_get(arena_chunk_t *chunk, size_t pageind) return (&arena_mapp_get(chunk, pageind)->bits); } +JEMALLOC_ALWAYS_INLINE size_t +arena_mapbitsp_read(size_t *mapbitsp) +{ + + return (*mapbitsp); +} + JEMALLOC_ALWAYS_INLINE size_t arena_mapbits_get(arena_chunk_t *chunk, size_t pageind) { - return (*arena_mapbitsp_get(chunk, pageind)); + return (arena_mapbitsp_read(arena_mapbitsp_get(chunk, pageind))); } JEMALLOC_ALWAYS_INLINE size_t @@ -584,83 +593,90 @@ arena_mapbits_allocated_get(arena_chunk_t *chunk, size_t pageind) return (mapbits & CHUNK_MAP_ALLOCATED); } +JEMALLOC_ALWAYS_INLINE void +arena_mapbitsp_write(size_t *mapbitsp, size_t mapbits) +{ + + *mapbitsp = mapbits; +} + JEMALLOC_ALWAYS_INLINE void arena_mapbits_unallocated_set(arena_chunk_t *chunk, size_t pageind, size_t size, size_t flags) { - size_t *mapbitsp; + size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind); - mapbitsp = arena_mapbitsp_get(chunk, pageind); assert((size & PAGE_MASK) == 0); assert((flags & ~CHUNK_MAP_FLAGS_MASK) == 0); assert((flags & (CHUNK_MAP_DIRTY|CHUNK_MAP_UNZEROED)) == flags); - *mapbitsp = size | CHUNK_MAP_BININD_INVALID | flags; + arena_mapbitsp_write(mapbitsp, size | CHUNK_MAP_BININD_INVALID | flags); } JEMALLOC_ALWAYS_INLINE void arena_mapbits_unallocated_size_set(arena_chunk_t *chunk, size_t pageind, size_t size) { - size_t *mapbitsp; + size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind); + size_t mapbits = arena_mapbitsp_read(mapbitsp); - mapbitsp = arena_mapbitsp_get(chunk, pageind); assert((size & PAGE_MASK) == 0); - assert((*mapbitsp & (CHUNK_MAP_LARGE|CHUNK_MAP_ALLOCATED)) == 0); - *mapbitsp = size | (*mapbitsp & PAGE_MASK); + assert((mapbits & (CHUNK_MAP_LARGE|CHUNK_MAP_ALLOCATED)) == 0); + arena_mapbitsp_write(mapbitsp, size | (mapbits & PAGE_MASK)); } JEMALLOC_ALWAYS_INLINE void arena_mapbits_large_set(arena_chunk_t *chunk, size_t pageind, size_t size, size_t flags) { - size_t *mapbitsp; + size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind); + size_t mapbits = arena_mapbitsp_read(mapbitsp); size_t unzeroed; - mapbitsp = arena_mapbitsp_get(chunk, pageind); assert((size & PAGE_MASK) == 0); assert((flags & CHUNK_MAP_DIRTY) == flags); - unzeroed = *mapbitsp & CHUNK_MAP_UNZEROED; /* Preserve unzeroed. */ - *mapbitsp = size | CHUNK_MAP_BININD_INVALID | flags | unzeroed | - CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED; + unzeroed = mapbits & CHUNK_MAP_UNZEROED; /* Preserve unzeroed. */ + arena_mapbitsp_write(mapbitsp, size | CHUNK_MAP_BININD_INVALID | flags + | unzeroed | CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED); } JEMALLOC_ALWAYS_INLINE void arena_mapbits_large_binind_set(arena_chunk_t *chunk, size_t pageind, size_t binind) { - size_t *mapbitsp; + size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind); + size_t mapbits = arena_mapbitsp_read(mapbitsp); assert(binind <= BININD_INVALID); - mapbitsp = arena_mapbitsp_get(chunk, pageind); assert(arena_mapbits_large_size_get(chunk, pageind) == PAGE); - *mapbitsp = (*mapbitsp & ~CHUNK_MAP_BININD_MASK) | (binind << - CHUNK_MAP_BININD_SHIFT); + arena_mapbitsp_write(mapbitsp, (mapbits & ~CHUNK_MAP_BININD_MASK) | + (binind << CHUNK_MAP_BININD_SHIFT)); } JEMALLOC_ALWAYS_INLINE void arena_mapbits_small_set(arena_chunk_t *chunk, size_t pageind, size_t runind, size_t binind, size_t flags) { - size_t *mapbitsp; + size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind); + size_t mapbits = arena_mapbitsp_read(mapbitsp); size_t unzeroed; assert(binind < BININD_INVALID); - mapbitsp = arena_mapbitsp_get(chunk, pageind); assert(pageind - runind >= map_bias); assert((flags & CHUNK_MAP_DIRTY) == flags); - unzeroed = *mapbitsp & CHUNK_MAP_UNZEROED; /* Preserve unzeroed. */ - *mapbitsp = (runind << LG_PAGE) | (binind << CHUNK_MAP_BININD_SHIFT) | - flags | unzeroed | CHUNK_MAP_ALLOCATED; + unzeroed = mapbits & CHUNK_MAP_UNZEROED; /* Preserve unzeroed. */ + arena_mapbitsp_write(mapbitsp, (runind << LG_PAGE) | (binind << + CHUNK_MAP_BININD_SHIFT) | flags | unzeroed | CHUNK_MAP_ALLOCATED); } JEMALLOC_ALWAYS_INLINE void arena_mapbits_unzeroed_set(arena_chunk_t *chunk, size_t pageind, size_t unzeroed) { - size_t *mapbitsp; + size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind); + size_t mapbits = arena_mapbitsp_read(mapbitsp); - mapbitsp = arena_mapbitsp_get(chunk, pageind); - *mapbitsp = (*mapbitsp & ~CHUNK_MAP_UNZEROED) | unzeroed; + arena_mapbitsp_write(mapbitsp, (mapbits & ~CHUNK_MAP_UNZEROED) | + unzeroed); } JEMALLOC_INLINE bool diff --git a/extra/jemalloc/include/jemalloc/internal/jemalloc_internal.h.in b/extra/jemalloc/include/jemalloc/internal/jemalloc_internal.h.in index 50d84cabf69..124ec34bddf 100644 --- a/extra/jemalloc/include/jemalloc/internal/jemalloc_internal.h.in +++ b/extra/jemalloc/include/jemalloc/internal/jemalloc_internal.h.in @@ -235,6 +235,7 @@ static const bool config_ivsalloc = #ifdef JEMALLOC_DEBUG /* Disable inlining to make debugging easier. */ # define JEMALLOC_ALWAYS_INLINE +# define JEMALLOC_ALWAYS_INLINE_C static # define JEMALLOC_INLINE # define inline #else @@ -242,8 +243,11 @@ static const bool config_ivsalloc = # ifdef JEMALLOC_HAVE_ATTR # define JEMALLOC_ALWAYS_INLINE \ static inline JEMALLOC_ATTR(unused) JEMALLOC_ATTR(always_inline) +# define JEMALLOC_ALWAYS_INLINE_C \ + static inline JEMALLOC_ATTR(always_inline) # else # define JEMALLOC_ALWAYS_INLINE static inline +# define JEMALLOC_ALWAYS_INLINE_C static inline # endif # define JEMALLOC_INLINE static inline # ifdef _MSC_VER diff --git a/extra/jemalloc/include/jemalloc/internal/private_namespace.h b/extra/jemalloc/include/jemalloc/internal/private_namespace.h index 65de3163fd3..cdb0b0eb1c4 100644 --- a/extra/jemalloc/include/jemalloc/internal/private_namespace.h +++ b/extra/jemalloc/include/jemalloc/internal/private_namespace.h @@ -33,6 +33,8 @@ #define arena_mapbits_unzeroed_get JEMALLOC_N(arena_mapbits_unzeroed_get) #define arena_mapbits_unzeroed_set JEMALLOC_N(arena_mapbits_unzeroed_set) #define arena_mapbitsp_get JEMALLOC_N(arena_mapbitsp_get) +#define arena_mapbitsp_read JEMALLOC_N(arena_mapbitsp_read) +#define arena_mapbitsp_write JEMALLOC_N(arena_mapbitsp_write) #define arena_mapp_get JEMALLOC_N(arena_mapp_get) #define arena_maxclass JEMALLOC_N(arena_maxclass) #define arena_new JEMALLOC_N(arena_new) diff --git a/extra/jemalloc/include/jemalloc/internal/tcache.h b/extra/jemalloc/include/jemalloc/internal/tcache.h index ba36204ff21..d4eecdee0dc 100644 --- a/extra/jemalloc/include/jemalloc/internal/tcache.h +++ b/extra/jemalloc/include/jemalloc/internal/tcache.h @@ -313,6 +313,7 @@ tcache_alloc_small(tcache_t *tcache, size_t size, bool zero) } else if (opt_zero) memset(ret, 0, size); } + VALGRIND_MAKE_MEM_UNDEFINED(ret, size); } else { if (config_fill && opt_junk) { arena_alloc_junk_small(ret, &arena_bin_info[binind], @@ -321,7 +322,6 @@ tcache_alloc_small(tcache_t *tcache, size_t size, bool zero) VALGRIND_MAKE_MEM_UNDEFINED(ret, size); memset(ret, 0, size); } - VALGRIND_MAKE_MEM_UNDEFINED(ret, size); if (config_stats) tbin->tstats.nrequests++; @@ -368,11 +368,11 @@ tcache_alloc_large(tcache_t *tcache, size_t size, bool zero) else if (opt_zero) memset(ret, 0, size); } + VALGRIND_MAKE_MEM_UNDEFINED(ret, size); } else { VALGRIND_MAKE_MEM_UNDEFINED(ret, size); memset(ret, 0, size); } - VALGRIND_MAKE_MEM_UNDEFINED(ret, size); if (config_stats) tbin->tstats.nrequests++; diff --git a/extra/jemalloc/src/arena.c b/extra/jemalloc/src/arena.c index 05a787f89d9..d28b629a1e1 100644 --- a/extra/jemalloc/src/arena.c +++ b/extra/jemalloc/src/arena.c @@ -368,14 +368,21 @@ arena_run_zero(arena_chunk_t *chunk, size_t run_ind, size_t npages) (npages << LG_PAGE)); } +static inline void +arena_run_page_mark_zeroed(arena_chunk_t *chunk, size_t run_ind) +{ + + VALGRIND_MAKE_MEM_DEFINED((void *)((uintptr_t)chunk + (run_ind << + LG_PAGE)), PAGE); +} + static inline void arena_run_page_validate_zeroed(arena_chunk_t *chunk, size_t run_ind) { size_t i; UNUSED size_t *p = (size_t *)((uintptr_t)chunk + (run_ind << LG_PAGE)); - VALGRIND_MAKE_MEM_DEFINED((void *)((uintptr_t)chunk + (run_ind << - LG_PAGE)), PAGE); + arena_run_page_mark_zeroed(chunk, run_ind); for (i = 0; i < PAGE / sizeof(size_t); i++) assert(p[i] == 0); } @@ -458,6 +465,9 @@ arena_run_split(arena_t *arena, arena_run_t *run, size_t size, bool large, } else if (config_debug) { arena_run_page_validate_zeroed( chunk, run_ind+i); + } else { + arena_run_page_mark_zeroed( + chunk, run_ind+i); } } } else { @@ -467,6 +477,9 @@ arena_run_split(arena_t *arena, arena_run_t *run, size_t size, bool large, */ arena_run_zero(chunk, run_ind, need_pages); } + } else { + VALGRIND_MAKE_MEM_UNDEFINED((void *)((uintptr_t)chunk + + (run_ind << LG_PAGE)), (need_pages << LG_PAGE)); } /* @@ -508,9 +521,9 @@ arena_run_split(arena_t *arena, arena_run_t *run, size_t size, bool large, arena_run_page_validate_zeroed(chunk, run_ind+need_pages-1); } + VALGRIND_MAKE_MEM_UNDEFINED((void *)((uintptr_t)chunk + + (run_ind << LG_PAGE)), (need_pages << LG_PAGE)); } - VALGRIND_MAKE_MEM_UNDEFINED((void *)((uintptr_t)chunk + (run_ind << - LG_PAGE)), (need_pages << LG_PAGE)); } static arena_chunk_t * @@ -569,17 +582,24 @@ arena_chunk_alloc(arena_t *arena) * unless the chunk is not zeroed. */ if (zero == false) { + VALGRIND_MAKE_MEM_UNDEFINED( + (void *)arena_mapp_get(chunk, map_bias+1), + (size_t)((uintptr_t) arena_mapp_get(chunk, + chunk_npages-1) - (uintptr_t)arena_mapp_get(chunk, + map_bias+1))); for (i = map_bias+1; i < chunk_npages-1; i++) arena_mapbits_unzeroed_set(chunk, i, unzeroed); - } else if (config_debug) { + } else { VALGRIND_MAKE_MEM_DEFINED( (void *)arena_mapp_get(chunk, map_bias+1), - (void *)((uintptr_t) - arena_mapp_get(chunk, chunk_npages-1) - - (uintptr_t)arena_mapp_get(chunk, map_bias+1))); - for (i = map_bias+1; i < chunk_npages-1; i++) { - assert(arena_mapbits_unzeroed_get(chunk, i) == - unzeroed); + (size_t)((uintptr_t) arena_mapp_get(chunk, + chunk_npages-1) - (uintptr_t)arena_mapp_get(chunk, + map_bias+1))); + if (config_debug) { + for (i = map_bias+1; i < chunk_npages-1; i++) { + assert(arena_mapbits_unzeroed_get(chunk, + i) == unzeroed); + } } } arena_mapbits_unallocated_set(chunk, chunk_npages-1, @@ -1458,6 +1478,7 @@ arena_malloc_small(arena_t *arena, size_t size, bool zero) } else if (opt_zero) memset(ret, 0, size); } + VALGRIND_MAKE_MEM_UNDEFINED(ret, size); } else { if (config_fill && opt_junk) { arena_alloc_junk_small(ret, &arena_bin_info[binind], @@ -1466,7 +1487,6 @@ arena_malloc_small(arena_t *arena, size_t size, bool zero) VALGRIND_MAKE_MEM_UNDEFINED(ret, size); memset(ret, 0, size); } - VALGRIND_MAKE_MEM_UNDEFINED(ret, size); return (ret); } diff --git a/extra/yassl/CMakeLists.txt b/extra/yassl/CMakeLists.txt index 26ea7e23e33..08e0f49d8a2 100644 --- a/extra/yassl/CMakeLists.txt +++ b/extra/yassl/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 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 @@ -33,4 +33,9 @@ SET(YASSL_SOURCES src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp sr ADD_CONVENIENCE_LIBRARY(yassl ${YASSL_SOURCES}) RESTRICT_SYMBOL_EXPORTS(yassl) +INSTALL_DEBUG_SYMBOLS(yassl) +IF(MSVC) + INSTALL_DEBUG_TARGET(yassl DESTINATION ${INSTALL_LIBDIR}/debug) +ENDIF() + diff --git a/extra/yassl/include/yassl_error.hpp b/extra/yassl/include/yassl_error.hpp index a4b29ae2e8c..beba7b0b5dd 100644 --- a/extra/yassl/include/yassl_error.hpp +++ b/extra/yassl/include/yassl_error.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 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 diff --git a/extra/yassl/include/yassl_types.hpp b/extra/yassl/include/yassl_types.hpp index 6a8c3f6c075..129661c58ed 100644 --- a/extra/yassl/include/yassl_types.hpp +++ b/extra/yassl/include/yassl_types.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 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 diff --git a/extra/yassl/src/handshake.cpp b/extra/yassl/src/handshake.cpp index d4c45ae8a3d..79a0c291fb6 100644 --- a/extra/yassl/src/handshake.cpp +++ b/extra/yassl/src/handshake.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. + Copyright (c) 2005, 2013, 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 diff --git a/extra/yassl/src/yassl_error.cpp b/extra/yassl/src/yassl_error.cpp index 2d42e82ab4a..36e286a73ce 100644 --- a/extra/yassl/src/yassl_error.cpp +++ b/extra/yassl/src/yassl_error.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates + Copyright (c) 2005, 2013, 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 diff --git a/extra/yassl/src/yassl_imp.cpp b/extra/yassl/src/yassl_imp.cpp index d943775101b..b927a55237d 100644 --- a/extra/yassl/src/yassl_imp.cpp +++ b/extra/yassl/src/yassl_imp.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates + Copyright (c) 2005, 2013, 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 diff --git a/extra/yassl/taocrypt/CMakeLists.txt b/extra/yassl/taocrypt/CMakeLists.txt index b75d478037e..84f1fc186e4 100644 --- a/extra/yassl/taocrypt/CMakeLists.txt +++ b/extra/yassl/taocrypt/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 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 @@ -32,3 +32,8 @@ SET(TAOCRYPT_SOURCES src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp ADD_CONVENIENCE_LIBRARY(taocrypt ${TAOCRYPT_SOURCES}) RESTRICT_SYMBOL_EXPORTS(taocrypt) +INSTALL_DEBUG_SYMBOLS(taocrypt) +IF(MSVC) + INSTALL_DEBUG_TARGET(taocrypt DESTINATION ${INSTALL_LIBDIR}/debug) +ENDIF() + diff --git a/include/handler_ername.h b/include/handler_ername.h index 91780be553d..50f7f535806 100644 --- a/include/handler_ername.h +++ b/include/handler_ername.h @@ -78,3 +78,4 @@ { "HA_ERR_ROW_NOT_VISIBLE", HA_ERR_ROW_NOT_VISIBLE, "" }, { "HA_ERR_ABORTED_BY_USER", HA_ERR_ABORTED_BY_USER, "" }, { "HA_ERR_DISK_FULL", HA_ERR_DISK_FULL, "" }, +{ "HA_ERR_INCOMPATIBLE_DEFINITION", HA_ERR_INCOMPATIBLE_DEFINITION, "" }, diff --git a/include/hash.h b/include/hash.h index f014c44c7ec..ba36df23f58 100644 --- a/include/hash.h +++ b/include/hash.h @@ -44,6 +44,8 @@ extern "C" { typedef uint my_hash_value_type; typedef uchar *(*my_hash_get_key)(const uchar *,size_t*,my_bool); +typedef my_hash_value_type (*my_hash_function)(const CHARSET_INFO *, + const uchar *, size_t); typedef void (*my_hash_free_key)(void *); typedef my_bool (*my_hash_walk_action)(void *,void *); @@ -54,6 +56,7 @@ typedef struct st_hash { uint flags; DYNAMIC_ARRAY array; /* Place for hash_keys */ my_hash_get_key get_key; + my_hash_function hash_function; void (*free)(void *); CHARSET_INFO *charset; } HASH; @@ -61,10 +64,11 @@ typedef struct st_hash { /* A search iterator state */ typedef uint HASH_SEARCH_STATE; -#define my_hash_init(A,B,C,D,E,F,G,H) my_hash_init2(A,0,B,C,D,E,F,G,H) +#define my_hash_init(A,B,C,D,E,F,G,H) my_hash_init2(A,0,B,C,D,E,F,0,G,H) my_bool my_hash_init2(HASH *hash, uint growth_size, CHARSET_INFO *charset, ulong default_array_elements, size_t key_offset, size_t key_length, my_hash_get_key get_key, + my_hash_function hash_function, void (*free_element)(void*), uint flags); void my_hash_free(HASH *tree); @@ -74,8 +78,9 @@ uchar *my_hash_search(const HASH *info, const uchar *key, size_t length); uchar *my_hash_search_using_hash_value(const HASH *info, my_hash_value_type hash_value, const uchar *key, size_t length); -my_hash_value_type my_calc_hash(const HASH *info, +my_hash_value_type my_hash_sort(const CHARSET_INFO *cs, const uchar *key, size_t length); +#define my_calc_hash(A, B, C) my_hash_sort((A)->charset, B, C) uchar *my_hash_first(const HASH *info, const uchar *key, size_t length, HASH_SEARCH_STATE *state); uchar *my_hash_first_from_hash_value(const HASH *info, diff --git a/include/maria.h b/include/maria.h index 5812c543c1e..908825b9970 100644 --- a/include/maria.h +++ b/include/maria.h @@ -69,8 +69,8 @@ extern "C" { #if MARIA_MAX_KEY > MARIA_KEYMAP_BITS #define maria_is_key_active(_keymap_,_keyno_) \ (((_keyno_) < MARIA_KEYMAP_BITS) ? \ - test((_keymap_) & (1ULL << (_keyno_))) : \ - test((_keymap_) & MARIA_KEYMAP_HIGH_MASK)) + MY_TEST((_keymap_) & (1ULL << (_keyno_))) : \ + MY_TEST((_keymap_) & MARIA_KEYMAP_HIGH_MASK)) #define maria_set_key_active(_keymap_,_keyno_) \ (_keymap_)|= (((_keyno_) < MARIA_KEYMAP_BITS) ? \ (1ULL << (_keyno_)) : \ @@ -81,14 +81,14 @@ extern "C" { (~ (0ULL)) /*ignore*/ ) #else #define maria_is_key_active(_keymap_,_keyno_) \ - test((_keymap_) & (1ULL << (_keyno_))) + MY_TEST((_keymap_) & (1ULL << (_keyno_))) #define maria_set_key_active(_keymap_,_keyno_) \ (_keymap_)|= (1ULL << (_keyno_)) #define maria_clear_key_active(_keymap_,_keyno_) \ (_keymap_)&= (~ (1ULL << (_keyno_))) #endif #define maria_is_any_key_active(_keymap_) \ - test((_keymap_)) + MY_TEST((_keymap_)) #define maria_is_all_keys_active(_keymap_,_keys_) \ ((_keymap_) == maria_get_mask_all_keys_active(_keys_)) #define maria_set_all_keys_active(_keymap_,_keys_) \ diff --git a/include/my_base.h b/include/my_base.h index c9f9a8a4ed3..cc056bffa70 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -200,11 +200,6 @@ enum ha_extra_function { HA_EXTRA_ATTACH_CHILDREN, HA_EXTRA_IS_ATTACHED_CHILDREN, HA_EXTRA_DETACH_CHILDREN, - /* - Prepare table for export - (e.g. quiesce the table and write table metadata). - */ - HA_EXTRA_EXPORT, HA_EXTRA_DETACH_CHILD, /* Inform handler we will force a close as part of flush */ HA_EXTRA_PREPARE_FOR_FORCED_CLOSE @@ -264,13 +259,11 @@ enum ha_base_keytype { #define HA_SPATIAL 1024 /* For spatial search */ #define HA_NULL_ARE_EQUAL 2048 /* NULL in key are cmp as equal */ #define HA_GENERATED_KEY 8192 /* Automaticly generated key */ -#define HA_RTREE_INDEX 16384 /* For RTREE search */ /* The combination of the above can be used for key type comparison. */ #define HA_KEYFLAG_MASK (HA_NOSAME | HA_PACK_KEY | HA_AUTO_KEY | \ HA_BINARY_PACK_KEY | HA_FULLTEXT | HA_UNIQUE_CHECK | \ - HA_SPATIAL | HA_NULL_ARE_EQUAL | HA_GENERATED_KEY | \ - HA_RTREE_INDEX) + HA_SPATIAL | HA_NULL_ARE_EQUAL | HA_GENERATED_KEY) /* Key contains partial segments. @@ -507,7 +500,8 @@ enum ha_base_keytype { #define HA_ERR_ROW_NOT_VISIBLE 187 #define HA_ERR_ABORTED_BY_USER 188 #define HA_ERR_DISK_FULL 189 -#define HA_ERR_LAST 189 /* Copy of last error nr */ +#define HA_ERR_INCOMPATIBLE_DEFINITION 190 +#define HA_ERR_LAST 190 /* Copy of last error nr */ /* Number of different errors */ #define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1) diff --git a/include/my_bitmap.h b/include/my_bitmap.h index ef3274a8269..9c9550e3141 100644 --- a/include/my_bitmap.h +++ b/include/my_bitmap.h @@ -41,9 +41,14 @@ typedef struct st_bitmap #ifdef __cplusplus extern "C" { #endif + +/* compatibility functions */ +#define bitmap_init(A,B,C,D) my_bitmap_init(A,B,C,D) +#define bitmap_free(A) my_bitmap_free(A) + extern void create_last_word_mask(MY_BITMAP *map); -extern my_bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits, - my_bool thread_safe); +extern my_bool my_bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits, + my_bool thread_safe); extern my_bool bitmap_is_clear_all(const MY_BITMAP *map); extern my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size); extern my_bool bitmap_is_set_all(const MY_BITMAP *map); @@ -64,7 +69,7 @@ extern uint bitmap_get_first(const MY_BITMAP *map); extern uint bitmap_get_first_set(const MY_BITMAP *map); extern uint bitmap_bits_set(const MY_BITMAP *map); extern uint bitmap_get_next_set(const MY_BITMAP *map, uint bitmap_bit); -extern void bitmap_free(MY_BITMAP *map); +extern void my_bitmap_free(MY_BITMAP *map); extern void bitmap_set_above(MY_BITMAP *map, uint from_byte, uint use_bit); extern void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size); extern void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2); diff --git a/include/my_check_opt.h b/include/my_check_opt.h new file mode 100644 index 00000000000..a95cb79b3ac --- /dev/null +++ b/include/my_check_opt.h @@ -0,0 +1,76 @@ +/* Copyright (c) 2000, 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 Street, Fifth Floor, Boston, MA 02110-1301, USA */ + +#ifndef _my_check_opt_h +#define _my_check_opt_h + +#ifdef __cplusplus +extern "C" { +#endif + +/* + All given definitions needed for MyISAM storage engine: + myisamchk.c or/and ha_myisam.cc or/and micheck.c + Some definitions are needed by the MySQL parser. +*/ + +#define T_AUTO_INC (1UL << 0) +#define T_AUTO_REPAIR (1UL << 1) +#define T_BACKUP_DATA (1UL << 2) +#define T_CALC_CHECKSUM (1UL << 3) +#define T_CHECK (1UL << 4) +#define T_CHECK_ONLY_CHANGED (1UL << 5) +#define T_CREATE_MISSING_KEYS (1UL << 6) +#define T_DESCRIPT (1UL << 7) +#define T_DONT_CHECK_CHECKSUM (1UL << 8) +#define T_EXTEND (1UL << 9) +#define T_FAST (1UL << 10) +#define T_FORCE_CREATE (1UL << 11) +#define T_FORCE_UNIQUENESS (1UL << 12) +#define T_INFO (1UL << 13) +/** CHECK TABLE...MEDIUM (the default) */ +#define T_MEDIUM (1UL << 14) +/** CHECK TABLE...QUICK */ +#define T_QUICK (1UL << 15) +#define T_READONLY (1UL << 16) +#define T_REP (1UL << 17) +#define T_REP_BY_SORT (1UL << 18) +#define T_REP_PARALLEL (1UL << 19) +#define T_RETRY_WITHOUT_QUICK (1UL << 20) +#define T_SAFE_REPAIR (1UL << 21) +#define T_SILENT (1UL << 22) +#define T_SORT_INDEX (1UL << 23) +#define T_SORT_RECORDS (1UL << 24) +#define T_STATISTICS (1UL << 25) +#define T_UNPACK (1UL << 26) +#define T_UPDATE_STATE (1UL << 27) +#define T_VERBOSE (1UL << 28) +#define T_VERY_SILENT (1UL << 29) +#define T_WAIT_FOREVER (1UL << 30) +#define T_WRITE_LOOP (1UL << 31) +#define T_ZEROFILL (1ULL << 32) +#define T_ZEROFILL_KEEP_LSN (1ULL << 33) +/** If repair should not bump create_rename_lsn */ +#define T_NO_CREATE_RENAME_LSN (1ULL << 34) +#define T_CREATE_UNIQUE_BY_SORT (1ULL << 35) +#define T_SUPPRESS_ERR_HANDLING (1ULL << 36) +#define T_FORCE_SORT_MEMORY (1ULL << 37) + +#define T_REP_ANY (T_REP | T_REP_BY_SORT | T_REP_PARALLEL) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/my_getopt.h b/include/my_getopt.h index 56662079ce4..18b4bf10698 100644 --- a/include/my_getopt.h +++ b/include/my_getopt.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2002, 2012, Oracle and/or its affiliates. + Copyright (c) 2002, 2013, 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 diff --git a/include/my_global.h b/include/my_global.h index 1a7aff4a41f..e9a472e686e 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -144,6 +144,7 @@ /* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */ #if defined(_AIX) && defined(_LARGE_FILE_API) #undef _LARGE_FILE_API +#undef __GNUG__ #endif /* @@ -264,6 +265,16 @@ #endif #endif + +#ifdef _AIX +/* + AIX includes inttypes.h from sys/types.h + Explicitly request format macros before the first inclusion of inttypes.h +*/ +#define __STDC_FORMAT_MACROS +#endif + + #if !defined(__WIN__) #ifndef _POSIX_PTHREAD_SEMANTICS #define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */ @@ -316,6 +327,13 @@ C_MODE_END #define _LONG_LONG 1 /* For AIX string library */ #endif +/* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */ +#if defined(_AIX) && defined(_LARGE_FILE_API) +#undef _LARGE_FILE_API +#undef __GNUG__ +#endif + + #ifndef stdin #include #endif @@ -341,12 +359,17 @@ C_MODE_END #ifdef HAVE_SYS_TYPES_H #include #endif + +/* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */ +#if defined(_AIX) && defined(_LARGE_FILE_API) +#undef _LARGE_FILE_API +#undef __GNUG__ +#endif + + #ifdef HAVE_FCNTL_H #include #endif -#ifdef HAVE_SYS_TIMEB_H -#include /* Avoid warnings on SCO */ -#endif #ifdef HAVE_SYS_STAT_H #include #endif @@ -477,7 +500,7 @@ typedef unsigned short ushort; #endif #define swap_variables(t, a, b) do { t dummy; dummy= a; a= b; b= dummy; } while(0) -#define test(a) ((a) ? 1 : 0) +#define MY_TEST(a) ((a) ? 1 : 0) #define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0) #define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0) #define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1)) @@ -1217,11 +1240,10 @@ static inline double rint(double x) #define HAVE_EXTERNAL_CLIENT #endif /* EMBEDDED_LIBRARY */ -/* - Define default tmpdir if not already set. -*/ -#if !defined(DEFAULT_TMPDIR) -#define DEFAULT_TMPDIR P_tmpdir +/* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */ +#if defined(_AIX) && defined(_LARGE_FILE_API) +#undef _LARGE_FILE_API +#undef __GNUG__ #endif #endif /* my_global_h */ diff --git a/include/my_handler_errors.h b/include/my_handler_errors.h index 17b4a73ff93..76b6b1aa60d 100644 --- a/include/my_handler_errors.h +++ b/include/my_handler_errors.h @@ -92,7 +92,8 @@ static const char *handler_error_messages[]= "Row in wrong partition", "Row is not visible by the current transaction", "Operation was interrupted by end user (probably kill command?)", - "Disk full" + "Disk full", + "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You have to dump and restore the table to fix this" }; #endif /* MYSYS_MY_HANDLER_ERRORS_INCLUDED */ diff --git a/include/my_net.h b/include/my_net.h index 06e5a382b48..1ebb71ead23 100644 --- a/include/my_net.h +++ b/include/my_net.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 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 diff --git a/include/my_pthread.h b/include/my_pthread.h index ebbd666be70..0be821586a1 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -1,5 +1,5 @@ -/* Copyright (C) 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc, - 2010-2011 Oracle and/or its affiliates, 2009-2010 Monty Program Ab. +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. + Copyright (c) 2009, 2013, 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 @@ -96,7 +96,7 @@ int pthread_create(pthread_t *, const pthread_attr_t *, pthread_handler, void *) int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr); int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex); int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, - struct timespec *abstime); + const struct timespec *abstime); int pthread_cond_signal(pthread_cond_t *cond); int pthread_cond_broadcast(pthread_cond_t *cond); int pthread_cond_destroy(pthread_cond_t *cond); diff --git a/include/my_time.h b/include/my_time.h index 67aa9a27f7f..3c45d1d9235 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -74,8 +74,11 @@ extern uchar days_in_month[]; #define MYSQL_TIME_WARN_WARNINGS (MYSQL_TIME_WARN_TRUNCATED|MYSQL_TIME_WARN_OUT_OF_RANGE) #define MYSQL_TIME_WARN_NOTES (MYSQL_TIME_NOTE_TRUNCATED) -#define MYSQL_TIME_WARN_HAVE_WARNINGS(x) test((x) & MYSQL_TIME_WARN_WARNINGS) -#define MYSQL_TIME_WARN_HAVE_NOTES(x) test((x) & MYSQL_TIME_WARN_NOTES) +#define MYSQL_TIME_WARN_HAVE_WARNINGS(x) MY_TEST((x) & MYSQL_TIME_WARN_WARNINGS) +#define MYSQL_TIME_WARN_HAVE_NOTES(x) MY_TEST((x) & MYSQL_TIME_WARN_NOTES) + +/* Usefull constants */ +#define SECONDS_IN_24H 86400L /* Limits for the TIME data type */ #define TIME_MAX_HOUR 838 diff --git a/include/my_valgrind.h b/include/my_valgrind.h index 49da89ab78c..4531ec78f9a 100644 --- a/include/my_valgrind.h +++ b/include/my_valgrind.h @@ -13,10 +13,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* Some defines to make it easier to use valgrind */ -#include /* bfill */ - #ifdef HAVE_valgrind #define IF_VALGRIND(A,B) A #else @@ -37,7 +33,7 @@ #endif /* HAVE_VALGRIND */ #ifndef DBUG_OFF -#define TRASH_FILL(A,B,C) do { const size_t trash_tmp= (B) ; bfill(A, trash_tmp, C); MEM_UNDEFINED(A, trash_tmp); } while (0) +#define TRASH_FILL(A,B,C) do { const size_t trash_tmp= (B); memset(A, C, trash_tmp); MEM_UNDEFINED(A, trash_tmp); } while (0) #else #define TRASH_FILL(A,B,C) do{ const size_t trash_tmp __attribute__((unused)) = (B) ; MEM_CHECK_ADDRESSABLE(A,trash_tmp);MEM_UNDEFINED(A,trash_tmp);} while (0) #endif diff --git a/include/myisam.h b/include/myisam.h index 7952b091d93..853fac20ae4 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. + Copyright (c) 2000, 2013, Oracle and/or its affiliates. Copyright (c) 2009, 2013, Monty Program Ab. This program is free software; you can redistribute it and/or modify @@ -29,7 +29,7 @@ extern "C" { #include "my_compare.h" #include #include - +#include /* Limit max keys according to HA_MAX_POSSIBLE_KEY; See myisamchk.h for details */ @@ -68,8 +68,8 @@ extern "C" { #define mi_is_key_active(_keymap_,_keyno_) \ (((_keyno_) < MI_KEYMAP_BITS) ? \ - test((_keymap_) & (1ULL << (_keyno_))) : \ - test((_keymap_) & MI_KEYMAP_HIGH_MASK)) + MY_TEST((_keymap_) & (1ULL << (_keyno_))) : \ + MY_TEST((_keymap_) & MI_KEYMAP_HIGH_MASK)) #define mi_set_key_active(_keymap_,_keyno_) \ (_keymap_)|= (((_keyno_) < MI_KEYMAP_BITS) ? \ (1ULL << (_keyno_)) : \ @@ -82,7 +82,7 @@ extern "C" { #else #define mi_is_key_active(_keymap_,_keyno_) \ - test((_keymap_) & (1ULL << (_keyno_))) + MY_TEST((_keymap_) & (1ULL << (_keyno_))) #define mi_set_key_active(_keymap_,_keyno_) \ (_keymap_)|= (1ULL << (_keyno_)) #define mi_clear_key_active(_keymap_,_keyno_) \ @@ -91,7 +91,7 @@ extern "C" { #endif #define mi_is_any_key_active(_keymap_) \ - test((_keymap_)) + MY_TEST((_keymap_)) #define mi_is_all_keys_active(_keymap_,_keys_) \ ((_keymap_) == mi_get_mask_all_keys_active(_keys_)) #define mi_set_all_keys_active(_keymap_,_keys_) \ @@ -312,7 +312,6 @@ typedef struct st_mi_bit_buff uint error; } MI_BIT_BUFF; - typedef struct st_sort_info { /* sync things */ diff --git a/include/myisamchk.h b/include/myisamchk.h index 0a30615c629..7abbcea3302 100644 --- a/include/myisamchk.h +++ b/include/myisamchk.h @@ -27,48 +27,6 @@ #ifndef _myisamchk_h #define _myisamchk_h -#define T_AUTO_INC 1 -#define T_AUTO_REPAIR 2 /* QQ to be removed */ -#define T_BACKUP_DATA 4 -#define T_CALC_CHECKSUM 8 -#define T_CHECK 16 -#define T_CHECK_ONLY_CHANGED 32 -#define T_CREATE_MISSING_KEYS 64 -#define T_DESCRIPT 128 -#define T_DONT_CHECK_CHECKSUM 256 -#define T_EXTEND 512 -#define T_FAST (1L << 10) -#define T_FORCE_CREATE (1L << 11) -#define T_FORCE_UNIQUENESS (1L << 12) -#define T_INFO (1L << 13) -#define T_MEDIUM (1L << 14) -#define T_QUICK (1L << 15) -#define T_READONLY (1L << 16) -#define T_REP (1L << 17) -#define T_REP_BY_SORT (1L << 18) -#define T_REP_PARALLEL (1L << 19) -#define T_RETRY_WITHOUT_QUICK (1L << 20) -#define T_SAFE_REPAIR (1L << 21) -#define T_SILENT (1L << 22) -#define T_SORT_INDEX (1L << 23) -#define T_SORT_RECORDS (1L << 24) -#define T_STATISTICS (1L << 25) -#define T_UNPACK (1L << 26) -#define T_UPDATE_STATE (1L << 27) -#define T_VERBOSE (1L << 28) -#define T_VERY_SILENT (1L << 29) -#define T_WAIT_FOREVER (1L << 30) -#define T_WRITE_LOOP ((ulong) 1L << 31) -#define T_ZEROFILL ((ulonglong) 1L << 32) -#define T_ZEROFILL_KEEP_LSN ((ulonglong) 1L << 33) -/** If repair should not bump create_rename_lsn */ -#define T_NO_CREATE_RENAME_LSN ((ulonglong) 1L << 34) -#define T_CREATE_UNIQUE_BY_SORT ((ulonglong) 1L << 35) -#define T_SUPPRESS_ERR_HANDLING ((ulonglong) 1L << 36) -#define T_FORCE_SORT_MEMORY ((ulonglong) 1L << 37) - -#define T_REP_ANY (T_REP | T_REP_BY_SORT | T_REP_PARALLEL) - /* Flags used by xxxxchk.c or/and ha_xxxx.cc that are NOT passed to xxxcheck.c follows: diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index aa678ceba83..8e8229d6630 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -1,5 +1,5 @@ -/* Copyright (c) 2005, 2011, Oracle and/or its affiliates - Copyright (C) 2009, 2011, Monty Program Ab +/* Copyright (c) 2005, 2013, Oracle and/or its affiliates + Copyright (C) 2009, 2013, 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 diff --git a/include/mysql/plugin_audit.h b/include/mysql/plugin_audit.h index 99f5744cd35..31589f071f0 100644 --- a/include/mysql/plugin_audit.h +++ b/include/mysql/plugin_audit.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2007, 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 diff --git a/include/mysql/psi/mysql_thread.h b/include/mysql/psi/mysql_thread.h index f0d88ff8ede..a0682aae4c6 100644 --- a/include/mysql/psi/mysql_thread.h +++ b/include/mysql/psi/mysql_thread.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2008, 2013, 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 @@ -518,7 +518,7 @@ typedef struct st_mysql_cond mysql_cond_t; @c mysql_cond_timedwait is a drop-in replacement for @c pthread_cond_timedwait. */ -#ifdef HAVE_PSI_COND_INTERFACE +#if defined(HAVE_PSI_INTERFACE) || defined(SAFE_MUTEX) #define mysql_cond_timedwait(C, M, W) \ inline_mysql_cond_timedwait(C, M, W, __FILE__, __LINE__) #else @@ -1170,8 +1170,8 @@ static inline int inline_mysql_cond_wait( static inline int inline_mysql_cond_timedwait( mysql_cond_t *that, mysql_mutex_t *mutex, - struct timespec *abstime -#ifdef HAVE_PSI_COND_INTERFACE + const struct timespec *abstime +#if defined(HAVE_PSI_INTERFACE) || defined(SAFE_MUTEX) , const char *src_file, uint src_line #endif ) diff --git a/include/queues.h b/include/queues.h index 4fef72b149c..f341bbb8148 100644 --- a/include/queues.h +++ b/include/queues.h @@ -51,6 +51,7 @@ typedef struct st_queue { #define queue_first_element(queue) 1 #define queue_last_element(queue) (queue)->elements +#define queue_empty(queue) ((queue)->elements == 0) #define queue_top(queue) ((queue)->root[1]) #define queue_element(queue,index) ((queue)->root[index]) #define queue_end(queue) ((queue)->root[(queue)->elements]) diff --git a/include/welcome_copyright_notice.h b/include/welcome_copyright_notice.h index 302f623e377..875770edb89 100644 --- a/include/welcome_copyright_notice.h +++ b/include/welcome_copyright_notice.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011, 2012, Oracle and/or its affiliates. +/* Copyright (c) 2011, 2014, Oracle and/or its affiliates. Copyright (c) 2011, 2012, Monty Program Ab This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ #ifndef _welcome_copyright_notice_h_ #define _welcome_copyright_notice_h_ -#define COPYRIGHT_NOTICE_CURRENT_YEAR "2013" +#define COPYRIGHT_NOTICE_CURRENT_YEAR "2014" /* This define specifies copyright notice which is displayed by every MySQL diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index 43b0c6187b9..e3c932c88f0 100644 --- a/libmysql/CMakeLists.txt +++ b/libmysql/CMakeLists.txt @@ -1,4 +1,5 @@ -# Copyright (c) 2006, 2012, Oracle and/or its affiliates. +# Copyright (c) 2006, 2013, Oracle and/or its affiliates. +# Copyright (c) 2009, 2013, SkySQL 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 @@ -16,8 +17,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/libmysql - ${CMAKE_BINARY_DIR}/pcre - ${CMAKE_SOURCE_DIR}/pcre + ${PCRE_INCLUDES} ${CMAKE_SOURCE_DIR}/strings ${SSL_INCLUDE_DIRS} ${SSL_INTERNAL_INCLUDE_DIRS} @@ -26,8 +26,6 @@ ADD_DEFINITIONS(${SSL_DEFINES}) SET(CLIENT_API_FUNCTIONS_5_1 get_tty_password -handle_options -load_defaults mysql_thread_end mysql_thread_init myodbc_remove_escape @@ -131,6 +129,12 @@ mysql_server_init mysql_server_end mysql_set_character_set mysql_get_character_set_info +# These are documented in Paul DuBois' MySQL book, +# so we treat them as part of the de-facto API. +handle_options +load_defaults +free_defaults +my_print_help ) SET(CLIENT_API_FUNCTIONS_5_5 @@ -153,6 +157,8 @@ mysql_close_cont mysql_close_start mysql_commit_cont mysql_commit_start +mysql_dump_debug_info_cont +mysql_dump_debug_info_start mysql_fetch_row_cont mysql_fetch_row_start mysql_free_result_cont @@ -259,73 +265,76 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux") # for compatibility with distribution packages, so client shared library can # painlessly replace the one supplied by the distribution. - # Also list of exported symbols in distributions may differ from what is considered - # official API. Define CLIENT_API_EXTRA for the set of symbols, that required to - # be exported on different platforms. + # Also list of exported symbols in distributions may differ from what is + # considered official API. Define CLIENT_API_5_1_EXTRA for the set of + # symbols, that required to be exported on different platforms. - IF(RPM) - # Fedora & Co declared following functions as part of API - SET(CLIENT_API_EXTRA - mysql_default_charset_info - mysql_get_charset - mysql_get_charset_by_csname - mysql_net_realloc - mysql_client_errors + # Fedora & Co declared following functions as part of API + SET(CLIENT_API_5_1_EXTRA + # why does Fedora export these? + _fini + _init + my_init - # Also export the non-renamed variants - # (in case someone wants to rebuild mysqli-php or something similar) - # See MDEV-4127 - default_charset_info - get_charset - get_charset_by_csname - net_realloc - client_errors - THR_KEY_mysys - ) - - # Add special script to fix symbols renames by Fedora - SET(CLIENT_SOURCES_EXTRA rpm_support.cc) - SET(VERSION_SCRIPT_TEMPLATE - ${CMAKE_CURRENT_SOURCE_DIR}/libmysql_rpm_version.in) - ELSEIF(DEB) - # libmyodbc on Ubuntu is using functions below - # If we don't export them, linker would just remove - # them (they are not used inside libmysqlclient) - SET(CLIENT_API_EXTRA - strfill - init_dynamic_string - ) - # MySQL supplied with Ubuntu does not have versioning, bug Debian does. - IF(DEB MATCHES "debian") - SET(VERSION_SCRIPT_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/libmysql.ver.in) - ENDIF() - ENDIF() + # mysql-connector-odbc requires these + mysql_default_charset_info + mysql_get_charset + mysql_get_charset_by_csname + mysql_net_realloc - IF(VERSION_SCRIPT_TEMPLATE) - # Generate version script. - # Create semicolon separated lists of functions to export from - # Since RPM packages use separate versioning for 5.1 API - # and 5.5 API (libmysqlclient_16 vs libmysqlclient_18), - # we need 2 lists. - SET (CLIENT_API_5_1_LIST) - FOREACH (f ${CLIENT_API_FUNCTIONS_5_1}) - SET(CLIENT_API_5_1_LIST "${CLIENT_API_5_1_LIST}\n${f};") - ENDFOREACH() - - SET (CLIENT_API_5_5_LIST) - FOREACH (f ${CLIENT_API_FUNCTIONS_5_5}) - SET(CLIENT_API_5_5_LIST "${CLIENT_API_5_5_LIST}\n${f};") - ENDFOREACH() + # PHP's mysqli.so requires this (via the ER() macro) + mysql_client_errors + + # Also export the non-renamed variants + # (in case someone wants to rebuild mysqli-php or something similar) + # See MDEV-4127 + default_charset_info + get_charset + get_charset_by_csname + net_realloc + client_errors + + # pure-ftpd requires this + my_make_scrambled_password + + # hydra requires this + scramble + + # ODB requires this: https://bugzilla.redhat.com/show_bug.cgi?id=846602 + THR_KEY_mysys + + # DBD::mysql requires this + is_prefix + ) + + # Linker script to version symbols in Fedora- and Debian- compatible way, MDEV-5529 + SET(VERSION_SCRIPT_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/libmysql_versions.ld.in) + + # Generate version script. + # Create semicolon separated lists of functions to export from + # Since RPM packages use separate versioning for 5.1 API + # and 5.5 API (libmysqlclient_16 vs libmysqlclient_18), + # we need 2 lists. + SET (CLIENT_API_5_1_LIST) + SET (CLIENT_API_5_1_ALIASES) + FOREACH (f ${CLIENT_API_FUNCTIONS_5_1} ${CLIENT_API_5_1_EXTRA}) + SET(CLIENT_API_5_1_LIST "${CLIENT_API_5_1_LIST}\t${f};\n") + SET(CLIENT_API_5_1_ALIASES "${CLIENT_API_5_1_ALIASES}\"${f}@libmysqlclient_16\" = ${f};\n") + ENDFOREACH() + + SET (CLIENT_API_5_5_LIST) + FOREACH (f ${CLIENT_API_FUNCTIONS_5_5}) + SET(CLIENT_API_5_5_LIST "${CLIENT_API_5_5_LIST}\t${f};\n") + ENDFOREACH() + + CONFIGURE_FILE( + ${VERSION_SCRIPT_TEMPLATE} + ${CMAKE_CURRENT_BINARY_DIR}/libmysql_versions.ld + @ONLY@ + ) + SET(VERSION_SCRIPT_LINK_FLAGS + "-Wl,${CMAKE_CURRENT_BINARY_DIR}/libmysql_versions.ld") - CONFIGURE_FILE( - ${VERSION_SCRIPT_TEMPLATE} - ${CMAKE_CURRENT_BINARY_DIR}/libmysql.version - @ONLY@ - ) - SET(VERSION_SCRIPT_LINK_FLAGS - "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/libmysql.version") - ENDIF() - ENDIF() @@ -353,8 +362,10 @@ SET(LIBS clientlib dbug strings vio mysys mysys_ssl ${ZLIB_LIBRARY} ${SSL_LIBRAR MERGE_LIBRARIES(mysqlclient STATIC ${LIBS} COMPONENT Development) # Visual Studio users need debug static library for debug projects +INSTALL_DEBUG_SYMBOLS(clientlib) IF(MSVC) INSTALL_DEBUG_TARGET(mysqlclient DESTINATION ${INSTALL_LIBDIR}/debug) + INSTALL_DEBUG_TARGET(clientlib DESTINATION ${INSTALL_LIBDIR}/debug) ENDIF() IF(UNIX) @@ -373,7 +384,7 @@ IF(UNIX) ENDIF() IF(NOT DISABLE_SHARED) - MERGE_LIBRARIES(libmysql SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS} ${CLIENT_API_EXTRA} COMPONENT SharedLibraries) + MERGE_LIBRARIES(libmysql SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS} ${CLIENT_API_5_1_EXTRA} COMPONENT SharedLibraries) IF(UNIX) # libtool compatability IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR APPLE) @@ -390,9 +401,6 @@ IF(NOT DISABLE_SHARED) SOVERSION "${SHARED_LIB_MAJOR_VERSION}") IF(LINK_FLAG_NO_UNDEFINED OR VERSION_SCRIPT_LINK_FLAGS) GET_TARGET_PROPERTY(libmysql_link_flags libmysql LINK_FLAGS) - IF(NOT libmysql_link_flag) - SET(libmysql_link_flags) - ENDIF() SET_TARGET_PROPERTIES(libmysql PROPERTIES LINK_FLAGS "${libmysql_link_flags} ${LINK_FLAG_NO_UNDEFINED} ${VERSION_SCRIPT_LINK_FLAGS}") ENDIF() diff --git a/libmysql/conf_to_src.c b/libmysql/conf_to_src.c index 04a6a727029..a5a7d23db0b 100644 --- a/libmysql/conf_to_src.c +++ b/libmysql/conf_to_src.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2004 MySQL AB +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 78de4b8867f..3d8a2bebc75 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1,5 +1,5 @@ -/* Copyright (c) 2000, 2012, Oracle and/or its affiliates - Copyright (c) 2009, 2012, Monty Program Ab +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates + Copyright (c) 2009, 2013, 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 @@ -1273,6 +1273,7 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *, MYSQL_FIELD *field); #define RESET_LONG_DATA 2 #define RESET_STORE_RESULT 4 #define RESET_CLEAR_ERROR 8 +#define RESET_ALL_BUFFERS 16 static my_bool reset_stmt_handle(MYSQL_STMT *stmt, uint flags); @@ -2083,8 +2084,8 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length) buff[4]= (char) stmt->flags; int4store(buff+5, 1); /* iteration count */ - res= test(cli_advanced_command(mysql, COM_STMT_EXECUTE, buff, sizeof(buff), - (uchar*) packet, length, 1, stmt) || + res= MY_TEST(cli_advanced_command(mysql, COM_STMT_EXECUTE, buff, sizeof(buff), + (uchar*) packet, length, 1, stmt) || (*mysql->methods->read_query_result)(mysql)); stmt->affected_rows= mysql->affected_rows; stmt->server_status= mysql->server_status; @@ -2571,7 +2572,7 @@ int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt) reinit_result_set_metadata(stmt); prepare_to_fetch_result(stmt); } - DBUG_RETURN(test(stmt->last_errno)); + DBUG_RETURN(MY_TEST(stmt->last_errno)); } @@ -3187,14 +3188,14 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value, { double data= my_strntod(&my_charset_latin1, value, length, &endptr, &err); float fdata= (float) data; - *param->error= (fdata != data) | test(err); + *param->error= (fdata != data) | MY_TEST(err); floatstore(buffer, fdata); break; } case MYSQL_TYPE_DOUBLE: { double data= my_strntod(&my_charset_latin1, value, length, &endptr, &err); - *param->error= test(err); + *param->error= MY_TEST(err); doublestore(buffer, data); break; } @@ -3204,7 +3205,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value, MYSQL_TIME_STATUS status; str_to_time(value, length, tm, 0, &status); err= status.warnings; - *param->error= test(err); + *param->error= MY_TEST(err); break; } case MYSQL_TYPE_DATE: @@ -3215,8 +3216,8 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value, MYSQL_TIME_STATUS status; (void) str_to_datetime(value, length, tm, 0, &status); err= status.warnings; - *param->error= test(err) && (param->buffer_type == MYSQL_TYPE_DATE && - tm->time_type != MYSQL_TIMESTAMP_DATE); + *param->error= MY_TEST(err) && (param->buffer_type == MYSQL_TYPE_DATE && + tm->time_type != MYSQL_TIMESTAMP_DATE); break; } case MYSQL_TYPE_TINY_BLOB: @@ -3338,7 +3339,7 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, { int error; value= number_to_datetime(value, 0, (MYSQL_TIME *) buffer, 0, &error); - *param->error= test(error); + *param->error= MY_TEST(error); break; } default: @@ -3686,7 +3687,7 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, static void fetch_result_tinyint(MYSQL_BIND *param, MYSQL_FIELD *field, uchar **row) { - my_bool field_is_unsigned= test(field->flags & UNSIGNED_FLAG); + my_bool field_is_unsigned= MY_TEST(field->flags & UNSIGNED_FLAG); uchar data= **row; *(uchar *)param->buffer= data; *param->error= param->is_unsigned != field_is_unsigned && data > INT_MAX8; @@ -3696,7 +3697,7 @@ static void fetch_result_tinyint(MYSQL_BIND *param, MYSQL_FIELD *field, static void fetch_result_short(MYSQL_BIND *param, MYSQL_FIELD *field, uchar **row) { - my_bool field_is_unsigned= test(field->flags & UNSIGNED_FLAG); + my_bool field_is_unsigned= MY_TEST(field->flags & UNSIGNED_FLAG); ushort data= (ushort) sint2korr(*row); shortstore(param->buffer, data); *param->error= param->is_unsigned != field_is_unsigned && data > INT_MAX16; @@ -3707,7 +3708,7 @@ static void fetch_result_int32(MYSQL_BIND *param, MYSQL_FIELD *field __attribute__((unused)), uchar **row) { - my_bool field_is_unsigned= test(field->flags & UNSIGNED_FLAG); + my_bool field_is_unsigned= MY_TEST(field->flags & UNSIGNED_FLAG); uint32 data= (uint32) sint4korr(*row); longstore(param->buffer, data); *param->error= param->is_unsigned != field_is_unsigned && data > INT_MAX32; @@ -3718,7 +3719,7 @@ static void fetch_result_int64(MYSQL_BIND *param, MYSQL_FIELD *field __attribute__((unused)), uchar **row) { - my_bool field_is_unsigned= test(field->flags & UNSIGNED_FLAG); + my_bool field_is_unsigned= MY_TEST(field->flags & UNSIGNED_FLAG); ulonglong data= (ulonglong) sint8korr(*row); *param->error= param->is_unsigned != field_is_unsigned && data > LONGLONG_MAX; longlongstore(param->buffer, data); @@ -4615,6 +4616,14 @@ static my_bool reset_stmt_handle(MYSQL_STMT *stmt, uint flags) *mysql->unbuffered_fetch_owner= TRUE; mysql->status= MYSQL_STATUS_READY; } + if (flags & RESET_ALL_BUFFERS) + { + /* mysql_stmt_next_result will flush all pending + result sets + */ + while (mysql_more_results(mysql) && + mysql_stmt_next_result(stmt) == 0); + } } if (flags & RESET_SERVER_SIDE) { @@ -4679,27 +4688,18 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt) { mysql->stmts= list_delete(mysql->stmts, &stmt->list); /* - Clear NET error state: if the following commands come through - successfully, connection will still be usable for other commands. + Clear NET error state: if the following commands come through + successfully, connection will still be usable for other commands. */ net_clear_error(&mysql->net); + if ((int) stmt->state > (int) MYSQL_STMT_INIT_DONE) { uchar buff[MYSQL_STMT_HEADER]; /* 4 bytes - stmt id */ - if (mysql->unbuffered_fetch_owner == &stmt->unbuffered_fetch_cancelled) - mysql->unbuffered_fetch_owner= 0; - if (mysql->status != MYSQL_STATUS_READY) - { - /* - Flush result set of the connection. If it does not belong - to this statement, set a warning. - */ - (*mysql->methods->flush_use_result)(mysql, TRUE); - if (mysql->unbuffered_fetch_owner) - *mysql->unbuffered_fetch_owner= TRUE; - mysql->status= MYSQL_STATUS_READY; - } + if ((rc= reset_stmt_handle(stmt, RESET_ALL_BUFFERS | RESET_CLEAR_ERROR))) + return rc; + int4store(buff, stmt->stmt_id); if ((rc= stmt_command(mysql, COM_STMT_CLOSE, buff, 4, stmt))) { @@ -4711,7 +4711,7 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt) my_free(stmt->extension); my_free(stmt); - DBUG_RETURN(test(rc)); + DBUG_RETURN(MY_TEST(rc)); } /* @@ -4731,7 +4731,7 @@ my_bool STDCALL mysql_stmt_reset(MYSQL_STMT *stmt) /* Reset the client and server sides of the prepared statement */ DBUG_RETURN(reset_stmt_handle(stmt, RESET_SERVER_SIDE | RESET_LONG_DATA | - RESET_CLEAR_ERROR)); + RESET_ALL_BUFFERS | RESET_CLEAR_ERROR)); } /* @@ -4843,7 +4843,6 @@ int STDCALL mysql_next_result(MYSQL *mysql) DBUG_RETURN(-1); /* No more results */ } - int STDCALL mysql_stmt_next_result(MYSQL_STMT *stmt) { MYSQL *mysql= stmt->mysql; diff --git a/libmysql/libmysql.ver.in b/libmysql/libmysql.ver.in deleted file mode 100644 index 20eb0fd41bb..00000000000 --- a/libmysql/libmysql.ver.in +++ /dev/null @@ -1 +0,0 @@ -libmysqlclient_@SHARED_LIB_MAJOR_VERSION@ { global: *; }; diff --git a/libmysql/libmysql_rpm_version.in b/libmysql/libmysql_rpm_version.in deleted file mode 100644 index ff0707cdb75..00000000000 --- a/libmysql/libmysql_rpm_version.in +++ /dev/null @@ -1,62 +0,0 @@ -# This version script is heavily inspired by Fedora's and Mageia's version scripts for -# MySQL client shared library. It is used in MariaDB for building RPMs. - -libmysqlclient_16 { - global: -@CLIENT_API_5_1_LIST@ - -# some stuff from Mageia, I have no idea why it is there -# But too afraid to throw anything away - _fini; - _init; - my_init; - my_progname; - myodbc_remove_escape; - -# These are documented in Paul DuBois' MySQL book, so we treat them as part -# of the de-facto API. - free_defaults; - handle_options; - load_defaults; - my_print_help; -# pure-ftpd requires this - my_make_scrambled_password; -# fedora18 export - THR_KEY_mysys; -# hydra requires this - scramble; -# DBD::mysql requires this - is_prefix; - local: - *; -}; - -libmysqlclient_18 { - global: - @CLIENT_API_5_5_LIST@ -# -# Ideally the following symbols wouldn't be exported, but various applications -# require them. Fedora limits the namespace damage by prefixing mysql_ -# (see mysql-dubious-exports.patch), which means the symbols are not present -# in libmysqlclient_16. -# -# MariaDB does not do the Fedora-style function renaming via #define in headers, -# however it exports mysql_ prefixed symbols in addition to the "normal" ones. -# -# To ensure successful recompilation of affected projects, as well as drop-in replacement -# for MySQL libraries, provided by distribution, both original symbols and their mysql_ -# prefixed counterparts have to be exported. - -# mysql-connector-odbc requires these - mysql_default_charset_info; - mysql_get_charset; - mysql_get_charset_by_csname; - mysql_net_realloc; - default_charset_info; - get_charset; - get_charset_by_csname; - net_realloc; -# PHP's mysqli.so requires this (via the ER() macro) - mysql_client_errors; - client_errors; -}; diff --git a/libmysql/libmysql_versions.ld.in b/libmysql/libmysql_versions.ld.in new file mode 100644 index 00000000000..8d97da5b2eb --- /dev/null +++ b/libmysql/libmysql_versions.ld.in @@ -0,0 +1,45 @@ +/* + This version script is heavily inspired by Fedora's and Mageia's version + scripts for MySQL client shared library. + But it was modified to support Debian-compatible versioning too. + + In RedHat universe, symbols from old libmysqlclient.so.16 + keep their libmysqlclient_16 version. New symbols added in + libmysqlclient.so.18 get the new libmysqlclient_18 version. + + In Debian all symbols in libmysqlclient.so.18 have libmysqlclient_18 version, + including symbols that existed in libmysqlclient.so.16 + + We solve this by putting all symbols into libmysqlclient_18 version node, + but creating aliases for old symbols in the libmysqlclient_16 version node. +*/ + +@CLIENT_API_5_1_ALIASES@ + +/* + On Fedora the following symbols are exported, but renamed into a mysql_ + namespace. We export them as aliases, but keep original symbols too. See + MDEV-4127. +*/ +mysql_default_charset_info = default_charset_info; +mysql_get_charset = get_charset; +mysql_get_charset_by_csname = get_charset_by_csname; +mysql_net_realloc = net_realloc; +mysql_client_errors = client_errors; + +VERSION { + +libmysqlclient_18 { + global: +@CLIENT_API_5_1_LIST@ +@CLIENT_API_5_5_LIST@ + + local: + *; +}; + +libmysqlclient_16 { + /* empty here. aliases are added above */ +}; + +} diff --git a/libmysql/rpm_support.cc b/libmysql/rpm_support.cc deleted file mode 100644 index 8c9a1e8683d..00000000000 --- a/libmysql/rpm_support.cc +++ /dev/null @@ -1,41 +0,0 @@ -/* - Provide aliases for several symbols, to support drop-in replacement for - MariaDB on Fedora and several derives distributions. - - These distributions redefine several symbols (in a way that is no compatible - with either MySQL or MariaDB) and export it from the client library ( as seen - e.g from this patch) -http://lists.fedoraproject.org/pipermail/scm-commits/2010-December/537257.html - - MariaDB handles compatibility distribution by providing the same symbols from - the client library if it is built with -DRPM - -*/ -#include -#include -#include -extern "C" { - -CHARSET_INFO *mysql_default_charset_info = default_charset_info; - -CHARSET_INFO *mysql_get_charset(uint cs_number, myf flags) -{ - return get_charset(cs_number, flags); -} - -CHARSET_INFO *mysql_get_charset_by_csname(const char *cs_name, - uint cs_flags, myf my_flags) -{ - return get_charset_by_csname(cs_name, cs_flags, my_flags); -} - - -my_bool mysql_net_realloc(NET *net, size_t length) -{ - return net_realloc(net,length); -} - -const char **mysql_client_errors = client_errors; - -} /*extern "C" */ - diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index 3bcaab597b7..d0c3fafdf69 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -22,8 +22,7 @@ ${CMAKE_SOURCE_DIR}/libmysql ${CMAKE_SOURCE_DIR}/libmysqld ${CMAKE_SOURCE_DIR}/sql ${CMAKE_BINARY_DIR}/sql -${CMAKE_BINARY_DIR}/pcre -${CMAKE_SOURCE_DIR}/pcre +${PCRE_INCLUDES} ${ZLIB_INCLUDE_DIR} ${SSL_INCLUDE_DIRS} ${SSL_INTERNAL_INCLUDE_DIRS} diff --git a/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt index cf23fdc4a6a..d47638ad2f9 100644 --- a/libmysqld/examples/CMakeLists.txt +++ b/libmysqld/examples/CMakeLists.txt @@ -15,8 +15,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/libmysqld/include - ${CMAKE_BINARY_DIR}/pcre - ${CMAKE_SOURCE_DIR}/pcre + ${PCRE_INCLUDES} ${CMAKE_SOURCE_DIR}/sql ${MY_READLINE_INCLUDE_DIR} ) diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 86b3bc6a283..1c043c6d03b 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -332,8 +332,8 @@ static int emb_stmt_execute(MYSQL_STMT *stmt) thd->client_param_count= stmt->param_count; thd->client_params= stmt->params; - res= test(emb_advanced_command(stmt->mysql, COM_STMT_EXECUTE, 0, 0, - header, sizeof(header), 1, stmt) || + res= MY_TEST(emb_advanced_command(stmt->mysql, COM_STMT_EXECUTE, 0, 0, + header, sizeof(header), 1, stmt) || emb_read_query_result(stmt->mysql)); stmt->affected_rows= stmt->mysql->affected_rows; stmt->insert_id= stmt->mysql->insert_id; @@ -566,7 +566,7 @@ int init_embedded_server(int argc, char **argv, char **groups) opt_mysql_tmpdir=getenv("TMP"); #endif if (!opt_mysql_tmpdir || !opt_mysql_tmpdir[0]) - opt_mysql_tmpdir=(char*) DEFAULT_TMPDIR; /* purecov: inspected */ + opt_mysql_tmpdir= const_cast(DEFAULT_TMPDIR); /* purecov: inspected*/ init_ssl(); umask(((~my_umask) & 0666)); diff --git a/libservices/logger_service.c b/libservices/logger_service.c index c45e978413c..615e595c6bc 100644 --- a/libservices/logger_service.c +++ b/libservices/logger_service.c @@ -15,7 +15,6 @@ #include - /* file reserved for the future use */ -SERVICE_VERSION *logger_service= (void *) VERSION_logger; +SERVICE_VERSION logger_service= (void *) VERSION_logger; diff --git a/mysql-test/CMakeLists.txt b/mysql-test/CMakeLists.txt index 16eb2a6f166..2948fb88069 100644 --- a/mysql-test/CMakeLists.txt +++ b/mysql-test/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 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 @@ -74,7 +74,7 @@ ENDIF() IF(WITH_EMBEDDED_SERVER) SET(TEST_EMBEDDED ${MTR_FORCE} --comment=embedded --timer --embedded-server - --skip-rpl --skip-ndbcluster $(EXP)) + --skip-rpl --skip-ndbcluster ${EXP}) ELSE() SET(TEST_EMBEDDED echo "Can not test embedded, not compiled in") ENDIF() diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index e4c839ce705..ff4bc960acb 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -15,6 +15,7 @@ main.wait_timeout @solaris # Bug#11758972 2010-04-26 alik wait_tim rpl.rpl_innodb_bug28430 # Bug#11754425 rpl.rpl_row_sp011 @solaris # Bug#11753919 2011-07-25 sven Several test cases fail on Solaris with error Thread stack overrun +rpl.rpl_spec_variables @solaris # Bug #17337114 2013-08-20 Luis Soares failing on pb2 with timeout for 'CHECK WARNINGS' sys_vars.max_sp_recursion_depth_func @solaris # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun sys_vars.wait_timeout_func # Bug#11750645 2010-04-26 alik wait_timeout_func fails diff --git a/mysql-test/collections/default.weekly b/mysql-test/collections/default.weekly index 40f0548f374..a03e2593cfe 100755 --- a/mysql-test/collections/default.weekly +++ b/mysql-test/collections/default.weekly @@ -5,3 +5,6 @@ perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=eits-tests-innodb-engine --experimental=collections/default.experimental --vardir=var-stmt-eits-tests-innodb-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=innodb --mysqld=--innodb --skip-test-list=collections/disabled-weekly.list perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=eits-rpl-binlog-row-tests-innodb-engine --experimental=collections/default.experimental --vardir=var-binlog-row-eits-tests-innodb-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=innodb --mysqld=--innodb --do-test=rpl --mysqld=--binlog-format=row --skip-test-list=collections/disabled-weekly.list perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=eits-rpl-binlog-mixed-tests-innodb-engine --experimental=collections/default.experimental --vardir=var-binlog-mixed-eits-tests-innodb-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=innodb --mysqld=--innodb --do-test=rpl --mysqld=--binlog-format=mixed --skip-test-list=collections/disabled-weekly.list + +# Run innodb compression tests +perl mysql-test-run.pl --force --debug-server --comment=innodb_compression --vardir=var-innodb-zip --big-test --testcase-timeout=60 --parallel=auto --experimental=collections/default.experimental --suite=innodb_zip diff --git a/mysql-test/extra/rpl_tests/rpl_ddl.test b/mysql-test/extra/rpl_tests/rpl_ddl.test index 3b0348cc29f..32fc10479b8 100644 --- a/mysql-test/extra/rpl_tests/rpl_ddl.test +++ b/mysql-test/extra/rpl_tests/rpl_ddl.test @@ -608,6 +608,7 @@ use test; --echo --echo -------- switch to master ------- connection master; +DROP TEMPORARY TABLE mysqltest1.t22; DROP DATABASE mysqltest1; # mysqltest2 was alreday DROPPED some tests before. DROP DATABASE mysqltest3; diff --git a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc index cea8ac56931..a7ee54658f8 100644 --- a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc +++ b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc @@ -187,10 +187,9 @@ if (`SELECT HEX(@commands) = HEX('configure')`) } # -# Drops tables and synchronizes master and slave. Note that temporary -# tables are not explitcily dropped as they will be dropped while -# closing the connection. +# Drops tables and synchronizes master and slave. # + if (`SELECT HEX(@commands) = HEX('clean')`) { connection master; @@ -207,10 +206,15 @@ if (`SELECT HEX(@commands) = HEX('clean')`) DROP TABLE IF EXISTS nt_error_2; + DROP TEMPORARY TABLE IF EXISTS tt_tmp_xx_1; + DROP TEMPORARY TABLE IF EXISTS nt_tmp_xx_1; + --let $n= $tot_table while ($n) { --eval DROP TABLE IF EXISTS nt_$n + --eval DROP TEMPORARY TABLE IF EXISTS tt_tmp_$n + --eval DROP TEMPORARY TABLE IF EXISTS nt_tmp_$n --dec $n } diff --git a/mysql-test/extra/rpl_tests/rpl_innodb.test b/mysql-test/extra/rpl_tests/rpl_innodb.test index c0ec5299cfd..865c97cf95d 100644 --- a/mysql-test/extra/rpl_tests/rpl_innodb.test +++ b/mysql-test/extra/rpl_tests/rpl_innodb.test @@ -113,7 +113,7 @@ FLUSH LOGS; --echo -------- switch to master -------- connection master; FLUSH LOGS; - +DROP TEMPORARY TABLE IF EXISTS mysqltest1.tmp2; DROP DATABASE mysqltest1; --echo End of 5.1 tests diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test index deff9d653e0..01e8497e4de 100644 --- a/mysql-test/extra/rpl_tests/rpl_log.test +++ b/mysql-test/extra/rpl_tests/rpl_log.test @@ -18,8 +18,12 @@ start slave; --source include/wait_for_slave_to_start.inc let $VERSION=`select version()`; - +# Lets run this test in STRICT MODE (DROP TABLE is not DROP TABLE IF EXISTS) +connection slave; +set @save_slave_ddl_exec_mode=@@global.slave_ddl_exec_mode; +set @@global.slave_ddl_exec_mode=STRICT; connection master; + eval create table t1(n int not null auto_increment primary key)ENGINE=$engine_type; insert into t1 values (NULL); drop table t1; @@ -141,3 +145,5 @@ drop table t1; # End of 4.1 tests sync_slave_with_master; +set @@global.slave_ddl_exec_mode=@save_slave_ddl_exec_mode; +connection master; diff --git a/mysql-test/extra/rpl_tests/rpl_reset_slave.test b/mysql-test/extra/rpl_tests/rpl_reset_slave.test index 17d949a7790..e7a78f36efc 100644 --- a/mysql-test/extra/rpl_tests/rpl_reset_slave.test +++ b/mysql-test/extra/rpl_tests/rpl_reset_slave.test @@ -41,6 +41,9 @@ reset slave; source include/start_slave.inc; sync_with_master; show status like 'slave_open_temp_tables'; +connection master; +drop temporary table if exists t1; +sync_slave_with_master; # #Bug#34654 RESET SLAVE does not clear LAST_IO_Err* diff --git a/mysql-test/extra/rpl_tests/rpl_stop_slave.test b/mysql-test/extra/rpl_tests/rpl_stop_slave.test index b226f4f22f1..0f09faa0301 100644 --- a/mysql-test/extra/rpl_tests/rpl_stop_slave.test +++ b/mysql-test/extra/rpl_tests/rpl_stop_slave.test @@ -59,3 +59,6 @@ source include/wait_for_slave_sql_to_stop.inc; connection slave; START SLAVE SQL_THREAD; source include/wait_for_slave_sql_to_start.inc; + +connection master; +sync_slave_with_master; diff --git a/mysql-test/include/commit.inc b/mysql-test/include/commit.inc index bdb6f48f095..e72ebba8527 100644 --- a/mysql-test/include/commit.inc +++ b/mysql-test/include/commit.inc @@ -751,7 +751,7 @@ call p_verify_status_increment(4, 4, 4, 4); --echo # Sic: no table is created. create table if not exists t2 (a int) select 6 union select 7; --echo # Sic: first commits the statement, and then the transaction. -call p_verify_status_increment(2, 0, 2, 0); +call p_verify_status_increment(0, 0, 0, 0); create table t3 select a from t2; call p_verify_status_increment(2, 0, 4, 4); alter table t3 add column (b int); diff --git a/mysql-test/include/ctype_filesort2.inc b/mysql-test/include/ctype_filesort2.inc index 7b09eb482a5..7b576034136 100644 --- a/mysql-test/include/ctype_filesort2.inc +++ b/mysql-test/include/ctype_filesort2.inc @@ -14,3 +14,12 @@ SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; ALTER TABLE t1 ADD KEY(a); SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; DROP TABLE IF EXISTS t1; +--echo # +--echo # BUG#16691598 - ORDER BY LOWER(COLUMN) PRODUCES +--echo # OUT-OF-ORDER RESULTS +--echo # +CREATE TABLE t1 SELECT ('a a') as n; +INSERT INTO t1 VALUES('a b'); +SELECT * FROM t1 ORDER BY LOWER(n) ASC; +SELECT * FROM t1 ORDER BY LOWER(n) DESC; +DROP TABLE t1; diff --git a/mysql-test/include/have_innodb.combinations b/mysql-test/include/have_innodb.combinations index 3c5cfa7bd5a..f647f15ddb6 100644 --- a/mysql-test/include/have_innodb.combinations +++ b/mysql-test/include/have_innodb.combinations @@ -24,7 +24,7 @@ innodb-sys-foreign innodb-sys-foreign-col innodb-metrics -[innodb] +[xtradb] innodb innodb-cmpmem innodb-trx diff --git a/mysql-test/include/have_metadata_lock_info.inc b/mysql-test/include/have_metadata_lock_info.inc new file mode 100644 index 00000000000..51fae1c62f0 --- /dev/null +++ b/mysql-test/include/have_metadata_lock_info.inc @@ -0,0 +1,4 @@ +if (!`SELECT count(*) FROM information_schema.plugins WHERE + (PLUGIN_STATUS = 'ACTIVE') AND PLUGIN_NAME = 'METADATA_LOCK_INFO'`){ + skip Need archive METADATA_LOCK_INFO plugin; +} diff --git a/mysql-test/include/have_metadata_lock_info.opt b/mysql-test/include/have_metadata_lock_info.opt new file mode 100644 index 00000000000..677c4ec01be --- /dev/null +++ b/mysql-test/include/have_metadata_lock_info.opt @@ -0,0 +1,2 @@ +--loose-metadata-lock-info +--plugin-load-add=$METADATA_LOCK_INFO_SO diff --git a/mysql-test/include/index_merge_ror_cpk.inc b/mysql-test/include/index_merge_ror_cpk.inc index 3912aa34026..df42745b4fc 100644 --- a/mysql-test/include/index_merge_ror_cpk.inc +++ b/mysql-test/include/index_merge_ror_cpk.inc @@ -79,8 +79,11 @@ select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1; # Verify that CPK is always used for index intersection scans # (this is because it is used as a filter, not for retrieval) explain select * from t1 where badkey=1 and key1=10; +set @tmp_index_merge_ror_cpk=@@optimizer_switch; +set optimizer_switch='extended_keys=off'; --replace_column 9 ROWS explain select * from t1 where pk1 < 7500 and key1 = 10; +set optimizer_switch=@tmp_index_merge_ror_cpk; # Verify that keys with 'tails' of PK members are ok. explain select * from t1 where pktail1ok=1 and key1=10; diff --git a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc index 0a5b63b4280..c837eb7a7ad 100644 --- a/mysql-test/include/mix1.inc +++ b/mysql-test/include/mix1.inc @@ -633,7 +633,7 @@ drop table t1; drop table bug29807; --disable_query_log call mtr.add_suppression("InnoDB: Error: table .test...bug29807. does not exist in the InnoDB internal"); -call mtr.add_suppression("InnoDB: Cannot open table test\/bug29807 from"); +call mtr.add_suppression("InnoDB: Cannot open table test/bug29807 from"); --enable_query_log diff --git a/mysql-test/include/mtr_check.sql b/mysql-test/include/mtr_check.sql index de5567e91bd..e34e32ad1a6 100644 --- a/mysql-test/include/mtr_check.sql +++ b/mysql-test/include/mtr_check.sql @@ -1,4 +1,5 @@ --- Copyright (c) 2008, 2011, Oracle and/or its affiliates +-- Copyright (c) 2008, 2013, Oracle and/or its affiliates +-- Copyright (c) 2009, 2013, SkySQL 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 @@ -57,6 +58,16 @@ BEGIN WHERE table_schema='mysql' AND table_name != 'ndb_apply_status' ORDER BY columns_in_mysql; + -- Dump all events, there should be none + SELECT * FROM INFORMATION_SCHEMA.EVENTS; + -- Dump all triggers except mtr internals, there should be none + SELECT * FROM INFORMATION_SCHEMA.TRIGGERS + WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); + -- Dump all created procedures, there should be none + SELECT * FROM INFORMATION_SCHEMA.ROUTINES; + + SHOW STATUS LIKE 'slave_open_temp_tables'; + -- Checksum system tables to make sure they have been properly -- restored after test checksum table @@ -82,5 +93,8 @@ BEGIN -- verify that no plugin changed its disabled/enabled state SELECT * FROM INFORMATION_SCHEMA.PLUGINS; + select * from information_schema.session_variables + where variable_name = 'debug_sync'; + END|| diff --git a/mysql-test/include/save_master_gtid.inc b/mysql-test/include/save_master_gtid.inc new file mode 100644 index 00000000000..4fd0d3266a2 --- /dev/null +++ b/mysql-test/include/save_master_gtid.inc @@ -0,0 +1,28 @@ +# ==== Purpose ==== +# +# Save the current binlog GTID position on the master, to be used +# with include/sync_with_master_gtid.inc. +# +# +# ==== Usage ==== +# +# [--let $rpl_debug= 1] +# --source include/save_master_gtid.inc +# +# Parameters: +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= save_master_gtid.inc +--source include/begin_include_file.inc + +--let $master_pos= `SELECT @@gtid_binlog_pos` + +if ($rpl_debug) +{ + --echo save_master_gtid saved master_pos='$master_pos' +} + +--let $include_filename= save_master_gtid.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/search_pattern_in_file.inc b/mysql-test/include/search_pattern_in_file.inc new file mode 100644 index 00000000000..c047b5bc499 --- /dev/null +++ b/mysql-test/include/search_pattern_in_file.inc @@ -0,0 +1,66 @@ +# Purpose: +# Simple search with Perl for a pattern in some file. +# +# The advantages compared to thinkable auxiliary constructs using the +# mysqltest language and SQL are: +# 1. We do not need a running MySQL server. +# 2. SQL causes "noise" during debugging and increases the size of logs. +# Perl code does not disturb at all. +# +# The environment variables SEARCH_FILE and SEARCH_PATTERN must be set +# before sourcing this routine. +# +# In case of +# - SEARCH_FILE and/or SEARCH_PATTERN is not set +# - SEARCH_FILE cannot be opened +# - SEARCH_FILE does not contain SEARCH_PATTERN +# the test will abort immediate. +# MTR will report something like +# .... +# worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009 +# main.1st [ pass ] 3 +# innodb.innodb_page_size [ fail ] +# Test ended at 2011-11-11 18:15:58 +# +# CURRENT_TEST: innodb.innodb_page_size +# # ERROR: The file '' does not contain the expected pattern +# mysqltest: In included file "./include/search_pattern_in_file.inc": +# included from ./include/search_pattern_in_file.inc at line 36: +# At line 25: command "perl" failed with error 255. my_errno=175 +# +# The result from queries just before the failure was: +# ... +# - saving '' to '' +# main.1st [ pass ] 2 +# +# Typical use case (check invalid server startup options): +# let $error_log= $MYSQLTEST_VARDIR/log/my_restart.err; +# --error 0,1 +# --remove_file $error_log +# let SEARCH_FILE= $error_log; +# # Stop the server +# let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; +# --exec echo "wait" > $restart_file +# --shutdown_server 10 +# --source include/wait_until_disconnected.inc +# +# --error 1 +# --exec $MYSQLD_CMD > $error_log 2>&1 +# # The server restart aborts +# let SEARCH_PATTERN= \[ERROR\] Aborting; +# --source include/search_pattern_in_file.inc +# +# Created: 2011-11-11 mleich +# + +perl; + use strict; + my $search_file= $ENV{'SEARCH_FILE'} or die "SEARCH_FILE not set"; + my $search_pattern= $ENV{'SEARCH_PATTERN'} or die "SEARCH_PATTERN not set"; + open(FILE, "$search_file") or die("Unable to open '$search_file': $!\n"); + read(FILE, my $file_content, 50000, 0); + close(FILE); + if ( not $file_content =~ m{$search_pattern} ) { + die("# ERROR: The file '$search_file' does not contain the expected pattern $search_pattern\n->$file_content<-\n"); + } +EOF diff --git a/mysql-test/include/sync_with_master_gtid.inc b/mysql-test/include/sync_with_master_gtid.inc new file mode 100644 index 00000000000..97ada8eea29 --- /dev/null +++ b/mysql-test/include/sync_with_master_gtid.inc @@ -0,0 +1,48 @@ +# ==== Purpose ==== +# +# Wait until the slave has reached a certain GTID position. +# Similar to --sync_with_master, but using GTID instead of old-style +# binlog file/offset coordinates. +# +# +# ==== Usage ==== +# +# --let $master_pos= `SELECT @@GLOBAL.gtid_binlog_pos` +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/sync_with_master_gtid.inc +# +# Syncs slave to the specified GTID position. +# +# Must be called on the slave. +# +# Parameters: +# $master_pos +# The GTID position to sync to. Typically obtained from +# @@GLOBAL.gtid_binlog_pos on the master. +# +# $slave_timeout +# Timeout in seconds. The default is 2 minutes. +# +# $rpl_debug +# See include/rpl_init.inc + +--let $include_filename= sync_with_master_gtid.inc +--source include/begin_include_file.inc + +let $_slave_timeout= $slave_timeout; +if (!$_slave_timeout) +{ + let $_slave_timeout= 120; +} + +--let $_result= `SELECT master_gtid_wait('$master_pos', $_slave_timeout)` +if ($_result == -1) +{ + --let $_current_gtid_pos= `SELECT @@GLOBAL.gtid_slave_pos` + --echo Timeout in master_gtid_wait('$master_pos', $_slave_timeout), current slave GTID position is: $_current_gtid_pos. + --die Failed to sync with master +} + +--let $include_filename= sync_with_master_gtid.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/type_hrtime.inc b/mysql-test/include/type_hrtime.inc index cd631f25632..5d847d72195 100644 --- a/mysql-test/include/type_hrtime.inc +++ b/mysql-test/include/type_hrtime.inc @@ -1,6 +1,8 @@ --source include/have_innodb.inc +SET timestamp=UNIX_TIMESTAMP('2001-02-03 10:20:30'); + --disable_warnings drop table if exists t1, t2, t3; --enable_warnings @@ -126,3 +128,4 @@ select * from t2; drop view v1; drop table t1, t2; +SET timestamp=DEFAULT; diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc index 007acf77617..f19ca622278 100644 --- a/mysql-test/lib/My/SafeProcess/safe_process.cc +++ b/mysql-test/lib/My/SafeProcess/safe_process.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2008, 2011, Oracle and/or its affiliates +/* Copyright (c) 2008, 2012, 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 diff --git a/mysql-test/lib/My/SysInfo.pm b/mysql-test/lib/My/SysInfo.pm index 36c50ab91d1..4cca116620e 100644 --- a/mysql-test/lib/My/SysInfo.pm +++ b/mysql-test/lib/My/SysInfo.pm @@ -1,6 +1,5 @@ # -*- cperl -*- -# Copyright (c) 2013 MySQL AB, 2008 Sun Microsystems, Inc. -# Use is subject to license terms. +# Copyright (c) 2008, 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 diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index e6bd18fc363..59216f41cff 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -337,15 +337,20 @@ sub parse_disabled { # sub collect_default_suites(@) { - my @dirs = my_find_dir(dirname($::glob_mysql_test_dir), - [ @plugin_suitedirs ], '*'); - for my $d (@dirs) { - next unless -f "$d/suite.pm"; - my $sname= basename($d); + use File::Find; + my @dirs; + find(sub { + push @dirs, [$File::Find::topdir, $File::Find::name] + if -d and -f "$File::Find::name/suite.pm"; + }, my_find_dir(dirname($::glob_mysql_test_dir), \@plugin_suitedirs)); + + for (@dirs) { + my ($plugin_root, $dir) = @$_; + my $sname= substr $dir, 1 + length $plugin_root; # ignore overlays here, otherwise we'd need accurate # duplicate detection with overlay support for the default suite list next if $sname eq 'main' or -d "$::glob_mysql_test_dir/suite/$sname"; - my $s = load_suite_object($sname, $d); + my $s = load_suite_object($sname, $dir); push @_, $sname if $s->is_default(); } return @_; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index b00ddd5f2fc..689320f7cd4 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -174,6 +174,7 @@ my @DEFAULT_SUITES= qw( heap- innodb- innodb_fts- + innodb_zip- maria- multi_source- optimizer_unfixed_bugs- @@ -4265,11 +4266,18 @@ sub run_testcase ($$) { # foreach my $option ($config->options_in_group("ENV")) { - # Save old value to restore it before next time - $old_env{$option->name()}= $ENV{$option->name()}; + my ($name, $val)= ($option->name(), $option->value()); - mtr_verbose($option->name(), "=",$option->value()); - $ENV{$option->name()}= $option->value(); + # Save old value to restore it before next time + $old_env{$name}= $ENV{$name}; + + unless (defined $val) { + mtr_warning("Uninitialized value for ", $name, + ", group [ENV], file ", $current_config_name); + } else { + mtr_verbose($name, "=", $val); + $ENV{$name}= $val; + } } } @@ -6181,6 +6189,13 @@ sub valgrind_arguments { mtr_add_arg($args, "--num-callers=16"); mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir) if -f "$glob_mysql_test_dir/valgrind.supp"; + + # Ensure the jemalloc works with mysqld + if ($mysqld_variables{'version-malloc-library'} ne "system" && + $$exe =~ /mysqld/) + { + mtr_add_arg($args, "--soname-synonyms=somalloc=NONE" ); + } } # Add valgrind options, can be overriden by user @@ -6311,7 +6326,20 @@ sub usage ($) { $0 [ OPTIONS ] [ TESTCASE ] -Options to control what engine/variation to run +Where test case can be specified as: + +testcase[.test] Runs the test case named 'testcase' from all suits +path-to-testcase +[suite.]testcase[,combination] + +Examples: + +alias +main.alias 'main' is the name of the suite for the 't' directory. +rpl.rpl_invoked_features,mix,xtradb_plugin +suite/rpl/t/rpl.rpl_invoked_features + +Options to control what engine/variation to run: embedded-server Use the embedded server, i.e. no mysqld daemons ps-protocol Use the binary protocol between client and server diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index f714e6646de..207f6166fe0 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -1354,7 +1354,7 @@ CREATE TABLE t1 ( id INT(11) NOT NULL, x_param INT(11) DEFAULT NULL, PRIMARY KEY (id) -); +) ENGINE=MYISAM; ALTER TABLE t1 ADD COLUMN IF NOT EXISTS id INT, ADD COLUMN IF NOT EXISTS lol INT AFTER id; Warnings: @@ -1390,6 +1390,77 @@ t1 CREATE TABLE `t1` ( KEY `x_param1` (`x_param`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; +CREATE TABLE t1 ( +id INT(11) NOT NULL, +x_param INT(11) DEFAULT NULL, +PRIMARY KEY (id) +) ENGINE=INNODB; +CREATE TABLE t2 ( +id INT(11) NOT NULL) ENGINE=INNODB; +ALTER TABLE t1 ADD COLUMN IF NOT EXISTS id INT, +ADD COLUMN IF NOT EXISTS lol INT AFTER id; +Warnings: +Note 1060 Duplicate column name 'id' +ALTER TABLE t1 ADD COLUMN IF NOT EXISTS lol INT AFTER id; +Warnings: +Note 1060 Duplicate column name 'lol' +ALTER TABLE t1 DROP COLUMN IF EXISTS lol; +ALTER TABLE t1 DROP COLUMN IF EXISTS lol; +Warnings: +Note 1091 Can't DROP 'lol'; check that column/key exists +ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param); +ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param); +Warnings: +Note 1061 Duplicate key name 'x_param' +ALTER TABLE t1 MODIFY IF EXISTS lol INT; +Warnings: +Note 1054 Unknown column 'lol' in 't1' +DROP INDEX IF EXISTS x_param ON t1; +DROP INDEX IF EXISTS x_param ON t1; +Warnings: +Note 1091 Can't DROP 'x_param'; check that column/key exists +CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param); +CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param); +Warnings: +Note 1061 Duplicate key name 'x_param1' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `x_param` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `x_param1` (`x_param`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t2 ADD FOREIGN KEY IF NOT EXISTS fk(id) REFERENCES t1(id); +ALTER TABLE t2 ADD FOREIGN KEY IF NOT EXISTS fk(id) REFERENCES t1(id); +Warnings: +Note 1061 Duplicate key name 'fk' +ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS fk; +ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS fk; +Warnings: +Note 1091 Can't DROP 'fk'; check that column/key exists +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + KEY `fk` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t2 ADD FOREIGN KEY (id) REFERENCES t1(id); +ALTER TABLE t2 ADD FOREIGN KEY IF NOT EXISTS t2_ibfk_1(id) REFERENCES t1(id); +Warnings: +Note 1061 Duplicate key name 't2_ibfk_1' +ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS t2_ibfk_1; +ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS t2_ibfk_1; +Warnings: +Note 1091 Can't DROP 't2_ibfk_1'; check that column/key exists +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + KEY `id` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; # # Bug#11938817 ALTER BEHAVIOR DIFFERENT THEN DOCUMENTED # diff --git a/mysql-test/r/alter_table_autoinc-5574.result b/mysql-test/r/alter_table_autoinc-5574.result new file mode 100644 index 00000000000..9476313c773 --- /dev/null +++ b/mysql-test/r/alter_table_autoinc-5574.result @@ -0,0 +1,11 @@ +create table t1(a int(10)unsigned not null auto_increment primary key, +b varchar(255) not null) engine=innodb default charset=utf8; +insert into t1 values(1,'aaa'),(2,'bbb'); +alter table t1 auto_increment=1; +insert into t1 values(NULL, 'ccc'); +select * from t1; +a b +1 aaa +2 bbb +3 ccc +drop table t1; diff --git a/mysql-test/r/alter_table_trans.result b/mysql-test/r/alter_table_trans.result index 6e034e47e76..a2547708ada 100644 --- a/mysql-test/r/alter_table_trans.result +++ b/mysql-test/r/alter_table_trans.result @@ -4,3 +4,15 @@ ALTER TABLE t1 RENAME TO t2, DISABLE KEYS; Warnings: Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option DROP TABLE t2; +CREATE TABLE t1 ( +col4 text NOT NULL, +col2 int(11) NOT NULL DEFAULT '0', +col3 int(11) DEFAULT NULL, +extra int(11) DEFAULT NULL, +KEY idx (col4(10)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +insert t1 values (repeat('1', 8193),3,1,1); +insert t1 values (repeat('3', 8193),3,1,1); +ALTER TABLE t1 ADD PRIMARY KEY (col4(10)) , ADD UNIQUE KEY uidx (col3); +ERROR 23000: Duplicate entry '1' for key 'uidx' +DROP TABLE t1; diff --git a/mysql-test/r/assign_key_cache-5405.result b/mysql-test/r/assign_key_cache-5405.result new file mode 100644 index 00000000000..4a0fc58cd4f --- /dev/null +++ b/mysql-test/r/assign_key_cache-5405.result @@ -0,0 +1,14 @@ +create table t1 (f int, key(f)) engine=myisam; +set global kc1.key_buffer_size = 65536; +set debug_sync='assign_key_cache_op_unlock wait_for op_locked'; +cache index t1 in kc1; +set debug_sync='assign_key_cache_op_lock signal op_locked wait_for assigned'; +cache index t1 in kc1; +Table Op Msg_type Msg_text +test.t1 assign_to_keycache status OK +set debug_sync='now signal assigned'; +Table Op Msg_type Msg_text +test.t1 assign_to_keycache status OK +drop table t1; +set global kc1.key_buffer_size = 0; +set debug_sync='reset'; diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result index 5e933914f5d..8ae61881c07 100644 --- a/mysql-test/r/cast.result +++ b/mysql-test/r/cast.result @@ -1,3 +1,4 @@ +SET timestamp=unix_timestamp('2001-02-03 10:20:30'); select CAST(1-2 AS UNSIGNED); CAST(1-2 AS UNSIGNED) 18446744073709551615 @@ -62,7 +63,7 @@ cast(12.444 as double) 12.444 select cast(cast("20:01:01" as time) as datetime); cast(cast("20:01:01" as time) as datetime) -0000-00-00 20:01:01 +2001-02-03 20:01:01 select cast(cast("8:46:06.23434" AS time) as decimal(32,10)); cast(cast("8:46:06.23434" AS time) as decimal(32,10)) 84606.0000000000 @@ -764,7 +765,7 @@ cast(cast("2101-00-01 02:03:04" as datetime) as time) 02:03:04 SELECT CAST(CAST('20:05:05' AS TIME) as date); CAST(CAST('20:05:05' AS TIME) as date) -0000-00-00 +2001-02-03 set sql_mode= TRADITIONAL; select cast("2101-00-01 02:03:04" as datetime); cast("2101-00-01 02:03:04" as datetime) @@ -778,9 +779,7 @@ Warnings: Warning 1292 Incorrect datetime value: '2101-00-01 02:03:04' SELECT CAST(CAST('20:05:05' AS TIME) as date); CAST(CAST('20:05:05' AS TIME) as date) -NULL -Warnings: -Warning 1292 Incorrect datetime value: '20:05:05' +2001-02-03 set sql_mode=DEFAULT; create table t1 (f1 time, f2 date, f3 datetime); insert into t1 values ('11:22:33','2011-12-13','2011-12-13 11:22:33'); @@ -790,9 +789,7 @@ cast(f1 as unsigned) cast(f2 as unsigned) cast(f3 as unsigned) drop table t1; SELECT CAST(TIME('10:20:30') AS DATE) + INTERVAL 1 DAY; CAST(TIME('10:20:30') AS DATE) + INTERVAL 1 DAY -NULL -Warnings: -Warning 1292 Incorrect datetime value: '0000-00-00' +2001-02-04 SET SQL_MODE=ALLOW_INVALID_DATES; SELECT DATE("foo"); DATE("foo") diff --git a/mysql-test/r/comments.result b/mysql-test/r/comments.result index ce817b5012f..c13eb510326 100644 --- a/mysql-test/r/comments.result +++ b/mysql-test/r/comments.result @@ -35,6 +35,12 @@ select 1 /*M!50000 +1 */; select 1 /*M!50300 +1 */; 1 +1 2 +select 2 /*M!99999 +1 */; +2 +1 +3 +select 2 /*M!100000 +1 */; +2 +1 +3 select 2 /*M!999999 +1 */; 2 2 diff --git a/mysql-test/r/commit_1innodb.result b/mysql-test/r/commit_1innodb.result index 3583e8ed396..1e173221b15 100644 --- a/mysql-test/r/commit_1innodb.result +++ b/mysql-test/r/commit_1innodb.result @@ -830,7 +830,7 @@ create table if not exists t2 (a int) select 6 union select 7; Warnings: Note 1050 Table 't2' already exists # Sic: first commits the statement, and then the transaction. -call p_verify_status_increment(2, 0, 2, 0); +call p_verify_status_increment(0, 0, 0, 0); SUCCESS create table t3 select a from t2; diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 7eba25d8ea3..41a2200c13f 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -2602,6 +2602,8 @@ create table t1 (a int, b int) select 2,2; ERROR 42S01: Table 't1' already exists create table t1 like t2; ERROR 42S01: Table 't1' already exists +create or replace table t1 (a int, b int) select 2,2; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction select * from t1; a b 1 1 diff --git a/mysql-test/r/create_or_replace.result b/mysql-test/r/create_or_replace.result new file mode 100644 index 00000000000..8f6ca01d34b --- /dev/null +++ b/mysql-test/r/create_or_replace.result @@ -0,0 +1,362 @@ +drop table if exists t1,t2,t3; +CREATE TABLE t2 (a int); +INSERT INTO t2 VALUES(1),(2),(3); +# +# Check first syntax and wrong usage +# +CREATE OR REPLACE TABLE IF NOT EXISTS t1 (a int); +ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS +create or replace trigger trg before insert on t1 for each row set @a:=1; +ERROR HY000: Incorrect usage of OR REPLACE and TRIGGERS / SP / EVENT +create or replace table mysql.general_log (a int); +ERROR HY000: You cannot 'CREATE OR REPLACE' a log table if logging is enabled +create or replace table mysql.slow_log (a int); +ERROR HY000: You cannot 'CREATE OR REPLACE' a log table if logging is enabled +# +# Usage when table doesn't exist +# +CREATE OR REPLACE TABLE t1 (a int); +CREATE TABLE t1 (a int); +ERROR 42S01: Table 't1' already exists +DROP TABLE t1; +CREATE OR REPLACE TEMPORARY TABLE t1 (a int); +CREATE TEMPORARY TABLE t1 (a int, b int, c int); +ERROR 42S01: Table 't1' already exists +DROP TEMPORARY TABLE t1; +# +# Testing with temporary tables +# +CREATE OR REPLACE TABLE t1 (a int); +CREATE OR REPLACE TEMPORARY TABLE t1 (a int); +CREATE OR REPLACE TEMPORARY TABLE t1 (a int, b int); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TEMPORARY TABLE t1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +create temporary table t1 (i int) engine=InnoDB; +create or replace temporary table t1 (a int, b int) engine=InnoDB; +create or replace temporary table t1 (j int); +show create table t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `j` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +CREATE OR REPLACE TABLE t1 (a int); +LOCK TABLES t1 write; +CREATE OR REPLACE TEMPORARY TABLE t1 (a int); +CREATE OR REPLACE TEMPORARY TABLE t1 (a int, b int); +CREATE OR REPLACE TEMPORARY TABLE t1 (a int, b int) engine= innodb; +CREATE OR REPLACE TEMPORARY TABLE t1 (a int) engine= innodb; +CREATE OR REPLACE TEMPORARY TABLE t1 (a int, b int) engine=myisam; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TEMPORARY TABLE t1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE OR REPLACE TABLE t2 (a int); +ERROR HY000: Table 't2' was not locked with LOCK TABLES +DROP TABLE t1; +UNLOCK TABLES; +CREATE OR REPLACE TEMPORARY TABLE t1 (a int) SELECT * from t2; +SELECT * FROM t1; +a +1 +2 +3 +CREATE OR REPLACE TEMPORARY TABLE t1 (b int) SELECT * from t2; +SELECT * FROM t1; +b a +NULL 1 +NULL 2 +NULL 3 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 AS SELECT a FROM t2; +CREATE TEMPORARY TABLE IF NOT EXISTS t1(a int, b int) SELECT 1,2 FROM t2; +Warnings: +Note 1050 Table 't1' already exists +DROP TABLE t1; +CREATE TABLE t1 (a int); +CREATE OR REPLACE TABLE t1 AS SELECT 1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `1` int(1) NOT NULL DEFAULT '0' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +create table t1 (a int); +create or replace table t1 as select * from t1; +ERROR HY000: Table 't1' is specified twice, both as a target for 'CREATE' and as a separate source for data +create or replace table t1 as select a from (select a from t1) as t3; +ERROR HY000: Table 't1' is specified twice, both as a target for 'CREATE' and as a separate source for data +create or replace table t1 as select a from t2 where t2.a in (select a from t1); +ERROR HY000: Table 't1' is specified twice, both as a target for 'CREATE' and as a separate source for data +drop table t1; +# +# Testing with normal tables +# +CREATE OR REPLACE TABLE t1 (a int); +CREATE OR REPLACE TABLE t1 (a int, b int); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (a int) SELECT * from t2; +SELECT * FROM t1; +a +1 +2 +3 +TRUNCATE TABLE t1; +CREATE TABLE IF NOT EXISTS t1 (a int) SELECT * from t2; +Warnings: +Note 1050 Table 't1' already exists +SELECT * FROM t1; +a +DROP TABLE t1; +CREATE TABLE t1 (i int); +CREATE OR REPLACE TABLE t1 AS SELECT 1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `1` int(1) NOT NULL DEFAULT '0' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a int); +LOCK TABLES t1 write,t2 write; +CREATE OR REPLACE TABLE t1 (a int, b int); +SELECT * FROM t1; +a b +INSERT INTO t1 values(1,1); +CREATE OR REPLACE TABLE t1 (a int, b int, c int); +INSERT INTO t1 values(1,1,1); +CREATE OR REPLACE TABLE t3 (a int); +ERROR HY000: Table 't3' was not locked with LOCK TABLES +UNLOCK TABLES; +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a int); +LOCK TABLES t1 write,t2 write; +CREATE OR REPLACE TABLE t1 (a int, b int) select a,1 from t2; +SELECT * FROM t2; +a +1 +2 +3 +SELECT * FROM t1; +b a 1 +NULL 1 1 +NULL 2 1 +NULL 3 1 +SELECT * FROM t1; +b a 1 +NULL 1 1 +NULL 2 1 +NULL 3 1 +INSERT INTO t1 values(1,1,1); +CREATE OR REPLACE TABLE t1 (a int, b int, c int, d int); +INSERT INTO t1 values(1,1,1,1); +CREATE OR REPLACE TABLE t3 (a int); +ERROR HY000: Table 't3' was not locked with LOCK TABLES +UNLOCK TABLES; +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a int); +LOCK TABLES t1 write,t2 write, t1 as t1_read read; +CREATE OR REPLACE TABLE t1 (a int, b int) select a,1 from t2; +SELECT * FROM t1; +b a 1 +NULL 1 1 +NULL 2 1 +NULL 3 1 +SELECT * FROM t2; +a +1 +2 +3 +SELECT * FROM t1 as t1_read; +ERROR HY000: Table 't1_read' was not locked with LOCK TABLES +DROP TABLE t1; +UNLOCK TABLES; +CREATE OR REPLACE TABLE t1 (a int); +LOCK TABLE t1 WRITE; +CREATE OR REPLACE TABLE t1 AS SELECT 1; +SELECT * from t1; +1 +1 +SELECT * from t2; +ERROR HY000: Table 't2' was not locked with LOCK TABLES +DROP TABLE t1; +# +# Test also with InnoDB (transactional engine) +# +create table t1 (i int) engine=innodb; +lock table t1 write; +create or replace table t1 (j int); +unlock tables; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `j` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 (i int) engine=InnoDB; +lock table t1 write, t2 write; +create or replace table t1 (j int) engine=innodb; +unlock tables; +drop table t1; +create table t1 (i int) engine=InnoDB; +create table t3 (i int) engine=InnoDB; +insert into t3 values(1),(2),(3); +lock table t1 write, t2 write, t3 write; +create or replace table t1 (a int, i int) engine=innodb select t2.a,t3.i from t2,t3; +unlock tables; +select * from t1 order by a,i; +a i +1 1 +1 2 +1 3 +2 1 +2 2 +2 3 +3 1 +3 2 +3 3 +drop table t1,t3; +# +# Testing CREATE .. LIKE +# +create or replace table t1 like t2; +create or replace table t1 like t2; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 (b int); +lock tables t1 write, t2 read; +create or replace table t1 like t2; +SELECT * FROM t1; +a +INSERT INTO t1 values(1); +CREATE OR REPLACE TABLE t1 like t2; +INSERT INTO t1 values(2); +unlock tables; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create or replace table t1 like t2; +create or replace table t1 like t1; +ERROR 42000: Not unique table/alias: 't1' +drop table t1; +CREATE TEMPORARY TABLE t1 like t2; +CREATE OR REPLACE TABLE t1 like t1; +ERROR 42000: Not unique table/alias: 't1' +CREATE OR REPLACE TABLE t1 like t1; +ERROR 42000: Not unique table/alias: 't1' +drop table t1; +CREATE TEMPORARY TABLE t1 like t2; +CREATE OR REPLACE TEMPORARY TABLE t3 like t1; +CREATE OR REPLACE TEMPORARY TABLE t3 like t3; +ERROR 42000: Not unique table/alias: 't3' +drop table t1,t3; +# +# Test with prepared statements +# +prepare stmt1 from 'create or replace table t1 select * from t2'; +execute stmt1; +select * from t1; +a +1 +2 +3 +execute stmt1; +select * from t1; +a +1 +2 +3 +drop table t1; +execute stmt1; +select * from t1; +a +1 +2 +3 +deallocate prepare stmt1; +drop table t1; +# +# Test with views +# +create view t1 as select 1; +create table if not exists t1 (a int); +Warnings: +Note 1050 Table 't1' already exists +create or replace table t1 (a int); +ERROR 42S02: 'test.t1' is a view +drop table t1; +ERROR 42S02: 'test.t1' is a view +drop view t1; +# +# MDEV-5602 CREATE OR REPLACE obtains stricter locks than the +# connection had before +# +create table t1 (a int); +lock table t1 write, t2 read; +select * from information_schema.metadata_lock_info; +THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME +# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock +# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 +# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test +# MDL_SHARED_READ MDL_EXPLICIT Table metadata lock test t2 +create or replace table t1 (i int); +select * from information_schema.metadata_lock_info; +THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME +# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock +# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 +# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test +# MDL_SHARED_READ MDL_EXPLICIT Table metadata lock test t2 +create or replace table t1 like t2; +select * from information_schema.metadata_lock_info; +THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME +# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock +# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 +# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test +# MDL_SHARED_READ MDL_EXPLICIT Table metadata lock test t2 +create or replace table t1 select 1 as f1; +select * from information_schema.metadata_lock_info; +THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME +# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock +# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 +# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test +# MDL_SHARED_READ MDL_EXPLICIT Table metadata lock test t2 +drop table t1; +unlock tables; +DROP TABLE t2; diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result index 6925da6b206..5c75bc098e3 100644 --- a/mysql-test/r/ctype_utf16.result +++ b/mysql-test/r/ctype_utf16.result @@ -671,6 +671,21 @@ FF9D EFBE9D D800DF84 F0908E84 DBC0DC00 F4808080 DROP TABLE IF EXISTS t1; +# +# BUG#16691598 - ORDER BY LOWER(COLUMN) PRODUCES +# OUT-OF-ORDER RESULTS +# +CREATE TABLE t1 SELECT ('a a') as n; +INSERT INTO t1 VALUES('a b'); +SELECT * FROM t1 ORDER BY LOWER(n) ASC; +n +a a +a b +SELECT * FROM t1 ORDER BY LOWER(n) DESC; +n +a b +a a +DROP TABLE t1; select @@collation_connection; @@collation_connection utf16_bin diff --git a/mysql-test/r/ctype_utf16le.result b/mysql-test/r/ctype_utf16le.result index 8f63dda2adc..baf3f4bb0f8 100644 --- a/mysql-test/r/ctype_utf16le.result +++ b/mysql-test/r/ctype_utf16le.result @@ -714,6 +714,21 @@ HEX(a) HEX(CONVERT(a USING utf8mb4)) 00D884DF F0908E84 C0DB00DC F4808080 DROP TABLE IF EXISTS t1; +# +# BUG#16691598 - ORDER BY LOWER(COLUMN) PRODUCES +# OUT-OF-ORDER RESULTS +# +CREATE TABLE t1 SELECT ('a a') as n; +INSERT INTO t1 VALUES('a b'); +SELECT * FROM t1 ORDER BY LOWER(n) ASC; +n +a a +a b +SELECT * FROM t1 ORDER BY LOWER(n) DESC; +n +a b +a a +DROP TABLE t1; select @@collation_connection; @@collation_connection utf16le_bin diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result index e0bede76fb7..b67de4d0051 100644 --- a/mysql-test/r/ctype_utf32.result +++ b/mysql-test/r/ctype_utf32.result @@ -670,6 +670,21 @@ HEX(a) HEX(CONVERT(a USING utf8mb4)) 00010384 F0908E84 00100000 F4808080 DROP TABLE IF EXISTS t1; +# +# BUG#16691598 - ORDER BY LOWER(COLUMN) PRODUCES +# OUT-OF-ORDER RESULTS +# +CREATE TABLE t1 SELECT ('a a') as n; +INSERT INTO t1 VALUES('a b'); +SELECT * FROM t1 ORDER BY LOWER(n) ASC; +n +a a +a b +SELECT * FROM t1 ORDER BY LOWER(n) DESC; +n +a b +a a +DROP TABLE t1; select @@collation_connection; @@collation_connection utf32_bin diff --git a/mysql-test/r/ctype_utf8mb4.result b/mysql-test/r/ctype_utf8mb4.result index 73ceae39295..55d5c6eed86 100644 --- a/mysql-test/r/ctype_utf8mb4.result +++ b/mysql-test/r/ctype_utf8mb4.result @@ -1149,6 +1149,21 @@ EFBE9D EFBE9D F0908E84 F0908E84 F4808080 F4808080 DROP TABLE IF EXISTS t1; +# +# BUG#16691598 - ORDER BY LOWER(COLUMN) PRODUCES +# OUT-OF-ORDER RESULTS +# +CREATE TABLE t1 SELECT ('a a') as n; +INSERT INTO t1 VALUES('a b'); +SELECT * FROM t1 ORDER BY LOWER(n) ASC; +n +a a +a b +SELECT * FROM t1 ORDER BY LOWER(n) DESC; +n +a b +a a +DROP TABLE t1; select @@collation_connection; @@collation_connection utf8mb4_bin diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index 699d3279e3e..3a3b69f1fc7 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -479,6 +479,28 @@ SELECT * FROM WHERE tmp.a; a b 100 200 +# +# MDEV-5356: Server crashes in Item_equal::contains on 2nd +# execution of a PS +# +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,2),(3,4); +CREATE TABLE t2 (c INT); +INSERT INTO t2 VALUES (5),(6); +CREATE TABLE t3 (d INT); +INSERT INTO t3 VALUES (7),(8); +CREATE PROCEDURE pr() +UPDATE t3, +(SELECT c FROM +(SELECT 1 FROM t1 WHERE a=72 AND NOT b) sq, +t2 +) sq2 +SET d=sq2.c; +CALL pr(); +CALL pr(); +CALL pr(); +drop procedure pr; +drop table t1,t2,t3; # End of 5.3 tests # # Bug#58730 Assertion failed: table->key_read == 0 in close_thread_table, diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result index 2b041448d3b..80d2d64dced 100644 --- a/mysql-test/r/derived_view.result +++ b/mysql-test/r/derived_view.result @@ -2253,9 +2253,118 @@ EXPLAIN EXTENDED SELECT a FROM v1 WHERE a > 100 ORDER BY b; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select 4 AS `a` from dual where (4 > 100) order by 1 +Note 1003 select 4 AS `a` from dual where 0 order by 1 DROP VIEW v1; DROP TABLE t1; +CREATE TABLE IF NOT EXISTS `galleries` ( +`id` int(11) NOT NULL AUTO_INCREMENT, +`name` varchar(100) NOT NULL, +`year` int(11) DEFAULT NULL, +PRIMARY KEY (`id`), +UNIQUE KEY `name` (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +Warnings: +Warning 1286 Unknown storage engine 'InnoDB' +Warning 1266 Using storage engine MyISAM for table 'galleries' +CREATE TABLE IF NOT EXISTS `pictures` ( +`id` int(11) NOT NULL AUTO_INCREMENT, +`name` varchar(100) NOT NULL, +`width` float DEFAULT NULL, +`height` float DEFAULT NULL, +`year` int(4) DEFAULT NULL, +`technique` varchar(50) DEFAULT NULL, +`comment` varchar(2000) DEFAULT NULL, +`gallery_id` int(11) NOT NULL, +`type` int(11) NOT NULL, +PRIMARY KEY (`id`), +KEY `gallery_id` (`gallery_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +Warnings: +Warning 1286 Unknown storage engine 'InnoDB' +Warning 1266 Using storage engine MyISAM for table 'pictures' +ALTER TABLE `pictures` +ADD CONSTRAINT `pictures_ibfk_1` FOREIGN KEY (`gallery_id`) REFERENCES `galleries` (`id`); +INSERT INTO `galleries` (`id`, `name`, `year`) VALUES +(1, 'Quand le noir et blanc invite le taupe', 2013), +(2, 'Une touche de couleur', 2012), +(3, 'Éclats', 2011), +(4, 'Gris béton', 2010), +(5, 'Expression du spalter', 2010), +(6, 'Zénitude', 2009), +(7, 'La force du rouge', 2008), +(8, 'Sphères', NULL), +(9, 'Centre', 2009), +(10, 'Nébuleuse', NULL); +INSERT INTO `pictures` (`id`, `name`, `width`, `height`, `year`, `technique`, `comment`, `gallery_id`, `type`) VALUES +(1, 'Éclaircie', 72.5, 100, NULL, NULL, NULL, 1, 1), +(2, 'Architecture', 81, 100, NULL, NULL, NULL, 1, 1), +(3, 'Nouveau souffle', 72.5, 100, NULL, NULL, NULL, 1, 1), +(4, 'Échanges (2)', 89, 116, NULL, NULL, NULL, 1, 1), +(5, 'Échanges', 89, 116, NULL, NULL, NULL, 1, 1), +(6, 'Fenêtre de vie', 81, 116, NULL, NULL, NULL, 1, 1), +(7, 'Architecture', 81, 100, NULL, NULL, NULL, 1, 1), +(8, 'Nouveau souffle (2)', 72.5, 100, NULL, NULL, NULL, 1, 1), +(9, 'Fluidité', 89, 116, NULL, NULL, NULL, 1, 1), +(10, 'Nouveau Monde', 89, 125, NULL, NULL, NULL, 1, 1), +(11, 'Mirage', 73, 100, NULL, NULL, NULL, 1, 1), +(12, 'Équilibre', 72.5, 116, NULL, NULL, NULL, 2, 1), +(13, 'Fusion', 72.5, 116, NULL, NULL, NULL, 2, 1), +(14, 'Étincelles', NULL, NULL, NULL, NULL, NULL, 3, 1), +(15, 'Régénérescence', NULL, NULL, NULL, NULL, NULL, 3, 1), +(16, 'Chaleur', 80, 80, NULL, NULL, NULL, 4, 1), +(17, 'Création', 90, 90, NULL, NULL, NULL, 4, 1), +(18, 'Horizon', 92, 73, NULL, NULL, NULL, 4, 1), +(19, 'Labyrinthe', 81, 100, NULL, NULL, NULL, 4, 1), +(20, 'Miroir', 80, 116, NULL, NULL, NULL, 5, 1), +(21, 'Libération', 81, 116, NULL, NULL, NULL, 5, 1), +(22, 'Éclats', 81, 116, NULL, NULL, NULL, 5, 1), +(23, 'Zénitude', 116, 89, NULL, NULL, NULL, 6, 1), +(24, 'Écritures lointaines', 90, 90, NULL, NULL, NULL, 7, 1), +(25, 'Émergence', 80, 80, NULL, NULL, NULL, 7, 1), +(26, 'Liberté', 50, 50, NULL, NULL, NULL, 7, 1), +(27, 'Silhouettes amérindiennes', 701, 70, NULL, NULL, NULL, 7, 1), +(28, 'Puissance', 81, 100, NULL, NULL, NULL, 8, 1), +(29, 'Source', 73, 116, NULL, NULL, NULL, 8, 1), +(30, 'Comme une ville qui prend vie', 50, 100, 2008, NULL, NULL, 9, 1), +(31, 'Suspension azur', 80, 80, NULL, NULL, NULL, 9, 1), +(32, 'Nébuleuse', 70, 70, NULL, NULL, NULL, 10, 1), +(33, 'Œuvre commandée 120 P', 114, 195, NULL, NULL, NULL, 1, 2), +(34, 'Œuvre commandée 120 P', 114, 195, NULL, NULL, NULL, 1, 2), +(35, 'Œuvre commandée 120 P', 114, 195, NULL, NULL, NULL, 1, 2), +(36, 'Œuvre commandée 120 P', 114, 195, NULL, NULL, NULL, 1, 2), +(37, 'Œuvre commandée 120 P', 114, 195, NULL, NULL, NULL, 1, 2), +(38, 'Œuvre commandée 120 P', 114, 195, NULL, NULL, NULL, 1, 2); +explain +SELECT g.id AS gallery_id, +g.name AS gallery_name, +p.id AS picture_id, +p.name AS picture_name, +g.p_random AS r1, +g.p_random AS r2, +g.p_random AS r3 +FROM +( +SELECT gal.id, +gal.name, +( +SELECT pi.id +FROM pictures pi +WHERE pi.gallery_id = gal.id +ORDER BY RAND() +LIMIT 1 +) AS p_random +FROM galleries gal +) g +LEFT JOIN pictures p +ON p.id = g.p_random +ORDER BY gallery_name ASC +; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 2 Using filesort +1 PRIMARY p eq_ref PRIMARY PRIMARY 4 g.p_random 1 Using where +2 DERIVED gal ALL NULL NULL NULL NULL 10 +3 DEPENDENT SUBQUERY pi ref gallery_id gallery_id 4 test.gal.id 4 Using temporary; Using filesort +drop table galleries, pictures; # # end of 5.3 tests # diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index 019099bde14..6f68483f684 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -999,4 +999,44 @@ c 11112222 33334444 DROP TABLE t1; +# +# Bug#16539979 BASIC SELECT COUNT(DISTINCT ID) IS BROKEN. +# Bug#17867117 ERROR RESULT WHEN "COUNT + DISTINCT + CASE WHEN" NEED MERGE_WALK +# +SET @tmp_table_size_save= @@tmp_table_size; +SET @@tmp_table_size= 1024; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8); +INSERT INTO t1 SELECT a+8 FROM t1; +INSERT INTO t1 SELECT a+16 FROM t1; +INSERT INTO t1 SELECT a+32 FROM t1; +INSERT INTO t1 SELECT a+64 FROM t1; +INSERT INTO t1 VALUE(NULL); +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +128 +SELECT COUNT(DISTINCT (a+0)) FROM t1; +COUNT(DISTINCT (a+0)) +128 +DROP TABLE t1; +create table tb( +id int auto_increment primary key, +v varchar(32)) +engine=myisam charset=gbk; +insert into tb(v) values("aaa"); +insert into tb(v) (select v from tb); +insert into tb(v) (select v from tb); +insert into tb(v) (select v from tb); +insert into tb(v) (select v from tb); +insert into tb(v) (select v from tb); +insert into tb(v) (select v from tb); +update tb set v=concat(v, id); +select count(distinct case when id<=64 then id end) from tb; +count(distinct case when id<=64 then id end) +64 +select count(distinct case when id<=63 then id end) from tb; +count(distinct case when id<=63 then id end) +63 +drop table tb; +SET @@tmp_table_size= @tmp_table_size_save; End of 5.5 tests diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result index efe519fe3f9..ca2130cd700 100644 --- a/mysql-test/r/dyncol.result +++ b/mysql-test/r/dyncol.result @@ -697,14 +697,14 @@ column_get(column_create(1, 0), 1 as datetime) select column_get(column_create(1, "2001021"), 1 as datetime); column_get(column_create(1, "2001021"), 1 as datetime) 2020-01-02 01:00:00 +SET timestamp=unix_timestamp('2001-02-03 10:20:30'); select column_get(column_create(1, "8:46:06.23434" AS time), 1 as datetime); column_get(column_create(1, "8:46:06.23434" AS time), 1 as datetime) -0000-00-00 08:46:06 +2001-02-03 08:46:06 select column_get(column_create(1, "-808:46:06.23434" AS time), 1 as datetime); column_get(column_create(1, "-808:46:06.23434" AS time), 1 as datetime) -NULL -Warnings: -Warning 1292 Truncated incorrect datetime value: '-808:46:06' +2000-12-31 07:13:53 +SET timestamp=DEFAULT; set @@sql_mode="allow_invalid_dates"; select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as datetime); column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as datetime) diff --git a/mysql-test/r/error_simulation.result b/mysql-test/r/error_simulation.result index 88a9d114bc6..006c51d1880 100644 --- a/mysql-test/r/error_simulation.result +++ b/mysql-test/r/error_simulation.result @@ -94,7 +94,7 @@ INSERT INTO t1 VALUES (1),(2); INSERT INTO t2 VALUES (1),(2); SET SESSION debug_dbug="+d,bug11747970_raise_error"; INSERT IGNORE INTO t2 SELECT f1 FROM t1 a WHERE NOT EXISTS (SELECT 1 FROM t2 b WHERE a.f1 = b.f1); -ERROR HY000: Unknown error +ERROR 70100: Query execution was interrupted SET SESSION debug_dbug = DEFAULT; DROP TABLE t1,t2; # diff --git a/mysql-test/r/events_trans.result b/mysql-test/r/events_trans.result index 37951c30787..084587079ba 100644 --- a/mysql-test/r/events_trans.result +++ b/mysql-test/r/events_trans.result @@ -135,3 +135,4 @@ SELECT * FROM t2; a ROLLBACK WORK TO SAVEPOINT A; DROP TABLE t1, t2; +DROP EVENT e1; diff --git a/mysql-test/r/flush-innodb-notembedded.result b/mysql-test/r/flush-innodb-notembedded.result new file mode 100644 index 00000000000..817d57d9d79 --- /dev/null +++ b/mysql-test/r/flush-innodb-notembedded.result @@ -0,0 +1,34 @@ +# Test 7: Check privileges required. +# +CREATE DATABASE db1; +CREATE TABLE db1.t1 (a INT) engine= InnoDB; +GRANT RELOAD, SELECT, LOCK TABLES ON *.* TO user1@localhost; +GRANT CREATE, DROP ON *.* TO user2@localhost; +GRANT RELOAD, SELECT ON *.* TO user3@localhost; +GRANT SELECT, LOCK TABLES ON *.* TO user4@localhost; +GRANT RELOAD, LOCK TABLES ON *.* TO user5@localhost; +# Connection con1 as user1 +FLUSH TABLE db1.t1 FOR EXPORT; +UNLOCK TABLES; +# Connection default +# Connection con1 as user2 +FLUSH TABLE db1.t1 FOR EXPORT; +ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation +# Connection default +# Connection con1 as user3 +FLUSH TABLE db1.t1 FOR EXPORT; +ERROR 42000: Access denied for user 'user3'@'localhost' to database 'db1' +# Connection default +# Connection con1 as user4 +FLUSH TABLE db1.t1 FOR EXPORT; +ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation +# Connection default +# Connection con1 as user5 +FLUSH TABLE db1.t1 FOR EXPORT; +ERROR 42000: SELECT command denied to user 'user5'@'localhost' for table 't1' +# Connection default +DROP USER user1@localhost, user2@localhost, user3@localhost, +user4@localhost, user5@localhost; +DROP TABLE db1.t1; +DROP DATABASE db1; +# End of 5.6 tests diff --git a/mysql-test/r/flush-innodb.result b/mysql-test/r/flush-innodb.result index cea4f81e2a2..6a97d33225e 100644 --- a/mysql-test/r/flush-innodb.result +++ b/mysql-test/r/flush-innodb.result @@ -3,3 +3,297 @@ UNLOCK TABLES; CREATE TABLE t1 ( m MEDIUMTEXT ) ENGINE=InnoDB; INSERT INTO t1 VALUES ( REPEAT('i',1048576) ); DROP TABLE t1; + +# +# WL#6168: FLUSH TABLES ... FOR EXPORT -- parser +# + +# Requires innodb_file_per_table +SET @old_innodb_file_per_table= @@GLOBAL.innodb_file_per_table; +SET GLOBAL innodb_file_per_table= 1; +# new "EXPORT" keyword is a valid user variable name: +SET @export = 10; +# new "EXPORT" keyword is a valid SP parameter name: +CREATE PROCEDURE p1(export INT) BEGIN END; +DROP PROCEDURE p1; +# new "EXPORT" keyword is a valid local variable name: +CREATE PROCEDURE p1() +BEGIN +DECLARE export INT; +END| +DROP PROCEDURE p1; +# new "EXPORT" keyword is a valid SP name: +CREATE PROCEDURE export() BEGIN END; +DROP PROCEDURE export; +# new FLUSH TABLES ... FOR EXPORT syntax: +FLUSH TABLES FOR EXPORT; +ERROR 42000: No tables used near 'FOR EXPORT' at line 1 +FLUSH TABLES WITH EXPORT; +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 'EXPORT' at line 1 +CREATE TABLE t1 (i INT) engine=InnoDB; +CREATE TABLE t2 LIKE t1; +FLUSH TABLES t1,t2 WITH EXPORT; +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 'EXPORT' at line 1 +FLUSH TABLES t1, t2 FOR EXPORT; +UNLOCK TABLES; +# case check +FLUSH TABLES t1, t2 for ExPoRt; +UNLOCK TABLES; +# With LOCAL keyword +FLUSH LOCAL TABLES t1, t2 FOR EXPORT; +UNLOCK TABLES; +# Tables with fully qualified names +FLUSH LOCAL TABLES test.t1, test.t2 for ExPoRt; +UNLOCK TABLES; +DROP TABLES t1, t2; +# new "EXPORT" keyword is a valid table name: +CREATE TABLE export (i INT) engine=InnoDB; +# it's ok to lock the "export" table for export: +FLUSH TABLE export FOR EXPORT; +UNLOCK TABLES; +DROP TABLE export; +# +# WL#6169 FLUSH TABLES ... FOR EXPORT -- runtime +# +# Test 1: Views, temporary tables, non-existent tables +# +CREATE VIEW v1 AS SELECT 1; +CREATE TEMPORARY TABLE t1 (a INT); +FLUSH TABLES v1 FOR EXPORT; +ERROR HY000: 'test.v1' is not BASE TABLE +FLUSH TABLES t1 FOR EXPORT; +ERROR 42S02: Table 'test.t1' doesn't exist +FLUSH TABLES non_existent FOR EXPORT; +ERROR 42S02: Table 'test.non_existent' doesn't exist +DROP TEMPORARY TABLE t1; +DROP VIEW v1; +# Test 2: Blocked by update transactions, blocks updates. +# +CREATE TABLE t1 (a INT PRIMARY KEY, b INT) engine= InnoDB; +CREATE TABLE t2 (a INT) engine= InnoDB; +# Connection con1 +START TRANSACTION; +INSERT INTO t1 VALUES (1, 1); +# Connection default +# Should be blocked +# Sending: +FLUSH TABLES t1 FOR EXPORT; +# Connection con1 +COMMIT; +# Connection default +# Reaping: FLUSH TABLES t1 FOR EXPORT +# Connection con1 +# Should not be blocked +INSERT INTO t2 VALUES (1); +# Should be blocked +# Sending: +INSERT INTO t1 VALUES (2, 2); +# Connection default +UNLOCK TABLES; +# Connection con1 +# Reaping: INSERT INTO t1 VALUES (2, 2); +# Test 3: Read operations should not be affected. +# +START TRANSACTION; +SELECT * FROM t1; +a b +1 1 +2 2 +# Connection default +# Should not be blocked +FLUSH TABLES t1 FOR EXPORT; +# Connection con1 +COMMIT; +# Should not be blocked +SELECT * FROM t1; +a b +1 1 +2 2 +# Connection default +UNLOCK TABLES; +# Test 4: Blocked by DDL, blocks DDL. +# +START TRANSACTION; +SELECT * FROM t1; +a b +1 1 +2 2 +# Connection con2 +# Sending: +ALTER TABLE t1 ADD INDEX i1(b); +# Connection con1 +# Should be blocked +FLUSH TABLE t1 FOR EXPORT; +# Connection default +COMMIT; +# Connection con2 +# Reaping ALTER TABLE ... +# Connection con1 +# Reaping FLUSH TABLE t1 FOR EXPORT +UNLOCK TABLES; +# Connection default +FLUSH TABLE t1 FOR EXPORT; +# Connection con2 +# Should be blocked +DROP TABLE t1; +# Connection default +UNLOCK TABLES; +# Connection con2 +# Reaping DROP TABLE t1 +# Connection default +DROP TABLE t2; +# Test 5: Compatibilty with FLUSH TABLES WITH READ LOCK +# +CREATE TABLE t1(a INT) engine= InnoDB; +FLUSH TABLES WITH READ LOCK; +# Connection con1 +# This should not block +FLUSH TABLE t1 FOR EXPORT; +UNLOCK TABLES; +# Connection default +UNLOCK TABLES; +DROP TABLE t1; +# Test 6: Unsupported storage engines. +# +CREATE TABLE t1(a INT) engine= MEMORY; +FLUSH TABLE t1 FOR EXPORT; +ERROR HY000: Storage engine MEMORY of the table `test`.`t1` doesn't have this option +DROP TABLE t1; +# Connection con1 +# Connection defalt +# Test 7: Check privileges required. +# in flush-innodb-notembedded.test +# Test 8: FLUSH TABLE FOR EXPORT is incompatible +# with itself (to avoid race conditions in metadata +# file handling). +# +CREATE TABLE t1 (a INT) engine= InnoDB; +CREATE TABLE t2 (a INT) engine= InnoDB; +# Connection con1 +FLUSH TABLE t1 FOR EXPORT; +# Connection default +# This should not block +FLUSH TABLE t2 FOR EXPORT; +UNLOCK TABLES; +# This should block +# Sending: +FLUSH TABLE t1 FOR EXPORT; +# Connection con1 +UNLOCK TABLES; +# Connection default +# Reaping: FLUSH TABLE t1 FOR EXPORT +UNLOCK TABLES; +# Test 9: LOCK TABLES ... READ is not affected +# +LOCK TABLE t1 READ; +# Connection con1 +# Should not block +FLUSH TABLE t1 FOR EXPORT; +UNLOCK TABLES; +# Connection default +UNLOCK TABLES; +FLUSH TABLE t1 FOR EXPORT; +# Connection con1 +# Should not block +LOCK TABLE t1 READ; +UNLOCK TABLES; +# Connection default +UNLOCK TABLES; +# Connection con1 +# Connection default +DROP TABLE t1, t2; +# Test 10: Lock is released if transaction is started after doing +# 'flush table..' in same session +CREATE TABLE t1 ( i INT ) ENGINE = Innodb; +FLUSH TABLE t1 FOR EXPORT; +# error as active locks already exist +FLUSH TABLE t1 FOR EXPORT; +ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction +# active locks will be released due to start transaction +START TRANSACTION; +# passes as start transaction released ealier locks +FLUSH TABLE t1 FOR EXPORT; +UNLOCK TABLES; +DROP TABLE t1; +# Test 11: Test 'flush table with fully qualified table names +# and with syntax local/NO_WRITE_TO_BINLOG +# Connection con1 +# Connection default +CREATE TABLE t1 ( i INT ) ENGINE = Innodb; +INSERT INTO t1 VALUES (100),(200); +FLUSH LOCAL TABLES test.t1 FOR EXPORT; +# Connection con1 +# Should be blocked +# Sending: +FLUSH LOCAL TABLES t1 FOR EXPORT; +# Connection default +UNLOCK TABLE; +# Connection con1 +# Reaping: FLUSH LOCAL TABLES t1 FOR EXPORT +SELECT * FROM t1 ORDER BY i; +i +100 +200 +# Connection default +# Should be blocked +# Sending: +FLUSH NO_WRITE_TO_BINLOG TABLES test.t1 FOR EXPORT; +# Connection con1 +UNLOCK TABLES; +# Connection default +# Reaping: FLUSH NO_WRITE_TO_BINLOG TABLES test.t1 FOR EXPORT +SELECT * FROM t1 ORDER BY i; +i +100 +200 +UNLOCK TABLE; +DROP TABLE t1; +# Test 12: Active transaction get committed if user execute +# "FLUSH TABLE ... FOR EXPORT" or "LOCK TABLE.." +# Connection default +CREATE TABLE t1 ( i INT ) ENGINE = Innodb; +INSERT INTO t1 VALUES (100),(200); +START TRANSACTION; +INSERT INTO t1 VALUES (300); +# 'flush table..' commit active transaction from same session +FLUSH LOCAL TABLES test.t1 FOR EXPORT; +ROLLBACK; +SELECT * FROM t1 ORDER BY i; +i +100 +200 +300 +START TRANSACTION; +INSERT INTO t1 VALUES (400); +# 'lock table ..' commit active transaction from same session +LOCK TABLES test.t1 READ; +ROLLBACK; +SELECT * FROM t1 ORDER BY i; +i +100 +200 +300 +400 +UNLOCK TABLES; +DROP TABLE t1; +# Test 13: Verify "FLUSH TABLE ... FOR EXPORT" and "LOCK TABLE.." +# in same session +# Connection default +CREATE TABLE t1 ( i INT ) ENGINE = Innodb; +# Lock table +LOCK TABLES test.t1 WRITE; +# 'lock table ..' completes even if table lock is acquired +# in same session using 'lock table'. Previous locks are released. +LOCK TABLES test.t1 READ; +# 'flush table ..' gives error if table lock is acquired +# in same session using 'lock table ..' +FLUSH TABLES test.t1 FOR EXPORT; +ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction +# 'lock table ..' completes even if table lock is acquired +# in same session using 'flush table'. Previous locks are released. +LOCK TABLES test.t1 WRITE; +UNLOCK TABLES; +DROP TABLE t1; +# Reset innodb_file_per_table +SET GLOBAL innodb_file_per_table= @old_innodb_file_per_table; +# End of 5.6 tests diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result index c2f1e5bf273..011dec4d555 100644 --- a/mysql-test/r/func_compress.result +++ b/mysql-test/r/func_compress.result @@ -102,7 +102,6 @@ a foo Warnings: Warning 1259 ZLIB: Input data corrupted -Warning 1259 ZLIB: Input data corrupted explain select *, uncompress(a) from t1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 8e50c045775..8e2bdeae93c 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -1458,6 +1458,8 @@ DROP TABLE derived1; DROP TABLE D; CREATE TABLE t1 (a INT, b INT); INSERT INTO t1 VALUES (1,1), (1,2), (1,3); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (3),(4); SET SQL_MODE='ONLY_FULL_GROUP_BY'; SELECT COUNT(*) FROM t1; COUNT(*) @@ -1473,12 +1475,19 @@ COUNT(*) SELECT COUNT(*), (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a) FROM t1 outr; ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT COUNT(*) FROM t1 outr, (SELECT b, count(*) FROM t2) as t3; +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT COUNT(*) FROM t1 outr where (1,1) in (SELECT a, count(*) FROM t2); +COUNT(*) +0 SELECT COUNT(*) FROM t1 a JOIN t1 outr ON a.a= (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a); COUNT(*) 0 +SELECT * FROM (SELECT a FROM t1 GROUP BY a) sq JOIN t2 ON a = b; +a b SET SQL_MODE=default; -DROP TABLE t1; +DROP TABLE t1,t2; End of 5.0 tests # # BUG#47280 - strange results from count(*) with order by multiple diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result index a033c91bc05..1d1300a96db 100644 --- a/mysql-test/r/func_misc.result +++ b/mysql-test/r/func_misc.result @@ -264,6 +264,13 @@ INET_NTOA(0) SELECT '1' IN ('1', INET_NTOA(0)); '1' IN ('1', INET_NTOA(0)) 1 +SELECT NAME_CONST('a', -(1 OR 2)) OR 1; +ERROR HY000: Incorrect arguments to NAME_CONST +SELECT NAME_CONST('a', -(1 AND 2)) AND 1; +ERROR HY000: Incorrect arguments to NAME_CONST +SELECT NAME_CONST('a', -(1)) OR 1; +NAME_CONST('a', -(1)) OR 1 +1 # # Bug #52165: Assertion failed: file .\dtoa.c, line 465 # @@ -561,6 +568,3 @@ ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa # # End of 5.5 tests # -# -# End of tests -# diff --git a/mysql-test/r/func_regexp.result b/mysql-test/r/func_regexp.result index 78b8e5d908a..f405a2297cb 100644 --- a/mysql-test/r/func_regexp.result +++ b/mysql-test/r/func_regexp.result @@ -52,7 +52,7 @@ explain extended select * from t1 where xxx regexp('is a test of some long text id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 Warnings: -Note 1003 select 'this is a test of some long text to see what happens' AS `xxx` from dual where ('this is a test of some long text to see what happens' regexp 'is a test of some long text to') +Note 1003 select 'this is a test of some long text to see what happens' AS `xxx` from dual where 1 select * from t1 where xxx regexp('is a test of some long text to '); xxx this is a test of some long text to see what happens diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index a5280f13ada..c9d7b6636c4 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -1153,7 +1153,6 @@ str num notnumber 0 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'notnumber' -Warning 1292 Truncated incorrect DOUBLE value: 'notnumber' SELECT * FROM t1, t2 WHERE num=substring(str from 1 for 6); str num notnumber 0 diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 5b8c09cb32e..a548d5c18f1 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1719,6 +1719,8 @@ create table t1(a time); insert into t1 values ('00:00:00'),('00:01:00'); select 1 from t1 where 1 < some (select cast(a as datetime) from t1); 1 +1 +1 drop table t1; select time('10:10:10') > 10; time('10:10:10') > 10 @@ -1853,9 +1855,11 @@ Warnings: Warning 1292 Incorrect datetime value: '0' Warning 1292 Incorrect datetime value: '0' drop table t1; +SET timestamp=unix_timestamp('2001-02-03 10:20:30'); select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow'); convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow') NULL +SET timestamp=DEFAULT; create table t1 (f1 integer, f2 date); insert into t1 values (1,'2011-05-05'),(2,'2011-05-05'),(3,'2011-05-05'),(4,'2011-05-05'),(5,'2011-05-05'),(6, '2011-05-06'); select * from t1 where 1 and concat(f2)=MAKEDATE(2011, 125); @@ -2330,6 +2334,7 @@ SELECT * FROM t1; TIMESTAMP('2001-01-01 00:00:00','10:10:10') TIMESTAMP('2001-01-01 00:00:00.1','10:10:10') TIMESTAMP('2001-01-01 00:00:00.12','10:10:10') TIMESTAMP('2001-01-01 00:00:00.123','10:10:10') TIMESTAMP('2001-01-01 00:00:00.1234','10:10:10') TIMESTAMP('2001-01-01 00:00:00.12345','10:10:10') TIMESTAMP('2001-01-01 00:00:00.123456','10:10:10') TIMESTAMP('2001-01-01 00:00:00.1234567','10:10:10') 2001-01-01 10:10:10 2001-01-01 10:10:10.1 2001-01-01 10:10:10.12 2001-01-01 10:10:10.123 2001-01-01 10:10:10.1234 2001-01-01 10:10:10.12345 2001-01-01 10:10:10.123456 2001-01-01 10:10:10.123456 DROP TABLE t1; +SET timestamp=unix_timestamp('2001-02-03 10:20:30'); CREATE TABLE t1 AS SELECT TIMESTAMP('00:00:00','10:10:10'), TIMESTAMP(TIME('00:00:00'),'10:10:10'); @@ -2339,8 +2344,9 @@ TIMESTAMP('00:00:00','10:10:10') datetime YES NULL TIMESTAMP(TIME('00:00:00'),'10:10:10') datetime YES NULL SELECT * FROM t1; TIMESTAMP('00:00:00','10:10:10') TIMESTAMP(TIME('00:00:00'),'10:10:10') -NULL NULL +NULL 2001-02-03 10:10:10 DROP TABLE t1; +SET timestamp=DEFAULT; # # MDEV-4869 Wrong result of MAKETIME(0, 0, -0.1) # @@ -2350,6 +2356,7 @@ NULL # # MDEV-4857 Wrong result of HOUR('1 00:00:00') # +SET timestamp=unix_timestamp('2001-02-03 10:20:30'); SELECT HOUR('1 02:00:00'), HOUR('26:00:00'); HOUR('1 02:00:00') HOUR('26:00:00') 26 26 @@ -2361,7 +2368,7 @@ HOUR(TIME('1 02:00:00')) HOUR(TIME('26:00:00')) 26 26 SELECT DAY(TIME('1 02:00:00')), DAY(TIME('26:00:00')); DAY(TIME('1 02:00:00')) DAY(TIME('26:00:00')) -0 0 +4 4 SELECT EXTRACT(HOUR FROM '1 02:00:00'), EXTRACT(HOUR FROM '26:00:00'); EXTRACT(HOUR FROM '1 02:00:00') EXTRACT(HOUR FROM '26:00:00') 2 2 @@ -2374,6 +2381,39 @@ EXTRACT(HOUR FROM TIME('1 02:00:00')) EXTRACT(HOUR FROM TIME('26:00:00')) SELECT EXTRACT(DAY FROM TIME('1 02:00:00')), EXTRACT(DAY FROM TIME('26:00:00')); EXTRACT(DAY FROM TIME('1 02:00:00')) EXTRACT(DAY FROM TIME('26:00:00')) 1 1 +SET timestamp=DEFAULT; +# +# MDEV-5458 RQG hits 'sql/tztime.cc:799: my_time_t sec_since_epoch(int, int, int, int, int, int): Assertion `mon > 0 && mon < 13' failed.' +# +SET TIMESTAMP=UNIX_TIMESTAMP('2014-01-22 18:19:20'); +CREATE TABLE t1 (t TIME); +INSERT INTO t1 VALUES ('03:22:30'),('18:30:05'); +SELECT CONVERT_TZ(GREATEST(t, CURRENT_DATE()), '+02:00', '+10:00') FROM t1; +CONVERT_TZ(GREATEST(t, CURRENT_DATE()), '+02:00', '+10:00') +2014-02-26 06:59:59 +2014-02-26 06:59:59 +Warnings: +Warning 1292 Truncated incorrect time value: '1296:00:00' +Warning 1292 Truncated incorrect time value: '1296:00:00' +SELECT GREATEST(t, CURRENT_DATE()) FROM t1; +GREATEST(t, CURRENT_DATE()) +838:59:59 +838:59:59 +Warnings: +Warning 1292 Truncated incorrect time value: '1296:00:00' +Warning 1292 Truncated incorrect time value: '1296:00:00' +DROP TABLE t1; +SET TIMESTAMP=DEFAULT; +# +# MDEV-5504 Server crashes in String::length on SELECT with MONTHNAME, GROUP BY, ROLLUP +# +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +SELECT 1 FROM t1 GROUP BY MONTHNAME(0) WITH ROLLUP; +1 +1 +1 +DROP TABLE t1; # # MDEV-4838 Wrong metadata for DATE_ADD('string', INVERVAL) # @@ -2382,3 +2422,62 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def DATE_ADD('2011-01-02 12:13:14', INTERVAL 1 MINUTE) 254 19 19 Y 0 0 8 DATE_ADD('2011-01-02 12:13:14', INTERVAL 1 MINUTE) 2011-01-02 12:14:14 +# +# MDEV-5450 Assertion `cached_field_ type == MYSQL_TYPE_STRING || ltime.time_type == MYSQL_TIMESTAMP_NONE || mysql_type_to_time_type(cached_field_type) == ltime.time_type' fails with IF, ISNULL, ADDDATE +# +CREATE TABLE t1 (a DATETIME, b DATE); +INSERT INTO t1 VALUES (NULL, '2012-12-21'); +SELECT IF(1,ADDDATE(IFNULL(a,b),0),1) FROM t1; +IF(1,ADDDATE(IFNULL(a,b),0),1) +2012-12-21 00:00:00 +SELECT CAST(ADDDATE(IFNULL(a,b),0) AS CHAR) FROM t1; +CAST(ADDDATE(IFNULL(a,b),0) AS CHAR) +2012-12-21 00:00:00 +SELECT CAST(ADDDATE(COALESCE(a,b),0) AS CHAR) FROM t1; +CAST(ADDDATE(COALESCE(a,b),0) AS CHAR) +2012-12-21 00:00:00 +SELECT CAST(ADDDATE(CASE WHEN 0 THEN a ELSE b END,0) AS CHAR) FROM t1; +CAST(ADDDATE(CASE WHEN 0 THEN a ELSE b END,0) AS CHAR) +2012-12-21 00:00:00 +SELECT IF(1,ADDTIME(IFNULL(a,b),0),1) FROM t1; +IF(1,ADDTIME(IFNULL(a,b),0),1) +2012-12-21 00:00:00 +SELECT CAST(ADDTIME(IFNULL(a,b),0) AS CHAR) FROM t1; +CAST(ADDTIME(IFNULL(a,b),0) AS CHAR) +2012-12-21 00:00:00 +SELECT CAST(ADDTIME(COALESCE(a,b),0) AS CHAR) FROM t1; +CAST(ADDTIME(COALESCE(a,b),0) AS CHAR) +2012-12-21 00:00:00 +SELECT CAST(ADDTIME(CASE WHEN 0 THEN a ELSE b END,0) AS CHAR) FROM t1; +CAST(ADDTIME(CASE WHEN 0 THEN a ELSE b END,0) AS CHAR) +2012-12-21 00:00:00 +DROP TABLE t1; +SET timestamp=unix_timestamp('2001-02-03 10:20:30'); +CREATE TABLE t1 (a DATETIME, b TIME); +INSERT INTO t1 VALUES (NULL, '00:20:12'); +SELECT IF(1,ADDDATE(IFNULL(a,b),0),1) FROM t1; +IF(1,ADDDATE(IFNULL(a,b),0),1) +2001-02-03 00:20:12 +SELECT CAST(ADDDATE(IFNULL(a,b),0) AS CHAR) FROM t1; +CAST(ADDDATE(IFNULL(a,b),0) AS CHAR) +2001-02-03 00:20:12 +SELECT CAST(ADDDATE(COALESCE(a,b),0) AS CHAR) FROM t1; +CAST(ADDDATE(COALESCE(a,b),0) AS CHAR) +2001-02-03 00:20:12 +SELECT CAST(ADDDATE(CASE WHEN 0 THEN a ELSE b END,0) AS CHAR) FROM t1; +CAST(ADDDATE(CASE WHEN 0 THEN a ELSE b END,0) AS CHAR) +2001-02-03 00:20:12 +SELECT IF(1,ADDTIME(IFNULL(a,b),0),1) FROM t1; +IF(1,ADDTIME(IFNULL(a,b),0),1) +2001-02-03 00:20:12 +SELECT CAST(ADDTIME(IFNULL(a,b),0) AS CHAR) FROM t1; +CAST(ADDTIME(IFNULL(a,b),0) AS CHAR) +2001-02-03 00:20:12 +SELECT CAST(ADDTIME(COALESCE(a,b),0) AS CHAR) FROM t1; +CAST(ADDTIME(COALESCE(a,b),0) AS CHAR) +2001-02-03 00:20:12 +SELECT CAST(ADDTIME(CASE WHEN 0 THEN a ELSE b END,0) AS CHAR) FROM t1; +CAST(ADDTIME(CASE WHEN 0 THEN a ELSE b END,0) AS CHAR) +2001-02-03 00:20:12 +DROP TABLE t1; +SET timestamp=DEFAULT; diff --git a/mysql-test/r/gis-precise.result b/mysql-test/r/gis-precise.result index 3b07be3930a..71eed65b2ea 100644 --- a/mysql-test/r/gis-precise.result +++ b/mysql-test/r/gis-precise.result @@ -452,3 +452,6 @@ ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 -3.0, 0.0 -3.0 ))' ), 136 +select astext(buffer(st_linestringfromwkb(linestring(point(-1,1), point(-1,-2))),-1)); +astext(buffer(st_linestringfromwkb(linestring(point(-1,1), point(-1,-2))),-1)) +GEOMETRYCOLLECTION EMPTY diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index fa7b93092d9..9acdb1a87c2 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -1574,6 +1574,27 @@ SELECT 1 FROM g1 WHERE a >= ANY 1 DROP TABLE g1; # +# Bug#16451878 GEOMETRY QUERY CRASHES SERVER +# +# should not crash +SELECT ASTEXT(0x0100000000030000000100000000000010); +ASTEXT(0x0100000000030000000100000000000010) +NULL +#should not crash +SELECT ENVELOPE(0x0100000000030000000100000000000010); +ENVELOPE(0x0100000000030000000100000000000010) +NULL +#should not crash +SELECT +GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffff0000, 1); +GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffff0000, 1) +NULL +#should not crash +SELECT +GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1); +GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1) +NULL +# # MDEV-3819 missing constraints for spatial column types # create table t1 (pt point); diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index eaeb2a32b29..dfe28f0e05a 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -1957,12 +1957,12 @@ UNIQUE INDEX idx (col1)); INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10), (11),(12),(13),(14),(15),(16),(17),(18),(19),(20); EXPLAIN SELECT col1 AS field1, col1 AS field2 -FROM t1 GROUP BY field1, field2;; +FROM t1 GROUP BY field1, field2+0;; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL idx 5 NULL 20 Using index; Using temporary; Using filesort FLUSH STATUS; SELECT col1 AS field1, col1 AS field2 -FROM t1 GROUP BY field1, field2;; +FROM t1 GROUP BY field1, field2+0;; field1 field2 1 1 2 2 @@ -2054,8 +2054,12 @@ field1 field2 explain select col1 f1, col1 f2 from t1 order by f2, f1; id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL idx 5 NULL 20 Using index +explain +select col1 f1, col1 f2 from t1 order by f2, f1+0; +id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL idx 5 NULL 20 Using index; Using filesort -select col1 f1, col1 f2 from t1 order by f2, f1; +select col1 f1, col1 f2 from t1 order by f2, f1+0; f1 f2 1 1 2 2 @@ -2080,7 +2084,7 @@ f1 f2 explain select col1 f1, col1 f2 from t1 group by f2 order by f2, f1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL idx 5 NULL 20 Using index; Using temporary; Using filesort +1 SIMPLE t1 index NULL idx 5 NULL 20 Using index select col1 f1, col1 f2 from t1 group by f2 order by f2, f1; f1 f2 1 1 @@ -2106,7 +2110,7 @@ f1 f2 explain select col1 f1, col1 f2 from t1 group by f1, f2 order by f2, f1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL idx 5 NULL 20 Using index; Using temporary; Using filesort +1 SIMPLE t1 index NULL idx 5 NULL 20 Using index select col1 f1, col1 f2 from t1 group by f1, f2 order by f2, f1; f1 f2 1 1 @@ -2137,10 +2141,10 @@ INSERT INTO t2(col1, col2) VALUES (1,20),(2,19),(3,18),(4,17),(5,16),(6,15),(7,14),(8,13),(9,12),(10,11), (11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1); explain -select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3; +select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3+0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 index NULL idx 10 NULL 20 Using index; Using temporary; Using filesort -select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3; +select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3+0; f1 f2 f3 1 20 1 2 19 2 @@ -2163,10 +2167,10 @@ f1 f2 f3 19 2 19 20 1 20 explain -select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3; +select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3+0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 index NULL idx 10 NULL 20 Using index; Using filesort -select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3; +select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3+0; f1 f2 f3 1 20 1 2 19 2 @@ -2470,32 +2474,6 @@ v 2v,2v NULL 1c,2v,2v DROP TABLE t1,t2; # -# Test of MDEV-4002 -# -CREATE TABLE t1 ( -pk INT NOT NULL PRIMARY KEY, -d1 DOUBLE, -d2 DOUBLE, -i INT NOT NULL DEFAULT '0', -KEY (i) -) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1,1.0,1.1,1),(2,2.0,2.2,2); -PREPARE stmt FROM " -SELECT DISTINCT i, GROUP_CONCAT( d1, d2 ORDER BY d1, d2 ) -FROM t1 a1 NATURAL JOIN t1 a2 GROUP BY i WITH ROLLUP -"; -EXECUTE stmt; -i GROUP_CONCAT( d1, d2 ORDER BY d1, d2 ) -1 11.1 -2 22.2 -NULL 11.1,22.2 -EXECUTE stmt; -i GROUP_CONCAT( d1, d2 ORDER BY d1, d2 ) -1 11.1 -2 22.2 -NULL 11.1,22.2 -DROP TABLE t1; -# # Bug #58782 # Missing rows with SELECT .. WHERE .. IN subquery # with full GROUP BY and no aggr diff --git a/mysql-test/r/group_by_innodb.result b/mysql-test/r/group_by_innodb.result index d165834cbe3..4b5d9990c51 100644 --- a/mysql-test/r/group_by_innodb.result +++ b/mysql-test/r/group_by_innodb.result @@ -1,3 +1,4 @@ +set @save_ext_key_optimizer_switch=@@optimizer_switch; # # MDEV-3992 Server crash or valgrind errors in test_if_skip_sort_order/test_if_cheaper_ordering # on GROUP BY with indexes on InnoDB table @@ -7,13 +8,14 @@ pk INT PRIMARY KEY, a VARCHAR(1) NOT NULL, KEY (pk) ) ENGINE=InnoDB; +set optimizer_switch='extended_keys=on'; INSERT INTO t1 VALUES (1,'a'),(2,'b'); EXPLAIN SELECT COUNT(*), pk field1, pk AS field2 FROM t1 WHERE a = 'r' OR pk = 183 GROUP BY field1, field2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY,pk pk 4 NULL 2 Using where +1 SIMPLE t1 index PRIMARY,pk PRIMARY 4 NULL 2 Using where SELECT COUNT(*), pk field1, pk AS field2 FROM t1 WHERE a = 'r' OR pk = 183 GROUP BY field1, field2; @@ -22,9 +24,36 @@ EXPLAIN SELECT COUNT(*), pk field1 FROM t1 WHERE a = 'r' OR pk = 183 GROUP BY field1, field1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY,pk pk 4 NULL 2 Using where +1 SIMPLE t1 index PRIMARY,pk PRIMARY 4 NULL 2 Using where SELECT COUNT(*), pk field1 FROM t1 WHERE a = 'r' OR pk = 183 GROUP BY field1, field1; COUNT(*) field1 drop table t1; +set optimizer_switch=@save_ext_key_optimizer_switch; +# +# MDEV-4002 Server crash or valgrind errors in Item_func_group_concat::setup and Item_func_group_concat::add +# +CREATE TABLE t1 ( +pk INT NOT NULL PRIMARY KEY, +d1 DOUBLE, +d2 DOUBLE, +i INT NOT NULL DEFAULT '0', +KEY (i) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,1.0,1.1,1),(2,2.0,2.2,2); +PREPARE stmt FROM " +SELECT DISTINCT i, GROUP_CONCAT( d1, d2 ORDER BY d1, d2 ) +FROM t1 a1 NATURAL JOIN t1 a2 GROUP BY i WITH ROLLUP +"; +EXECUTE stmt; +i GROUP_CONCAT( d1, d2 ORDER BY d1, d2 ) +1 11.1 +2 22.2 +NULL 11.1,22.2 +EXECUTE stmt; +i GROUP_CONCAT( d1, d2 ORDER BY d1, d2 ) +1 11.1 +2 22.2 +NULL 11.1,22.2 +DROP TABLE t1; End of 5.5 tests diff --git a/mysql-test/r/group_by_null.result b/mysql-test/r/group_by_null.result new file mode 100644 index 00000000000..01053514cb0 --- /dev/null +++ b/mysql-test/r/group_by_null.result @@ -0,0 +1,6 @@ +create table t1 (a int); +insert into t1 values (1),(2); +select max('foo') from t1 group by values(a), extractvalue('bar','qux') order by "v"; +max('foo') +foo +drop table t1; diff --git a/mysql-test/r/index_intersect_innodb.result b/mysql-test/r/index_intersect_innodb.result index d28b3a0bf92..33f2247e5d1 100644 --- a/mysql-test/r/index_intersect_innodb.result +++ b/mysql-test/r/index_intersect_innodb.result @@ -463,29 +463,29 @@ EXPLAIN SELECT * FROM City WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Country,Population 4,3,4 NULL # Using sort_intersect(PRIMARY,Country,Population); Using where +1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Country,Population 4,7,4 NULL # Using sort_intersect(PRIMARY,Country,Population); Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,3 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where +1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 2001 AND 2500 AND Population > 300000 AND Country LIKE 'H%'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Country 4,3 NULL # Using sort_intersect(PRIMARY,Country); Using where +1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Country 4,7 NULL # Using sort_intersect(PRIMARY,Country); Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3701 AND 4000 AND Population > 1000000 AND Country BETWEEN 'S' AND 'Z'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Country,Population 4,3,4 NULL # Using sort_intersect(PRIMARY,Country,Population); Using where +1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Country,Population 4,7,4 NULL # Using sort_intersect(PRIMARY,Country,Population); Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000 AND Country BETWEEN 'S' AND 'Z' ; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Country,Population 4,3,4 NULL # Using sort_intersect(PRIMARY,Country,Population); Using where +1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Country,Population 4,7,4 NULL # Using sort_intersect(PRIMARY,Country,Population); Using where SELECT * FROM City USE INDEX () WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%'; ID Name Country Population @@ -739,13 +739,13 @@ EXPLAIN SELECT * FROM City WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,3 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where +1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000 AND Country BETWEEN 'S' AND 'Z'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Country,Population 4,3,4 NULL # Using sort_intersect(PRIMARY,Country,Population); Using where +1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Country,Population 4,7,4 NULL # Using sort_intersect(PRIMARY,Country,Population); Using where SELECT * FROM City WHERE Name LIKE 'C%' AND Population > 1000000; ID Name Country Population @@ -1033,7 +1033,7 @@ EXPLAIN SELECT * FROM t1 WHERE (f1 < 535 OR f1 > 985) AND ( f4='r' OR f4 LIKE 'a%' ) ; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge PRIMARY,f4 PRIMARY,f4 4,35 NULL # Using sort_intersect(PRIMARY,f4); Using where +1 SIMPLE t1 index_merge PRIMARY,f4 PRIMARY,f4 4,39 NULL # Using sort_intersect(PRIMARY,f4); Using where SELECT * FROM t1 WHERE (f1 < 535 OR f1 > 985) AND ( f4='r' OR f4 LIKE 'a%' ) ; f1 f4 f5 diff --git a/mysql-test/r/index_merge_innodb.result b/mysql-test/r/index_merge_innodb.result index b93d15f7bef..5202c79f3c7 100644 --- a/mysql-test/r/index_merge_innodb.result +++ b/mysql-test/r/index_merge_innodb.result @@ -580,9 +580,12 @@ pk1 pk2 explain select * from t1 where badkey=1 and key1=10; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref key1 key1 4 const 100 Using where +set @tmp_index_merge_ror_cpk=@@optimizer_switch; +set optimizer_switch='extended_keys=off'; explain select * from t1 where pk1 < 7500 and key1 = 10; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index_merge PRIMARY,key1 key1,PRIMARY 4,4 NULL ROWS Using intersect(key1,PRIMARY); Using where +set optimizer_switch=@tmp_index_merge_ror_cpk; explain select * from t1 where pktail1ok=1 and key1=10; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index_merge key1,pktail1ok key1,pktail1ok 4,4 NULL 1 Using intersect(key1,pktail1ok); Using where diff --git a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result index 2fa2d5bcce1..2c0dc77399f 100644 --- a/mysql-test/r/index_merge_myisam.result +++ b/mysql-test/r/index_merge_myisam.result @@ -1415,9 +1415,12 @@ pk1 pk2 explain select * from t1 where badkey=1 and key1=10; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref key1 key1 4 const 91 Using where +set @tmp_index_merge_ror_cpk=@@optimizer_switch; +set optimizer_switch='extended_keys=off'; explain select * from t1 where pk1 < 7500 and key1 = 10; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref PRIMARY,key1 key1 4 const ROWS Using where +set optimizer_switch=@tmp_index_merge_ror_cpk; explain select * from t1 where pktail1ok=1 and key1=10; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref key1,pktail1ok pktail1ok 4 const 76 Using where diff --git a/mysql-test/r/information_schema-big.result b/mysql-test/r/information_schema-big.result index fd98d4e6dc6..45898c77989 100644 --- a/mysql-test/r/information_schema-big.result +++ b/mysql-test/r/information_schema-big.result @@ -1,7 +1,7 @@ DROP TABLE IF EXISTS t0,t1,t2,t3,t4,t5; DROP VIEW IF EXISTS v1; # -# Bug#18925: subqueries with MIN/MAX functions on INFORMARTION_SCHEMA +# Bug#18925: subqueries with MIN/MAX functions on INFORMATION_SCHEMA # SELECT t.table_name, c1.column_name FROM information_schema.tables t @@ -58,8 +58,8 @@ USER_PRIVILEGES GRANTEE USER_STATISTICS USER VIEWS TABLE_SCHEMA XTRADB_INTERNAL_HASH_TABLES INTERNAL_HASH_TABLE_NAME -XTRADB_RSEG rseg_id XTRADB_READ_VIEW READ_VIEW_UNDO_NUMBER +XTRADB_RSEG rseg_id SELECT t.table_name, c1.column_name FROM information_schema.tables t INNER JOIN @@ -115,5 +115,5 @@ USER_PRIVILEGES GRANTEE USER_STATISTICS USER VIEWS TABLE_SCHEMA XTRADB_INTERNAL_HASH_TABLES INTERNAL_HASH_TABLE_NAME -XTRADB_RSEG rseg_id XTRADB_READ_VIEW READ_VIEW_UNDO_NUMBER +XTRADB_RSEG rseg_id diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 652d8e19829..b0e2898780d 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1945,3 +1945,45 @@ drop database mysqltest; # # End of 5.5 tests # +# +# MDEV-5723: mysqldump -uroot unusable for multi-database operations, checks all databases +# +drop database if exists db1; +create database db1; +use db1; +create table t1 (a int); +create table t2 (a int); +create table t3 (a int); +create database mysqltest; +use mysqltest; +create table t1 (a int); +create table t2 (a int); +create table t3 (a int); +flush tables; +flush status; +SELECT +LOGFILE_GROUP_NAME, FILE_NAME, TOTAL_EXTENTS, INITIAL_SIZE, ENGINE, EXTRA +FROM +INFORMATION_SCHEMA.FILES +WHERE +FILE_TYPE = 'UNDO LOG' AND FILE_NAME IS NOT NULL AND +LOGFILE_GROUP_NAME IN (SELECT DISTINCT LOGFILE_GROUP_NAME +FROM INFORMATION_SCHEMA.FILES +WHERE +FILE_TYPE = 'DATAFILE' AND +TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME +FROM INFORMATION_SCHEMA.PARTITIONS +WHERE TABLE_SCHEMA IN ('db1') +) +) +GROUP BY +LOGFILE_GROUP_NAME, FILE_NAME, ENGINE +ORDER BY +LOGFILE_GROUP_NAME; +LOGFILE_GROUP_NAME FILE_NAME TOTAL_EXTENTS INITIAL_SIZE ENGINE EXTRA +# This must have Opened_tables=3, not 6. +show status like 'Opened_tables'; +Variable_name Value +Opened_tables 3 +drop database mysqltest; +drop database db1; diff --git a/mysql-test/r/information_schema_all_engines.result b/mysql-test/r/information_schema_all_engines.result index 7ced16404a6..7e6cfd176a4 100644 --- a/mysql-test/r/information_schema_all_engines.result +++ b/mysql-test/r/information_schema_all_engines.result @@ -55,9 +55,6 @@ TRIGGERS USER_PRIVILEGES USER_STATISTICS VIEWS -XTRADB_INTERNAL_HASH_TABLES -XTRADB_READ_VIEW -XTRADB_RSEG SELECT t.table_name, c1.column_name FROM information_schema.tables t INNER JOIN @@ -127,9 +124,6 @@ TRIGGERS TRIGGER_SCHEMA USER_PRIVILEGES GRANTEE USER_STATISTICS USER VIEWS TABLE_SCHEMA -XTRADB_INTERNAL_HASH_TABLES INTERNAL_HASH_TABLE_NAME -XTRADB_READ_VIEW READ_VIEW_UNDO_NUMBER -XTRADB_RSEG rseg_id SELECT t.table_name, c1.column_name FROM information_schema.tables t INNER JOIN @@ -199,9 +193,6 @@ TRIGGERS TRIGGER_SCHEMA USER_PRIVILEGES GRANTEE USER_STATISTICS USER VIEWS TABLE_SCHEMA -XTRADB_INTERNAL_HASH_TABLES INTERNAL_HASH_TABLE_NAME -XTRADB_READ_VIEW READ_VIEW_UNDO_NUMBER -XTRADB_RSEG rseg_id select 1 as "must be 1" from information_schema.tables where "ACCOUNTS"= (select cast(table_name as char) from information_schema.tables order by table_name limit 1) limit 1; @@ -276,9 +267,6 @@ TRIGGERS information_schema.TRIGGERS 1 USER_PRIVILEGES information_schema.USER_PRIVILEGES 1 USER_STATISTICS information_schema.USER_STATISTICS 1 VIEWS information_schema.VIEWS 1 -XTRADB_INTERNAL_HASH_TABLES information_schema.XTRADB_INTERNAL_HASH_TABLES 1 -XTRADB_READ_VIEW information_schema.XTRADB_READ_VIEW 1 -XTRADB_RSEG information_schema.XTRADB_RSEG 1 +---------------------------------------+ +---------------------------------------+ +---------------------------------------+ @@ -338,9 +326,6 @@ Database: information_schema | USER_PRIVILEGES | | USER_STATISTICS | | VIEWS | -| XTRADB_INTERNAL_HASH_TABLES | -| XTRADB_READ_VIEW | -| XTRADB_RSEG | +---------------------------------------+ +---------------------------------------+ +---------------------------------------+ @@ -400,9 +385,6 @@ Database: INFORMATION_SCHEMA | USER_PRIVILEGES | | USER_STATISTICS | | VIEWS | -| XTRADB_INTERNAL_HASH_TABLES | -| XTRADB_READ_VIEW | -| XTRADB_RSEG | +--------------------+ +--------------------+ +--------------------+ @@ -411,5 +393,5 @@ Wildcard: inf_rmation_schema | information_schema | SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA; table_schema count(*) -information_schema 57 +information_schema 54 mysql 30 diff --git a/mysql-test/r/innodb_ext_key.result b/mysql-test/r/innodb_ext_key.result index e4e7e44ce7c..9140f306f77 100644 --- a/mysql-test/r/innodb_ext_key.result +++ b/mysql-test/r/innodb_ext_key.result @@ -327,7 +327,7 @@ from lineitem use index (i_l_shipdate, i_l_receiptdate) where l_shipdate='1992-07-01' and l_orderkey=130 or l_receiptdate='1992-07-01' and l_orderkey=5603; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 8,8 NULL 2 Using sort_union(i_l_shipdate,i_l_receiptdate); Using where +1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 8,8 NULL 2 Using union(i_l_shipdate,i_l_receiptdate); Using where flush status; select l_orderkey, l_linenumber from lineitem use index (i_l_shipdate, i_l_receiptdate) @@ -991,6 +991,54 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ref page_timestamp page_timestamp 4 const 10 Using where 1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.rev_text_id 1 DROP TABLE t1,t2,t3; +# +# MDEV-5424 SELECT using ORDER BY DESC and LIMIT produces unexpected +# results (InnoDB/XtraDB) +# +create table t1 (a bigint not null unique auto_increment, b varchar(10), primary key (a), key (b(2))) engine = myisam default character set utf8; +create table t2 (a bigint not null unique auto_increment, b varchar(10), primary key (a), key (b(2))) engine = innodb default character set utf8; +insert into t1 (b) values (null), (null), (null); +insert into t2 (b) values (null), (null), (null); +set optimizer_switch='extended_keys=on'; +explain select a from t1 where b is null order by a desc limit 2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref b b 9 const 2 Using where; Using filesort +select a from t1 where b is null order by a desc limit 2; +a +3 +2 +explain select a from t2 where b is null order by a desc limit 2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range b b 9 NULL 3 Using where; Using filesort +select a from t2 where b is null order by a desc limit 2; +a +3 +2 +set optimizer_switch='extended_keys=off'; +explain select a from t2 where b is null order by a desc limit 2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range b b 9 NULL 3 Using where; Using filesort +select a from t2 where b is null order by a desc limit 2; +a +3 +2 +explain select a from t2 where b is null order by a desc; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index b PRIMARY 8 NULL 3 Using where +select a from t2 where b is null order by a desc; +a +3 +2 +1 +explain select a from t2 where b is null order by a desc,a,a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index b PRIMARY 8 NULL 3 Using where +select a from t2 where b is null order by a desc,a,a; +a +3 +2 +1 +drop table t1, t2; set optimizer_switch=@save_optimizer_switch; set optimizer_switch=@save_ext_key_optimizer_switch; SET SESSION STORAGE_ENGINE=DEFAULT; diff --git a/mysql-test/r/innodb_icp.result b/mysql-test/r/innodb_icp.result index 5e9e6d647f8..fb467494525 100644 --- a/mysql-test/r/innodb_icp.result +++ b/mysql-test/r/innodb_icp.result @@ -910,5 +910,30 @@ OR a = c ORDER BY e; a b c d e DROP TABLE t1,t2,t3; +# +# MDEV-5337: Wrong result in mariadb 5.5.32 with ORDER BY + LIMIT when index_condition_pushdown=on +# MDEV-5512: Wrong result (WHERE clause ignored) with multiple clauses using Percona-XtraDB engine +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (pk int primary key, +key1 char(32), +key2 char(32), +key(key1), +key(key2) +) engine=innodb; +insert into t2 select +A.a+10*B.a+100*C.a, +concat('rare-', A.a+10*B.a), +concat('rare-', A.a+10*B.a) +from +t1 A, t1 B, t1 C; +update t2 set key1='frequent-val' where pk between 100 and 350; +select * from t2 ignore key(PRIMARY) +where key1='frequent-val' and key2 between 'rare-400' and 'rare-450' order by pk limit 2; +pk key1 key2 +141 frequent-val rare-41 +142 frequent-val rare-42 +drop table t1, t2; set optimizer_switch=@innodb_icp_tmp; set storage_engine= @save_storage_engine; diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result index a722ab8d97f..82f3977e231 100644 --- a/mysql-test/r/insert.result +++ b/mysql-test/r/insert.result @@ -697,3 +697,23 @@ ERROR 42000: Column 'a' specified twice INSERT IGNORE t1 (a, a) SELECT 1,1 UNION SELECT 2,2; ERROR 42000: Column 'a' specified twice DROP TABLE t1; +# +# MDEV-5168: Ensure that we can disable duplicate key warnings +# from INSERT IGNORE +# +create table t1 (f1 int unique, f2 int unique); +insert into t1 values (1,12); +insert into t1 values (2,13); +insert into t1 values (1,12); +ERROR 23000: Duplicate entry '1' for key 'f1' +insert ignore into t1 values (1,12); +Warnings: +Warning 1062 Duplicate entry '1' for key 'f1' +set @@old_mode="NO_DUP_KEY_WARNINGS_WITH_IGNORE"; +insert ignore into t1 values (1,12); +insert ignore into t1 values (1,12) on duplicate key update f2=13; +set @@old_mode=""; +insert ignore into t1 values (1,12); +Warnings: +Warning 1062 Duplicate entry '1' for key 'f1' +DROP TABLE t1; diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result index 0f798f7ba1a..e7292e8ddce 100644 --- a/mysql-test/r/join.result +++ b/mysql-test/r/join.result @@ -1538,3 +1538,14 @@ a 3 4 DROP TABLE t1,t2; +# +# MDEV-5635: join of a const table with non-const tables +# +CREATE TABLE t1 (a varchar(3) NOT NULL) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('foo'); +CREATE TABLE t2 (b varchar(3), c varchar(3), INDEX(b)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('bar', 'bar'),( 'qux', 'qux'); +SELECT STRAIGHT_JOIN * FROM t1, t2 AS t2_1, t2 AS t2_2 +WHERE t2_2.c = t2_1.c AND t2_2.b = t2_1.b AND ( a IS NULL OR t2_1.c = a ); +a b c b c +DROP TABLE t1,t2; diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index 4a806e0831c..e303c288552 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -1311,7 +1311,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 Warnings: -Note 1003 select 1 AS `f1`,NULL AS `f2`,3 AS `f3`,NULL AS `f1`,NULL AS `f2` from `test`.`t2` where ((coalesce(1,NULL),3) in ((1,3),(2,2))) +Note 1003 select 1 AS `f1`,NULL AS `f2`,3 AS `f3`,NULL AS `f1`,NULL AS `f2` from `test`.`t2` where 1 SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2 WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2)); f1 f2 f3 f1 f2 diff --git a/mysql-test/r/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result index 6a543f920e4..88f2fd7c630 100644 --- a/mysql-test/r/join_outer_jcl6.result +++ b/mysql-test/r/join_outer_jcl6.result @@ -1322,7 +1322,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 Warnings: -Note 1003 select 1 AS `f1`,NULL AS `f2`,3 AS `f3`,NULL AS `f1`,NULL AS `f2` from `test`.`t2` where ((coalesce(1,NULL),3) in ((1,3),(2,2))) +Note 1003 select 1 AS `f1`,NULL AS `f2`,3 AS `f3`,NULL AS `f1`,NULL AS `f2` from `test`.`t2` where 1 SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2 WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2)); f1 f2 f3 f1 f2 diff --git a/mysql-test/r/lowercase_table2.result b/mysql-test/r/lowercase_table2.result index 58b976413de..f75eed41d9f 100644 --- a/mysql-test/r/lowercase_table2.result +++ b/mysql-test/r/lowercase_table2.result @@ -274,7 +274,7 @@ Database Table In_use Name_locked test t_bug44738_uppercase 0 0 # So attempt to create table with the same name should fail. create table t_bug44738_UPPERCASE (i int); -ERROR HY000: Can't find file: './test/t_bug44738_uppercase.MYI' (errno: 2 "No such file or directory") +ERROR 42S01: Table 't_bug44738_uppercase' already exists # And should succeed after FLUSH TABLES. flush tables; create table t_bug44738_UPPERCASE (i int); diff --git a/mysql-test/r/lowercase_view.result b/mysql-test/r/lowercase_view.result index 33c87ec101c..f43c39c4fc1 100644 --- a/mysql-test/r/lowercase_view.result +++ b/mysql-test/r/lowercase_view.result @@ -20,13 +20,13 @@ ERROR HY000: The definition of table 'v1Aa' prevents operation UPDATE on table ' update v2Aa set col1 = (select max(col1) from t1Aa); ERROR HY000: The definition of table 'v2Aa' prevents operation UPDATE on table 'v2Aa'. update v2aA set col1 = (select max(col1) from v2Aa); -ERROR HY000: You can't specify target table 'v2aA' for update in FROM clause +ERROR HY000: Table 'v2aA' is specified twice, both as a target for 'UPDATE' and as a separate source for data update v2aA,t2Aa set v2Aa.col1 = (select max(col1) from v1aA) where v2aA.col1 = t2aA.col1; ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 'v2aA'. update t1aA,t2Aa set t1Aa.col1 = (select max(col1) from v1Aa) where t1aA.col1 = t2aA.col1; ERROR HY000: The definition of table 'v1Aa' prevents operation UPDATE on table 't1aA'. update v1aA,t2Aa set v1Aa.col1 = (select max(col1) from v1aA) where v1Aa.col1 = t2aA.col1; -ERROR HY000: You can't specify target table 'v1aA' for update in FROM clause +ERROR HY000: Table 'v1aA' is specified twice, both as a target for 'UPDATE' and as a separate source for data update t2Aa,v2Aa set v2aA.col1 = (select max(col1) from v1aA) where v2Aa.col1 = t2aA.col1; ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 't2Aa'. update t2Aa,t1Aa set t1aA.col1 = (select max(col1) from v1Aa) where t1Aa.col1 = t2aA.col1; @@ -36,17 +36,17 @@ ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table ' update v2aA,t2Aa set v2Aa.col1 = (select max(col1) from t1aA) where v2aA.col1 = t2aA.col1; ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 'v2aA'. update t1Aa,t2Aa set t1aA.col1 = (select max(col1) from t1Aa) where t1aA.col1 = t2aA.col1; -ERROR HY000: You can't specify target table 't1Aa' for update in FROM clause +ERROR HY000: Table 't1Aa' is specified twice, both as a target for 'UPDATE' and as a separate source for data update v1aA,t2Aa set v1Aa.col1 = (select max(col1) from t1Aa) where v1aA.col1 = t2aA.col1; ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 'v1aA'. update t2Aa,v2Aa set v2aA.col1 = (select max(col1) from t1aA) where v2Aa.col1 = t2aA.col1; -ERROR HY000: You can't specify target table 't2Aa' for update in FROM clause +ERROR HY000: Table 't2Aa' is specified twice, both as a target for 'UPDATE' and as a separate source for data update t2Aa,t1Aa set t1aA.col1 = (select max(col1) from t1Aa) where t1aA.col1 = t2aA.col1; -ERROR HY000: You can't specify target table 't2Aa' for update in FROM clause +ERROR HY000: Table 't2Aa' is specified twice, both as a target for 'UPDATE' and as a separate source for data update t2Aa,v1Aa set v1aA.col1 = (select max(col1) from t1Aa) where v1Aa.col1 = t2aA.col1; -ERROR HY000: You can't specify target table 't2Aa' for update in FROM clause +ERROR HY000: Table 't2Aa' is specified twice, both as a target for 'UPDATE' and as a separate source for data update v2aA,t2Aa set v2Aa.col1 = (select max(col1) from v2aA) where v2Aa.col1 = t2aA.col1; -ERROR HY000: You can't specify target table 'v2aA' for update in FROM clause +ERROR HY000: Table 'v2aA' is specified twice, both as a target for 'UPDATE' and as a separate source for data update t1aA,t2Aa set t1Aa.col1 = (select max(col1) from v2aA) where t1aA.col1 = t2aA.col1; ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 't1aA'. update v1aA,t2Aa set v1Aa.col1 = (select max(col1) from v2Aa) where v1aA.col1 = t2aA.col1; @@ -64,27 +64,27 @@ ERROR HY000: The definition of table 'v3aA' prevents operation UPDATE on table ' update v3aA set v3Aa.col1 = (select max(col1) from v2aA); ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 'v3aA'. update v3aA set v3Aa.col1 = (select max(col1) from v3aA); -ERROR HY000: You can't specify target table 'v3aA' for update in FROM clause +ERROR HY000: Table 'v3aA' is specified twice, both as a target for 'UPDATE' and as a separate source for data delete from v2Aa where col1 = (select max(col1) from v1Aa); ERROR HY000: The definition of table 'v1Aa' prevents operation DELETE on table 'v2Aa'. delete from v2aA where col1 = (select max(col1) from t1Aa); ERROR HY000: The definition of table 'v2aA' prevents operation DELETE on table 'v2aA'. delete from v2Aa where col1 = (select max(col1) from v2aA); -ERROR HY000: You can't specify target table 'v2Aa' for update in FROM clause +ERROR HY000: Table 'v2Aa' is specified twice, both as a target for 'DELETE' and as a separate source for data delete v2Aa from v2aA,t2Aa where (select max(col1) from v1aA) > 0 and v2Aa.col1 = t2aA.col1; ERROR HY000: The definition of table 'v1aA' prevents operation DELETE on table 'v2aA'. delete t1aA from t1Aa,t2Aa where (select max(col1) from v1Aa) > 0 and t1aA.col1 = t2aA.col1; ERROR HY000: The definition of table 'v1Aa' prevents operation DELETE on table 't1Aa'. delete v1aA from v1Aa,t2Aa where (select max(col1) from v1aA) > 0 and v1Aa.col1 = t2aA.col1; -ERROR HY000: You can't specify target table 'v1Aa' for update in FROM clause +ERROR HY000: Table 'v1Aa' is specified twice, both as a target for 'DELETE' and as a separate source for data delete v2aA from v2Aa,t2Aa where (select max(col1) from t1Aa) > 0 and v2aA.col1 = t2aA.col1; ERROR HY000: The definition of table 'v2Aa' prevents operation DELETE on table 'v2Aa'. delete t1aA from t1Aa,t2Aa where (select max(col1) from t1aA) > 0 and t1Aa.col1 = t2aA.col1; -ERROR HY000: You can't specify target table 't1Aa' for update in FROM clause +ERROR HY000: Table 't1Aa' is specified twice, both as a target for 'DELETE' and as a separate source for data delete v1aA from v1Aa,t2Aa where (select max(col1) from t1aA) > 0 and v1aA.col1 = t2aA.col1; ERROR HY000: The definition of table 'v1Aa' prevents operation DELETE on table 'v1Aa'. delete v2Aa from v2aA,t2Aa where (select max(col1) from v2Aa) > 0 and v2aA.col1 = t2aA.col1; -ERROR HY000: You can't specify target table 'v2aA' for update in FROM clause +ERROR HY000: Table 'v2aA' is specified twice, both as a target for 'DELETE' and as a separate source for data delete t1Aa from t1aA,t2Aa where (select max(col1) from v2Aa) > 0 and t1Aa.col1 = t2aA.col1; ERROR HY000: The definition of table 'v2Aa' prevents operation DELETE on table 't1aA'. delete v1Aa from v1aA,t2Aa where (select max(col1) from v2aA) > 0 and v1Aa.col1 = t2aA.col1; @@ -98,15 +98,15 @@ ERROR HY000: The definition of table 'v1aA' prevents operation INSERT on table ' insert into v2Aa values ((select max(col1) from t1Aa)); ERROR HY000: The definition of table 'v2Aa' prevents operation INSERT on table 'v2Aa'. insert into t1aA values ((select max(col1) from t1Aa)); -ERROR HY000: You can't specify target table 't1aA' for update in FROM clause +ERROR HY000: Table 't1aA' is specified twice, both as a target for 'INSERT' and as a separate source for data insert into v2aA values ((select max(col1) from t1aA)); ERROR HY000: The definition of table 'v2aA' prevents operation INSERT on table 'v2aA'. insert into v2Aa values ((select max(col1) from v2aA)); -ERROR HY000: You can't specify target table 'v2Aa' for update in FROM clause +ERROR HY000: Table 'v2Aa' is specified twice, both as a target for 'INSERT' and as a separate source for data insert into t1Aa values ((select max(col1) from v2Aa)); ERROR HY000: The definition of table 'v2Aa' prevents operation INSERT on table 't1Aa'. insert into v2aA values ((select max(col1) from v2Aa)); -ERROR HY000: You can't specify target table 'v2aA' for update in FROM clause +ERROR HY000: Table 'v2aA' is specified twice, both as a target for 'INSERT' and as a separate source for data insert into v3Aa (col1) values ((select max(col1) from v1Aa)); ERROR HY000: The definition of table 'v1Aa' prevents operation INSERT on table 'v3Aa'. insert into v3aA (col1) values ((select max(col1) from t1aA)); diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index 0feb1cdce98..89aaf48219e 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -3657,85 +3657,85 @@ insert into tmp (b) values (1); insert into t1 (a) values (1); insert into t3 (b) values (1); insert into m1 (a) values ((select max(a) from m1)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data insert into m1 (a) values ((select max(a) from m2)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data insert into m1 (a) values ((select max(a) from t1)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data insert into m1 (a) values ((select max(a) from t2)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data insert into m1 (a) values ((select max(a) from t3, m1)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data insert into m1 (a) values ((select max(a) from t3, m2)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data insert into m1 (a) values ((select max(a) from t3, t1)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data insert into m1 (a) values ((select max(a) from t3, t2)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data insert into m1 (a) values ((select max(a) from tmp, m1)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data insert into m1 (a) values ((select max(a) from tmp, m2)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data insert into m1 (a) values ((select max(a) from tmp, t1)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data insert into m1 (a) values ((select max(a) from tmp, t2)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data insert into m1 (a) values ((select max(a) from v1)); ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'm1'. insert into m1 (a) values ((select max(a) from tmp, v1)); ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'm1'. update m1 set a = ((select max(a) from m1)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data update m1 set a = ((select max(a) from m2)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data update m1 set a = ((select max(a) from t1)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data update m1 set a = ((select max(a) from t2)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data update m1 set a = ((select max(a) from t3, m1)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data update m1 set a = ((select max(a) from t3, m2)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data update m1 set a = ((select max(a) from t3, t1)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data update m1 set a = ((select max(a) from t3, t2)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data update m1 set a = ((select max(a) from tmp, m1)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data update m1 set a = ((select max(a) from tmp, m2)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data update m1 set a = ((select max(a) from tmp, t1)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data update m1 set a = ((select max(a) from tmp, t2)); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data update m1 set a = ((select max(a) from v1)); ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'm1'. update m1 set a = ((select max(a) from tmp, v1)); ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'm1'. delete from m1 where a = (select max(a) from m1); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data delete from m1 where a = (select max(a) from m2); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data delete from m1 where a = (select max(a) from t1); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data delete from m1 where a = (select max(a) from t2); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data delete from m1 where a = (select max(a) from t3, m1); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data delete from m1 where a = (select max(a) from t3, m2); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data delete from m1 where a = (select max(a) from t3, t1); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data delete from m1 where a = (select max(a) from t3, t2); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data delete from m1 where a = (select max(a) from tmp, m1); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data delete from m1 where a = (select max(a) from tmp, m2); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data delete from m1 where a = (select max(a) from tmp, t1); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data delete from m1 where a = (select max(a) from tmp, t2); -ERROR HY000: You can't specify target table 'm1' for update in FROM clause +ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data delete from m1 where a = (select max(a) from v1); ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'm1'. delete from m1 where a = (select max(a) from tmp, v1); diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index f49998da5f4..ff0aa828636 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -439,9 +439,9 @@ drop table t1, t2, t3; create table t1 (col1 int); create table t2 (col1 int); update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1; -ERROR HY000: You can't specify target table 't1' for update in FROM clause +ERROR HY000: Table 't1' is specified twice, both as a target for 'UPDATE' and as a separate source for data delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1; -ERROR HY000: You can't specify target table 't1' for update in FROM clause +ERROR HY000: Table 't1' is specified twice, both as a target for 'DELETE' and as a separate source for data drop table t1,t2; create table t1 ( aclid bigint not null primary key, @@ -457,7 +457,7 @@ drop table t1, t2; create table t1(a int); create table t2(a int); delete from t1,t2 using t1,t2 where t1.a=(select a from t1); -ERROR HY000: You can't specify target table 't1' for update in FROM clause +ERROR HY000: Table 't1' is specified twice, both as a target for 'DELETE' and as a separate source for data drop table t1, t2; create table t1 ( c char(8) not null ) engine=innodb; insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'); diff --git a/mysql-test/r/myisam_optimize.result b/mysql-test/r/myisam_optimize.result index 5c9dee9a9ca..ae0c5b59d06 100644 --- a/mysql-test/r/myisam_optimize.result +++ b/mysql-test/r/myisam_optimize.result @@ -21,3 +21,4 @@ a left(b,10) 3 CCCCCCCCCC 4 CCCCCCCCCC drop table t1; +set debug_sync='reset'; diff --git a/mysql-test/r/mysql_tzinfo_to_sql_symlink.result b/mysql-test/r/mysql_tzinfo_to_sql_symlink.result index 1aaaa38895d..484f71a4c2e 100644 --- a/mysql-test/r/mysql_tzinfo_to_sql_symlink.result +++ b/mysql-test/r/mysql_tzinfo_to_sql_symlink.result @@ -2,6 +2,7 @@ # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above # SET SESSION wsrep_replicate_myisam=ON; +# Verbose run TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_transition; @@ -12,12 +13,51 @@ INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES (@time_zone_id, 0, 0, 0, 'GMT') ; +Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/garbage' as time zone. Skipping it. +Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/ignored.tab' as time zone. Skipping it. INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); SET @time_zone_id= LAST_INSERT_ID(); INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('posix/GMT', @time_zone_id); INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES (@time_zone_id, 0, 0, 0, 'GMT') ; +Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. +Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it. Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion. 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; +# Silent run +TRUNCATE TABLE time_zone; +TRUNCATE TABLE time_zone_name; +TRUNCATE TABLE time_zone_transition; +TRUNCATE TABLE time_zone_transition_type; +INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); +SET @time_zone_id= LAST_INSERT_ID(); +INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); +INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES + (@time_zone_id, 0, 0, 0, 'GMT') +; +Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/garbage' as time zone. Skipping it. +INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); +SET @time_zone_id= LAST_INSERT_ID(); +INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('posix/GMT', @time_zone_id); +INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES + (@time_zone_id, 0, 0, 0, 'GMT') +; +Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. +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; +# +# Testing with explicit timezonefile +# +INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); +SET @time_zone_id= LAST_INSERT_ID(); +INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id); +INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES + (@time_zone_id, 0, 0, 0, 'GMT') +; +# +# Testing --leap +# +TRUNCATE TABLE time_zone_leap_second; +ALTER TABLE time_zone_leap_second ORDER BY Transition_time; diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result index 06efaf65f5e..cf4f54658b4 100644 --- a/mysql-test/r/mysql_upgrade.result +++ b/mysql-test/r/mysql_upgrade.result @@ -126,6 +126,9 @@ test Phase 3/3: Running 'mysql_fix_privilege_tables'... OK DROP USER mysqltest1@'%'; +Version check failed. Got the following error when calling the 'mysql' command line client +ERROR 1045 (28000): Access denied for user 'mysqltest1'@'localhost' (using password: YES) +FATAL ERROR: Upgrade failed Run mysql_upgrade with a non existing server socket mysqlcheck: Got error: 2005: Unknown MySQL server host 'not_existing_host' (errno) when trying to connect FATAL ERROR: Upgrade failed diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index 6999c49ff9a..58271e8d73a 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -468,8 +468,12 @@ The following options may be given as the first argument: --net-write-timeout=# Number of seconds to wait for a block to be written to a connection before aborting the write - --old Use compatible behavior + --old Use compatible behavior from previous MariaDB version. + See also --old-mode --old-alter-table Use old, non-optimized alter table + --old-mode=name Used to emulate old behavior from earlier MariaDB or + MySQL versions. Syntax: old_mode=mode[,mode[,mode...]]. + See the manual for the complete list of valid old modes --old-passwords Use old password encryption method (needed for 4.0 and older clients) --old-style-user-limits @@ -856,13 +860,30 @@ The following options may be given as the first argument: --skip-slave-start If set, slave is not autostarted. --slave-compressed-protocol Use compression on master/slave protocol + --slave-ddl-exec-mode=name + Modes for how replication events should be executed. + Legal values are STRICT and IDEMPOTENT (default). In + IDEMPOTENT mode, replication will not stop for DDL + operations that are idempotent. This means that CREATE + TABLE is treated CREATE TABLE OR REPLACE and DROP TABLE + is threated as DROP TABLE IF EXISTS. + --slave-domain-parallel-threads=# + Maximum number of parallel threads to use on slave for + events in a single replication domain. When using + multiple domains, this can be used to limit a single + domain from grabbing all threads and thus stalling other + domains. The default of 0 means to allow a domain to grab + as many threads as it wants, up to the value of + slave_parallel_threads. --slave-exec-mode=name Modes for how replication events should be executed. Legal values are STRICT (default) and IDEMPOTENT. In IDEMPOTENT mode, replication will not stop for operations - that are idempotent. In STRICT mode, replication will - stop on any unexpected difference between the master and - the slave + that are idempotent. For example, in row based + replication attempts to delete rows that doesn't exist + will be ignored.In STRICT mode, replication will stop on + any unexpected difference between the master and the + slave --slave-load-tmpdir=name The location where the slave should put its temporary files when replicating a LOAD DATA INFILE command @@ -1093,7 +1114,7 @@ auto-increment-increment 1 auto-increment-offset 1 autocommit TRUE automatic-sp-privileges TRUE -back-log 50 +back-log 150 big-tables FALSE bind-address (No default value) binlog-annotate-row-events FALSE @@ -1238,12 +1259,13 @@ net-retry-count 10 net-write-timeout 60 old FALSE old-alter-table FALSE +old-mode old-passwords FALSE old-style-user-limits FALSE optimizer-prune-level 1 optimizer-search-depth 62 optimizer-selectivity-sampling-limit 100 -optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on +optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on optimizer-use-condition-selectivity 1 performance-schema TRUE performance-schema-accounts-size 10 @@ -1294,7 +1316,8 @@ port 3306 port-open-timeout 0 preload-buffer-size 32768 profiling-history-size 15 -progress-report-time 56 +progress-report-time 5 +protocol-version 10 query-alloc-block-size 8192 query-cache-limit 1048576 query-cache-min-res-unit 4096 @@ -1333,6 +1356,8 @@ skip-networking FALSE skip-show-database FALSE skip-slave-start FALSE slave-compressed-protocol FALSE +slave-ddl-exec-mode IDEMPOTENT +slave-domain-parallel-threads 0 slave-exec-mode STRICT slave-max-allowed-packet 1073741824 slave-net-timeout 3600 diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index a473279ce40..c67a7a00425 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -5265,6 +5265,20 @@ slow_log CREATE TABLE `slow_log` ( SET @@global.log_output= @old_log_output_state; SET @@global.slow_query_log= @old_slow_query_log_state; SET @@global.general_log= @old_general_log_state; +# MDEV-5481 mysqldump fails to dump geometry types properly +create table t1 (g GEOMETRY) CHARSET koi8r; +create table t2 (g GEOMETRY) CHARSET koi8r; +insert into t1 values (point(1,1)), (point(2,2)); +################################################## +\0\0\0\0\0\0\0\0\0\0\0\0\0?\0\0\0\0\0\0? +\0\0\0\0\0\0\0\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@ +################################################## +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET koi8r; +select astext(g) from t2; +astext(g) +POINT(1 1) +POINT(2 2) +drop table t1, t2; # # End of 5.1 tests # diff --git a/mysql-test/r/not_embedded_server.result b/mysql-test/r/not_embedded_server.result index eccf6151d33..33c8bfdb5d6 100644 --- a/mysql-test/r/not_embedded_server.result +++ b/mysql-test/r/not_embedded_server.result @@ -6,6 +6,7 @@ slave_skip_errors OFF # Bug#58026: massive recursion and crash in regular expression handling # SELECT '1' RLIKE RPAD('1', 10000, '('); +Got one of the listed errors # # WL#4284: Transactional DDL locking # diff --git a/mysql-test/r/old-mode.result b/mysql-test/r/old-mode.result index eec08d4d5c8..b7e1ee26391 100644 --- a/mysql-test/r/old-mode.result +++ b/mysql-test/r/old-mode.result @@ -19,3 +19,84 @@ drop table t1,t2; SHOW PROCESSLIST; Id User Host db Command Time State Info root test Query