diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index cb61f9cfd70..b5f1c7b200e 100755 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -90,22 +90,19 @@ SSL_LIBRARY=--with-ssl if [ "x$warning_mode" != "xpedantic" ]; then # Both C and C++ warnings - warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W" - warnings="$warnings -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare" - warnings="$warnings -Wwrite-strings -Wunused-function -Wunused-label -Wunused-value -Wunused-variable" + warnings="-Wall -Wextra -Wunused -Wwrite-strings" # For more warnings, uncomment the following line -# warnings="$global_warnings -Wshadow" +# warnings="$warnings -Wshadow" # C warnings - c_warnings="$warnings -Wunused-parameter" + c_warnings="$warnings" # C++ warnings - cxx_warnings="$warnings" + cxx_warnings="$warnings -Wno-unused-parameter" # cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo" - cxx_warnings="$cxx_warnings -Wreorder" cxx_warnings="$cxx_warnings -Wctor-dtor-privacy -Wnon-virtual-dtor" # Added unless --with-debug=full - debug_extra_cflags="-O0 -g3 -gdwarf-2" #1 -Wuninitialized" + debug_extra_cflags="-O0 -g3 -gdwarf-2" else warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE" c_warnings="$warnings" diff --git a/BUILD/build_mccge.sh b/BUILD/build_mccge.sh index b85252028ae..aae017aa54d 100755 --- a/BUILD/build_mccge.sh +++ b/BUILD/build_mccge.sh @@ -1066,7 +1066,6 @@ set_with_debug_flags() if test "x$with_debug_flag" = "xyes" ; then if test "x$developer_flag" = "xyes" ; then loc_debug_flags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS " - loc_debug_flags="$loc_debug_flags" compiler_flags="$compiler_flags $loc_debug_flags" fi fi diff --git a/BUILD/check-cpu b/BUILD/check-cpu index eb001ee61ae..f9f5d423f4f 100755 --- a/BUILD/check-cpu +++ b/BUILD/check-cpu @@ -187,69 +187,76 @@ check_cpu () { cc=$CC fi - if test "x$compiler" = "x" ; then - cc_ver=`$cc --version | sed 1q` - cc_verno=`echo $cc_ver | sed -e 's/^.*(GCC)//g; s/[^0-9. ]//g; s/^ *//g; s/ .*//g'` + if test "x$core2" = "xyes" ; then + cpu_arg="core2" + fi + + if test "x$compiler" != "x" ; then + return 0 + fi + + # check if compiler is gcc and dump its version + cc_verno=`$cc -dumpversion 2>/dev/null` + if test "x$?" = "x0" ; then set -- `echo $cc_verno | tr '.' ' '` + cc_ver="GCC" cc_major=$1 cc_minor=$2 cc_patch=$3 cc_comp=`expr $cc_major '*' 100 '+' $cc_minor` - - case "$cc_ver--$cc_verno" in - *GCC*) - # different gcc backends (and versions) have different CPU flags - case `gcc -dumpmachine` in - i?86-* | x86_64-*) - if test "$cc_comp" -lt 304 ; then - check_cpu_cflags="-mcpu=${cpu_arg}" - elif test "$cc_comp" -ge 402 ; then - check_cpu_cflags="-mtune=native" - else - check_cpu_cflags="-mtune=${cpu_arg}" - fi - ;; - ppc-*) - check_cpu_cflags="-mcpu=${cpu_arg} -mtune=${cpu_arg}" - ;; - *) - check_cpu_cflags="" - return - ;; - esac - ;; - 2.95.*) - # GCC 2.95 doesn't expose its name in --version output - check_cpu_cflags="-m${cpu_arg}" - ;; - *) - check_cpu_cflags="" - return - ;; - esac - # now we check whether the compiler really understands the cpu type - touch __test.c + fi - while [ "$cpu_arg" ] ; do - printf "testing $cpu_arg ... " >&2 - - # compile check - eval "$cc -c $check_cpu_cflags __test.c" 2>/dev/null - if test "x$?" = "x0" ; then - echo ok >&2 - break; - fi - - echo failed >&2 + case "$cc_ver--$cc_verno" in + *GCC*) + # different gcc backends (and versions) have different CPU flags + case `gcc -dumpmachine` in + i?86-* | x86_64-*) + if test "$cc_comp" -lt 304 ; then + check_cpu_cflags="-mcpu=${cpu_arg}" + elif test "$cc_comp" -ge 402 ; then + check_cpu_cflags="-mtune=native" + else + check_cpu_cflags="-mtune=${cpu_arg}" + fi + ;; + ppc-*) + check_cpu_cflags="-mcpu=${cpu_arg} -mtune=${cpu_arg}" + ;; + *) + check_cpu_cflags="" + return + ;; + esac + ;; + 2.95.*) + # GCC 2.95 doesn't expose its name in --version output + check_cpu_cflags="-m${cpu_arg}" + ;; + *) check_cpu_cflags="" + return + ;; + esac + + # now we check whether the compiler really understands the cpu type + touch __test.c + + while [ "$cpu_arg" ] ; do + printf "testing $cpu_arg ... " >&2 + + # compile check + eval "$cc -c $check_cpu_cflags __test.c" 2>/dev/null + if test "x$?" = "x0" ; then + echo ok >&2 break; - done - rm __test.* - fi - if test "x$core2" = "xyes" ; then - cpu_arg="core2" - fi + fi + + echo failed >&2 + check_cpu_cflags="" + break; + done + rm __test.* return 0 } - + check_cpu diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100755 new mode 100644 index cb71cb6aefc..4ff2507dcc3 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,6 +104,27 @@ IF(DEFINED ENV{CPPFLAGS}) ADD_DEFINITIONS($ENV{CPPFLAGS}) ENDIF() +# +# Control aspects of the development environment which are +# specific to MySQL maintainers and developers. +# +OPTION(MYSQL_MAINTAINER_MODE "MySQL maintainer-specific development environment" OFF) +# Whether the maintainer mode should be enabled. +IF(MYSQL_MAINTAINER_MODE) + IF(CMAKE_COMPILER_IS_GNUCC) + SET(MY_MAINTAINER_C_WARNINGS "-Wall -Wextra -Wunused -Wwrite-strings -Werror" + CACHE STRING "C warning options used in maintainer builds.") + ENDIF() + IF(CMAKE_COMPILER_IS_GNUCXX) + SET(MY_MAINTAINER_CXX_WARNINGS "${MY_MAINTAINER_C_WARNINGS} -Wno-unused-parameter" + CACHE STRING "C++ warning options used in maintainer builds.") + ENDIF() + # Do not make warnings in checks into errors. + IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX) + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wno-error") + ENDIF() +ENDIF() + # Add macros INCLUDE(character_sets) INCLUDE(zlib) @@ -226,6 +247,19 @@ MYSQL_CHECK_SSL() # Add readline or libedit. MYSQL_CHECK_READLINE() +# +# Setup maintainer mode options by the end. Platform checks are +# not run with the warning options as to not perturb fragile checks +# (i.e. do not make warnings into errors). +# +IF(MYSQL_MAINTAINER_MODE) + # Set compiler flags required under maintainer mode. + MESSAGE(STATUS "C warning options: ${MY_MAINTAINER_C_WARNINGS}") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MY_MAINTAINER_C_WARNINGS}") + MESSAGE(STATUS "C++ warning options: ${MY_MAINTAINER_CXX_WARNINGS}") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_MAINTAINER_CXX_WARNINGS}") +ENDIF() + IF(NOT WITHOUT_SERVER) SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "") # Add storage engines and plugins. diff --git a/Makefile.am b/Makefile.am index 91174568026..297e923905e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -27,7 +27,7 @@ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \ @pstack_dir@ libservices \ @sql_union_dirs@ unittest \ @sql_server@ @man_dirs@ tests \ - netware @libmysqld_dirs@ \ + @libmysqld_dirs@ \ mysql-test support-files sql-bench \ win \ cmake @@ -36,7 +36,7 @@ DIST_SUBDIRS = . include Docs zlib \ pstack libservices \ strings mysys dbug extra regex libmysql libmysql_r client unittest storage plugin \ vio sql man tests \ - netware libmysqld \ + libmysqld \ mysql-test support-files sql-bench \ win \ cmake \ diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/client/client_priv.h b/client/client_priv.h index b0991c0134f..e7911fc31f7 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -60,7 +60,7 @@ enum options_client OPT_IMPORT_USE_THREADS, OPT_MYSQL_NUMBER_OF_QUERY, OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE, - OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_CREATE_SLAP_SCHEMA, + OPT_TZ_UTC, OPT_CREATE_SLAP_SCHEMA, OPT_MYSQLDUMP_SLAVE_APPLY, OPT_MYSQLDUMP_SLAVE_DATA, OPT_MYSQLDUMP_INCLUDE_MASTER_HOST_PORT, diff --git a/client/mysql.cc b/client/mysql.cc index d64bd8f686a..abf01d8127d 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -88,10 +88,9 @@ extern "C" { #endif #endif -#undef bcmp // Fix problem with new readline #if defined(__WIN__) #include -#elif !defined(__NETWARE__) +#else #include #define HAVE_READLINE #endif @@ -109,7 +108,7 @@ extern "C" { #define cmp_database(cs,A,B) strcmp((A),(B)) #endif -#if !defined(__WIN__) && !defined(__NETWARE__) && !defined(THREAD) +#if !defined(__WIN__) && !defined(THREAD) #define USE_POPEN #endif @@ -1365,10 +1364,6 @@ static struct my_option my_long_options[] = 0, 0, 0, 0, 0}, {"help", 'I', "Synonym for -?", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"auto-rehash", OPT_AUTO_REHASH, "Enable automatic rehashing. One doesn't need to use 'rehash' to get table " "and field completion, but startup and reconnecting may take a longer time. " @@ -1582,11 +1577,6 @@ static struct my_option my_long_options[] = static void usage(int version) { - /* Divert all help information on NetWare to logger screen. */ -#ifdef __NETWARE__ -#define printf consoleprintf -#endif - #if defined(USE_LIBEDIT_INTERFACE) const char* readline= ""; #else @@ -1609,10 +1599,6 @@ static void usage(int version) my_print_help(my_long_options); print_defaults("my", load_default_groups); my_print_variables(my_long_options); - NETWARE_SET_SCREEN_MODE(1); -#ifdef __NETWARE__ -#undef printf -#endif } @@ -1621,11 +1607,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), char *argument) { switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case OPT_CHARSETS_DIR: strmake(mysql_charsets_dir, argument, sizeof(mysql_charsets_dir) - 1); charsets_dir = mysql_charsets_dir; @@ -1851,10 +1832,6 @@ static int get_options(int argc, char **argv) static int read_and_execute(bool interactive) { -#if defined(__NETWARE__) - char linebuffer[254]; - String buffer; -#endif #if defined(__WIN__) String tmpbuf; String buffer; @@ -1900,18 +1877,8 @@ static int read_and_execute(bool interactive) if (opt_outfile && glob_buffer.is_empty()) fflush(OUTFILE); -#if defined(__WIN__) || defined(__NETWARE__) +#if defined(__WIN__) tee_fputs(prompt, stdout); -#if defined(__NETWARE__) - line=fgets(linebuffer, sizeof(linebuffer)-1, stdin); - /* Remove the '\n' */ - if (line) - { - char *p = strrchr(line, '\n'); - if (p != NULL) - *p = '\0'; - } -#else if (!tmpbuf.is_alloced()) tmpbuf.alloc(65535); tmpbuf.length(0); @@ -1932,12 +1899,11 @@ static int read_and_execute(bool interactive) */ if (line) line= buffer.c_ptr(); -#endif /* __NETWARE__ */ #else if (opt_outfile) fputs(prompt, OUTFILE); line= readline(prompt); -#endif /* defined(__WIN__) || defined(__NETWARE__) */ +#endif /* defined(__WIN__) */ /* When Ctrl+d or Ctrl+z is pressed, the line may be NULL on some OS @@ -1985,10 +1951,8 @@ static int read_and_execute(bool interactive) } } -#if defined(__WIN__) || defined(__NETWARE__) - buffer.free(); -#endif #if defined(__WIN__) + buffer.free(); tmpbuf.free(); #endif @@ -3945,8 +3909,6 @@ static int com_quit(String *buffer __attribute__((unused)), char *line __attribute__((unused))) { - /* let the screen auto close on a normal shutdown */ - NETWARE_SET_SCREEN_MODE(SCR_AUTOCLOSE_ON_EXIT); status.exit_status=0; return 1; } @@ -4664,7 +4626,6 @@ void tee_fprintf(FILE *file, const char *fmt, ...) { va_list args; - NETWARE_YIELD; va_start(args, fmt); (void) vfprintf(file, fmt, args); va_end(args); @@ -4680,7 +4641,6 @@ void tee_fprintf(FILE *file, const char *fmt, ...) void tee_fputs(const char *s, FILE *file) { - NETWARE_YIELD; fputs(s, file); if (opt_outfile) fputs(s, OUTFILE); @@ -4689,7 +4649,6 @@ void tee_fputs(const char *s, FILE *file) void tee_puts(const char *s, FILE *file) { - NETWARE_YIELD; fputs(s, file); fputc('\n', file); if (opt_outfile) @@ -4706,7 +4665,7 @@ void tee_putc(int c, FILE *file) putc(c, OUTFILE); } -#if defined(__WIN__) || defined(__NETWARE__) +#if defined(__WIN__) #include #else #include @@ -4718,8 +4677,8 @@ void tee_putc(int c, FILE *file) static ulong start_timer(void) { -#if defined(__WIN__) || defined(__NETWARE__) - return clock(); +#if defined(__WIN__) + return clock(); #else struct tms tms_tmp; return times(&tms_tmp); diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 0ad44f3d20d..20436200c7e 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -57,8 +57,6 @@ static my_bool not_used; /* Can't use GET_BOOL without a value pointer */ static my_bool opt_write_binlog; -#include - static struct my_option my_long_options[]= { {"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG, @@ -139,8 +137,6 @@ static struct my_option my_long_options[]= {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; -#include - static void free_used_memory(void) { @@ -809,9 +805,6 @@ int main(int argc, char **argv) char self_name[FN_REFLEN]; MY_INIT(argv[0]); -#ifdef __NETWARE__ - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); -#endif #if __WIN__ if (GetModuleFileName(NULL, self_name, FN_REFLEN) == 0) diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index bf0dec01d2f..69381b749a1 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -116,10 +116,6 @@ static TYPELIB command_typelib= static struct my_option my_long_options[] = { -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"count", 'c', "Number of iterations to make. This works with -i (--sleep) only.", &nr_iterations, &nr_iterations, 0, GET_UINT, @@ -222,11 +218,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), int error = 0; switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'c': opt_count_iterations= 1; break; @@ -1068,13 +1059,11 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) return 0; } -#include static void print_version(void) { printf("%s Ver %s Distrib %s, for %s on %s\n",my_progname,ADMIN_VERSION, MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } @@ -1118,7 +1107,6 @@ static void usage(void) version Get version info from server"); } -#include static int drop_db(MYSQL *mysql, const char *db) { diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index a7875d63aa2..277c2d62544 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -436,7 +436,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname, ptr= fname + target_dir_name_len; memcpy(ptr,bname,blen); ptr+= blen; - ptr+= my_sprintf(ptr, (ptr, "-%x", file_id)); + ptr+= sprintf(ptr, "-%x", file_id); if ((file= create_unique_file(fname,ptr)) < 0) { @@ -1002,10 +1002,6 @@ static struct my_option my_long_options[] = { {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"base64-output", OPT_BASE64_OUTPUT_MODE, /* 'unspec' is not mentioned because it is just a placeholder. */ "Determine when the output statements should be base64-encoded BINLOG " @@ -1233,12 +1229,10 @@ static void cleanup() mysql_close(mysql); } -#include static void print_version() { printf("%s Ver 3.3 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } @@ -1280,7 +1274,6 @@ static my_time_t convert_str_to_timestamp(const char* str) my_system_gmt_sec(&l_time, &dummy_my_timezone, &dummy_in_dst_time_gap); } -#include extern "C" my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), @@ -1288,11 +1281,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), { bool tty_password=0; switch (optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif #ifndef DBUG_OFF case '#': DBUG_PUSH(argument ? argument : default_dbug_option); diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 2c9c563e17f..ce733e57db6 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -62,10 +62,6 @@ static struct my_option my_long_options[] = "Instead of issuing one query for each table, use one query per database, naming all tables in the database in a comma-separated list.", &opt_all_in_1, &opt_all_in_1, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"auto-repair", OPT_AUTO_REPAIR, "If a checked table is corrupted, automatically fix it. Repairing will be done after all tables have been checked, if corrupted ones were found.", &opt_auto_repair, &opt_auto_repair, 0, GET_BOOL, NO_ARG, 0, @@ -208,13 +204,11 @@ static uint fixed_name_length(const char *name); static char *fix_table_name(char *dest, char *src); int what_to_do = 0; -#include static void print_version(void) { printf("%s Ver %s Distrib %s, for %s (%s)\n", my_progname, CHECK_VERSION, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } /* print_version */ @@ -245,18 +239,12 @@ static void usage(void) my_print_variables(my_long_options); } /* usage */ -#include static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), char *argument) { switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'a': what_to_do = DO_ANALYZE; break; @@ -708,8 +696,7 @@ static int handle_request_for_tables(char *tables, uint length) if (opt_all_in_1) { /* No backticks here as we added them before */ - query_length= my_sprintf(query, - (query, "%s TABLE %s %s", op, tables, options)); + query_length= sprintf(query, "%s TABLE %s %s", op, tables, options); } else { diff --git a/client/mysqldump.c b/client/mysqldump.c index 6d294153c54..68cfde864b5 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -212,10 +212,6 @@ static struct my_option my_long_options[] = "Adds 'STOP SLAVE' prior to 'CHANGE MASTER' and 'START SLAVE' to bottom of dump.", &opt_slave_apply, &opt_slave_apply, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"character-sets-dir", OPT_CHARSETS_DIR, "Directory for character set files.", &charsets_dir, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -433,10 +429,10 @@ static struct my_option my_long_options[] = &opt_replace_into, &opt_replace_into, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"result-file", 'r', - "Direct output to a given file. This option should be used in MSDOS, " - "because it prevents new line '\\n' from being converted to '\\r\\n' " - "(carriage return + line feed).", - 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + "Direct output to a given file. This option should be used in systems " + "(e.g., DOS, Windows) that use carriage-return linefeed pairs (\\r\\n) " + "to separate text lines. This option ensures that only a single newline " + "is used.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"routines", 'R', "Dump stored routines (functions and procedures).", &opt_routines, &opt_routines, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -531,7 +527,6 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables) static int dump_tablespaces_for_databases(char** databases); static int dump_tablespaces(char* ts_where); -#include /* Print the supplied message if in verbose mode @@ -575,7 +570,6 @@ static void print_version(void) { printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,DUMP_VERSION, MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } /* print_version */ @@ -585,7 +579,6 @@ static void short_usage_sub(void) printf("OR %s [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]\n", my_progname); printf("OR %s [OPTIONS] --all-databases [OPTIONS]\n", my_progname); - NETWARE_SET_SCREEN_MODE(1); } @@ -608,8 +601,6 @@ static void short_usage(void) printf("For more options, use %s --help\n", my_progname); } -#include - static void write_header(FILE *sql_file, char *db_name) { @@ -728,11 +719,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), char *argument) { switch (optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'p': if (argument == disabled_my_option) argument= (char*) ""; /* Don't require password */ diff --git a/client/mysqlimport.c b/client/mysqlimport.c index fdb521b9cf8..3d71e437e40 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -67,10 +67,6 @@ static char *shared_memory_base_name=0; static struct my_option my_long_options[] = { -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"character-sets-dir", OPT_CHARSETS_DIR, "Directory for character set files.", &charsets_dir, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -184,13 +180,11 @@ static struct my_option my_long_options[] = static const char *load_default_groups[]= { "mysqlimport","client",0 }; -#include static void print_version(void) { printf("%s Ver %s Distrib %s, for %s (%s)\n" ,my_progname, IMPORT_VERSION, MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } @@ -212,18 +206,12 @@ file. The SQL command 'LOAD DATA INFILE' is used to import the rows.\n"); my_print_variables(my_long_options); } -#include static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), char *argument) { switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'p': if (argument == disabled_my_option) argument= (char*) ""; /* Don't require password */ diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 76f9048e09e..bb05400e0d8 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -160,10 +160,6 @@ int main(int argc, char **argv) static struct my_option my_long_options[] = { -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"character-sets-dir", 'c', "Directory for character set files.", &charsets_dir, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -240,14 +236,11 @@ static struct my_option my_long_options[] = {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; - -#include static void print_version(void) { printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,SHOW_VERSION, MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } @@ -270,18 +263,12 @@ are shown."); my_print_variables(my_long_options); } -#include static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), char *argument) { switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'v': opt_verbose++; break; @@ -670,8 +657,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table, char query[1024],*end; MYSQL_RES *result; MYSQL_ROW row; - ulong rows; - LINT_INIT(rows); + ulong UNINIT_VAR(rows); if (mysql_select_db(mysql,db)) { diff --git a/client/mysqlslap.c b/client/mysqlslap.c index e411b096d68..e605e2d522c 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -676,8 +676,6 @@ static struct my_option my_long_options[] = }; -#include - static void print_version(void) { printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname, SLAP_VERSION, @@ -696,7 +694,6 @@ static void usage(void) my_print_help(my_long_options); } -#include static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), @@ -704,11 +701,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), { DBUG_ENTER("get_one_option"); switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'v': verbose++; break; diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 9845a3ec060..c8ec6c981ef 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -3707,7 +3707,6 @@ void do_send_quit(struct st_command *command) void do_change_user(struct st_command *command) { MYSQL *mysql = &cur_con->mysql; - /* static keyword to make the NetWare compiler happy. */ static DYNAMIC_STRING ds_user, ds_passwd, ds_db; const struct command_arg change_user_args[] = { { "user", ARG_STRING, FALSE, &ds_user, "User to connect as" }, @@ -5828,7 +5827,7 @@ int read_command(struct st_command** command_ptr) (struct st_command*) my_malloc(sizeof(*command), MYF(MY_WME|MY_ZEROFILL))) || insert_dynamic(&q_lines, (uchar*) &command)) - die(NullS); + die("Out of memory"); command->type= Q_UNKNOWN; read_command_buf[0]= 0; @@ -6006,8 +6005,6 @@ static struct my_option my_long_options[] = }; -#include - void print_version(void) { printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,MTEST_VERSION, @@ -6026,8 +6023,6 @@ void usage() my_print_variables(my_long_options); } -#include - /* Read arguments for embedded server and put them into @@ -6319,7 +6314,7 @@ void init_win_path_patterns() } if (insert_dynamic(&patterns, (uchar*) &p)) - die(NullS); + die("Out of memory"); DBUG_PRINT("info", ("p: %s", p)); while (*p) @@ -9411,8 +9406,7 @@ REPLACE *init_replace(char * *from, char * *to,uint count, for (i=1 ; i <= found_sets ; i++) { pos=from[found_set[i-1].table_offset]; - rep_str[i].found= !bcmp((const uchar*) pos, - (const uchar*) "\\^", 3) ? 2 : 1; + rep_str[i].found= !memcmp(pos, "\\^", 3) ? 2 : 1; rep_str[i].replace_string=to_array[found_set[i-1].table_offset]; rep_str[i].to_offset=found_set[i-1].found_offset-start_at_word(pos); rep_str[i].from_offset=found_set[i-1].found_offset-replace_len(pos)+ @@ -9540,8 +9534,8 @@ void copy_bits(REP_SET *to,REP_SET *from) int cmp_bits(REP_SET *set1,REP_SET *set2) { - return bcmp((uchar*) set1->bits,(uchar*) set2->bits, - sizeof(uint) * set1->size_of_bits); + return memcmp(set1->bits, set2->bits, + sizeof(uint) * set1->size_of_bits); } @@ -9610,17 +9604,15 @@ int find_found(FOUND_SET *found_set,uint table_offset, int found_offset) uint start_at_word(char * pos) { - return (((!bcmp((const uchar*) pos, (const uchar*) "\\b",2) && pos[2]) || - !bcmp((const uchar*) pos, (const uchar*) "\\^", 2)) ? 1 : 0); + return (((!memcmp(pos, "\\b",2) && pos[2]) || + !memcmp(pos, "\\^", 2)) ? 1 : 0); } uint end_of_word(char * pos) { char * end=strend(pos); - return ((end > pos+2 && !bcmp((const uchar*) end-2, - (const uchar*) "\\b", 2)) || - (end >= pos+2 && !bcmp((const uchar*) end-2, - (const uchar*) "\\$",2))) ? 1 : 0; + return ((end > pos+2 && !memcmp(end-2, "\\b", 2)) || + (end >= pos+2 && !memcmp(end-2, "\\$",2))) ? 1 : 0; } /**************************************************************************** diff --git a/cmake/configure.pl b/cmake/configure.pl index fba417365fc..5be47ce5a31 100644 --- a/cmake/configure.pl +++ b/cmake/configure.pl @@ -184,6 +184,12 @@ foreach my $option (@ARGV) $cmakeargs = $cmakeargs." -DWITH_DEBUG_FULL=1"; next; } + if ($option =~ /mysql-maintainer-mode/) + { + $cmakeargs = $cmakeargs." -DMYSQL_MAINTAINER_MODE=" . + ($option =~ /enable/ ? "1" : "0"); + next; + } $option = uc($option); $option =~ s/-/_/g; diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake old mode 100755 new mode 100644 diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake index 68b6f2a6ddf..e07e3f54aa8 100644 --- a/cmake/os/WindowsCache.cmake +++ b/cmake/os/WindowsCache.cmake @@ -30,7 +30,6 @@ SET(HAVE_ASM_MSR_H CACHE INTERNAL "") SET(HAVE_BACKTRACE CACHE INTERNAL "") SET(HAVE_BACKTRACE_SYMBOLS CACHE INTERNAL "") SET(HAVE_BACKTRACE_SYMBOLS_FD CACHE INTERNAL "") -SET(HAVE_BCMP CACHE INTERNAL "") SET(HAVE_BFILL CACHE INTERNAL "") SET(HAVE_BMOVE CACHE INTERNAL "") SET(HAVE_BSD_SIGNALS CACHE INTERNAL "") diff --git a/cmake/package_name.cmake b/cmake/package_name.cmake index 6e6fe89e8b3..b027ac3901f 100644 --- a/cmake/package_name.cmake +++ b/cmake/package_name.cmake @@ -26,11 +26,10 @@ IF(NOT VERSION) SET(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE 1) SET(DEFAULT_PLATFORM ${CMAKE_SYSTEM_NAME}) SET(DEFAULT_MACHINE ${CMAKE_SYSTEM_PROCESSOR}) - MESSAGE("SIZEOF_VOIDP=${SIZEOF_VOIDP}") IF(SIZEOF_VOIDP EQUAL 8) SET(64BIT 1) ENDIF() - + IF(CMAKE_SYSTEM_NAME MATCHES "Windows") SET(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE 0) SET(DEFAULT_PLATFORM "win") diff --git a/cmd-line-utils/readline/Makefile.am b/cmd-line-utils/readline/Makefile.am index 40e74ccaf55..48d3af34412 100644 --- a/cmd-line-utils/readline/Makefile.am +++ b/cmd-line-utils/readline/Makefile.am @@ -31,4 +31,4 @@ noinst_HEADERS = readline.h chardefs.h keymaps.h \ EXTRA_DIST= emacs_keymap.c vi_keymap.c CMakeLists.txt -DEFS = -DMYSQL_CLIENT_NO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR +DEFS = -DMYSQL_CLIENT_NO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR -D_GNU_SOURCE=1 diff --git a/config.h.cmake b/config.h.cmake index 7bef260cf4e..2d877ed853f 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -125,7 +125,6 @@ #cmakedefine HAVE_AIOWAIT 1 #cmakedefine HAVE_ALARM 1 #cmakedefine HAVE_ALLOCA 1 -#cmakedefine HAVE_BCMP 1 #cmakedefine HAVE_BFILL 1 #cmakedefine HAVE_BMOVE 1 #cmakedefine HAVE_BZERO 1 diff --git a/config/ac-macros/maintainer.m4 b/config/ac-macros/maintainer.m4 new file mode 100644 index 00000000000..1b7df75d6f7 --- /dev/null +++ b/config/ac-macros/maintainer.m4 @@ -0,0 +1,64 @@ +# +# Control aspects of the development environment which are +# specific to MySQL maintainers and developers. +# +AC_DEFUN([MY_MAINTAINER_MODE], [ + AC_MSG_CHECKING([whether to enable the maintainer-specific development environment]) + AC_ARG_ENABLE([mysql-maintainer-mode], + [AS_HELP_STRING([--enable-mysql-maintainer-mode], + [Enable a MySQL maintainer-specific development environment])], + [USE_MYSQL_MAINTAINER_MODE=$enableval], + [USE_MYSQL_MAINTAINER_MODE=no]) + AC_MSG_RESULT([$USE_MYSQL_MAINTAINER_MODE]) +]) + +# Set warning options required under maintainer mode. +AC_DEFUN([MY_MAINTAINER_MODE_WARNINGS], [ + # Setup GCC warning options. + AS_IF([test "$GCC" = "yes"], [ + C_WARNINGS="-Wall -Wextra -Wunused -Wwrite-strings -Werror" + CXX_WARNINGS="${C_WARNINGS} -Wno-unused-parameter" + ]) + + # Test whether the warning options work. + # Test C options + AS_IF([test -n "$C_WARNINGS"], [ + save_CFLAGS="$CFLAGS" + AC_MSG_CHECKING([whether to use C warning options ${C_WARNINGS}]) + AC_LANG_PUSH(C) + CFLAGS="$CFLAGS ${C_WARNINGS}" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [myac_c_warning_flags=yes], + [myac_c_warning_flags=no]) + AC_LANG_POP() + AC_MSG_RESULT([$myac_c_warning_flags]) + CFLAGS="$save_CFLAGS" + ]) + + # Test C++ options + AS_IF([test -n "$CXX_WARNINGS"], [ + save_CXXFLAGS="$CXXFLAGS" + AC_MSG_CHECKING([whether to use C++ warning options ${CXX_WARNINGS}]) + AC_LANG_PUSH(C++) + CXXFLAGS="$CXXFLAGS ${CXX_WARNINGS}" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [myac_cxx_warning_flags=yes], + [myac_cxx_warning_flags=no]) + AC_LANG_POP() + AC_MSG_RESULT([$myac_cxx_warning_flags]) + CXXFLAGS="$save_CXXFLAGS" + ]) + + # Set compile flag variables. + AS_IF([test "$myac_c_warning_flags" = "yes"], [ + AM_CFLAGS="${AM_CFLAGS} ${C_WARNINGS}" + AC_SUBST([AM_CFLAGS])]) + AS_IF([test "$myac_cxx_warning_flags" = "yes"], [ + AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS}" + AC_SUBST([AM_CXXFLAGS])]) +]) + + +# Set compiler flags required under maintainer mode. +AC_DEFUN([MY_MAINTAINER_MODE_SETUP], [ + AS_IF([test "$USE_MYSQL_MAINTAINER_MODE" = "yes"], + [MY_MAINTAINER_MODE_WARNINGS]) +]) diff --git a/config/ac-macros/misc.m4 b/config/ac-macros/misc.m4 index 996ac62e025..89de1e5f8fa 100644 --- a/config/ac-macros/misc.m4 +++ b/config/ac-macros/misc.m4 @@ -617,25 +617,19 @@ fi AC_DEFUN([MYSQL_CHECK_CXX_VERSION], [ -case $SYSTEM_TYPE in - *netware*) - CXX_VERSION=`$CXX -version | grep -i version` - ;; - *) - CXX_VERSION=`$CXX --version | sed 1q` - if test $? -ne "0" -o -z "$CXX_VERSION" - then - CXX_VERSION=`$CXX -V 2>&1|sed 1q` # trying harder for Sun and SGI - fi - if test $? -ne "0" -o -z "$CXX_VERSION" - then - CXX_VERSION=`$CXX -v 2>&1|sed 1q` # even harder for Alpha - fi - if test $? -ne "0" -o -z "$CXX_VERSION" - then - CXX_VERSION="" - fi -esac +CXX_VERSION=`$CXX --version | sed 1q` +if test $? -ne "0" -o -z "$CXX_VERSION" +then + CXX_VERSION=`$CXX -V 2>&1|sed 1q` # trying harder for Sun and SGI +fi +if test $? -ne "0" -o -z "$CXX_VERSION" +then + CXX_VERSION=`$CXX -v 2>&1|sed 1q` # even harder for Alpha +fi +if test $? -ne "0" -o -z "$CXX_VERSION" +then + CXX_VERSION="" +fi if test "$CXX_VERSION" then AC_MSG_CHECKING("C++ compiler version") diff --git a/configure.cmake b/configure.cmake index 462e359ee7d..ab3d706ee01 100644 --- a/configure.cmake +++ b/configure.cmake @@ -273,7 +273,6 @@ CHECK_FUNCTION_EXISTS (backtrace HAVE_BACKTRACE) CHECK_FUNCTION_EXISTS (backtrace_symbols HAVE_BACKTRACE_SYMBOLS) CHECK_FUNCTION_EXISTS (backtrace_symbols_fd HAVE_BACKTRACE_SYMBOLS_FD) CHECK_FUNCTION_EXISTS (printstack HAVE_PRINTSTACK) -CHECK_FUNCTION_EXISTS (bcmp HAVE_BCMP) CHECK_FUNCTION_EXISTS (bfill HAVE_BFILL) CHECK_FUNCTION_EXISTS (bmove HAVE_BMOVE) CHECK_FUNCTION_EXISTS (bsearch HAVE_BSEARCH) diff --git a/configure.in b/configure.in index 4dbf858232a..a2f0c432681 100644 --- a/configure.in +++ b/configure.in @@ -80,6 +80,7 @@ MYSQL_TCP_PORT_DEFAULT=3306 MYSQL_UNIX_ADDR_DEFAULT="/tmp/mysql.sock" dnl Include m4 +sinclude(config/ac-macros/maintainer.m4) sinclude(config/ac-macros/alloca.m4) sinclude(config/ac-macros/check_cpu.m4) sinclude(config/ac-macros/character_sets.m4) @@ -118,6 +119,8 @@ AC_SUBST(SHARED_LIB_MAJOR_VERSION) AC_SUBST(SHARED_LIB_VERSION) AC_SUBST(AVAILABLE_LANGUAGES) +# Whether the maintainer mode should be enabled. +MY_MAINTAINER_MODE # Canonicalize the configuration name. @@ -226,14 +229,7 @@ AC_PROG_CXX AC_PROG_CPP # Print version of CC and CXX compiler (if they support --version) -case $SYSTEM_TYPE in - *netware*) -CC_VERSION=`$CC -version | grep -i version` - ;; - *) CC_VERSION=`$CC --version | sed 1q` - ;; -esac if test $? -eq "0" then AC_MSG_CHECKING("C Compiler version") @@ -291,40 +287,6 @@ AC_CHECK_PROGS(YACC, ['bison -y -p MYSQL']) AC_CHECK_PROG(PDFMANUAL, pdftex, manual.pdf) AC_CHECK_PROG(DVIS, tex, manual.dvi) -#check the return type of sprintf -AC_MSG_CHECKING("return type of sprintf") -AC_TRY_RUN([ - int main() - { - char* s = "hello"; - char buf[6]; - if((int)sprintf(buf, s) == strlen(s)) - return 0; - - return -1; - } - ], - [AC_DEFINE(SPRINTF_RETURNS_INT, [1], [POSIX sprintf]) - AC_MSG_RESULT("int")], - [AC_TRY_RUN([ - int main() - { - char* s = "hello"; - char buf[6]; - if((char*)sprintf(buf,s) == buf + strlen(s)) - return 0; - return -1; - } ], - [AC_DEFINE(SPRINTF_RETURNS_PTR, [1], [Broken sprintf]) - AC_MSG_RESULT("ptr")], - [AC_DEFINE(SPRINTF_RETURNS_GARBAGE, [1], [Broken sprintf]) - AC_MSG_RESULT("garbage")] - )], - # Cross compile, assume POSIX - [AC_DEFINE(SPRINTF_RETURNS_INT, [1], [POSIX sprintf]) - AC_MSG_RESULT("int (we assume)")] -) - AC_PATH_PROG(uname_prog, uname, no) # We should go through this and put all the explictly system dependent @@ -458,15 +420,10 @@ dnl Find paths to some shell programs AC_PATH_PROG(LN, ln, ln) # This must be able to take a -f flag like normal unix ln. AC_PATH_PROG(LN_CP_F, ln, ln) -case $SYSTEM_TYPE in - *netware*) ;; - *) - # If ln -f does not exists use -s (AFS systems) - if test -n "$LN_CP_F"; then - LN_CP_F="$LN_CP_F -s" - fi - ;; -esac +# If ln -f does not exists use -s (AFS systems) +if test -n "$LN_CP_F"; then + LN_CP_F="$LN_CP_F -s" +fi AC_PATH_PROG(MV, mv, mv) AC_PATH_PROG(RM, rm, rm) @@ -506,7 +463,16 @@ if test "$GCC" != "yes" || expr "$CC" : ".*icc.*" then ABI_CHECK="" else - ABI_CHECK="abi_check" + # Workaround GCC >= 4.5 - See Bug#52514 + case `$CC -dumpversion` in + [[4-9]].[[5-9]]*) + AC_MSG_WARN([ABI check disabled (GCC >= 4.5)]) + ABI_CHECK="" + ;; + *) + ABI_CHECK="abi_check" + ;; + esac fi AC_SUBST(ABI_CHECK) @@ -550,9 +516,6 @@ else *cygwin*) FIND_PROC="$PS -e | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" | grep \" \$\$PID \" > /dev/null" ;; - *netware*) - FIND_PROC= - ;; *) AC_MSG_ERROR([Could not find the right ps and/or grep switches. Which OS is this? See the Installation chapter in the Reference Manual.]) esac @@ -1354,98 +1317,6 @@ dnl Is this the right match for DEC OSF on alpha? # fix to handle include of correctly on OSF1 with cxx compiler CXXFLAGS="$CXXFLAGS -I/usr/include/cxx -I/usr/include/cxx_cname -I/usr/include -I/usr/include.dtk" ;; - *netware*) - # No need for curses library so set it to null - with_named_curses="" - - # No thread library - in LibC - with_named_thread="" - - # - # Edit Makefile.in files. - # - echo -n "configuring Makefile.in files for NetWare... " - for file in sql/Makefile.in extra/Makefile.in client/Makefile.in - do - # echo "#### $file ####" - filedir="`dirname $file`" - filebase="`basename $file`" - filesed=$filedir/$filebase.sed - # - # Backup and always use original file - # - if test -f $file.bk - then - cp -fp $file.bk $file - else - cp -fp $file $file.bk - fi - case $file in - sql/Makefile.in) - # Use gen_lex_hash.linux instead of gen_lex_hash - # Add library dependencies to mysqld_DEPENDENCIES - lib_DEPENDENCIES="\$(pstack_libs) \$(openssl_libs) \$(yassl_libs)" - cat > $filesed << EOF -s,\(\./gen_lex_hash\)\$(EXEEXT),\1.linux, -s%\(mysqld_DEPENDENCIES = \)%\1$lib_DEPENDENCIES % -EOF - ;; - extra/Makefile.in) - cat > $filesed << EOF -s,\(extra/comp_err\)\$(EXEEXT),\1.linux, -EOF - ;; - libmysql/Makefile.in) - cat > $filesed << EOF -s,libyassl.la,.libs/libyassl.a, -s,libtaocrypt.la,.libs/libtaocrypt.a, -EOF - ;; - libmysql_r/Makefile.in) - cat > $filesed << EOF -s,libyassl.la,.libs/libyassl.a, -s,libtaocrypt.la,.libs/libtaocrypt.a, -EOF - ;; - client/Makefile.in) - # - cat > $filesed << EOF -s,libmysqlclient.la,.libs/libmysqlclient.a, -EOF - ;; - esac - if `sed -f $filesed $file > $file.nw`;\ - then - mv -f $file.nw $file - rm -f $filesed - else - exit 1 - fi - # wait for file system changes to complete - sleep 1 - done - echo "done" - - # - # Make sure the following files are writable. - # - # When the files are retrieved from some source code control systems they are read-only. - # - echo -n "making sure specific build files are writable... " - for file in \ - Docs/manual.chm \ - Docs/mysql.info \ - Docs/INSTALL-BINARY \ - INSTALL-SOURCE \ - COPYING - do - if test -e $file; then - chmod +w $file - fi - done - echo "done" - - ;; esac @@ -1818,12 +1689,7 @@ esac # System characteristics -case $SYSTEM_TYPE in - *netware*) ;; - *) AC_SYS_RESTARTABLE_SYSCALLS - ;; -esac # Build optimized or debug version ? # First check for gcc and g++ @@ -1863,17 +1729,6 @@ else esac fi -case $SYSTEM_TYPE in - *netware*) - DEBUG_CFLAGS="-g -DDEBUG -sym internal,codeview4" - DEBUG_CXXFLAGS="-g -DDEBUG -sym internal,codeview4" - DEBUG_OPTIMIZE_CC="-DDEBUG" - DEBUG_OPTIMIZE_CXX="-DDEBUG" - OPTIMIZE_CFLAGS="-O3 -DNDEBUG" - OPTIMIZE_CXXFLAGS="-O3 -DNDEBUG" - ;; -esac - # If the user specified CFLAGS, we won't add any optimizations if test -n "$SAVE_CFLAGS" then @@ -2221,18 +2076,13 @@ MYSQL_TZNAME # Do the c++ compiler have a bool type MYSQL_CXX_BOOL # Check some common bugs with gcc 2.8.# on sparc -case $SYSTEM_TYPE in - *netware*) ;; - *) - MYSQL_CHECK_LONGLONG_TO_FLOAT - if test "$ac_cv_conv_longlong_to_float" != "yes" - then - AC_MSG_ERROR([Your compiler cannot convert a longlong value to a float! - If you are using gcc 2.8.# you should upgrade to egcs 1.0.3 or newer and try - again]) - fi - ;; -esac +MYSQL_CHECK_LONGLONG_TO_FLOAT +if test "$ac_cv_conv_longlong_to_float" != "yes" +then + AC_MSG_ERROR([Your compiler cannot convert a longlong value to a float! + If you are using gcc 2.8.# you should upgrade to egcs 1.0.3 + or newer and try again]) +fi AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include ]) AC_CHECK_TYPES([size_t], [], [], [#include ]) AC_CHECK_TYPES([u_int32_t]) @@ -2340,7 +2190,7 @@ MYSQL_TYPE_QSORT AC_FUNC_UTIME_NULL AC_FUNC_VPRINTF -AC_CHECK_FUNCS(alarm bcmp bfill bmove bsearch bzero \ +AC_CHECK_FUNCS(alarm bfill bmove bsearch bzero \ chsize cuserid fchmod fcntl \ fdatasync fesetround finite fpresetsticky fpsetmask fsync ftruncate \ getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \ @@ -2930,66 +2780,58 @@ readline_h_ln_cmd="" readline_link="" want_to_use_readline="no" -case $SYSTEM_TYPE in - *netware*) - # For NetWare, do not need readline - echo "Skipping readline" - ;; - *) - if [test "$with_libedit" = "yes"] || [test "$with_libedit" = "undefined"] && [test "$with_readline" = "undefined"] +if [test "$with_libedit" = "yes"] || [test "$with_libedit" = "undefined"] && [test "$with_readline" = "undefined"] +then + readline_topdir="cmd-line-utils" + readline_basedir="libedit" + readline_dir="$readline_topdir/$readline_basedir" + readline_link="\$(top_builddir)/cmd-line-utils/libedit/libedit.a" + readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/libedit/readline readline" + compile_libedit=yes + AC_DEFINE_UNQUOTED(HAVE_HIST_ENTRY, 1) + AC_DEFINE_UNQUOTED(USE_LIBEDIT_INTERFACE, 1) +elif test "$with_readline" = "yes" +then + readline_topdir="cmd-line-utils" + readline_basedir="readline" + readline_dir="$readline_topdir/$readline_basedir" + readline_link="\$(top_builddir)/cmd-line-utils/readline/libreadline.a" + readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/readline readline" + compile_readline=yes + want_to_use_readline="yes" + AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1) +else + # Use system readline library + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + MYSQL_CHECK_LIBEDIT_INTERFACE + MYSQL_CHECK_NEW_RL_INTERFACE + MYSQL_CHECK_READLINE_DECLARES_HIST_ENTRY + AC_LANG_RESTORE + if [test "$mysql_cv_new_rl_interface" = "yes"] && [test -d "$srcdir/cmd-line-utils/readline"] then - readline_topdir="cmd-line-utils" - readline_basedir="libedit" - readline_dir="$readline_topdir/$readline_basedir" - readline_link="\$(top_builddir)/cmd-line-utils/libedit/libedit.a" - readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/libedit/readline readline" - compile_libedit=yes - AC_DEFINE_UNQUOTED(HAVE_HIST_ENTRY, 1) - AC_DEFINE_UNQUOTED(USE_LIBEDIT_INTERFACE, 1) - elif test "$with_readline" = "yes" + # Use the new readline interface, but only if the package includes a bundled libreadline + # this way we avoid linking commercial source with GPL readline + readline_link="-lreadline" + want_to_use_readline="yes" + elif [test "$mysql_cv_libedit_interface" = "yes"] then - readline_topdir="cmd-line-utils" - readline_basedir="readline" - readline_dir="$readline_topdir/$readline_basedir" - readline_link="\$(top_builddir)/cmd-line-utils/readline/libreadline.a" - readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/readline readline" - compile_readline=yes - want_to_use_readline="yes" - AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1) + # Use libedit + readline_link="-ledit" else - # Use system readline library - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - MYSQL_CHECK_LIBEDIT_INTERFACE - MYSQL_CHECK_NEW_RL_INTERFACE - MYSQL_CHECK_READLINE_DECLARES_HIST_ENTRY - AC_LANG_RESTORE - if [test "$mysql_cv_new_rl_interface" = "yes"] && [test -d "$srcdir/cmd-line-utils/readline"] - then - # Use the new readline interface, but only if the package includes a bundled libreadline - # this way we avoid linking commercial source with GPL readline - readline_link="-lreadline" - want_to_use_readline="yes" - elif [test "$mysql_cv_libedit_interface" = "yes"] - then - # Use libedit - readline_link="-ledit" - else - AC_MSG_ERROR([Could not find system readline or libedit libraries - Use --with-readline or --with-libedit to use the bundled - versions of libedit or readline]) - fi + AC_MSG_ERROR([Could not find system readline or libedit libraries + Use --with-readline or --with-libedit to use the bundled + versions of libedit or readline]) fi +fi - # if there is no readline, but we want to build with readline, we fail - if [test "$want_to_use_readline" = "yes"] && [test ! -d "$srcdir/cmd-line-utils/readline"] - then - AC_MSG_ERROR([This commercially licensed MySQL source package can't - be built with libreadline. Please use --with-libedit to use - the bundled version of libedit instead.]) - fi - ;; -esac +# if there is no readline, but we want to build with readline, we fail +if [test "$want_to_use_readline" = "yes"] && [test ! -d "$srcdir/cmd-line-utils/readline"] +then + AC_MSG_ERROR([This commercially licensed MySQL source package can't + be built with libreadline. Please use --with-libedit to use + the bundled version of libedit instead.]) +fi AC_SUBST(readline_dir) AC_SUBST(readline_topdir) @@ -3079,15 +2921,6 @@ AC_SUBST(NON_THREADED_LIBS) AC_SUBST(STATIC_NSS_FLAGS) AC_SUBST(sql_client_dirs) -# If configuring for NetWare, build the netware directory -netware_dir= -if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null -then - netware_dir="netware" -fi -AC_SUBST(netware_dir) -AM_CONDITIONAL(HAVE_NETWARE, test "$netware_dir" = "netware") - if test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no" then AC_DEFINE([THREAD], [1], @@ -3140,19 +2973,17 @@ do done AC_SUBST(sql_union_dirs) +# +# Setup maintainer mode options by the end to not disturb +# system and other checks. +# +MY_MAINTAINER_MODE_SETUP + # Some usefull subst AC_SUBST(CC) AC_SUBST(GXX) # Set configuration options for make_binary_distribution -case $SYSTEM_TYPE in - *netware*) - MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --no-strip" - ;; - *) - : # no change for other platforms yet - ;; -esac AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS) #-------------------------------------------------------------------- @@ -3225,8 +3056,7 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl cmd-line-utils/Makefile cmd-line-utils/libedit/Makefile dnl libmysqld/Makefile libmysqld/examples/Makefile dnl mysql-test/Makefile mysql-test/lib/My/SafeProcess/Makefile dnl - netware/Makefile sql-bench/Makefile dnl - include/mysql_version.h plugin/Makefile win/Makefile + sql-bench/Makefile include/mysql_version.h plugin/Makefile win/Makefile dnl cmake/Makefile ) diff --git a/dbug/CMakeLists.txt b/dbug/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/dbug/dbug.c b/dbug/dbug.c index a4b381f2746..fd87669b8ca 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -95,7 +95,7 @@ #define fnmatch(A,B,C) strcmp(A,B) #endif -#if defined(MSDOS) || defined(__WIN__) +#if defined(__WIN__) #include #endif @@ -302,7 +302,7 @@ static int DoTrace(CODE_STATE *cs); #define DISABLE_TRACE 4 /* Test to see if file is writable */ -#if defined(HAVE_ACCESS) && !defined(MSDOS) +#if defined(HAVE_ACCESS) static BOOLEAN Writable(const char *pathname); /* Change file owner and group */ static void ChangeOwner(CODE_STATE *cs, char *pathname); @@ -336,23 +336,19 @@ static unsigned long Clock(void); #define ERR_OPEN "%s: can't open debug output stream \"%s\": " #define ERR_CLOSE "%s: can't close debug file: " #define ERR_ABORT "%s: debugger aborting because %s\n" -#define ERR_CHOWN "%s: can't change owner/group of \"%s\": " /* * Macros and defines for testing file accessibility under UNIX and MSDOS. */ #undef EXISTS -#if !defined(HAVE_ACCESS) || defined(MSDOS) +#if !defined(HAVE_ACCESS) #define EXISTS(pathname) (FALSE) /* Assume no existance */ #define Writable(name) (TRUE) #else #define EXISTS(pathname) (access(pathname, F_OK) == 0) #define WRITABLE(pathname) (access(pathname, W_OK) == 0) #endif -#ifndef MSDOS -#define ChangeOwner(cs,name) -#endif /* @@ -2008,10 +2004,6 @@ static void DBUGOpenFile(CODE_STATE *cs, else { cs->stack->out_file= fp; - if (newfile) - { - ChangeOwner(cs, name); - } } } } @@ -2069,10 +2061,6 @@ static FILE *OpenProfile(CODE_STATE *cs, const char *name) else { cs->stack->prof_file= fp; - if (newfile) - { - ChangeOwner(cs, name); - } } } return fp; @@ -2263,42 +2251,6 @@ static BOOLEAN Writable(const char *pathname) #endif -/* - * FUNCTION - * - * ChangeOwner change owner to real user for suid programs - * - * SYNOPSIS - * - * static VOID ChangeOwner(pathname) - * - * DESCRIPTION - * - * For unix systems, change the owner of the newly created debug - * file to the real owner. This is strictly for the benefit of - * programs that are running with the set-user-id bit set. - * - * Note that at this point, the fact that pathname represents - * a newly created file has already been established. If the - * program that the debugger is linked to is not running with - * the suid bit set, then this operation is redundant (but - * harmless). - * - */ - -#ifndef ChangeOwner -static void ChangeOwner(CODE_STATE *cs, char *pathname) -{ - if (chown(pathname, getuid(), getgid()) == -1) - { - (void) fprintf(stderr, ERR_CHOWN, cs->process, pathname); - perror(""); - (void) fflush(stderr); - } -} -#endif - - /* * FUNCTION * @@ -2470,7 +2422,7 @@ static unsigned long Clock() return ru.ru_utime.tv_sec*1000 + ru.ru_utime.tv_usec/1000; } -#elif defined(MSDOS) || defined(__WIN__) +#elif defined(__WIN__) static ulong Clock() { @@ -2519,37 +2471,6 @@ static unsigned long Clock() #endif /* RUSAGE */ #endif /* THREADS */ -#ifdef NO_VARARGS - -/* - * Fake vfprintf for systems that don't support it. If this - * doesn't work, you are probably SOL... - */ - -static int vfprintf(stream, format, ap) -FILE *stream; -char *format; -va_list ap; -{ - int rtnval; - ARGS_DCL; - - ARG0= va_arg(ap, ARGS_TYPE); - ARG1= va_arg(ap, ARGS_TYPE); - ARG2= va_arg(ap, ARGS_TYPE); - ARG3= va_arg(ap, ARGS_TYPE); - ARG4= va_arg(ap, ARGS_TYPE); - ARG5= va_arg(ap, ARGS_TYPE); - ARG6= va_arg(ap, ARGS_TYPE); - ARG7= va_arg(ap, ARGS_TYPE); - ARG8= va_arg(ap, ARGS_TYPE); - ARG9= va_arg(ap, ARGS_TYPE); - rtnval= fprintf(stream, format, ARGS_LIST); - return rtnval; -} - -#endif /* NO_VARARGS */ - #else /* diff --git a/dbug/dbug_analyze.c b/dbug/dbug_analyze.c index 3263b2ccc59..1ebe8bfd77e 100644 --- a/dbug/dbug_analyze.c +++ b/dbug/dbug_analyze.c @@ -561,9 +561,6 @@ FILE *outf; #define usage() fprintf (DBUG_FILE,"Usage: %s [-v] [prof-file]\n",my_name) -#ifdef MSDOS -extern int getopt(int argc, char **argv, char *opts); -#endif extern int optind; extern char *optarg; @@ -609,118 +606,5 @@ int main (int argc, char **argv) process (infile); output (outfile); DBUG_RETURN (EX_OK); + } } -} - -#ifdef MSDOS - -/* - * From std-unix@ut-sally.UUCP (Moderator, John Quarterman) Sun Nov 3 14:34:15 1985 - * Relay-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site gatech.CSNET - * Posting-Version: version B 2.10.2 9/18/84; site ut-sally.UUCP - * Path: gatech!akgua!mhuxv!mhuxt!mhuxr!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!ut-sally!std-unix - * From: std-unix@ut-sally.UUCP (Moderator, John Quarterman) - * Newsgroups: mod.std.unix - * Subject: public domain AT&T getopt source - * Message-ID: <3352@ut-sally.UUCP> - * Date: 3 Nov 85 19:34:15 GMT - * Date-Received: 4 Nov 85 12:25:09 GMT - * Organization: IEEE/P1003 Portable Operating System Environment Committee - * Lines: 91 - * Approved: jsq@ut-sally.UUCP - * - * Here's something you've all been waiting for: the AT&T public domain - * source for getopt(3). It is the code which was given out at the 1985 - * UNIFORUM conference in Dallas. I obtained it by electronic mail - * directly from AT&T. The people there assure me that it is indeed - * in the public domain. - * - * There is no manual page. That is because the one they gave out at - * UNIFORUM was slightly different from the current System V Release 2 - * manual page. The difference apparently involved a note about the - * famous rules 5 and 6, recommending using white space between an option - * and its first argument, and not grouping options that have arguments. - * Getopt itself is currently lenient about both of these things White - * space is allowed, but not mandatory, and the last option in a group can - * have an argument. That particular version of the man page evidently - * has no official existence, and my source at AT&T did not send a copy. - * The current SVR2 man page reflects the actual behavor of this getopt. - * However, I am not about to post a copy of anything licensed by AT&T. - * - * I will submit this source to Berkeley as a bug fix. - * - * I, personally, make no claims or guarantees of any kind about the - * following source. I did compile it to get some confidence that - * it arrived whole, but beyond that you're on your own. - * - */ - -/*LINTLIBRARY*/ - -int opterr = 1; -int optind = 1; -int optopt; -char *optarg; - -static void _ERR(s,c,argv) -char *s; -int c; -char *argv[]; -{ - char errbuf[3]; - - if (opterr) { - errbuf[0] = c; - errbuf[1] = '\n'; - (void) fprintf(stderr, "%s", argv[0]); - (void) fprintf(stderr, "%s", s); - (void) fprintf(stderr, "%s", errbuf); - } -} - -int getopt(argc, argv, opts) -int argc; -char **argv, *opts; -{ - static int sp = 1; - register int c; - register char *cp; - - if(sp == 1) - if(optind >= argc || - argv[optind][0] != '-' || argv[optind][1] == '\0') - return(EOF); - else if(strcmp(argv[optind], "--") == 0) { - optind++; - return(EOF); - } - optopt = c = argv[optind][sp]; - if(c == ':' || (cp=strchr(opts, c)) == NULL) { - _ERR(": illegal option -- ", c, argv); - if(argv[optind][++sp] == '\0') { - optind++; - sp = 1; - } - return('?'); - } - if(*++cp == ':') { - if(argv[optind][sp+1] != '\0') - optarg = &argv[optind++][sp+1]; - else if(++optind >= argc) { - _ERR(": option requires an argument -- ", c, argv); - sp = 1; - return('?'); - } else - optarg = argv[optind++]; - sp = 1; - } else { - if(argv[optind][++sp] == '\0') { - sp = 1; - optind++; - } - optarg = NULL; - } - return(c); -} - -#endif /* !unix && !xenix */ diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/extra/comp_err.c b/extra/comp_err.c index c85aef7bcc5..3c56770650f 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -665,9 +665,9 @@ static struct message *find_message(struct errors *err, const char *lang, static ha_checksum checksum_format_specifier(const char* msg) { ha_checksum chksum= 0; - const char* p= msg; - const char* start= 0; - int num_format_specifiers= 0; + const uchar* p= (const uchar*) msg; + const uchar* start= NULL; + uint32 num_format_specifiers= 0; while (*p) { diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index 81416df2922..89fd4104c6f 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -89,9 +89,6 @@ static struct my_option my_long_options[] = }; - -#include - static void usage(my_bool version) { printf("%s Ver 1.6 for %s at %s\n",my_progname,SYSTEM_TYPE, @@ -107,8 +104,6 @@ static void usage(my_bool version) printf("\nExample usage:\n%s --defaults-file=example.cnf client mysql\n", my_progname); } -#include - static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), diff --git a/extra/mysql_waitpid.c b/extra/mysql_waitpid.c index e5c06ac9857..d5c9f2f42ae 100644 --- a/extra/mysql_waitpid.c +++ b/extra/mysql_waitpid.c @@ -15,8 +15,6 @@ /* Wait until a program dies */ -#ifndef __NETWARE__ - #include #include #include @@ -103,15 +101,3 @@ void usage(void) my_print_help(my_long_options); exit(-1); } - -#else - -#include - -main() -{ - fprintf(stderr,"This tool has not been ported to NetWare\n"); - return 0; -} - -#endif /* __NETWARE__ */ diff --git a/extra/perror.c b/extra/perror.c index be9a47d63a4..382805c5dfd 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -102,8 +102,6 @@ static HA_ERRORS ha_errlist[]= }; -#include - static void print_version(void) { printf("%s Ver %s, for %s (%s)\n",my_progname,PERROR_VERSION, @@ -122,8 +120,6 @@ static void usage(void) my_print_variables(my_long_options); } -#include - static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), @@ -281,7 +277,7 @@ int main(int argc,char *argv[]) #endif { /* - On some system, like NETWARE, strerror(unknown_error) returns a + On some system, like Linux, strerror(unknown_error) returns a string 'Unknown Error'. To avoid printing it we try to find the error string by asking for an impossible big error message. diff --git a/extra/replace.c b/extra/replace.c index 1a887ac3e21..bbe70ba586e 100644 --- a/extra/replace.c +++ b/extra/replace.c @@ -648,7 +648,7 @@ static REPLACE *init_replace(char * *from, char * *to,uint count, for (i=1 ; i <= found_sets ; i++) { pos=from[found_set[i-1].table_offset]; - rep_str[i].found= (my_bool) (!bcmp(pos,"\\^",3) ? 2 : 1); + rep_str[i].found= (my_bool) (!memcmp(pos,"\\^",3) ? 2 : 1); rep_str[i].replace_string=to_array[found_set[i-1].table_offset]; rep_str[i].to_offset=found_set[i-1].found_offset-start_at_word(pos); rep_str[i].from_offset=found_set[i-1].found_offset-replace_len(pos)+ @@ -776,8 +776,8 @@ static void copy_bits(REP_SET *to,REP_SET *from) static int cmp_bits(REP_SET *set1,REP_SET *set2) { - return bcmp((uchar*) set1->bits,(uchar*) set2->bits, - sizeof(uint) * set1->size_of_bits); + return memcmp(set1->bits, set2->bits, + sizeof(uint) * set1->size_of_bits); } @@ -849,14 +849,14 @@ static short find_found(FOUND_SET *found_set,uint table_offset, static uint start_at_word(char * pos) { - return (((!bcmp(pos,"\\b",2) && pos[2]) || !bcmp(pos,"\\^",2)) ? 1 : 0); + return (((!memcmp(pos,"\\b",2) && pos[2]) || !memcmp(pos,"\\^",2)) ? 1 : 0); } static uint end_of_word(char * pos) { char * end=strend(pos); - return ((end > pos+2 && !bcmp(end-2,"\\b",2)) || - (end >= pos+2 && !bcmp(end-2,"\\$",2))) ? + return ((end > pos+2 && !memcmp(end-2,"\\b",2)) || + (end >= pos+2 && !memcmp(end-2,"\\$",2))) ? 1 : 0; } diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c index 4faca1653b2..432a207f424 100644 --- a/extra/resolve_stack_dump.c +++ b/extra/resolve_stack_dump.c @@ -65,8 +65,6 @@ static struct my_option my_long_options[] = static void verify_sort(); -#include - static void print_version(void) { printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,DUMP_VERSION, @@ -90,8 +88,6 @@ The numeric-dump-file should contain a numeric stack trace from mysqld.\n\ If the numeric-dump-file is not given, the stack trace is read from stdin.\n"); } -#include - static void die(const char* fmt, ...) { diff --git a/extra/resolveip.c b/extra/resolveip.c index 90fda977848..094dfecae59 100644 --- a/extra/resolveip.c +++ b/extra/resolveip.c @@ -155,11 +155,8 @@ int main(int argc, char **argv) else { printf ("Host name of %s is %s", ip,hpaddr->h_name); -#ifndef __NETWARE__ - /* this information is not available on NetWare */ for (q = hpaddr->h_aliases; *q != 0; q++) (void) printf(", %s", *q); -#endif /* __NETWARE__ */ puts(""); } } diff --git a/extra/yassl/CMakeLists.txt b/extra/yassl/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/extra/yassl/include/yassl_int.hpp b/extra/yassl/include/yassl_int.hpp index 1e761f559e2..1cc4200d10c 100644 --- a/extra/yassl/include/yassl_int.hpp +++ b/extra/yassl/include/yassl_int.hpp @@ -34,9 +34,8 @@ #include "openssl/ssl.h" // ASN1_STRING and DH // Check if _POSIX_THREADS should be forced -#if !defined(_POSIX_THREADS) && (defined(__NETWARE__) || defined(__hpux)) +#if !defined(_POSIX_THREADS) && defined(__hpux) // HPUX does not define _POSIX_THREADS as it's not _fully_ implemented -// Netware supports pthreads but does not announce it #define _POSIX_THREADS #endif diff --git a/extra/yassl/src/crypto_wrapper.cpp b/extra/yassl/src/crypto_wrapper.cpp index 28d7f1b5693..b968ec1e6c3 100644 --- a/extra/yassl/src/crypto_wrapper.cpp +++ b/extra/yassl/src/crypto_wrapper.cpp @@ -953,8 +953,9 @@ x509* PemToDer(FILE* file, CertType type, EncryptedInfo* info) info->set = true; } } - fgets(line,sizeof(line), file); // get blank line - begin = ftell(file); + // get blank line + if (fgets(line, sizeof(line), file)) + begin = ftell(file); } } diff --git a/extra/yassl/src/socket_wrapper.cpp b/extra/yassl/src/socket_wrapper.cpp index eee5d47377f..cebbd9c5529 100644 --- a/extra/yassl/src/socket_wrapper.cpp +++ b/extra/yassl/src/socket_wrapper.cpp @@ -37,7 +37,7 @@ #include #endif // _WIN32 -#if defined(__sun) || defined(__SCO_VERSION__) || defined(__NETWARE__) +#if defined(__sun) || defined(__SCO_VERSION__) #include #endif diff --git a/extra/yassl/taocrypt/CMakeLists.txt b/extra/yassl/taocrypt/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/extra/yassl/taocrypt/include/blowfish.hpp b/extra/yassl/taocrypt/include/blowfish.hpp index 90d2c014b4c..94bbab7aea8 100644 --- a/extra/yassl/taocrypt/include/blowfish.hpp +++ b/extra/yassl/taocrypt/include/blowfish.hpp @@ -51,7 +51,7 @@ public: enum { BLOCK_SIZE = BLOWFISH_BLOCK_SIZE, ROUNDS = 16 }; Blowfish(CipherDir DIR, Mode MODE) - : Mode_BASE(BLOCK_SIZE, DIR, MODE) {} + : Mode_BASE(BLOCK_SIZE, DIR, MODE), sbox_(pbox_ + ROUNDS + 2) {} #ifdef DO_BLOWFISH_ASM void Process(byte*, const byte*, word32); @@ -62,8 +62,8 @@ private: static const word32 p_init_[ROUNDS + 2]; static const word32 s_init_[4 * 256]; - word32 pbox_[ROUNDS + 2]; - word32 sbox_[4 * 256]; + word32 pbox_[ROUNDS + 2 + 4 * 256]; + word32* sbox_; void crypt_block(const word32 in[2], word32 out[2]) const; void AsmProcess(const byte* in, byte* out) const; diff --git a/extra/yassl/taocrypt/include/misc.hpp b/extra/yassl/taocrypt/include/misc.hpp index 96648a39aa1..431316b84d1 100644 --- a/extra/yassl/taocrypt/include/misc.hpp +++ b/extra/yassl/taocrypt/include/misc.hpp @@ -125,7 +125,7 @@ void CleanUp(); // no gas on these systems ?, disable for now -#if defined(__sun__) || defined (__QNX__) || defined (__APPLE__) +#if defined(__sun__) || defined (__APPLE__) #define TAOCRYPT_DISABLE_X86ASM #endif diff --git a/extra/yassl/taocrypt/include/runtime.hpp b/extra/yassl/taocrypt/include/runtime.hpp index b59f61a1cde..9d12b253dd6 100644 --- a/extra/yassl/taocrypt/include/runtime.hpp +++ b/extra/yassl/taocrypt/include/runtime.hpp @@ -35,10 +35,7 @@ // Handler for pure virtual functions namespace __Crun { - static void pure_error(void) - { - assert("Pure virtual method called." == "Aborted"); - } + void pure_error(void); } // namespace __Crun #endif // __sun @@ -54,16 +51,7 @@ extern "C" { #else #include "kernelc.hpp" #endif - -/* Disallow inline __cxa_pure_virtual() */ -static int __cxa_pure_virtual() __attribute__((noinline, used)); -static int __cxa_pure_virtual() -{ - // oops, pure virtual called! - assert(!"Pure virtual method called. Aborted"); - return 0; -} - + int __cxa_pure_virtual () __attribute__ ((weak)); } // extern "C" #endif // __GNUC__ > 2 diff --git a/extra/yassl/taocrypt/src/aes.cpp b/extra/yassl/taocrypt/src/aes.cpp index b2b42d3dcf0..63eff1d91fc 100644 --- a/extra/yassl/taocrypt/src/aes.cpp +++ b/extra/yassl/taocrypt/src/aes.cpp @@ -51,7 +51,7 @@ void AES::Process(byte* out, const byte* in, word32 sz) out += BLOCK_SIZE; in += BLOCK_SIZE; } - else if (mode_ == CBC) + else if (mode_ == CBC) { if (dir_ == ENCRYPTION) while (blocks--) { r_[0] ^= *(word32*)in; @@ -78,6 +78,7 @@ void AES::Process(byte* out, const byte* in, word32 sz) out += BLOCK_SIZE; in += BLOCK_SIZE; } + } } #endif // DO_AES_ASM diff --git a/extra/yassl/taocrypt/src/algebra.cpp b/extra/yassl/taocrypt/src/algebra.cpp index c221ce3d6cb..47a660d5c96 100644 --- a/extra/yassl/taocrypt/src/algebra.cpp +++ b/extra/yassl/taocrypt/src/algebra.cpp @@ -186,10 +186,10 @@ Integer AbstractGroup::CascadeScalarMultiply(const Element &x, struct WindowSlider { - WindowSlider(const Integer &exp, bool fastNegate, + WindowSlider(const Integer &expIn, bool fastNegateIn, unsigned int windowSizeIn=0) - : exp(exp), windowModulus(Integer::One()), windowSize(windowSizeIn), - windowBegin(0), fastNegate(fastNegate), firstTime(true), + : exp(expIn), windowModulus(Integer::One()), windowSize(windowSizeIn), + windowBegin(0), fastNegate(fastNegateIn), firstTime(true), finished(false) { if (windowSize == 0) diff --git a/extra/yassl/taocrypt/src/blowfish.cpp b/extra/yassl/taocrypt/src/blowfish.cpp index 66ff4d829d7..2097b045278 100644 --- a/extra/yassl/taocrypt/src/blowfish.cpp +++ b/extra/yassl/taocrypt/src/blowfish.cpp @@ -53,7 +53,7 @@ void Blowfish::Process(byte* out, const byte* in, word32 sz) out += BLOCK_SIZE; in += BLOCK_SIZE; } - else if (mode_ == CBC) + else if (mode_ == CBC) { if (dir_ == ENCRYPTION) while (blocks--) { r_[0] ^= *(word32*)in; @@ -78,6 +78,7 @@ void Blowfish::Process(byte* out, const byte* in, word32 sz) out += BLOCK_SIZE; in += BLOCK_SIZE; } + } } #endif // DO_BLOWFISH_ASM diff --git a/extra/yassl/taocrypt/src/integer.cpp b/extra/yassl/taocrypt/src/integer.cpp index 85733b88aa9..b054e98bef4 100644 --- a/extra/yassl/taocrypt/src/integer.cpp +++ b/extra/yassl/taocrypt/src/integer.cpp @@ -283,21 +283,23 @@ DWord() {} word GetHighHalfAsBorrow() const {return 0-halfs_.high;} private: + struct dword_struct + { + #ifdef LITTLE_ENDIAN_ORDER + word low; + word high; + #else + word high; + word low; + #endif + }; + union { #ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE dword whole_; #endif - struct - { - #ifdef LITTLE_ENDIAN_ORDER - word low; - word high; - #else - word high; - word low; - #endif - } halfs_; + struct dword_struct halfs_; }; }; @@ -1214,20 +1216,24 @@ public: #define AS1(x) #x ";" #define AS2(x, y) #x ", " #y ";" #define AddPrologue \ + word res; \ __asm__ __volatile__ \ ( \ "push %%ebx;" /* save this manually, in case of -fPIC */ \ - "mov %2, %%ebx;" \ + "mov %3, %%ebx;" \ ".intel_syntax noprefix;" \ "push ebp;" #define AddEpilogue \ "pop ebp;" \ ".att_syntax prefix;" \ "pop %%ebx;" \ - : \ + "mov %%eax, %0;" \ + : "=g" (res) \ : "c" (C), "d" (A), "m" (B), "S" (N) \ : "%edi", "memory", "cc" \ - ); + ); \ + return res; + #define MulPrologue \ __asm__ __volatile__ \ ( \ diff --git a/extra/yassl/taocrypt/src/misc.cpp b/extra/yassl/taocrypt/src/misc.cpp index 402645c93fd..11dd4dc6d66 100644 --- a/extra/yassl/taocrypt/src/misc.cpp +++ b/extra/yassl/taocrypt/src/misc.cpp @@ -84,12 +84,23 @@ namespace STL = STL_NAMESPACE; } -#if defined(__ICC) || defined(__INTEL_COMPILER) +#ifdef __sun + +// Handler for pure virtual functions +namespace __Crun { + void pure_error() { + assert(!"Aborted: pure virtual method called."); + } +} + +#endif + +#if defined(__ICC) || defined(__INTEL_COMPILER) || (__GNUC__ > 2) extern "C" { int __cxa_pure_virtual() { - assert("Pure virtual method called." == "Aborted"); + assert(!"Aborted: pure virtual method called."); return 0; } @@ -166,14 +177,6 @@ word Crop(word value, unsigned int size) #ifdef TAOCRYPT_X86ASM_AVAILABLE -#ifndef _MSC_VER - static jmp_buf s_env; - static void SigIllHandler(int) - { - longjmp(s_env, 1); - } -#endif - bool HaveCpuId() { diff --git a/extra/yassl/taocrypt/src/random.cpp b/extra/yassl/taocrypt/src/random.cpp index 2bbc0a85e8b..729421fc71d 100644 --- a/extra/yassl/taocrypt/src/random.cpp +++ b/extra/yassl/taocrypt/src/random.cpp @@ -92,67 +92,6 @@ void OS_Seed::GenerateSeed(byte* output, word32 sz) } -#elif defined(__NETWARE__) - -/* The OS_Seed implementation for Netware */ - -#include -#include - -// Loop on high resulution Read Time Stamp Counter -static void NetwareSeed(byte* output, word32 sz) -{ - word32 tscResult; - - for (word32 i = 0; i < sz; i += sizeof(tscResult)) { - #if defined(__GNUC__) - asm volatile("rdtsc" : "=A" (tscResult)); - #else - #ifdef __MWERKS__ - asm { - #else - __asm { - #endif - rdtsc - mov tscResult, eax - } - #endif - - memcpy(output, &tscResult, sizeof(tscResult)); - output += sizeof(tscResult); - - NXThreadYield(); // induce more variance - } -} - - -OS_Seed::OS_Seed() -{ -} - - -OS_Seed::~OS_Seed() -{ -} - - -void OS_Seed::GenerateSeed(byte* output, word32 sz) -{ - /* - Try to use NXSeedRandom as it will generate a strong - seed using the onboard 82802 chip - - As it's not always supported, fallback to default - implementation if an error is returned - */ - - if (NXSeedRandom(sz, output) != 0) - { - NetwareSeed(output, sz); - } -} - - #else /* The default OS_Seed implementation */ diff --git a/extra/yassl/taocrypt/src/twofish.cpp b/extra/yassl/taocrypt/src/twofish.cpp index 84dd35f9191..71601c08162 100644 --- a/extra/yassl/taocrypt/src/twofish.cpp +++ b/extra/yassl/taocrypt/src/twofish.cpp @@ -54,7 +54,7 @@ void Twofish::Process(byte* out, const byte* in, word32 sz) out += BLOCK_SIZE; in += BLOCK_SIZE; } - else if (mode_ == CBC) + else if (mode_ == CBC) { if (dir_ == ENCRYPTION) while (blocks--) { r_[0] ^= *(word32*)in; @@ -82,6 +82,7 @@ void Twofish::Process(byte* out, const byte* in, word32 sz) out += BLOCK_SIZE; in += BLOCK_SIZE; } + } } #endif // DO_TWOFISH_ASM diff --git a/extra/yassl/testsuite/test.hpp b/extra/yassl/testsuite/test.hpp index c921f8f9c69..283c929a2e1 100644 --- a/extra/yassl/testsuite/test.hpp +++ b/extra/yassl/testsuite/test.hpp @@ -32,8 +32,7 @@ #endif /* _WIN32 */ -#if !defined(_SOCKLEN_T) && \ - (defined(_WIN32) || defined(__NETWARE__) || defined(__APPLE__)) +#if !defined(_SOCKLEN_T) && (defined(_WIN32) || defined(__APPLE__)) typedef int socklen_t; #endif @@ -42,18 +41,14 @@ #if defined(__hpux) // HPUX uses int* for third parameter to accept typedef int* ACCEPT_THIRD_T; -#elif defined(__NETWARE__) -// NetWare uses size_t* for third parameter to accept - typedef size_t* ACCEPT_THIRD_T; #else typedef socklen_t* ACCEPT_THIRD_T; #endif // Check if _POSIX_THREADS should be forced -#if !defined(_POSIX_THREADS) && (defined(__NETWARE__) || defined(__hpux)) +#if !defined(_POSIX_THREADS) && defined(__hpux) // HPUX does not define _POSIX_THREADS as it's not _fully_ implemented -// Netware supports pthreads but does not announce it #define _POSIX_THREADS #endif @@ -160,6 +155,11 @@ inline void err_sys(const char* msg) } +extern "C" { + static int PasswordCallBack(char*, int, int, void*); +} + + static int PasswordCallBack(char* passwd, int sz, int rw, void* userdata) { strncpy(passwd, "12345678", sz); diff --git a/include/Makefile.am b/include/Makefile.am index e610a8e325c..ad023083829 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2000-2006 MySQL AB, 2009 Sun Microsystems, Inc +# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public @@ -15,6 +15,8 @@ # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, # MA 02111-1307, USA +pkgpsiincludedir = $(pkgincludedir)/psi + BUILT_SOURCES = $(HEADERS_GEN_MAKE) link_sources probes_mysql_nodtrace.h HEADERS_GEN_CONFIGURE = mysql_version.h HEADERS_GEN_MAKE = my_config.h @@ -25,18 +27,16 @@ pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \ my_xml.h mysql_embed.h mysql/services.h \ mysql/service_my_snprintf.h mysql/service_thd_alloc.h \ my_pthread.h my_no_pthread.h \ - mysql/psi/psi.h mysql/psi/mysql_thread.h \ - mysql/psi/mysql_file.h \ decimal.h errmsg.h my_global.h my_net.h \ my_getopt.h sslopt-longopts.h my_dir.h \ sslopt-vars.h sslopt-case.h sql_common.h keycache.h \ m_ctype.h my_attribute.h $(HEADERS_GEN_CONFIGURE) \ $(HEADERS_GEN_MAKE) probes_mysql.h probes_mysql_nodtrace.h -noinst_HEADERS = config-win.h config-netware.h lf.h my_bit.h \ +noinst_HEADERS = config-win.h lf.h my_bit.h \ heap.h my_bitmap.h my_uctype.h password.h \ myisam.h myisampack.h myisammrg.h ft_global.h\ - mysys_err.h my_base.h help_start.h help_end.h \ + mysys_err.h my_base.h \ my_nosys.h my_alarm.h queues.h rijndael.h sha1.h sha2.h \ my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \ thr_lock.h t_ctype.h violite.h my_md5.h base64.h \ @@ -45,7 +45,10 @@ noinst_HEADERS = config-win.h config-netware.h lf.h my_bit.h \ my_vle.h my_user.h my_atomic.h atomic/nolock.h \ atomic/rwlock.h atomic/x86-gcc.h atomic/generic-msvc.h \ atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \ - atomic/solaris.h mysql/innodb_priv.h + atomic/solaris.h mysql/innodb_priv.h my_compiler.h + +pkgpsiinclude_HEADERS = mysql/psi/psi.h mysql/psi/mysql_thread.h \ + mysql/psi/mysql_file.h EXTRA_DIST = mysql.h.pp mysql/plugin.h.pp probes_mysql.d.base \ CMakeLists.txt \ diff --git a/include/config-netware.h b/include/config-netware.h deleted file mode 100644 index a4465ea177a..00000000000 --- a/include/config-netware.h +++ /dev/null @@ -1,161 +0,0 @@ -/* Copyright (C) 2000 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* Header for NetWare compatible with MySQL */ - -#ifndef _config_netware_h -#define _config_netware_h - -#define __event_h__ -#define _EVENT_H_ -/* - These two #define(s) are needed as both libc of NetWare and MySQL have - files named event.h which causes compilation errors. -*/ - - -/* required headers */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#undef _EVENT_H_ -/* - This #undef exists here because both libc of NetWare and MySQL have - files named event.h which causes compilation errors. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -/* required adjustments */ -#undef HAVE_READDIR_R -#undef HAVE_RWLOCK_INIT -#undef HAVE_SCHED_H -#undef HAVE_SYS_MMAN_H -#undef HAVE_SYNCH_H -#undef HAVE_MMAP -#undef HAVE_RINT - -#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 -#define HAVE_PTHREAD_SIGMASK 1 -#define HAVE_PTHREAD_YIELD_ZERO_ARG 1 -#define HAVE_BROKEN_REALPATH 1 - -/* changes made to make use of LibC-June-2004 for building purpose */ -#undef HAVE_POSIX_SIGNALS -#undef HAVE_PTHREAD_ATTR_SETSCOPE -#undef HAVE_ALLOC_A -#undef HAVE_FINITE -#undef HAVE_GETPWNAM -#undef HAVE_GETPWUID -#undef HAVE_READLINK -#undef HAVE_STPCPY -/* changes end */ - -/* Changes made to make use of LibC-June-2005 for building purpose */ -#undef HAVE_GETPASS -#undef HAVE_GETRLIMIT -#undef HAVE_GETRUSAGE -#undef HAVE_INITGROUPS -/* Changes end - LibC-June-2005 */ - -/* no libc crypt() function */ -#ifdef HAVE_OPENSSL - #define HAVE_CRYPT 1 -#else - #undef HAVE_CRYPT -#endif /* HAVE_OPENSSL */ - -/* Netware has an ancient zlib */ -#undef HAVE_COMPRESS -#define HAVE_COMPRESS -#undef HAVE_ARCHIVE_DB - -/* include the old function apis */ -#define USE_OLD_FUNCTIONS 1 - -/* no case sensitivity */ -#define FN_NO_CASE_SENSE 1 - -/* the thread alarm is not used */ -#define DONT_USE_THR_ALARM 1 - -/* signals do not interrupt sockets */ -#define SIGNALS_DONT_BREAK_READ 1 - -/* signal by closing the sockets */ -#define SIGNAL_WITH_VIO_CLOSE 1 - -/* On NetWare, stack grows towards lower address */ -#define STACK_DIRECTION -1 - -/* On NetWare, we need to set stack size for threads, otherwise default 16K is used */ -#define NW_THD_STACKSIZE 65536 - -/* On NetWare, to fix the problem with the deletion of open files */ -#define CANT_DELETE_OPEN_FILES 1 - -#define FN_LIBCHAR '\\' -#define FN_ROOTDIR "\\" -#define FN_DEVCHAR ':' - -/* default directory information */ -#define DEFAULT_MYSQL_HOME "sys:/mysql" -#define PACKAGE "mysql" -#define DEFAULT_BASEDIR "sys:/" -#define SHAREDIR "share/" -#define DEFAULT_CHARSET_HOME "sys:/mysql/" -#define MYSQL_DATADIR "data/" - -/* 64-bit file system calls */ -#define SIZEOF_OFF_T 8 -#define off_t off64_t -#define chsize chsize64 -#define ftruncate ftruncate64 -#define lseek lseek64 -#define pread pread64 -#define pwrite pwrite64 -#define tell tell64 - -/* do not use the extended time in LibC sys\stat.h */ -#define _POSIX_SOURCE - -/* Some macros for portability */ - -#define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=time(NULL)+(SEC); (ABSTIME).tv_nsec=0; } - -/* extra protection against CPU Hogs on NetWare */ -#define NETWARE_YIELD pthread_yield() -/* Screen mode for help texts */ -#define NETWARE_SET_SCREEN_MODE(A) setscreenmode(A) - -#ifdef __cplusplus -} -#endif - -#endif /* _config_netware_h */ diff --git a/include/config-win.h b/include/config-win.h index 269ec0e925a..9e8bb19c12d 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -185,7 +185,6 @@ typedef SSIZE_T ssize_t; #define SOCKET_SIZE_TYPE int #define my_socket_defined #define byte_defined -#define HUGE_PTR #define STDCALL __stdcall /* Used by libmysql.dll */ #define isnan(X) _isnan(X) #define finite(X) _finite(X) diff --git a/include/help_end.h b/include/help_end.h deleted file mode 100644 index 92953efe35a..00000000000 --- a/include/help_end.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef HELP_END_INCLUDED -#define HELP_END_INCLUDED - -/* Copyright (C) 2004-2005 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifdef __NETWARE__ -#undef printf -#undef puts -#undef fputs -#undef fputc -#undef putchar -#endif -#endif /* HELP_END_INCLUDED */ diff --git a/include/help_start.h b/include/help_start.h deleted file mode 100644 index 414f7ec93a0..00000000000 --- a/include/help_start.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef HELP_START_INCLUDED -#define HELP_START_INCLUDED - -/* Copyright (C) 2004-2005 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -/* Divert all help information on NetWare to logger screen. */ - -#ifdef __NETWARE__ -#define printf consoleprintf -#define puts(s) consoleprintf("%s\n",s) -#define fputs(s,f) puts(s) -#define fputc(s,f) consoleprintf("%c", s) -#define putchar(s) consoleprintf("%c", s) -#endif -#endif /* HELP_START_INCLUDED */ diff --git a/include/m_string.h b/include/m_string.h index 1a2a508edfb..c2779c63941 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -36,10 +36,6 @@ /* need by my_vsnprintf */ #include -#ifdef _AIX -#undef HAVE_BCMP -#endif - /* This is needed for the definitions of bzero... on solaris */ #if defined(HAVE_STRINGS_H) #include @@ -63,14 +59,10 @@ /* Unixware 7 */ #if !defined(HAVE_BFILL) # define bfill(A,B,C) memset((A),(C),(B)) -# define bmove_align(A,B,C) memcpy((A),(B),(C)) #endif -#if !defined(HAVE_BCMP) -# define bcopy(s, d, n) memcpy((d), (s), (n)) -# define bcmp(A,B,C) memcmp((A),(B),(C)) -# define bzero(A,B) memset((A),0,(B)) -# define bmove_align(A,B,C) memcpy((A),(B),(C)) +#if !defined(bzero) && !defined(HAVE_BZERO) +# define bzero(A,B) memset((A),0,(B)) #endif #if defined(__cplusplus) @@ -92,8 +84,8 @@ extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */ #endif /* Declared in int2str() */ -extern char NEAR _dig_vec_upper[]; -extern char NEAR _dig_vec_lower[]; +extern char _dig_vec_upper[]; +extern char _dig_vec_lower[]; #ifndef strmov #define strmov_overlapp(A,B) strmov(A,B) @@ -116,19 +108,6 @@ extern char NEAR _dig_vec_lower[]; extern void bfill(uchar *dst,size_t len,pchar fill); #endif -#if !defined(bzero) && !defined(HAVE_BZERO) -extern void bzero(uchar * dst,size_t len); -#endif - -#if !defined(bcmp) && !defined(HAVE_BCMP) -extern size_t bcmp(const uchar *s1,const uchar *s2,size_t len); -#endif -#ifdef HAVE_purify -extern size_t my_bcmp(const uchar *s1,const uchar *s2,size_t len); -#undef bcmp -#define bcmp(A,B,C) my_bcmp((A),(B),(C)) -#endif /* HAVE_purify */ - #ifndef bmove512 extern void bmove512(uchar *dst,const uchar *src,size_t len); #endif @@ -156,15 +135,15 @@ extern char *strmov(char *dst,const char *src); #else extern char *strmov_overlapp(char *dst,const char *src); #endif -extern char *strnmov(char *dst,const char *src,size_t n); -extern char *strsuff(const char *src,const char *suffix); -extern char *strcont(const char *src,const char *set); -extern char *strxcat _VARARGS((char *dst,const char *src, ...)); -extern char *strxmov _VARARGS((char *dst,const char *src, ...)); -extern char *strxcpy _VARARGS((char *dst,const char *src, ...)); -extern char *strxncat _VARARGS((char *dst,size_t len, const char *src, ...)); -extern char *strxnmov _VARARGS((char *dst,size_t len, const char *src, ...)); -extern char *strxncpy _VARARGS((char *dst,size_t len, const char *src, ...)); +extern char *strnmov(char *dst, const char *src, size_t n); +extern char *strsuff(const char *src, const char *suffix); +extern char *strcont(const char *src, const char *set); +extern char *strxcat(char *dst, const char *src, ...); +extern char *strxmov(char *dst, const char *src, ...); +extern char *strxcpy(char *dst, const char *src, ...); +extern char *strxncat(char *dst, size_t len, const char *src, ...); +extern char *strxnmov(char *dst, size_t len, const char *src, ...); +extern char *strxncpy(char *dst, size_t len, const char *src, ...); /* Prototypes of normal stringfunctions (with may ours) */ diff --git a/include/my_alarm.h b/include/my_alarm.h index dd2d5642f5f..fa396cf02f9 100644 --- a/include/my_alarm.h +++ b/include/my_alarm.h @@ -36,14 +36,14 @@ extern ulong my_time_to_wait_for_lock; #define ALARM_END (void) signal(SIGALRM,alarm_signal); \ (void) alarm(alarm_old); #define ALARM_TEST my_have_got_alarm -#ifdef DONT_REMEMBER_SIGNAL +#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY #define ALARM_REINIT (void) alarm(MY_HOW_OFTEN_TO_ALARM); \ (void) signal(SIGALRM,my_set_alarm_variable);\ my_have_got_alarm=0; #else #define ALARM_REINIT (void) alarm((uint) MY_HOW_OFTEN_TO_ALARM); \ my_have_got_alarm=0; -#endif /* DONT_REMEMBER_SIGNAL */ +#endif /* SIGNAL_HANDLER_RESET_ON_DELIVERY */ #else #define ALARM_VARIABLES long alarm_pos=0,alarm_end_pos=MY_HOW_OFTEN_TO_WRITE-1 #define ALARM_INIT diff --git a/include/my_bitmap.h b/include/my_bitmap.h index 314dac983b0..0caf2da12d0 100644 --- a/include/my_bitmap.h +++ b/include/my_bitmap.h @@ -159,22 +159,6 @@ static inline my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2) #define bitmap_set_all(MAP) \ (memset((MAP)->bitmap, 0xFF, 4*no_words_in_map((MAP)))) -/** - check, set and clear a bit of interest of an integer. - - If the bit is out of range @retval -1. Otherwise - bit_is_set @return 0 or 1 reflecting the bit is set or not; - bit_do_set @return 1 (bit is set 1) - bit_do_clear @return 0 (bit is cleared to 0) -*/ - -#define bit_is_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \ - (((I) & (ULL(1) << (B))) == 0 ? 0 : 1) : -1) -#define bit_do_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \ - ((I) |= (ULL(1) << (B)), 1) : -1) -#define bit_do_clear(I,B) (sizeof(I) * CHAR_BIT > (B) ? \ - ((I) &= ~(ULL(1) << (B)), 0) : -1) - #ifdef __cplusplus } #endif diff --git a/include/my_compiler.h b/include/my_compiler.h new file mode 100644 index 00000000000..1cd46ff4260 --- /dev/null +++ b/include/my_compiler.h @@ -0,0 +1,129 @@ +#ifndef MY_COMPILER_INCLUDED +#define MY_COMPILER_INCLUDED + +/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +/** + Header for compiler-dependent features. + + Intended to contain a set of reusable wrappers for preprocessor + macros, attributes, pragmas, and any other features that are + specific to a target compiler. +*/ + +#include /* stddef.h offsetof */ + +/** + Compiler-dependent internal convenience macros. +*/ + +/* GNU C/C++ */ +#if defined __GNUC__ +/* Any after 2.95... */ +# define MY_ALIGN_EXT + +/* Microsoft Visual C++ */ +#elif defined _MSC_VER +# define MY_ALIGNOF(type) __alignof(type) +# define MY_ALIGNED(n) __declspec(align(n)) + +/* Oracle Solaris Studio */ +#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) +# if __SUNPRO_C >= 0x590 +# define MY_ALIGN_EXT +# endif + +/* IBM XL C/C++ */ +#elif defined __xlC__ +# if __xlC__ >= 0x0600 +# define MY_ALIGN_EXT +# endif + +/* HP aCC */ +#elif defined(__HP_aCC) || defined(__HP_cc) +# if (__HP_aCC >= 60000) || (__HP_cc >= 60000) +# define MY_ALIGN_EXT +# endif +#endif + +#ifdef MY_ALIGN_EXT +/** Specifies the minimum alignment of a type. */ +# define MY_ALIGNOF(type) __alignof__(type) +/** Determine the alignment requirement of a type. */ +# define MY_ALIGNED(n) __attribute__((__aligned__((n)))) +#endif + +/** + Generic compiler-dependent features. +*/ +#ifndef MY_ALIGNOF +# ifdef __cplusplus + template struct my_alignof_helper { char m1; type m2; }; + /* Invalid for non-POD types, but most compilers give the right answer. */ +# define MY_ALIGNOF(type) offsetof(my_alignof_helper, m2) +# else +# define MY_ALIGNOF(type) offsetof(struct { char m1; type m2; }, m2) +# endif +#endif + +/** + C++ Type Traits +*/ + +#ifdef __cplusplus + +/** + Opaque storage with a particular alignment. +*/ +# if defined(MY_ALIGNED) +/* Partial specialization used due to MSVC++. */ +template struct my_alignment_imp; +template<> struct MY_ALIGNED(1) my_alignment_imp<1> {}; +template<> struct MY_ALIGNED(2) my_alignment_imp<2> {}; +template<> struct MY_ALIGNED(4) my_alignment_imp<4> {}; +template<> struct MY_ALIGNED(8) my_alignment_imp<8> {}; +template<> struct MY_ALIGNED(16) my_alignment_imp<16> {}; +/* ... expand as necessary. */ +# else +template +struct my_alignment_imp { double m1; }; +# endif + +/** + A POD type with a given size and alignment. + + @remark If the compiler does not support a alignment attribute + (MY_ALIGN macro), the default alignment of a double is + used instead. + + @tparam size The minimum size. + @tparam alignment The desired alignment: 1, 2, 4, 8 or 16. +*/ +template +struct my_aligned_storage +{ + union + { + char data[size]; + my_alignment_imp align; + }; +}; + +#endif /* __cplusplus */ + +#include + +#endif /* MY_COMPILER_INCLUDED */ diff --git a/include/my_dbug.h b/include/my_dbug.h index 34681fbc633..19570ac2a67 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -45,7 +45,7 @@ extern void _db_enter_(const char *_func_, const char *_file_, uint _line_, struct _db_stack_frame_ *_stack_frame_); extern void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_); extern void _db_pargs_(uint _line_,const char *keyword); -extern void _db_doprnt_ _VARARGS((const char *format,...)) +extern void _db_doprnt_(const char *format,...) ATTRIBUTE_FORMAT(printf, 1, 2); extern void _db_dump_(uint _line_,const char *keyword, const unsigned char *memory, size_t length); diff --git a/include/my_global.h b/include/my_global.h index 5e99c579bfd..b0db017c565 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -46,15 +46,6 @@ #define HAVE_ERRNO_AS_DEFINE #endif /* __CYGWIN__ */ -#if defined(__QNXNTO__) && !defined(FD_SETSIZE) -#define FD_SETSIZE 1024 /* Max number of file descriptor bits in - fd_set, used when calling 'select' - Must be defined before including - "sys/select.h" and "sys/time.h" - */ -#endif - - /* to make command line shorter we'll define USE_PRAGMA_INTERFACE here */ #ifdef USE_PRAGMA_IMPLEMENTATION #define USE_PRAGMA_INTERFACE @@ -82,20 +73,7 @@ #define CPP_UNNAMED_NS_END } #endif -#if defined(_WIN32) #include -#elif defined(__NETWARE__) -#include -#include -#if defined(__cplusplus) && defined(inline) -#undef inline /* fix configure problem */ -#endif -#else -#include -#if defined(__cplusplus) && defined(inline) -#undef inline /* fix configure problem */ -#endif -#endif /* _WIN32... */ #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE #define HAVE_PSI_INTERFACE @@ -108,12 +86,6 @@ #define IF_WIN(A,B) B #endif -#ifdef __NETWARE__ -#define IF_NETWARE(A,B) A -#else -#define IF_NETWARE(A,B) B -#endif - #ifndef DBUG_OFF #define IF_DBUG(A,B) A #else @@ -143,12 +115,6 @@ #define HAVE_EXTERNAL_CLIENT #endif -/* Some defines to avoid ifdefs in the code */ -#ifndef NETWARE_YIELD -#define NETWARE_YIELD -#define NETWARE_SET_SCREEN_MODE(A) -#endif - #if defined (_WIN32) /* off_t is 32 bit long. We do not use C runtime functions @@ -591,22 +557,6 @@ C_MODE_END extern "C" int madvise(void *addr, size_t len, int behav); #endif -#ifdef __QNXNTO__ -/* This has to be after include limits.h */ -#define HAVE_ERRNO_AS_DEFINE -#define HAVE_FCNTL_LOCK -#undef HAVE_FINITE -#undef LONGLONG_MIN /* These get wrongly defined in QNX 6.2 */ -#undef LONGLONG_MAX /* standard system library 'limits.h' */ -#ifdef __cplusplus -#ifndef HAVE_RINT -#define HAVE_RINT -#endif /* rint() and isnan() functions are not */ -#define rint(a) std::rint(a) /* visible in C++ scope due to an error */ -#define isnan(a) std::isnan(a) /* in the usr/include/math.h on QNX */ -#endif -#endif - /* We can not live without the following defines */ #define USE_MYFUNC 1 /* Must use syscall indirection */ @@ -627,26 +577,34 @@ extern "C" int madvise(void *addr, size_t len, int behav); #endif /* Does the system remember a signal handler after a signal ? */ -#ifndef HAVE_BSD_SIGNALS -#define DONT_REMEMBER_SIGNAL +#if !defined(HAVE_BSD_SIGNALS) && !defined(HAVE_SIGACTION) +#define SIGNAL_HANDLER_RESET_ON_DELIVERY #endif -#if defined(_lint) || defined(FORCE_INIT_OF_VARS) -#define LINT_INIT(var) var=0 /* No uninitialize-warning */ +/* + Deprecated workaround for false-positive uninitialized variables + warnings. Those should be silenced using tool-specific heuristics. + + Enabled by default for g++ due to the bug referenced below. +*/ +#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \ + (defined(__GNUC__) && defined(__cplusplus)) +#define LINT_INIT(var) var= 0 #else #define LINT_INIT(var) #endif -/* +/* Suppress uninitialized variable warning without generating code. The _cplusplus is a temporary workaround for C++ code pending a fix - for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772). + for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772). */ -#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(__cplusplus) || \ - !defined(__GNUC__) +#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \ + defined(__cplusplus) || !defined(__GNUC__) #define UNINIT_VAR(x) x= 0 #else +/* GCC specific self-initialization which inhibits the warning. */ #define UNINIT_VAR(x) x= x #endif @@ -670,7 +628,6 @@ typedef unsigned short ushort; #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 test_all_bits(a,b) (((a) & (b)) == (b)) -#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1)) #define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0]))) /* Define some general constants */ @@ -691,7 +648,7 @@ typedef unsigned short ushort; #define my_const_cast(A) (A) #endif -#include +#include /* Wen using the embedded library, users might run into link problems, @@ -704,16 +661,6 @@ int __cxa_pure_virtual () __attribute__ ((weak)); C_MODE_END #endif -/* From old s-system.h */ - -/* - Support macros for non ansi & other old compilers. Since such - things are no longer supported we do nothing. We keep then since - some of our code may still be needed to upgrade old customers. -*/ -#define _VARARGS(X) X -#define _STATIC_VARARGS(X) X - /* The DBUG_ON flag always takes precedence over default DBUG_OFF */ #if defined(DBUG_ON) && defined(DBUG_OFF) #undef DBUG_OFF @@ -729,7 +676,6 @@ C_MODE_END #define MIN_ARRAY_SIZE 0 /* Zero or One. Gcc allows zero*/ #define ASCII_BITS_USED 8 /* Bit char used */ -#define NEAR_F /* No near function handling */ /* Some types that is different between systems */ @@ -1073,20 +1019,6 @@ typedef long long my_ptrdiff_t; #define ADD_TO_PTR(ptr,size,type) (type) ((uchar*) (ptr)+size) #define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((uchar*) (A) - (uchar*) (B)) -#define MY_DIV_UP(A, B) (((A) + (B) - 1) / (B)) -#define MY_ALIGNED_BYTE_ARRAY(N, S, T) T N[MY_DIV_UP(S, sizeof(T))] - -#ifdef __cplusplus -template struct Aligned_char_array -{ - union { - void *v; // Ensures alignment. - char arr[sz]; // The actual buffer. - } u; - void* arr() { return &u.arr[0]; } -}; -#endif /* __cplusplus */ - /* Custom version of standard offsetof() macro which can be used to get offsets of members in class for non-POD types (according to the current @@ -1103,14 +1035,6 @@ template struct Aligned_char_array ((size_t)((char *)&(((TYPE *)0x10)->MEMBER) - (char*)0x10)) #define NullS (char *) 0 -/* Nowdays we do not support MessyDos */ -#ifndef NEAR -#define NEAR /* Who needs segments ? */ -#define FAR /* On a good machine */ -#ifndef HUGE_PTR -#define HUGE_PTR -#endif -#endif #ifdef STDCALL #undef STDCALL @@ -1622,17 +1546,6 @@ do { doubleget_union _tmp; \ #endif /* WORDS_BIGENDIAN */ -/* sprintf does not always return the number of bytes :- */ -#ifdef SPRINTF_RETURNS_INT -#define my_sprintf(buff,args) sprintf args -#else -#ifdef SPRINTF_RETURNS_PTR -#define my_sprintf(buff,args) ((int)(sprintf args - buff)) -#else -#define my_sprintf(buff,args) ((ulong) sprintf args, (ulong) strlen(buff)) -#endif -#endif - #ifndef THREAD #define thread_safe_increment(V,L) (V)++ #define thread_safe_decrement(V,L) (V)-- @@ -1677,25 +1590,12 @@ do { doubleget_union _tmp; \ #endif -#ifndef __NETWARE__ /* * Include standard definitions of operator new and delete. */ #ifdef __cplusplus #include #endif -#else -/* - * Define placement versions of operator new and operator delete since - * we don't have when building for Netware. - */ -#ifdef __cplusplus -inline void *operator new(size_t, void *ptr) { return ptr; } -inline void *operator new[](size_t, void *ptr) { return ptr; } -inline void operator delete(void*, void*) { /* Do nothing */ } -inline void operator delete[](void*, void*) { /* Do nothing */ } -#endif -#endif /* Length of decimal number represented by INT32. */ #define MY_INT32_NUM_DECIMAL_DIGITS 11 diff --git a/include/my_net.h b/include/my_net.h index 8617f180431..1b8425984ae 100644 --- a/include/my_net.h +++ b/include/my_net.h @@ -46,7 +46,7 @@ C_MODE_START #include #endif -#if !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__NETWARE__) +#if !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) #include #include #include diff --git a/include/my_pthread.h b/include/my_pthread.h index ea37f6e6b92..e5ffa0db3bb 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -195,11 +195,6 @@ int pthread_cancel(pthread_t thread); #include #endif -#ifdef __NETWARE__ -void my_pthread_exit(void *status); -#define pthread_exit(A) my_pthread_exit(A) -#endif - #define pthread_key(T,V) pthread_key_t V #define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,(V)) #define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,(void*) (V)) @@ -356,7 +351,7 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res); #define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH) #undef pthread_detach_this_thread #define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); } -#elif !defined(__NETWARE__) /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */ +#else /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */ #define HAVE_PTHREAD_KILL #endif @@ -461,10 +456,6 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex); /* safe_mutex adds checking to mutex for easier debugging */ -#if defined(__NETWARE__) && !defined(SAFE_MUTEX_DETECT_DESTROY) -#define SAFE_MUTEX_DETECT_DESTROY -#endif - typedef struct st_safe_mutex_t { pthread_mutex_t global,mutex; diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h index 9250fd4579e..78e3dbca577 100644 --- a/include/my_stacktrace.h +++ b/include/my_stacktrace.h @@ -32,9 +32,7 @@ #define HAVE_STACKTRACE 1 #endif -#if !defined(__NETWARE__) #define HAVE_WRITE_CORE -#endif #if HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS && \ HAVE_CXXABI_H && HAVE_ABI_CXA_DEMANGLE && \ diff --git a/include/my_sys.h b/include/my_sys.h index 64b20753567..c5702ec7395 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -42,7 +42,7 @@ typedef struct my_aio_result { #endif /* HAVE_VALGRIND */ #ifndef THREAD -extern int NEAR my_errno; /* Last error in mysys */ +extern int my_errno; /* Last error in mysys */ #else #include #endif @@ -214,7 +214,7 @@ extern int errno; /* declare errno */ #endif /* #ifndef errno */ extern char *home_dir; /* Home directory for user */ extern const char *my_progname; /* program-name (printed in errors) */ -extern char NEAR curr_dir[]; /* Current directory for user */ +extern char curr_dir[]; /* Current directory for user */ extern void (*error_handler_hook)(uint my_err, const char *str,myf MyFlags); extern void (*fatal_error_handler_hook)(uint my_err, const char *str, myf MyFlags); @@ -247,17 +247,16 @@ extern void (*my_sigtstp_cleanup)(void), (*my_sigtstp_restart)(void), (*my_abort_hook)(int); /* Executed when comming from shell */ -extern MYSQL_PLUGIN_IMPORT int NEAR my_umask; /* Default creation mask */ -extern int NEAR my_umask_dir, - NEAR my_recived_signals, /* Signals we have got */ - NEAR my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */ - NEAR my_dont_interrupt; /* call remember_intr when set */ -extern my_bool NEAR my_use_symdir; -extern size_t sf_malloc_cur_memory, sf_malloc_max_memory; +extern MYSQL_PLUGIN_IMPORT int my_umask; /* Default creation mask */ +extern int my_umask_dir, + my_recived_signals, /* Signals we have got */ + my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */ + my_dont_interrupt; /* call remember_intr when set */ +extern my_bool my_use_symdir; extern ulong my_default_record_cache_size; -extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io, - NEAR my_disable_flush_key_blocks, NEAR my_disable_symlinks; +extern my_bool my_disable_locking, my_disable_async_io, + my_disable_flush_key_blocks, my_disable_symlinks; extern char wild_many,wild_one,wild_prefix; extern const char *charsets_dir; /* from default.c */ @@ -650,10 +649,10 @@ extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags); extern int my_sync(File fd, myf my_flags); extern int my_sync_dir(const char *dir_name, myf my_flags); extern int my_sync_dir_by_file(const char *file_name, myf my_flags); -extern void my_error _VARARGS((int nr,myf MyFlags, ...)); -extern void my_printf_error _VARARGS((uint my_err, const char *format, - myf MyFlags, ...)) - ATTRIBUTE_FORMAT(printf, 2, 4); +extern void my_error(int nr,myf MyFlags, ...); +extern void my_printf_error(uint my_err, const char *format, + myf MyFlags, ...) + ATTRIBUTE_FORMAT(printf, 2, 4); extern void my_printv_error(uint error, const char *format, myf MyFlags, va_list ap); extern int my_error_register(const char** (*get_errmsgs) (), @@ -913,10 +912,7 @@ extern int my_getncpus(); #define MAP_FAILED ((void *)-1) #define MS_SYNC 0x0000 -#ifndef __NETWARE__ #define HAVE_MMAP -#endif - void *my_mmap(void *, size_t, int, int, int, my_off_t); int my_munmap(void *, size_t); #endif @@ -981,10 +977,6 @@ void my_security_attr_free(SECURITY_ATTRIBUTES *sa); char* my_cgets(char *string, size_t clen, size_t* plen); #endif -#ifdef __NETWARE__ -void netware_reg_user(const char *ip, const char *user, - const char *application); -#endif #include diff --git a/include/my_time.h b/include/my_time.h index 829cb706bb6..fdfe130c45f 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -35,8 +35,6 @@ extern uchar days_in_month[]; Using the system built in time_t is not an option as we rely on the above requirements in the time functions - - For example QNX has an unsigned time_t type */ typedef long my_time_t; diff --git a/include/myisam.h b/include/myisam.h index d590a29c1b3..7547f6b475e 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -55,8 +55,6 @@ extern "C" { #define MI_MAX_MSG_BUF 1024 /* used in CHECK TABLE, REPAIR TABLE */ #define MI_NAME_IEXT ".MYI" #define MI_NAME_DEXT ".MYD" -/* Max extra space to use when sorting keys */ -#define MI_MAX_TEMP_LENGTH 2*1024L*1024L*1024L /* Possible values for myisam_block_size (must be power of 2) */ #define MI_KEY_BLOCK_LENGTH 1024 /* default key block length */ diff --git a/include/mysql.h b/include/mysql.h index 452b4374cf7..7eef91cf55a 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -79,10 +79,6 @@ extern char *mysql_unix_port; #define CLIENT_NET_READ_TIMEOUT 365*24*3600 /* Timeout on read */ #define CLIENT_NET_WRITE_TIMEOUT 365*24*3600 /* Timeout on write */ -#ifdef __NETWARE__ -#pragma pack(push, 8) /* 8 byte alignment */ -#endif - #define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG) #define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG) #define IS_BLOB(n) ((n) & BLOB_FLAG) @@ -746,10 +742,6 @@ int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB); (*(mysql)->methods->advanced_command)(mysql, command, 0, \ 0, arg, length, 1, stmt) -#ifdef __NETWARE__ -#pragma pack(pop) /* restore alignment */ -#endif - #ifdef __cplusplus } #endif diff --git a/include/mysql/psi/mysql_file.h b/include/mysql/psi/mysql_file.h index 820979f16ee..de145f642e1 100644 --- a/include/mysql/psi/mysql_file.h +++ b/include/mysql/psi/mysql_file.h @@ -506,9 +506,10 @@ inline_mysql_file_fgets( char *result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_READ); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) size, src_file, src_line); @@ -532,9 +533,10 @@ inline_mysql_file_fgetc( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_READ); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 1, src_file, src_line); @@ -558,10 +560,11 @@ inline_mysql_file_fputs( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; size_t bytes= 0; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_WRITE); if (likely(locker != NULL)) { @@ -588,9 +591,10 @@ inline_mysql_file_fputc( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_WRITE); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 1, src_file, src_line); @@ -614,9 +618,10 @@ inline_mysql_file_fprintf(MYSQL_FILE *file, const char *format, ...) va_list args; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_WRITE); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, __FILE__, __LINE__); @@ -642,9 +647,10 @@ inline_mysql_file_vfprintf( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_WRITE); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -668,9 +674,10 @@ inline_mysql_file_fflush( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_FLUSH); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -700,9 +707,10 @@ inline_mysql_file_fstat( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_descriptor_locker(filenr, + locker= PSI_server->get_thread_file_descriptor_locker(&state, filenr, PSI_FILE_FSTAT); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -726,9 +734,11 @@ inline_mysql_file_stat( MY_STAT *result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_STAT, + locker= PSI_server->get_thread_file_name_locker(&state, + key, PSI_FILE_STAT, path, &locker); if (likely(locker != NULL)) PSI_server->start_file_open_wait(locker, src_file, src_line); @@ -752,9 +762,10 @@ inline_mysql_file_chsize( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_descriptor_locker(file, + locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_CHSIZE); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) newlength, src_file, @@ -784,10 +795,11 @@ inline_mysql_file_fopen( { #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { locker= PSI_server->get_thread_file_name_locker - (key, PSI_FILE_STREAM_OPEN, filename, that); + (&state, key, PSI_FILE_STREAM_OPEN, filename, that); if (likely(locker != NULL)) that->m_psi= PSI_server->start_file_open_wait(locker, src_file, src_line); @@ -820,10 +832,11 @@ inline_mysql_file_fclose( { #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; DBUG_ASSERT(file != NULL); if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_STREAM_CLOSE); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -849,9 +862,10 @@ inline_mysql_file_fread( size_t result= 0; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_READ); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, count, src_file, src_line); @@ -882,9 +896,10 @@ inline_mysql_file_fwrite( size_t result= 0; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_WRITE); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, count, src_file, src_line); @@ -915,9 +930,10 @@ inline_mysql_file_fseek( my_off_t result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_SEEK); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -941,9 +957,10 @@ inline_mysql_file_ftell( my_off_t result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server && file->m_psi)) { - locker= PSI_server->get_thread_file_stream_locker(file->m_psi, + locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi, PSI_FILE_TELL); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -967,9 +984,10 @@ inline_mysql_file_create( File file; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_CREATE, + locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_CREATE, filename, &locker); if (likely(locker != NULL)) PSI_server->start_file_open_wait(locker, src_file, src_line); @@ -1014,9 +1032,10 @@ inline_mysql_file_open( File file; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_OPEN, + locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_OPEN, filename, &locker); if (likely(locker != NULL)) PSI_server->start_file_open_wait(locker, src_file, src_line); @@ -1040,9 +1059,10 @@ inline_mysql_file_close( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_descriptor_locker(file, + locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_CLOSE); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -1066,9 +1086,10 @@ inline_mysql_file_read( size_t result= 0; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_descriptor_locker(file, + locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_READ); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, count, src_file, src_line); @@ -1099,9 +1120,10 @@ inline_mysql_file_write( size_t result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_descriptor_locker(file, + locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_WRITE); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, count, src_file, src_line); @@ -1132,9 +1154,10 @@ inline_mysql_file_pread( size_t result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_descriptor_locker(file, PSI_FILE_READ); + locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_READ); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, count, src_file, src_line); } @@ -1164,9 +1187,10 @@ inline_mysql_file_pwrite( size_t result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_descriptor_locker(file, + locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_WRITE); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, count, src_file, src_line); @@ -1197,9 +1221,10 @@ inline_mysql_file_seek( my_off_t result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_descriptor_locker(file, PSI_FILE_SEEK); + locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_SEEK); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); } @@ -1222,9 +1247,10 @@ inline_mysql_file_tell( my_off_t result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_descriptor_locker(file, PSI_FILE_TELL); + locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_TELL); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); } @@ -1247,9 +1273,10 @@ inline_mysql_file_delete( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_DELETE, + locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_DELETE, name, &locker); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -1273,9 +1300,10 @@ inline_mysql_file_rename( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_RENAME, + locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_RENAME, to, &locker); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -1300,9 +1328,10 @@ inline_mysql_file_create_with_symlink( File file; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_CREATE, + locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_CREATE, filename, &locker); if (likely(locker != NULL)) PSI_server->start_file_open_wait(locker, src_file, src_line); @@ -1327,9 +1356,10 @@ inline_mysql_file_delete_with_symlink( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_DELETE, + locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_DELETE, name, &locker); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -1353,9 +1383,10 @@ inline_mysql_file_rename_with_symlink( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_RENAME, + locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_RENAME, to, &locker); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); @@ -1379,9 +1410,10 @@ inline_mysql_file_sync( int result= 0; #ifdef HAVE_PSI_INTERFACE struct PSI_file_locker *locker= NULL; + PSI_file_locker_state state; if (likely(PSI_server != NULL)) { - locker= PSI_server->get_thread_file_descriptor_locker(fd, PSI_FILE_SYNC); + locker= PSI_server->get_thread_file_descriptor_locker(&state, fd, PSI_FILE_SYNC); if (likely(locker != NULL)) PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line); } diff --git a/include/mysql/psi/mysql_thread.h b/include/mysql/psi/mysql_thread.h index 193cb89647d..d133f2655fb 100644 --- a/include/mysql/psi/mysql_thread.h +++ b/include/mysql/psi/mysql_thread.h @@ -625,9 +625,10 @@ static inline int inline_mysql_mutex_lock( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_mutex_locker *locker= NULL; + PSI_mutex_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_mutex_locker(that->m_psi, PSI_MUTEX_LOCK); + locker= PSI_server->get_thread_mutex_locker(&state, that->m_psi, PSI_MUTEX_LOCK); if (likely(locker != NULL)) PSI_server->start_mutex_wait(locker, src_file, src_line); } @@ -654,9 +655,10 @@ static inline int inline_mysql_mutex_trylock( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_mutex_locker *locker= NULL; + PSI_mutex_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_mutex_locker(that->m_psi, PSI_MUTEX_TRYLOCK); + locker= PSI_server->get_thread_mutex_locker(&state, that->m_psi, PSI_MUTEX_TRYLOCK); if (likely(locker != NULL)) PSI_server->start_mutex_wait(locker, src_file, src_line); } @@ -682,13 +684,8 @@ static inline int inline_mysql_mutex_unlock( { int result; #ifdef HAVE_PSI_INTERFACE - struct PSI_thread *thread; if (likely(PSI_server && that->m_psi)) - { - thread= PSI_server->get_thread(); - if (likely(thread != NULL)) - PSI_server->unlock_mutex(thread, that->m_psi); - } + PSI_server->unlock_mutex(that->m_psi); #endif #ifdef SAFE_MUTEX result= safe_mutex_unlock(&that->m_mutex, src_file, src_line); @@ -771,9 +768,10 @@ static inline int inline_mysql_rwlock_rdlock( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_rwlock_locker *locker= NULL; + PSI_rwlock_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_rwlock_locker(that->m_psi, + locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, PSI_RWLOCK_READLOCK); if (likely(locker != NULL)) PSI_server->start_rwlock_rdwait(locker, src_file, src_line); @@ -798,9 +796,10 @@ static inline int inline_mysql_prlock_rdlock( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_rwlock_locker *locker= NULL; + PSI_rwlock_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_rwlock_locker(that->m_psi, + locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, PSI_RWLOCK_READLOCK); if (likely(locker != NULL)) PSI_server->start_rwlock_rdwait(locker, src_file, src_line); @@ -825,9 +824,10 @@ static inline int inline_mysql_rwlock_wrlock( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_rwlock_locker *locker= NULL; + PSI_rwlock_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_rwlock_locker(that->m_psi, + locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, PSI_RWLOCK_WRITELOCK); if (likely(locker != NULL)) PSI_server->start_rwlock_wrwait(locker, src_file, src_line); @@ -852,9 +852,10 @@ static inline int inline_mysql_prlock_wrlock( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_rwlock_locker *locker= NULL; + PSI_rwlock_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_rwlock_locker(that->m_psi, + locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, PSI_RWLOCK_WRITELOCK); if (likely(locker != NULL)) PSI_server->start_rwlock_wrwait(locker, src_file, src_line); @@ -879,9 +880,10 @@ static inline int inline_mysql_rwlock_tryrdlock( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_rwlock_locker *locker= NULL; + PSI_rwlock_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_rwlock_locker(that->m_psi, + locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, PSI_RWLOCK_TRYREADLOCK); if (likely(locker != NULL)) PSI_server->start_rwlock_rdwait(locker, src_file, src_line); @@ -906,9 +908,10 @@ static inline int inline_mysql_prlock_tryrdlock( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_rwlock_locker *locker= NULL; + PSI_rwlock_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_rwlock_locker(that->m_psi, + locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, PSI_RWLOCK_TRYREADLOCK); if (likely(locker != NULL)) PSI_server->start_rwlock_rdwait(locker, src_file, src_line); @@ -933,9 +936,10 @@ static inline int inline_mysql_rwlock_trywrlock( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_rwlock_locker *locker= NULL; + PSI_rwlock_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_rwlock_locker(that->m_psi, + locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, PSI_RWLOCK_TRYWRITELOCK); if (likely(locker != NULL)) PSI_server->start_rwlock_wrwait(locker, src_file, src_line); @@ -960,9 +964,10 @@ static inline int inline_mysql_prlock_trywrlock( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_rwlock_locker *locker= NULL; + PSI_rwlock_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_rwlock_locker(that->m_psi, + locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, PSI_RWLOCK_TRYWRITELOCK); if (likely(locker != NULL)) PSI_server->start_rwlock_wrwait(locker, src_file, src_line); @@ -982,13 +987,8 @@ static inline int inline_mysql_rwlock_unlock( { int result; #ifdef HAVE_PSI_INTERFACE - struct PSI_thread *thread; if (likely(PSI_server && that->m_psi)) - { - thread= PSI_server->get_thread(); - if (likely(thread != NULL)) - PSI_server->unlock_rwlock(thread, that->m_psi); - } + PSI_server->unlock_rwlock(that->m_psi); #endif result= rw_unlock(&that->m_rwlock); return result; @@ -1000,13 +1000,8 @@ static inline int inline_mysql_prlock_unlock( { int result; #ifdef HAVE_PSI_INTERFACE - struct PSI_thread *thread; if (likely(PSI_server && that->m_psi)) - { - thread= PSI_server->get_thread(); - if (likely(thread != NULL)) - PSI_server->unlock_rwlock(thread, that->m_psi); - } + PSI_server->unlock_rwlock(that->m_psi); #endif result= rw_pr_unlock(&that->m_prlock); return result; @@ -1053,9 +1048,10 @@ static inline int inline_mysql_cond_wait( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_cond_locker *locker= NULL; + PSI_cond_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_cond_locker(that->m_psi, mutex->m_psi, + locker= PSI_server->get_thread_cond_locker(&state, that->m_psi, mutex->m_psi, PSI_COND_WAIT); if (likely(locker != NULL)) PSI_server->start_cond_wait(locker, src_file, src_line); @@ -1081,9 +1077,10 @@ static inline int inline_mysql_cond_timedwait( int result; #ifdef HAVE_PSI_INTERFACE struct PSI_cond_locker *locker= NULL; + PSI_cond_locker_state state; if (likely(PSI_server && that->m_psi)) { - locker= PSI_server->get_thread_cond_locker(that->m_psi, mutex->m_psi, + locker= PSI_server->get_thread_cond_locker(&state, that->m_psi, mutex->m_psi, PSI_COND_TIMEDWAIT); if (likely(locker != NULL)) PSI_server->start_cond_wait(locker, src_file, src_line); @@ -1102,13 +1099,8 @@ static inline int inline_mysql_cond_signal( { int result; #ifdef HAVE_PSI_INTERFACE - struct PSI_thread *thread; if (likely(PSI_server && that->m_psi)) - { - thread= PSI_server->get_thread(); - if (likely(thread != NULL)) - PSI_server->signal_cond(thread, that->m_psi); - } + PSI_server->signal_cond(that->m_psi); #endif result= pthread_cond_signal(&that->m_cond); return result; @@ -1119,13 +1111,8 @@ static inline int inline_mysql_cond_broadcast( { int result; #ifdef HAVE_PSI_INTERFACE - struct PSI_thread *thread; if (likely(PSI_server && that->m_psi)) - { - thread= PSI_server->get_thread(); - if (likely(thread != NULL)) - PSI_server->broadcast_cond(thread, that->m_psi); - } + PSI_server->broadcast_cond(that->m_psi); #endif result= pthread_cond_broadcast(&that->m_cond); return result; diff --git a/include/mysql/psi/psi.h b/include/mysql/psi/psi.h index 1cab6c3a11a..562e4a80fd5 100644 --- a/include/mysql/psi/psi.h +++ b/include/mysql/psi/psi.h @@ -422,6 +422,175 @@ struct PSI_file_info_v1 int m_flags; }; +/** + State data storage for @c get_thread_mutex_locker_v1_t. + This structure provide temporary storage to a mutex locker. + The content of this structure is considered opaque, + the fields are only hints of what an implementation + of the psi interface can use. + This memory is provided by the instrumented code for performance reasons. + @sa get_thread_mutex_locker_v1_t +*/ +struct PSI_mutex_locker_state_v1 +{ + /** Internal state. */ + uint m_flags; + /** Current mutex. */ + struct PSI_mutex *m_mutex; + /** Current thread. */ + struct PSI_thread *m_thread; + /** Timer start. */ + ulonglong m_timer_start; + /** Timer function. */ + ulonglong (*m_timer)(void); + /** Current operation. */ + enum PSI_mutex_operation m_operation; + /** Source file. */ + const char* m_src_file; + /** Source line number. */ + int m_src_line; + /** Internal data. */ + void *m_wait; +}; + +/** + State data storage for @c get_thread_rwlock_locker_v1_t. + This structure provide temporary storage to a rwlock locker. + The content of this structure is considered opaque, + the fields are only hints of what an implementation + of the psi interface can use. + This memory is provided by the instrumented code for performance reasons. + @sa get_thread_rwlock_locker_v1_t +*/ +struct PSI_rwlock_locker_state_v1 +{ + /** Internal state. */ + uint m_flags; + /** Current rwlock. */ + struct PSI_rwlock *m_rwlock; + /** Current thread. */ + struct PSI_thread *m_thread; + /** Timer start. */ + ulonglong m_timer_start; + /** Timer function. */ + ulonglong (*m_timer)(void); + /** Current operation. */ + enum PSI_rwlock_operation m_operation; + /** Source file. */ + const char* m_src_file; + /** Source line number. */ + int m_src_line; + /** Internal data. */ + void *m_wait; +}; + +/** + State data storage for @c get_thread_cond_locker_v1_t. + This structure provide temporary storage to a condition locker. + The content of this structure is considered opaque, + the fields are only hints of what an implementation + of the psi interface can use. + This memory is provided by the instrumented code for performance reasons. + @sa get_thread_cond_locker_v1_t +*/ +struct PSI_cond_locker_state_v1 +{ + /** Internal state. */ + uint m_flags; + /** Current condition. */ + struct PSI_cond *m_cond; + /** Current mutex. */ + struct PSI_mutex *m_mutex; + /** Current thread. */ + struct PSI_thread *m_thread; + /** Timer start. */ + ulonglong m_timer_start; + /** Timer function. */ + ulonglong (*m_timer)(void); + /** Current operation. */ + enum PSI_cond_operation m_operation; + /** Source file. */ + const char* m_src_file; + /** Source line number. */ + int m_src_line; + /** Internal data. */ + void *m_wait; +}; + +/** + State data storage for @c get_thread_file_name_locker_v1_t. + This structure provide temporary storage to a file locker. + The content of this structure is considered opaque, + the fields are only hints of what an implementation + of the psi interface can use. + This memory is provided by the instrumented code for performance reasons. + @sa get_thread_file_name_locker_v1_t + @sa get_thread_file_stream_locker_v1_t + @sa get_thread_file_descriptor_locker_v1_t +*/ +struct PSI_file_locker_state_v1 +{ + /** Internal state. */ + uint m_flags; + /** Current file. */ + struct PSI_file *m_file; + /** Current thread. */ + struct PSI_thread *m_thread; + /** Operation number of bytes. */ + size_t m_number_of_bytes; + /** Timer start. */ + ulonglong m_timer_start; + /** Timer function. */ + ulonglong (*m_timer)(void); + /** Current operation. */ + enum PSI_file_operation m_operation; + /** Source file. */ + const char* m_src_file; + /** Source line number. */ + int m_src_line; + /** Internal data. */ + void *m_wait; +}; + +/** + State data storage for @c get_thread_table_locker_v1_t. + This structure provide temporary storage to a table locker. + The content of this structure is considered opaque, + the fields are only hints of what an implementation + of the psi interface can use. + This memory is provided by the instrumented code for performance reasons. + @sa get_thread_table_locker_v1_t +*/ +struct PSI_table_locker_state_v1 +{ + /** Internal state. */ + uint m_flags; + /** Current table handle. */ + struct PSI_table *m_table; + /** Current table share. */ + struct PSI_table_share *m_table_share; + /** Instrumentation class. */ + void *m_class; + /** Current thread. */ + struct PSI_thread *m_thread; + /** Timer start. */ + ulonglong m_timer_start; + /** Timer function. */ + ulonglong (*m_timer)(void); + /* Current operation (waiting for WL#4895). */ + /* enum PSI_table_operation m_operation; */ + /** Current table io index. */ + uint m_index; + /** Current table lock index. */ + uint m_lock_index; + /** Source file. */ + const char* m_src_file; + /** Source line number. */ + int m_src_line; + /** Internal data. */ + void *m_wait; +}; + /* Using typedef to make reuse between PSI_v1 and PSI_v2 easier later. */ /** @@ -619,40 +788,51 @@ typedef void (*delete_thread_v1_t)(struct PSI_thread *thread); /** Get a mutex instrumentation locker. + @param state data storage for the locker @param mutex the instrumented mutex to lock @return a mutex locker, or NULL */ typedef struct PSI_mutex_locker* (*get_thread_mutex_locker_v1_t) - (struct PSI_mutex *mutex, enum PSI_mutex_operation op); + (struct PSI_mutex_locker_state_v1 *state, + struct PSI_mutex *mutex, + enum PSI_mutex_operation op); /** Get a rwlock instrumentation locker. + @param state data storage for the locker @param rwlock the instrumented rwlock to lock @return a rwlock locker, or NULL */ typedef struct PSI_rwlock_locker* (*get_thread_rwlock_locker_v1_t) - (struct PSI_rwlock *rwlock, enum PSI_rwlock_operation op); + (struct PSI_rwlock_locker_state_v1 *state, + struct PSI_rwlock *rwlock, + enum PSI_rwlock_operation op); /** Get a cond instrumentation locker. + @param state data storage for the locker @param cond the instrumented condition to wait on @param mutex the instrumented mutex associated with the condition @return a condition locker, or NULL */ typedef struct PSI_cond_locker* (*get_thread_cond_locker_v1_t) - (struct PSI_cond *cond, struct PSI_mutex *mutex, + (struct PSI_cond_locker_state_v1 *state, + struct PSI_cond *cond, struct PSI_mutex *mutex, enum PSI_cond_operation op); /** Get a table instrumentation locker. + @param state data storage for the locker @param table the instrumented table to lock @return a table locker, or NULL */ typedef struct PSI_table_locker* (*get_thread_table_locker_v1_t) - (struct PSI_table *table); + (struct PSI_table_locker_state_v1 *state, + struct PSI_table *table); /** Get a file instrumentation locker, for opening or creating a file. + @param state data storage for the locker @param key the file instrumentation key @param op the operation to perform @param name the file name @@ -660,58 +840,59 @@ typedef struct PSI_table_locker* (*get_thread_table_locker_v1_t) @return a file locker, or NULL */ typedef struct PSI_file_locker* (*get_thread_file_name_locker_v1_t) - (PSI_file_key key, enum PSI_file_operation op, const char *name, + (struct PSI_file_locker_state_v1 *state, + PSI_file_key key, enum PSI_file_operation op, const char *name, const void *identity); /** Get a file stream instrumentation locker. + @param state data storage for the locker @param file the file stream to access @param op the operation to perform @return a file locker, or NULL */ typedef struct PSI_file_locker* (*get_thread_file_stream_locker_v1_t) - (struct PSI_file *file, enum PSI_file_operation op); + (struct PSI_file_locker_state_v1 *state, + struct PSI_file *file, enum PSI_file_operation op); /** Get a file instrumentation locker. + @param state data storage for the locker @param file the file descriptor to access @param op the operation to perform @return a file locker, or NULL */ typedef struct PSI_file_locker* (*get_thread_file_descriptor_locker_v1_t) - (File file, enum PSI_file_operation op); + (struct PSI_file_locker_state_v1 *state, + File file, enum PSI_file_operation op); /** Record a mutex instrumentation unlock event. - @param thread the running thread instrumentation @param mutex the mutex instrumentation */ typedef void (*unlock_mutex_v1_t) - (struct PSI_thread *thread, struct PSI_mutex *mutex); + (struct PSI_mutex *mutex); /** Record a rwlock instrumentation unlock event. - @param thread the running thread instrumentation @param rwlock the rwlock instrumentation */ typedef void (*unlock_rwlock_v1_t) - (struct PSI_thread *thread, struct PSI_rwlock *rwlock); + (struct PSI_rwlock *rwlock); /** Record a condition instrumentation signal event. - @param thread the running thread instrumentation @param cond the cond instrumentation */ typedef void (*signal_cond_v1_t) - (struct PSI_thread *thread, struct PSI_cond *cond); + (struct PSI_cond *cond); /** Record a condition instrumentation broadcast event. - @param thread the running thread instrumentation @param cond the cond instrumentation */ typedef void (*broadcast_cond_v1_t) - (struct PSI_thread *thread, struct PSI_cond *cond); + (struct PSI_cond *cond); /** Record a mutex instrumentation wait start event. @@ -1013,6 +1194,36 @@ struct PSI_file_info_v2 int placeholder; }; +struct PSI_mutex_locker_state_v2 +{ + /** Placeholder */ + int placeholder; +}; + +struct PSI_rwlock_locker_state_v2 +{ + /** Placeholder */ + int placeholder; +}; + +struct PSI_cond_locker_state_v2 +{ + /** Placeholder */ + int placeholder; +}; + +struct PSI_file_locker_state_v2 +{ + /** Placeholder */ + int placeholder; +}; + +struct PSI_table_locker_state_v2 +{ + /** Placeholder */ + int placeholder; +}; + /** @} (end of group Group_PSI_v2) */ #endif /* HAVE_PSI_2 */ @@ -1056,6 +1267,11 @@ typedef struct PSI_rwlock_info_v1 PSI_rwlock_info; typedef struct PSI_cond_info_v1 PSI_cond_info; typedef struct PSI_thread_info_v1 PSI_thread_info; typedef struct PSI_file_info_v1 PSI_file_info; +typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state; +typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state; +typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state; +typedef struct PSI_file_locker_state_v1 PSI_file_locker_state; +typedef struct PSI_table_locker_state_v1 PSI_table_locker_state; #endif #ifdef USE_PSI_2 @@ -1065,6 +1281,11 @@ typedef struct PSI_rwlock_info_v2 PSI_rwlock_info; typedef struct PSI_cond_info_v2 PSI_cond_info; typedef struct PSI_thread_info_v2 PSI_thread_info; typedef struct PSI_file_info_v2 PSI_file_info; +typedef struct PSI_mutex_locker_state_v2 PSI_mutex_locker_state; +typedef struct PSI_rwlock_locker_state_v2 PSI_rwlock_locker_state; +typedef struct PSI_cond_locker_state_v2 PSI_cond_locker_state; +typedef struct PSI_file_locker_state_v2 PSI_file_locker_state; +typedef struct PSI_table_locker_state_v2 PSI_table_locker_state; #endif #else /* HAVE_PSI_INTERFACE */ diff --git a/include/mysql/psi/psi_abi_v1.h.pp b/include/mysql/psi/psi_abi_v1.h.pp index 6ecd0f3098d..adb3010469b 100644 --- a/include/mysql/psi/psi_abi_v1.h.pp +++ b/include/mysql/psi/psi_abi_v1.h.pp @@ -88,6 +88,71 @@ struct PSI_file_info_v1 const char *m_name; int m_flags; }; +struct PSI_mutex_locker_state_v1 +{ + uint m_flags; + struct PSI_mutex *m_mutex; + struct PSI_thread *m_thread; + ulonglong m_timer_start; + ulonglong (*m_timer)(void); + enum PSI_mutex_operation m_operation; + const char* m_src_file; + int m_src_line; + void *m_wait; +}; +struct PSI_rwlock_locker_state_v1 +{ + uint m_flags; + struct PSI_rwlock *m_rwlock; + struct PSI_thread *m_thread; + ulonglong m_timer_start; + ulonglong (*m_timer)(void); + enum PSI_rwlock_operation m_operation; + const char* m_src_file; + int m_src_line; + void *m_wait; +}; +struct PSI_cond_locker_state_v1 +{ + uint m_flags; + struct PSI_cond *m_cond; + struct PSI_mutex *m_mutex; + struct PSI_thread *m_thread; + ulonglong m_timer_start; + ulonglong (*m_timer)(void); + enum PSI_cond_operation m_operation; + const char* m_src_file; + int m_src_line; + void *m_wait; +}; +struct PSI_file_locker_state_v1 +{ + uint m_flags; + struct PSI_file *m_file; + struct PSI_thread *m_thread; + size_t m_number_of_bytes; + ulonglong m_timer_start; + ulonglong (*m_timer)(void); + enum PSI_file_operation m_operation; + const char* m_src_file; + int m_src_line; + void *m_wait; +}; +struct PSI_table_locker_state_v1 +{ + uint m_flags; + struct PSI_table *m_table; + struct PSI_table_share *m_table_share; + void *m_class; + struct PSI_thread *m_thread; + ulonglong m_timer_start; + ulonglong (*m_timer)(void); + uint m_index; + uint m_lock_index; + const char* m_src_file; + int m_src_line; + void *m_wait; +}; typedef void (*register_mutex_v1_t) (const char *category, struct PSI_mutex_info_v1 *info, int count); typedef void (*register_rwlock_v1_t) @@ -129,29 +194,38 @@ typedef void (*set_thread_v1_t)(struct PSI_thread *thread); typedef void (*delete_current_thread_v1_t)(void); typedef void (*delete_thread_v1_t)(struct PSI_thread *thread); typedef struct PSI_mutex_locker* (*get_thread_mutex_locker_v1_t) - (struct PSI_mutex *mutex, enum PSI_mutex_operation op); + (struct PSI_mutex_locker_state_v1 *state, + struct PSI_mutex *mutex, + enum PSI_mutex_operation op); typedef struct PSI_rwlock_locker* (*get_thread_rwlock_locker_v1_t) - (struct PSI_rwlock *rwlock, enum PSI_rwlock_operation op); + (struct PSI_rwlock_locker_state_v1 *state, + struct PSI_rwlock *rwlock, + enum PSI_rwlock_operation op); typedef struct PSI_cond_locker* (*get_thread_cond_locker_v1_t) - (struct PSI_cond *cond, struct PSI_mutex *mutex, + (struct PSI_cond_locker_state_v1 *state, + struct PSI_cond *cond, struct PSI_mutex *mutex, enum PSI_cond_operation op); typedef struct PSI_table_locker* (*get_thread_table_locker_v1_t) - (struct PSI_table *table); + (struct PSI_table_locker_state_v1 *state, + struct PSI_table *table); typedef struct PSI_file_locker* (*get_thread_file_name_locker_v1_t) - (PSI_file_key key, enum PSI_file_operation op, const char *name, + (struct PSI_file_locker_state_v1 *state, + PSI_file_key key, enum PSI_file_operation op, const char *name, const void *identity); typedef struct PSI_file_locker* (*get_thread_file_stream_locker_v1_t) - (struct PSI_file *file, enum PSI_file_operation op); + (struct PSI_file_locker_state_v1 *state, + struct PSI_file *file, enum PSI_file_operation op); typedef struct PSI_file_locker* (*get_thread_file_descriptor_locker_v1_t) - (File file, enum PSI_file_operation op); + (struct PSI_file_locker_state_v1 *state, + File file, enum PSI_file_operation op); typedef void (*unlock_mutex_v1_t) - (struct PSI_thread *thread, struct PSI_mutex *mutex); + (struct PSI_mutex *mutex); typedef void (*unlock_rwlock_v1_t) - (struct PSI_thread *thread, struct PSI_rwlock *rwlock); + (struct PSI_rwlock *rwlock); typedef void (*signal_cond_v1_t) - (struct PSI_thread *thread, struct PSI_cond *cond); + (struct PSI_cond *cond); typedef void (*broadcast_cond_v1_t) - (struct PSI_thread *thread, struct PSI_cond *cond); + (struct PSI_cond *cond); typedef void (*start_mutex_wait_v1_t) (struct PSI_mutex_locker *locker, const char *src_file, uint src_line); typedef void (*end_mutex_wait_v1_t) @@ -240,5 +314,10 @@ typedef struct PSI_rwlock_info_v1 PSI_rwlock_info; typedef struct PSI_cond_info_v1 PSI_cond_info; typedef struct PSI_thread_info_v1 PSI_thread_info; typedef struct PSI_file_info_v1 PSI_file_info; +typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state; +typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state; +typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state; +typedef struct PSI_file_locker_state_v1 PSI_file_locker_state; +typedef struct PSI_table_locker_state_v1 PSI_table_locker_state; extern MYSQL_PLUGIN_IMPORT PSI *PSI_server; C_MODE_END diff --git a/include/mysql/psi/psi_abi_v2.h.pp b/include/mysql/psi/psi_abi_v2.h.pp index b32415a59b4..63f8c52c50a 100644 --- a/include/mysql/psi/psi_abi_v2.h.pp +++ b/include/mysql/psi/psi_abi_v2.h.pp @@ -82,11 +82,36 @@ struct PSI_file_info_v2 { int placeholder; }; +struct PSI_mutex_locker_state_v2 +{ + int placeholder; +}; +struct PSI_rwlock_locker_state_v2 +{ + int placeholder; +}; +struct PSI_cond_locker_state_v2 +{ + int placeholder; +}; +struct PSI_file_locker_state_v2 +{ + int placeholder; +}; +struct PSI_table_locker_state_v2 +{ + int placeholder; +}; typedef struct PSI_v2 PSI; typedef struct PSI_mutex_info_v2 PSI_mutex_info; typedef struct PSI_rwlock_info_v2 PSI_rwlock_info; typedef struct PSI_cond_info_v2 PSI_cond_info; typedef struct PSI_thread_info_v2 PSI_thread_info; typedef struct PSI_file_info_v2 PSI_file_info; +typedef struct PSI_mutex_locker_state_v2 PSI_mutex_locker_state; +typedef struct PSI_rwlock_locker_state_v2 PSI_rwlock_locker_state; +typedef struct PSI_cond_locker_state_v2 PSI_cond_locker_state; +typedef struct PSI_file_locker_state_v2 PSI_file_locker_state; +typedef struct PSI_table_locker_state_v2 PSI_table_locker_state; extern MYSQL_PLUGIN_IMPORT PSI *PSI_server; C_MODE_END diff --git a/include/mysys_err.h b/include/mysys_err.h index 6c18055b31b..9629dfec014 100644 --- a/include/mysys_err.h +++ b/include/mysys_err.h @@ -15,17 +15,15 @@ #ifndef _mysys_err_h #define _mysys_err_h + #ifdef __cplusplus - -#include "my_global.h" /* NEAR */ - extern "C" { #endif #define GLOBERRS (EE_ERROR_LAST - EE_ERROR_FIRST + 1) /* Nr of global errors */ #define EE(X) (globerrs[(X) - EE_ERROR_FIRST]) -extern const char * NEAR globerrs[]; /* my_error_messages is here */ +extern const char *globerrs[]; /* my_error_messages is here */ /* Error message numbers in global map */ /* diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared index e972a6bdec8..53264f2e559 100644 --- a/libmysql/Makefile.shared +++ b/libmysql/Makefile.shared @@ -38,7 +38,7 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \ strmake.lo strend.lo \ strnlen.lo strfill.lo is_prefix.lo \ int2str.lo str2int.lo strinstr.lo strcont.lo \ - strcend.lo bcmp.lo ctype-latin1.lo \ + strcend.lo ctype-latin1.lo \ bchange.lo bmove.lo bmove_upp.lo longlong2str.lo \ strtoull.lo strtoll.lo llstr.lo my_vsnprintf.lo \ ctype.lo ctype-simple.lo ctype-bin.lo ctype-mb.lo \ diff --git a/libmysql/dll.c b/libmysql/dll.c index 8fcf41c792c..b5fcba13f91 100644 --- a/libmysql/dll.c +++ b/libmysql/dll.c @@ -48,7 +48,7 @@ void libmysql_init(void) #ifdef __WIN__ static int inited=0,threads=0; -HINSTANCE NEAR s_hModule; /* Saved module handle */ +HINSTANCE s_hModule; /* Saved module handle */ DWORD main_thread; BOOL APIENTRY LibMain(HANDLE hInst,DWORD ul_reason_being_called, @@ -105,21 +105,3 @@ int __stdcall DllMain(HANDLE hInst,DWORD ul_reason_being_called,LPVOID lpReserve return TRUE; } -#elif defined(WINDOWS) - -/**************************************************************************** -** This routine is called by LIBSTART.ASM at module load time. All it -** does in this sample is remember the DLL module handle. The module -** handle is needed if you want to do things like load stuff from the -** resource file (for instance string resources). -****************************************************************************/ - -int _export FAR PASCAL libmain(HANDLE hModule,short cbHeapSize, - UCHAR FAR *lszCmdLine) -{ - s_hModule = hModule; - libmysql_init(); - return TRUE; -} - -#endif diff --git a/libmysql/get_password.c b/libmysql/get_password.c index cbe5fce6949..56514a8d864 100644 --- a/libmysql/get_password.c +++ b/libmysql/get_password.c @@ -36,7 +36,7 @@ #include #endif /* HAVE_PWD_H */ #else /* ! HAVE_GETPASS */ -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) #include #ifdef HAVE_TERMIOS_H /* For tty-password */ #include @@ -55,9 +55,7 @@ #include #endif #else -#ifndef __NETWARE__ #include -#endif /* __NETWARE__ */ #endif /* __WIN__ */ #endif /* HAVE_GETPASS */ @@ -65,16 +63,8 @@ #define getpass(A) getpassphrase(A) #endif -#if defined( __WIN__) || defined(__NETWARE__) +#if defined(__WIN__) /* were just going to fake it here and get input from the keyboard */ - -#ifdef __NETWARE__ -#undef _getch -#undef _cputs -#define _getch getcharacter -#define _cputs(A) putstring(A) -#endif - char *get_tty_password(const char *opt_message) { char to[80]; diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index b69c27731dd..02ed93fa501 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -34,7 +34,7 @@ #ifdef HAVE_PWD_H #include #endif -#if !defined(MSDOS) && !defined(__WIN__) +#if !defined(__WIN__) #include #include #include @@ -45,7 +45,7 @@ #ifdef HAVE_SYS_SELECT_H #include #endif -#endif /* !defined(MSDOS) && !defined(__WIN__) */ +#endif /* !defined(__WIN__) */ #ifdef HAVE_POLL #include #endif @@ -74,7 +74,7 @@ ulong max_allowed_packet= 1024L*1024L*1024L; my_bool net_flush(NET *net); #endif -#if defined(MSDOS) || defined(__WIN__) +#if defined(__WIN__) /* socket_errno is defined in my_global.h for all platforms */ #define perror(A) #else @@ -128,31 +128,29 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)), init_client_errs(); if (!mysql_port) { - mysql_port = MYSQL_PORT; -#ifndef MSDOS - { - struct servent *serv_ptr __attribute__((unused)); - char *env; + char *env; + struct servent *serv_ptr __attribute__((unused)); - /* - if builder specifically requested a default port, use that - (even if it coincides with our factory default). - only if they didn't do we check /etc/services (and, failing - on that, fall back to the factory default of 3306). - either default can be overridden by the environment variable - MYSQL_TCP_PORT, which in turn can be overridden with command - line options. - */ + mysql_port = MYSQL_PORT; + + /* + if builder specifically requested a default port, use that + (even if it coincides with our factory default). + only if they didn't do we check /etc/services (and, failing + on that, fall back to the factory default of 3306). + either default can be overridden by the environment variable + MYSQL_TCP_PORT, which in turn can be overridden with command + line options. + */ #if MYSQL_PORT_DEFAULT == 0 - if ((serv_ptr = getservbyname("mysql", "tcp"))) - mysql_port = (uint) ntohs((ushort) serv_ptr->s_port); -#endif - if ((env = getenv("MYSQL_TCP_PORT"))) - mysql_port =(uint) atoi(env); - } + if ((serv_ptr= getservbyname("mysql", "tcp"))) + mysql_port= (uint) ntohs((ushort) serv_ptr->s_port); #endif + if ((env= getenv("MYSQL_TCP_PORT"))) + mysql_port=(uint) atoi(env); } + if (!mysql_unix_port) { char *env; @@ -165,7 +163,7 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)), mysql_unix_port = env; } mysql_debug(NullS); -#if defined(SIGPIPE) && !defined(__WIN__) && !defined(__NETWARE__) +#if defined(SIGPIPE) && !defined(__WIN__) (void) signal(SIGPIPE, SIG_IGN); #endif #ifdef EMBEDDED_LIBRARY @@ -318,7 +316,7 @@ sig_handler my_pipe_sig_handler(int sig __attribute__((unused))) { DBUG_PRINT("info",("Hit by signal %d",sig)); -#ifdef DONT_REMEMBER_SIGNAL +#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY (void) signal(SIGPIPE, my_pipe_sig_handler); #endif } @@ -479,15 +477,7 @@ struct passwd *getpwuid(uid_t); char* getlogin(void); #endif -#if defined(__NETWARE__) -/* Default to value of USER on NetWare, if unset use "UNKNOWN_USER" */ -void read_user_name(char *name) -{ - char *str=getenv("USER"); - strmake(name, str ? str : "UNKNOWN_USER", USERNAME_LENGTH); -} - -#elif !defined(MSDOS) && ! defined(VMS) && !defined(__WIN__) +#if !defined(__WIN__) void read_user_name(char *name) { @@ -517,7 +507,7 @@ void read_user_name(char *name) DBUG_VOID_RETURN; } -#else /* If MSDOS || VMS */ +#else /* If Windows */ void read_user_name(char *name) { @@ -2127,7 +2117,12 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length) stmt->insert_id= mysql->insert_id; if (res) { - set_stmt_errmsg(stmt, net); + /* + Don't set stmt error if stmt->mysql is NULL, as the error in this case + has already been set by mysql_prune_stmt_list(). + */ + if (stmt->mysql) + set_stmt_errmsg(stmt, net); DBUG_RETURN(1); } DBUG_RETURN(0); @@ -2338,7 +2333,12 @@ stmt_read_row_from_cursor(MYSQL_STMT *stmt, unsigned char **row) buff, sizeof(buff), (uchar*) 0, 0, 1, stmt)) { - set_stmt_errmsg(stmt, net); + /* + Don't set stmt error if stmt->mysql is NULL, as the error in this case + has already been set by mysql_prune_stmt_list(). + */ + if (stmt->mysql) + set_stmt_errmsg(stmt, net); return 1; } if ((*mysql->methods->read_rows_from_cursor)(stmt)) @@ -3025,7 +3025,12 @@ mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number, buff, sizeof(buff), (uchar*) data, length, 1, stmt)) { - set_stmt_errmsg(stmt, &mysql->net); + /* + Don't set stmt error if stmt->mysql is NULL, as the error in this case + has already been set by mysql_prune_stmt_list(). + */ + if (stmt->mysql) + set_stmt_errmsg(stmt, &mysql->net); DBUG_RETURN(1); } } @@ -4027,6 +4032,7 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field) case MYSQL_TYPE_TIME: field->max_length= 15; /* 19:23:48.123456 */ param->skip_result= skip_result_with_length; + break; case MYSQL_TYPE_DATE: field->max_length= 10; /* 2003-11-11 */ param->skip_result= skip_result_with_length; @@ -4440,7 +4446,12 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt) if (cli_advanced_command(mysql, COM_STMT_FETCH, buff, sizeof(buff), (uchar*) 0, 0, 1, stmt)) { - set_stmt_errmsg(stmt, net); + /* + Don't set stmt error if stmt->mysql is NULL, as the error in this case + has already been set by mysql_prune_stmt_list(). + */ + if (stmt->mysql) + set_stmt_errmsg(stmt, net); DBUG_RETURN(1); } } diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index 3519c6e2541..9d8c5edaa12 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -157,27 +157,22 @@ if DARWIN_MWCC mwld -lib -o $@ libmysqld_int.a `echo $(INC_LIB) | sort -u` $(storageobjects) else -rm -f libmysqld.a - if test "$(host_os)" = "netware" ; \ - then \ - $(libmysqld_a_AR) libmysqld.a $(INC_LIB) libmysqld_int.a $(storageobjects); \ - else \ - current_dir=`pwd`; \ - rm -rf tmp; mkdir tmp; \ - (for arc in $(INC_LIB) ./libmysqld_int.a; do \ - arpath=`echo $$arc|sed 's|[^/]*$$||'|sed 's|\.libs/$$||'`; \ - artmp=`echo $$arc|sed 's|^.*/|tmp/lib-|'`; \ - for F in `$(AR) t $$arc | grep -v SYMDEF`; do \ - if test -e "$$arpath/$$F" ; then echo "$$arpath/$$F"; else \ - mkdir $$artmp; cd $$artmp > /dev/null; \ - $(AR) x ../../$$arc; \ - cd $$current_dir > /dev/null; \ - ls $$artmp/* | grep -v SYMDEF; \ - continue 2; fi; done; \ - done; echo $(libmysqld_a_DEPENDENCIES) ) | sort -u | xargs $(AR) cq libmysqld.a ; \ - $(AR) r libmysqld.a $(storageobjects); \ - $(RANLIB) libmysqld.a ; \ - rm -rf tmp; \ - fi + current_dir=`pwd`; \ + rm -rf tmp; mkdir tmp; \ + (for arc in $(INC_LIB) ./libmysqld_int.a; do \ + arpath=`echo $$arc|sed 's|[^/]*$$||'|sed 's|\.libs/$$||'`; \ + artmp=`echo $$arc|sed 's|^.*/|tmp/lib-|'`; \ + for F in `$(AR) t $$arc | grep -v SYMDEF`; do \ + if test -e "$$arpath/$$F" ; then echo "$$arpath/$$F"; else \ + mkdir $$artmp; cd $$artmp > /dev/null; \ + $(AR) x ../../$$arc; \ + cd $$current_dir > /dev/null; \ + ls $$artmp/* | grep -v SYMDEF; \ + continue 2; fi; done; \ + done; echo $(libmysqld_a_DEPENDENCIES) ) | sort -u | xargs $(AR) cq libmysqld.a; \ + $(AR) r libmysqld.a $(storageobjects); \ + $(RANLIB) libmysqld.a ; \ + rm -rf tmp endif ## XXX: any time the client interface changes, we'll need to bump diff --git a/libmysqld/examples/Makefile.am b/libmysqld/examples/Makefile.am index e7b053d9766..66c40d88e29 100644 --- a/libmysqld/examples/Makefile.am +++ b/libmysqld/examples/Makefile.am @@ -42,7 +42,8 @@ LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @LIBDL@ $(CXXLDFLAGS) \ mysqltest_embedded_LINK = $(CXXLINK) nodist_mysqltest_embedded_SOURCES = mysqltest.cc -mysqltest_embedded_LDADD = $(LDADD) $(top_builddir)/regex/libregex.a +mysqltest_embedded_LDADD = $(LDADD) $(top_builddir)/regex/libregex.a \ + @MYSQLD_EXTRA_LDFLAGS@ nodist_mysql_SOURCES = mysql.cc readline.cc completion_hash.cc \ my_readline.h sql_string.h completion_hash.h diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index b8d855fcd45..94927c590cf 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -522,10 +522,10 @@ int init_embedded_server(int argc, char **argv, char **groups) mysql_data_home= mysql_real_data_home; mysql_data_home_len= mysql_real_data_home_len; - + /* Get default temporary directory */ opt_mysql_tmpdir=getenv("TMPDIR"); /* Use this if possible */ -#if defined( __WIN__) || defined(OS2) +#if defined(__WIN__) if (!opt_mysql_tmpdir) opt_mysql_tmpdir=getenv("TEMP"); if (!opt_mysql_tmpdir) diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index 758b803dbd4..603fc3bc2f0 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -32,7 +32,7 @@ #ifdef HAVE_PWD_H #include #endif -#if !defined(MSDOS) && !defined(__WIN__) +#if !defined(__WIN__) #include #include #include @@ -54,7 +54,7 @@ extern ulong net_buffer_length; extern ulong max_allowed_packet; -#if defined(MSDOS) || defined(__WIN__) +#if defined(__WIN__) #define ERRNO WSAGetLastError() #define perror(A) #else diff --git a/mysql-test/extra/binlog_tests/binlog.test b/mysql-test/extra/binlog_tests/binlog.test index c6f9e928cc5..900e46ff90a 100644 --- a/mysql-test/extra/binlog_tests/binlog.test +++ b/mysql-test/extra/binlog_tests/binlog.test @@ -243,14 +243,17 @@ reset master; drop table if exists t3; --enable_warnings create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb; -show master status; +--let $binlog_file1= query_get_value(SHOW MASTER STATUS, File, 1) +--echo File $binlog_file1 let $it=4; while ($it) { insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); dec $it; } -show master status /* must show new binlog index after rotating */; +--let $binlog_file2= query_get_value(SHOW MASTER STATUS, File, 1) +--echo *** show new binlog index after rotating *** +--echo File $binlog_file2 drop table t3; --echo # diff --git a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test index 435cae7fd28..aaadda941fb 100644 --- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test +++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test @@ -320,6 +320,16 @@ disconnect con3; connection con4; select get_lock("a",10); # wait for rollback to finish +if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`) +{ + --let $binlog_rollback= query_get_value(SHOW BINLOG EVENTS, Pos, 7) + --let $binlog_query= query_get_value(SHOW BINLOG EVENTS, Info, 7) + if (`SELECT 'ROLLBACK' != '$binlog_query'`) { + --echo Wrong query from SHOW BINLOG EVENTS. Expected ROLLBACK, got '$binlog_query' + --source include/show_rpl_debug_info.inc + --die Wrong value for slave parameter + } +} flush logs; let $MYSQLD_DATADIR= `select @@datadir`; @@ -328,13 +338,12 @@ let $MYSQLD_DATADIR= `select @@datadir`; # and does not make slave to stop) if (`select @@binlog_format = 'ROW'`) { - --echo This does not matter in ROW mode as the rolled back changes do not contain transactional changes as these - --echo were previously flushed upon committing/rolling back each statement. + --echo There is nothing to roll back; transactional changes are removed from the trans cache. } if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`) { - --exec $MYSQL_BINLOG --start-position=556 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output + --exec $MYSQL_BINLOG --start-position=$binlog_rollback $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select diff --git a/mysql-test/extra/rpl_tests/rpl_conflicts.test b/mysql-test/extra/rpl_tests/rpl_conflicts.test index 8a98059b0ad..b20bbb15a1a 100644 --- a/mysql-test/extra/rpl_tests/rpl_conflicts.test +++ b/mysql-test/extra/rpl_tests/rpl_conflicts.test @@ -92,7 +92,10 @@ if (`SELECT @@global.binlog_format != 'ROW' OR @@global.slave_exec_mode = 'STRIC let $slave_sql_errno= 1062; # ER_DUP_ENTRY source include/wait_for_slave_sql_error.inc; let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); - --echo Last_SQL_Error = $err (expected "duplicate key" error) + --replace_regex /end_log_pos [0-9]+/end_log_pos END_LOG_POS/ + --disable_query_log + --eval SELECT "$err" as 'Last_SQL_Error (expected "duplicate key" error)' + --enable_query_log SELECT * FROM t1; --echo ---- Resolve the conflict on the slave and restart SQL thread ---- diff --git a/mysql-test/include/diff_tables.inc b/mysql-test/include/diff_tables.inc index ad42615511a..d6216f3fe1e 100644 --- a/mysql-test/include/diff_tables.inc +++ b/mysql-test/include/diff_tables.inc @@ -65,17 +65,13 @@ let $_diff_table=$diff_table_2; let $_diff_i=2; while ($_diff_i) { - # Parse out any leading "master:" or "slave:" from the table - # specification and connect the appropriate server. - let $_diff_conn_master=`SELECT SUBSTR('$_diff_table', 1, 7) = 'master:'`; - if ($_diff_conn_master) { - let $_diff_table=`SELECT SUBSTR('$_diff_table', 8)`; - connection master; - } - let $_diff_conn_slave=`SELECT SUBSTR('$_diff_table', 1, 6) = 'slave:'`; - if ($_diff_conn_slave) { - let $_diff_table=`SELECT SUBSTR('$_diff_table', 7)`; - connection slave; + # Parse out any leading "master:" or "slave:" from the table specification +# and connect the appropriate server. + let $_pos= `SELECT LOCATE(':', '$_diff_table')`; + let $_diff_conn=`SELECT SUBSTR('$_diff_table', 1, $_pos-1)`; + if (`SELECT 'XX$_diff_conn' <> 'XX'`) { + let $_diff_table=`SELECT SUBSTR('$_diff_table', $_pos+1)`; + connection $_diff_conn; } # Sanity-check the input. diff --git a/mysql-test/include/parser_bug21114.inc b/mysql-test/include/parser_bug21114.inc old mode 100755 new mode 100644 diff --git a/mysql-test/include/rpl_diff_tables.inc b/mysql-test/include/rpl_diff_tables.inc new file mode 100644 index 00000000000..c3a45578a79 --- /dev/null +++ b/mysql-test/include/rpl_diff_tables.inc @@ -0,0 +1,35 @@ +# ############################################################################# +# Check whether the given table is consistent between different master and +# slaves +# +# Usage: +# --let $diff_table= test.t1 +# --let $diff_server_list= master, slave, slave2 +# --source include/rpl_diff_tables.inc +# ############################################################################# + +if (`SELECT "XX$diff_table" = "XX"`) +{ + --die diff_table is null. +} + +--let $_servers= master, slave +if (`SELECT "XX$diff_server_list" <> "XX"`) +{ + --let $_servers= $diff_server_list +} + +--let $_master= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)` +--let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_master') + 2))` +connection $_master; +while (`SELECT "XX$_servers" <> "XX"`) +{ + --let $_slave= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)` + --let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_slave') + 2))` + + --sync_slave_with_master $_slave + --let $diff_table_1= $_master:$diff_table + --let $diff_table_2= $_slave:$diff_table + --source include/diff_tables.inc + connection $_slave; +} diff --git a/mysql-test/include/show_msg.inc b/mysql-test/include/show_msg.inc old mode 100755 new mode 100644 diff --git a/mysql-test/include/show_msg80.inc b/mysql-test/include/show_msg80.inc old mode 100755 new mode 100644 diff --git a/mysql-test/lib/My/Handles.pm b/mysql-test/lib/My/Handles.pm old mode 100755 new mode 100644 diff --git a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc old mode 100755 new mode 100644 diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc index 50c433b9b39..1c778362975 100644 --- a/mysql-test/lib/My/SafeProcess/safe_process.cc +++ b/mysql-test/lib/My/SafeProcess/safe_process.cc @@ -159,7 +159,7 @@ int main(int argc, char* const argv[] ) signal(SIGCHLD, handle_signal); signal(SIGABRT, handle_abort); - sprintf(safe_process_name, "safe_process[%d]", own_pid); + sprintf(safe_process_name, "safe_process[%ld]", (long) own_pid); message("Started"); diff --git a/mysql-test/lib/My/SafeProcess/safe_process_win.cc b/mysql-test/lib/My/SafeProcess/safe_process_win.cc old mode 100755 new mode 100644 diff --git a/mysql-test/lib/v1/mtr_misc.pl b/mysql-test/lib/v1/mtr_misc.pl index 0173e8b8572..da2395a8a95 100644 --- a/mysql-test/lib/v1/mtr_misc.pl +++ b/mysql-test/lib/v1/mtr_misc.pl @@ -141,7 +141,6 @@ sub mtr_exe_maybe_exists (@) { my @path= @_; map {$_.= ".exe"} @path if $::glob_win32; - map {$_.= ".nlm"} @path if $::glob_netware; foreach my $path ( @path ) { if($::glob_win32) diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl index a67aefa2d9c..5e785c86027 100755 --- a/mysql-test/lib/v1/mysql-test-run.pl +++ b/mysql-test/lib/v1/mysql-test-run.pl @@ -76,7 +76,6 @@ $| = 1; # Automatically flush STDOUT our $glob_win32_perl= ($^O eq "MSWin32"); # ActiveState Win32 Perl our $glob_cygwin_perl= ($^O eq "cygwin"); # Cygwin Perl our $glob_win32= ($glob_win32_perl or $glob_cygwin_perl); -our $glob_netware= ($^O eq "NetWare"); # NetWare require "lib/v1/mtr_cases.pl"; require "lib/v1/mtr_im.pl"; @@ -3124,11 +3123,8 @@ sub install_db ($$) { $path_vardir_trace, $type); } - if ( ! $glob_netware ) - { - mtr_add_arg($args, "--lc-messages-dir=%s", $path_language); - mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); - } + mtr_add_arg($args, "--lc-messages-dir=%s", $path_language); + mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); # If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g., # configure --disable-grant-options), mysqld will not recognize the diff --git a/mysql-test/r/bug46080.result b/mysql-test/r/bug46080.result old mode 100755 new mode 100644 diff --git a/mysql-test/r/ctype_eucjpms.result b/mysql-test/r/ctype_eucjpms.result old mode 100755 new mode 100644 diff --git a/mysql-test/r/error_simulation.result b/mysql-test/r/error_simulation.result index fc58687cc86..b6b79cb596b 100644 --- a/mysql-test/r/error_simulation.result +++ b/mysql-test/r/error_simulation.result @@ -48,5 +48,40 @@ Got one of the listed errors SET SESSION debug=DEFAULT; DROP TABLE t1; # +# Bug#41660: Sort-index_merge for non-first join table may require +# O(#scans) memory +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9); +CREATE TABLE t2 (a INT, b INT, filler CHAR(100), KEY(a), KEY(b)); +INSERT INTO t2 SELECT 1000, 1000, 'filler' FROM t1 A, t1 B, t1 C; +INSERT INTO t2 VALUES (1, 1, 'data'); +# the example query uses LEFT JOIN only for the sake of being able to +# demonstrate the issue with a very small dataset. (left outer join +# disables the use of join buffering, so we get the second table +# re-scanned for every record in the outer table. if we used inner join, +# we would need to have thousands of records and/or more columns in both +# tables so that the join buffer is filled and re-scans are triggered). +SET SESSION debug = '+d,only_one_Unique_may_be_created'; +EXPLAIN +SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 ); +id select_type table type possible_keys key key_len ref rows Extra +x x x x x x x x x +x x x x x x x x x Using sort_union(a,b); Using where +SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 ); +a a b filler +0 1 1 data +1 1 1 data +2 1 1 data +3 1 1 data +4 1 1 data +5 1 1 data +6 1 1 data +7 1 1 data +8 1 1 data +9 1 1 data +SET SESSION debug = DEFAULT; +DROP TABLE t1, t2; +# # End of 5.1 tests # diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index ffdacc43735..fdeec2755ca 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -750,4 +750,24 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables DROP TABLE t1; # +# Bug#54477: Crash on IN / CASE with NULL arguments +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2); +SELECT 1 IN (NULL, a) FROM t1; +1 IN (NULL, a) +1 +NULL +SELECT a IN (a, a) FROM t1 GROUP BY a WITH ROLLUP; +a IN (a, a) +1 +1 +NULL +SELECT CASE a WHEN a THEN a END FROM t1 GROUP BY a WITH ROLLUP; +CASE a WHEN a THEN a END +1 +2 +NULL +DROP TABLE t1; +# End of 5.1 tests diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result index 8d0f34f3bda..552ff564a89 100644 --- a/mysql-test/r/func_like.result +++ b/mysql-test/r/func_like.result @@ -169,3 +169,17 @@ select 'andre%' like 'andre select _cp1251'andre%' like convert('andreÊ%' using cp1251) escape 'Ê'; _cp1251'andre%' like convert('andreÊ%' using cp1251) escape 'Ê' 1 +End of 4.1 tests +# +# Bug #54575: crash when joining tables with unique set column +# +CREATE TABLE t1(a SET('a') NOT NULL, UNIQUE KEY(a)); +CREATE TABLE t2(b INT PRIMARY KEY); +INSERT INTO t1 VALUES (); +Warnings: +Warning 1364 Field 'a' doesn't have a default value +INSERT INTO t2 VALUES (1), (2), (3); +SELECT 1 FROM t2 JOIN t1 ON 1 LIKE a GROUP BY a; +1 +DROP TABLE t1, t2; +End of 5.1 tests diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result index c69de0f307b..daf043860a4 100644 --- a/mysql-test/r/having.result +++ b/mysql-test/r/having.result @@ -532,3 +532,19 @@ Warnings: Warning 1292 Truncated incorrect INTEGER value: 'd' DROP TABLE t1,t2; End of 5.0 tests +# +# Bug#54416 MAX from JOIN with HAVING returning NULL with 5.1 and Empty set +# +CREATE TABLE t1 (f1 INT(11), f2 VARCHAR(1), PRIMARY KEY (f1)); +INSERT INTO t1 VALUES (1,'f'); +CREATE TABLE t2 (f1 INT(11), f2 VARCHAR(1)); +INSERT INTO t2 VALUES (2,'m'); +INSERT INTO t2 VALUES (3,'m'); +INSERT INTO t2 VALUES (11,NULL); +INSERT INTO t2 VALUES (12,'k'); +SELECT MAX(t1.f1) field1 +FROM t1 JOIN t2 ON t2.f2 LIKE 'x' +HAVING field1 < 7; +field1 +DROP TABLE t1,t2; +End of 5.1 tests diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index eb3abc3f0c9..21b42577a11 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1681,6 +1681,33 @@ COUNT(*) DROP USER nonpriv; DROP TABLE db1.t1; DROP DATABASE db1; + +Bug#54422 query with = 'variables' + +CREATE TABLE variables(f1 INT); +SELECT COLUMN_DEFAULT, TABLE_NAME +FROM INFORMATION_SCHEMA.COLUMNS +WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = 'variables'; +COLUMN_DEFAULT TABLE_NAME +NULL variables +DROP TABLE variables; +# +# Bug #53814: NUMERIC_PRECISION for unsigned bigint field is 19, +# should be 20 +# +CREATE TABLE ubig (a BIGINT, b BIGINT UNSIGNED); +SELECT TABLE_NAME, COLUMN_NAME, NUMERIC_PRECISION +FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='ubig'; +TABLE_NAME COLUMN_NAME NUMERIC_PRECISION +ubig a 19 +ubig b 20 +INSERT INTO ubig VALUES (0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFF); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +SELECT length(CAST(b AS CHAR)) FROM ubig; +length(CAST(b AS CHAR)) +20 +DROP TABLE ubig; End of 5.1 tests. # # Additional test for WL#3726 "DDL locking for all metadata objects" diff --git a/mysql-test/r/information_schema_parameters.result b/mysql-test/r/information_schema_parameters.result index db04f5c0bd3..288f22e2ea3 100644 --- a/mysql-test/r/information_schema_parameters.result +++ b/mysql-test/r/information_schema_parameters.result @@ -25,7 +25,7 @@ WHERE table_schema = 'information_schema' ORDER BY ordinal_position; TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME SPECIFIC_CATALOG ORDINAL_POSITION 1 COLUMN_DEFAULT @@ -44,7 +44,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME SPECIFIC_SCHEMA ORDINAL_POSITION 2 COLUMN_DEFAULT @@ -63,7 +63,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME SPECIFIC_NAME ORDINAL_POSITION 3 COLUMN_DEFAULT @@ -82,7 +82,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME ORDINAL_POSITION ORDINAL_POSITION 4 COLUMN_DEFAULT 0 @@ -101,7 +101,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME PARAMETER_MODE ORDINAL_POSITION 5 COLUMN_DEFAULT NULL @@ -120,7 +120,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME PARAMETER_NAME ORDINAL_POSITION 6 COLUMN_DEFAULT NULL @@ -139,7 +139,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME DATA_TYPE ORDINAL_POSITION 7 COLUMN_DEFAULT @@ -158,7 +158,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME CHARACTER_MAXIMUM_LENGTH ORDINAL_POSITION 8 COLUMN_DEFAULT NULL @@ -177,7 +177,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME CHARACTER_OCTET_LENGTH ORDINAL_POSITION 9 COLUMN_DEFAULT NULL @@ -196,7 +196,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME NUMERIC_PRECISION ORDINAL_POSITION 10 COLUMN_DEFAULT NULL @@ -215,7 +215,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME NUMERIC_SCALE ORDINAL_POSITION 11 COLUMN_DEFAULT NULL @@ -234,7 +234,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME CHARACTER_SET_NAME ORDINAL_POSITION 12 COLUMN_DEFAULT NULL @@ -253,7 +253,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME COLLATION_NAME ORDINAL_POSITION 13 COLUMN_DEFAULT NULL @@ -272,7 +272,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME DTD_IDENTIFIER ORDINAL_POSITION 14 COLUMN_DEFAULT NULL @@ -291,7 +291,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME parameters +TABLE_NAME PARAMETERS COLUMN_NAME ROUTINE_TYPE ORDINAL_POSITION 15 COLUMN_DEFAULT diff --git a/mysql-test/r/information_schema_routines.result b/mysql-test/r/information_schema_routines.result index 664ec6bf748..aa4766f0a6b 100644 --- a/mysql-test/r/information_schema_routines.result +++ b/mysql-test/r/information_schema_routines.result @@ -40,7 +40,7 @@ WHERE table_schema = 'information_schema' ORDER BY ordinal_position; TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME SPECIFIC_NAME ORDINAL_POSITION 1 COLUMN_DEFAULT @@ -59,7 +59,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME ROUTINE_CATALOG ORDINAL_POSITION 2 COLUMN_DEFAULT @@ -78,7 +78,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME ROUTINE_SCHEMA ORDINAL_POSITION 3 COLUMN_DEFAULT @@ -97,7 +97,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME ROUTINE_NAME ORDINAL_POSITION 4 COLUMN_DEFAULT @@ -116,7 +116,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME ROUTINE_TYPE ORDINAL_POSITION 5 COLUMN_DEFAULT @@ -135,7 +135,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME DATA_TYPE ORDINAL_POSITION 6 COLUMN_DEFAULT @@ -154,7 +154,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME CHARACTER_MAXIMUM_LENGTH ORDINAL_POSITION 7 COLUMN_DEFAULT NULL @@ -173,7 +173,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME CHARACTER_OCTET_LENGTH ORDINAL_POSITION 8 COLUMN_DEFAULT NULL @@ -192,7 +192,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME NUMERIC_PRECISION ORDINAL_POSITION 9 COLUMN_DEFAULT NULL @@ -211,7 +211,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME NUMERIC_SCALE ORDINAL_POSITION 10 COLUMN_DEFAULT NULL @@ -230,7 +230,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME CHARACTER_SET_NAME ORDINAL_POSITION 11 COLUMN_DEFAULT NULL @@ -249,7 +249,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME COLLATION_NAME ORDINAL_POSITION 12 COLUMN_DEFAULT NULL @@ -268,7 +268,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME DTD_IDENTIFIER ORDINAL_POSITION 13 COLUMN_DEFAULT NULL @@ -287,7 +287,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME ROUTINE_BODY ORDINAL_POSITION 14 COLUMN_DEFAULT @@ -306,7 +306,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME ROUTINE_DEFINITION ORDINAL_POSITION 15 COLUMN_DEFAULT NULL @@ -325,7 +325,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME EXTERNAL_NAME ORDINAL_POSITION 16 COLUMN_DEFAULT NULL @@ -344,7 +344,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME EXTERNAL_LANGUAGE ORDINAL_POSITION 17 COLUMN_DEFAULT NULL @@ -363,7 +363,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME PARAMETER_STYLE ORDINAL_POSITION 18 COLUMN_DEFAULT @@ -382,7 +382,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME IS_DETERMINISTIC ORDINAL_POSITION 19 COLUMN_DEFAULT @@ -401,7 +401,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME SQL_DATA_ACCESS ORDINAL_POSITION 20 COLUMN_DEFAULT @@ -420,7 +420,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME SQL_PATH ORDINAL_POSITION 21 COLUMN_DEFAULT NULL @@ -439,7 +439,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME SECURITY_TYPE ORDINAL_POSITION 22 COLUMN_DEFAULT @@ -458,7 +458,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME CREATED ORDINAL_POSITION 23 COLUMN_DEFAULT 0000-00-00 00:00:00 @@ -477,7 +477,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME LAST_ALTERED ORDINAL_POSITION 24 COLUMN_DEFAULT 0000-00-00 00:00:00 @@ -496,7 +496,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME SQL_MODE ORDINAL_POSITION 25 COLUMN_DEFAULT @@ -515,7 +515,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME ROUTINE_COMMENT ORDINAL_POSITION 26 COLUMN_DEFAULT NULL @@ -534,7 +534,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME DEFINER ORDINAL_POSITION 27 COLUMN_DEFAULT @@ -553,7 +553,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME CHARACTER_SET_CLIENT ORDINAL_POSITION 28 COLUMN_DEFAULT @@ -572,7 +572,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME COLLATION_CONNECTION ORDINAL_POSITION 29 COLUMN_DEFAULT @@ -591,7 +591,7 @@ PRIVILEGES # COLUMN_COMMENT TABLE_CATALOG def TABLE_SCHEMA information_schema -TABLE_NAME routines +TABLE_NAME ROUTINES COLUMN_NAME DATABASE_COLLATION ORDINAL_POSITION 30 COLUMN_DEFAULT diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result index a7407cfa699..1c59f41cfc0 100644 --- a/mysql-test/r/loaddata.result +++ b/mysql-test/r/loaddata.result @@ -503,4 +503,33 @@ DROP TABLE t1; CREATE TABLE t1 (id INT NOT NULL); LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1; DROP TABLE t1; +# +# Bug #51876 : crash/memory underrun when loading data with ucs2 +# and reverse() function +# +# Problem # 1 (original report): wrong parsing of ucs2 data +SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; +CREATE TABLE t1(a INT); +LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 +(@b) SET a=REVERSE(@b); +Warnings: +Warning 1366 Incorrect integer value: '?' for column 'a' at row 1 +Warning 1366 Incorrect integer value: '?' for column 'a' at row 2 +# should return 2 zeroes (as the value is truncated) +SELECT * FROM t1; +a +0 +0 +DROP TABLE t1; +# Problem # 2 : if you write and read ucs2 data to a file they're lost +SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; +CREATE TABLE t1(a INT); +LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 +(@b) SET a=REVERSE(@b); +# should return 0 and 1 (10 reversed) +SELECT * FROM t1; +a +0 +1 +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/r/lowercase_mixed_tmpdir_innodb.result b/mysql-test/r/lowercase_mixed_tmpdir_innodb.result old mode 100755 new mode 100644 diff --git a/mysql-test/r/lowercase_view.result b/mysql-test/r/lowercase_view.result index c37dc41c495..33c87ec101c 100644 --- a/mysql-test/r/lowercase_view.result +++ b/mysql-test/r/lowercase_view.result @@ -148,3 +148,20 @@ a DROP VIEW v1; DROP TABLE t1; End of 5.0 tests. +# +# Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS +# returns nothing +# +CREATE TABLE `ttt` ( +`f1` char(3) NOT NULL, +PRIMARY KEY (`f1`) +) ENGINE=myisam DEFAULT CHARSET=latin1; +SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = +'TTT'; +count(COLUMN_NAME) +1 +SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT'; +count(*) +1 +DROP TABLE `ttt`; +End of 5.0 tests. diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result index 394beb042a5..58f6ffd4040 100644 --- a/mysql-test/r/mysql_upgrade.result +++ b/mysql-test/r/mysql_upgrade.result @@ -169,4 +169,46 @@ DROP PROCEDURE testproc; WARNING: NULL values of the 'character_set_client' column ('mysql.proc' table) have been updated with a default value (latin1). Please verify if necessary. WARNING: NULL values of the 'collation_connection' column ('mysql.proc' table) have been updated with a default value (latin1_swedish_ci). Please verify if necessary. WARNING: NULL values of the 'db_collation' column ('mysql.proc' table) have been updated with default values. Please verify if necessary. +# +# Bug #53613: mysql_upgrade incorrectly revokes +# TRIGGER privilege on given table +# +GRANT USAGE ON *.* TO 'user3'@'%'; +GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'; +Run mysql_upgrade with all privileges on a user +mtr.global_suppressions OK +mtr.test_suppressions OK +mysql.columns_priv OK +mysql.db OK +mysql.event OK +mysql.func OK +mysql.general_log +Error : You can't use locks with log tables. +status : OK +mysql.help_category OK +mysql.help_keyword OK +mysql.help_relation OK +mysql.help_topic OK +mysql.host OK +mysql.ndb_binlog_index OK +mysql.plugin OK +mysql.proc OK +mysql.procs_priv OK +mysql.servers OK +mysql.slow_log +Error : You can't use locks with log tables. +status : OK +mysql.tables_priv OK +mysql.time_zone OK +mysql.time_zone_leap_second OK +mysql.time_zone_name OK +mysql.time_zone_transition OK +mysql.time_zone_transition_type OK +mysql.user OK +SHOW GRANTS FOR 'user3'@'%'; +Grants for user3@% +GRANT USAGE ON *.* TO 'user3'@'%' +GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%' +DROP USER 'user3'@'%'; +End of 5.1 tests The --upgrade-system-tables option was used, databases won't be touched. diff --git a/mysql-test/r/rpl_mysqldump_slave.result b/mysql-test/r/rpl_mysqldump_slave.result index 158a43a658c..2229725a61d 100644 --- a/mysql-test/r/rpl_mysqldump_slave.result +++ b/mysql-test/r/rpl_mysqldump_slave.result @@ -8,10 +8,10 @@ start slave; # New --dump-slave, --apply-slave-statements functionality # use test; -CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=107; +CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START; STOP SLAVE; -CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=107; +CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START; START SLAVE; STOP SLAVE; -CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT='MASTER_MYPORT', MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=107; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT='MASTER_MYPORT', MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START; START SLAVE; diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index b518522e2bf..b193a269288 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -4856,6 +4856,21 @@ a b c SELECT * FROM t1 WHERE 102 < c; a b c DROP TABLE t1; +# +# Bug #54459: Assertion failed: param.sort_length, +# file .\filesort.cc, line 149 (part II) +# +CREATE TABLE t1(a ENUM('') NOT NULL); +INSERT INTO t1 VALUES (), (), (); +EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; +1 +1 +1 +1 +DROP TABLE t1; End of 5.1 tests # # Bug#54515: Crash in opt_range.cc::get_best_group_min_max on diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index e3aa87876ed..72d63e47d9a 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -4988,3 +4988,20 @@ t1_id total_amount DROP TABLE t3; DROP TABLE t2; DROP TABLE t1; +# +# Bug #52711: Segfault when doing EXPLAIN SELECT with +# union...order by (select... where...) +# +CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a)); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (1),(2); +# Should not crash +EXPLAIN +SELECT * FROM t2 UNION SELECT * FROM t2 +ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE)); +# Should not crash +SELECT * FROM t2 UNION SELECT * FROM t2 +ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE)); +DROP TABLE t1,t2; +End of 5.1 tests diff --git a/mysql-test/std_data/intersect-bug50389.tsv b/mysql-test/std_data/intersect-bug50389.tsv new file mode 100644 index 00000000000..f84359603a8 --- /dev/null +++ b/mysql-test/std_data/intersect-bug50389.tsv @@ -0,0 +1,441 @@ +3304605 1221256 0 0 abcdefghijklmnopwrst +3304606 1221259 0 0 abcdefghijklmnopwrst +3304607 1221260 0 0 asdfghjklzxcvbnm +3304629 1221273 0 0 asdfghjklzxcvbnm +3304630 1221273 0 0 asdfghjklzxcvbnm +3304634 1221259 0 0 asdfghjklzxcvbnm +3304644 1221278 0 0 abcdefghijklmnopwrst +3304648 1221278 0 0 abcdefghijklmnopwrst +3304649 1221278 0 1 asdfghjklzxcvbnm +3304650 1221278 0 0 asdfghjklzxcvbnm +3304651 1221282 0 0 abcdefghijklmnopwrst +3304660 1221287 0 0 asdfghjklzxcvbnm +3304662 1221288 0 0 abcdefghijklmnopwrst +3304663 1221288 0 0 abcdefghijklmnopwrst +3304664 1221290 0 0 abcdefghijklmnopwrst +3304670 1221290 0 0 asdfghjklzxcvbnm +3304671 1221292 0 0 abcdefghijklmnopwrst +3304672 1221287 0 0 asdfghjklzxcvbnm +3304673 1221294 0 0 asdfghjklzxcvbnm +3304674 1221287 0 0 asdfghjklzxcvbnm +3304676 1221296 0 0 abcdefghijklmnopwrst +3304677 1221287 0 0 abcdefghijklmnopwrst +3304678 1221287 0 0 abcdefghijklmnopwrst +3304679 1221297 0 0 asdfghjklzxcvbnm +3304680 1221290 0 0 abcdefghijklmnopwrst +3304681 1221290 0 0 abcdefghijklmnopwrst +3304685 1221300 0 0 asdfghjklzxcvbnm +3304687 1221302 0 0 abcdefghijklmnopwrst +3304688 1221296 1221298 0 abcdefghijklmnopwrst +3304692 1221309 0 0 asdfghjklzxcvbnm +3304694 1221309 0 0 asdfghjklzxcvbnm +3304695 1221290 0 0 abcdefghijklmnopwrst +3304696 1221313 0 0 asdfghjklzxcvbnm +3304701 1221314 0 0 asdfghjklzxcvbnm +3304703 1221313 0 0 abcdefghijklmnopwrst +3304707 1221313 0 0 asdfghjklzxcvbnm +3304709 1221313 0 0 abcdefghijklmnopwrst +3304713 1221314 0 0 abcdefghijklmnopwrst +3304715 1221317 0 0 abcdefghijklmnopwrst +3304717 1221319 0 0 asdfghjklzxcvbnm +3304718 1221320 0 0 abcdefghijklmnopwrst +3304723 1221314 0 0 abcdefghijklmnopwrst +3304724 1221314 0 0 asdfghjklzxcvbnm +3304725 1221300 0 0 asdfghjklzxcvbnm +3304726 1221314 0 0 asdfghjklzxcvbnm +3304730 1221326 0 0 asdfghjklzxcvbnm +3304732 1221328 0 0 asdfghjklzxcvbnm +3304733 1221329 0 0 asdfghjklzxcvbnm +3304745 1221331 0 0 abcdefghijklmnopwrst +3304747 1221300 0 0 abcdefghijklmnopwrst +3304752 1221332 0 0 asdfghjklzxcvbnm +3304756 1221333 0 0 asdfghjklzxcvbnm +3304765 1221336 0 0 asdfghjklzxcvbnm +3304767 1221338 0 0 abcdefghijklmnopwrst +3304769 1221340 0 0 asdfghjklzxcvbnm +3304770 1221328 0 0 asdfghjklzxcvbnm +3304771 1221328 0 0 abcdefghijklmnopwrst +3304773 1221340 0 0 asdfghjklzxcvbnm +3304774 1221340 0 0 abcdefghijklmnopwrst +3304775 1221338 1221342 1 asdfghjklzxcvbnm +3304778 1221345 0 0 asdfghjklzxcvbnm +3304786 1221332 0 0 asdfghjklzxcvbnm +3304787 1221347 0 0 abcdefghijklmnopwrst +3304789 1221347 0 0 asdfghjklzxcvbnm +3304793 1221349 0 0 abcdefghijklmnopwrst +3304794 1221350 0 0 asdfghjklzxcvbnm +3304800 1221290 0 0 asdfghjklzxcvbnm +3304802 1221290 0 0 asdfghjklzxcvbnm +3304803 1221290 0 0 asdfghjklzxcvbnm +3304810 1221356 0 0 asdfghjklzxcvbnm +3304811 1221356 0 0 asdfghjklzxcvbnm +3304821 1221364 0 0 asdfghjklzxcvbnm +3304823 1221365 0 0 asdfghjklzxcvbnm +3304824 1221366 0 0 abcdefghijklmnopwrst +3304825 1221365 0 0 asdfghjklzxcvbnm +3304826 1221367 0 0 asdfghjklzxcvbnm +3304828 1221369 0 0 abcdefghijklmnopwrst +3304829 1221366 1221368 0 asdfghjklzxcvbnm +3304831 1221372 0 0 abcdefghijklmnopwrst +3304832 1221364 1221373 0 abcdefghijklmnopwrst +3304833 1221364 1221371 0 asdfghjklzxcvbnm +3304834 1221364 0 0 abcdefghijklmnopwrst +3304836 1221375 0 0 abcdefghijklmnopwrst +3304837 1221364 0 0 abcdefghijklmnopwrst +3304838 1221364 1221376 0 asdfghjklzxcvbnm +3304840 1221372 0 0 asdfghjklzxcvbnm +3304842 1221372 0 1 abcdefghijklmnopwrst +3304844 1221372 0 0 asdfghjklzxcvbnm +3304845 1221372 0 0 abcdefghijklmnopwrst +3304847 1221382 0 0 abcdefghijklmnopwrst +3304848 1221372 0 0 abcdefghijklmnopwrst +3304849 1221372 0 0 asdfghjklzxcvbnm +3304852 1221364 1221378 0 asdfghjklzxcvbnm +3304853 1221383 0 0 abcdefghijklmnopwrst +3304854 1221384 0 0 asdfghjklzxcvbnm +3304855 1221347 0 0 asdfghjklzxcvbnm +3304858 1221383 0 0 abcdefghijklmnopwrst +3304862 1221386 0 0 abcdefghijklmnopwrst +3304864 1221387 0 0 abcdefghijklmnopwrst +3304867 1221389 0 0 abcdefghijklmnopwrst +3304868 1221390 0 0 asdfghjklzxcvbnm +3304869 1221391 0 0 asdfghjklzxcvbnm +3304871 1221393 0 0 asdfghjklzxcvbnm +3304874 1221395 0 0 abcdefghijklmnopwrst +3304877 1221396 0 0 abcdefghijklmnopwrst +3304879 1221396 0 0 asdfghjklzxcvbnm +3304882 1221398 0 0 abcdefghijklmnopwrst +3304883 1221399 0 0 abcdefghijklmnopwrst +3304884 1221400 0 0 abcdefghijklmnopwrst +3304889 1221405 0 0 abcdefghijklmnopwrst +3304895 1221409 0 0 asdfghjklzxcvbnm +3304899 1221395 0 0 asdfghjklzxcvbnm +3304900 1221395 0 0 asdfghjklzxcvbnm +3304902 1221395 0 0 abcdefghijklmnopwrst +3304903 1221395 0 0 asdfghjklzxcvbnm +3304924 1221414 0 0 abcdefghijklmnopwrst +3304925 1221415 0 0 asdfghjklzxcvbnm +3304935 1221416 0 0 asdfghjklzxcvbnm +3304936 1221418 0 0 asdfghjklzxcvbnm +3304944 1221419 0 0 abcdefghijklmnopwrst +3304959 1221427 0 0 asdfghjklzxcvbnm +3304963 1221415 0 0 asdfghjklzxcvbnm +3304964 1221428 0 0 asdfghjklzxcvbnm +3304965 1221429 0 0 abcdefghijklmnopwrst +3304978 1221433 0 0 abcdefghijklmnopwrst +3304986 1221437 0 0 asdfghjklzxcvbnm +3304988 1221439 0 0 asdfghjklzxcvbnm +3304994 1221441 0 0 asdfghjklzxcvbnm +3304996 1221442 0 0 asdfghjklzxcvbnm +3304998 1221443 0 0 asdfghjklzxcvbnm +3305003 1221446 0 0 abcdefghijklmnopwrst +3305008 1221433 0 0 abcdefghijklmnopwrst +3305009 1221447 0 0 asdfghjklzxcvbnm +3305012 1221447 0 0 asdfghjklzxcvbnm +3305013 1221449 0 0 abcdefghijklmnopwrst +3305015 1221451 0 0 asdfghjklzxcvbnm +3305019 1221453 0 0 asdfghjklzxcvbnm +3305023 1221449 0 0 asdfghjklzxcvbnm +3305026 1221456 0 0 abcdefghijklmnopwrst +3305028 1221457 0 0 asdfghjklzxcvbnm +3305032 1221449 0 0 asdfghjklzxcvbnm +3305037 1221453 0 0 asdfghjklzxcvbnm +3305040 1221451 0 0 asdfghjklzxcvbnm +3305061 1221446 0 0 abcdefghijklmnopwrst +3305175 1221457 0 0 abcdefghijklmnopwrst +3305304 1221453 0 0 abcdefghijklmnopwrst +3305308 1221453 0 1 abcdefghijklmnopwrst +3305333 1221457 1221577 0 asdfghjklzxcvbnm +3305335 1221453 0 0 asdfghjklzxcvbnm +3305354 1221457 0 1 asdfghjklzxcvbnm +3306089 1221442 0 0 abcdefghijklmnopwrst +3306090 1221442 0 0 abcdefghijklmnopwrst +3306092 1221442 0 0 asdfghjklzxcvbnm +3306345 1221366 0 0 asdfghjklzxcvbnm +3306349 1221366 0 0 asdfghjklzxcvbnm +3306419 1221364 1221371 0 asdfghjklzxcvbnm +3307390 1221453 0 0 abcdefghijklmnopwrst +3308002 1221416 1221417 0 abcdefghijklmnopwrst +3308331 1221366 1222821 0 abcdefghijklmnopwrst +3309991 1221347 0 0 asdfghjklzxcvbnm +3311917 1221287 0 0 abcdefghijklmnopwrst +3311937 1221287 0 0 abcdefghijklmnopwrst +3311945 1221287 0 0 asdfghjklzxcvbnm +3311955 1221287 0 0 abcdefghijklmnopwrst +3311961 1221287 0 0 asdfghjklzxcvbnm +3311963 1221287 0 1 asdfghjklzxcvbnm +3311968 1221287 0 0 asdfghjklzxcvbnm +3311974 1221287 0 1 abcdefghijklmnopwrst +3311976 1221287 0 1 abcdefghijklmnopwrst +3311981 1221287 0 1 abcdefghijklmnopwrst +3311985 1221287 0 1 asdfghjklzxcvbnm +3312014 1221287 0 0 abcdefghijklmnopwrst +3312018 1221287 0 1 abcdefghijklmnopwrst +3312025 1221287 0 0 abcdefghijklmnopwrst +3312027 1221287 0 0 abcdefghijklmnopwrst +3312030 1221287 0 0 abcdefghijklmnopwrst +3313755 1221288 0 0 abcdefghijklmnopwrst +3313767 1221288 0 0 asdfghjklzxcvbnm +3314668 1221290 0 0 asdfghjklzxcvbnm +3314670 1221290 0 0 abcdefghijklmnopwrst +3323440 1221338 0 0 abcdefghijklmnopwrst +3323736 1221338 0 0 asdfghjklzxcvbnm +3323739 1221338 0 0 asdfghjklzxcvbnm +3324077 1221290 0 0 asdfghjklzxcvbnm +3324081 1221290 0 0 abcdefghijklmnopwrst +3324082 1221290 0 0 abcdefghijklmnopwrst +3324639 1221457 1221563 1 asdfghjklzxcvbnm +3326180 1221287 0 0 abcdefghijklmnopwrst +3326204 1221287 0 0 asdfghjklzxcvbnm +3326945 1221457 1221563 1 asdfghjklzxcvbnm +3328393 1221364 1221373 0 asdfghjklzxcvbnm +3328966 1221287 0 0 abcdefghijklmnopwrst +3329875 1221457 1382427 0 abcdefghijklmnopwrst +3333449 1221278 1231113 0 abcdefghijklmnopwrst +3336022 1221457 0 0 abcdefghijklmnopwrst +3340069 1221364 1221373 0 abcdefghijklmnopwrst +3340073 1221364 1221373 0 abcdefghijklmnopwrst +3340563 1221290 0 0 asdfghjklzxcvbnm +3341553 1221453 0 0 abcdefghijklmnopwrst +3345868 1221287 0 0 asdfghjklzxcvbnm +3345873 1221287 0 0 abcdefghijklmnopwrst +3345879 1221287 0 0 asdfghjklzxcvbnm +3346860 1221457 0 0 abcdefghijklmnopwrst +3347053 1221287 0 0 asdfghjklzxcvbnm +3347109 1221287 0 1 abcdefghijklmnopwrst +3350589 1221372 1236415 0 abcdefghijklmnopwrst +3350594 1221372 1236415 1 asdfghjklzxcvbnm +3353871 1221457 0 0 asdfghjklzxcvbnm +3354727 1221364 1221373 0 abcdefghijklmnopwrst +3355270 1221393 0 1 abcdefghijklmnopwrst +3357638 1221287 0 0 asdfghjklzxcvbnm +3357644 1221287 0 0 abcdefghijklmnopwrst +3357648 1221287 0 0 abcdefghijklmnopwrst +3357651 1221287 0 0 asdfghjklzxcvbnm +3357661 1221287 0 0 abcdefghijklmnopwrst +3357678 1221287 0 0 abcdefghijklmnopwrst +3357697 1221287 0 0 asdfghjklzxcvbnm +3357737 1221287 0 0 asdfghjklzxcvbnm +3357744 1221287 0 0 abcdefghijklmnopwrst +3357754 1221287 0 1 asdfghjklzxcvbnm +3357760 1221287 0 1 abcdefghijklmnopwrst +3357774 1221287 0 1 abcdefghijklmnopwrst +3357779 1221287 0 0 abcdefghijklmnopwrst +3357796 1221287 0 0 asdfghjklzxcvbnm +3357814 1221287 0 0 asdfghjklzxcvbnm +3357833 1221287 0 1 asdfghjklzxcvbnm +3357835 1221287 0 0 abcdefghijklmnopwrst +3357840 1221287 0 1 asdfghjklzxcvbnm +3357842 1221287 0 0 abcdefghijklmnopwrst +3357845 1221287 0 1 abcdefghijklmnopwrst +3357849 1221287 0 1 abcdefghijklmnopwrst +3357852 1221287 0 0 abcdefghijklmnopwrst +3358935 1221443 0 1 abcdefghijklmnopwrst +3358967 1221443 0 1 abcdefghijklmnopwrst +3359181 1221256 0 0 abcdefghijklmnopwrst +3360512 1221319 0 0 asdfghjklzxcvbnm +3362004 1221287 0 0 abcdefghijklmnopwrst +3362009 1221287 0 1 abcdefghijklmnopwrst +3362358 1221287 0 0 asdfghjklzxcvbnm +3363214 1221287 0 0 abcdefghijklmnopwrst +3363238 1221287 0 1 asdfghjklzxcvbnm +3363616 1221287 0 1 asdfghjklzxcvbnm +3363631 1221287 0 0 asdfghjklzxcvbnm +3364281 1221287 0 0 abcdefghijklmnopwrst +3365900 1221347 0 0 asdfghjklzxcvbnm +3365901 1221347 0 0 asdfghjklzxcvbnm +3365906 1221347 0 0 asdfghjklzxcvbnm +3365907 1221347 0 0 asdfghjklzxcvbnm +3365910 1221347 0 0 abcdefghijklmnopwrst +3365936 1221347 0 0 abcdefghijklmnopwrst +3367846 1221287 0 0 abcdefghijklmnopwrst +3368011 1221428 0 0 abcdefghijklmnopwrst +3369882 1221300 0 0 asdfghjklzxcvbnm +3370856 1221443 0 0 asdfghjklzxcvbnm +3370861 1221443 1221445 0 abcdefghijklmnopwrst +3375327 1221443 0 0 abcdefghijklmnopwrst +3375333 1221443 1221445 0 abcdefghijklmnopwrst +3376219 1221453 0 1 abcdefghijklmnopwrst +3376228 1221453 0 0 abcdefghijklmnopwrst +3376238 1221453 0 0 asdfghjklzxcvbnm +3376243 1221453 0 0 abcdefghijklmnopwrst +3376248 1221453 0 1 abcdefghijklmnopwrst +3376254 1221453 0 0 abcdefghijklmnopwrst +3376263 1221453 0 0 abcdefghijklmnopwrst +3376272 1221453 0 1 asdfghjklzxcvbnm +3376281 1221453 0 0 asdfghjklzxcvbnm +3376290 1221453 0 0 abcdefghijklmnopwrst +3376296 1221453 0 1 abcdefghijklmnopwrst +3376301 1221453 0 0 asdfghjklzxcvbnm +3376350 1221453 0 0 asdfghjklzxcvbnm +3379002 1221453 0 0 abcdefghijklmnopwrst +3379015 1221453 0 0 asdfghjklzxcvbnm +3379025 1221453 0 0 abcdefghijklmnopwrst +3379032 1221453 0 0 asdfghjklzxcvbnm +3380181 1221372 1245650 0 asdfghjklzxcvbnm +3380186 1221372 1245650 0 abcdefghijklmnopwrst +3380190 1221372 1245650 0 asdfghjklzxcvbnm +3380195 1221372 1245650 0 abcdefghijklmnopwrst +3380202 1221372 1245650 0 asdfghjklzxcvbnm +3380683 1221287 0 0 asdfghjklzxcvbnm +3382317 1221453 0 0 abcdefghijklmnopwrst +3382417 1221287 0 0 asdfghjklzxcvbnm +3383523 1221338 0 1 abcdefghijklmnopwrst +3387213 1221287 0 0 abcdefghijklmnopwrst +3388139 1221453 0 0 asdfghjklzxcvbnm +3398039 1221443 1251164 0 abcdefghijklmnopwrst +3401835 1221453 0 0 asdfghjklzxcvbnm +3412582 1221443 1255886 0 asdfghjklzxcvbnm +3412583 1221443 1255886 0 asdfghjklzxcvbnm +3413795 1221443 1255886 0 asdfghjklzxcvbnm +3413813 1221443 1256258 0 asdfghjklzxcvbnm +3420306 1221453 0 0 asdfghjklzxcvbnm +3420354 1221453 0 0 asdfghjklzxcvbnm +3425653 1221443 0 0 abcdefghijklmnopwrst +3425658 1221443 0 0 asdfghjklzxcvbnm +3431409 1221453 0 0 asdfghjklzxcvbnm +3432510 1221443 1262320 0 asdfghjklzxcvbnm +3432513 1221443 1262320 0 asdfghjklzxcvbnm +3444444 1221443 1262320 0 abcdefghijklmnopwrst +3445447 1221287 0 1 asdfghjklzxcvbnm +3448662 1221338 0 0 asdfghjklzxcvbnm +3450032 1221347 0 0 abcdefghijklmnopwrst +3450259 1221453 0 0 abcdefghijklmnopwrst +3452176 1221453 0 0 asdfghjklzxcvbnm +3459239 1221347 0 0 asdfghjklzxcvbnm +3463196 1221347 0 0 abcdefghijklmnopwrst +3468759 1221453 0 0 abcdefghijklmnopwrst +3470988 1221457 0 0 asdfghjklzxcvbnm +3477116 1221287 0 0 asdfghjklzxcvbnm +3477639 1221372 1277136 0 abcdefghijklmnopwrst +3477656 1221372 1277136 0 asdfghjklzxcvbnm +3488071 1221256 1238964 0 abcdefghijklmnopwrst +3488079 1221256 0 0 asdfghjklzxcvbnm +3488108 1221256 0 1 asdfghjklzxcvbnm +3507126 1221287 0 1 asdfghjklzxcvbnm +3511898 1221347 0 0 asdfghjklzxcvbnm +3521780 1221453 0 0 abcdefghijklmnopwrst +3536908 1221287 0 0 abcdefghijklmnopwrst +3544231 1221329 0 1 asdfghjklzxcvbnm +3545379 1221329 1298955 0 abcdefghijklmnopwrst +3545384 1221329 1298955 0 abcdefghijklmnopwrst +3545387 1221329 1298955 0 abcdefghijklmnopwrst +3545389 1221329 1298955 1 abcdefghijklmnopwrst +3545398 1221329 1298955 1 abcdefghijklmnopwrst +3555715 1221287 0 0 asdfghjklzxcvbnm +3563557 1221329 1298955 0 abcdefghijklmnopwrst +3564322 1221338 0 0 asdfghjklzxcvbnm +3565475 1221453 0 0 abcdefghijklmnopwrst +3577588 1221287 0 0 asdfghjklzxcvbnm +3600047 1221453 0 0 abcdefghijklmnopwrst +3600062 1221453 0 0 asdfghjklzxcvbnm +3600071 1221453 0 0 abcdefghijklmnopwrst +3600080 1221453 0 1 abcdefghijklmnopwrst +3600086 1221453 0 0 asdfghjklzxcvbnm +3600091 1221453 0 1 abcdefghijklmnopwrst +3600097 1221453 0 0 asdfghjklzxcvbnm +3600103 1221453 0 0 asdfghjklzxcvbnm +3600106 1221453 0 0 abcdefghijklmnopwrst +3600113 1221453 0 0 abcdefghijklmnopwrst +3600119 1221453 0 0 asdfghjklzxcvbnm +3600124 1221453 0 0 abcdefghijklmnopwrst +3600144 1221453 0 0 asdfghjklzxcvbnm +3600152 1221453 0 0 asdfghjklzxcvbnm +3600165 1221453 0 0 asdfghjklzxcvbnm +3610561 1221287 0 0 abcdefghijklmnopwrst +3617030 1221329 0 0 asdfghjklzxcvbnm +3628347 1221443 1327098 0 abcdefghijklmnopwrst +3628348 1221443 1327098 0 abcdefghijklmnopwrst +3628646 1221443 0 0 asdfghjklzxcvbnm +3633673 1221372 1328838 0 abcdefghijklmnopwrst +3648489 1221443 0 0 asdfghjklzxcvbnm +3648490 1221443 0 0 asdfghjklzxcvbnm +3648534 1221443 1333827 0 asdfghjklzxcvbnm +3653046 1221329 1298955 0 asdfghjklzxcvbnm +3662680 1221287 0 0 asdfghjklzxcvbnm +3699529 1221288 0 0 asdfghjklzxcvbnm +3706659 1221453 0 0 asdfghjklzxcvbnm +3723399 1221287 0 1 asdfghjklzxcvbnm +3749934 1221278 0 0 abcdefghijklmnopwrst +3761370 1221443 1371176 0 asdfghjklzxcvbnm +3765884 1221443 1333827 0 abcdefghijklmnopwrst +3772880 1221457 0 0 abcdefghijklmnopwrst +3779574 1221457 1372998 1 abcdefghijklmnopwrst +3784656 1221457 1372998 1 abcdefghijklmnopwrst +3784700 1221457 1372998 1 abcdefghijklmnopwrst +3784744 1221457 1382427 0 abcdefghijklmnopwrst +3796187 1221457 1382427 1 abcdefghijklmnopwrst +3796193 1221457 0 0 abcdefghijklmnopwrst +3817277 1221457 1382427 0 asdfghjklzxcvbnm +3828282 1221457 0 0 abcdefghijklmnopwrst +3828297 1221457 0 0 abcdefghijklmnopwrst +3828300 1221457 0 0 abcdefghijklmnopwrst +3833022 1221287 0 0 asdfghjklzxcvbnm +3856380 1221457 1395359 0 asdfghjklzxcvbnm +3856391 1221457 0 0 asdfghjklzxcvbnm +3861413 1221256 0 0 abcdefghijklmnopwrst +3864734 1221393 0 1 abcdefghijklmnopwrst +3868051 1221329 0 0 abcdefghijklmnopwrst +3868059 1221329 0 0 abcdefghijklmnopwrst +3869088 1221329 0 0 abcdefghijklmnopwrst +3878669 1221329 1298955 0 asdfghjklzxcvbnm +3878684 1221329 1298955 0 asdfghjklzxcvbnm +3881785 1221287 0 0 abcdefghijklmnopwrst +3882333 1221287 0 0 asdfghjklzxcvbnm +3882389 1221287 0 0 abcdefghijklmnopwrst +3908680 1221372 1245650 0 asdfghjklzxcvbnm +3908690 1221372 1245650 0 asdfghjklzxcvbnm +3908697 1221372 1245650 0 abcdefghijklmnopwrst +3911434 1221453 0 0 abcdefghijklmnopwrst +3911446 1221453 0 0 asdfghjklzxcvbnm +3911448 1221453 0 0 abcdefghijklmnopwrst +3911489 1221453 0 0 abcdefghijklmnopwrst +3917384 1221453 0 0 abcdefghijklmnopwrst +3939602 1221457 0 1 asdfghjklzxcvbnm +3962210 1221453 0 0 asdfghjklzxcvbnm +3963734 1221457 0 0 asdfghjklzxcvbnm +3977364 1221287 0 0 asdfghjklzxcvbnm +3981725 1221453 0 0 abcdefghijklmnopwrst +4042952 1221453 0 0 abcdefghijklmnopwrst +4042953 1221453 0 0 abcdefghijklmnopwrst +4042958 1221453 0 0 abcdefghijklmnopwrst +4042960 1221453 0 1 abcdefghijklmnopwrst +4042965 1221453 0 0 asdfghjklzxcvbnm +4066893 1221453 0 1 abcdefghijklmnopwrst +4066896 1221453 0 0 abcdefghijklmnopwrst +4066900 1221453 0 0 abcdefghijklmnopwrst +4066908 1221453 0 0 abcdefghijklmnopwrst +4066912 1221453 0 0 asdfghjklzxcvbnm +4066915 1221453 0 0 asdfghjklzxcvbnm +4066919 1221453 0 0 abcdefghijklmnopwrst +4066924 1221453 0 0 asdfghjklzxcvbnm +4066929 1221453 0 0 abcdefghijklmnopwrst +4066934 1221453 0 0 asdfghjklzxcvbnm +4066941 1221453 0 0 abcdefghijklmnopwrst +4066946 1221453 0 0 asdfghjklzxcvbnm +4066955 1221453 0 0 abcdefghijklmnopwrst +4116291 1221433 1487238 0 asdfghjklzxcvbnm +4116295 1221433 1487238 0 abcdefghijklmnopwrst +4116450 1221433 1487238 0 abcdefghijklmnopwrst +4121149 1221287 0 0 asdfghjklzxcvbnm +4137325 1221453 0 0 abcdefghijklmnopwrst +4149051 1221287 0 0 abcdefghijklmnopwrst +4162347 1221287 0 0 abcdefghijklmnopwrst +4164485 1221457 0 1 asdfghjklzxcvbnm +4174706 1221457 0 0 abcdefghijklmnopwrst +4178645 1221457 0 0 abcdefghijklmnopwrst +4180122 1221457 1382427 0 asdfghjklzxcvbnm +4180925 1221457 1382427 0 asdfghjklzxcvbnm +4186417 1221457 0 0 abcdefghijklmnopwrst +4189624 1221457 0 1 asdfghjklzxcvbnm +4203132 1221453 0 0 asdfghjklzxcvbnm +4228206 1221457 0 0 abcdefghijklmnopwrst +4278829 1221453 0 0 abcdefghijklmnopwrst +4326422 1221453 0 0 abcdefghijklmnopwrst +4337061 1221287 0 0 abcdefghijklmnopwrst +4379354 1221287 0 0 abcdefghijklmnopwrst +4404901 1221457 0 0 abcdefghijklmnopwrst +4494153 1221457 0 0 abcdefghijklmnopwrst +4535721 1221287 0 0 asdfghjklzxcvbnm +4559596 1221457 0 0 abcdefghijklmnopwrst +4617751 1221393 0 0 abcdefghijklmnopwrst diff --git a/mysql-test/suite/binlog/r/binlog_base64_flag.result b/mysql-test/suite/binlog/r/binlog_base64_flag.result index 58c444c9571..7fb5e50a219 100644 --- a/mysql-test/suite/binlog/r/binlog_base64_flag.result +++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result @@ -91,3 +91,14 @@ iONkSBcBAAAAKwAAAMQBAAAQABAAAAAAAAEAA//4AQAAAAMAMTIzAQAAAA== '; ERROR HY000: master may suffer from http://bugs.mysql.com/bug.php?id=37426 so slave stops; check error log on slave for more info drop table t1, char63_utf8, char128_utf8; +# +# Bug #54393: crash and/or valgrind errors in +# mysql_client_binlog_statement +# +BINLOG ''; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use +BINLOG '123'; +BINLOG '-2079193929'; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use +BINLOG 'xç↓%~∙Dâ•’Æ’â•¡'; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result index 67a9869520b..8ba70fb8311 100644 --- a/mysql-test/suite/binlog/r/binlog_row_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result @@ -1286,16 +1286,13 @@ drop table t1; reset master; drop table if exists t3; create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 347 +File master-bin.000001 insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); -show master status /* must show new binlog index after rotating */; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000002 107 +*** show new binlog index after rotating *** +File master-bin.000002 drop table t3; # # Bug #45998: database crashes when running "create as select" diff --git a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result index 699c824844f..52065ef1a3d 100644 --- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result @@ -463,8 +463,7 @@ select get_lock("a",10); get_lock("a",10) 1 flush logs; -This does not matter in ROW mode as the rolled back changes do not contain transactional changes as these -were previously flushed upon committing/rolling back each statement. +There is nothing to roll back; transactional changes are removed from the trans cache. drop table t1, t2; create temporary table tt (a int unique); create table ti (a int) engine=innodb; diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result index c491d23c21b..fd036643b4b 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result @@ -776,16 +776,13 @@ drop table t1; reset master; drop table if exists t3; create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb; -show master status; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 347 +File master-bin.000001 insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); -show master status /* must show new binlog index after rotating */; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000002 107 +*** show new binlog index after rotating *** +File master-bin.000002 drop table t3; # # Bug #45998: database crashes when running "create as select" diff --git a/mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result b/mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result old mode 100755 new mode 100644 diff --git a/mysql-test/suite/binlog/t/binlog_base64_flag.test b/mysql-test/suite/binlog/t/binlog_base64_flag.test index e6271ec6ccc..3f1e4e98bec 100644 --- a/mysql-test/suite/binlog/t/binlog_base64_flag.test +++ b/mysql-test/suite/binlog/t/binlog_base64_flag.test @@ -150,3 +150,16 @@ iONkSBcBAAAAKwAAAMQBAAAQABAAAAAAAAEAA//4AQAAAAMAMTIzAQAAAA== '; drop table t1, char63_utf8, char128_utf8; + + +--echo # +--echo # Bug #54393: crash and/or valgrind errors in +--echo # mysql_client_binlog_statement +--echo # +--error ER_SYNTAX_ERROR +BINLOG ''; +BINLOG '123'; +--error ER_SYNTAX_ERROR +BINLOG '-2079193929'; +--error ER_SYNTAX_ERROR +BINLOG 'xç↓%~∙Dâ•’Æ’â•¡'; diff --git a/mysql-test/suite/binlog/t/binlog_killed_simulate.test b/mysql-test/suite/binlog/t/binlog_killed_simulate.test index 9cfa9e3e88e..f271c34d29d 100644 --- a/mysql-test/suite/binlog/t/binlog_killed_simulate.test +++ b/mysql-test/suite/binlog/t/binlog_killed_simulate.test @@ -24,7 +24,8 @@ update t1 set a=2 /* will be "killed" after work has been done */; # for some constants like the offset of the first real event # that is different between severs versions. let $MYSQLD_DATADIR= `select @@datadir`; ---exec $MYSQL_BINLOG --force-if-open --start-position=107 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog +--let $binlog_start_point= query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1) +--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_start_point $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog")) @@ -49,10 +50,13 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "kil # a proof the query is binlogged with an error - +--let $binlog_load_data= query_get_value(SHOW BINLOG EVENTS, Pos, 3) +--let $binlog_end= query_get_value(SHOW BINLOG EVENTS, Pos, 4) source include/show_binlog_events.inc; ---exec $MYSQL_BINLOG --force-if-open --start-position=210 --stop-position=387 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog +--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_load_data --stop-position=$binlog_end $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog + + --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog")) diff --git a/mysql-test/suite/funcs_1/r/is_basics_mixed.result b/mysql-test/suite/funcs_1/r/is_basics_mixed.result index ce0bb69e5ee..3ac17803688 100644 --- a/mysql-test/suite/funcs_1/r/is_basics_mixed.result +++ b/mysql-test/suite/funcs_1/r/is_basics_mixed.result @@ -328,7 +328,7 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_ SELECT table_schema,table_name FROM information_schema.tables WHERE table_schema = 'information_schema' AND table_name = 'tables'; table_schema table_name -information_schema tables +information_schema TABLES SELECT * FROM information_schema.table_privileges WHERE table_schema = 'information_schema'; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE diff --git a/mysql-test/suite/funcs_1/r/is_columns_innodb.result b/mysql-test/suite/funcs_1/r/is_columns_innodb.result index 1fac7ca83db..12ec7e2a33e 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_innodb.result +++ b/mysql-test/suite/funcs_1/r/is_columns_innodb.result @@ -450,9 +450,9 @@ def test tb1 f27 27 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerof def test tb1 f28 28 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references def test tb1 f29 29 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references def test tb1 f3 3 NULL YES char 0 0 NULL NULL latin1 latin1_swedish_ci char(0) select,insert,update,references -def test tb1 f30 30 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -def test tb1 f31 31 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references -def test tb1 f32 32 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +def test tb1 f30 30 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +def test tb1 f31 31 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +def test tb1 f32 32 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references def test tb1 f33 33 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references def test tb1 f34 34 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references def test tb1 f35 35 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references @@ -565,9 +565,9 @@ def test tb3 f143 26 99999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned se def test tb3 f144 27 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references def test tb3 f145 28 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references def test tb3 f146 29 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references -def test tb3 f147 30 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -def test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references -def test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +def test tb3 f147 30 999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +def test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +def test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references def test tb3 f150 33 1000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references def test tb3 f151 34 999 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references def test tb3 f152 35 0000001000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result index 0088b21ee04..ea13b8619ce 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is.result @@ -15,8 +15,8 @@ def information_schema COLLATIONS IS_DEFAULT 4 NO varchar 3 9 NULL NULL utf8 ut def information_schema COLLATIONS SORTLEN 6 0 NO bigint NULL NULL 19 0 NULL NULL bigint(3) select def information_schema COLLATION_CHARACTER_SET_APPLICABILITY CHARACTER_SET_NAME 2 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select def information_schema COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME 1 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select -def information_schema COLUMNS CHARACTER_MAXIMUM_LENGTH 9 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -def information_schema COLUMNS CHARACTER_OCTET_LENGTH 10 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +def information_schema COLUMNS CHARACTER_MAXIMUM_LENGTH 9 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +def information_schema COLUMNS CHARACTER_OCTET_LENGTH 10 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select def information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select def information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select def information_schema COLUMNS COLUMN_COMMENT 19 NO varchar 1024 3072 NULL NULL utf8 utf8_general_ci varchar(1024) select @@ -27,9 +27,9 @@ def information_schema COLUMNS COLUMN_TYPE 15 NULL NO longtext 4294967295 429496 def information_schema COLUMNS DATA_TYPE 8 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema COLUMNS EXTRA 17 NO varchar 27 81 NULL NULL utf8 utf8_general_ci varchar(27) select def information_schema COLUMNS IS_NULLABLE 7 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select -def information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -def information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -def information_schema COLUMNS ORDINAL_POSITION 5 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +def information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +def information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +def information_schema COLUMNS ORDINAL_POSITION 5 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select def information_schema COLUMNS PRIVILEGES 18 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select def information_schema COLUMNS TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select def information_schema COLUMNS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -71,14 +71,14 @@ def information_schema EVENTS SQL_MODE 12 NO varchar 8192 24576 NULL NULL utf8 def information_schema EVENTS STARTS 13 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select def information_schema EVENTS STATUS 15 NO varchar 18 54 NULL NULL utf8 utf8_general_ci varchar(18) select def information_schema EVENTS TIME_ZONE 5 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema FILES AUTOEXTEND_SIZE 19 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -def information_schema FILES AVG_ROW_LENGTH 28 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -def information_schema FILES CHECKSUM 36 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +def information_schema FILES AUTOEXTEND_SIZE 19 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +def information_schema FILES AVG_ROW_LENGTH 28 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +def information_schema FILES CHECKSUM 36 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select def information_schema FILES CHECK_TIME 35 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select def information_schema FILES CREATE_TIME 33 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select def information_schema FILES CREATION_TIME 20 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -def information_schema FILES DATA_FREE 32 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -def information_schema FILES DATA_LENGTH 29 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +def information_schema FILES DATA_FREE 32 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +def information_schema FILES DATA_LENGTH 29 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select def information_schema FILES DELETED_ROWS 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select def information_schema FILES ENGINE 10 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema FILES EXTENT_SIZE 16 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) select @@ -88,27 +88,27 @@ def information_schema FILES FILE_NAME 2 NULL YES varchar 64 192 NULL NULL utf8 def information_schema FILES FILE_TYPE 3 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select def information_schema FILES FREE_EXTENTS 14 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select def information_schema FILES FULLTEXT_KEYS 11 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema FILES INDEX_LENGTH 31 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -def information_schema FILES INITIAL_SIZE 17 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +def information_schema FILES INDEX_LENGTH 31 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +def information_schema FILES INITIAL_SIZE 17 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select def information_schema FILES LAST_ACCESS_TIME 22 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select def information_schema FILES LAST_UPDATE_TIME 21 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select def information_schema FILES LOGFILE_GROUP_NAME 8 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema FILES LOGFILE_GROUP_NUMBER 9 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select -def information_schema FILES MAXIMUM_SIZE 18 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -def information_schema FILES MAX_DATA_LENGTH 30 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +def information_schema FILES MAXIMUM_SIZE 18 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +def information_schema FILES MAX_DATA_LENGTH 30 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select def information_schema FILES RECOVER_TIME 23 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select def information_schema FILES ROW_FORMAT 26 NULL YES varchar 10 30 NULL NULL utf8 utf8_general_ci varchar(10) select def information_schema FILES STATUS 37 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select def information_schema FILES TABLESPACE_NAME 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema FILES TABLE_CATALOG 5 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema FILES TABLE_NAME 7 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema FILES TABLE_ROWS 27 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +def information_schema FILES TABLE_ROWS 27 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select def information_schema FILES TABLE_SCHEMA 6 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema FILES TOTAL_EXTENTS 15 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select def information_schema FILES TRANSACTION_COUNTER 24 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select def information_schema FILES UPDATE_COUNT 13 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select def information_schema FILES UPDATE_TIME 34 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -def information_schema FILES VERSION 25 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +def information_schema FILES VERSION 25 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select def information_schema GLOBAL_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NULL YES varchar 1024 3072 NULL NULL utf8 utf8_general_ci varchar(1024) select def information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -140,29 +140,29 @@ def information_schema PARAMETERS ROUTINE_TYPE 15 NO varchar 9 27 NULL NULL utf def information_schema PARAMETERS SPECIFIC_CATALOG 1 NO varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select def information_schema PARAMETERS SPECIFIC_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema PARAMETERS SPECIFIC_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema PARTITIONS AVG_ROW_LENGTH 14 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -def information_schema PARTITIONS CHECKSUM 22 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +def information_schema PARTITIONS AVG_ROW_LENGTH 14 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +def information_schema PARTITIONS CHECKSUM 22 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select def information_schema PARTITIONS CHECK_TIME 21 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select def information_schema PARTITIONS CREATE_TIME 19 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -def information_schema PARTITIONS DATA_FREE 18 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -def information_schema PARTITIONS DATA_LENGTH 15 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -def information_schema PARTITIONS INDEX_LENGTH 17 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -def information_schema PARTITIONS MAX_DATA_LENGTH 16 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +def information_schema PARTITIONS DATA_FREE 18 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +def information_schema PARTITIONS DATA_LENGTH 15 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +def information_schema PARTITIONS INDEX_LENGTH 17 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +def information_schema PARTITIONS MAX_DATA_LENGTH 16 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select def information_schema PARTITIONS NODEGROUP 24 NO varchar 12 36 NULL NULL utf8 utf8_general_ci varchar(12) select def information_schema PARTITIONS PARTITION_COMMENT 23 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select def information_schema PARTITIONS PARTITION_DESCRIPTION 12 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select def information_schema PARTITIONS PARTITION_EXPRESSION 10 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select def information_schema PARTITIONS PARTITION_METHOD 8 NULL YES varchar 18 54 NULL NULL utf8 utf8_general_ci varchar(18) select def information_schema PARTITIONS PARTITION_NAME 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema PARTITIONS PARTITION_ORDINAL_POSITION 6 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +def information_schema PARTITIONS PARTITION_ORDINAL_POSITION 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select def information_schema PARTITIONS SUBPARTITION_EXPRESSION 11 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select def information_schema PARTITIONS SUBPARTITION_METHOD 9 NULL YES varchar 12 36 NULL NULL utf8 utf8_general_ci varchar(12) select def information_schema PARTITIONS SUBPARTITION_NAME 5 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema PARTITIONS SUBPARTITION_ORDINAL_POSITION 7 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +def information_schema PARTITIONS SUBPARTITION_ORDINAL_POSITION 7 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select def information_schema PARTITIONS TABLESPACE_NAME 25 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema PARTITIONS TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select def information_schema PARTITIONS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema PARTITIONS TABLE_ROWS 13 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +def information_schema PARTITIONS TABLE_ROWS 13 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select def information_schema PARTITIONS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema PARTITIONS UPDATE_TIME 20 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select def information_schema PLUGINS PLUGIN_AUTHOR 8 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -254,33 +254,33 @@ def information_schema STATISTICS SUB_PART 11 NULL YES bigint NULL NULL 19 0 NUL def information_schema STATISTICS TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select def information_schema STATISTICS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema STATISTICS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema TABLES AUTO_INCREMENT 14 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -def information_schema TABLES AVG_ROW_LENGTH 9 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -def information_schema TABLES CHECKSUM 19 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +def information_schema TABLES AUTO_INCREMENT 14 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +def information_schema TABLES AVG_ROW_LENGTH 9 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +def information_schema TABLES CHECKSUM 19 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select def information_schema TABLES CHECK_TIME 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select def information_schema TABLES CREATE_OPTIONS 20 NULL YES varchar 255 765 NULL NULL utf8 utf8_general_ci varchar(255) select def information_schema TABLES CREATE_TIME 15 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -def information_schema TABLES DATA_FREE 13 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -def information_schema TABLES DATA_LENGTH 10 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +def information_schema TABLES DATA_FREE 13 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +def information_schema TABLES DATA_LENGTH 10 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select def information_schema TABLES ENGINE 5 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema TABLES INDEX_LENGTH 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -def information_schema TABLES MAX_DATA_LENGTH 11 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +def information_schema TABLES INDEX_LENGTH 12 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +def information_schema TABLES MAX_DATA_LENGTH 11 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select def information_schema TABLES ROW_FORMAT 7 NULL YES varchar 10 30 NULL NULL utf8 utf8_general_ci varchar(10) select def information_schema TABLES TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select def information_schema TABLES TABLE_COLLATION 18 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select def information_schema TABLES TABLE_COMMENT 21 NO varchar 2048 6144 NULL NULL utf8 utf8_general_ci varchar(2048) select def information_schema TABLES TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema TABLES TABLE_ROWS 8 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +def information_schema TABLES TABLE_ROWS 8 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select def information_schema TABLES TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema TABLES TABLE_TYPE 4 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema TABLES UPDATE_TIME 16 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -def information_schema TABLES VERSION 6 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -def information_schema TABLESPACES AUTOEXTEND_SIZE 6 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +def information_schema TABLES VERSION 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +def information_schema TABLESPACES AUTOEXTEND_SIZE 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select def information_schema TABLESPACES ENGINE 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema TABLESPACES EXTENT_SIZE 5 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +def information_schema TABLESPACES EXTENT_SIZE 5 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select def information_schema TABLESPACES LOGFILE_GROUP_NAME 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema TABLESPACES MAXIMUM_SIZE 7 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -def information_schema TABLESPACES NODEGROUP_ID 8 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +def information_schema TABLESPACES MAXIMUM_SIZE 7 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +def information_schema TABLESPACES NODEGROUP_ID 8 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select def information_schema TABLESPACES TABLESPACE_COMMENT 9 NULL YES varchar 2048 6144 NULL NULL utf8 utf8_general_ci varchar(2048) select def information_schema TABLESPACES TABLESPACE_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema TABLESPACES TABLESPACE_TYPE 3 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select diff --git a/mysql-test/suite/funcs_1/r/is_columns_memory.result b/mysql-test/suite/funcs_1/r/is_columns_memory.result index b2a798c938c..8cb865e68db 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_memory.result +++ b/mysql-test/suite/funcs_1/r/is_columns_memory.result @@ -437,9 +437,9 @@ def test tb1 f27 19 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerof def test tb1 f28 20 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references def test tb1 f29 21 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references def test tb1 f3 3 NULL YES char 1 1 NULL NULL latin1 latin1_swedish_ci char(1) select,insert,update,references -def test tb1 f30 22 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -def test tb1 f31 23 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references -def test tb1 f32 24 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +def test tb1 f30 22 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +def test tb1 f31 23 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +def test tb1 f32 24 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references def test tb1 f33 25 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references def test tb1 f34 26 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references def test tb1 f35 27 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references @@ -540,9 +540,9 @@ def test tb3 f143 20 99999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned se def test tb3 f144 21 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references def test tb3 f145 22 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references def test tb3 f146 23 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references -def test tb3 f147 24 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -def test tb3 f148 25 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references -def test tb3 f149 26 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +def test tb3 f147 24 999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +def test tb3 f148 25 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +def test tb3 f149 26 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references def test tb3 f150 27 1000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references def test tb3 f151 28 999 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references def test tb3 f152 29 0000001000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references diff --git a/mysql-test/suite/funcs_1/r/is_columns_myisam.result b/mysql-test/suite/funcs_1/r/is_columns_myisam.result index b7c972c7238..e4c86f7ca94 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_myisam.result +++ b/mysql-test/suite/funcs_1/r/is_columns_myisam.result @@ -479,9 +479,9 @@ def test tb1 f27 27 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerof def test tb1 f28 28 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references def test tb1 f29 29 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references def test tb1 f3 3 NULL YES char 1 1 NULL NULL latin1 latin1_swedish_ci char(1) select,insert,update,references -def test tb1 f30 30 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -def test tb1 f31 31 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references -def test tb1 f32 32 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +def test tb1 f30 30 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +def test tb1 f31 31 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +def test tb1 f32 32 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references def test tb1 f33 33 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references def test tb1 f34 34 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references def test tb1 f35 35 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references @@ -602,9 +602,9 @@ def test tb3 f143 26 99999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned se def test tb3 f144 27 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references def test tb3 f145 28 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references def test tb3 f146 29 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references -def test tb3 f147 30 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -def test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references -def test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +def test tb3 f147 30 999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +def test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +def test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references def test tb3 f150 33 1000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references def test tb3 f151 34 999 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references def test tb3 f152 35 0000001000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result index bd548ac0a25..1ab2b3513f0 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result @@ -97,13 +97,13 @@ def mysql host Select_priv 3 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum(' def mysql host Show_view_priv 16 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references def mysql host Trigger_priv 20 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references def mysql host Update_priv 5 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references -def mysql ndb_binlog_index deletes 6 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -def mysql ndb_binlog_index epoch 3 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned PRI select,insert,update,references +def mysql ndb_binlog_index deletes 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +def mysql ndb_binlog_index epoch 3 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned PRI select,insert,update,references def mysql ndb_binlog_index File 2 NULL NO varchar 255 255 NULL NULL latin1 latin1_swedish_ci varchar(255) select,insert,update,references -def mysql ndb_binlog_index inserts 4 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -def mysql ndb_binlog_index Position 1 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -def mysql ndb_binlog_index schemaops 7 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -def mysql ndb_binlog_index updates 5 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references +def mysql ndb_binlog_index inserts 4 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +def mysql ndb_binlog_index Position 1 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +def mysql ndb_binlog_index schemaops 7 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +def mysql ndb_binlog_index updates 5 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references def mysql plugin dl 2 NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references def mysql plugin name 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) PRI select,insert,update,references def mysql proc body 11 NULL NO longblob 4294967295 4294967295 NULL NULL NULL NULL longblob select,insert,update,references diff --git a/mysql-test/suite/ibmdb2i/include/have_i54.inc b/mysql-test/suite/ibmdb2i/include/have_i54.inc old mode 100755 new mode 100644 diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result old mode 100755 new mode 100644 diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result old mode 100755 new mode 100644 diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test old mode 100755 new mode 100644 diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test old mode 100755 new mode 100644 diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result index 6d92d14e735..b418b62ec90 100644 --- a/mysql-test/suite/innodb/r/innodb_mysql.result +++ b/mysql-test/suite/innodb/r/innodb_mysql.result @@ -2468,6 +2468,76 @@ ENGINE=InnoDB; INSERT INTO t1 VALUES (0, 77, 1, 3); UPDATE t1 SET d = 0 WHERE b = 77 AND c = 25; DROP TABLE t1; +# +# Bug#50389 Using intersect does not return all rows +# +CREATE TABLE t1 ( +f1 INT(10) NOT NULL, +f2 INT(10), +f3 INT(10), +f4 TINYINT(4), +f5 VARCHAR(50), +PRIMARY KEY (f1), +KEY idx1 (f2,f5,f4), +KEY idx2 (f2,f4) +) ENGINE=InnoDB; +LOAD DATA INFILE '../../std_data/intersect-bug50389.tsv' INTO TABLE t1; +SELECT * FROM t1 WHERE f1 IN +(3305028,3353871,3772880,3346860,4228206,3336022, +3470988,3305175,3329875,3817277,3856380,3796193, +3784744,4180925,4559596,3963734,3856391,4494153) +AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ; +f1 f2 f3 f4 f5 +3305175 1221457 0 0 abcdefghijklmnopwrst +3329875 1221457 1382427 0 abcdefghijklmnopwrst +3336022 1221457 0 0 abcdefghijklmnopwrst +3346860 1221457 0 0 abcdefghijklmnopwrst +3772880 1221457 0 0 abcdefghijklmnopwrst +3784744 1221457 1382427 0 abcdefghijklmnopwrst +3796193 1221457 0 0 abcdefghijklmnopwrst +4228206 1221457 0 0 abcdefghijklmnopwrst +4494153 1221457 0 0 abcdefghijklmnopwrst +4559596 1221457 0 0 abcdefghijklmnopwrst +EXPLAIN SELECT * FROM t1 WHERE f1 IN +(3305028,3353871,3772880,3346860,4228206,3336022, +3470988,3305175,3329875,3817277,3856380,3796193, +3784744,4180925,4559596,3963734,3856391,4494153) +AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge PRIMARY,idx1,idx2 idx2,idx1,PRIMARY 7,60,4 NULL 1 Using intersect(idx2,idx1,PRIMARY); Using where +DROP TABLE t1; +# +# Bug#51431 Wrong sort order after import of dump file +# +CREATE TABLE t1 ( +f1 INT(11) NOT NULL, +f2 int(11) NOT NULL, +f3 int(11) NOT NULL, +f4 tinyint(1) NOT NULL, +PRIMARY KEY (f1), +UNIQUE KEY (f2, f3), +KEY (f4) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(1,1,991,1), (2,1,992,1), (3,1,993,1), (4,1,994,1), (5,1,995,1), +(6,1,996,1), (7,1,997,1), (8,1,998,1), (10,1,999,1), (11,1,9910,1), +(16,1,9911,1), (17,1,9912,1), (18,1,9913,1), (19,1,9914,1), (20,1,9915,1), +(21,1,9916,1), (22,1,9917,1), (23,1,9918,1), (24,1,9919,1), (25,1,9920,1), +(26,1,9921,1), (27,1,9922,1); +FLUSH TABLES; +SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE +ORDER BY f1 DESC LIMIT 5; +f1 f2 f3 f4 +27 1 9922 1 +26 1 9921 1 +25 1 9920 1 +24 1 9919 1 +23 1 9918 1 +EXPLAIN SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE +ORDER BY f1 DESC LIMIT 5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range f2,f4 f4 1 NULL 11 Using where +DROP TABLE t1; End of 5.1 tests # # Test for bug #39932 "create table fails if column for FK is in different diff --git a/mysql-test/suite/innodb/t/innodb_mysql.test b/mysql-test/suite/innodb/t/innodb_mysql.test index 09e076c0506..fcd54075ecc 100644 --- a/mysql-test/suite/innodb/t/innodb_mysql.test +++ b/mysql-test/suite/innodb/t/innodb_mysql.test @@ -676,6 +676,67 @@ UPDATE t1 SET d = 0 WHERE b = 77 AND c = 25; DROP TABLE t1; +--echo # +--echo # Bug#50389 Using intersect does not return all rows +--echo # + +CREATE TABLE t1 ( + f1 INT(10) NOT NULL, + f2 INT(10), + f3 INT(10), + f4 TINYINT(4), + f5 VARCHAR(50), + PRIMARY KEY (f1), + KEY idx1 (f2,f5,f4), + KEY idx2 (f2,f4) +) ENGINE=InnoDB; + +LOAD DATA INFILE '../../std_data/intersect-bug50389.tsv' INTO TABLE t1; + +SELECT * FROM t1 WHERE f1 IN +(3305028,3353871,3772880,3346860,4228206,3336022, + 3470988,3305175,3329875,3817277,3856380,3796193, + 3784744,4180925,4559596,3963734,3856391,4494153) +AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ; + +EXPLAIN SELECT * FROM t1 WHERE f1 IN +(3305028,3353871,3772880,3346860,4228206,3336022, + 3470988,3305175,3329875,3817277,3856380,3796193, + 3784744,4180925,4559596,3963734,3856391,4494153) +AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ; + +DROP TABLE t1; + +--echo # +--echo # Bug#51431 Wrong sort order after import of dump file +--echo # + +CREATE TABLE t1 ( + f1 INT(11) NOT NULL, + f2 int(11) NOT NULL, + f3 int(11) NOT NULL, + f4 tinyint(1) NOT NULL, + PRIMARY KEY (f1), + UNIQUE KEY (f2, f3), + KEY (f4) +) ENGINE=InnoDB; + +INSERT INTO t1 VALUES +(1,1,991,1), (2,1,992,1), (3,1,993,1), (4,1,994,1), (5,1,995,1), +(6,1,996,1), (7,1,997,1), (8,1,998,1), (10,1,999,1), (11,1,9910,1), +(16,1,9911,1), (17,1,9912,1), (18,1,9913,1), (19,1,9914,1), (20,1,9915,1), +(21,1,9916,1), (22,1,9917,1), (23,1,9918,1), (24,1,9919,1), (25,1,9920,1), +(26,1,9921,1), (27,1,9922,1); + +FLUSH TABLES; + +SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE +ORDER BY f1 DESC LIMIT 5; +EXPLAIN SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE +ORDER BY f1 DESC LIMIT 5; + +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/mysql-test/suite/perfschema/r/misc.result b/mysql-test/suite/perfschema/r/misc.result index 3c0a4a58e08..00619595749 100644 --- a/mysql-test/suite/perfschema/r/misc.result +++ b/mysql-test/suite/perfschema/r/misc.result @@ -25,3 +25,5 @@ drop table test.ghost; select * from performance_schema.FILE_INSTANCES where file_name like "%ghost%"; FILE_NAME EVENT_NAME OPEN_COUNT +select * from performance_schema.no_such_table; +ERROR 42S02: Table 'performance_schema.no_such_table' doesn't exist diff --git a/mysql-test/suite/perfschema/r/myisam_file_io.result b/mysql-test/suite/perfschema/r/myisam_file_io.result index 66c37c7d6d8..5d710d9183d 100644 --- a/mysql-test/suite/perfschema/r/myisam_file_io.result +++ b/mysql-test/suite/perfschema/r/myisam_file_io.result @@ -4,6 +4,7 @@ update performance_schema.SETUP_INSTRUMENTS set enabled='YES' update performance_schema.SETUP_CONSUMERS set enabled='YES'; truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; +flush status; drop table if exists test.no_index_tab; create table test.no_index_tab ( a varchar(255), b int ) engine=myisam; insert into no_index_tab set a = 'foo', b = 1; diff --git a/mysql-test/suite/perfschema/r/pfs_upgrade.result b/mysql-test/suite/perfschema/r/pfs_upgrade.result index 17b57ba2e46..2d0d82ef19c 100644 --- a/mysql-test/suite/perfschema/r/pfs_upgrade.result +++ b/mysql-test/suite/perfschema/r/pfs_upgrade.result @@ -26,7 +26,7 @@ ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists -ERROR 1644 (HY000) at line 1140: Unexpected content found in the performance_schema database. +ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database. FATAL ERROR: Upgrade failed show tables like "user_table"; Tables_in_performance_schema (user_table) @@ -57,7 +57,7 @@ ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists -ERROR 1644 (HY000) at line 1140: Unexpected content found in the performance_schema database. +ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database. FATAL ERROR: Upgrade failed show tables like "user_view"; Tables_in_performance_schema (user_view) @@ -86,7 +86,7 @@ ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists -ERROR 1644 (HY000) at line 1140: Unexpected content found in the performance_schema database. +ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database. FATAL ERROR: Upgrade failed select name from mysql.proc where db='performance_schema'; name @@ -115,7 +115,7 @@ ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists -ERROR 1644 (HY000) at line 1140: Unexpected content found in the performance_schema database. +ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database. FATAL ERROR: Upgrade failed select name from mysql.proc where db='performance_schema'; name @@ -144,7 +144,7 @@ ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists -ERROR 1644 (HY000) at line 1140: Unexpected content found in the performance_schema database. +ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database. FATAL ERROR: Upgrade failed select name from mysql.event where db='performance_schema'; name diff --git a/mysql-test/suite/perfschema/r/query_cache.result b/mysql-test/suite/perfschema/r/query_cache.result index 06862009493..f2fe8c727b2 100644 --- a/mysql-test/suite/perfschema/r/query_cache.result +++ b/mysql-test/suite/perfschema/r/query_cache.result @@ -4,6 +4,7 @@ insert into t1 values (1), (2), (3); SET GLOBAL query_cache_size=1355776; flush query cache; reset query cache; +flush status; select * from t1; a 1 diff --git a/mysql-test/suite/perfschema/r/thread_cache.result b/mysql-test/suite/perfschema/r/thread_cache.result new file mode 100644 index 00000000000..de4d19f9c64 --- /dev/null +++ b/mysql-test/suite/perfschema/r/thread_cache.result @@ -0,0 +1,34 @@ +SET @saved_thread_cache_size = @@global.thread_cache_size; +set global thread_cache_size = 0; +show variables like "thread_cache_size"; +Variable_name Value +thread_cache_size 0 +select @id_increment; +@id_increment +1 +select @thread_id_increment; +@thread_id_increment +1 +select @id_increment; +@id_increment +1 +select @thread_id_increment; +@thread_id_increment +1 +set global thread_cache_size = 100; +show variables like "thread_cache_size"; +Variable_name Value +thread_cache_size 100 +select @id_increment; +@id_increment +1 +select @thread_id_increment; +@thread_id_increment +1 +select @id_increment; +@id_increment +1 +select @thread_id_increment; +@thread_id_increment +1 +set global thread_cache_size = @saved_thread_cache_size; diff --git a/mysql-test/suite/perfschema/t/misc.test b/mysql-test/suite/perfschema/t/misc.test index 755648036ac..dfa865e8702 100644 --- a/mysql-test/suite/perfschema/t/misc.test +++ b/mysql-test/suite/perfschema/t/misc.test @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# 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 @@ -10,15 +10,14 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA # Tests for PERFORMANCE_SCHEMA # Miscelaneous --source include/not_embedded.inc --source include/have_perfschema.inc ---source include/not_var_link.inc # # Bug#45496 Performance schema: assertion fails in @@ -77,3 +76,10 @@ drop table test.ghost; select * from performance_schema.FILE_INSTANCES where file_name like "%ghost%"; +# +# Bug#52586 Misleading error message on attempt to access +# a P_S table using a wrong name + +--error ER_NO_SUCH_TABLE +select * from performance_schema.no_such_table; + diff --git a/mysql-test/suite/perfschema/t/myisam_file_io.test b/mysql-test/suite/perfschema/t/myisam_file_io.test index 53d2ea6dbe6..0861e8f4b74 100644 --- a/mysql-test/suite/perfschema/t/myisam_file_io.test +++ b/mysql-test/suite/perfschema/t/myisam_file_io.test @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# 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 @@ -10,8 +10,8 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA # Tests for PERFORMANCE_SCHEMA @@ -29,6 +29,9 @@ update performance_schema.SETUP_CONSUMERS truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; +# Reset lost counters to a known state +flush status; + # Code to test --disable_warnings diff --git a/mysql-test/suite/perfschema/t/query_cache.test b/mysql-test/suite/perfschema/t/query_cache.test index a50b3b99650..95f78d290ee 100644 --- a/mysql-test/suite/perfschema/t/query_cache.test +++ b/mysql-test/suite/perfschema/t/query_cache.test @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# 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 @@ -10,8 +10,8 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA # Tests for PERFORMANCE_SCHEMA @@ -33,6 +33,8 @@ SET GLOBAL query_cache_size=1355776; flush query cache; reset query cache; +# Reset Qcache_* to a known state +flush status; select * from t1; diff --git a/mysql-test/suite/perfschema/t/thread_cache.test b/mysql-test/suite/perfschema/t/thread_cache.test new file mode 100644 index 00000000000..8c3271ba406 --- /dev/null +++ b/mysql-test/suite/perfschema/t/thread_cache.test @@ -0,0 +1,134 @@ +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# Setup + +SET @saved_thread_cache_size = @@global.thread_cache_size; + +set global thread_cache_size = 0; + +show variables like "thread_cache_size"; + +connect (con1, localhost, root, , ); + +let $con1_ID=`select connection_id()`; + +let $con1_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST + where ID = connection_id()`; + +connect (con2, localhost, root, , ); + +let $con2_ID=`select connection_id()`; + +let $con2_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST + where ID = connection_id()`; + +connection default; + +--disable_query_log +eval select ($con2_ID - $con1_ID) into @id_increment; +eval select ($con2_THREAD_ID - $con1_THREAD_ID) into @thread_id_increment; +--enable_query_log + +# Expect 1, connection_id() is incremented for each new connection +select @id_increment; +# Expect 1, THREAD_ID is incremented for each new connection +select @thread_id_increment; + +disconnect con2; + +connect (con3, localhost, root, , ); + +let $con3_ID=`select connection_id()`; + +let $con3_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST + where ID = connection_id()`; + +disconnect con3; +disconnect con1; + +connection default; + +--disable_query_log +eval select ($con3_ID - $con2_ID) into @id_increment; +eval select ($con3_THREAD_ID - $con2_THREAD_ID) into @thread_id_increment; +--enable_query_log + +select @id_increment; +select @thread_id_increment; + +set global thread_cache_size = 100; + +show variables like "thread_cache_size"; + +connect (con1, localhost, root, , ); + +let $con1_ID=`select connection_id()`; + +let $con1_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST + where ID = connection_id()`; + +connect (con2, localhost, root, , ); + +let $con2_ID=`select connection_id()`; + +let $con2_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST + where ID = connection_id()`; + +connection default; + +--disable_query_log +eval select ($con2_ID - $con1_ID) into @id_increment; +eval select ($con2_THREAD_ID - $con1_THREAD_ID) into @thread_id_increment; +--enable_query_log + +select @id_increment; +select @thread_id_increment; + +disconnect con2; + +connect (con3, localhost, root, , ); + +let $con3_ID=`select connection_id()`; + +let $con3_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST + where ID = connection_id()`; + +disconnect con3; +disconnect con1; + +connection default; + +--disable_query_log +eval select ($con3_ID - $con2_ID) into @id_increment; +eval select ($con3_THREAD_ID - $con2_THREAD_ID) into @thread_id_increment; +--enable_query_log + +# When caching threads, the pthread that executed con2 was parked in the +# cache on disconnect, and then picked up con3. + +# Still expect a new connection_id() +select @id_increment; + +# And expect a new instrumentation: the THREAD_ID of old connections should not be reused. +select @thread_id_increment; + +set global thread_cache_size = @saved_thread_cache_size; + diff --git a/mysql-test/suite/rpl/r/rpl_current_user.result b/mysql-test/suite/rpl/r/rpl_current_user.result new file mode 100644 index 00000000000..69c20078531 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_current_user.result @@ -0,0 +1,205 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*"); + +# On slave2 +# Connect slave2 to slave +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=SLAVE_MYPORT;, +MASTER_LOG_FILE='slave-bin.000001', MASTER_USER='root'; +START SLAVE; + +# [On master] +DROP VIEW IF EXISTS v_user; +DROP VIEW IF EXISTS v_tables_priv; +DROP VIEW IF EXISTS v_procs_priv; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS my_grant; +DROP PROCEDURE IF EXISTS my_revoke; +DROP FUNCTION IF EXISTS my_user; +DROP EVENT IF EXISTS e1; +CREATE TABLE t1(c1 char(100)); +CREATE VIEW test.v_user AS SELECT * FROM mysql.user WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_tables_priv AS SELECT * FROM mysql.tables_priv WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_procs_priv AS SELECT * FROM mysql.procs_priv WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_event AS SELECT definer FROM mysql.event WHERE name = 'e1'; +CREATE PROCEDURE p1() SELECT 1; +# bug48321_1-01234 has the max length(16) of user. +GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1-01234'@'localhost' WITH GRANT OPTION; + +# Make sure the max lengths of user and host +# the user name is too lengh +GRANT CREATE USER ON *.* TO '01234567890123456'@'fakehost'; +ERROR HY000: String '01234567890123456' is too long for user name (should be no longer than 16) +# the host name is too lengh +GRANT CREATE USER ON *.* TO 'fakename'@'0123456789012345678901234567890123456789012345678901234567890'; +ERROR HY000: String '0123456789012345678901234567890123456789012345678901234567890' is too long for host name (should be no longer than 60) + +# User 'bug48321_1-01234' connects to master by conn1 +# [On conn1] +# Verify 'REVOKE ALL' statement +REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER(); +Comparing tables master:test.v_user and slave:test.v_user +Comparing tables master:test.v_user and slave2:test.v_user + +# Verify 'GRANT ... ON TABLE ...' statement +GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); +Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv +Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv + +# Verify 'GRANT ... ON PROCEDURE...' statement +GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER(); +Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv +Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv + +# Verify 'GRANT ... ON *.* ...' statement +GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION; +Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv +Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv + +# Verify 'REVOKE ... ON TABLE ...' statement +REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); +Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv +Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv + +# Verify 'REVOKE ... ON PROCEDURE...' statement +REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER(); +Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv +Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv + +# Verify 'REVOKE ... ON *.* ...' statement +REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER(); +Comparing tables master:test.v_user and slave:test.v_user +Comparing tables master:test.v_user and slave2:test.v_user + +# Verify 'GRANT ...' statement in the procedure +CREATE PROCEDURE my_grant() +GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); +call my_grant; +Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv +Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv + +# Verify 'REVOKE ... ON TABLE ...' statement in the procedure +CREATE PROCEDURE my_revoke() +REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); +call my_revoke; +Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv +Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv + +# Verify 'RENAME USER ...' statement +RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost'; +Comparing tables master:test.v_user and slave:test.v_user +Comparing tables master:test.v_user and slave2:test.v_user + +# Verify 'DROP USER ...' statement +GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost'; +DROP USER CURRENT_USER(); +Comparing tables master:test.v_user and slave:test.v_user +Comparing tables master:test.v_user and slave2:test.v_user + +# Verify 'ALTER EVENT...' statement +CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1; +# Explicitly assign CURRENT_USER() to definer +ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE; +Comparing tables master:test.v_event and slave:test.v_event +Comparing tables master:test.v_event and slave2:test.v_event + +# Session user will be set as definer, if the statement does not assign +# a definer +ALTER EVENT e1 ENABLE; +Comparing tables master:test.v_event and slave:test.v_event +Comparing tables master:test.v_event and slave2:test.v_event + +# Verify that this patch does not affect the calling of CURRENT_USER() +# in the other statements +# [On master] +INSERT INTO t1 VALUES(CURRENT_USER()), ('1234'); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. +SELECT * FROM t1; +c1 +root@localhost +1234 +# [On slave] +SELECT * FROM t1; +c1 +@ +1234 +# [On slave2] +SELECT * FROM t1; +c1 +@ +1234 +# [On master] +UPDATE t1 SET c1=CURRENT_USER() WHERE c1='1234'; +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. +SELECT * FROM t1; +c1 +root@localhost +root@localhost +# [On slave] +SELECT * FROM t1; +c1 +@ +@ +# [On slave2] +SELECT * FROM t1; +c1 +@ +@ +# [On master] +DELETE FROM t1 WHERE c1=CURRENT_USER(); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. +SELECT * FROM t1; +c1 +# [On slave] +SELECT * FROM t1; +c1 +# [On slave2] +SELECT * FROM t1; +c1 +# [On master] +CREATE TABLE t2(c1 char(100)); +CREATE FUNCTION my_user() RETURNS VARCHAR(64) +SQL SECURITY INVOKER +BEGIN +INSERT INTO t2 VALUES(CURRENT_USER()); +RETURN CURRENT_USER(); +END | +INSERT INTO t1 VALUES(my_user()); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. +SELECT * FROM t1; +c1 +root@localhost +SELECT * FROM t2; +c1 +root@localhost +# [On slave] +SELECT * FROM t1; +c1 +@ +SELECT * FROM t2; +c1 +@ +# [On slave2] +SELECT * FROM t1; +c1 +@ +SELECT * FROM t2; +c1 +@ + +# END +DROP TABLE t1, t2; +DROP VIEW v_user, v_tables_priv, v_procs_priv, v_event; +DROP PROCEDURE p1; +DROP PROCEDURE my_grant; +DROP PROCEDURE my_revoke; +DROP FUNCTION my_user; +DROP EVENT e1; diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result index dd0a2d89d54..daef153cdef 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result @@ -750,7 +750,7 @@ test_rpl e2 root@localhost SYSTEM RECURRING NULL 1 # # NULL ENABLED 1 latin1 lat USE test_rpl; SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation -test_rpl e2 @ SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +test_rpl e2 root@localhost SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci ==========MASTER========== SELECT COUNT(*) FROM t1; COUNT(*) diff --git a/mysql-test/suite/rpl/r/rpl_row_conflicts.result b/mysql-test/suite/rpl/r/rpl_row_conflicts.result index 6f98c25c335..90ccae5d738 100644 --- a/mysql-test/suite/rpl/r/rpl_row_conflicts.result +++ b/mysql-test/suite/rpl/r/rpl_row_conflicts.result @@ -24,7 +24,8 @@ a 1 [on slave] ---- Wait until slave stops with an error ---- -Last_SQL_Error = Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos 347 (expected "duplicate key" error) +Last_SQL_Error (expected "duplicate key" error) +Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos END_LOG_POS SELECT * FROM t1; a 1 diff --git a/mysql-test/suite/rpl/r/rpl_stm_conflicts.result b/mysql-test/suite/rpl/r/rpl_stm_conflicts.result index b0df9516b7c..6d9759b3562 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_conflicts.result +++ b/mysql-test/suite/rpl/r/rpl_stm_conflicts.result @@ -19,7 +19,8 @@ a 1 [on slave] ---- Wait until slave stops with an error ---- -Last_SQL_Error = Error 'Duplicate entry '1' for key 'PRIMARY'' on query. Default database: 'test'. Query: 'INSERT INTO t1 VALUES (1)' (expected "duplicate key" error) +Last_SQL_Error (expected "duplicate key" error) +Error 'Duplicate entry '1' for key 'PRIMARY'' on query. Default database: 'test'. Query: 'INSERT INTO t1 VALUES (1)' SELECT * FROM t1; a 1 diff --git a/mysql-test/suite/rpl/r/rpl_stm_until.result b/mysql-test/suite/rpl/r/rpl_stm_until.result index 118d31d78c8..36e06d1edd1 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_until.result +++ b/mysql-test/suite/rpl/r/rpl_stm_until.result @@ -96,7 +96,7 @@ Note 1051 Unknown table 't1' flush logs; stop slave; reset slave; -start slave until master_log_file='master-bin.000001', master_log_pos=294 /* to stop right before DROP */; +start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS; /* to stop right before DROP */; show tables /* t1 must exist */; Tables_in_test t1 diff --git a/mysql-test/suite/rpl/t/rpl_current_user.cnf b/mysql-test/suite/rpl/t/rpl_current_user.cnf new file mode 100644 index 00000000000..999ee727a88 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_current_user.cnf @@ -0,0 +1,9 @@ +!include ../my.cnf + +[mysqld.3] +server-id=3 +log-bin=slave-bin + +[ENV] +SLAVE_MYPORT1= @mysqld.3.port +SLAVE_MYSOCK1= @mysqld.3.socket diff --git a/mysql-test/suite/rpl/t/rpl_current_user.test b/mysql-test/suite/rpl/t/rpl_current_user.test new file mode 100644 index 00000000000..79816ef6c95 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_current_user.test @@ -0,0 +1,239 @@ +############################################################################## +# BUG#48321 CURRENT_USER() incorrectly replicated for DROP/RENAME USER, +# REVOKE, GRANT, ALTER EVENT +# +# Calling CURRENT_USER() results into inconsistency between slave and master, +# as the slave SQL thread has different user with common users. +# +# After the patch for bug#48321, session's user will be written into query log +# event if CURRENT_USER() is called in 'DROP/RENAME USER', 'REVOKE', 'GRANT', +# 'ALTER EVENT'. +# +############################################################################## +source include/master-slave.inc; +source include/have_binlog_format_statement.inc; +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*"); + +--echo +--echo # On slave2 +connect (slave2,127.0.0.1,root,,test,$SLAVE_MYPORT1,); +connection slave2; + +--echo # Connect slave2 to slave +--replace_result $SLAVE_MYPORT SLAVE_MYPORT; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT, + MASTER_LOG_FILE='slave-bin.000001', MASTER_USER='root'; +START SLAVE; +source include/wait_for_slave_to_start.inc; + +--echo +--echo # [On master] +connection master; +--disable_warnings +DROP VIEW IF EXISTS v_user; +DROP VIEW IF EXISTS v_tables_priv; +DROP VIEW IF EXISTS v_procs_priv; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS my_grant; +DROP PROCEDURE IF EXISTS my_revoke; +DROP FUNCTION IF EXISTS my_user; +DROP EVENT IF EXISTS e1; +--enable_warnings +CREATE TABLE t1(c1 char(100)); +CREATE VIEW test.v_user AS SELECT * FROM mysql.user WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_tables_priv AS SELECT * FROM mysql.tables_priv WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_procs_priv AS SELECT * FROM mysql.procs_priv WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_event AS SELECT definer FROM mysql.event WHERE name = 'e1'; +CREATE PROCEDURE p1() SELECT 1; +--echo # bug48321_1-01234 has the max length(16) of user. +GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1-01234'@'localhost' WITH GRANT OPTION; + +--echo +--echo # Make sure the max lengths of user and host +--echo # the user name is too lengh +--error 1470 +GRANT CREATE USER ON *.* TO '01234567890123456'@'fakehost'; +--echo # the host name is too lengh +--error 1470 +GRANT CREATE USER ON *.* TO 'fakename'@'0123456789012345678901234567890123456789012345678901234567890'; + +--echo +--echo # User 'bug48321_1-01234' connects to master by conn1 +connect (conn1, 127.0.0.1, 'bug48321_1-01234'@'localhost',,); +connection conn1; +--echo # [On conn1] +--echo # Verify 'REVOKE ALL' statement +REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER(); +let $diff_table= test.v_user; +let $diff_server_list= master, slave, slave2; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'GRANT ... ON TABLE ...' statement +connection conn1; +GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); +let $diff_table= test.v_tables_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'GRANT ... ON PROCEDURE...' statement +connection conn1; +GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER(); +let $diff_table= test.v_procs_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'GRANT ... ON *.* ...' statement +connection conn1; +GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'REVOKE ... ON TABLE ...' statement +connection conn1; +REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); +let $diff_table= test.v_tables_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'REVOKE ... ON PROCEDURE...' statement +connection conn1; +REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER(); +let $diff_table= test.v_procs_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'REVOKE ... ON *.* ...' statement +connection conn1; +REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER(); +let $diff_table= test.v_user; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'GRANT ...' statement in the procedure +connection conn1; +CREATE PROCEDURE my_grant() + GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); +call my_grant; +let $diff_table= test.v_tables_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'REVOKE ... ON TABLE ...' statement in the procedure +connection conn1; +CREATE PROCEDURE my_revoke() + REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); +call my_revoke; +let $diff_table= test.v_tables_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'RENAME USER ...' statement +connection conn1; +RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost'; +let $diff_table= test.v_user; +source include/rpl_diff_tables.inc; + +disconnect conn1; + +--echo +--echo # Verify 'DROP USER ...' statement +connection master; +GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost'; +connect (conn1, 127.0.0.1, 'bug48321_2'@'localhost',,); +connection conn1; +DROP USER CURRENT_USER(); +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'ALTER EVENT...' statement +connection master; +CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1; + +--echo # Explicitly assign CURRENT_USER() to definer +ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE; +let $diff_table= test.v_event; +source include/rpl_diff_tables.inc; + +connection master; +--echo +--echo # Session user will be set as definer, if the statement does not assign +--echo # a definer +ALTER EVENT e1 ENABLE; +sync_slave_with_master; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify that this patch does not affect the calling of CURRENT_USER() +--echo # in the other statements +connection master; +--echo # [On master] +INSERT INTO t1 VALUES(CURRENT_USER()), ('1234'); +SELECT * FROM t1; +sync_slave_with_master; +--echo # [On slave] +SELECT * FROM t1; +--echo # [On slave2] +sync_slave_with_master slave2; +SELECT * FROM t1; + +connection master; +--echo # [On master] +UPDATE t1 SET c1=CURRENT_USER() WHERE c1='1234'; +SELECT * FROM t1; +sync_slave_with_master; +--echo # [On slave] +SELECT * FROM t1; +sync_slave_with_master slave2; +--echo # [On slave2] +SELECT * FROM t1; + +connection master; +--echo # [On master] +DELETE FROM t1 WHERE c1=CURRENT_USER(); +SELECT * FROM t1; +sync_slave_with_master; +--echo # [On slave] +SELECT * FROM t1; +sync_slave_with_master slave2; +--echo # [On slave2] +SELECT * FROM t1; + +connection master; +--echo # [On master] +CREATE TABLE t2(c1 char(100)); + +DELIMITER |; +CREATE FUNCTION my_user() RETURNS VARCHAR(64) + SQL SECURITY INVOKER +BEGIN + INSERT INTO t2 VALUES(CURRENT_USER()); + RETURN CURRENT_USER(); +END | +DELIMITER ;| + +INSERT INTO t1 VALUES(my_user()); +SELECT * FROM t1; +SELECT * FROM t2; +sync_slave_with_master; +--echo # [On slave] +SELECT * FROM t1; +SELECT * FROM t2; +sync_slave_with_master slave2; +--echo # [On slave2] +SELECT * FROM t1; +SELECT * FROM t2; + +--echo +--echo # END +connection master; +DROP TABLE t1, t2; +DROP VIEW v_user, v_tables_priv, v_procs_priv, v_event; +DROP PROCEDURE p1; +DROP PROCEDURE my_grant; +DROP PROCEDURE my_revoke; +DROP FUNCTION my_user; +DROP EVENT e1; +sync_slave_with_master; +sync_slave_with_master slave2; +source include/master-slave-end.inc; diff --git a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test index ebb8bb6c718..f0231fa3470 100644 --- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test +++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test @@ -29,9 +29,11 @@ DROP TABLE IF EXISTS t1,t2,t3; connection master; CREATE TABLE t1(word VARCHAR(20)); CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY); +--let $position= query_get_value(SHOW MASTER STATUS, Position, 1) CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT); - - +--let $stop_position=query_get_value(SHOW MASTER STATUS, Position, 1) +--let $stop_position1=`select $stop_position - 1` +--let $binlog_start_pos=query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1) # Test Section # Lets start by putting some data into the tables. @@ -167,8 +169,7 @@ remove_file $MYSQLTEST_VARDIR/tmp/master.sql; select "--- Test 2 position test --" as ""; --enable_query_log let $MYSQLD_DATADIR= `select @@datadir;`; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --start-position=417 --stop-position=570 $MYSQLD_DATADIR/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --start-position=$position --stop-position=$stop_position $MYSQLD_DATADIR/master-bin.000001 # These are tests for remote binlog. # They should return the same as previous test. @@ -179,7 +180,7 @@ select "--- Test 3 First Remote test --" as ""; # This is broken now --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=569 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=$stop_position --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --disable_query_log select "--- Test 4 Second Remote test --" as ""; @@ -251,7 +252,7 @@ connection master; select "--- Test 5 LOAD DATA --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=106 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=$binlog_start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 # Bug#7853 (mysqlbinlog does not accept input from stdin) @@ -260,13 +261,13 @@ select "--- Test 6 reading stdin --" as ""; --enable_query_log let $MYSQLD_DATADIR= `select @@datadir;`; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL_BINLOG --short-form --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --stop-position=$stop_position1 - < $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- Test 7 reading stdin w/position --" as ""; --enable_query_log --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL_BINLOG --short-form --start-position=417 --stop-position=570 - < $MYSQLD_DATADIR/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --start-position=$position --stop-position=$stop_position - < $MYSQLD_DATADIR/master-bin.000001 # Bug#16217 (mysql client did not know how not switch its internal charset) --disable_query_log diff --git a/mysql-test/suite/rpl/t/rpl_stm_until.test b/mysql-test/suite/rpl/t/rpl_stm_until.test index 07d4ee37579..403069b6216 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_until.test +++ b/mysql-test/suite/rpl/t/rpl_stm_until.test @@ -203,11 +203,14 @@ flush logs; let $MYSQLD_DATADIR= `select @@datadir`; --remove_file $MYSQLD_DATADIR/master-bin.000001 --copy_file $MYSQL_TEST_DIR/std_data/bug47142_master-bin.000001 $MYSQLD_DATADIR/master-bin.000001 +# this a constant bound to the bug47142_master-bin.000001 binlog file +--let $binlog_before_drop=294; connection slave; stop slave; reset slave; -start slave until master_log_file='master-bin.000001', master_log_pos=294 /* to stop right before DROP */; +--replace_regex /master_log_pos=[0-9]+/master_log_pos=MASTER_LOG_POS/ +eval start slave until master_log_file='master-bin.000001', master_log_pos=$binlog_before_drop /* to stop right before DROP */; --source include/wait_for_slave_sql_to_stop.inc show tables /* t1 must exist */; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result index 66eeaa6357c..b17d30fa8e4 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result @@ -30,7 +30,7 @@ FROM mysql.ndb_binlog_index WHERE epoch = ; CHANGE MASTER TO master_port=, master_log_file = 'master-bin.000001', -master_log_pos = 107 ; +master_log_pos = BINLOG_START ; start slave; INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4); DELETE FROM t1 WHERE c3 = 1; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test index eb128cfa2ce..800362db67a 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test @@ -40,6 +40,7 @@ let $the_file= `SELECT @the_file` ; # now connect the slave to the _other_ "master" connection slave; --replace_result $MASTER_MYPORT1 +--replace_regex /master_log_pos = [0-9]+/master_log_pos = BINLOG_START/ eval CHANGE MASTER TO master_port=$MASTER_MYPORT1, master_log_file = '$the_file', diff --git a/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test b/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test index 7de63332844..636309a3088 100644 --- a/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test @@ -77,7 +77,6 @@ SELECT @@global.innodb_fast_shutdown; SET @@global.innodb_fast_shutdown = 1; SELECT @@global.innodb_fast_shutdown; ## A value of 2 is used to just flush logs and then shutdown cold. -## Not supported on Netware SET @@global.innodb_fast_shutdown = 2; SELECT @@global.innodb_fast_shutdown; diff --git a/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test b/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test index 0b9d3ada158..e616a807a38 100644 --- a/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test +++ b/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test @@ -120,7 +120,7 @@ SELECT @@global.ndb_log_update_as_write; #SELECT @@global.ndb_log_update_as_write; #SET @@global.ndb_log_update_as_write = 1; #SELECT @@global.ndb_log_update_as_write; -## a value of 2 is used to just flush logs and then shutdown cold. Not supported on Netware +## a value of 2 is used to just flush logs and then shutdown cold. #SET @@global.ndb_log_update_as_write = 2; #SELECT @@global.ndb_log_update_as_write; diff --git a/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test b/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test index 85b76cc88a4..c00ecf2e2fa 100644 --- a/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test +++ b/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test @@ -120,7 +120,7 @@ SELECT @@global.ndb_log_updated_only; #SELECT @@global.ndb_log_updated_only; #SET @@global.ndb_log_updated_only = 1; #SELECT @@global.ndb_log_updated_only; -## a value of 2 is used to just flush logs and then shutdown cold. Not supported on Netware +## a value of 2 is used to just flush logs and then shutdown cold. #SET @@global.ndb_log_updated_only = 2; #SELECT @@global.ndb_log_updated_only; diff --git a/mysql-test/t/error_simulation.test b/mysql-test/t/error_simulation.test index 7a48a2e3231..f6edacfaa29 100644 --- a/mysql-test/t/error_simulation.test +++ b/mysql-test/t/error_simulation.test @@ -45,7 +45,6 @@ SHOW CREATE TABLE t1; SELECT * FROM t1; DROP TABLE t1; - --echo # --echo # Bug#42064: low memory crash when importing hex strings, in Item_hex_string::Item_hex_string --echo # @@ -60,6 +59,36 @@ SET SESSION debug=DEFAULT; DROP TABLE t1; +-- echo # +-- echo # Bug#41660: Sort-index_merge for non-first join table may require +-- echo # O(#scans) memory +-- echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9); + +CREATE TABLE t2 (a INT, b INT, filler CHAR(100), KEY(a), KEY(b)); +INSERT INTO t2 SELECT 1000, 1000, 'filler' FROM t1 A, t1 B, t1 C; +INSERT INTO t2 VALUES (1, 1, 'data'); + +--echo # the example query uses LEFT JOIN only for the sake of being able to +--echo # demonstrate the issue with a very small dataset. (left outer join +--echo # disables the use of join buffering, so we get the second table +--echo # re-scanned for every record in the outer table. if we used inner join, +--echo # we would need to have thousands of records and/or more columns in both +--echo # tables so that the join buffer is filled and re-scans are triggered). + +SET SESSION debug = '+d,only_one_Unique_may_be_created'; + +--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x +EXPLAIN +SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 ); +SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 ); + +SET SESSION debug = DEFAULT; + +DROP TABLE t1, t2; + --echo # --echo # End of 5.1 tests --echo # diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index 61ae812d874..6efeb2866e6 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -539,6 +539,21 @@ EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, NULL); DROP TABLE t1; +--echo # +--echo # Bug#54477: Crash on IN / CASE with NULL arguments +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2); + +SELECT 1 IN (NULL, a) FROM t1; + +SELECT a IN (a, a) FROM t1 GROUP BY a WITH ROLLUP; + +SELECT CASE a WHEN a THEN a END FROM t1 GROUP BY a WITH ROLLUP; + +DROP TABLE t1; + --echo # --echo End of 5.1 tests diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test index 741ea5533da..1204d04d9a0 100644 --- a/mysql-test/t/func_like.test +++ b/mysql-test/t/func_like.test @@ -112,5 +112,19 @@ select 'andre%' like 'andre # select _cp1251'andre%' like convert('andreÊ%' using cp1251) escape 'Ê'; -# -# End of 4.1 tests + +--echo End of 4.1 tests + + +--echo # +--echo # Bug #54575: crash when joining tables with unique set column +--echo # +CREATE TABLE t1(a SET('a') NOT NULL, UNIQUE KEY(a)); +CREATE TABLE t2(b INT PRIMARY KEY); +INSERT INTO t1 VALUES (); +INSERT INTO t2 VALUES (1), (2), (3); +SELECT 1 FROM t2 JOIN t1 ON 1 LIKE a GROUP BY a; +DROP TABLE t1, t2; + + +--echo End of 5.1 tests diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test index 65bf9518a5c..c808e747523 100644 --- a/mysql-test/t/having.test +++ b/mysql-test/t/having.test @@ -544,3 +544,24 @@ ORDER BY t1.f2; DROP TABLE t1,t2; --echo End of 5.0 tests + +--echo # +--echo # Bug#54416 MAX from JOIN with HAVING returning NULL with 5.1 and Empty set +--echo # + +CREATE TABLE t1 (f1 INT(11), f2 VARCHAR(1), PRIMARY KEY (f1)); +INSERT INTO t1 VALUES (1,'f'); + +CREATE TABLE t2 (f1 INT(11), f2 VARCHAR(1)); +INSERT INTO t2 VALUES (2,'m'); +INSERT INTO t2 VALUES (3,'m'); +INSERT INTO t2 VALUES (11,NULL); +INSERT INTO t2 VALUES (12,'k'); + +SELECT MAX(t1.f1) field1 +FROM t1 JOIN t2 ON t2.f2 LIKE 'x' +HAVING field1 < 7; + +DROP TABLE t1,t2; + +--echo End of 5.1 tests diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 456cacf2fe1..87022d65fcc 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -1416,6 +1416,31 @@ DROP USER nonpriv; DROP TABLE db1.t1; DROP DATABASE db1; +--echo +--echo Bug#54422 query with = 'variables' +--echo + +CREATE TABLE variables(f1 INT); +SELECT COLUMN_DEFAULT, TABLE_NAME +FROM INFORMATION_SCHEMA.COLUMNS +WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = 'variables'; +DROP TABLE variables; + +--echo # +--echo # Bug #53814: NUMERIC_PRECISION for unsigned bigint field is 19, +--echo # should be 20 +--echo # + +CREATE TABLE ubig (a BIGINT, b BIGINT UNSIGNED); + +SELECT TABLE_NAME, COLUMN_NAME, NUMERIC_PRECISION + FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='ubig'; + +INSERT INTO ubig VALUES (0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFF); +SELECT length(CAST(b AS CHAR)) FROM ubig; + +DROP TABLE ubig; + --echo End of 5.1 tests. diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index 27c4cc8a75c..06054d1990d 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -570,4 +570,36 @@ DROP TABLE t1; connection default; disconnect con1; + +--echo # +--echo # Bug #51876 : crash/memory underrun when loading data with ucs2 +--echo # and reverse() function +--echo # + +--echo # Problem # 1 (original report): wrong parsing of ucs2 data +SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; +CREATE TABLE t1(a INT); +LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 +(@b) SET a=REVERSE(@b); +--echo # should return 2 zeroes (as the value is truncated) +SELECT * FROM t1; + +DROP TABLE t1; +let $MYSQLD_DATADIR= `select @@datadir`; +remove_file $MYSQLD_DATADIR/test/tmpp.txt; + + +--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost +SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; +CREATE TABLE t1(a INT); +LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 +(@b) SET a=REVERSE(@b); +--echo # should return 0 and 1 (10 reversed) +SELECT * FROM t1; + +DROP TABLE t1; +let $MYSQLD_DATADIR= `select @@datadir`; +remove_file $MYSQLD_DATADIR/test/tmpp2.txt; + + --echo End of 5.1 tests diff --git a/mysql-test/t/lowercase_view.test b/mysql-test/t/lowercase_view.test index d6612b3e6b9..52be911cde0 100644 --- a/mysql-test/t/lowercase_view.test +++ b/mysql-test/t/lowercase_view.test @@ -160,4 +160,26 @@ SELECT * FROM v1; DROP VIEW v1; DROP TABLE t1; + --echo End of 5.0 tests. + + +--echo # +--echo # Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS +--echo # returns nothing +--echo # + +CREATE TABLE `ttt` ( + `f1` char(3) NOT NULL, + PRIMARY KEY (`f1`) +) ENGINE=myisam DEFAULT CHARSET=latin1; + +SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = +'TTT'; +SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT'; + +DROP TABLE `ttt`; + + +--echo End of 5.0 tests. + diff --git a/mysql-test/t/mysql_delimiter_19799.sql b/mysql-test/t/mysql_delimiter_19799.sql old mode 100755 new mode 100644 diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test index 83d97954222..3ea612d2ca7 100644 --- a/mysql-test/t/mysql_upgrade.test +++ b/mysql-test/t/mysql_upgrade.test @@ -108,6 +108,23 @@ DROP PROCEDURE testproc; --cat_file $MYSQLTEST_VARDIR/tmp/41569.txt --remove_file $MYSQLTEST_VARDIR/tmp/41569.txt + +--echo # +--echo # Bug #53613: mysql_upgrade incorrectly revokes +--echo # TRIGGER privilege on given table +--echo # + +GRANT USAGE ON *.* TO 'user3'@'%'; +GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'; +--echo Run mysql_upgrade with all privileges on a user +--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1 +SHOW GRANTS FOR 'user3'@'%'; + +DROP USER 'user3'@'%'; + +--echo End of 5.1 tests + + # # Test the --upgrade-system-tables option # diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index 8b250dbb586..e375cb7299f 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -36,6 +36,7 @@ load data infile '../../std_data/words.dat' into table t1; load data infile '../../std_data/words.dat' into table t1; load data infile '../../std_data/words.dat' into table t1; # simple query to show more in second binlog +--let $binlog_start_pos=query_get_value(SHOW MASTER STATUS, Position, 1) insert into t1 values ("Alas"); flush logs; @@ -75,7 +76,7 @@ select "--- --start-position --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --start-position=1074 $MYSQLD_DATADIR/master-bin.000002 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --start-position=$binlog_start_pos $MYSQLD_DATADIR/master-bin.000002 # These are tests for remote binlog. # They should return the same as previous test. @@ -111,8 +112,7 @@ select "--- --start-position --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --start-position=1074 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 - +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --start-position=$binlog_start_pos --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 # Bug#7853 mysqlbinlog does not accept input from stdin --disable_query_log @@ -124,7 +124,9 @@ select "--- reading stdin --" as ""; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ ---exec $MYSQL_BINLOG --short-form --start-position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001 +# postion is constant to correspond to an event in pre-recorded binlog +--let $binlog_start_pos=79 +--exec $MYSQL_BINLOG --short-form --start-position=$binlog_start_pos - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001 drop table t1,t2; # diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test index 1f0da6bcf54..dcd92262a83 100644 --- a/mysql-test/t/mysqlbinlog2.test +++ b/mysql-test/t/mysqlbinlog2.test @@ -21,7 +21,9 @@ create table t1 (a int auto_increment not null primary key, b char(3)); insert into t1 values(null, "a"); insert into t1 values(null, "b"); set timestamp=@a+2; +--let $binlog_pos_760=query_get_value(SHOW MASTER STATUS, Position, 1) insert into t1 values(null, "c"); +--let $binlog_pos_951=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000001' from $binlog_pos_760, Pos, 4) set timestamp=@a+4; insert into t1 values(null, "d"); insert into t1 values(null, "e"); @@ -29,6 +31,8 @@ insert into t1 values(null, "e"); flush logs; set timestamp=@a+1; # this could happen on a slave insert into t1 values(null, "f"); +--let $binlog_pos_135=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000002', Pos, 3) +--let $binlog_pos_203=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000002', Pos, 4) # delimiters are for easier debugging in future @@ -50,15 +54,15 @@ select "--- offset --" as ""; --disable_query_log select "--- start-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=760 $MYSQLD_DATADIR/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- stop-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --stop-position=760 $MYSQLD_DATADIR/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --stop-position=$binlog_pos_760 $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- start and stop positions ---" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=760 --stop-position 951 $MYSQLD_DATADIR/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 --stop-position=$binlog_pos_951 $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log @@ -84,11 +88,11 @@ select "--- offset --" as ""; --disable_query_log select "--- start-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=760 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 +--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 --disable_query_log select "--- stop-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --stop-position=203 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 +--exec $MYSQL_BINLOG --short-form --stop-position=$binlog_pos_203 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log @@ -111,15 +115,15 @@ select "--- offset --" as ""; --disable_query_log select "--- start-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 +--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --disable_query_log select "--- stop-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --stop-position=760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 +--exec $MYSQL_BINLOG --short-form --stop-position=$binlog_pos_760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --disable_query_log select "--- start and stop positions ---" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=760 --stop-position 951 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 +--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 --stop-position=$binlog_pos_951 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log @@ -142,11 +146,11 @@ select "--- offset --" as ""; --disable_query_log select "--- start-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 +--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 --disable_query_log select "--- stop-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --stop-position=135 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 +--exec $MYSQL_BINLOG --short-form --stop-position=$binlog_pos_135 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log diff --git a/mysql-test/t/rpl_mysqldump_slave.test b/mysql-test/t/rpl_mysqldump_slave.test index 5723f1282aa..8f27646ba08 100644 --- a/mysql-test/t/rpl_mysqldump_slave.test +++ b/mysql-test/t/rpl_mysqldump_slave.test @@ -15,11 +15,14 @@ use test; connection slave; # Execute mysqldump with --dump-slave +--replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/ --exec $MYSQL_DUMP_SLAVE --compact --dump-slave test # Execute mysqldump with --dump-slave and --apply-slave-statements +--replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/ --exec $MYSQL_DUMP_SLAVE --compact --dump-slave --apply-slave-statements test +--replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/ --replace_result $MASTER_MYPORT MASTER_MYPORT # Execute mysqldump with --dump-slave ,--apply-slave-statements and --include-master-host-port --exec $MYSQL_DUMP_SLAVE --compact --dump-slave --apply-slave-statements --include-master-host-port test diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 6f2d34459eb..495b6002986 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -4117,6 +4117,17 @@ SELECT * FROM t1 WHERE 102 < c; DROP TABLE t1; +--echo # +--echo # Bug #54459: Assertion failed: param.sort_length, +--echo # file .\filesort.cc, line 149 (part II) +--echo # +CREATE TABLE t1(a ENUM('') NOT NULL); +INSERT INTO t1 VALUES (), (), (); +EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; +SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; +DROP TABLE t1; + + --echo End of 5.1 tests --echo # diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 06aaf5dfb7f..2e442e7f897 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -3921,3 +3921,28 @@ GROUP BY DROP TABLE t3; DROP TABLE t2; DROP TABLE t1; + + +--echo # +--echo # Bug #52711: Segfault when doing EXPLAIN SELECT with +--echo # union...order by (select... where...) +--echo # + +CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a)); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (1),(2); + +--echo # Should not crash +--disable_result_log +EXPLAIN +SELECT * FROM t2 UNION SELECT * FROM t2 + ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE)); + +--echo # Should not crash +SELECT * FROM t2 UNION SELECT * FROM t2 + ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE)); +DROP TABLE t1,t2; +--enable_result_log + +--echo End of 5.1 tests diff --git a/mysql-test/t/windows.test b/mysql-test/t/windows.test old mode 100755 new mode 100644 diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/mysys/Makefile.am b/mysys/Makefile.am index f4fab89d5a5..a9e3f16c548 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -51,7 +51,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \ my_net.c my_port.c my_sleep.c \ charset.c charset-def.c my_bitmap.c my_bit.c md5.c \ my_gethostbyname.c rijndael.c my_aes.c sha1.c \ - my_handler.c my_netware.c my_largepage.c \ + my_handler.c my_largepage.c \ my_memmem.c stacktrace.c \ my_windac.c my_access.c base64.c my_libwrap.c \ my_rdtsc.c diff --git a/mysys/default.c b/mysys/default.c index fc119bb3283..8002a1a0307 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -118,7 +118,6 @@ static int search_default_file_with_ext(Process_option_func func, - Windows: GetWindowsDirectory() - Windows: C:/ - Windows: Directory above where the executable is located - - Netware: sys:/etc/ - Unix: /etc/ - Unix: /etc/mysql/ - Unix: --sysconfdir= (compile-time option) @@ -708,7 +707,7 @@ static int search_default_file_with_ext(Process_option_func opt_handler, strmov(name,config_file); } fn_format(name,name,"","",4); -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) { MY_STAT stat_info; if (!my_stat(name,&stat_info,MYF(0))) @@ -954,7 +953,6 @@ static char *remove_end_comment(char *ptr) return ptr; } -#include void my_print_default_files(const char *conf_file) { @@ -1034,8 +1032,6 @@ void print_defaults(const char *conf_file, const char **groups) --defaults-extra-file=# Read this file after the global files are read."); } -#include - static int add_directory(MEM_ROOT *alloc, const char *dir, const char **dirs) { @@ -1150,10 +1146,6 @@ static const char **init_default_directories(MEM_ROOT *alloc) errors += add_directory(alloc, fname_buffer, dirs); } -#elif defined(__NETWARE__) - - errors += add_directory(alloc, "sys:/etc/", dirs); - #else errors += add_directory(alloc, "/etc/", dirs); @@ -1172,7 +1164,7 @@ static const char **init_default_directories(MEM_ROOT *alloc) /* Placeholder for --defaults-extra-file= */ errors += add_directory(alloc, "", dirs); -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) errors += add_directory(alloc, "~/", dirs); #endif diff --git a/mysys/errors.c b/mysys/errors.c index 37d33374fe1..9342ab2d2dd 100644 --- a/mysys/errors.c +++ b/mysys/errors.c @@ -18,7 +18,7 @@ #ifndef SHARED_LIBRARY -const char * NEAR globerrs[GLOBERRS]= +const char *globerrs[GLOBERRS]= { "Can't create/write to file '%s' (Errcode: %d)", "Error reading file '%s' (Errcode: %d)", diff --git a/mysys/mf_dirname.c b/mysys/mf_dirname.c index 1b428ded751..5a9440483e4 100644 --- a/mysys/mf_dirname.c +++ b/mysys/mf_dirname.c @@ -40,11 +40,7 @@ size_t dirname_length(const char *name) continue; } #endif - if (*pos == FN_LIBCHAR || *pos == '/' -#ifdef FN_C_AFTER_DIR - || *pos == FN_C_AFTER_DIR || *pos == FN_C_AFTER_DIR_2 -#endif - ) + if (*pos == FN_LIBCHAR || *pos == '/') gpos=pos; } return (size_t) (gpos+1-(char*) name); @@ -88,8 +84,7 @@ size_t dirname_part(char *to, const char *name, size_t *to_res_length) from_end Pointer at end of filename (normally end \0) IMPLEMENTATION - If MSDOS converts '/' to '\' - If VMS converts '<' to '[' and '>' to ']' + If Windows converts '/' to '\' Adds a FN_LIBCHAR to end if the result string if there isn't one and the last isn't dev_char. Copies data from 'from' until ASCII(0) for until from == from_end @@ -118,18 +113,12 @@ char *convert_dirname(char *to, const char *from, const char *from_end) if (!from_end || (from_end - from) > FN_REFLEN-2) from_end=from+FN_REFLEN -2; -#if FN_LIBCHAR != '/' || defined(FN_C_BEFORE_DIR_2) +#if FN_LIBCHAR != '/' { for (; from != from_end && *from ; from++) { if (*from == '/') *to++= FN_LIBCHAR; -#ifdef FN_C_BEFORE_DIR_2 - else if (*from == FN_C_BEFORE_DIR_2) - *to++= FN_C_BEFORE_DIR; - else if (*from == FN_C_AFTER_DIR_2) - *to++= FN_C_AFTER_DIR; -#endif else { #ifdef BACKSLASH_MBTAIL diff --git a/mysys/mf_fn_ext.c b/mysys/mf_fn_ext.c index da7fac3de73..c872f2993c4 100644 --- a/mysys/mf_fn_ext.c +++ b/mysys/mf_fn_ext.c @@ -39,7 +39,7 @@ char *fn_ext(const char *name) DBUG_ENTER("fn_ext"); DBUG_PRINT("mfunkt",("name: '%s'",name)); -#if defined(FN_DEVCHAR) || defined(FN_C_AFTER_DIR) || defined(BASKSLASH_MBTAIL) +#if defined(FN_DEVCHAR) || defined(BASKSLASH_MBTAIL) { char buff[FN_REFLEN]; size_t res_length; diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index 5d0808933e3..c42c3d469e6 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -252,7 +252,7 @@ static void test_key_cache(KEY_CACHE *keycache, #if defined(KEYCACHE_DEBUG_LOG) static FILE *keycache_debug_log=NULL; -static void keycache_debug_print _VARARGS((const char *fmt,...)); +static void keycache_debug_print(const char *fmt,...); #define KEYCACHE_DEBUG_OPEN \ if (!keycache_debug_log) \ { \ diff --git a/mysys/mf_loadpath.c b/mysys/mf_loadpath.c index 07851ab6e92..9350babc176 100644 --- a/mysys/mf_loadpath.c +++ b/mysys/mf_loadpath.c @@ -42,7 +42,7 @@ char * my_load_path(char * to, const char *path, if (is_cur) is_cur=2; /* Remove current dir */ if (! my_getwd(buff,(uint) (FN_REFLEN-strlen(path)+is_cur),MYF(0))) - (void) strncat(buff, path+is_cur, FN_REFLEN); + (void) strncat(buff, path+is_cur, FN_REFLEN-1); else (void) strnmov(buff, path, FN_REFLEN); /* Return org file name */ } diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c index 4f7cd90e8aa..c6e6a3a429e 100644 --- a/mysys/mf_pack.c +++ b/mysys/mf_pack.c @@ -18,13 +18,8 @@ #ifdef HAVE_PWD_H #include #endif -#ifdef VMS -#include -#include -#include -#endif /* VMS */ -static char * NEAR_F expand_tilde(char * *path); +static char * expand_tilde(char **path); /* Pack a dirname ; Changes HOME to ~/ and current dev to ./ */ /* from is a dirname (from dirname() ?) ending with FN_LIBCHAR */ @@ -52,7 +47,7 @@ void pack_dirname(char * to, const char *from) buff_length= strlen(buff); d_length= (size_t) (start-to); if ((start == to || - (buff_length == d_length && !bcmp(buff,start,d_length))) && + (buff_length == d_length && !memcmp(buff,start,d_length))) && *start != FN_LIBCHAR && *start) { /* Put current dir before */ bchange((uchar*) to, d_length, (uchar*) buff, buff_length, strlen(to)+1); @@ -70,7 +65,7 @@ void pack_dirname(char * to, const char *from) } if (length > 1 && length < d_length) { /* test if /xx/yy -> ~/yy */ - if (bcmp(to,home_dir,length) == 0 && to[length] == FN_LIBCHAR) + if (memcmp(to,home_dir,length) == 0 && to[length] == FN_LIBCHAR) { to[0]=FN_HOMELIB; /* Filename begins with ~ */ (void) strmov_overlapp(to+1,to+length); @@ -80,7 +75,7 @@ void pack_dirname(char * to, const char *from) { /* Test if cwd is ~/... */ if (length > 1 && length < buff_length) { - if (bcmp(buff,home_dir,length) == 0 && buff[length] == FN_LIBCHAR) + if (memcmp(buff,home_dir,length) == 0 && buff[length] == FN_LIBCHAR) { buff[0]=FN_HOMELIB; (void) strmov_overlapp(buff+1,buff+length); @@ -166,7 +161,7 @@ size_t cleanup_dirname(register char *to, const char *from) *pos = FN_LIBCHAR; if (*pos == FN_LIBCHAR) { - if ((size_t) (pos-start) > length && bcmp(pos-length,parent,length) == 0) + if ((size_t) (pos-start) > length && memcmp(pos-length,parent,length) == 0) { /* If .../../; skip prev */ pos-=length; if (pos != start) @@ -197,7 +192,7 @@ size_t cleanup_dirname(register char *to, const char *from) end_parentdir=pos; while (pos >= start && *pos != FN_LIBCHAR) /* remove prev dir */ pos--; - if (pos[1] == FN_HOMELIB || bcmp(pos,parent,length) == 0) + if (pos[1] == FN_HOMELIB || memcmp(pos,parent,length) == 0) { /* Don't remove ~user/ */ pos=strmov(end_parentdir+1,parent); *pos=FN_LIBCHAR; @@ -206,7 +201,7 @@ size_t cleanup_dirname(register char *to, const char *from) } } else if ((size_t) (pos-start) == length-1 && - !bcmp(start,parent+1,length-1)) + !memcmp(start,parent+1,length-1)) start=pos; /* Starts with "../" */ else if (pos-start > 0 && pos[-1] == FN_LIBCHAR) { @@ -300,8 +295,7 @@ size_t normalize_dirname(char *to, const char *from) /* Despite the name, this actually converts the name to the system's - format (TODO: rip out the non-working VMS stuff and name this - properly). + format (TODO: name this properly). */ (void) intern_filename(buff, from); length= strlen(buff); /* Fix that '/' is last */ @@ -377,7 +371,7 @@ size_t unpack_dirname(char * to, const char *from) /* Expand tilde to home or user-directory */ /* Path is reset to point at FN_LIBCHAR after ~xxx */ -static char * NEAR_F expand_tilde(char * *path) +static char * expand_tilde(char **path) { if (path[0][0] == FN_LIBCHAR) return home_dir; /* ~/ expanded to home */ @@ -443,73 +437,10 @@ size_t unpack_filename(char * to, const char *from) /* Used before system command's like open(), create() .. */ /* Returns used length of to; total length should be FN_REFLEN */ -size_t system_filename(char * to, const char *from) +size_t system_filename(char *to, const char *from) { -#ifndef FN_C_BEFORE_DIR return (size_t) (strmake(to,from,FN_REFLEN-1)-to); -#else /* VMS */ - - /* change 'dev:lib/xxx' to 'dev:[lib]xxx' */ - /* change 'dev:xxx' to 'dev:xxx' */ - /* change './xxx' to 'xxx' */ - /* change './lib/' or lib/ to '[.lib]' */ - /* change '/x/y/z to '[x.y]x' */ - /* change 'dev:/x' to 'dev:[000000]x' */ - - int libchar_found; - size_t length; - char * to_pos,from_pos,pos; - char buff[FN_REFLEN]; - DBUG_ENTER("system_filename"); - - libchar_found=0; - (void) strmov(buff,from); /* If to == from */ - from_pos= buff; - if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skip device part */ - { - pos++; - to_pos=strnmov(to,from_pos,(size_t) (pos-from_pos)); - from_pos=pos; - } - else - to_pos=to; - - if (from_pos[0] == FN_CURLIB && from_pos[1] == FN_LIBCHAR) - from_pos+=2; /* Skip './' */ - if (strchr(from_pos,FN_LIBCHAR)) - { - *(to_pos++) = FN_C_BEFORE_DIR; - if (strinstr(from_pos,FN_ROOTDIR) == 1) - { - from_pos+=strlen(FN_ROOTDIR); /* Actually +1 but... */ - if (! strchr(from_pos,FN_LIBCHAR)) - { /* No dir, use [000000] */ - to_pos=strmov(to_pos,FN_C_ROOT_DIR); - libchar_found++; - } - } - else - *(to_pos++)=FN_C_DIR_SEP; /* '.' gives current dir */ - - while ((pos=strchr(from_pos,FN_LIBCHAR))) - { - if (libchar_found++) - *(to_pos++)=FN_C_DIR_SEP; /* Add '.' between dirs */ - if (strinstr(from_pos,FN_PARENTDIR) == 1 && - from_pos+strlen(FN_PARENTDIR) == pos) - to_pos=strmov(to_pos,FN_C_PARENT_DIR); /* Found '../' */ - else - to_pos=strnmov(to_pos,from_pos,(size_t) (pos-from_pos)); - from_pos=pos+1; - } - *(to_pos++)=FN_C_AFTER_DIR; - } - length= (size_t) (strmov(to_pos,from_pos)-to); - DBUG_PRINT("exit",("name: '%s'",to)); - DBUG_RETURN(length); -#endif -} /* system_filename */ - +} /* Fix a filename to intern (UNIX format) */ diff --git a/mysys/mf_path.c b/mysys/mf_path.c index d51cac732f5..92cb62e6827 100644 --- a/mysys/mf_path.c +++ b/mysys/mf_path.c @@ -78,9 +78,6 @@ char * my_path(char * to, const char *progname, #define F_OK 0 #define PATH_SEP ';' #define PROGRAM_EXTENSION ".exe" -#elif defined(__NETWARE__) -#define PATH_SEP ';' -#define PROGRAM_EXTENSION ".nlm" #else #define PATH_SEP ':' #endif diff --git a/mysys/mf_tempdir.c b/mysys/mf_tempdir.c index 1c6c01cef9f..c84987cfc96 100644 --- a/mysys/mf_tempdir.c +++ b/mysys/mf_tempdir.c @@ -16,7 +16,7 @@ #include "mysys_priv.h" #include -#if defined( __WIN__) || defined(__NETWARE__) +#if defined(__WIN__) #define DELIM ';' #else #define DELIM ':' @@ -36,7 +36,7 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist) { /* Get default temporary directory */ pathlist=getenv("TMPDIR"); /* Use this if possible */ -#if defined( __WIN__) || defined(__NETWARE__) +#if defined(__WIN__) if (!pathlist) pathlist=getenv("TEMP"); if (!pathlist) diff --git a/mysys/mf_tempfile.c b/mysys/mf_tempfile.c index 40016210de4..e85124fb4c3 100644 --- a/mysys/mf_tempfile.c +++ b/mysys/mf_tempfile.c @@ -100,16 +100,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix, my_errno= tmp; } -#elif defined(_ZTC__) - if (!dir) - dir=getenv("TMPDIR"); - if ((res=tempnam((char*) dir,(char *) prefix))) - { - strmake(to,res,FN_REFLEN-1); - (*free)(res); - file=my_create(to, 0, mode | O_EXCL | O_NOFOLLOW, MyFlags); - } -#elif defined(HAVE_MKSTEMP) && !defined(__NETWARE__) +#elif defined(HAVE_MKSTEMP) { char prefix_buff[30]; uint pfx_len; @@ -143,9 +134,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix, } #elif defined(HAVE_TEMPNAM) { -#if !defined(__NETWARE__) extern char **environ; -#endif char *res,**old_env,*temp_env[1]; if (dir && !dir[0]) @@ -154,14 +143,14 @@ File create_temp_file(char *to, const char *dir, const char *prefix, to[1]= 0; dir=to; } -#if !defined(__NETWARE__) + old_env= (char**) environ; if (dir) { /* Don't use TMPDIR if dir is given */ environ=(const char**) temp_env; temp_env[0]=0; } -#endif + if ((res=tempnam((char*) dir, (char*) prefix))) { strmake(to,res,FN_REFLEN-1); @@ -176,9 +165,8 @@ File create_temp_file(char *to, const char *dir, const char *prefix, { DBUG_PRINT("error",("Got error: %d from tempnam",errno)); } -#if !defined(__NETWARE__) + environ=(const char**) old_env; -#endif } #else #error No implementation found for create_temp_file diff --git a/mysys/mf_unixpath.c b/mysys/mf_unixpath.c index 75f8de14879..ee81aae4584 100644 --- a/mysys/mf_unixpath.c +++ b/mysys/mf_unixpath.c @@ -16,10 +16,15 @@ #include "mysys_priv.h" #include - /* convert filename to unix style filename */ - /* If MSDOS converts '\' to '/' */ +/** + Convert filename to unix style filename. -void to_unix_path(char * to __attribute__((unused))) + @remark On Windows, converts '\' to '/'. + + @param to A pathname. +*/ + +void to_unix_path(char *to __attribute__((unused))) { #if FN_LIBCHAR != '/' { diff --git a/mysys/mf_util.c b/mysys/mf_util.c deleted file mode 100644 index 248b72b8748..00000000000 --- a/mysys/mf_util.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (C) 2000 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* Utilities with are missing on some systems */ - -#include "mysys_priv.h" -#ifdef __ZTC__ -#include -#endif - -#ifdef __ZTC__ - - /* On ZORTECH C we don't have a getpid() call */ - -int getpid(void) -{ - return (int) _psp; -} - -#ifndef M_IC80386 - - /* Define halloc and hfree in as in MSC */ - -void * __CDECL halloc(long count,size_t length) -{ - return (void*) MK_FP(dos_alloc((uint) ((count*length+15) >> 4)),0); -} - -void __CDECL hfree(void *ptr) -{ - dos_free(FP_SEG(ptr)); -} - -#endif /* M_IC80386 */ -#endif /* __ZTC__ */ diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c index 25d2f3fda30..3de05fa8664 100644 --- a/mysys/my_bitmap.c +++ b/mysys/my_bitmap.c @@ -508,10 +508,8 @@ uint bitmap_get_first_set(const MY_BITMAP *map) if (*byte_ptr & (1 << k)) return (i*32) + (j*8) + k; } - DBUG_ASSERT(0); } } - DBUG_ASSERT(0); } } return MY_BIT_NONE; @@ -534,7 +532,7 @@ uint bitmap_get_first(const MY_BITMAP *map) { byte_ptr= (uchar*)data_ptr; for (j=0; ; j++, byte_ptr++) - { + { if (*byte_ptr != 0xFF) { for (k=0; ; k++) @@ -542,10 +540,8 @@ uint bitmap_get_first(const MY_BITMAP *map) if (!(*byte_ptr & (1 << k))) return (i*32) + (j*8) + k; } - DBUG_ASSERT(0); } } - DBUG_ASSERT(0); } } return MY_BIT_NONE; diff --git a/mysys/my_clock.c b/mysys/my_clock.c index d17f26ed316..da04feb462f 100644 --- a/mysys/my_clock.c +++ b/mysys/my_clock.c @@ -15,14 +15,14 @@ #include "my_global.h" -#if !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__NETWARE__) +#if !defined(_MSC_VER) && !defined(__BORLANDC__) #include "mysys_priv.h" #include #endif long my_clock(void) { -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) struct tms tmsbuf; (void) times(&tmsbuf); return (tmsbuf.tms_utime + tmsbuf.tms_stime); diff --git a/mysys/my_copy.c b/mysys/my_copy.c index d38507c111a..878aebd3684 100644 --- a/mysys/my_copy.c +++ b/mysys/my_copy.c @@ -103,10 +103,10 @@ int my_copy(const char *from, const char *to, myf MyFlags) if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat) DBUG_RETURN(0); /* File copyed but not stat */ res= chmod(to, stat_buff.st_mode & 07777); /* Copy modes */ -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) res= chown(to, stat_buff.st_uid,stat_buff.st_gid); /* Copy ownership */ #endif -#if !defined(VMS) && !defined(__ZTC__) + if (MyFlags & MY_COPYTIME) { struct utimbuf timep; @@ -114,7 +114,7 @@ int my_copy(const char *from, const char *to, myf MyFlags) timep.modtime = stat_buff.st_mtime; (void) utime((char*) to, &timep); /* last accessed and modified times */ } -#endif + DBUG_RETURN(0); } diff --git a/mysys/my_gethwaddr.c b/mysys/my_gethwaddr.c index 87e6519cafe..9ca22f2201e 100644 --- a/mysys/my_gethwaddr.c +++ b/mysys/my_gethwaddr.c @@ -47,7 +47,7 @@ my_bool my_gethwaddr(uchar *to) uchar *buf, *next, *end, *addr; struct if_msghdr *ifm; struct sockaddr_dl *sdl; - int i, res=1, mib[6]={CTL_NET, AF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0}; + int res=1, mib[6]={CTL_NET, AF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0}; if (sysctl(mib, 6, NULL, &len, NULL, 0) == -1) goto err; diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index f51dd7befd5..e4b199dab84 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -28,7 +28,7 @@ typedef void (*init_func_p)(const struct my_option *option, void *variable, static void default_reporter(enum loglevel level, const char *format, ...); my_error_reporter my_getopt_error_reporter= &default_reporter; -static int findopt(char *, uint, const struct my_option **, char **); +static int findopt(char *, uint, const struct my_option **, const char **); my_bool getopt_compare_strings(const char *, const char *, uint); static longlong getopt_ll(char *arg, const struct my_option *optp, int *err); static ulonglong getopt_ull(char *, const struct my_option *, int *); @@ -113,8 +113,8 @@ int handle_options(int *argc, char ***argv, uint opt_found, argvpos= 0, length; my_bool end_of_options= 0, must_be_var, set_maximum_value, option_is_loose; - char **pos, **pos_end, *optend, *UNINIT_VAR(prev_found), - *opt_str, key_name[FN_REFLEN]; + char **pos, **pos_end, *optend, *opt_str, key_name[FN_REFLEN]; + const char *UNINIT_VAR(prev_found); const struct my_option *optp; void *value; int error, i; @@ -185,7 +185,6 @@ int handle_options(int *argc, char ***argv, Find first the right option. Return error in case of an ambiguous, or unknown option */ - LINT_INIT(prev_found); optp= longopts; if (!(opt_found= findopt(opt_str, length, &optp, &prev_found))) { @@ -695,10 +694,10 @@ ret: static int findopt(char *optpat, uint length, const struct my_option **opt_res, - char **ffname) + const char **ffname) { uint count; - struct my_option *opt= (struct my_option *) *opt_res; + const struct my_option *opt= *opt_res; for (count= 0; opt->name; opt++) { @@ -709,8 +708,9 @@ static int findopt(char *optpat, uint length, return 1; if (!count) { + /* We only need to know one prev */ count= 1; - *ffname= (char *) opt->name; /* We only need to know one prev */ + *ffname= opt->name; } else if (strcmp(*ffname, opt->name)) { @@ -1032,7 +1032,7 @@ static void init_one_value(const struct my_option *option, void *variable, *((ulonglong*) variable)= (ulonglong) value; break; case GET_DOUBLE: - *((double*) variable)= (double) value; + *((double*) variable)= ulonglong2double(value); break; case GET_STR: /* @@ -1147,8 +1147,6 @@ static uint print_name(const struct my_option *optp) Print help for all options and variables. */ -#include - void my_print_help(const struct my_option *options) { uint col, name_space= 22, comment_space= 57; @@ -1330,5 +1328,3 @@ void my_print_variables(const struct my_option *options) } } } - -#include diff --git a/mysys/my_getsystime.c b/mysys/my_getsystime.c index ea12f73fe3d..cc5d1b83efb 100644 --- a/mysys/my_getsystime.c +++ b/mysys/my_getsystime.c @@ -25,10 +25,6 @@ #include "mysys_priv.h" #include "my_static.h" -#ifdef __NETWARE__ -#include -#endif - ulonglong my_getsystime() { #ifdef HAVE_CLOCK_GETTIME @@ -45,10 +41,6 @@ ulonglong my_getsystime() query_performance_frequency) + query_performance_offset); } return 0; -#elif defined(__NETWARE__) - NXTime_t tm; - NXGetTime(NX_SINCE_1970, NX_NSECONDS, &tm); - return (ulonglong)tm/100; #else /* TODO: check for other possibilities for hi-res timestamping */ struct timeval tv; diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c index 4182ea9826f..ace14c8a3c9 100644 --- a/mysys/my_getwd.c +++ b/mysys/my_getwd.c @@ -72,16 +72,6 @@ int my_getwd(char * buf, size_t size, myf MyFlags) getwd(pathname); strmake(buf,pathname,size-1); } -#elif defined(VMS) - if (size < 2) - DBUG_RETURN(-1); - if (!getcwd(buf,size-2,1) && MyFlags & MY_WME) - { - my_errno=errno; - my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno); - DBUG_RETURN(-1); - } - intern_filename(buf,buf); #else #error "No way to get current directory" #endif @@ -103,27 +93,12 @@ int my_setwd(const char *dir, myf MyFlags) int res; size_t length; char *start, *pos; -#if defined(VMS) - char buff[FN_REFLEN]; -#endif DBUG_ENTER("my_setwd"); DBUG_PRINT("my",("dir: '%s' MyFlags %d", dir, MyFlags)); start=(char *) dir; if (! dir[0] || (dir[0] == FN_LIBCHAR && dir[1] == 0)) dir=FN_ROOTDIR; -#ifdef VMS - { - pos=strmov(buff,dir); - if (pos[-1] != FN_LIBCHAR) - { - pos[0]=FN_LIBCHAR; /* Mark as directory */ - pos[1]=0; - } - system_filename(buff,buff); /* Change to VMS format */ - dir=buff; - } -#endif /* VMS */ if ((res=chdir((char*) dir)) != 0) { my_errno=errno; diff --git a/mysys/my_handler.c b/mysys/my_handler.c index 3f8af553db6..48d100f2d3f 100644 --- a/mysys/my_handler.c +++ b/mysys/my_handler.c @@ -269,7 +269,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a+=a_length; b+=b_length; - break; } break; case HA_KEYTYPE_INT8: diff --git a/mysys/my_init.c b/mysys/my_init.c index 41a2efe0b90..dbf1bfe761c 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -19,10 +19,6 @@ #include #include #include -#ifdef VMS -#include -#include -#endif #ifdef __WIN__ #ifdef _MSC_VER #include @@ -36,11 +32,6 @@ static my_bool win32_init_tcp_ip(); #else #define my_win_init() #endif -#ifdef __NETWARE__ -static void netware_init(); -#else -#define netware_init() -#endif my_bool my_init_done= 0; /** True if @c my_basic_init() has been called. */ @@ -84,14 +75,12 @@ my_bool my_basic_init(void) my_umask= 0660; /* Default umask for new files */ my_umask_dir= 0700; /* Default umask for new directories */ -#ifndef VMS /* Default creation of new files */ if ((str= getenv("UMASK")) != 0) my_umask= (int) (atoi_octal(str) | 0600); /* Default creation of new dir's */ if ((str= getenv("UMASK_DIR")) != 0) my_umask_dir= (int) (atoi_octal(str) | 0700); -#endif init_glob_errs(); @@ -109,7 +98,6 @@ my_bool my_basic_init(void) #if defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) fastmutex_global_init(); /* Must be called early */ #endif - netware_init(); #ifdef THREAD #if defined(HAVE_PTHREAD_INIT) pthread_init(); /* Must be called before DBUG_ENTER */ @@ -150,7 +138,7 @@ my_bool my_init(void) #ifdef THREAD if (my_thread_global_init()) return 1; -#if !defined( __WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) sigfillset(&my_signals); /* signals blocked by mf_brkhant */ #endif #endif /* THREAD */ @@ -158,9 +146,6 @@ my_bool my_init(void) DBUG_ENTER("my_init"); DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown")); my_win_init(); -#ifdef VMS - init_ctype(); /* Stupid linker don't link _ctype.c */ -#endif DBUG_PRINT("exit", ("home: '%s'", home_dir)); #ifdef __WIN__ win32_init_tcp_ip(); @@ -239,9 +224,6 @@ Voluntary context switches %ld, Involuntary context switches %ld\n", rus.ru_msgsnd, rus.ru_msgrcv, rus.ru_nsignals, rus.ru_nvcsw, rus.ru_nivcsw); #endif -#if defined(__NETWARE__) && !defined(__WIN__) - fprintf(info_file,"\nRun time: %.1f\n",(double) clock()/CLOCKS_PER_SEC); -#endif #if defined(__WIN__) && defined(_MSC_VER) _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE ); _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDERR ); @@ -524,60 +506,6 @@ static my_bool win32_init_tcp_ip() } #endif /* __WIN__ */ - -#ifdef __NETWARE__ -/* - Basic initialisation for netware -*/ - -static void netware_init() -{ - char cwd[PATH_MAX], *name; - - DBUG_ENTER("netware_init"); - - /* init only if we are not a client library */ - if (my_progname) - { -#if SUPPORTED_BY_LIBC /* Removed until supported in Libc */ - struct termios tp; - /* Disable control characters */ - tcgetattr(STDIN_FILENO, &tp); - tp.c_cc[VINTR] = _POSIX_VDISABLE; - tp.c_cc[VEOF] = _POSIX_VDISABLE; - tp.c_cc[VSUSP] = _POSIX_VDISABLE; - tcsetattr(STDIN_FILENO, TCSANOW, &tp); -#endif /* SUPPORTED_BY_LIBC */ - - /* With stdout redirection */ - if (!isatty(STDOUT_FILENO)) - { - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); /* auto close the screen */ - } - else - { - setscreenmode(SCR_NO_MODE); /* keep the screen up */ - } - - /* Parse program name and change to base format */ - name= (char*) my_progname; - for (; *name; name++) - { - if (*name == '\\') - { - *name = '/'; - } - else - { - *name = tolower(*name); - } - } - } - - DBUG_VOID_RETURN; -} -#endif /* __NETWARE__ */ - #ifdef HAVE_PSI_INTERFACE #if !defined(HAVE_PREAD) && !defined(_WIN32) diff --git a/mysys/my_lib.c b/mysys/my_lib.c index e70a70d47ed..890ff0b5dd1 100644 --- a/mysys/my_lib.c +++ b/mysys/my_lib.c @@ -14,7 +14,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* TODO: check for overun of memory for names. */ -/* Convert MSDOS-TIME to standar time_t (still needed?) */ #include "mysys_priv.h" #include @@ -41,11 +40,6 @@ # endif # endif #endif -#ifdef VMS -#include -#include -#include -#endif #if defined(THREAD) && defined(HAVE_READDIR_R) #define READDIR(A,B,C) ((errno=readdir_r(A,B,&C)) != 0 || !C) @@ -199,9 +193,6 @@ MY_DIR *my_dir(const char *path, myf MyFlags) /* * Convert from directory name to filename. - * On VMS: - * xyzzy:[mukesh.emacs] => xyzzy:[mukesh]emacs.dir.1 - * xyzzy:[mukesh] => xyzzy:[000000]mukesh.dir.1 * On UNIX, it's simple: just make sure there is a terminating / * Returns pointer to dst; @@ -209,11 +200,8 @@ MY_DIR *my_dir(const char *path, myf MyFlags) char * directory_file_name (char * dst, const char *src) { -#ifndef VMS - /* Process as Unix format: just remove test the final slash. */ - - char * end; + char *end; if (src[0] == 0) src= (char*) "."; /* Use empty as current */ @@ -224,125 +212,7 @@ char * directory_file_name (char * dst, const char *src) end[1]='\0'; } return dst; - -#else /* VMS */ - - long slen; - long rlen; - char * ptr, rptr; - char bracket; - struct FAB fab = cc$rms_fab; - struct NAM nam = cc$rms_nam; - char esa[NAM$C_MAXRSS]; - - if (! src[0]) - src="[.]"; /* Empty is == current dir */ - - slen = strlen (src) - 1; - if (src[slen] == FN_C_AFTER_DIR || src[slen] == FN_C_AFTER_DIR_2 || - src[slen] == FN_DEVCHAR) - { - /* VMS style - convert [x.y.z] to [x.y]z, [x] to [000000]x */ - fab.fab$l_fna = src; - fab.fab$b_fns = slen + 1; - fab.fab$l_nam = &nam; - fab.fab$l_fop = FAB$M_NAM; - - nam.nam$l_esa = esa; - nam.nam$b_ess = sizeof esa; - nam.nam$b_nop |= NAM$M_SYNCHK; - - /* We call SYS$PARSE to handle such things as [--] for us. */ - if (SYS$PARSE(&fab, 0, 0) == RMS$_NORMAL) - { - slen = nam.nam$b_esl - 1; - if (esa[slen] == ';' && esa[slen - 1] == '.') - slen -= 2; - esa[slen + 1] = '\0'; - src = esa; - } - if (src[slen] != FN_C_AFTER_DIR && src[slen] != FN_C_AFTER_DIR_2) - { - /* what about when we have logical_name:???? */ - if (src[slen] == FN_DEVCHAR) - { /* Xlate logical name and see what we get */ - (void) strmov(dst,src); - dst[slen] = 0; /* remove colon */ - if (!(src = getenv (dst))) - return dst; /* Can't translate */ - - /* should we jump to the beginning of this procedure? - Good points: allows us to use logical names that xlate - to Unix names, - Bad points: can be a problem if we just translated to a device - name... - For now, I'll punt and always expect VMS names, and hope for - the best! */ - - slen = strlen (src) - 1; - if (src[slen] != FN_C_AFTER_DIR && src[slen] != FN_C_AFTER_DIR_2) - { /* no recursion here! */ - (void) strmov(dst, src); - return(dst); - } - } - else - { /* not a directory spec */ - (void) strmov(dst, src); - return(dst); - } - } - - bracket = src[slen]; /* End char */ - if (!(ptr = strchr (src, bracket - 2))) - { /* no opening bracket */ - (void) strmov (dst, src); - return dst; - } - if (!(rptr = strrchr (src, '.'))) - rptr = ptr; - slen = rptr - src; - (void) strmake (dst, src, slen); - - if (*rptr == '.') - { /* Put bracket and add */ - dst[slen++] = bracket; /* (rptr+1) after this */ - } - else - { - /* If we have the top-level of a rooted directory (i.e. xx:[000000]), - then translate the device and recurse. */ - - if (dst[slen - 1] == ':' - && dst[slen - 2] != ':' /* skip decnet nodes */ - && strcmp(src + slen, "[000000]") == 0) - { - dst[slen - 1] = '\0'; - if ((ptr = getenv (dst)) - && (rlen = strlen (ptr) - 1) > 0 - && (ptr[rlen] == FN_C_AFTER_DIR || ptr[rlen] == FN_C_AFTER_DIR_2) - && ptr[rlen - 1] == '.') - { - (void) strmov(esa,ptr); - esa[rlen - 1] = FN_C_AFTER_DIR; - esa[rlen] = '\0'; - return (directory_file_name (dst, esa)); - } - else - dst[slen - 1] = ':'; - } - (void) strmov(dst+slen,"[000000]"); - slen += 8; - } - (void) strmov(strmov(dst+slen,rptr+1)-1,".DIR.1"); - return dst; - } - (void) strmov(dst, src); - if (dst[slen] == '/' && slen > 1) - dst[slen] = 0; - return dst; -#endif /* VMS */ -} /* directory_file_name */ +} #else diff --git a/mysys/my_lock.c b/mysys/my_lock.c index 1436c845286..49c94ea838c 100644 --- a/mysys/my_lock.c +++ b/mysys/my_lock.c @@ -22,9 +22,6 @@ #undef NO_ALARM_LOOP #endif #include -#ifdef __NETWARE__ -#include -#endif #ifdef _WIN32 #define WIN_LOCK_INFINITE -1 @@ -145,60 +142,14 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length, int value; ALARM_VARIABLES; #endif -#ifdef __NETWARE__ - int nxErrno; -#endif DBUG_ENTER("my_lock"); DBUG_PRINT("my",("fd: %d Op: %d start: %ld Length: %ld MyFlags: %d", fd,locktype,(long) start,(long) length,MyFlags)); -#ifdef VMS - DBUG_RETURN(0); -#else if (my_disable_locking) DBUG_RETURN(0); -#if defined(__NETWARE__) - { - NXSOffset_t nxLength = length; - unsigned long nxLockFlags = 0; - - if (length == F_TO_EOF) - { - /* EOF is interpreted as a very large length. */ - nxLength = 0x7FFFFFFFFFFFFFFF; - } - - if (locktype == F_UNLCK) - { - /* The lock flags are currently ignored by NKS. */ - if (!(nxErrno= NXFileRangeUnlock(fd, 0L, start, nxLength))) - DBUG_RETURN(0); - } - else - { - if (locktype == F_RDLCK) - { - /* A read lock is mapped to a shared lock. */ - nxLockFlags = NX_RANGE_LOCK_SHARED; - } - else - { - /* A write lock is mapped to an exclusive lock. */ - nxLockFlags = NX_RANGE_LOCK_EXCL; - } - - if (MyFlags & MY_DONT_WAIT) - { - /* Don't block on the lock. */ - nxLockFlags |= NX_RANGE_LOCK_TRYLOCK; - } - - if (!(nxErrno= NXFileRangeLock(fd, nxLockFlags, start, nxLength))) - DBUG_RETURN(0); - } - } -#elif defined(_WIN32) +#if defined(_WIN32) { int timeout_sec; if (MyFlags & MY_DONT_WAIT) @@ -257,12 +208,9 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length, #endif /* HAVE_FCNTL */ #endif /* HAVE_LOCKING */ -#ifdef __NETWARE__ - my_errno = nxErrno; -#else - /* We got an error. We don't want EACCES errors */ + /* We got an error. We don't want EACCES errors */ my_errno=(errno == EACCES) ? EAGAIN : errno ? errno : -1; -#endif + if (MyFlags & MY_WME) { if (locktype == F_UNLCK) @@ -272,5 +220,4 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length, } DBUG_PRINT("error",("my_errno: %d (%d)",my_errno,errno)); DBUG_RETURN(-1); -#endif /* ! VMS */ } /* my_lock */ diff --git a/mysys/my_mess.c b/mysys/my_mess.c index 0ec97525ae8..513afe39054 100644 --- a/mysys/my_mess.c +++ b/mysys/my_mess.c @@ -22,11 +22,7 @@ void my_message_stderr(uint error __attribute__((unused)), DBUG_PRINT("enter",("message: %s",str)); (void) fflush(stdout); if (MyFlags & ME_BELL) -#ifdef __NETWARE__ - ringbell(); /* Bell */ -#else - (void) fputc('\007',stderr); /* Bell */ -#endif /* __NETWARE__ */ + (void) fputc('\007', stderr); if (my_progname) { (void)fputs(my_progname,stderr); (void)fputs(": ",stderr); diff --git a/mysys/my_netware.c b/mysys/my_netware.c deleted file mode 100644 index 5b5c39c0ac0..00000000000 --- a/mysys/my_netware.c +++ /dev/null @@ -1,150 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* - Functions specific to netware -*/ - -#include -#ifdef __NETWARE__ - #include - #include - -/* - PMUserLicenseRequest is an API exported by the polimgr.nlm - (loaded by the NetWare OS when it comes up) for use by other - NLM-based NetWare products/services. - PMUserLicenseRequest provides a couple of functions: - 1) it will optionally request a User license or ensure that - one already exists for the specified User in userInfo - 2) it utilizes the NetWare usage metering service to - record usage information about your product/service. -*/ - -long PMMeteredUsageRequest -( - /* - NDS distinguished name or IP address or ??. asciiz string, e.g. - ".CN=Admin.O=this.T=MYTREE." - */ - char *userInfo, - long infoType, /* see defined values */ - /* - string used to identify the calling service, used to index the - metered info e.g. "iPrint" - */ - char *serviceID, - char tranAddrType, /* type of address that follows */ - char *tranAddr, /* ptr to a 10-byte array */ - long flags, /* see defined values */ - /* NLS error code, if any. NULL input is okay */ - long *licRequestErrCode, - /* meter service error code, if any. NULL input is okay */ - long *storeMeterInfoErrCode, - /* - error code from NLSMeter if - storeMeterInfoErrCode == PM_LICREQ_NLSMETERERROR. - NULL input is okay - */ - long *NLSMeterErrCode -); - -typedef long(*PMUR)(const char*, long, const char*, char, - const char*, long, long*, long*, long*); - -/* infoType */ -/* indicates that the info in the userInfo param is an NDS user */ -#define PM_USERINFO_TYPE_NDS 1 -/* indicates that the info in the userInfo param is NOT an NDS user */ -#define PM_USERINFO_TYPE_ADDRESS 2 - -/* Flags */ - -/* - Tells the service that it should not check to see if the NDS user - contained in the userInfo param has a NetWare User License - just - record metering information; this is ignored if infoType != - PM_USERINFO_TYPE_NDS -*/ - -#define PM_FLAGS_METER_ONLY 0x0000001 - -/* - Indicates that the values in the userInfo and serviceID parameters - are unicode strings, so that the metering service bypasses - converting these to unicode (again) -*/ -#define PM_LICREQ_ALREADY_UNICODE 0x0000002 -/* - Useful only if infoType is PM_USERINFO_TYPE_NDS - indicates a "no - stop" policy of the calling service -*/ -#define PM_LICREQ_ALWAYS_METER 0x0000004 - - -/* - net Address Types - system-defined types of net addresses that can - be used in the tranAddrType field -*/ - -#define NLS_TRAN_TYPE_IPX 0x00000001 /* An IPX address */ -#define NLS_TRAN_TYPE_IP 0x00000008 /* An IP address */ -#define NLS_ADDR_TYPE_MAC 0x000000F1 /* a MAC address */ - -/* - Net Address Sizes - lengths that correspond to the tranAddrType - field (just fyi) -*/ -#define NLS_IPX_ADDR_SIZE 10 /* the size of an IPX address */ -#define NLS_IP_ADDR_SIZE 4 /* the size of an IP address */ -#define NLS_MAC_ADDR_SIZE 6 /* the size of a MAC address */ - - -void netware_reg_user(const char *ip, const char *user, - const char *application) -{ - PMUR usage_request; - long licRequestErrCode = 0; - long storeMeterInfoErrCode = 0; - long nlsMeterErrCode = 0; - - /* import the symbol */ - usage_request= ((PMUR)ImportPublicObject(getnlmhandle(), - "PMMeteredUsageRequest")); - if (usage_request != NULL) - { - unsigned long iaddr; - char addr[NLS_IPX_ADDR_SIZE]; - - /* create address */ - iaddr = htonl(inet_addr(ip)); - bzero(addr, NLS_IPX_ADDR_SIZE); - memcpy(addr, &iaddr, NLS_IP_ADDR_SIZE); - - /* call to NLS */ - usage_request(user, - PM_USERINFO_TYPE_ADDRESS, - application, - NLS_TRAN_TYPE_IP, - addr, - PM_FLAGS_METER_ONLY, - &licRequestErrCode, - &storeMeterInfoErrCode, - &nlsMeterErrCode); - /* release symbol */ - UnImportPublicObject(getnlmhandle(), "PMMeteredUsageRequest"); - } -} -#endif /* __NETWARE__ */ diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c index 3019e4bc5c1..270d13928e3 100644 --- a/mysys/my_pthread.c +++ b/mysys/my_pthread.c @@ -45,34 +45,6 @@ void *my_pthread_getspecific_imp(pthread_key_t key) } #endif -#ifdef __NETWARE__ -/* - Don't kill the LibC Reaper thread or the main thread -*/ -#include -#undef pthread_exit -void my_pthread_exit(void *status) -{ - NXThreadId_t tid; - NXContext_t ctx; - char name[NX_MAX_OBJECT_NAME_LEN+1] = ""; - - tid= NXThreadGetId(); - if (tid == NX_INVALID_THREAD_ID || !tid) - return; - if (NXThreadGetContext(tid, &ctx) || - NXContextGetName(ctx, name, sizeof(name)-1)) - return; - - /* - "MYSQLD.NLM's LibC Reaper" or "MYSQLD.NLM's main thread" - with a debug build of LibC the reaper can have different names - */ - if (!strindex(name, "\'s")) - pthread_exit(status); -} -#endif - /* Some functions for RTS threads, AIX, Siemens Unix and UnixWare 7 (and DEC OSF/1 3.2 too) diff --git a/mysys/my_rdtsc.c b/mysys/my_rdtsc.c index 073663e3d96..c8ef38efbdc 100644 --- a/mysys/my_rdtsc.c +++ b/mysys/my_rdtsc.c @@ -86,10 +86,6 @@ #include /* for times */ #endif -#if defined(__NETWARE__) -#include /* for NXGetTime */ -#endif - #if defined(__INTEL_COMPILER) && defined(__ia64__) && defined(HAVE_IA64INTRIN_H) #include /* for __GetReg */ #endif @@ -265,12 +261,6 @@ ulonglong my_timer_nanoseconds(void) clock_gettime(CLOCK_REALTIME, &tp); return (ulonglong) tp.tv_sec * 1000000000 + (ulonglong) tp.tv_nsec; } -#elif defined(__NETWARE__) - { - NXTime_t tm; - NXGetTime(NX_SINCE_1970, NX_NSECONDS, &tm); - return (ulonglong) tm; - } #elif defined(__APPLE__) && defined(__MACH__) { ulonglong tm; @@ -322,12 +312,6 @@ ulonglong my_timer_microseconds(void) QueryPerformanceCounter(&t_cnt); return (ulonglong) t_cnt.QuadPart; } -#elif defined(__NETWARE__) - { - NXTime_t tm; - NXGetTime(NX_SINCE_1970, NX_USECONDS, &tm); - return (ulonglong) tm; - } #else return 0; #endif @@ -354,12 +338,6 @@ ulonglong my_timer_milliseconds(void) GetSystemTimeAsFileTime( &ft ); return ((ulonglong)ft.dwLowDateTime + (((ulonglong)ft.dwHighDateTime) << 32))/10000; -#elif defined(__NETWARE__) - { - NXTime_t tm; - NXGetTime(NX_SINCE_1970, NX_MSECONDS, &tm); - return (ulonglong)tm; - } #else return 0; #endif @@ -378,12 +356,6 @@ ulonglong my_timer_ticks(void) struct tms times_buf; return (ulonglong) times(×_buf); } -#elif defined(__NETWARE__) - { - NXTime_t tm; - NXGetTime(NX_SINCE_BOOT, NX_TICKS, &tm); - return (ulonglong) tm; - } #elif defined(_WIN32) return (ulonglong) GetTickCount(); #else @@ -583,8 +555,6 @@ void my_timer_init(MY_TIMER_INFO *mti) mti->nanoseconds.routine= MY_TIMER_ROUTINE_GETHRTIME; #elif defined(HAVE_CLOCK_GETTIME) mti->nanoseconds.routine= MY_TIMER_ROUTINE_CLOCK_GETTIME; -#elif defined(__NETWARE__) - mti->nanoseconds.routine= MY_TIMER_ROUTINE_NXGETTIME; #elif defined(__APPLE__) && defined(__MACH__) mti->nanoseconds.routine= MY_TIMER_ROUTINE_MACH_ABSOLUTE_TIME; #else @@ -614,8 +584,6 @@ void my_timer_init(MY_TIMER_INFO *mti) mti->microseconds.routine= MY_TIMER_ROUTINE_QUERYPERFORMANCECOUNTER; } } -#elif defined(__NETWARE__) - mti->microseconds.routine= MY_TIMER_ROUTINE_NXGETTIME; #else mti->microseconds.routine= 0; #endif @@ -633,8 +601,6 @@ void my_timer_init(MY_TIMER_INFO *mti) mti->milliseconds.routine= MY_TIMER_ROUTINE_FTIME; #elif defined(_WIN32) mti->milliseconds.routine= MY_TIMER_ROUTINE_GETSYSTEMTIMEASFILETIME; -#elif defined(__NETWARE__) - mti->milliseconds.routine= MY_TIMER_ROUTINE_NXGETTIME; #elif defined(HAVE_TIME) mti->milliseconds.routine= MY_TIMER_ROUTINE_TIME; #else @@ -652,8 +618,6 @@ void my_timer_init(MY_TIMER_INFO *mti) mti->ticks.frequency= 100; /* permanent assumption */ #if defined(HAVE_SYS_TIMES_H) && defined(HAVE_TIMES) mti->ticks.routine= MY_TIMER_ROUTINE_TIMES; -#elif defined(__NETWARE__) - mti->ticks.routine= MY_TIMER_ROUTINE_NXGETTIME; #elif defined(_WIN32) mti->ticks.routine= MY_TIMER_ROUTINE_GETTICKCOUNT; #else @@ -998,7 +962,7 @@ void my_timer_init(MY_TIMER_INFO *mti) We tested with AIX, Solaris (x86 + Sparc), Linux (x86 + Itanium), Windows, 64-bit Windows, QNX, FreeBSD, HPUX, - Irix, Mac. We didn't test with NetWare or SCO. + Irix, Mac. We didn't test with SCO. */ diff --git a/mysys/my_redel.c b/mysys/my_redel.c index 77040870048..300bac6e296 100644 --- a/mysys/my_redel.c +++ b/mysys/my_redel.c @@ -76,7 +76,7 @@ end: int my_copystat(const char *from, const char *to, int MyFlags) { struct stat statbuf; -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) int res; #endif @@ -91,17 +91,15 @@ int my_copystat(const char *from, const char *to, int MyFlags) return 1; (void) chmod(to, statbuf.st_mode & 07777); /* Copy modes */ -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING) { if (MyFlags & MY_LINK_WARNING) my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink); } res= chown(to, statbuf.st_uid, statbuf.st_gid); /* Copy ownership */ -#endif /* !__WIN__ && !__NETWARE__ */ +#endif /* !__WIN__ */ -#ifndef VMS -#ifndef __ZTC__ if (MyFlags & MY_COPYTIME) { struct utimbuf timep; @@ -109,15 +107,6 @@ int my_copystat(const char *from, const char *to, int MyFlags) timep.modtime = statbuf.st_mtime; (void) utime((char*) to, &timep);/* Update last accessed and modified times */ } -#else - if (MyFlags & MY_COPYTIME) - { - time_t time[2]; - time[0]= statbuf.st_atime; - time[1]= statbuf.st_mtime; - (void) utime((char*) to, time);/* Update last accessed and modified times */ - } -#endif -#endif + return 0; } /* my_copystat */ diff --git a/mysys/my_rename.c b/mysys/my_rename.c index 39e6056a9e4..1a4e7b2b409 100644 --- a/mysys/my_rename.c +++ b/mysys/my_rename.c @@ -44,7 +44,7 @@ int my_rename(const char *from, const char *to, myf MyFlags) } #endif #if defined(HAVE_RENAME) -#if defined(__WIN__) || defined(__NETWARE__) +#if defined(__WIN__) /* On windows we can't rename over an existing file: Remove any conflicting files: diff --git a/mysys/my_sleep.c b/mysys/my_sleep.c index 87170e4af41..6d1bdd5dc55 100644 --- a/mysys/my_sleep.c +++ b/mysys/my_sleep.c @@ -20,9 +20,7 @@ void my_sleep(ulong m_seconds) { -#ifdef __NETWARE__ - delay(m_seconds/1000+1); -#elif defined(__WIN__) +#if defined(__WIN__) Sleep(m_seconds/1000+1); /* Sleep() has millisecond arg */ #elif defined(HAVE_SELECT) struct timeval t; diff --git a/mysys/my_static.c b/mysys/my_static.c index ff5abba29d3..2869b43543a 100644 --- a/mysys/my_static.c +++ b/mysys/my_static.c @@ -27,20 +27,20 @@ my_bool timed_mutexes= 0; /* from my_init */ char * home_dir=0; const char *my_progname=0; -char NEAR curr_dir[FN_REFLEN]= {0}, - NEAR home_dir_buff[FN_REFLEN]= {0}; +char curr_dir[FN_REFLEN]= {0}, + home_dir_buff[FN_REFLEN]= {0}; ulong my_stream_opened=0,my_file_opened=0, my_tmp_file_created=0; ulong my_file_total_opened= 0; -int NEAR my_umask=0664, NEAR my_umask_dir=0777; +int my_umask=0664, my_umask_dir=0777; #ifndef THREAD -int NEAR my_errno=0; +int my_errno=0; #endif struct st_my_file_info my_file_info_default[MY_NFILE]; uint my_file_limit= MY_NFILE; struct st_my_file_info *my_file_info= my_file_info_default; /* From mf_brkhant */ -int NEAR my_dont_interrupt=0; +int my_dont_interrupt=0; volatile int _my_signals=0; struct st_remember _my_sig_remember[MAX_SIGNALS]={{0,0}}; #ifdef THREAD @@ -65,26 +65,13 @@ my_bool my_use_large_pages= 0; uint my_large_page_size= 0; #endif - /* from safe_malloc */ -uint sf_malloc_prehunc=0, /* If you have problem with core- */ - sf_malloc_endhunc=0, /* dump when malloc-message.... */ - /* set theese to 64 or 128 */ - sf_malloc_quick=0; /* set if no calls to sanity */ -size_t sf_malloc_cur_memory= 0L; /* Current memory usage */ -size_t sf_malloc_max_memory= 0L; /* Maximum memory usage */ -uint sf_malloc_count= 0; /* Number of times NEW() was called */ -uchar *sf_min_adress= (uchar*) ~(unsigned long) 0L, - *sf_max_adress= (uchar*) 0L; -/* Root of the linked list of struct st_irem */ -struct st_irem *sf_malloc_root = NULL; - /* from my_alarm */ int volatile my_have_got_alarm=0; /* declare variable to reset */ ulong my_time_to_wait_for_lock=2; /* In seconds */ /* from errors.c */ #ifdef SHARED_LIBRARY -char * NEAR globerrs[GLOBERRS]; /* my_error_messages is here */ +const char *globerrs[GLOBERRS]; /* my_error_messages is here */ #endif void (*my_abort_hook)(int) = (void(*)(int)) exit; void (*error_handler_hook)(uint error, const char *str, myf MyFlags)= @@ -119,10 +106,10 @@ ulonglong query_performance_frequency, query_performance_offset; #endif /* How to disable options */ -my_bool NEAR my_disable_locking=0; -my_bool NEAR my_disable_async_io=0; -my_bool NEAR my_disable_flush_key_blocks=0; -my_bool NEAR my_disable_symlinks=0; +my_bool my_disable_locking=0; +my_bool my_disable_async_io=0; +my_bool my_disable_flush_key_blocks=0; +my_bool my_disable_symlinks=0; /* Note that PSI_hook and PSI_server are unconditionally diff --git a/mysys/my_static.h b/mysys/my_static.h index c336115bc35..2c9cef0f101 100644 --- a/mysys/my_static.h +++ b/mysys/my_static.h @@ -34,26 +34,7 @@ struct st_remember { sig_handler (*func)(int number); }; -/* - Structure that stores information of a allocated memory block - The data is at &struct_adr+sizeof(ALIGN_SIZE(sizeof(struct irem))) - The lspecialvalue is at the previous 4 bytes from this, which may not - necessarily be in the struct if the struct size isn't aligned at a 8 byte - boundary. -*/ - -struct st_irem -{ - struct st_irem *next; /* Linked list of structures */ - struct st_irem *prev; /* Other link */ - char *filename; /* File in which memory was new'ed */ - size_t datasize; /* Size requested */ - uint32 linenum; /* Line number in above file */ - uint32 SpecialValue; /* Underrun marker value */ -}; - - -extern char NEAR curr_dir[FN_REFLEN],NEAR home_dir_buff[FN_REFLEN]; +extern char curr_dir[FN_REFLEN], home_dir_buff[FN_REFLEN]; extern volatile int _my_signals; extern struct st_remember _my_sig_remember[MAX_SIGNALS]; @@ -63,10 +44,6 @@ extern const char *soundex_map; extern USED_MEM* my_once_root_block; extern uint my_once_extra; -extern uchar *sf_min_adress,*sf_max_adress; -extern uint sf_malloc_count; -extern struct st_irem *sf_malloc_root; - extern struct st_my_file_info my_file_info_default[MY_NFILE]; extern ulonglong query_performance_frequency, query_performance_offset; diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index 555ac1cf990..9ca18eeaf1b 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -306,7 +306,7 @@ sig_handler process_alarm(int sig __attribute__((unused))) #if defined(MAIN) && !defined(__bsdi__) printf("thread_alarm in process_alarm\n"); fflush(stdout); #endif -#ifdef DONT_REMEMBER_SIGNAL +#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY my_sigset(thr_client_alarm, process_alarm); /* int. thread system calls */ #endif return; @@ -325,7 +325,7 @@ sig_handler process_alarm(int sig __attribute__((unused))) #endif process_alarm_part2(sig); #ifndef USE_ALARM_THREAD -#if defined(DONT_REMEMBER_SIGNAL) && !defined(USE_ONE_SIGNAL_HAND) +#if defined(SIGNAL_HANDLER_RESET_ON_DELIVERY) && !defined(USE_ONE_SIGNAL_HAND) my_sigset(THR_SERVER_ALARM,process_alarm); #endif mysql_mutex_unlock(&LOCK_alarm); @@ -523,12 +523,12 @@ void thr_alarm_info(ALARM_INFO *info) */ -static sig_handler thread_alarm(int sig) +static sig_handler thread_alarm(int sig __attribute__((unused))) { #ifdef MAIN printf("thread_alarm\n"); fflush(stdout); #endif -#ifdef DONT_REMEMBER_SIGNAL +#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY my_sigset(sig,thread_alarm); /* int. thread system calls */ #endif } @@ -797,7 +797,7 @@ static sig_handler print_signal_warning(int sig) { printf("Warning: Got signal %d from thread %s\n",sig,my_thread_name()); fflush(stdout); -#ifdef DONT_REMEMBER_SIGNAL +#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY my_sigset(sig,print_signal_warning); /* int. thread system calls */ #endif if (sig == SIGALRM) diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c index cff1b9b9845..9d10ba1fb01 100644 --- a/mysys/thr_lock.c +++ b/mysys/thr_lock.c @@ -122,8 +122,7 @@ static int check_lock(struct st_lock_list *list, const char* lock_type, { THR_LOCK_DATA *data,**prev; uint count=0; - THR_LOCK_OWNER *first_owner; - LINT_INIT(first_owner); + THR_LOCK_OWNER *UNINIT_VAR(first_owner); prev= &list->data; if (list->data) diff --git a/netware/BUILD/apply-patch b/netware/BUILD/apply-patch deleted file mode 100755 index 3fe5a077f9a..00000000000 --- a/netware/BUILD/apply-patch +++ /dev/null @@ -1,41 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -# repository directory -repo_dir=`pwd` - -# show usage -show_usage() -{ - cat << EOF - -usage: apply-patch - -Imports netware/current-changes.patch so that current changes -for the platform are present on the local repository. - -Use from the root directory of the repository, with BitKeeper -installed. - -EOF - exit 0; -} - -if test $1 || test -z $BK_USER -then - show_usage -fi - -echo "starting patch..." - -echo "user: $BK_USER" - -# import patch -# Note: In future this should be changed to check whether -# the repo already has this patch -bk import -tpatch $repo_dir/netware/current-changes.patch $repo_dir diff --git a/netware/BUILD/compile-AUTOTOOLS b/netware/BUILD/compile-AUTOTOOLS deleted file mode 100755 index c93fb1b1b28..00000000000 --- a/netware/BUILD/compile-AUTOTOOLS +++ /dev/null @@ -1,26 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e -sed -e "s/^DIST_COMMON/#DIST_COMMON/g" storage/ndb/Makefile.am > storage/ndb/Makefile.am.$$ -mv storage/ndb/Makefile.am.$$ storage/ndb/Makefile.am - -# for package in . ./storage/innobase -for package in . -do - (cd $package - rm -rf config.cache autom4te.cache - aclocal - autoheader - libtoolize --force - aclocal -# automake --verbose --add-missing --force-missing - automake --add-missing --force-missing - autoconf) -done - -#rm -rf ./bdb/build_unix/config.cache ./bdb/dist/autom4te.cache -#(cd ./bdb/dist && sh s_all) diff --git a/netware/BUILD/compile-linux-tools b/netware/BUILD/compile-linux-tools deleted file mode 100755 index 6a6abd32639..00000000000 --- a/netware/BUILD/compile-linux-tools +++ /dev/null @@ -1,67 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -if test ! -r ./sql/mysqld.cc -then - echo "you must start from the top source directory" - exit 1 -fi - -path=`dirname $0` - -# clean -if test -e "Makefile"; then make -k clean; fi - -# remove files -rm -f */.deps/*.P -rm -f */*.linux - -# run autotools -. $path/compile-AUTOTOOLS - -# configure -./configure --without-innodb --without-docs - -# build tools only -make clean -make - -# Create mysql_version.h which was deleted my previous step -./config.status include/mysql_version.h - -(cd dbug; make libdbug.a) -(cd strings; make libmystrings.a) -(cd mysys; make libmysys.a) -(cd storage/heap; make libheap.a) -(cd vio; make libvio.a) -(cd regex; make libregex.a) -(cd storage/myisam; make libmyisam.a) -(cd storage/myisammrg; make libmyisammrg.a) -(cd extra; make comp_err) -(cd libmysql; make conf_to_src) -(cd libmysql_r; make conf_to_src) -# so the file will be linked -(cd sql; make sql_yacc.cc) -(cd sql; make gen_lex_hash) -(cd strings; make conf_to_src) - -# so the file will be linked -(cd sql; make sql_yacc.cc) - -# we need initilizing SQL files. -(cd netware; make test_db.sql init_db.sql) - -# copying required linux tools -cp extra/comp_err extra/comp_err.linux -cp libmysql/conf_to_src libmysql/conf_to_src.linux -#cp libmysql_r/conf_to_src libmysql_r/conf_to_src.linux -cp sql/gen_lex_hash sql/gen_lex_hash.linux -cp strings/conf_to_src strings/conf_to_src.linux - -# Delete mysql_version.h -rm -f include/mysql_version.h diff --git a/netware/BUILD/compile-netware-END b/netware/BUILD/compile-netware-END deleted file mode 100755 index bf712f09162..00000000000 --- a/netware/BUILD/compile-netware-END +++ /dev/null @@ -1,52 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -path=`dirname $0` - -# clean -if test -e "Makefile"; then make -k clean; fi - -# remove files -rm -f */.deps/*.P -rm -rf Makefile.in.bk - -# Setup Metrowerks environment -. $path/mwenv - -# Temporary hack to allow building from source dist -if [ ! "$USER"=pushbuild ] -then - # Run autotools(use BUILD/autorun.sh) - echo "Running autotools again(BUILD/autorun.sh)" - . BUILD/autorun.sh -fi - -# configure -./configure $base_configs $extra_configs - -# Ensure a clean tree -make clean - -# Link NetWare specific .def files into their proper locations -# in the source tree -( cd netware && make link_sources ) - -# Now, do the real build -make bin-dist - -# mark the build -for file in *.tar.gz *.zip -do - if (expr "$file" : "mysql-[1-9].*" > /dev/null) - then - new_file=`echo $file | sed -e "s/mysql-/mysql-$suffix-/"` - if test -e "$new_file"; then mv -f $new_file $new_file.old; fi - mv $file $new_file - fi -done - diff --git a/netware/BUILD/compile-netware-START b/netware/BUILD/compile-netware-START deleted file mode 100755 index 414d577130e..00000000000 --- a/netware/BUILD/compile-netware-START +++ /dev/null @@ -1,26 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -if test ! -r ./sql/mysqld.cc -then - echo "you must start from the top source directory" - exit 1 -fi - -path=`dirname $0` - -# stop on errors -set -e - -base_configs=" \ - --host=i686-pc-netware \ - --enable-local-infile \ - --with-extra-charsets=all \ - --prefix=N:/mysql \ - --without-man \ - " diff --git a/netware/BUILD/compile-netware-all b/netware/BUILD/compile-netware-all deleted file mode 100755 index dbe64e8f97e..00000000000 --- a/netware/BUILD/compile-netware-all +++ /dev/null @@ -1,15 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -path=`dirname $0` - -$path/compile-netware-src -$path/compile-netware-standard -$path/compile-netware-debug -$path/compile-netware-max -$path/compile-netware-max-debug diff --git a/netware/BUILD/compile-netware-debug b/netware/BUILD/compile-netware-debug deleted file mode 100755 index e44d64e3074..00000000000 --- a/netware/BUILD/compile-netware-debug +++ /dev/null @@ -1,21 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -path=`dirname $0` -. $path/compile-netware-START - -suffix="debug" - -extra_configs=" \ - --with-innodb \ - --with-debug=full \ - " - -. $path/compile-netware-END - - diff --git a/netware/BUILD/compile-netware-max b/netware/BUILD/compile-netware-max deleted file mode 100755 index d8278a4e915..00000000000 --- a/netware/BUILD/compile-netware-max +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - - -path=`dirname $0` -. $path/compile-netware-START - -suffix="max" - -extra_configs=" \ - --with-innodb \ - --with-embedded-server \ - --with-ssl \ - " - -. $path/compile-netware-END - - diff --git a/netware/BUILD/compile-netware-max-debug b/netware/BUILD/compile-netware-max-debug deleted file mode 100755 index de1b5dd17cc..00000000000 --- a/netware/BUILD/compile-netware-max-debug +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -path=`dirname $0` -. $path/compile-netware-START - -suffix="max-debug" - -extra_configs=" \ - --with-innodb \ - --with-debug=full \ - --with-embedded-server \ - --with-ssl \ - " - -. $path/compile-netware-END - - diff --git a/netware/BUILD/compile-netware-src b/netware/BUILD/compile-netware-src deleted file mode 100755 index f4e8a53ffea..00000000000 --- a/netware/BUILD/compile-netware-src +++ /dev/null @@ -1,35 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -if test ! -r ./sql/mysqld.cc -then - echo "you must start from the top source directory" - exit 1 -fi - -path=`dirname $0` - -# clean -if test -e "Makefile"; then - make -k clean; - make -k distclean; -fi - -# remove other files -rm -f */.deps/*.P -rm -rf Makefile.in.bk - -# zip source -files=`pwd | sed -e "s/.*\\\(mysql-.*\)/\1/"` -file=`pwd | sed -e "s/.*\\mysql-\(.*\)/mysql-src-\1-pc-netware-i686/"` -cd .. -if test -e "$file.zip"; then rm -f $file.zip; fi -zip -r $file.zip $files -x \*.zip -x \*.tar.gz -if test -e "./$files/$file.zip"; then mv -f ./$files/$file.zip ./$files/$file.zip.old; fi -mv -f $file.zip ./$files/$file.zip - diff --git a/netware/BUILD/compile-netware-standard b/netware/BUILD/compile-netware-standard deleted file mode 100755 index 76a776a1da3..00000000000 --- a/netware/BUILD/compile-netware-standard +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - - -path=`dirname $0` -. $path/compile-netware-START - -suffix="standard" - -extra_configs=" \ - --with-innodb \ - --enable-thread-safe-client \ - --with-archive-storage-engine \ - " - -. $path/compile-netware-END - - diff --git a/netware/BUILD/create-patch b/netware/BUILD/create-patch deleted file mode 100755 index 711eabf2d89..00000000000 --- a/netware/BUILD/create-patch +++ /dev/null @@ -1,56 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -# repository direcotry -repo_dir=`pwd` - -# show usage -show_usage() -{ - cat << EOF - -usage: create-patch - -Creates a patch file between the latest revision of the current tree -and the latest revision not create by \$BK_USER. - -EOF - exit 0; -} - -if test $1 || test -z $BK_USER -then - show_usage -fi - -echo "starting patch..." - -echo "user: $BK_USER" - -# check for bk and repo_dir -bk help > /dev/null -repo_dir=`bk root $repo_dir` -cd $repo_dir - -# determine version -version=`grep -e "AM_INIT_AUTOMAKE(mysql, .*)" < configure.in | sed -e "s/AM_INIT_AUTOMAKE(mysql, \(.*\))/\1/"` -echo "version: $version" - -# user revision -user_rev=`bk changes -e -n -d':REV:' | head -1` -echo "latest revision: $user_rev" - -# tree revision -tree_rev=`bk changes -e -n -d':REV:' -U$BK_USER | head -1` -echo "latest non-$BK_USER revision: $tree_rev" - -# create patch -patch="$repo_dir/../$BK_USER-$version.patch" -echo "creating \"$patch\"..." -bk export -tpatch -r$tree_rev..$user_rev > $patch - diff --git a/netware/BUILD/cron-build b/netware/BUILD/cron-build deleted file mode 100755 index 26ccde28e2a..00000000000 --- a/netware/BUILD/cron-build +++ /dev/null @@ -1,46 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -# repository direcotry -repo_dir=`pwd` - -# show usage -show_usage() -{ - cat << EOF - -usage: cron-patch - -EOF - exit 0; -} - -echo "starting build..." - -# check for bk and repo_dir -bk help > /dev/null -repo_dir=`bk root $repo_dir` -cd $repo_dir - -# pull latest code -echo 'y' | bk pull - -# determine version -version=`grep -e "AM_INIT_AUTOMAKE(mysql, .*)" < configure.in | sed -e "s/AM_INIT_AUTOMAKE(mysql, \(.*\))/\1/"` -echo "version: $version" - -# latest revision -rev=`bk changes -e -n -d':REV:' | head -1` -echo "latest revision: $rev" - -# run bootstrap -./netware/BUILD/nwbootstrap --revision=$rev --suffix=$rev --build=all - -echo "done" - - diff --git a/netware/BUILD/crontab b/netware/BUILD/crontab deleted file mode 100755 index 0097f8acaaf..00000000000 --- a/netware/BUILD/crontab +++ /dev/null @@ -1,4 +0,0 @@ -00 23 * * * (export PATH='/usr/local/bin:/usr/bin:/bin'; export DISPLAY=':0'; cd ~/bk/mysqldoc; echo 'y' | bk pull) -00 00 * * * (export PATH='/usr/local/bin:/usr/bin:/bin'; export DISPLAY=':0'; cd ~/bk/mysql-4.0; ./netware/BUILD/cron-build) -00 04 * * * (export PATH='/usr/local/bin:/usr/bin:/bin'; export DISPLAY=':0'; cd ~/bk/mysql-4.1; ./netware/BUILD/cron-build) - diff --git a/netware/BUILD/knetware.imp b/netware/BUILD/knetware.imp deleted file mode 100644 index d9a9372b34f..00000000000 --- a/netware/BUILD/knetware.imp +++ /dev/null @@ -1,2 +0,0 @@ -kYieldIfTimeSliceUp - diff --git a/netware/BUILD/mwasmnlm b/netware/BUILD/mwasmnlm deleted file mode 100755 index 11fc2bc3842..00000000000 --- a/netware/BUILD/mwasmnlm +++ /dev/null @@ -1,11 +0,0 @@ -#! /bin/sh - -# stop on errors -set -e - -args=" $*" - -# NOTE: Option 'pipefail' is not standard sh -set -o pipefail -wine --debugmsg -all -- mwasmnlm $args | \ -perl -pe 's/\r//g; s/^\e.*\e(\[J|>)?//; s/[[^:print:]]//g' diff --git a/netware/BUILD/mwccnlm b/netware/BUILD/mwccnlm deleted file mode 100755 index 030d87288f2..00000000000 --- a/netware/BUILD/mwccnlm +++ /dev/null @@ -1,16 +0,0 @@ -#! /bin/sh - -# stop on errors -set -e - -# mwccnlm is having a hard time understanding: -# * "-I./../include", convert it to "-I../include" -# * "-I.../..", convert it to "-I../../" -args=" "`echo $* | sed \ --e 's/-I.\/../-I../g' \ --e 's/\(-I[.\/]*.\) /\1\/ /g'` - -# NOTE: Option 'pipefail' is not standard sh -set -o pipefail -wine --debugmsg -all -- mwccnlm $args | \ -perl -pe 's/\r//g; s/^\e.*\e(\[J|>)?//; s/[[^:print:]]//g' diff --git a/netware/BUILD/mwenv b/netware/BUILD/mwenv deleted file mode 100755 index 44497c48917..00000000000 --- a/netware/BUILD/mwenv +++ /dev/null @@ -1,75 +0,0 @@ -#! /bin/sh - -if test ! -r ./sql/mysqld.cc -then - echo "you must start from the top source directory" - exit 1 -fi - -# The base path(in wineformat) where compilers, includes and -# libraries are installed -if test -z "$MYDEV" -then - # the default is "F:/mydev" - export MYDEV="F:/mydev" -fi -echo "MYDEV: $MYDEV" - -# Get current dir -BUILD_DIR=`pwd` -echo "BUILD_DIR: $BUILD_DIR" - -# Get current dir in wine format -base=`echo $MYDEV |sed 's/\/.*//'` -base_unix_part=`winepath -- -u $base/` -WINE_BUILD_DIR=`echo "$BUILD_DIR" | sed 's_'$base_unix_part'/__'` -WINE_BUILD_DIR="$base/$WINE_BUILD_DIR" -echo "WINE_BUILD_DIR: $WINE_BUILD_DIR" - -# Look for libc, MySQL 5.1.x uses libc-2006 by default -libc_dir="$MYDEV/libc-2006" -if [ ! -d `winepath $libc_dir` ] -then - # The libcdir didn't exist, set default - libc_dir="$MYDEV/libc" -fi -echo "Using libc in $libc_dir"; - -export MWCNWx86Includes="$libc_dir/include;$MYDEV/fs64/headers;$MYDEV/zlib-1.2.3;$WINE_BUILD_DIR/include;$MYDEV" -export MWNWx86Libraries="$libc_dir/imports;$MYDEV/mw/lib;$MYDEV/fs64/imports;$MYDEV/zlib-1.2.3;$MYDEV/openssl;$WINE_BUILD_DIR/netware/BUILD" -export MWNWx86LibraryFiles="libcpre.o;libc.imp;netware.imp;mwcrtl.lib;mwcpp.lib;libz.a;neb.imp;zPublics.imp;knetware.imp" - -export WINEPATH="$MYDEV/mw/bin" - -# the default added path is "$BUILD_DIR/netware/BUILD" -export PATH="$PATH:$BUILD_DIR/netware/BUILD" - -export AR='mwldnlm' -export AR_FLAGS='-type library -o' -export AS='mwasmnlm' -export CC='mwccnlm -gccincludes' -export CFLAGS='-enum int -align 8 -proc 686 -relax_pointers -dialect c' -export CXX='mwccnlm -gccincludes' -export CXXFLAGS='-enum int -align 8 -proc 686 -relax_pointers -dialect c++ -bool on -wchar_t on -D_WCHAR_T' -export LD='mwldnlm' -export LDFLAGS='-entry _LibCPrelude -exit _LibCPostlude -map -flags pseudopreemption' -export RANLIB=: -export STRIP=: - -# -# Check that TERM has been set to avoid problem "Error opening -# terminal: unknown" when the script is executed using non interactive ssh -# -if test -z "$TERM" -o "$TERM"=dumb -then - export TERM=linux -fi - -# Temporary hack to allow building from source dist -if [ "$USER"=pushbuild ] -then - export ARFLAGS=$AR_FLAGS -fi - -# Print all env. variables -export diff --git a/netware/BUILD/mwldnlm b/netware/BUILD/mwldnlm deleted file mode 100755 index b1822827b59..00000000000 --- a/netware/BUILD/mwldnlm +++ /dev/null @@ -1,18 +0,0 @@ -#! /bin/sh - -# stop on errors -set -e - -# If libtool passes "x" as the first argument to this script -# it's an indication that libtool is trying to unpack .la's -# so they can be added to a new library -# This step does not work on Netware and we avoid it by -# replacing the .la library with the path to the .a library -# in Makefile.in - -args=" $*" - -# NOTE: Option 'pipefail' is not standard sh -set -o pipefail -wine --debugmsg -all -- mwldnlm $args | \ -perl -pe 's/\r//g; s/^\e.*\e(\[J|>)?//; s/[[^:print:]]//g' diff --git a/netware/BUILD/nwbuild b/netware/BUILD/nwbuild deleted file mode 100755 index d431f70add8..00000000000 --- a/netware/BUILD/nwbuild +++ /dev/null @@ -1,86 +0,0 @@ -#! /bin/sh - -# This script builds a Netware binary from a MySQL source tarball - -# debug -#set -x - -# stop on errors -set -e - -# init -build="" - -# show usage -show_usage() -{ - cat << EOF - -usage: nwbuild [options] - -Build Netware binary from source .tar.gz - -options: - ---build= Build the binary distributions for NetWare, - where is "standard", "debug", or "all" - (default is to not build a binary distribution) - ---help Show this help information - -Examples: - - ./netware/BUILD/nwbuild --build=debug - ./netware/BUILD/nwbuild --build=standard - -EOF -} - -# parse arguments -for arg do - case "$arg" in - --build=*) build=`echo "$arg" | sed -e "s;--build=;;"` ;; - --help) show_usage; exit 0 ;; - *) show_usage >&2; exit 1 ;; - esac -done - -# determine version -version=`grep -e "AM_INIT_AUTOMAKE(mysql, .*)" < configure.in | sed -e "s/AM_INIT_AUTOMAKE(mysql, \(.*\))/\1/"` -echo "version: $version" - -# make files writeable -echo "making files writable..." -chmod -R u+rw,g+rw . - -# edit the def file versions -nlm_version=`echo "$version" | sed -e "s;\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*;\1, \2, \3;"` -echo "updating *.def file versions to $nlm_version..." - -for file in ./netware/*.def -do - mv -f $file $file.org - sed -e "s;VERSION.*;VERSION $nlm_version;g" $file.org > $file - rm $file.org -done - -# create the libmysql.imp file in netware folder from libmysql/libmysql.def -# file -echo "generating libmysql.imp file..." -awk 'BEGIN{x=0;} END{printf("\n");} x==1 {printf(" %s",$1); x++; next} x>1 {printf(",\n %s", $1);next} /EXPORTS/{x=1}' libmysql/libmysql.def > netware/libmysql.imp -# build linux tools -echo "compiling linux tools..." -./netware/BUILD/compile-linux-tools -test -f ./netware/init_db.sql # this must exist -test -f ./netware/test_db.sql # this must exist - -# compile -if test $build -then - echo "compiling $build..." - ./netware/BUILD/compile-netware-$build -else - echo "Preparation complete. Use ./netware/BUILD/compile-netware-* to build MySQL." -fi - -echo "done" diff --git a/netware/BUILD/openssl.imp b/netware/BUILD/openssl.imp deleted file mode 100644 index 8972ff5d58c..00000000000 --- a/netware/BUILD/openssl.imp +++ /dev/null @@ -1,9 +0,0 @@ -WS2_32_shutdown -WS2_32_closesocket -WSASetLastError -WS2_32_recv -WSASetLastError -WS2_32_send -WSAGetLastError -GetProcessSwitchCount -RunningProcess diff --git a/netware/BUILD/save-patch b/netware/BUILD/save-patch deleted file mode 100755 index 9f9979ace5b..00000000000 --- a/netware/BUILD/save-patch +++ /dev/null @@ -1,56 +0,0 @@ -#! /bin/sh - -# debug -#set -x - -# stop on errors -set -e - -# repository directory -repo_dir=`pwd` - -# show usage -show_usage() -{ - cat << EOF - -usage: save-patch - -Creates a patch file between the latest revision of the current tree -and the latest revision not created by \$BK_USER and places it in -the tree as netware/current-changes.patch - -EOF - exit 0; -} - -if test $1 || test -z $BK_USER -then - show_usage -fi - -echo "starting patch..." - -echo "user: $BK_USER" - -# check for bk and repo_dir -bk help > /dev/null -repo_dir=`bk root $repo_dir` -cd $repo_dir - -# determine version -version=`grep -e "AM_INIT_AUTOMAKE(mysql, .*)" < configure.in | sed -e "s/AM_INIT_AUTOMAKE(mysql, \(.*\))/\1/"` -echo "version: $version" - -# user revision -user_rev=`bk changes -e -n -d':REV:' | head -1` -echo "latest revision: $user_rev" - -# tree revision -tree_rev=`bk changes -e -n -d':REV:' -U$BK_USER | head -1` -echo "latest non-$BK_USER revision: $tree_rev" - -# create patch -patch="$repo_dir/netware/current-changes.patch" -echo "creating \"$patch\"..." -bk export -tpatch -r$tree_rev..$user_rev -xnetware/current-changes.patch > $patch diff --git a/netware/Makefile.am b/netware/Makefile.am deleted file mode 100644 index f537022495b..00000000000 --- a/netware/Makefile.am +++ /dev/null @@ -1,117 +0,0 @@ -# Copyright (c) 2002 Novell, Inc. 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; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -if HAVE_NETWARE -INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I.. -LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \ - ../dbug/libdbug.a ../strings/libmystrings.a -bin_PROGRAMS = mysqld_safe mysql_install_db mysql_test_run libmysql -mysqld_safe_SOURCES= mysqld_safe.c my_manage.c -mysql_install_db_SOURCES= mysql_install_db.c my_manage.c -mysql_test_run_SOURCES= mysql_test_run.c my_manage.c -libmysql_SOURCES= libmysqlmain.c -libmysql_LDADD = ../libmysql/.libs/libmysqlclient.a \ - @openssl_libs@ @yassl_libs@ - -netware_build_files = client/mysql.def client/mysqladmin.def \ - client/mysqlbinlog.def client/mysqlcheck.def \ - client/mysqldump.def client/mysqlimport.def \ - client/mysqlshow.def client/mysqltest.def \ - client/mysqlslap.def client/mysql_upgrade.def \ - sql/mysqld.def extra/mysql_waitpid.def \ - tests/mysql_client_test.def \ - extra/my_print_defaults.def \ - extra/perror.def extra/replace.def \ - extra/resolveip.def extra/comp_err.def \ - extra/resolve_stack_dump.def \ - libmysqld/libmysqld.def \ - storage/myisam/myisamchk.def \ - storage/myisam/myisamlog.def \ - storage/myisam/myisampack.def \ - storage/myisam/myisam_ftdump.def - -BUILT_SOURCES = link_sources init_db.sql test_db.sql -CLEANFILES = $(BUILT_SOURCES) - -all: $(BUILT_SOURCES) - -link_sources: - for f in $(netware_build_files); do \ - rm -f ../$$f; \ - org=`basename $$f`; \ - @LN_CP_F@ $(srcdir)/$$org ../$$f; \ - done - echo timestamp > link_sources - -else - -BUILT_SOURCES = libmysql.imp init_db.sql test_db.sql -DISTCLEANFILES = libmysql.imp -CLEANFILES = init_db.sql test_db.sql - -# Create the libmysql.imp from libmysql/libmysql.def -libmysql.imp: $(top_srcdir)/libmysql/libmysql.def - $(AWK) 'BEGIN{x=0;} \ - END{printf("\n");} \ - x==1 {printf(" %s",$$1); x++; next} \ - x>1 {printf(",\n %s", $$1); next} \ - /EXPORTS/{x=1}' $(top_srcdir)/libmysql/libmysql.def > libmysql.imp - -EXTRA_DIST= $(BUILT_SOURCES) comp_err.def install_test_db.ncf \ - libmysql.def \ - libmysqlmain.c my_manage.c my_manage.h \ - my_print_defaults.def myisam_ftdump.def myisamchk.def \ - myisamlog.def myisampack.def mysql.def mysql.xdc \ - mysql_fix_privilege_tables.pl \ - mysql_install_db.c mysql_install_db.def \ - mysql_secure_installation.pl mysql_test_run.c \ - mysql_test_run.def mysql_waitpid.def mysqladmin.def \ - mysqlbinlog.def mysqlcheck.def mysqld.def \ - mysqld_safe.c mysqld_safe.def mysqldump.def mysqlimport.def \ - mysqlshow.def mysqltest.def mysqlslap.def mysql_upgrade.def \ - perror.def \ - mysql_client_test.def \ - replace.def resolve_stack_dump.def resolveip.def \ - static_init_db.sql init_db.sql test_db.sql \ - BUILD/apply-patch BUILD/compile-AUTOTOOLS \ - BUILD/compile-linux-tools BUILD/compile-netware-END \ - BUILD/compile-netware-START BUILD/compile-netware-all\ - BUILD/compile-netware-debug BUILD/compile-netware-max \ - BUILD/compile-netware-max-debug BUILD/compile-netware-src \ - BUILD/compile-netware-standard BUILD/create-patch \ - BUILD/cron-build BUILD/crontab BUILD/knetware.imp \ - BUILD/mwasmnlm BUILD/mwccnlm BUILD/mwenv BUILD/mwldnlm \ - BUILD/nwbuild BUILD/openssl.imp BUILD/save-patch - -endif - - -# Build init_db.sql from the files that contain -# the system tables for this version of MySQL plus any commands -init_db.sql: $(top_srcdir)/scripts/mysql_system_tables.sql \ - $(top_srcdir)/scripts/mysql_system_tables_data.sql - @echo "Building $@"; - @echo "CREATE DATABASE mysql;" > $@; - @echo "CREATE DATABASE test;" >> $@; - @echo "use mysql;" >> $@; - @cat $(top_srcdir)/scripts/mysql_system_tables.sql >> $@; - -# Build test_db.sql from init_db.sql plus -# some test data -test_db.sql: init_db.sql $(top_srcdir)/scripts/mysql_test_data_timezone.sql - @echo "Building $@"; - @cat init_db.sql \ - $(top_srcdir)/scripts/mysql_test_data_timezone.sql > $@; diff --git a/netware/comp_err.def b/netware/comp_err.def deleted file mode 100644 index f5b18bbdb9a..00000000000 --- a/netware/comp_err.def +++ /dev/null @@ -1,11 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Error File Compiler -#------------------------------------------------------------------------------ -MODULE libc.nlm -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Error File Compiler" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/install_test_db.ncf b/netware/install_test_db.ncf deleted file mode 100644 index 06befc5d9bd..00000000000 --- a/netware/install_test_db.ncf +++ /dev/null @@ -1 +0,0 @@ -# This functionality is handled by mysql-test-run.nlm on NetWare diff --git a/netware/libmysql.def b/netware/libmysql.def deleted file mode 100644 index d9d4c752612..00000000000 --- a/netware/libmysql.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Client -#------------------------------------------------------------------------------ -MODULE libc.nlm -EXPORT @libmysql.imp -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Client Library" -VERSION 4, 0 -AUTOUNLOAD -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG diff --git a/netware/libmysqlmain.c b/netware/libmysqlmain.c deleted file mode 100644 index 2b6ea9b7e27..00000000000 --- a/netware/libmysqlmain.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - Copyright (c) 2002 Novell, Inc. 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; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "my_global.h" - -void init_available_charsets(void); - -/* this function is required so that global memory is allocated against this -library nlm, and not against a paticular client */ -int _NonAppStart(void *NLMHandle, void *errorScreen, const char *commandLine, - const char *loadDirPath, size_t uninitializedDataLength, - void *NLMFileHandle, int (*readRoutineP)( int conn, void *fileHandle, - size_t offset, size_t nbytes, size_t *bytesRead, void *buffer ), - size_t customDataOffset, size_t customDataSize, int messageCount, - const char **messages) -{ - mysql_server_init(0, NULL, NULL); - - init_available_charsets(); - - return 0; -} - diff --git a/netware/my_manage.c b/netware/my_manage.c deleted file mode 100644 index 5f59e46374f..00000000000 --- a/netware/my_manage.c +++ /dev/null @@ -1,475 +0,0 @@ -/* - Copyright (c) 2003 Novell, Inc. 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; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "my_manage.h" - -/****************************************************************************** - - macros - -******************************************************************************/ - -/****************************************************************************** - - global variables - -******************************************************************************/ - -/****************************************************************************** - - functions - -******************************************************************************/ - -/****************************************************************************** - - init_args() - - Init an argument list. - -******************************************************************************/ -void init_args(arg_list_t *al) -{ - ASSERT(al != NULL); - - al->argc = 0; - al->size = ARG_BUF; - al->argv = malloc(al->size * sizeof(char *)); - ASSERT(al->argv != NULL); - - return; -} - -/****************************************************************************** - - add_arg() - - Add an argument to a list. - -******************************************************************************/ -void add_arg(arg_list_t *al, const char *format, ...) -{ - va_list ap; - char temp[PATH_MAX]; - - ASSERT(al != NULL); - - // increase size - if (al->argc >= al->size) - { - al->size += ARG_BUF; - al->argv = realloc(al->argv, al->size * sizeof(char *)); - ASSERT(al->argv != NULL); - } - - if (format) - { - va_start(ap, format); - vsprintf(temp, format, ap); - va_end(ap); - - al->argv[al->argc] = malloc(strlen(temp)+1); - ASSERT(al->argv[al->argc] != NULL); - strcpy(al->argv[al->argc], temp); - - ++(al->argc); - } - else - { - al->argv[al->argc] = NULL; - } - - return; -} - -/****************************************************************************** - - free_args() - - Free an argument list. - -******************************************************************************/ -void free_args(arg_list_t *al) -{ - int i; - - ASSERT(al != NULL); - - for(i = 0; i < al->argc; i++) - { - ASSERT(al->argv[i] != NULL); - free(al->argv[i]); - al->argv[i] = NULL; - } - - free(al->argv); - al->argc = 0; - al->argv = NULL; - - return; -} - -/****************************************************************************** - - sleep_until_file_deleted() - - Sleep until the given file is no longer found. - -******************************************************************************/ -int sleep_until_file_deleted(char *pid_file) -{ - struct stat buf; - int i, err; - - for(i = 0; (i < TRY_MAX) && (err = !stat(pid_file, &buf)); i++) sleep(1); - - if (err != 0) err = errno; - - return err; -} - -/****************************************************************************** - - sleep_until_file_exists() - - Sleep until the given file exists. - -******************************************************************************/ -int sleep_until_file_exists(char *pid_file) -{ - struct stat buf; - int i, err; - - for(i = 0; (i < TRY_MAX) && (err = stat(pid_file, &buf)); i++) sleep(1); - - if (err != 0) err = errno; - - return err; -} - -/****************************************************************************** - - wait_for_server_start() - - Wait for the server on the given port to start. - -******************************************************************************/ -int wait_for_server_start(char *bin_dir, char *user, char *password, int port,char *tmp_dir) -{ - arg_list_t al; - int err, i; - char mysqladmin_file[PATH_MAX]; - char trash[PATH_MAX]; - - // mysqladmin file - snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir); - snprintf(trash, PATH_MAX, "%s/trash.out",tmp_dir); - - // args - init_args(&al); - add_arg(&al, "%s", mysqladmin_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--port=%u", port); - add_arg(&al, "--user=%s", user); - add_arg(&al, "--password=%s", password); - add_arg(&al, "--silent"); - -#ifdef NOT_USED - add_arg(&al, "--connect_timeout=10"); - add_arg(&al, "-w"); -#endif - - add_arg(&al, "--host=localhost"); - add_arg(&al, "ping"); - - // NetWare does not support the connect timeout in the TCP/IP stack - // -- we will try the ping multiple times - for(i = 0; (i < TRY_MAX) - && (err = spawn(mysqladmin_file, &al, TRUE, NULL, - trash, NULL)); i++) sleep(1); - - // free args - free_args(&al); - - return err; -} - -/****************************************************************************** - - spawn() - - Spawn the given path with the given arguments. - -******************************************************************************/ -int spawn(char *path, arg_list_t *al, int join, char *input, - char *output, char *error) -{ - pid_t pid; - int result = 0; - wiring_t wiring = { FD_UNUSED, FD_UNUSED, FD_UNUSED }; - unsigned long flags = PROC_CURRENT_SPACE | PROC_INHERIT_CWD; - - // open wiring - if (input) - wiring.infd = open(input, O_RDONLY); - - if (output) - wiring.outfd = open(output, O_WRONLY | O_CREAT | O_TRUNC); - - if (error) - wiring.errfd = open(error, O_WRONLY | O_CREAT | O_TRUNC); - - // procve requires a NULL - add_arg(al, NULL); - - // go - pid = procve(path, flags, NULL, &wiring, NULL, NULL, 0, - NULL, (const char **)al->argv); - - if (pid == -1) - { - result = -1; - } - else if (join) - { - waitpid(pid, &result, 0); - } - - // close wiring - if (wiring.infd != -1) - close(wiring.infd); - - if (wiring.outfd != -1) - close(wiring.outfd); - - if (wiring.errfd != -1) - close(wiring.errfd); - - return result; -} - -/****************************************************************************** - - stop_server() - - Stop the server with the given port and pid file. - -******************************************************************************/ -int stop_server(char *bin_dir, char *user, char *password, int port, - char *pid_file,char *tmp_dir) -{ - arg_list_t al; - int err, i, argc = 0; - char mysqladmin_file[PATH_MAX]; - char trash[PATH_MAX]; - - // mysqladmin file - snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir); - snprintf(trash, PATH_MAX, "%s/trash.out",tmp_dir); - - // args - init_args(&al); - add_arg(&al, "%s", mysqladmin_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--port=%u", port); - add_arg(&al, "--user=%s", user); - add_arg(&al, "--password=%s", password); - add_arg(&al, "--shutdown_timeout=20"); - add_arg(&al, "shutdown"); - - // spawn - if ((err = spawn(mysqladmin_file, &al, TRUE, NULL, - trash, NULL)) == 0) - { - sleep_until_file_deleted(pid_file); - } - else - { - pid_t pid = get_server_pid(pid_file); - - // shutdown failed - kill server - kill_server(pid); - - sleep(TRY_MAX); - - // remove pid file if possible - err = remove(pid_file); - } - - // free args - free_args(&al); - - return err; -} - -/****************************************************************************** - - get_server_pid() - - Get the VM id with the given pid file. - -******************************************************************************/ -pid_t get_server_pid(char *pid_file) -{ - char buf[PATH_MAX]; - int fd, err; - char *p; - pid_t id; - - // discover id - fd = open(pid_file, O_RDONLY); - - err = read(fd, buf, PATH_MAX); - - close(fd); - - if (err > 0) - { - // terminate string - if ((p = strchr(buf, '\n')) != NULL) - { - *p = NULL; - - // check for a '\r' - if ((p = strchr(buf, '\r')) != NULL) - { - *p = NULL; - } - } - else - { - buf[err] = NULL; - } - - id = strtol(buf, NULL, 0); - } - - return id; -} - -/****************************************************************************** - - kill_server() - - Force a kill of the server with the given pid. - -******************************************************************************/ -void kill_server(pid_t pid) -{ - if (pid > 0) - { - // destroy vm - NXVmDestroy(pid); - } -} - -/****************************************************************************** - - del_tree() - - Delete the directory and subdirectories. - -******************************************************************************/ -void del_tree(char *dir) -{ - DIR *parent = opendir(dir); - DIR *entry; - char temp[PATH_MAX]; - - if (parent == NULL) - { - return; - } - - while((entry = readdir(parent)) != NULL) - { - // create long name - snprintf(temp, PATH_MAX, "%s/%s", dir, entry->d_name); - - if (entry->d_name[0] == '.') - { - // Skip - } - else if (S_ISDIR(entry->d_type)) - { - // delete subdirectory - del_tree(temp); - } - else - { - // remove file - remove(temp); - } - } - - // remove directory - rmdir(dir); -} - -/****************************************************************************** - - removef() - -******************************************************************************/ -int removef(const char *format, ...) -{ - va_list ap; - char path[PATH_MAX]; - - va_start(ap, format); - - vsnprintf(path, PATH_MAX, format, ap); - - va_end(ap); - - return remove(path); -} - -/****************************************************************************** - - get_basedir() - -******************************************************************************/ -void get_basedir(char *argv0, char *basedir) -{ - char temp[PATH_MAX]; - char *p; - - ASSERT(argv0 != NULL); - ASSERT(basedir != NULL); - - strcpy(temp, strlwr(argv0)); - while((p = strchr(temp, '\\')) != NULL) *p = '/'; - - if ((p = strindex(temp, "/bin/")) != NULL) - { - *p = NULL; - strcpy(basedir, temp); - } -} diff --git a/netware/my_manage.h b/netware/my_manage.h deleted file mode 100644 index 360f2f104be..00000000000 --- a/netware/my_manage.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - Copyright (c) 2002 Novell, Inc. 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; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef _MY_MANAGE -#define _MY_MANAGE - -/****************************************************************************** - - includes - -******************************************************************************/ - -#include -#ifndef __WIN__ -#include -#endif - -/****************************************************************************** - - macros - -******************************************************************************/ -#ifdef __WIN__ -#define PATH_MAX _MAX_PATH -#define NAME_MAX _MAX_FNAME -#define kill(A,B) TerminateProcess((HANDLE)A,0) -#define NOT_NEED_PID 0 -#define MASTER_PID 1 -#define SLAVE_PID 2 -#define mysqld_timeout 60000 - -intptr_t master_server; -intptr_t slave_server; -int pid_mode; -bool run_server; -char win_args[1024]; -bool skip_first_param; -#endif - - -#define ARG_BUF 10 -#define TRY_MAX 5 -#define NULL (char) 0 - -#ifdef __NETWARE__ -#define strstr(A,B) strindex(A,B) -#endif - - -/****************************************************************************** - - structures - -******************************************************************************/ - -typedef struct -{ - - int argc; - char **argv; - - size_t size; - -} arg_list_t; - - -typedef int pid_t; -/****************************************************************************** - - global variables - -******************************************************************************/ - -/****************************************************************************** - - prototypes - -******************************************************************************/ - -void init_args(arg_list_t *); -void add_arg(arg_list_t *, const char *, ...); -void free_args(arg_list_t *); - -int sleep_until_file_exists(char *); -int sleep_until_file_deleted(char *); -int wait_for_server_start(char *, char *, char *, int,char *); - -int spawn(char *, arg_list_t *, int, char *, char *, char *); - -int stop_server(char *, char *, char *, int, char *,char *); -pid_t get_server_pid(char *); -void kill_server(pid_t pid); - -void del_tree(char *); -int removef(const char *, ...); - -void get_basedir(char *, char *); - -char mysqladmin_file[PATH_MAX]; - -#endif /* _MY_MANAGE */ - - diff --git a/netware/my_print_defaults.def b/netware/my_print_defaults.def deleted file mode 100644 index acba6c81b49..00000000000 --- a/netware/my_print_defaults.def +++ /dev/null @@ -1,11 +0,0 @@ -#------------------------------------------------------------------------------ -# My Print Defaults -#------------------------------------------------------------------------------ -MODULE libc.nlm -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Print Defaults Tool" -VERSION 5, 0, 17 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/myisam_ftdump.def b/netware/myisam_ftdump.def deleted file mode 100644 index f2b4890a54d..00000000000 --- a/netware/myisam_ftdump.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL MyISAM Dump Tool -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL MyISAM Table Dump Tool" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL MyISAM Table Dump Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../../netware/mysql.xdc -#DEBUG - diff --git a/netware/myisamchk.def b/netware/myisamchk.def deleted file mode 100644 index 71fb66d0ed1..00000000000 --- a/netware/myisamchk.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MyISAM Check -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL MyISAM Table Check Tool[scrollable]" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL MyISAM Table Check Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../../netware/mysql.xdc -#DEBUG - diff --git a/netware/myisamlog.def b/netware/myisamlog.def deleted file mode 100644 index 1924ba2192b..00000000000 --- a/netware/myisamlog.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MyISAM Log -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL MyISAM Table Log Tool" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL MyISAM Table Log Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../../netware/mysql.xdc -#DEBUG - diff --git a/netware/myisampack.def b/netware/myisampack.def deleted file mode 100644 index 39fd1b34100..00000000000 --- a/netware/myisampack.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MyISAM Pack -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL MyISAM Table Pack Tool" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL MyISAM Table Pack Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysql.def b/netware/mysql.def deleted file mode 100644 index 4e44f4882d1..00000000000 --- a/netware/mysql.def +++ /dev/null @@ -1,13 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Client -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Monitor[scrollable]" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Monitor" -VERSION 4, 0 -STACKSIZE 131072 -MULTIPLE -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysql.xdc b/netware/mysql.xdc deleted file mode 100644 index a6c430f7314..00000000000 Binary files a/netware/mysql.xdc and /dev/null differ diff --git a/netware/mysql_client_test.def b/netware/mysql_client_test.def deleted file mode 100644 index 9a6f63ec4d7..00000000000 --- a/netware/mysql_client_test.def +++ /dev/null @@ -1,10 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Test -#------------------------------------------------------------------------------ -MODULE libc.nlm -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Client Test" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG diff --git a/netware/mysql_fix_privilege_tables.pl b/netware/mysql_fix_privilege_tables.pl deleted file mode 100644 index e40b4158e1c..00000000000 --- a/netware/mysql_fix_privilege_tables.pl +++ /dev/null @@ -1,227 +0,0 @@ -#----------------------------------------------------------------------------- -# Copyright (C) 2002 MySQL AB -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -#----------------------------------------------------------------------------- - -#----------------------------------------------------------------------------- -# This notice applies to changes, created by or for Novell, Inc., -# to preexisting works for which notices appear elsewhere in this file. - -# Copyright (c) 2003 Novell, Inc. 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; either version 2 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -#----------------------------------------------------------------------------- - -#use strict; -use Mysql; - -print "MySQL Fix Privilege Tables Script\n\n"; - -print "NOTE: This script updates your privilege tables to the lastest\n"; -print " specifications!\n\n"; - -#----------------------------------------------------------------------------- -# get the current root password -#----------------------------------------------------------------------------- - -print "In order to log into MySQL to update it, we'll need the current\n"; -print "password for the root user. If you've just installed MySQL, and\n"; -print "you haven't set the root password yet, the password will be blank,\n"; -print "so you should just press enter here.\n\n"; - -print "Enter the current password for root: "; -my $password = ; -chomp $password; -print "\n"; - -my $conn = Mysql->connect("localhost", "mysql", "root", $password) - || die "Unable to connect to MySQL."; - -print "OK, successfully used the password, moving on...\n\n"; - - -#----------------------------------------------------------------------------- -# MySQL 4.0.2 -#----------------------------------------------------------------------------- - -#-- Detect whether or not we had the Grant_priv column -print "Fixing privileges for old tables...\n"; -$conn->query("SET \@hadGrantPriv:=0;"); -$conn->query("SELECT \@hadGrantPriv:=1 FROM user WHERE Grant_priv LIKE '%';"); - -#--- Fix privileges for old tables -$conn->query("UPDATE user SET Grant_priv=File_priv,References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE \@hadGrantPriv = 0;"); -$conn->query("UPDATE db SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE \@hadGrantPriv = 0;"); -$conn->query("UPDATE host SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE \@hadGrantPriv = 0;"); - - -# Detect whether we had Show_db_priv -$conn->query("SET \@hadShowDbPriv:=0;"); -$conn->query("SELECT \@hadShowDbPriv:=1 FROM user WHERE Show_db_priv LIKE '%';"); - -print "Adding new fields used by MySQL 4.0.2 to the privilege tables...\n"; -print "NOTE: You can ignore any Duplicate column errors.\n"; -$conn->query(" \ -ALTER TABLE user \ -ADD Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER alter_priv, \ -ADD Super_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Show_db_priv, \ -ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Super_priv, \ -ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Create_tmp_table_priv, \ -ADD Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Lock_tables_priv, \ -ADD Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Execute_priv, \ -ADD Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Repl_slave_priv; \ -") && $conn->query(" \ -UPDATE user SET show_db_priv=select_priv, super_priv=process_priv, execute_priv=process_priv, create_tmp_table_priv='Y', Lock_tables_priv='Y', Repl_slave_priv=file_priv, Repl_client_priv=file_priv where user<>''AND \@hadShowDbPriv = 0; \ -"); - -#-- The above statement converts privileges so that users have similar privileges as before - -#----------------------------------------------------------------------------- -# MySQL 4.0 Limitations -#----------------------------------------------------------------------------- - -print "Adding new fields used by MySQL 4.0 security limitations...\n"; - -$conn->query(" \ -ALTER TABLE user \ -ADD max_questions int(11) NOT NULL AFTER x509_subject, \ -ADD max_updates int(11) unsigned NOT NULL AFTER max_questions, \ -ADD max_connections int(11) unsigned NOT NULL AFTER max_updates; \ -"); - -#-- Change the password column to suite the new password hashing used -#-- in 4.1.1 onward -$conn->query("ALTER TABLE user change Password Password char(41) binary not null;"); - -#-- The second alter changes ssl_type to new 4.0.2 format -#-- Adding columns needed by GRANT .. REQUIRE (openssl)" -print "Adding new fields to use in ssl authentication...\n"; - -$conn->query(" \ -ALTER TABLE user \ -ADD ssl_type enum('','ANY','X509', 'SPECIFIED') NOT NULL, \ -ADD ssl_cipher BLOB NOT NULL, \ -ADD x509_issuer BLOB NOT NULL, \ -ADD x509_subject BLOB NOT NULL; \ -"); - -#----------------------------------------------------------------------------- -# MySQL 4.0 DB and Host privs -#----------------------------------------------------------------------------- - -print "Adding new fields used by MySQL 4.0 locking and temporary table security...\n"; - -$conn->query(" \ -ALTER TABLE db \ -ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, \ -ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL; \ -"); - -$conn->query(" \ -ALTER TABLE host \ -ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, \ -ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL; \ -"); - -# -# Change the Table_name column to be of char(64) which was char(60) by mistake till now. -# -$conn->query("alter table tables_priv change Table_name Table_name char(64) binary DEFAULT '' NOT NULL;"); - - -# -# Create some possible missing tables -# -print "Adding online help tables...\n"; - -$conn->query(" \ -CREATE TABLE IF NOT EXISTS help_topic ( \ -help_topic_id int unsigned not null, \ -name varchar(64) not null, \ -help_category_id smallint unsigned not null, \ -description text not null, \ -example text not null, \ -url varchar(128) not null, \ -primary key (help_topic_id), unique index (name) \ -) comment='help topics'; \ -"); - -$conn->query(" \ -CREATE TABLE IF NOT EXISTS help_category ( \ -help_category_id smallint unsigned not null, \ -name varchar(64) not null, \ -parent_category_id smallint unsigned null, \ -url varchar(128) not null, \ -primary key (help_category_id), \ -unique index (name) \ -) comment='help categories'; \ -"); - -$conn->query(" \ -CREATE TABLE IF NOT EXISTS help_relation ( \ -help_topic_id int unsigned not null references help_topic, \ -help_keyword_id int unsigned not null references help_keyword, \ -primary key (help_keyword_id, help_topic_id) \ -) comment='keyword-topic relation'; \ -"); - -$conn->query(" \ -CREATE TABLE IF NOT EXISTS help_keyword ( \ -help_keyword_id int unsigned not null, \ -name varchar(64) not null, \ -primary key (help_keyword_id), \ -unique index (name) \ -) comment='help keywords'; \ -"); - - -# -# Filling the help tables with contents. -# -print "Filling online help tables with contents...\n"; -# Generate the path for "fill_help_tables.sql" file which is in different folder. -$fill_help_table=$0; -$fill_help_table =~ s/scripts[\\\/]mysql_fix_privilege_tables.pl/share\\fill_help_tables.sql/; - -#read all content from the sql file which contains recordsfor help tables. -open(fileIN,$fill_help_table) or die("Cannot open $fill_help_table: $!"); -@logData = ; -close(fileIN); -foreach $line (@logData) { -# if the line is not empty, insert a record in the table. - if( ! ($line =~ /^\s*$/) ) { - $conn->query("$line"); - } -} - -#----------------------------------------------------------------------------- -# done -#----------------------------------------------------------------------------- - -print "\n\nAll done!\n\n"; - -print "Thanks for using MySQL!\n\n"; diff --git a/netware/mysql_install_db.c b/netware/mysql_install_db.c deleted file mode 100644 index 98852c89825..00000000000 --- a/netware/mysql_install_db.c +++ /dev/null @@ -1,447 +0,0 @@ -/* - Copyright (c) 2002 Novell, Inc. 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; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "my_config.h" -#include "my_manage.h" - -/****************************************************************************** - - global variables - -******************************************************************************/ -char autoclose; -char basedir[PATH_MAX]; -char datadir[PATH_MAX]; -char err_log[PATH_MAX]; -char out_log[PATH_MAX]; -char mysqld[PATH_MAX]; -char hostname[PATH_MAX]; -char sql_file[PATH_MAX]; -char default_option[PATH_MAX]; - -/****************************************************************************** - - prototypes - -******************************************************************************/ - -void start_defaults(int, char*[]); -void finish_defaults(); -void read_defaults(arg_list_t *); -void parse_args(int, char*[]); -void get_options(int, char*[]); -void create_paths(); -int mysql_install_db(int argc, char *argv[]); - -/****************************************************************************** - - functions - -******************************************************************************/ - -/****************************************************************************** - - start_defaults() - - Start setting the defaults. - -******************************************************************************/ -void start_defaults(int argc, char *argv[]) -{ - struct stat buf; - int i; - - // default options - static char *default_options[] = - { - "--no-defaults", - "--defaults-file=", - "--defaults-extra-file=", - NULL - }; - - // autoclose - autoclose = FALSE; - - // basedir - get_basedir(argv[0], basedir); - - // hostname - if (gethostname(hostname,PATH_MAX) < 0) - { - // default - strcpy(hostname,"mysql"); - } - - // default option - default_option[0] = NULL; - for (i=0; (argc > 1) && default_options[i]; i++) - { - if(!strnicmp(argv[1], default_options[i], strlen(default_options[i]))) - { - strncpy(default_option, argv[1], PATH_MAX); - break; - } - } - - // set after basedir is established - datadir[0] = NULL; - err_log[0] = NULL; - out_log[0] = NULL; - mysqld[0] = NULL; - sql_file[0] = NULL; -} - -/****************************************************************************** - - finish_defaults() - - Finish setting the defaults. - -******************************************************************************/ -void finish_defaults() -{ - struct stat buf; - int i; - - // datadir - if (!datadir[0]) snprintf(datadir, PATH_MAX, "%s/data", basedir); - - // err-log - if (!err_log[0]) snprintf(err_log, PATH_MAX, "%s/%s.err", datadir, hostname); - - // out-log - if (!out_log[0]) snprintf(out_log, PATH_MAX, "%s/%s.out", datadir, hostname); - - // sql-file - if (!sql_file[0]) snprintf(sql_file, PATH_MAX, "%s/bin/init_db.sql", basedir); - - // mysqld - if (!mysqld[0]) snprintf(mysqld, PATH_MAX, "%s/bin/mysqld", basedir); -} - -/****************************************************************************** - - read_defaults() - - Read the defaults. - -******************************************************************************/ -void read_defaults(arg_list_t *pal) -{ - arg_list_t al; - char defaults_file[PATH_MAX]; - char mydefaults[PATH_MAX]; - char line[PATH_MAX]; - FILE *fp; - - // defaults output file - snprintf(defaults_file, PATH_MAX, "%s/bin/defaults.out", basedir); - remove(defaults_file); - - // mysqladmin file - snprintf(mydefaults, PATH_MAX, "%s/bin/my_print_defaults", basedir); - - // args - init_args(&al); - add_arg(&al, mydefaults); - if (default_option[0]) add_arg(&al, default_option); - add_arg(&al, "mysqld"); - add_arg(&al, "mysql_install_db"); - - spawn(mydefaults, &al, TRUE, NULL, defaults_file, NULL); - - free_args(&al); - - // gather defaults - if((fp = fopen(defaults_file, "r")) != NULL) - { - while(fgets(line, PATH_MAX, fp)) - { - char *p; - - // remove end-of-line character - if ((p = strrchr(line, '\n')) != NULL) *p = '\0'; - - // add the option as an argument - add_arg(pal, line); - } - - fclose(fp); - } - - // remove file - remove(defaults_file); -} - -/****************************************************************************** - - parse_args() - - Get the options. - -******************************************************************************/ -void parse_args(int argc, char *argv[]) -{ - int index = 0; - int c; - - // parse options - enum opts - { - OPT_BASEDIR = 0xFF, - OPT_DATADIR, - OPT_SQL_FILE - }; - - static struct option options[] = - { - {"autoclose", no_argument, &autoclose, TRUE}, - {"basedir", required_argument, 0, OPT_BASEDIR}, - {"datadir", required_argument, 0, OPT_DATADIR}, - {"sql-file", required_argument, 0, OPT_SQL_FILE}, - {0, 0, 0, 0} - }; - - // we have to reset getopt_long because we use it multiple times - optind = 1; - - // turn off error reporting - opterr = 0; - - while ((c = getopt_long(argc, argv, "b:h:", options, &index)) >= 0) - { - switch (c) - { - case OPT_BASEDIR: - case 'b': - strcpy(basedir, optarg); - break; - - case OPT_DATADIR: - case 'h': - strcpy(datadir, optarg); - break; - - case OPT_SQL_FILE: - strcpy(sql_file, optarg); - break; - - default: - // ignore - break; - } - } -} - -/****************************************************************************** - - get_options() - - Get the options. - -******************************************************************************/ -void get_options(int argc, char *argv[]) -{ - arg_list_t al; - - // start defaults - start_defaults(argc, argv); - - // default file arguments - init_args(&al); - add_arg(&al, "ignore"); - read_defaults(&al); - parse_args(al.argc, al.argv); - free_args(&al); - - // command-line arguments - parse_args(argc, argv); - - // finish defaults - finish_defaults(); -} - -/****************************************************************************** - - create_paths() - - Create database paths. - -******************************************************************************/ -void create_paths() -{ - struct stat info; - char temp[PATH_MAX]; - - // check for tables - snprintf(temp, PATH_MAX, "%s/mysql/host.frm", datadir); - if (!stat(temp, &info)) - { - printf("A database already exists in the directory:\n"); - printf("\t%s\n\n", datadir); - exit(-1); - } - - // data directory - if (stat(datadir, &info)) - { - mkdir(datadir, 0); - } -} - -/****************************************************************************** - - mysql_install_db() - - Install the database. - -******************************************************************************/ -int mysql_install_db(int argc, char *argv[]) -{ - arg_list_t al; - int i, j, err; - char skip; - struct stat info; - - // private options - static char *private_options[] = - { - "--autoclose", - "--sql-file=", - NULL - }; - - // args - init_args(&al); - add_arg(&al, "%s", mysqld); - - // parent args - for(i = 1; i < argc; i++) - { - skip = FALSE; - - // skip private arguments - for (j=0; private_options[j]; j++) - { - if(!strnicmp(argv[i], private_options[j], strlen(private_options[j]))) - { - skip = TRUE; - break; - } - } - - if (!skip) add_arg(&al, "%s", argv[i]); - } - - add_arg(&al, "--bootstrap"); - add_arg(&al, "--skip-grant-tables"); - add_arg(&al, "--skip-innodb"); - - if ((err = stat(sql_file, &info)) != 0) - { - printf("ERROR - %s:\n", strerror(errno)); - printf("\t%s\n\n", sql_file); - // free args - free_args(&al); - exit(-1); - } - - if ((err = stat(sql_file, &info)) != 0) - { - printf("ERROR - %s:\n", strerror(errno)); - printf("\t%s\n\n", sql_file); - // free args - free_args(&al); - exit(-1); - } - - // spawn mysqld - err = spawn(mysqld, &al, TRUE, sql_file, out_log, err_log); - - // free args - free_args(&al); - - return err; -} - -/****************************************************************************** - - main() - -******************************************************************************/ -int main(int argc, char **argv) -{ - // get options - get_options(argc, argv); - - // check for an autoclose option - if (!autoclose) setscreenmode(SCR_NO_MODE); - - // header - printf("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, - MACHINE_TYPE); - - // create paths - create_paths(); - - // install the database - if (mysql_install_db(argc, argv)) - { - printf("ERROR - Failed to create the database!\n"); - printf(" %s\n", strerror(errno)); - printf("See the following log for more information:\n"); - printf("\t%s\n\n", err_log); - exit(-1); - } - - // status - printf("Initial database successfully created in the directory:\n"); - printf("\t%s\n", datadir); - - // info - printf("\nPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !\n"); - - printf("\nThis is done with:\n"); - printf("\tmysqladmin -u root password 'new-password'\n"); - - printf("\nSee the manual for more instructions.\n"); - - printf("\nYou can start the MySQL daemon with:\n"); - printf("\tmysqld_safe\n"); - - printf("\nPlease report any problems with:\n"); - printf("\t/mysql/mysqlbug.txt\n"); - - printf("\nThe latest information about MySQL is available on the web at\n"); - printf("\thttp://www.mysql.com\n"); - - printf("\nSupport MySQL by buying support at http://shop.mysql.com\n\n"); - - return 0; -} diff --git a/netware/mysql_install_db.def b/netware/mysql_install_db.def deleted file mode 100644 index e3dc57fe44c..00000000000 --- a/netware/mysql_install_db.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Install DB -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Install" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Initial Database Installer" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysql_secure_installation.pl b/netware/mysql_secure_installation.pl deleted file mode 100644 index 8550f0e6d6e..00000000000 --- a/netware/mysql_secure_installation.pl +++ /dev/null @@ -1,218 +0,0 @@ -#----------------------------------------------------------------------------- -# Copyright (C) 2002 MySQL AB and Jeremy Cole -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -#----------------------------------------------------------------------------- - -#----------------------------------------------------------------------------- -# This notice applies to changes, created by or for Novell, Inc., -# to preexisting works for which notices appear elsewhere in this file. - -# Copyright (c) 2003 Novell, Inc. 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; either version 2 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -#----------------------------------------------------------------------------- - -use strict; -use Mysql; - -print "MySQL Secure Installation Script\n\n"; - -print "NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL\n"; -print " SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!\n\n"; - -#----------------------------------------------------------------------------- -# get the current root password -#----------------------------------------------------------------------------- - -print "In order to log into MySQL to secure it, we'll need the current\n"; -print "password for the root user. If you've just installed MySQL, and\n"; -print "you haven't set the root password yet, the password will be blank,\n"; -print "so you should just press enter here.\n\n"; - -print "Enter the current password for root: "; -my $password = ; -chomp $password; -print "\n"; - -my $conn = Mysql->connect("localhost", "mysql", "root", $password) - || die "Unable to connect to MySQL."; - -print "OK, successfully used the password, moving on...\n\n"; - -#----------------------------------------------------------------------------- -# set the root password -#----------------------------------------------------------------------------- - -unless ($password) -{ - print "Setting the root password ensures that no one can log into MySQL\n"; - print "using the root user without the proper authorization.\n\n"; - - print "Set root password (Y/N)? "; - my $reply = ; - chomp $reply; - print "\n"; - - if ($reply =~ /Y/i) - { - print "New password for root: "; - my $pass1 = ; - chomp $pass1; - print "\n"; - - print "Re-enter new password for root: "; - my $pass2 = ; - chomp $pass2; - print "\n"; - - unless ($pass1 eq $pass2) { die "Sorry, the passwords do not match."; } - - unless ($pass1) { die "Sorry, you can't use an empty password here."; } - - $conn->query("SET PASSWORD FOR root\@localhost=PASSWORD('$pass1')") - || die "Unable to set password."; - - print "OK, successfully set the password, moving on...\n\n"; - } - else - { - print "WARNING, the password is not set, moving on...\n\n"; - } -} - -#----------------------------------------------------------------------------- -# remove anonymous users -#----------------------------------------------------------------------------- - -print "By default, a MySQL installation has anonymous users, allowing anyone\n"; -print "to log into MySQL without having to have a user account created for\n"; -print "them. This is intended only for testing, and to make the installation\n"; -print "go a bit smoother. You should remove them before moving into a\n"; -print "production environment.\n\n"; - -print "Remove anonymous users (Y/N)? "; -my $reply = ; -chomp $reply; -print "\n"; - -if ($reply =~ /Y/i) -{ - $conn->query("DELETE FROM mysql.user WHERE user=''") - || die "Unable to remove anonymous users."; - - print "OK, successfully removed anonymous users, moving on...\n\n"; -} -else -{ - print "WARNING, the anonymous users have not been removed, moving on...\n\n"; -} - -#----------------------------------------------------------------------------- -# disallow remote root login -#----------------------------------------------------------------------------- - -print "Normally, root should only be allowed to connect from 'localhost'. This\n"; -print "ensures that someone cannot guess at the root password from the network.\n\n"; - -print "Disallow remote root login (Y/N)? "; -my $reply = ; -chomp $reply; -print "\n"; - -if ($reply =~ /Y/i) -{ - $conn->query("DELETE FROM mysql.user WHERE user='root' AND host!='localhost'") - || die "Unable to disallow remote root login."; - - print "OK, successfully disallowed remote root login, moving on...\n\n"; -} -else -{ - print "WARNING, remote root login has not been disallowed, moving on...\n\n"; -} - -#----------------------------------------------------------------------------- -# remove test database -#----------------------------------------------------------------------------- - -print "By default, MySQL comes with a database named 'test' that anyone can\n"; -print "access. This is intended only for testing, and should be removed\n"; -print "before moving into a production environment.\n\n"; - -print "Remove the test database (Y/N)? "; -my $reply = ; -chomp $reply; -print "\n"; - -if ($reply =~ /Y/i) -{ - $conn->query("DROP DATABASE IF EXISTS test") - || die "Unable to remove test database."; - - $conn->query("DELETE FROM mysql.db WHERE db='test' OR db='test\\_%'") - || die "Unable to remove access to the test database."; - - print "OK, successfully removed the test database, moving on...\n\n"; -} -else -{ - print "WARNING, the test database has not been removed, moving on...\n\n"; -} - -#----------------------------------------------------------------------------- -# reload privilege tables -#----------------------------------------------------------------------------- - -print "Reloading the privilege tables will ensure that all changes made so far\n"; -print "will take effect immediately.\n\n"; - -print "Reload privilege tables (Y/N)? "; -my $reply = ; -chomp $reply; -print "\n"; - -if ($reply =~ /Y/i) -{ - $conn->query("FLUSH PRIVILEGES") - || die "Unable to reload privilege tables."; - - print "OK, successfully reloaded privilege tables, moving on...\n\n"; -} -else -{ - print "WARNING, the privilege tables have not been reloaded, moving on...\n\n"; -} - -#----------------------------------------------------------------------------- -# done -#----------------------------------------------------------------------------- - -print "\n\nAll done! If you've completed all of the above steps, your MySQL\n"; -print "installation should now be secure.\n\n"; - -print "Thanks for using MySQL!\n\n"; - diff --git a/netware/mysql_test_run.c b/netware/mysql_test_run.c deleted file mode 100644 index 5fa92b325b6..00000000000 --- a/netware/mysql_test_run.c +++ /dev/null @@ -1,1415 +0,0 @@ -/* - Copyright (c) 2002, 2003 Novell, Inc. 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; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "my_manage.h" -#include "mysql_version.h" -#ifdef __NETWARE__ -#define strindex(a,b) ((char*)strindex(a,b)) -#define strstr(a,b) ((char*)strstr(a,b)) -#endif - -/****************************************************************************** - - macros - -******************************************************************************/ - -#define HEADER "TEST ELAPSED RESULT \n" -#define DASH "------------------------------------------------------------------------\n" - -#define NW_TEST_SUFFIX ".nw-test" -#define NW_RESULT_SUFFIX ".nw-result" -#define TEST_SUFFIX ".test" -#define RESULT_SUFFIX ".result" -#define REJECT_SUFFIX ".reject" -#define OUT_SUFFIX ".out" -#define ERR_SUFFIX ".err" - -#define TEST_PASS "[ pass ]" -#define TEST_SKIP "[ skip ]" -#define TEST_FAIL "[ fail ]" -#define TEST_BAD "[ bad ]" -#define TEST_IGNORE "[ignore]" - -/****************************************************************************** - - global variables - -******************************************************************************/ - -char base_dir[PATH_MAX] = "sys:/mysql"; -char db[PATH_MAX] = "test"; -char user[PATH_MAX] = "root"; -char password[PATH_MAX] = ""; - -int master_port = 9306; -int slave_port = 9307; - -// comma delimited list of tests to skip or empty string -char skip_test[PATH_MAX] = " lowercase_table3 , system_mysql_db_fix "; -char ignore_test[PATH_MAX] = ""; - -char bin_dir[PATH_MAX]; -char mysql_test_dir[PATH_MAX]; -char test_dir[PATH_MAX]; -char mysql_tmp_dir[PATH_MAX]; -char result_dir[PATH_MAX]; -char master_dir[PATH_MAX]; -char slave_dir[PATH_MAX]; -char lang_dir[PATH_MAX]; -char char_dir[PATH_MAX]; - -char mysqladmin_file[PATH_MAX]; -char mysqld_file[PATH_MAX]; -char mysqltest_file[PATH_MAX]; -char master_pid[PATH_MAX]; -char slave_pid[PATH_MAX]; - -char master_opt[PATH_MAX] = ""; -char slave_opt[PATH_MAX] = ""; - -char slave_master_info[PATH_MAX] = ""; - -char master_init_script[PATH_MAX] = ""; -char slave_init_script[PATH_MAX] = ""; - -// OpenSSL -char ca_cert[PATH_MAX]; -char server_cert[PATH_MAX]; -char server_key[PATH_MAX]; -char client_cert[PATH_MAX]; -char client_key[PATH_MAX]; - -int total_skip = 0; -int total_pass = 0; -int total_fail = 0; -int total_test = 0; - -int total_ignore = 0; -double total_time = 0; - -int use_openssl = FALSE; -int master_running = FALSE; -int slave_running = FALSE; -int skip_slave = TRUE; -int single_test = TRUE; - -int restarts = 0; - -FILE *log_fd = NULL; - -/****************************************************************************** - - functions - -******************************************************************************/ - -/****************************************************************************** - - prototypes - -******************************************************************************/ - -void report_stats(); -void install_db(char *); -void mysql_install_db(); -void start_master(); -void start_slave(); -void mysql_start(); -void stop_slave(); -void stop_master(); -void mysql_stop(); -void mysql_restart(); -int read_option(char *, char *); -void run_test(char *); -void setup(char *); -void vlog(char *, va_list); -void log_msg(char *, ...); -void log_info(char *, ...); -void log_error(char *, ...); -void log_errno(char *, ...); -void die(char *); -char *str_tok(char *string, const char *delim); - -/****************************************************************************** - - report_stats() - - Report the gathered statistics. - -******************************************************************************/ -void report_stats() -{ - if (total_fail == 0) - { - log_msg("\nAll %d test(s) were successful.\n", total_test); - } - else - { - double percent = ((double)total_pass / total_test) * 100; - - log_msg("\nFailed %u/%u test(s), %.02f%% successful.\n", - total_fail, total_test, percent); - log_msg("\nThe .out and .err files in %s may give you some\n", result_dir); - log_msg("hint of what went wrong.\n"); - log_msg("\nIf you want to report this error, please first read the documentation\n"); - log_msg("at: http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html\n"); - } - - log_msg("\n%.02f total minutes elapsed in the test cases\n\n", total_time / 60); -} - -/****************************************************************************** - - install_db() - - Install the a database. - -******************************************************************************/ -void install_db(char *datadir) -{ - arg_list_t al; - int err, i; - char input[PATH_MAX]; - char output[PATH_MAX]; - char error[PATH_MAX]; - - // input file - snprintf(input, PATH_MAX, "%s/bin/test_db.sql", base_dir); - snprintf(output, PATH_MAX, "%s/install.out", datadir); - snprintf(error, PATH_MAX, "%s/install.err", datadir); - - // args - init_args(&al); - add_arg(&al, mysqld_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--bootstrap"); - add_arg(&al, "--skip-grant-tables"); - add_arg(&al, "--basedir=%s", base_dir); - add_arg(&al, "--datadir=%s", datadir); - add_arg(&al, "--skip-innodb"); - - // spawn - if ((err = spawn(mysqld_file, &al, TRUE, input, output, error)) != 0) - { - die("Unable to create database."); - } - - // free args - free_args(&al); -} - -/****************************************************************************** - - mysql_install_db() - - Install the test databases. - -******************************************************************************/ -void mysql_install_db() -{ - char temp[PATH_MAX]; - - // var directory - snprintf(temp, PATH_MAX, "%s/var", mysql_test_dir); - - // clean up old direcotry - del_tree(temp); - - // create var directory - mkdir(temp, S_IRWXU); - - // create subdirectories - log_msg("Creating test-suite folders...\n"); - snprintf(temp, PATH_MAX, "%s/var/run", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, PATH_MAX, "%s/var/tmp", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, PATH_MAX, "%s/var/master-data", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, PATH_MAX, "%s/var/master-data/mysql", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, PATH_MAX, "%s/var/master-data/test", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, PATH_MAX, "%s/var/slave-data", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, PATH_MAX, "%s/var/slave-data/mysql", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, PATH_MAX, "%s/var/slave-data/test", mysql_test_dir); - mkdir(temp, S_IRWXU); - - // install databases - log_msg("Creating test databases for master... \n"); - install_db(master_dir); - log_msg("Creating test databases for slave... \n"); - install_db(slave_dir); -} - -/****************************************************************************** - - start_master() - - Start the master server. - -******************************************************************************/ -void start_master() -{ - arg_list_t al; - int err, i; - char master_out[PATH_MAX]; - char master_err[PATH_MAX]; - char temp[PATH_MAX], temp2[PATH_MAX]; - - // remove old berkeley db log files that can confuse the server - removef("%s/log.*", master_dir); - - // remove stale binary logs - removef("%s/var/log/*-bin.*", mysql_test_dir); - - // remove stale binary logs - removef("%s/var/log/*.index", mysql_test_dir); - - // remove master.info file - removef("%s/master.info", master_dir); - - // remove relay files - removef("%s/var/log/*relay*", mysql_test_dir); - - // remove relay-log.info file - removef("%s/relay-log.info", master_dir); - - // init script - if (master_init_script[0] != NULL) - { - // run_init_script(master_init_script); - - // TODO: use the scripts - if (strindex(master_init_script, "repair_part2-master.sh") != NULL) - { - FILE *fp; - - // create an empty index file - snprintf(temp, PATH_MAX, "%s/test/t1.MYI", master_dir); - fp = fopen(temp, "wb+"); - - fputs("1", fp); - - fclose(fp); - } - - } - - // redirection files - snprintf(master_out, PATH_MAX, "%s/var/run/master%u.out", - mysql_test_dir, restarts); - snprintf(master_err, PATH_MAX, "%s/var/run/master%u.err", - mysql_test_dir, restarts); - - snprintf(temp2,PATH_MAX,"%s/var",mysql_test_dir); - mkdir(temp2,0); - snprintf(temp2,PATH_MAX,"%s/var/log",mysql_test_dir); - mkdir(temp2,0); - - // args - init_args(&al); - add_arg(&al, "%s", mysqld_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--log-bin=%s/var/log/master-bin",mysql_test_dir); - add_arg(&al, "--server-id=1"); - add_arg(&al, "--basedir=%s", base_dir); - add_arg(&al, "--port=%u", master_port); - add_arg(&al, "--local-infile"); - add_arg(&al, "--core"); - add_arg(&al, "--datadir=%s", master_dir); - add_arg(&al, "--pid-file=%s", master_pid); - add_arg(&al, "--character-sets-dir=%s", char_dir); - add_arg(&al, "--tmpdir=%s", mysql_tmp_dir); - add_arg(&al, "--language=%s", lang_dir); - add_arg(&al, "--log-bin-trust-function-creators"); - add_arg(&al, "--log-slow-queries"); - add_arg(&al, "--log-queries-not-using-indexes"); -#ifdef DEBUG //only for debug builds - add_arg(&al, "--debug"); -#endif - - if (use_openssl) - { - add_arg(&al, "--ssl-ca=%s", ca_cert); - add_arg(&al, "--ssl-cert=%s", server_cert); - add_arg(&al, "--ssl-key=%s", server_key); - } - - // $MASTER_40_ARGS - add_arg(&al, "--rpl-recovery-rank=1"); - add_arg(&al, "--init-rpl-role=master"); - - // $SMALL_SERVER - add_arg(&al, "--key_buffer_size=1M"); - add_arg(&al, "--sort_buffer=256K"); - add_arg(&al, "--max_heap_table_size=1M"); - - // $EXTRA_MASTER_OPT - if (master_opt[0] != NULL) - { - char *p; - - p = (char *)str_tok(master_opt, " \t"); - if (!strstr(master_opt, "timezone")) - { - while (p) - { - add_arg(&al, "%s", p); - p = (char *)str_tok(NULL, " \t"); - } - } - } - - // remove the pid file if it exists - remove(master_pid); - - // spawn - if ((err= spawn(mysqld_file, &al, FALSE, NULL, master_out, master_err)) == 0) - { - sleep_until_file_exists(master_pid); - - if ((err = wait_for_server_start(bin_dir, user, password, master_port, - mysql_tmp_dir)) == 0) - { - master_running = TRUE; - } - else - { - log_error("The master server went down early."); - } - } - else - { - log_error("Unable to start master server."); - } - - // free_args - free_args(&al); -} - -/****************************************************************************** - - start_slave() - - Start the slave server. - -******************************************************************************/ -void start_slave() -{ - arg_list_t al; - int err, i; - char slave_out[PATH_MAX]; - char slave_err[PATH_MAX]; - char temp[PATH_MAX]; - - // skip? - if (skip_slave) return; - - // remove stale binary logs - removef("%s/*-bin.*", slave_dir); - - // remove stale binary logs - removef("%s/*.index", slave_dir); - - // remove master.info file - removef("%s/master.info", slave_dir); - - // remove relay files - removef("%s/var/log/*relay*", mysql_test_dir); - - // remove relay-log.info file - removef("%s/relay-log.info", slave_dir); - - // init script - if (slave_init_script[0] != NULL) - { - // run_init_script(slave_init_script); - - // TODO: use the scripts - if (strindex(slave_init_script, "rpl000016-slave.sh") != NULL) - { - // create empty master.info file - snprintf(temp, PATH_MAX, "%s/master.info", slave_dir); - close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO)); - } - else if (strindex(slave_init_script, "rpl000017-slave.sh") != NULL) - { - FILE *fp; - - // create a master.info file - snprintf(temp, PATH_MAX, "%s/master.info", slave_dir); - fp = fopen(temp, "wb+"); - - fputs("master-bin.000001\n", fp); - fputs("4\n", fp); - fputs("127.0.0.1\n", fp); - fputs("replicate\n", fp); - fputs("aaaaaaaaaaaaaaab\n", fp); - fputs("9306\n", fp); - fputs("1\n", fp); - fputs("0\n", fp); - - fclose(fp); - } - else if (strindex(slave_init_script, "rpl_rotate_logs-slave.sh") != NULL) - { - // create empty master.info file - snprintf(temp, PATH_MAX, "%s/master.info", slave_dir); - close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO)); - } - } - - // redirection files - snprintf(slave_out, PATH_MAX, "%s/var/run/slave%u.out", - mysql_test_dir, restarts); - snprintf(slave_err, PATH_MAX, "%s/var/run/slave%u.err", - mysql_test_dir, restarts); - - // args - init_args(&al); - add_arg(&al, "%s", mysqld_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--log-bin=slave-bin"); - add_arg(&al, "--relay_log=slave-relay-bin"); - add_arg(&al, "--basedir=%s", base_dir); - add_arg(&al, "--port=%u", slave_port); - add_arg(&al, "--datadir=%s", slave_dir); - add_arg(&al, "--pid-file=%s", slave_pid); - add_arg(&al, "--character-sets-dir=%s", char_dir); - add_arg(&al, "--core"); - add_arg(&al, "--tmpdir=%s", mysql_tmp_dir); - add_arg(&al, "--language=%s", lang_dir); - - add_arg(&al, "--exit-info=256"); - add_arg(&al, "--log-slave-updates"); - add_arg(&al, "--init-rpl-role=slave"); - add_arg(&al, "--skip-innodb"); - add_arg(&al, "--skip-slave-start"); - add_arg(&al, "--slave-load-tmpdir=../../var/tmp"); - - add_arg(&al, "--report-user=%s", user); - add_arg(&al, "--report-host=127.0.0.1"); - add_arg(&al, "--report-port=%u", slave_port); - - add_arg(&al, "--master-retry-count=10"); - add_arg(&al, "--slave_net_timeout=10"); - add_arg(&al, "--log-bin-trust-function-creators"); - add_arg(&al, "--log-slow-queries"); - add_arg(&al, "--log-queries-not-using-indexes"); -#ifdef DEBUG //only for debug builds - add_arg(&al, "--debug"); -#endif - - if (use_openssl) - { - add_arg(&al, "--ssl-ca=%s", ca_cert); - add_arg(&al, "--ssl-cert=%s", server_cert); - add_arg(&al, "--ssl-key=%s", server_key); - } - - // slave master info - if (slave_master_info[0] != NULL) - { - char *p; - - p = (char *)str_tok(slave_master_info, " \t"); - - while(p) - { - add_arg(&al, "%s", p); - - p = (char *)str_tok(NULL, " \t"); - } - } - else - { - add_arg(&al, "--master-user=%s", user); - add_arg(&al, "--master-password=%s", password); - add_arg(&al, "--master-host=127.0.0.1"); - add_arg(&al, "--master-port=%u", master_port); - add_arg(&al, "--master-connect-retry=1"); - add_arg(&al, "--server-id=2"); - add_arg(&al, "--rpl-recovery-rank=2"); - } - - // small server - add_arg(&al, "--key_buffer_size=1M"); - add_arg(&al, "--sort_buffer=256K"); - add_arg(&al, "--max_heap_table_size=1M"); - - // opt args - if (slave_opt[0] != NULL) - { - char *p; - - p = (char *)str_tok(slave_opt, " \t"); - - while(p) - { - add_arg(&al, "%s", p); - - p = (char *)str_tok(NULL, " \t"); - } - } - - // remove the pid file if it exists - remove(slave_pid); - - // spawn - if ((err = spawn(mysqld_file, &al, FALSE, NULL, slave_out, slave_err)) == 0) - { - sleep_until_file_exists(slave_pid); - - if ((err = wait_for_server_start(bin_dir, user, password, slave_port, - mysql_tmp_dir)) == 0) - { - slave_running = TRUE; - - } - else - { - log_error("The slave server went down early."); - - } - } - else - { - log_error("Unable to start slave server."); - - } - - // free args - free_args(&al); -} - -/****************************************************************************** - - mysql_start() - - Start the mysql servers. - -******************************************************************************/ -void mysql_start() -{ - log_info("Starting the MySQL server(s): %u", ++restarts); - start_master(); - - start_slave(); - - // activate the test screen - ActivateScreen(getscreenhandle()); -} - -/****************************************************************************** - - stop_slave() - - Stop the slave server. - -******************************************************************************/ -void stop_slave() -{ - int err; - - // running? - if (!slave_running) return; - - // stop - if ((err = stop_server(bin_dir, user, password, slave_port, slave_pid, - mysql_tmp_dir)) == 0) - { - slave_running = FALSE; - } - else - { - log_error("Unable to stop slave server."); - } -} - -/****************************************************************************** - - stop_master() - - Stop the master server. - -******************************************************************************/ -void stop_master() -{ - int err; - - // running? - if (!master_running) return; - - if ((err = stop_server(bin_dir, user, password, master_port, master_pid, - mysql_tmp_dir)) == 0) - { - master_running = FALSE; - } - else - { - log_error("Unable to stop master server."); - } -} - -/****************************************************************************** - - mysql_stop() - - Stop the mysql servers. - -******************************************************************************/ -void mysql_stop() -{ - log_info("Stopping the MySQL server(s)..."); - stop_master(); - - stop_slave(); - - // activate the test screen - ActivateScreen(getscreenhandle()); -} - -/****************************************************************************** - - mysql_restart() - - Restart the mysql servers. - -******************************************************************************/ -void mysql_restart() -{ - log_info("Restarting the MySQL server(s): %u", ++restarts); - - mysql_stop(); - - mysql_start(); -} - -/****************************************************************************** - - read_option() - - Read the option file. - -******************************************************************************/ -int read_option(char *opt_file, char *opt) -{ - int fd, err; - int result; - char *p; - char buf[PATH_MAX]; - - // copy current option - strncpy(buf, opt, PATH_MAX); - - // open options file - fd = open(opt_file, O_RDONLY); - - err = read(fd, opt, PATH_MAX); - - close(fd); - - if (err > 0) - { - // terminate string - if ((p = strchr(opt, '\n')) != NULL) - { - *p = NULL; - - // check for a '\r' - if ((p = strchr(opt, '\r')) != NULL) - { - *p = NULL; - } - } - else - { - opt[err] = NULL; - } - - // check for $MYSQL_TEST_DIR - if ((p = strstr(opt, "$MYSQL_TEST_DIR")) != NULL) - { - char temp[PATH_MAX]; - - *p = NULL; - - strcpy(temp, p + strlen("$MYSQL_TEST_DIR")); - - strcat(opt, mysql_test_dir); - - strcat(opt, temp); - } - // Check for double backslash and replace it with single bakslash - if ((p = strstr(opt, "\\\\")) != NULL) - { - /* bmove is guranteed to work byte by byte */ - bmove(p, p+1, strlen(p+1)); - } - } - else - { - // clear option - *opt = NULL; - } - - // compare current option with previous - return strcmp(opt, buf); -} - -/****************************************************************************** - - run_test() - - Run the given test case. - -******************************************************************************/ -void run_test(char *test) -{ - char temp[PATH_MAX]; - char *rstr; - double elapsed = 0; - int skip = FALSE, ignore=FALSE; - int restart = FALSE; - int flag = FALSE; - struct stat info; - - // skip tests in the skip list - snprintf(temp, PATH_MAX, " %s ", test); - skip = (strindex(skip_test, temp) != NULL); - if (skip == FALSE) - ignore = (strindex(ignore_test, temp) != NULL); - - if (ignore) - { - // show test - log_msg("%-46s ", test); - - // ignore - rstr = TEST_IGNORE; - ++total_ignore; - } - else if (!skip) // skip test? - { - char test_file[PATH_MAX]; - char master_opt_file[PATH_MAX]; - char slave_opt_file[PATH_MAX]; - char slave_master_info_file[PATH_MAX]; - char result_file[PATH_MAX]; - char reject_file[PATH_MAX]; - char out_file[PATH_MAX]; - char err_file[PATH_MAX]; - int err; - arg_list_t al; - NXTime_t start, stop; - - // skip slave? - flag = skip_slave; - skip_slave = (strncmp(test, "rpl", 3) != 0); - if (flag != skip_slave) restart = TRUE; - - // create files - snprintf(master_opt_file, PATH_MAX, "%s/%s-master.opt", test_dir, test); - snprintf(slave_opt_file, PATH_MAX, "%s/%s-slave.opt", test_dir, test); - snprintf(slave_master_info_file, PATH_MAX, "%s/%s.slave-mi", test_dir, test); - snprintf(reject_file, PATH_MAX, "%s/%s%s", result_dir, test, REJECT_SUFFIX); - snprintf(out_file, PATH_MAX, "%s/%s%s", result_dir, test, OUT_SUFFIX); - snprintf(err_file, PATH_MAX, "%s/%s%s", result_dir, test, ERR_SUFFIX); - - // netware specific files - snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, NW_TEST_SUFFIX); - if (stat(test_file, &info)) - { - snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, TEST_SUFFIX); - if (access(test_file,0)) - { - printf("Invalid test name %s, %s file not found\n",test,test_file); - return; - } - } - - snprintf(result_file, PATH_MAX, "%s/%s%s", result_dir, test, NW_RESULT_SUFFIX); - if (stat(result_file, &info)) - { - snprintf(result_file, PATH_MAX, "%s/%s%s", result_dir, test, RESULT_SUFFIX); - } - - // init scripts - snprintf(master_init_script, PATH_MAX, "%s/%s-master.sh", test_dir, test); - if (stat(master_init_script, &info)) - master_init_script[0] = NULL; - else - restart = TRUE; - - snprintf(slave_init_script, PATH_MAX, "%s/%s-slave.sh", test_dir, test); - if (stat(slave_init_script, &info)) - slave_init_script[0] = NULL; - else - restart = TRUE; - - // read options - if (read_option(master_opt_file, master_opt)) restart = TRUE; - if (read_option(slave_opt_file, slave_opt)) restart = TRUE; - if (read_option(slave_master_info_file, slave_master_info)) restart = TRUE; - - // cleanup previous run - remove(reject_file); - remove(out_file); - remove(err_file); - - // start or restart? - if (!master_running) mysql_start(); - else if (restart) mysql_restart(); - - // let the system stabalize - sleep(1); - - // show test - log_msg("%-46s ", test); - - // args - init_args(&al); - add_arg(&al, "%s", mysqltest_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--port=%u", master_port); - add_arg(&al, "--database=%s", db); - add_arg(&al, "--user=%s", user); - add_arg(&al, "--password=%s", password); - add_arg(&al, "--silent"); - add_arg(&al, "--basedir=%s/", mysql_test_dir); - add_arg(&al, "--host=127.0.0.1"); - add_arg(&al, "-v"); - add_arg(&al, "-R"); - add_arg(&al, "%s", result_file); - - if (use_openssl) - { - add_arg(&al, "--ssl-ca=%s", ca_cert); - add_arg(&al, "--ssl-cert=%s", client_cert); - add_arg(&al, "--ssl-key=%s", client_key); - } - - // start timer - NXGetTime(NX_SINCE_BOOT, NX_USECONDS, &start); - - // spawn - err = spawn(mysqltest_file, &al, TRUE, test_file, out_file, err_file); - - // stop timer - NXGetTime(NX_SINCE_BOOT, NX_USECONDS, &stop); - - // calculate - elapsed = ((double)(stop - start)) / NX_USECONDS; - total_time += elapsed; - - // free args - free_args(&al); - - if (err == 0) - { - // pass - rstr = TEST_PASS; - ++total_pass; - - // increment total - ++total_test; - } - else if (err == 62) - { - // skip - rstr = TEST_SKIP; - ++total_skip; - } - else if (err == 1) - { - // fail - rstr = TEST_FAIL; - ++total_fail; - - // increment total - ++total_test; - } - else - { - rstr = TEST_BAD; - } - } - else // early skips - { - // show test - log_msg("%-46s ", test); - - // skip - rstr = TEST_SKIP; - ++total_skip; - } - - // result - log_msg("%10.06f %-14s\n", elapsed, rstr); -} - -/****************************************************************************** - - vlog() - - Log the message. - -******************************************************************************/ -void vlog(char *format, va_list ap) -{ - vfprintf(stdout, format, ap); - fflush(stdout); - - if (log_fd) - { - vfprintf(log_fd, format, ap); - fflush(log_fd); - } -} - -/****************************************************************************** - - log() - - Log the message. - -******************************************************************************/ -void log_msg(char *format, ...) -{ - va_list ap; - - va_start(ap, format); - - vlog(format, ap); - - va_end(ap); -} - -/****************************************************************************** - - log_info() - - Log the given information. - -******************************************************************************/ -void log_info(char *format, ...) -{ - va_list ap; - - va_start(ap, format); - - log_msg("-- INFO : "); - vlog(format, ap); - log_msg("\n"); - - va_end(ap); -} - -/****************************************************************************** - - log_error() - - Log the given error. - -******************************************************************************/ -void log_error(char *format, ...) -{ - va_list ap; - - va_start(ap, format); - - log_msg("-- ERROR: "); - vlog(format, ap); - log_msg("\n"); - - va_end(ap); -} - -/****************************************************************************** - - log_errno() - - Log the given error and errno. - -******************************************************************************/ -void log_errno(char *format, ...) -{ - va_list ap; - - va_start(ap, format); - - log_msg("-- ERROR: (%003u) ", errno); - vlog(format, ap); - log_msg("\n"); - - va_end(ap); -} - -/****************************************************************************** - - die() - - Exit the application. - -******************************************************************************/ -void die(char *msg) -{ - log_error(msg); - - pressanykey(); - - exit(-1); -} - -/****************************************************************************** - - setup() - - Setup the mysql test enviornment. - -******************************************************************************/ -void setup(char *file) -{ - char temp[PATH_MAX]; - char file_path[PATH_MAX*2]; - char *p; - - // set the timezone for the timestamp test - setenv("TZ", "GMT-3", TRUE); - - // find base dir - strcpy(temp, strlwr(file)); - while((p = strchr(temp, '\\')) != NULL) *p = '/'; - - if ((p = strindex(temp, "/mysql-test/")) != NULL) - { - *p = NULL; - strcpy(base_dir, temp); - } - - // setup paths - snprintf(bin_dir, PATH_MAX, "%s/bin", base_dir); - snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir); - snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir); - snprintf(mysql_tmp_dir, PATH_MAX, "%s/var/tmp", mysql_test_dir); - snprintf(result_dir, PATH_MAX, "%s/r", mysql_test_dir); - snprintf(master_dir, PATH_MAX, "%s/var/master-data", mysql_test_dir); - snprintf(slave_dir, PATH_MAX, "%s/var/slave-data", mysql_test_dir); - snprintf(lang_dir, PATH_MAX, "%s/share/english", base_dir); - snprintf(char_dir, PATH_MAX, "%s/share/charsets", base_dir); - -#ifdef HAVE_OPENSSL - use_openssl = TRUE; -#endif // HAVE_OPENSSL - - // OpenSSL paths - snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir); - snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir); - snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir); - snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir); - snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir); - - // setup files - snprintf(mysqld_file, PATH_MAX, "%s/mysqld", bin_dir); - snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest", bin_dir); - snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir); - snprintf(master_pid, PATH_MAX, "%s/var/run/master.pid", mysql_test_dir); - snprintf(slave_pid, PATH_MAX, "%s/var/run/slave.pid", mysql_test_dir); - - // create log file - snprintf(temp, PATH_MAX, "%s/mysql-test-run.log", mysql_test_dir); - if ((log_fd = fopen(temp, "w+")) == NULL) - { - log_errno("Unable to create log file."); - } - - // prepare skip test list - while((p = strchr(skip_test, ',')) != NULL) *p = ' '; - strcpy(temp, strlwr(skip_test)); - snprintf(skip_test, PATH_MAX, " %s ", temp); - - // environment - setenv("MYSQL_TEST_DIR", mysql_test_dir, 1); - snprintf(file_path, PATH_MAX*2, "%s/mysqldump --no-defaults -u root --port=%u", bin_dir, master_port); - setenv("MYSQL_DUMP", file_path, 1); - snprintf(file_path, PATH_MAX*2, "%s/mysqlbinlog --no-defaults --local-load=%s", bin_dir, mysql_tmp_dir); - setenv("MYSQL_BINLOG", file_path, 1); - setenv("MASTER_MYPORT", "9306", 1); - setenv("SLAVE_MYPORT", "9307", 1); - snprintf(file_path, PATH_MAX*2, "%d", MYSQL_PORT); - setenv("MYSQL_TCP_PORT", file_path, 1); - snprintf(file_path, PATH_MAX*2, "%s/mysql_client_test --no-defaults --testcase--user=root --port=%u ", bin_dir, master_port); - setenv("MYSQL_CLIENT_TEST",file_path,1); - snprintf(file_path, PATH_MAX*2, "%s/mysql --no-defaults --user=root --port=%u ", bin_dir, master_port); - setenv("MYSQL",file_path,1); - snprintf(file_path, PATH_MAX*2, "%s/mysqlshow --no-defaults --user=root --port=%u", bin_dir, master_port); - setenv("MYSQL_SHOW",file_path,1); - snprintf(file_path, PATH_MAX*2, "%s/mysqlcheck --no-defaults -uroot --port=%u", bin_dir, master_port); - setenv("MYSQL_CHECK",file_path,1); - -} - -/****************************************************************************** - - main() - -******************************************************************************/ -int main(int argc, char **argv) -{ - int is_ignore_list= 0, autoclose= 0, individual_execution= 0; - // setup - setup(argv[0]); - - /* The --ignore option is comma saperated list of test cases to skip and - should be very first command line option to the test suite. - - The usage is now: - mysql_test_run --ignore=test1,test2 test3 test4 - where test1 and test2 are test cases to ignore - and test3 and test4 are test cases to run. - */ - if (argc >= 2 && !strnicmp(argv[1], "--ignore=", sizeof("--ignore=")-1)) - { - char *temp, *token; - temp= strdup(strchr(argv[1],'=') + 1); - for (token=str_tok(temp, ","); token != NULL; token=str_tok(NULL, ",")) - { - if (strlen(ignore_test) + strlen(token) + 2 <= PATH_MAX-1) - sprintf(ignore_test+strlen(ignore_test), " %s ", token); - else - { - free(temp); - die("ignore list too long."); - } - } - free(temp); - is_ignore_list = 1; - } - // header - log_msg("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE); - - log_msg("Initializing Tests...\n"); - - // install test databases - mysql_install_db(); - - log_msg("Starting Tests...\n"); - - log_msg("\n"); - log_msg(HEADER); - log_msg(DASH); - - if ( argc > 1 + is_ignore_list ) - { - int i; - - for (i = 1 + is_ignore_list; i < argc; i++) - { - if (!strncasecmp(argv[i], "--autoclose", 11)) - { - autoclose= 1; - continue; - } - // single test - single_test= TRUE; - individual_execution= 1; - - // run given test - run_test(argv[i]); - } - } - if (!individual_execution) - { - // run all tests - DIR *dir = opendir(test_dir); - DIR *entry; - char test[NAME_MAX]; - char *p; - - // single test - single_test = FALSE; - - if (dir == NULL) - { - die("Unable to open tests directory."); - } - - while((entry = readdir(dir)) != NULL) - { - if (!S_ISDIR(entry->d_type)) - { - strcpy(test, strlwr(entry->d_name)); - - // find the test suffix - if ((p = strindex(test, TEST_SUFFIX)) != NULL) - { - // null terminate at the suffix - *p = '\0'; - - // run test - run_test(test); - } - } - } - - closedir(dir); - } - - // stop server - mysql_stop(); - - log_msg(DASH); - log_msg("\n"); - - log_msg("Ending Tests...\n"); - - // report stats - report_stats(); - - // close log - if (log_fd) fclose(log_fd); - - // keep results up - if (!autoclose) - pressanykey(); - - return 0; -} - -/* - Synopsis: - This function breaks the string into a sequence of tokens. The difference - between this function and strtok is that it respects the quoted string i.e. - it skips any delimiter character within the quoted part of the string. - It return tokens by eliminating quote character. It modifies the input string - passed. It will work with whitespace delimeter but may not work properly with - other delimeter. If the delimeter will contain any quote character, then - function will not tokenize and will return null string. - e.g. if input string is - --init-slave="set global max_connections=500" --skip-external-locking - then the output will two string i.e. - --init-slave=set global max_connections=500 - --skip-external-locking - -Arguments: - string: input string - delim: set of delimiter character -Output: - return the null terminated token of NULL. -*/ - - -char *str_tok(char *string, const char *delim) -{ - char *token; /* current token received from strtok */ - char *qt_token; /* token delimeted by the matching pair of quote */ - /* - if there are any quote chars found in the token then this variable - will hold the concatenated string to return to the caller - */ - char *ptr_token=NULL; - /* pointer to the quote character in the token from strtok */ - char *ptr_quote=NULL; - - /* See if the delimeter contains any quote character */ - if (strchr(delim,'\'') || strchr(delim,'\"')) - return NULL; - - /* repeate till we are getting some token from strtok */ - while ((token = (char*)strtok(string, delim) ) != NULL) - { - /* - make the input string NULL so that next time onward strtok can - be called with NULL input string. - */ - string = NULL; - - /* check if the current token contain double quote character*/ - if ((ptr_quote = (char*)strchr(token,'\"')) != NULL) - { - /* - get the matching the matching double quote in the remaining - input string - */ - qt_token = (char*)strtok(NULL,"\""); - } - /* check if the current token contain single quote character*/ - else if ((ptr_quote = (char*)strchr(token,'\'')) != NULL) - { - /* - get the matching the matching single quote in the remaining - input string - */ - qt_token = (char*)strtok(NULL,"\'"); - } - - /* - if the current token does not contains any quote character then - return to the caller. - */ - if (ptr_quote == NULL) - { - /* - if there is any earlier token i.e. ptr_token then append the - current token in it and return it else return the current - token directly - */ - return ptr_token ? strcat(ptr_token,token) : token; - } - - /* - remove the quote character i.e. make NULL so that the token will - be devided in two part and later both part can be concatenated - and hence quote will be removed - */ - *ptr_quote= 0; - - /* check if ptr_token has been initialized or not */ - if (ptr_token == NULL) - { - /* initialize the ptr_token with current token */ - ptr_token= token; - /* copy entire string between matching pair of quote*/ - sprintf(ptr_token+strlen(ptr_token),"%s %s", ptr_quote+1, qt_token); - } - else - { - /* - copy the current token and entire string between matching pair - of quote - */ - sprintf(ptr_token+strlen(ptr_token),"%s%s %s", token, ptr_quote+1, - qt_token ); - } - } - - /* return the concatenated token */ - return ptr_token; -} diff --git a/netware/mysql_test_run.def b/netware/mysql_test_run.def deleted file mode 100644 index c8afd305978..00000000000 --- a/netware/mysql_test_run.def +++ /dev/null @@ -1,11 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Test Run -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Test Run" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Test Run" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG diff --git a/netware/mysql_upgrade.def b/netware/mysql_upgrade.def deleted file mode 100644 index 7b5718ffb1b..00000000000 --- a/netware/mysql_upgrade.def +++ /dev/null @@ -1,11 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Admin -#------------------------------------------------------------------------------ -MODULE libc.nlm -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Upgrade Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysql_waitpid.def b/netware/mysql_waitpid.def deleted file mode 100644 index 6e9cc76f139..00000000000 --- a/netware/mysql_waitpid.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# Wait for a Program to Terminate -#------------------------------------------------------------------------------ -MODULE libc.nlm -#SCREENNAME "MySQL Tool - Wait for a Program to Terminate" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Tool - Wait for a Program to Terminate" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysqladmin.def b/netware/mysqladmin.def deleted file mode 100644 index 03f15dfdd08..00000000000 --- a/netware/mysqladmin.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Admin -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Admin[scrollable]" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Admin Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysqlbinlog.def b/netware/mysqlbinlog.def deleted file mode 100644 index 88024acc318..00000000000 --- a/netware/mysqlbinlog.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Binary Log -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Binary Log Dump Tool[scrollable]" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Binary Log Dump Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysqlcheck.def b/netware/mysqlcheck.def deleted file mode 100644 index b9028c237d1..00000000000 --- a/netware/mysqlcheck.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Client -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Check Tool[scrollable]" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Check Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysqld.def b/netware/mysqld.def deleted file mode 100644 index bb7b8129983..00000000000 --- a/netware/mysqld.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Server -#------------------------------------------------------------------------------ -MODULE libc.nlm -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Database Server" -VERSION 4, 0 -MULTIPLE -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysqld_safe.c b/netware/mysqld_safe.c deleted file mode 100644 index 2a4268d63ef..00000000000 --- a/netware/mysqld_safe.c +++ /dev/null @@ -1,726 +0,0 @@ -/* - Copyright (c) 2003 Novell, Inc. 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; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "my_config.h" -#include "my_manage.h" -#include "mysql_version.h" - -/****************************************************************************** - - global variables - -******************************************************************************/ -char autoclose; -char basedir[PATH_MAX]; -char checktables; -char datadir[PATH_MAX]; -char pid_file[PATH_MAX]; -char address[PATH_MAX]; -char port[PATH_MAX]; -char err_log[PATH_MAX]; -char safe_log[PATH_MAX]; -char mysqld[PATH_MAX]; -char hostname[PATH_MAX]; -char default_option[PATH_MAX]; - -FILE *log_fd= NULL; - -/****************************************************************************** - - prototypes - -******************************************************************************/ - -void usage(void); -void vlog(char *, va_list); -void log(char *, ...); -void start_defaults(int, char *[]); -void finish_defaults(); -void read_defaults(arg_list_t *); -void parse_args(int, char *[]); -void get_options(int, char *[]); -void check_data_vol(); -void check_setup(); -void check_tables(); -void mysql_start(int, char *[]); - -/****************************************************************************** - - functions - -******************************************************************************/ - -/****************************************************************************** - - usage() - - Show usage. - -******************************************************************************/ -void usage(void) -{ - // keep the screen up - setscreenmode(SCR_NO_MODE); - - puts("\ -\n\ -usage: mysqld_safe [options]\n\ -\n\ -Program to start the MySQL daemon and restart it if it dies unexpectedly.\n\ -All options, besides those listed below, are passed on to the MySQL daemon.\n\ -\n\ -options:\n\ -\n\ ---autoclose Automatically close the mysqld_safe screen.\n\ -\n\ ---check-tables Check the tables before starting the MySQL daemon.\n\ -\n\ ---err-log= Send the MySQL daemon error output to .\n\ -\n\ ---help Show this help information.\n\ -\n\ ---mysqld= Use the MySQL daemon.\n\ -\n\ - "); - - exit(-1); -} - -/****************************************************************************** - - vlog() - - Log the message. - -******************************************************************************/ -void vlog(char *format, va_list ap) -{ - vfprintf(stdout, format, ap); - fflush(stdout); - - if (log_fd) - { - vfprintf(log_fd, format, ap); - fflush(log_fd); - } -} - -/****************************************************************************** - - log() - - Log the message. - -******************************************************************************/ -void log(char *format, ...) -{ - va_list ap; - - va_start(ap, format); - - vlog(format, ap); - - va_end(ap); -} - -/****************************************************************************** - - start_defaults() - - Start setting the defaults. - -******************************************************************************/ -void start_defaults(int argc, char *argv[]) -{ - struct stat buf; - int i; - - // default options - static char *default_options[]= - { - "--no-defaults", - "--defaults-file=", - "--defaults-extra-file=", - NULL - }; - - // autoclose - autoclose= FALSE; - - // basedir - get_basedir(argv[0], basedir); - - // check-tables - checktables= FALSE; - - // hostname - if (gethostname(hostname, PATH_MAX) < 0) - { - // default - strcpy(hostname, "mysql"); - } - - // address - snprintf(address, PATH_MAX, "0.0.0.0"); - - // port - snprintf(port, PATH_MAX, "%d", MYSQL_PORT); - - // default option - default_option[0]= NULL; - for (i= 0; (argc > 1) && default_options[i]; i++) - { - if (!strnicmp(argv[1], default_options[i], strlen(default_options[i]))) - { - strncpy(default_option, argv[1], PATH_MAX); - break; - } - } - - // set after basedir is established - datadir[0]= NULL; - pid_file[0]= NULL; - err_log[0]= NULL; - safe_log[0]= NULL; - mysqld[0]= NULL; -} - -/****************************************************************************** - - finish_defaults() - - Finish settig the defaults. - -******************************************************************************/ -void finish_defaults() -{ - struct stat buf; - int i; - - // datadir - if (!datadir[0]) - snprintf(datadir, PATH_MAX, "%s/data", basedir); - - // pid-file - if (!pid_file[0]) - snprintf(pid_file, PATH_MAX, "%s/%s.pid", datadir, hostname); - - // err-log - if (!err_log[0]) - snprintf(err_log, PATH_MAX, "%s/%s.err", datadir, hostname); - - // safe-log - if (!safe_log[0]) - snprintf(safe_log, PATH_MAX, "%s/%s.safe", datadir, hostname); - - // mysqld - if (!mysqld[0]) - snprintf(mysqld, PATH_MAX, "%s/bin/mysqld-max", basedir); - - if (stat(mysqld, &buf)) - { - snprintf(mysqld, PATH_MAX, "%s/bin/mysqld", basedir); - } -} - -/****************************************************************************** - - read_defaults() - - Read the defaults. - -******************************************************************************/ -void read_defaults(arg_list_t *pal) -{ - arg_list_t al; - char defaults_file[PATH_MAX]; - char mydefaults[PATH_MAX]; - char line[PATH_MAX]; - FILE *fp; - - // defaults output file - snprintf(defaults_file, PATH_MAX, "%s/bin/defaults.out", basedir); - remove(defaults_file); - - // mysqladmin file - snprintf(mydefaults, PATH_MAX, "%s/bin/my_print_defaults", basedir); - - // args - init_args(&al); - add_arg(&al, mydefaults); - if (default_option[0]) - add_arg(&al, default_option); - add_arg(&al, "mysqld"); - add_arg(&al, "server"); - add_arg(&al, "mysqld_safe"); - add_arg(&al, "safe_mysqld"); - - spawn(mydefaults, &al, TRUE, NULL, defaults_file, NULL); - - free_args(&al); - - // gather defaults - if ((fp= fopen(defaults_file, "r")) != NULL) - { - while (fgets(line, PATH_MAX, fp)) - { - char *p; - - // remove end-of-line character - if ((p= strrchr(line, '\n')) != NULL) - *p= '\0'; - - // add the option as an argument - add_arg(pal, line); - } - - fclose(fp); - } - - // remove file - remove(defaults_file); -} - -/****************************************************************************** - - parse_args() - - Get the options. - -******************************************************************************/ -void parse_args(int argc, char *argv[]) -{ - int index= 0; - int c; - - // parse options - enum opts - { - OPT_BASEDIR= 0xFF, - OPT_DATADIR, - OPT_PID_FILE, - OPT_BIND_ADDRESS, - OPT_PORT, - OPT_ERR_LOG, - OPT_SAFE_LOG, - OPT_MYSQLD, - OPT_HELP - }; - - static struct option options[]= - { - {"autoclose", no_argument, &autoclose, TRUE}, - {"basedir", required_argument, 0, OPT_BASEDIR}, - {"check-tables", no_argument, &checktables, TRUE}, - {"datadir", required_argument, 0, OPT_DATADIR}, - {"pid-file", required_argument, 0, OPT_PID_FILE}, - {"bind-address", required_argument, 0, OPT_BIND_ADDRESS}, - {"port", required_argument, 0, OPT_PORT}, - {"err-log", required_argument, 0, OPT_ERR_LOG}, - {"safe-log", required_argument, 0, OPT_SAFE_LOG}, - {"mysqld", required_argument, 0, OPT_MYSQLD}, - {"help", no_argument, 0, OPT_HELP}, - {0, 0, 0, 0} - }; - - // we have to reset getopt_long because we use it multiple times - optind= 1; - - // turn off error reporting - opterr= 0; - - while ((c= getopt_long(argc, argv, "b:h:P:", options, &index)) >= 0) - { - switch (c) { - case OPT_BASEDIR: - case 'b': - strcpy(basedir, optarg); - break; - - case OPT_DATADIR: - case 'h': - strcpy(datadir, optarg); - break; - - case OPT_PID_FILE: - strcpy(pid_file, optarg); - break; - - case OPT_BIND_ADDRESS: - strcpy(address, optarg); - break; - - case OPT_PORT: - case 'P': - strcpy(port, optarg); - break; - - case OPT_ERR_LOG: - strcpy(err_log, optarg); - break; - - case OPT_SAFE_LOG: - strcpy(safe_log, optarg); - break; - - case OPT_MYSQLD: - strcpy(mysqld, optarg); - break; - - case OPT_HELP: - usage(); - break; - - default: - // ignore - break; - } - } -} - - -/****************************************************************************** - - - -/****************************************************************************** - - get_options() - - Get the options. - -******************************************************************************/ -void get_options(int argc, char *argv[]) -{ - arg_list_t al; - - // start defaults - start_defaults(argc, argv); - - // default file arguments - init_args(&al); - add_arg(&al, "ignore"); - read_defaults(&al); - parse_args(al.argc, al.argv); - free_args(&al); - - // command-line arguments - parse_args(argc, argv); - - // finish defaults - finish_defaults(); -} - -/****************************************************************************** - - check_data_vol() - - Check the database volume. - -******************************************************************************/ -void check_data_vol() -{ - // warn if the data is on a Traditional volume - struct volume_info vol; - char buff[PATH_MAX]; - char *p; - - // clear struct - memset(&vol, 0, sizeof(vol)); - - // find volume name - strcpy(buff, datadir); - if (p= strchr(buff, ':')) - { - // terminate after volume name - *p= 0; - } - else - { - // assume SYS volume - strcpy(buff, "SYS"); - } - - // retrieve information - netware_vol_info_from_name(&vol, buff); - - if ((vol.flags & VOL_NSS_PRESENT) == 0) - { - log("Error: Either the data directory does not exist or is not on an NSS volume!\n\n"); - exit(-1); - } -} - -/****************************************************************************** - - check_setup() - - Check the current setup. - -******************************************************************************/ -void check_setup() -{ - struct stat info; - char temp[PATH_MAX]; - - // remove any current pid_file - if (!stat(pid_file, &info) && (remove(pid_file) < 0)) - { - log("ERROR: Unable to remove current pid file!\n\n"); - exit(-1); - } - - // check the data volume - check_data_vol(); - - // check for a database - snprintf(temp, PATH_MAX, "%s/mysql/host.frm", datadir); - if (stat(temp, &info)) - { - log("ERROR: No database found in the data directory!\n\n"); - exit(-1); - } -} - -/****************************************************************************** - - check_tables() - - Check the database tables. - -******************************************************************************/ -void check_tables() -{ - arg_list_t al; - char mycheck[PATH_MAX]; - char table[PATH_MAX]; - char db[PATH_MAX]; - DIR *datadir_entry, *db_entry, *table_entry; - - // status - log("checking tables...\n"); - - // list databases - if ((datadir_entry= opendir(datadir)) == NULL) - { - return; - } - - while ((db_entry= readdir(datadir_entry)) != NULL) - { - if (db_entry->d_name[0] == '.') - { - // Skip - } - else if (S_ISDIR(db_entry->d_type)) - { - // create long db name - snprintf(db, PATH_MAX, "%s/%s", datadir, db_entry->d_name); - - // list tables - if ((db_entry= opendir(db)) == NULL) - { - continue; - } - - while ((table_entry= readdir(db_entry)) != NULL) - { - // create long table name - snprintf(table, PATH_MAX, "%s/%s", db, strlwr(table_entry->d_name)); - - if (strindex(table, ".myi")) - { - // ** myisamchk - - // mysqladmin file - snprintf(mycheck, PATH_MAX, "%s/bin/myisamchk", basedir); - - // args - init_args(&al); - add_arg(&al, mycheck); - add_arg(&al, "--silent"); - add_arg(&al, "--force"); - add_arg(&al, "--fast"); - add_arg(&al, "--medium-check"); - add_arg(&al, "--key_buffer=64M"); - add_arg(&al, "--sort_buffer=64M"); - add_arg(&al, table); - - spawn(mycheck, &al, TRUE, NULL, NULL, NULL); - - free_args(&al); - } - else if (strindex(table, ".ism")) - { - // ** isamchk - - // mysqladmin file - snprintf(mycheck, PATH_MAX, "%s/bin/isamchk", basedir); - - // args - init_args(&al); - add_arg(&al, mycheck); - add_arg(&al, "--silent"); - add_arg(&al, "--force"); - add_arg(&al, "--sort_buffer=64M"); - add_arg(&al, table); - - spawn(mycheck, &al, TRUE, NULL, NULL, NULL); - - free_args(&al); - } - } - } - } -} - -/****************************************************************************** - - mysql_start() - - Start the mysql server. - -******************************************************************************/ -void mysql_start(int argc, char *argv[]) -{ - arg_list_t al; - int i, j, err; - struct stat info; - time_t cal; - struct tm lt; - char stamp[PATH_MAX]; - char skip; - - // private options - static char *private_options[]= - { - "--autoclose", - "--check-tables", - "--help", - "--err-log=", - "--mysqld=", - NULL - }; - - // args - init_args(&al); - add_arg(&al, "%s", mysqld); - - // parent args - for (i= 1; i < argc; i++) - { - skip= FALSE; - - // skip private arguments - for (j= 0; private_options[j]; j++) - { - if (!strnicmp(argv[i], private_options[j], strlen(private_options[j]))) - { - skip= TRUE; - break; - } - } - - if (!skip) - { - add_arg(&al, "%s", argv[i]); - } - } - // spawn - do - { - // check the database tables - if (checktables) - check_tables(); - - // status - time(&cal); - localtime_r(&cal, <); - strftime(stamp, PATH_MAX, "%d %b %Y %H:%M:%S", <); - log("mysql started : %s\n", stamp); - - // spawn mysqld - spawn(mysqld, &al, TRUE, NULL, NULL, err_log); - } - while (!stat(pid_file, &info)); - - // status - time(&cal); - localtime_r(&cal, <); - strftime(stamp, PATH_MAX, "%d %b %Y %H:%M:%S", <); - log("mysql stopped : %s\n\n", stamp); - - // free args - free_args(&al); -} - -/****************************************************************************** - - main() - -******************************************************************************/ -int main(int argc, char **argv) -{ - char temp[PATH_MAX]; - - // get the options - get_options(argc, argv); - - // keep the screen up - if (!autoclose) - setscreenmode(SCR_NO_MODE); - - // create log file - log_fd= fopen(safe_log, "w+"); - - // header - log("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE); - - // status - log("address : %s\n", address); - log("port : %s\n", port); - log("daemon : %s\n", mysqld); - log("base directory : %s\n", basedir); - log("data directory : %s\n", datadir); - log("pid file : %s\n", pid_file); - log("error file : %s\n", err_log); - log("log file : %s\n", safe_log); - log("\n"); - - // check setup - check_setup(); - - // start the MySQL server - mysql_start(argc, argv); - - // close log file - if (log_fd) - fclose(log_fd); - - return 0; -} diff --git a/netware/mysqld_safe.def b/netware/mysqld_safe.def deleted file mode 100644 index 5c436cc97ca..00000000000 --- a/netware/mysqld_safe.def +++ /dev/null @@ -1,13 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQLd Safe -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Database Server" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Database Server Monitor" -VERSION 4, 0 -STACKSIZE 131072 -MULTIPLE -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysqldump.def b/netware/mysqldump.def deleted file mode 100644 index 2e745492cf3..00000000000 --- a/netware/mysqldump.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Admin -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Dump Tool[scrollable]" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Dump Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysqlimport.def b/netware/mysqlimport.def deleted file mode 100644 index 5db6b940ce7..00000000000 --- a/netware/mysqlimport.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Client -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Import[scrollable]" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Import Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysqlshow.def b/netware/mysqlshow.def deleted file mode 100644 index 386cb98c091..00000000000 --- a/netware/mysqlshow.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Show -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Show[scrollable]" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Show Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysqlslap.def b/netware/mysqlslap.def deleted file mode 100644 index be10f9db192..00000000000 --- a/netware/mysqlslap.def +++ /dev/null @@ -1,11 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Slap -#------------------------------------------------------------------------------ -MODULE libc.nlm -SCREENNAME "MySQL Slap[scrollable]" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Slap Tool" -VERSION 4, 0 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/mysqltest.def b/netware/mysqltest.def deleted file mode 100644 index f0ee5f7e6a4..00000000000 --- a/netware/mysqltest.def +++ /dev/null @@ -1,11 +0,0 @@ -#------------------------------------------------------------------------------ -# MySQL Admin -#------------------------------------------------------------------------------ -MODULE libc.nlm -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Test Case Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/perror.def b/netware/perror.def deleted file mode 100644 index fc95de3476a..00000000000 --- a/netware/perror.def +++ /dev/null @@ -1,11 +0,0 @@ -#------------------------------------------------------------------------------ -# PERROR -#------------------------------------------------------------------------------ -MODULE libc.nlm -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Error Code Description Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/replace.def b/netware/replace.def deleted file mode 100644 index 7feccdbff41..00000000000 --- a/netware/replace.def +++ /dev/null @@ -1,11 +0,0 @@ -#------------------------------------------------------------------------------ -# Replace -#------------------------------------------------------------------------------ -MODULE libc.nlm -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Text Replacement Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/resolve_stack_dump.def b/netware/resolve_stack_dump.def deleted file mode 100644 index 20098c1b4e0..00000000000 --- a/netware/resolve_stack_dump.def +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# Resolve Stack Dump -#------------------------------------------------------------------------------ -MODULE libc.nlm -#SCREENNAME "MySQL Stack Dump Resolve Tool" -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Stack Dump Resolve Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/resolveip.def b/netware/resolveip.def deleted file mode 100644 index 1962d61be53..00000000000 --- a/netware/resolveip.def +++ /dev/null @@ -1,11 +0,0 @@ -#------------------------------------------------------------------------------ -# Resolve IP -#------------------------------------------------------------------------------ -MODULE libc.nlm -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL IP/Hostname Resolve Tool" -VERSION 4, 0 -STACKSIZE 131072 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/netware/static_init_db.sql b/netware/static_init_db.sql deleted file mode 100644 index e9fb92f4a97..00000000000 --- a/netware/static_init_db.sql +++ /dev/null @@ -1,34 +0,0 @@ -CREATE DATABASE mysql; -CREATE DATABASE test; - -USE mysql; - -CREATE TABLE db (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User)) comment='Database privileges'; - -INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y'); -INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y'); - -CREATE TABLE host (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db)) comment='Host privileges; Merged with database privileges'; - -CREATE TABLE user (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') DEFAULT 'N' NOT NULL, File_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User)) comment='Users and global privileges'; - -INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); -INSERT INTO user VALUES ('','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); - -INSERT INTO user (host,user) values ('localhost',''); -INSERT INTO user (host,user) values ('',''); - -CREATE TABLE func (name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') NOT NULL, PRIMARY KEY (name)) comment='User defined functions'; - -CREATE TABLE tables_priv (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor)) comment='Table privileges'; - -CREATE TABLE columns_priv (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name)) comment='Column privileges'; - - -CREATE TABLE help_topic (help_topic_id int unsigned NOT NULL, name varchar(64) NOT NULL, help_category_id smallint unsigned NOT NULL, description text NOT NULL, example text NOT NULL, url varchar(128) NOT NULL, primary key (help_topic_id), unique index (name))comment='help topics'; - -CREATE TABLE help_category (help_category_id smallint unsigned NOT NULL, name varchar(64) NOT NULL, parent_category_id smallint unsigned null, url varchar(128) NOT NULL, primary key (help_category_id), unique index (name)) comment='help categories'; - -CREATE TABLE help_keyword (help_keyword_id int unsigned NOT NULL, name varchar(64) NOT NULL, primary key (help_keyword_id), unique index (name)) comment='help keywords'; - -CREATE TABLE help_relation (help_topic_id int unsigned NOT NULL references help_topic, help_keyword_id int unsigned NOT NULL references help_keyword, primary key (help_keyword_id, help_topic_id)) comment='keyword-topic relation'; diff --git a/plugin/daemon_example/Makefile.am b/plugin/daemon_example/Makefile.am index 75151bdd4d9..d60271521b3 100644 --- a/plugin/daemon_example/Makefile.am +++ b/plugin/daemon_example/Makefile.am @@ -28,14 +28,14 @@ EXTRA_LTLIBRARIES = libdaemon_example.la pkgplugin_LTLIBRARIES = @plugin_daemon_example_shared_target@ libdaemon_example_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices -libdaemon_example_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +libdaemon_example_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN libdaemon_example_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN libdaemon_example_la_SOURCES = daemon_example.cc EXTRA_LIBRARIES = libdaemon_example.a noinst_LIBRARIES = @plugin_daemon_example_static_target@ -libdaemon_example_a_CXXFLAGS = $(AM_CFLAGS) +libdaemon_example_a_CXXFLAGS = $(AM_CXXFLAGS) libdaemon_example_a_CFLAGS = $(AM_CFLAGS) libdaemon_example_a_SOURCES= daemon_example.cc EXTRA_DIST = CMakeLists.txt diff --git a/plugin/semisync/Makefile.am b/plugin/semisync/Makefile.am index 0022d600f57..ec1ecee46a2 100644 --- a/plugin/semisync/Makefile.am +++ b/plugin/semisync/Makefile.am @@ -26,12 +26,12 @@ noinst_HEADERS = semisync.h semisync_master.h semisync_slave.h pkgplugin_LTLIBRARIES = semisync_master.la semisync_slave.la semisync_master_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices -semisync_master_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +semisync_master_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN semisync_master_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN semisync_master_la_SOURCES = semisync.cc semisync_master.cc semisync_master_plugin.cc semisync_slave_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices -semisync_slave_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +semisync_slave_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN semisync_slave_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN semisync_slave_la_SOURCES = semisync.cc semisync_slave.cc semisync_slave_plugin.cc diff --git a/regex/CMakeLists.txt b/regex/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/regex/regcomp.c b/regex/regcomp.c index b203d4941e1..81c435ed552 100644 --- a/regex/regcomp.c +++ b/regex/regcomp.c @@ -690,7 +690,6 @@ register cset *cs; case '-': SETERROR(REG_ERANGE); return; /* NOTE RETURN */ - break; default: c = '\0'; break; @@ -1564,13 +1563,13 @@ struct parse *p; register struct re_guts *g; { register sop *scan; - sop *start; - register sop *newstart; + sop *UNINIT_VAR(start); + register sop *UNINIT_VAR(newstart); register sopno newlen; register sop s; register char *cp; register sopno i; - LINT_INIT(start); LINT_INIT(newstart); + /* avoid making error situations worse */ if (p->error != 0) return; diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt old mode 100755 new mode 100644 index 84472c3a5c3..be25386c68f --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -91,16 +91,18 @@ ENDIF() IF(CMAKE_GENERATOR MATCHES "Makefiles") # No multiconfig build - use CMAKE_C_FLAGS - SET(CFLAGS "@CMAKE_C_FLAGS@") - SET(CXXFLAGS "@CMAKE_CXX_FLAGS@") + # Strip maintainer mode options if necessary + STRING(REPLACE "${MY_MAINTAINER_C_WARNINGS}" "" CFLAGS "${CMAKE_C_FLAGS}") + STRING(REPLACE "${MY_MAINTAINER_CXX_WARNINGS}" "" CXXFLAGS "${CMAKE_CXX_FLAGS}") FOREACH(ARCH ${CMAKE_OSX_ARCHITECTURES}) SET(CFLAGS "${CFLAGS} -arch ${ARCH}") SET(CXXFLAGS "${CXXFLAGS} -arch ${ARCH}") ENDFOREACH() ELSE() # Multiconfig build - use CMAKE_C_FLAGS_RELWITHDEBINFO - SET(CFLAGS "@CMAKE_C_FLAGS_RELWITHDEBINFO@") - SET(CXXFLAGS "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@") + # Strip maintainer mode options if necessary + STRING(REPLACE "${MY_MAINTAINER_C_WARNINGS}" "" CFLAGS "${CMAKE_C_FLAGS_RELWITHDEBINFO}") + STRING(REPLACE "${MY_MAINTAINER_CXX_WARNINGS}" "" CXXFLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") ENDIF() IF(UNIX) diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index aed758da620..951699317fd 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -162,10 +162,6 @@ fi # Print the platform name for build logs echo "PLATFORM NAME: $PLATFORM" -case $PLATFORM in - *netware*) BASE_SYSTEM="netware" ;; -esac - # Change the distribution to a long descriptive name # For the cluster product, concentrate on the second part VERSION_NAME=@VERSION@ @@ -226,318 +222,121 @@ fi # ############################################################################## -if [ x"$BASE_SYSTEM" != x"netware" ] ; then +# ---------------------------------------------------------------------- +# Terminate on any base level error +# ---------------------------------------------------------------------- +set -e - # ---------------------------------------------------------------------- - # Terminate on any base level error - # ---------------------------------------------------------------------- - set -e +# ---------------------------------------------------------------------- +# Really ugly, one script, "mysql_install_db", needs prefix set to ".", +# i.e. makes access relative the current directory. This matches +# the documentation, so better not change this. And for another script, +# "mysql.server", we make some relative, others not. +# ---------------------------------------------------------------------- - # ---------------------------------------------------------------------- - # Really ugly, one script, "mysql_install_db", needs prefix set to ".", - # i.e. makes access relative the current directory. This matches - # the documentation, so better not change this. And for another script, - # "mysql.server", we make some relative, others not. - # ---------------------------------------------------------------------- +cd scripts +rm -f mysql_install_db +@MAKE@ mysql_install_db \ + prefix=. \ + bindir=./bin \ + sbindir=./bin \ + scriptdir=./bin \ + libexecdir=./bin \ + pkgdatadir=./share \ + localstatedir=./data +cd .. - cd scripts - rm -f mysql_install_db - @MAKE@ mysql_install_db \ - prefix=. \ - bindir=./bin \ - sbindir=./bin \ - scriptdir=./bin \ - libexecdir=./bin \ - pkgdatadir=./share \ - localstatedir=./data - cd .. +cd support-files +rm -f mysql.server +@MAKE@ mysql.server \ + bindir=./bin \ + sbindir=./bin \ + scriptdir=./bin \ + libexecdir=./bin \ + pkgdatadir=@pkgdatadir@ +cd .. - cd support-files - rm -f mysql.server - @MAKE@ mysql.server \ - bindir=./bin \ - sbindir=./bin \ - scriptdir=./bin \ - libexecdir=./bin \ - pkgdatadir=@pkgdatadir@ - cd .. +# ---------------------------------------------------------------------- +# Do a install that we later are to pack. Use the same paths as in +# the build for the relevant directories. +# ---------------------------------------------------------------------- +@MAKE@ DESTDIR=$BASE install \ + pkglibdir=@pkglibdir@ \ + pkgincludedir=@pkgincludedir@ \ + pkgdatadir=@pkgdatadir@ \ + pkgplugindir=@pkgplugindir@ \ + pkgsuppdir=@pkgsuppdir@ \ + mandir=@mandir@ \ + infodir=@infodir@ - # ---------------------------------------------------------------------- - # Do a install that we later are to pack. Use the same paths as in - # the build for the relevant directories. - # ---------------------------------------------------------------------- - @MAKE@ DESTDIR=$BASE install \ - pkglibdir=@pkglibdir@ \ - pkgincludedir=@pkgincludedir@ \ - pkgdatadir=@pkgdatadir@ \ - pkgplugindir=@pkgplugindir@ \ - pkgsuppdir=@pkgsuppdir@ \ - mandir=@mandir@ \ - infodir=@infodir@ +# ---------------------------------------------------------------------- +# Rename top directory, and set DEST to the new directory +# ---------------------------------------------------------------------- +mv $BASE@prefix@ $BASE/$NEW_NAME +DEST=$BASE/$NEW_NAME - # ---------------------------------------------------------------------- - # Rename top directory, and set DEST to the new directory - # ---------------------------------------------------------------------- - mv $BASE@prefix@ $BASE/$NEW_NAME - DEST=$BASE/$NEW_NAME - - # ---------------------------------------------------------------------- - # If we compiled with gcc, copy libgcc.a to the dist as libmygcc.a - # ---------------------------------------------------------------------- - if [ x"@GXX@" = x"yes" ] ; then - gcclib=`@CC@ @CFLAGS@ --print-libgcc-file 2>/dev/null` || true - if [ -z "$gcclib" ] ; then - echo "Warning: Compiler doesn't tell libgcc.a!" - elif [ -f "$gcclib" ] ; then - $CP $gcclib $DEST/lib/libmygcc.a - else - echo "Warning: Compiler result '$gcclib' not found / no file!" - fi - fi - - # If requested, add a malloc library .so into pkglibdir for use - # by mysqld_safe - if [ -n "$MALLOC_LIB" ]; then - cp "$MALLOC_LIB" "$DEST/lib/" - fi - - # FIXME let this script be in "bin/", where it is in the RPMs? - # http://dev.mysql.com/doc/refman/5.1/en/mysql-install-db-problems.html - mkdir $DEST/scripts - mv $DEST/bin/mysql_install_db $DEST/scripts/ - - # Note, no legacy "safe_mysqld" link to "mysqld_safe" in 5.1 - - # Copy readme and license files - cp README Docs/INSTALL-BINARY $DEST/ - if [ -f COPYING -a -f EXCEPTIONS-CLIENT ] ; then - cp COPYING EXCEPTIONS-CLIENT $DEST/ - elif [ -f LICENSE.mysql ] ; then - cp LICENSE.mysql $DEST/ +# ---------------------------------------------------------------------- +# If we compiled with gcc, copy libgcc.a to the dist as libmygcc.a +# ---------------------------------------------------------------------- +if [ x"@GXX@" = x"yes" ] ; then + gcclib=`@CC@ @CFLAGS@ --print-libgcc-file 2>/dev/null` || true + if [ -z "$gcclib" ] ; then + echo "Warning: Compiler doesn't tell libgcc.a!" + elif [ -f "$gcclib" ] ; then + $CP $gcclib $DEST/lib/libmygcc.a else - echo "ERROR: no license files found" - exit 1 + echo "Warning: Compiler result '$gcclib' not found / no file!" fi - - # FIXME should be handled by make file, and to other dir - mkdir -p $DEST/bin $DEST/support-files - cp scripts/mysqlaccess.conf $DEST/bin/ - cp support-files/magic $DEST/support-files/ - - # Create empty data directories, set permission (FIXME why?) - mkdir $DEST/data $DEST/data/mysql $DEST/data/test - chmod o-rwx $DEST/data $DEST/data/mysql $DEST/data/test - - # ---------------------------------------------------------------------- - # Create the result tar file - # ---------------------------------------------------------------------- - - echo "Using $tar to create archive" - OPT=cvf - if [ x$SILENT = x1 ] ; then - OPT=cf - fi - - echo "Creating and compressing archive" - rm -f $NEW_NAME.tar.gz - (cd $BASE ; $tar $OPT - $NEW_NAME) | gzip -9 > $NEW_NAME.tar.gz - echo "$NEW_NAME.tar.gz created" - - echo "Removing temporary directory" - rm -rf $BASE - exit 0 fi - -############################################################################## -# -# Handle the Netware case, until integrated above -# -############################################################################## - -BS=".nlm" -MYSQL_SHARE=$BASE/share - -mkdir $BASE $BASE/bin $BASE/docs \ - $BASE/include $BASE/lib $BASE/support-files $BASE/share $BASE/scripts \ - $BASE/mysql-test $BASE/mysql-test/t $BASE/mysql-test/r \ - $BASE/mysql-test/include $BASE/mysql-test/std_data $BASE/mysql-test/lib \ - $BASE/mysql-test/suite - -# Copy files if they exists, warn for those that don't. -# Note that when listing files to copy, we might list the file name -# twice, once in the directory location where it is built, and a -# second time in the ".libs" location. In the case the first one -# is a wrapper script, the second one will overwrite it with the -# binary file. -copyfileto() -{ - destdir=$1 - shift - for i - do - if [ -f $i ] ; then - $CP $i $destdir - elif [ -d $i ] ; then - echo "Warning: Will not copy directory \"$i\"" - else - echo "Warning: Listed file not found \"$i\"" - fi - done -} - -copyfileto $BASE/docs ChangeLog Docs/mysql.info - -copyfileto $BASE COPYING COPYING.LIB README Docs/INSTALL-BINARY \ - EXCEPTIONS-CLIENT LICENSE.mysql - -# Non platform-specific bin dir files: -BIN_FILES="extra/comp_err$BS extra/replace$BS extra/perror$BS \ - extra/resolveip$BS extra/my_print_defaults$BS \ - extra/resolve_stack_dump$BS extra/mysql_waitpid$BS \ - storage/myisam/myisamchk$BS storage/myisam/myisampack$BS \ - storage/myisam/myisamlog$BS storage/myisam/myisam_ftdump$BS \ - sql/mysqld$BS sql/mysqld-debug$BS \ - sql/mysql_tzinfo_to_sql$BS \ - client/mysql$BS client/mysqlshow$BS client/mysqladmin$BS \ - client/mysqlslap$BS \ - client/mysqldump$BS client/mysqlimport$BS \ - client/mysqltest$BS client/mysqlcheck$BS \ - client/mysqlbinlog$BS client/mysql_upgrade$BS \ - tests/mysql_client_test$BS \ - libmysqld/examples/mysql_client_test_embedded$BS \ - libmysqld/examples/mysqltest_embedded$BS \ - "; - -# Platform-specific bin dir files: -BIN_FILES="$BIN_FILES \ - netware/mysqld_safe$BS netware/mysql_install_db$BS \ - netware/init_db.sql netware/test_db.sql \ - netware/mysqlhotcopy$BS netware/libmysql$BS netware/init_secure_db.sql \ - "; - -copyfileto $BASE/bin $BIN_FILES - -$CP netware/*.pl $BASE/scripts -$CP scripts/mysqlhotcopy $BASE/scripts/mysqlhotcopy.pl - -copyfileto $BASE/lib \ - libmysql/.libs/libmysqlclient.a \ - libmysql/.libs/libmysqlclient.so* \ - libmysql/.libs/libmysqlclient.sl* \ - libmysql/.libs/libmysqlclient*.dylib \ - libmysql/libmysqlclient.* \ - libmysql_r/.libs/libmysqlclient_r.a \ - libmysql_r/.libs/libmysqlclient_r.so* \ - libmysql_r/.libs/libmysqlclient_r.sl* \ - libmysql_r/.libs/libmysqlclient_r*.dylib \ - libmysql_r/libmysqlclient_r.* \ - libmysqld/.libs/libmysqld.a \ - libmysqld/.libs/libmysqld.so* \ - libmysqld/.libs/libmysqld.sl* \ - libmysqld/.libs/libmysqld*.dylib \ - mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a \ - libmysqld/libmysqld.a netware/libmysql.imp \ - zlib/.libs/libz.a - -# convert the .a to .lib for NetWare -for i in $BASE/lib/*.a -do - libname=`basename $i .a` - $MV $i $BASE/lib/$libname.lib -done -rm -f $BASE/lib/*.la - - -copyfileto $BASE/include config.h include/* - -rm -f $BASE/include/Makefile* $BASE/include/*.in $BASE/include/config-win.h - -# In a NetWare binary package, these tools and their manuals are not useful -rm -f $BASE/man/man1/make_win_* - -copyfileto $BASE/support-files support-files/* - -copyfileto $BASE/share scripts/*.sql - -$CP -r sql/share/* $MYSQL_SHARE -rm -f $MYSQL_SHARE/Makefile* $MYSQL_SHARE/*/*.OLD - -copyfileto $BASE/mysql-test \ - mysql-test/mysql-test-run mysql-test/install_test_db \ - mysql-test/mysql-test-run.pl mysql-test/README \ - mysql-test/mysql-stress-test.pl \ - mysql-test/valgrind.supp \ - netware/mysql_test_run.nlm netware/install_test_db.ncf - -$CP mysql-test/lib/*.pl $BASE/mysql-test/lib -$CP mysql-test/t/*.def $BASE/mysql-test/t -$CP mysql-test/include/*.inc $BASE/mysql-test/include -$CP mysql-test/include/*.sql $BASE/mysql-test/include -$CP mysql-test/include/*.test $BASE/mysql-test/include -$CP mysql-test/t/*.def $BASE/mysql-test/t -$CP mysql-test/std_data/*.dat mysql-test/std_data/*.frm \ - mysql-test/std_data/*.MYD mysql-test/std_data/*.MYI \ - mysql-test/std_data/*.pem mysql-test/std_data/Moscow_leap \ - mysql-test/std_data/Index.xml \ - mysql-test/std_data/des_key_file mysql-test/std_data/*.*001 \ - mysql-test/std_data/*.cnf mysql-test/std_data/*.MY* \ - $BASE/mysql-test/std_data -# Attention: when the wildcards expand to a line that is very long, -# it may exceed the command line length limit on some platform(s). Bug#54590 -$CP mysql-test/t/*.test mysql-test/t/*.imtest $BASE/mysql-test/t -$CP mysql-test/t/*.disabled mysql-test/t/*.opt $BASE/mysql-test/t -$CP mysql-test/t/*.slave-mi mysql-test/t/*.sh mysql-test/t/*.sql $BASE/mysql-test/t -$CP mysql-test/r/*.result mysql-test/r/*.require \ - $BASE/mysql-test/r - -# Copy the additional suites "as is", they are in flux -$tar cf - mysql-test/suite | ( cd $BASE ; $tar xf - ) -# Clean up if we did this from a bk tree -if [ -d mysql-test/SCCS ] ; then - find $BASE/mysql-test -name SCCS -print | xargs rm -rf +# If requested, add a malloc library .so into pkglibdir for use +# by mysqld_safe +if [ -n "$MALLOC_LIB" ]; then + cp "$MALLOC_LIB" "$DEST/lib/" fi -rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh \ - $BASE/bin/mysql_install_db $BASE/bin/make_binary_distribution \ - $BASE/bin/make_win_* \ - $BASE/bin/setsomevars $BASE/support-files/Makefile* \ - $BASE/support-files/*.sh +# FIXME let this script be in "bin/", where it is in the RPMs? +# http://dev.mysql.com/doc/refman/5.1/en/mysql-install-db-problems.html +mkdir $DEST/scripts +mv $DEST/bin/mysql_install_db $DEST/scripts/ -# -# Copy system dependent files -# -./scripts/fill_help_tables < ./Docs/manual.texi >> ./netware/init_db.sql +# Note, no legacy "safe_mysqld" link to "mysqld_safe" in 5.1 -# -# Remove system dependent files -# -rm -f $BASE/support-files/magic \ - $BASE/support-files/mysql.server \ - $BASE/support-files/mysql*.spec \ - $BASE/support-files/mysql-log-rotate \ - $BASE/support-files/binary-configure \ - $BASE/support-files/build-tags \ - $BASE/support-files/MySQL-shared-compat.spec \ - $BASE/INSTALL-BINARY - -# Clean up if we did this from a bk tree -if [ -d $BASE/sql-bench/SCCS ] ; then - find $BASE/share -name SCCS -print | xargs rm -rf - find $BASE/sql-bench -name SCCS -print | xargs rm -rf +# Copy readme and license files +cp README Docs/INSTALL-BINARY $DEST/ +if [ -f COPYING -a -f EXCEPTIONS-CLIENT ] ; then + cp COPYING EXCEPTIONS-CLIENT $DEST/ +elif [ -f LICENSE.mysql ] ; then + cp LICENSE.mysql $DEST/ +else + echo "ERROR: no license files found" + exit 1 fi -BASE2=$TMP/$NEW_NAME -rm -rf $BASE2 -mv $BASE $BASE2 -BASE=$BASE2 +# FIXME should be handled by make file, and to other dir +mkdir -p $DEST/bin $DEST/support-files +cp scripts/mysqlaccess.conf $DEST/bin/ +cp support-files/magic $DEST/support-files/ -# -# Create a zip file for NetWare users -# -rm -f $NEW_NAME.zip -(cd $TMP; zip -r "$SOURCE/$NEW_NAME.zip" $NEW_NAME) -echo "$NEW_NAME.zip created" +# Create empty data directories, set permission (FIXME why?) +mkdir $DEST/data $DEST/data/mysql $DEST/data/test +chmod o-rwx $DEST/data $DEST/data/mysql $DEST/data/test + +# ---------------------------------------------------------------------- +# Create the result tar file +# ---------------------------------------------------------------------- + +echo "Using $tar to create archive" +OPT=cvf +if [ x$SILENT = x1 ] ; then + OPT=cf +fi + +echo "Creating and compressing archive" +rm -f $NEW_NAME.tar.gz +(cd $BASE ; $tar $OPT - $NEW_NAME) | gzip -9 > $NEW_NAME.tar.gz +echo "$NEW_NAME.tar.gz created" echo "Removing temporary directory" rm -rf $BASE +exit 0 diff --git a/scripts/mysql_secure_installation.pl.in b/scripts/mysql_secure_installation.pl.in index 25339f9b916..0cd99267cdb 100755 --- a/scripts/mysql_secure_installation.pl.in +++ b/scripts/mysql_secure_installation.pl.in @@ -208,7 +208,7 @@ sub remove_anonymous_users { } sub remove_remote_root { - if (do_query("DELETE FROM mysql.user WHERE User='root' AND Host!='localhost';")) { + if (do_query("DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');")) { print " ... Success!\n"; } else { print " ... Failed!\n"; diff --git a/scripts/mysql_secure_installation.sh b/scripts/mysql_secure_installation.sh index 25d6343ee2c..ed789677bf0 100644 --- a/scripts/mysql_secure_installation.sh +++ b/scripts/mysql_secure_installation.sh @@ -17,6 +17,7 @@ config=".my.cnf.$$" command=".mysql.$$" +mysql_client="" trap "interrupt" 2 @@ -37,10 +38,26 @@ prepare() { chmod 600 $config $command } +find_mysql_client() +{ + for n in ./bin/mysql mysql + do + $n --no-defaults --help > /dev/null 2>&1 + status=$? + if test $status -eq 0 + then + mysql_client=$n + return + fi + done + echo "Can't find a 'mysql' client in PATH or ./bin" + exit 1 +} + do_query() { echo "$1" >$command #sed 's,^,> ,' < $command # Debugging - mysql --defaults-file=$config <$command + $mysql_client --defaults-file=$config <$command return $? } @@ -147,7 +164,7 @@ remove_anonymous_users() { } remove_remote_root() { - do_query "DELETE FROM mysql.user WHERE User='root' AND Host!='localhost';" + do_query "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');" if [ $? -eq 0 ]; then echo " ... Success!" else @@ -204,6 +221,7 @@ cleanup() { # The actual script starts here prepare +find_mysql_client set_echo_compat echo diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql index 3b6f0cccf20..2020971fb1a 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -69,7 +69,7 @@ ALTER TABLE tables_priv COLLATE utf8_general_ci DEFAULT '' NOT NULL, MODIFY Table_priv set('Select','Insert','Update','Delete','Create', 'Drop','Grant','References','Index','Alter', - 'Create View','Show view') + 'Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL, COMMENT='Table privileges'; @@ -603,8 +603,6 @@ ALTER TABLE host MODIFY Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAU ALTER TABLE db ADD Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL; ALTER TABLE db MODIFY Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL; -ALTER TABLE tables_priv MODIFY Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL; - UPDATE user SET Trigger_priv=Super_priv WHERE @hadTriggerPriv = 0; # diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh index aea7a657c9e..a08db77ac56 100644 --- a/scripts/mysqlhotcopy.sh +++ b/scripts/mysqlhotcopy.sh @@ -234,10 +234,6 @@ elsif (defined($tgt_name) && ($tgt_name =~ m:/: || $tgt_name eq '.')) { elsif ( $opt{suffix} ) { print "Using copy suffix '$opt{suffix}'\n" unless $opt{quiet}; } -elsif ( ($^O =~ m/^(NetWare)$/) && defined($tgt_name) && ($tgt_name =~ m:\\: || $tgt_name eq '.')) -{ - $tgt_dirname = $tgt_name; -} else { $tgt_name="" if (!defined($tgt_name)); @@ -423,11 +419,8 @@ foreach my $rdb ( @db_desc ) { else { mkdir($tgt_dirpath, 0750) or die "Can't create '$tgt_dirpath': $!\n" unless -d $tgt_dirpath; - if ($^O !~ m/^(NetWare)$/) - { - my @f_info= stat "$datadir/$rdb->{src}"; - chown $f_info[4], $f_info[5], $tgt_dirpath; - } + my @f_info= stat "$datadir/$rdb->{src}"; + chown $f_info[4], $f_info[5], $tgt_dirpath; } } @@ -598,14 +591,7 @@ sub copy_files { my @cmd; print "Copying ".@$files." files...\n" unless $opt{quiet}; - if ($^O =~ m/^(NetWare)$/) # on NetWare call PERL copy (slower) - { - foreach my $file ( @$files ) - { - copy($file, $target."/".basename($file)); - } - } - elsif ($method =~ /^s?cp\b/) # cp or scp with optional flags + if ($method =~ /^s?cp\b/) # cp or scp with optional flags { my $cp = $method; # add option to preserve mod time etc of copied files diff --git a/sql-common/client.c b/sql-common/client.c index c277b153109..f1bdcdc158f 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -80,7 +80,7 @@ my_bool net_flush(NET *net); #ifdef HAVE_PWD_H #include #endif -#if !defined(MSDOS) && !defined(__WIN__) +#if !defined(__WIN__) #include #include #include @@ -91,12 +91,12 @@ my_bool net_flush(NET *net); #ifdef HAVE_SYS_SELECT_H #include #endif -#endif /*!defined(MSDOS) && !defined(__WIN__) */ +#endif /* !defined(__WIN__) */ #ifdef HAVE_SYS_UN_H # include #endif -#if defined(MSDOS) || defined(__WIN__) +#if defined(__WIN__) #define perror(A) #else #include @@ -126,7 +126,7 @@ static void mysql_close_free_options(MYSQL *mysql); static void mysql_close_free(MYSQL *mysql); static void mysql_prune_stmt_list(MYSQL *mysql); -#if !(defined(__WIN__) || defined(__NETWARE__)) +#if !defined(__WIN__) static int wait_for_data(my_socket fd, uint timeout); #endif @@ -148,7 +148,7 @@ char mysql_server_last_error[MYSQL_ERRMSG_SIZE]; int my_connect(my_socket fd, const struct sockaddr *name, uint namelen, uint timeout) { -#if defined(__WIN__) || defined(__NETWARE__) +#if defined(__WIN__) DBUG_ENTER("my_connect"); DBUG_RETURN(connect(fd, (struct sockaddr*) name, namelen)); #else @@ -193,7 +193,7 @@ int my_connect(my_socket fd, const struct sockaddr *name, uint namelen, If not, we will use select() */ -#if !(defined(__WIN__) || defined(__NETWARE__)) +#if !defined(__WIN__) static int wait_for_data(my_socket fd, uint timeout) { @@ -316,7 +316,7 @@ static int wait_for_data(my_socket fd, uint timeout) DBUG_RETURN(0); /* ok */ #endif /* HAVE_POLL */ } -#endif /* defined(__WIN__) || defined(__NETWARE__) */ +#endif /* !defined(__WIN__) */ /** Set the internal error message to mysql handler diff --git a/sql-common/my_time.c b/sql-common/my_time.c index 0a09e945022..ac6c2ace890 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -1024,30 +1024,21 @@ void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type) int my_time_to_str(const MYSQL_TIME *l_time, char *to) { uint extra_hours= 0; - return my_sprintf(to, (to, "%s%02u:%02u:%02u", - (l_time->neg ? "-" : ""), - extra_hours+ l_time->hour, - l_time->minute, - l_time->second)); + return sprintf(to, "%s%02u:%02u:%02u", (l_time->neg ? "-" : ""), + extra_hours+ l_time->hour, l_time->minute, l_time->second); } int my_date_to_str(const MYSQL_TIME *l_time, char *to) { - return my_sprintf(to, (to, "%04u-%02u-%02u", - l_time->year, - l_time->month, - l_time->day)); + return sprintf(to, "%04u-%02u-%02u", + l_time->year, l_time->month, l_time->day); } int my_datetime_to_str(const MYSQL_TIME *l_time, char *to) { - return my_sprintf(to, (to, "%04u-%02u-%02u %02u:%02u:%02u", - l_time->year, - l_time->month, - l_time->day, - l_time->hour, - l_time->minute, - l_time->second)); + return sprintf(to, "%04u-%02u-%02u %02u:%02u:%02u", + l_time->year, l_time->month, l_time->day, + l_time->hour, l_time->minute, l_time->second); } diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/sql/Makefile.am b/sql/Makefile.am index 0616893a014..4b1ecbbc8da 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -135,8 +135,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ item_row.cc item_geofunc.cc item_xmlfunc.cc \ field.cc strfunc.cc key.cc sql_class.cc sql_list.cc \ net_serv.cc protocol.cc sql_state.c \ - lock.cc my_lock.c \ - sql_string.cc sql_manager.cc sql_map.cc \ + lock.cc sql_string.cc sql_manager.cc sql_map.cc \ main.cc mysqld.cc password.c hash_filo.cc hostname.cc \ sql_connect.cc scheduler.cc sql_parse.cc \ keycaches.cc set_var.cc sql_yacc.yy sys_vars.cc \ diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc old mode 100755 new mode 100644 diff --git a/sql/examples/CMakeLists.txt b/sql/examples/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/sql/field.cc b/sql/field.cc index bfaaf10b141..56d60ff5b28 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -8280,7 +8280,13 @@ int Field_set::store(longlong nr, bool unsigned_val) { ASSERT_COLUMN_MARKED_FOR_WRITE; int error= 0; - ulonglong max_nr= set_bits(ulonglong, typelib->count); + ulonglong max_nr; + + if (sizeof(ulonglong)*8 <= typelib->count) + max_nr= ULONGLONG_MAX; + else + max_nr= (ULL(1) << typelib->count) - 1; + if ((ulonglong) nr > max_nr) { nr&= max_nr; @@ -10135,7 +10141,7 @@ Field::set_datetime_warning(MYSQL_ERROR::enum_warning_level level, uint code, { /* DBL_DIG is enough to print '-[digits].E+###' */ char str_nr[DBL_DIG + 8]; - uint str_len= my_sprintf(str_nr, (str_nr, "%g", nr)); + uint str_len= sprintf(str_nr, "%g", nr); make_truncated_value_warning(thd, level, str_nr, str_len, ts_type, field_name); } diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 90a4802082b..bd3cd780bc5 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -4370,6 +4370,58 @@ int ha_partition::index_read_last_map(uchar *buf, const uchar *key, } +/* + Optimization of the default implementation to take advantage of dynamic + partition pruning. +*/ +int ha_partition::index_read_idx_map(uchar *buf, uint index, + const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag) +{ + int error= HA_ERR_KEY_NOT_FOUND; + DBUG_ENTER("ha_partition::index_read_idx_map"); + + if (find_flag == HA_READ_KEY_EXACT) + { + uint part; + m_start_key.key= key; + m_start_key.keypart_map= keypart_map; + m_start_key.flag= find_flag; + m_start_key.length= calculate_key_len(table, index, m_start_key.key, + m_start_key.keypart_map); + + get_partition_set(table, buf, index, &m_start_key, &m_part_spec); + + /* How can it be more than one partition with the current use? */ + DBUG_ASSERT(m_part_spec.start_part == m_part_spec.end_part); + + for (part= m_part_spec.start_part; part <= m_part_spec.end_part; part++) + { + if (bitmap_is_set(&(m_part_info->used_partitions), part)) + { + error= m_file[part]->index_read_idx_map(buf, index, key, + keypart_map, find_flag); + if (error != HA_ERR_KEY_NOT_FOUND && + error != HA_ERR_END_OF_FILE) + break; + } + } + } + else + { + /* + If not only used with READ_EXACT, we should investigate if possible + to optimize for other find_flag's as well. + */ + DBUG_ASSERT(0); + /* fall back on the default implementation */ + error= handler::index_read_idx_map(buf, index, key, keypart_map, find_flag); + } + DBUG_RETURN(error); +} + + /* Read next record in a forward index scan diff --git a/sql/ha_partition.h b/sql/ha_partition.h index eec3cb71537..cdbfb2163c7 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -36,8 +36,7 @@ enum partition_keywords HA_CAN_FULLTEXT | \ HA_DUPLICATE_POS | \ HA_CAN_SQL_HANDLER | \ - HA_CAN_INSERT_DELAYED | \ - HA_PRIMARY_KEY_REQUIRED_FOR_POSITION) + HA_CAN_INSERT_DELAYED) class ha_partition :public handler { private: @@ -431,6 +430,15 @@ public: virtual int index_init(uint idx, bool sorted); virtual int index_end(); + /** + @breif + Positions an index cursor to the index specified in the hanlde. Fetches the + row if available. If the key value is null, begin at first key of the + index. + */ + virtual int index_read_idx_map(uchar *buf, uint index, const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag); /* These methods are used to jump to next or previous entry in the index scan. There are also methods to jump to first and last entry. @@ -749,9 +757,6 @@ public: HA_PRIMARY_KEY_REQUIRED_FOR_POSITION: Does the storage engine need a PK for position? - Used with hidden primary key in InnoDB. - Hidden primary keys cannot be supported by partitioning, since the - partitioning expressions columns must be a part of the primary key. (InnoDB) HA_FILE_BASED is always set for partition handler since we use a diff --git a/sql/handler.h b/sql/handler.h index 5e08ed23bef..96095798d18 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -100,7 +100,10 @@ #define HA_PRIMARY_KEY_IN_READ_INDEX (1 << 15) /* If HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is set, it means that to position() - uses a primary key. Without primary key, we can't call position(). + uses a primary key given by the record argument. + Without primary key, we can't call position(). + If not set, the position is returned as the current rows position + regardless of what argument is given. */ #define HA_PRIMARY_KEY_REQUIRED_FOR_POSITION (1 << 16) #define HA_CAN_RTREEKEYS (1 << 17) @@ -1533,10 +1536,9 @@ public: virtual int rnd_next(uchar *buf)=0; virtual int rnd_pos(uchar * buf, uchar *pos)=0; /** - One has to use this method when to find - random position by record as the plain - position() call doesn't work for some - handlers for random position. + This function only works for handlers having + HA_PRIMARY_KEY_REQUIRED_FOR_POSITION set. + It will return the row with the PK given in the record argument. */ virtual int rnd_pos_by_record(uchar *record) { @@ -1554,6 +1556,12 @@ public: { return HA_ERR_WRONG_COMMAND; } virtual ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key) { return (ha_rows) 10; } + /* + If HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is set, then it sets ref + (reference to the row, aka position, with the primary key given in + the record). + Otherwise it set ref to the current row. + */ virtual void position(const uchar *record)=0; virtual int info(uint)=0; // see my_base.h for full description virtual void get_dynamic_partition_info(PARTITION_STATS *stat_info, diff --git a/sql/item.cc b/sql/item.cc index 05363f41d07..13b4aa96c76 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4400,8 +4400,7 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference) context->first_name_resolution_table, context->last_name_resolution_table, reference, REPORT_ALL_ERRORS, - !any_privileges && - TRUE, TRUE); + !any_privileges, TRUE); } return -1; } diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 3c871bc0663..d31799d7e60 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2777,6 +2777,8 @@ Item *Item_func_case::find_item(String *str) /* Compare every WHEN argument with it and return the first match */ for (uint i=0 ; i < ncases ; i+=2) { + if (args[i]->real_item()->type() == NULL_ITEM) + continue; cmp_type= item_cmp_type(left_result_type, args[i]->result_type()); DBUG_ASSERT(cmp_type != ROW_RESULT); DBUG_ASSERT(cmp_items[(uint)cmp_type]); @@ -4007,9 +4009,17 @@ longlong Item_func_in::val_int() return (longlong) (!null_value && tmp != negated); } + if ((null_value= args[0]->real_item()->type() == NULL_ITEM)) + return 0; + have_null= 0; for (uint i= 1 ; i < arg_count ; i++) { + if (args[i]->real_item()->type() == NULL_ITEM) + { + have_null= TRUE; + continue; + } Item_result cmp_type= item_cmp_type(left_result_type, args[i]->result_type()); in_item= cmp_items[(uint)cmp_type]; DBUG_ASSERT(in_item); @@ -4571,13 +4581,14 @@ Item_func::optimize_type Item_func_like::select_optimize() const if (args[1]->const_item()) { String* res2= args[1]->val_str((String *)&cmp.value2); + const char *ptr2; - if (!res2) + if (!res2 || !(ptr2= res2->ptr())) return OPTIMIZE_NONE; - if (*res2->ptr() != wild_many) + if (*ptr2 != wild_many) { - if (args[0]->result_type() != STRING_RESULT || *res2->ptr() != wild_one) + if (args[0]->result_type() != STRING_RESULT || *ptr2 != wild_one) return OPTIMIZE_OP; } } diff --git a/sql/item_create.cc b/sql/item_create.cc index 5f30a10d1e0..672e59986d5 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -5131,8 +5131,6 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type, CHARSET_INFO *cs) { Item *UNINIT_VAR(res); - ulong len; - uint dec; switch (cast_type) { case ITEM_CAST_BINARY: @@ -5155,11 +5153,10 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type, break; case ITEM_CAST_DECIMAL: { - if (c_len == NULL) - { - len= 0; - } - else + ulong len= 0; + uint dec= 0; + + if (c_len) { ulong decoded_size; errno= 0; @@ -5173,11 +5170,7 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type, len= decoded_size; } - if (c_dec == NULL) - { - dec= 0; - } - else + if (c_dec) { ulong decoded_size; errno= 0; @@ -5213,12 +5206,9 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type, } case ITEM_CAST_CHAR: { + int len= -1; CHARSET_INFO *real_cs= (cs ? cs : thd->variables.collation_connection); - if (c_len == NULL) - { - len= LL(-1); - } - else + if (c_len) { ulong decoded_size; errno= 0; @@ -5228,7 +5218,7 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type, my_error(ER_TOO_BIG_DISPLAYWIDTH, MYF(0), "cast as char", MAX_FIELD_BLOBLENGTH); return NULL; } - len= decoded_size; + len= (int) decoded_size; } res= new (thd->mem_root) Item_char_typecast(a, len, real_cs); break; diff --git a/sql/item_func.cc b/sql/item_func.cc index 2d5848e314e..833eac6893b 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -5069,6 +5069,7 @@ bool Item_func_get_user_var::set_value(THD *thd, bool Item_user_var_as_out_param::fix_fields(THD *thd, Item **ref) { DBUG_ASSERT(fixed == 0); + DBUG_ASSERT(thd->lex->exchange); if (Item::fix_fields(thd, ref) || !(entry= get_variable(&thd->user_vars, name, 1))) return TRUE; @@ -5078,7 +5079,9 @@ bool Item_user_var_as_out_param::fix_fields(THD *thd, Item **ref) of fields in LOAD DATA INFILE. (Since Item_user_var_as_out_param is used only there). */ - entry->collation.set(thd->variables.collation_database); + entry->collation.set(thd->lex->exchange->cs ? + thd->lex->exchange->cs : + thd->variables.collation_database); entry->update_query_id= thd->query_id; return FALSE; } diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index feff03e704a..1c2c1cfe512 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -775,13 +775,11 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, str->append(hours_i < 12 ? "AM" : "PM",2); break; case 'r': - length= my_sprintf(intbuff, - (intbuff, - ((l_time->hour % 24) < 12) ? - "%02d:%02d:%02d AM" : "%02d:%02d:%02d PM", - (l_time->hour+11)%12+1, - l_time->minute, - l_time->second)); + length= sprintf(intbuff, ((l_time->hour % 24) < 12) ? + "%02d:%02d:%02d AM" : "%02d:%02d:%02d PM", + (l_time->hour+11)%12+1, + l_time->minute, + l_time->second); str->append(intbuff, length); break; case 'S': @@ -790,12 +788,8 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, str->append_with_prefill(intbuff, length, 2, '0'); break; case 'T': - length= my_sprintf(intbuff, - (intbuff, - "%02d:%02d:%02d", - l_time->hour, - l_time->minute, - l_time->second)); + length= sprintf(intbuff, "%02d:%02d:%02d", + l_time->hour, l_time->minute, l_time->second); str->append(intbuff, length); break; case 'U': @@ -3057,12 +3051,12 @@ String *Item_func_maketime::val_str(String *str) char buf[28]; char *ptr= longlong10_to_str(hour, buf, args[0]->unsigned_flag ? 10 : -10); int len = (int)(ptr - buf) + - my_sprintf(ptr, (ptr, ":%02u:%02u", (uint)minute, (uint)second)); + sprintf(ptr, ":%02u:%02u", (uint) minute, (uint) second); make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, buf, len, MYSQL_TIMESTAMP_TIME, NullS); } - + if (make_time_with_warn((DATE_TIME_FORMAT *) 0, <ime, str)) { null_value= 1; diff --git a/sql/log.cc b/sql/log.cc index 521cedffc81..b398cb1e73f 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -2076,7 +2076,7 @@ static int find_uniq_filename(char *name) file_info= dir_info->dir_entry; for (i= dir_info->number_off_files ; i-- ; file_info++) { - if (bcmp((uchar*) file_info->name, (uchar*) start, length) == 0 && + if (memcmp(file_info->name, start, length) == 0 && test_if_number(file_info->name+length, &number,0)) { set_if_bigger(max_found,(ulong) number); diff --git a/sql/log_event.cc b/sql/log_event.cc index 52275a4b6bd..5236a2794cf 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1654,17 +1654,17 @@ log_event_print_value(IO_CACHE *file, const uchar *ptr, int i, end; char buff[512], *pos; pos= buff; - pos+= my_sprintf(buff, (buff, "%s", dec.sign() ? "-" : "")); + pos+= sprintf(buff, "%s", dec.sign() ? "-" : ""); end= ROUND_UP(dec.frac) + ROUND_UP(dec.intg)-1; for (i=0; i < end; i++) - pos+= my_sprintf(pos, (pos, "%09d.", dec.buf[i])); - pos+= my_sprintf(pos, (pos, "%09d", dec.buf[i])); + pos+= sprintf(pos, "%09d.", dec.buf[i]); + pos+= sprintf(pos, "%09d", dec.buf[i]); my_b_printf(file, "%s", buff); my_snprintf(typestr, typestr_length, "DECIMAL(%d,%d)", precision, decimals); return bin_size; } - + case MYSQL_TYPE_FLOAT: { float fl; @@ -2324,6 +2324,53 @@ bool Query_log_event::write(IO_CACHE* file) start+= 4; } + if (thd && thd->is_current_user_used()) + { + LEX_STRING user; + LEX_STRING host; + memset(&user, 0, sizeof(user)); + memset(&host, 0, sizeof(host)); + + if (thd->slave_thread && thd->has_invoker()) + { + /* user will be null, if master is older than this patch */ + user= thd->get_invoker_user(); + host= thd->get_invoker_host(); + } + else if (thd->security_ctx->priv_user) + { + Security_context *ctx= thd->security_ctx; + + user.length= strlen(ctx->priv_user); + user.str= ctx->priv_user; + if (ctx->priv_host[0] != '\0') + { + host.str= ctx->priv_host; + host.length= strlen(ctx->priv_host); + } + } + + if (user.length > 0) + { + *start++= Q_INVOKER; + + /* + Store user length and user. The max length of use is 16, so 1 byte is + enough to store the user's length. + */ + *start++= (uchar)user.length; + memcpy(start, user.str, user.length); + start+= user.length; + + /* + Store host length and host. The max length of host is 60, so 1 byte is + enough to store the host's length. + */ + *start++= (uchar)host.length; + memcpy(start, host.str, host.length); + start+= host.length; + } + } /* NOTE: When adding new status vars, please don't forget to update the MAX_SIZE_LOG_EVENT_STATUS in log_event.h and update the function @@ -2366,6 +2413,8 @@ bool Query_log_event::write(IO_CACHE* file) Query_log_event::Query_log_event() :Log_event(), data_buf(0) { + memset(&user, 0, sizeof(user)); + memset(&host, 0, sizeof(host)); } @@ -2408,6 +2457,9 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, { time_t end_time; + memset(&user, 0, sizeof(user)); + memset(&host, 0, sizeof(host)); + error_code= errcode; time(&end_time); @@ -2654,6 +2706,8 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, bool catalog_nz= 1; DBUG_ENTER("Query_log_event::Query_log_event(char*,...)"); + memset(&user, 0, sizeof(user)); + memset(&host, 0, sizeof(host)); common_header_len= description_event->common_header_len; post_header_len= description_event->post_header_len[event_type-1]; DBUG_PRINT("info",("event_len: %u common_header_len: %d post_header_len: %d", @@ -2808,6 +2862,20 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, data_written= master_data_written= uint4korr(pos); pos+= 4; break; + case Q_INVOKER: + { + CHECK_SPACE(pos, end, 1); + user.length= *pos++; + CHECK_SPACE(pos, end, user.length); + user.str= (char *)pos; + pos+= user.length; + + CHECK_SPACE(pos, end, 1); + host.length= *pos++; + CHECK_SPACE(pos, end, host.length); + host.str= (char *)pos; + pos+= host.length; + } default: /* That's why you must write status vars in growing order of code */ DBUG_PRINT("info",("Query_log_event has unknown status vars (first has\ @@ -2821,12 +2889,16 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, time_zone_len + 1 + data_len + 1 + QUERY_CACHE_FLAGS_SIZE + + user.length + 1 + + host.length + 1 + db_len + 1, MYF(MY_WME)))) #else if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1 + time_zone_len + 1 + - data_len + 1, + data_len + 1 + + user.length + 1 + + host.length + 1, MYF(MY_WME)))) #endif DBUG_VOID_RETURN; @@ -2849,6 +2921,11 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, if (time_zone_len) copy_str_and_move(&time_zone_str, &start, time_zone_len); + if (user.length > 0) + copy_str_and_move((const char **)&(user.str), &start, user.length); + if (host.length > 0) + copy_str_and_move((const char **)&(host.str), &start, host.length); + /** if time_zone_len or catalog_len are 0, then time_zone and catalog are uninitialized at this point. shouldn't they point to the @@ -2984,7 +3061,7 @@ void Query_log_event::print_query_header(IO_CACHE* file, if (likely(charset_inited) && (unlikely(!print_event_info->charset_inited || - bcmp((uchar*) print_event_info->charset, (uchar*) charset, 6)))) + memcmp(print_event_info->charset, charset, 6)))) { CHARSET_INFO *cs_info= get_charset(uint2korr(charset), MYF(MY_WME)); if (cs_info) @@ -3007,8 +3084,8 @@ void Query_log_event::print_query_header(IO_CACHE* file, } if (time_zone_len) { - if (bcmp((uchar*) print_event_info->time_zone_str, - (uchar*) time_zone_str, time_zone_len+1)) + if (memcmp(print_event_info->time_zone_str, + time_zone_str, time_zone_len+1)) { my_b_printf(file,"SET @@session.time_zone='%s'%s\n", time_zone_str, print_event_info->delimiter); @@ -3254,7 +3331,7 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli, thd->variables.collation_database= thd->db_charset; thd->table_map_for_update= (table_map)table_map_for_update; - + thd->set_invoker(&user, &host); /* Execute the query (note that we bypass dispatch_command()) */ Parser_state parser_state; if (!parser_state.init(thd, thd->query(), thd->query_length())) @@ -5713,7 +5790,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) double real_val; char real_buf[FMT_G_BUFSIZE(14)]; float8get(real_val, val); - my_sprintf(real_buf, (real_buf, "%.14g", real_val)); + sprintf(real_buf, "%.14g", real_val); my_b_printf(&cache, ":=%s%s\n", real_buf, print_event_info->delimiter); break; case INT_RESULT: @@ -6472,10 +6549,9 @@ void Append_block_log_event::print(FILE* file, void Append_block_log_event::pack_info(Protocol *protocol) { char buf[256]; - uint length; - length= (uint) my_sprintf(buf, - (buf, ";file_id=%u;block_len=%u", file_id, - block_len)); + size_t length; + length= my_snprintf(buf, sizeof(buf), ";file_id=%u;block_len=%u", + file_id, block_len); protocol->store(buf, length, &my_charset_bin); } @@ -6630,9 +6706,9 @@ void Delete_file_log_event::print(FILE* file, void Delete_file_log_event::pack_info(Protocol *protocol) { char buf[64]; - uint length; - length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id)); - protocol->store(buf, (int32) length, &my_charset_bin); + size_t length; + length= my_snprintf(buf, sizeof(buf), ";file_id=%u", (uint) file_id); + protocol->store(buf, length, &my_charset_bin); } #endif @@ -6728,9 +6804,9 @@ void Execute_load_log_event::print(FILE* file, void Execute_load_log_event::pack_info(Protocol *protocol) { char buf[64]; - uint length; - length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id)); - protocol->store(buf, (int32) length, &my_charset_bin); + size_t length; + length= my_snprintf(buf, sizeof(buf), ";file_id=%u", (uint) file_id); + protocol->store(buf, length, &my_charset_bin); } @@ -8656,7 +8732,7 @@ Rows_log_event::write_row(const Relay_log_info *const rli, TABLE *table= m_table; // pointer to event's table int error; - int keynum; + int UNINIT_VAR(keynum); auto_afree_ptr key(NULL); /* fill table->record[0] with default values */ @@ -8850,19 +8926,19 @@ Rows_log_event::write_row(const Relay_log_info *const rli, #endif -int +int Write_rows_log_event::do_exec_row(const Relay_log_info *const rli) { DBUG_ASSERT(m_table != NULL); int error= write_row(rli, slave_exec_mode == SLAVE_EXEC_MODE_IDEMPOTENT); - + if (error && !thd->is_error()) { DBUG_ASSERT(0); my_error(ER_UNKNOWN_ERROR, MYF(0)); } - - return error; + + return error; } #endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */ diff --git a/sql/log_event.h b/sql/log_event.h index 0119b11cc23..5d7250d8ebd 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -270,7 +270,8 @@ struct sql_ex_info 1 + 2 /* type, lc_time_names_number */ + \ 1 + 2 /* type, charset_database_number */ + \ 1 + 8 /* type, table_map_for_update */ + \ - 1 + 4 /* type, master_data_written */) + 1 + 4 /* type, master_data_written */ + \ + 1 + 16 + 1 + 60/* type, user_len, user, host_len, host */) #define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \ LOG_EVENT_HEADER_LEN + /* write_header */ \ QUERY_HEADER_LEN + /* write_data */ \ @@ -339,6 +340,8 @@ struct sql_ex_info #define Q_MASTER_DATA_WRITTEN_CODE 10 +#define Q_INVOKER 11 + /* Intvar event post-header */ /* Intvar event data */ @@ -1610,6 +1613,8 @@ protected: */ class Query_log_event: public Log_event { + LEX_STRING user; + LEX_STRING host; protected: Log_event::Byte* data_buf; public: diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index 9263578e0b5..88df4970816 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -418,7 +418,7 @@ copy_extra_record_fields(TABLE *table, DBUG_ASSERT(master_reclength <= table->s->reclength); if (master_reclength < table->s->reclength) - bmove_align(table->record[0] + master_reclength, + memcpy(table->record[0] + master_reclength, table->record[1] + master_reclength, table->s->reclength - master_reclength); @@ -697,7 +697,7 @@ static int find_and_fetch_row(TABLE *table, uchar *key) rnd_pos() returns the record in table->record[0], so we have to move it to table->record[1]. */ - bmove_align(table->record[1], table->record[0], table->s->reclength); + memcpy(table->record[1], table->record[0], table->s->reclength); DBUG_RETURN(error); } @@ -1190,7 +1190,7 @@ int Update_rows_log_event_old::do_exec_row(TABLE *table) overwriting the default values that where put there by the unpack_row() function. */ - bmove_align(table->record[0], m_after_image, table->s->reclength); + memcpy(table->record[0], m_after_image, table->s->reclength); copy_extra_record_fields(table, m_master_reclength, m_width); /* diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc index 68f9b582dd2..8a31cec6721 100644 --- a/sql/my_decimal.cc +++ b/sql/my_decimal.cc @@ -305,12 +305,12 @@ print_decimal(const my_decimal *dec) int i, end; char buff[512], *pos; pos= buff; - pos+= my_sprintf(buff, (buff, "Decimal: sign: %d intg: %d frac: %d { ", - dec->sign(), dec->intg, dec->frac)); + pos+= sprintf(buff, "Decimal: sign: %d intg: %d frac: %d { ", + dec->sign(), dec->intg, dec->frac); end= ROUND_UP(dec->frac)+ROUND_UP(dec->intg)-1; for (i=0; i < end; i++) - pos+= my_sprintf(pos, (pos, "%09d, ", dec->buf[i])); - pos+= my_sprintf(pos, (pos, "%09d }\n", dec->buf[i])); + pos+= sprintf(pos, "%09d, ", dec->buf[i]); + pos+= sprintf(pos, "%09d }\n", dec->buf[i]); fputs(buff, DBUG_FILE); } diff --git a/sql/my_lock.c b/sql/my_lock.c deleted file mode 100644 index f66d7282f72..00000000000 --- a/sql/my_lock.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright (C) 2000-2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#if defined(__NETWARE__) -#include "../mysys/my_lock.c" -#else - -#undef MAP_TO_USE_RAID /* Avoid RAID mappings */ -#include -#include -#include -#include -#include -#include - - /* Lock a part of a file */ - -int my_lock(File fd,int locktype,my_off_t start,my_off_t length,myf MyFlags) -{ - thr_alarm_t alarmed; - ALARM alarm_buff; - uint wait_for_alarm; - struct flock m_lock; - DBUG_ENTER("my_lock"); - DBUG_PRINT("my",("Fd: %d Op: %d start: %ld Length: %ld MyFlags: %d", - fd,locktype,(ulong) start,(ulong) length,MyFlags)); - if (my_disable_locking) - DBUG_RETURN(0); /* purecov: inspected */ - m_lock.l_type=(short) locktype; - m_lock.l_whence=0L; - m_lock.l_start=(long) start; - m_lock.l_len=(long) length; - wait_for_alarm=(MyFlags & MY_DONT_WAIT ? MY_HOW_OFTEN_TO_ALARM : - (uint) 12*60*60); - if (fcntl(fd,F_SETLK,&m_lock) != -1) /* Check if we can lock */ - DBUG_RETURN(0); /* Ok, file locked */ - DBUG_PRINT("info",("Was locked, trying with alarm")); - if (!thr_alarm(&alarmed,wait_for_alarm,&alarm_buff)) - { - int value; - while ((value=fcntl(fd,F_SETLKW,&m_lock)) && !thr_got_alarm(&alarmed) && - errno == EINTR) ; - thr_end_alarm(&alarmed); - if (value != -1) - DBUG_RETURN(0); - } - else - { - errno=EINTR; - } - if (errno == EINTR || errno == EACCES) - my_errno=EAGAIN; /* Easier to check for this */ - else - my_errno=errno; - - if (MyFlags & MY_WME) - { - if (locktype == F_UNLCK) - my_error(EE_CANTUNLOCK,MYF(ME_BELL+ME_WAITTANG),errno); - else - my_error(EE_CANTLOCK,MYF(ME_BELL+ME_WAITTANG),errno); - } - DBUG_PRINT("error",("errno: %d",errno)); - DBUG_RETURN(-1); -} -#endif diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ef68275b927..375c96bdec4 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1,4 +1,4 @@ -/* Copyright 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. +/* 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 @@ -126,14 +126,12 @@ extern "C" { // Because of SCO 3.2V4.2 #include #if !defined(__WIN__) -# ifndef __NETWARE__ #include -# endif /* __NETWARE__ */ #ifdef HAVE_SYS_UN_H -# include +#include #endif #ifdef HAVE_SELECT_H -# include +#include #endif #ifdef HAVE_SYS_SELECT_H #include @@ -164,45 +162,6 @@ extern int memcntl(caddr_t, size_t, int, caddr_t, int, int); #endif /* __sun__ ... */ #endif /* HAVE_SOLARIS_LARGE_PAGES */ -#ifdef __NETWARE__ -#define zVOLSTATE_ACTIVE 6 -#define zVOLSTATE_DEACTIVE 2 -#define zVOLSTATE_MAINTENANCE 3 - -#undef __event_h__ -#include <../include/event.h> -/* - This #undef exists here because both libc of NetWare and MySQL have - files named event.h which causes compilation errors. -*/ - -#include -#include -#include -#include -#include //For NEB -#include //For NEB -#include //For NEB -#include //For NSS event structures -#include - -static void *neb_consumer_id= NULL; //For storing NEB consumer id -static char datavolname[256]= {0}; -static VolumeID_t datavolid; -static event_handle_t eh; -static Report_t ref; -static void *refneb= NULL; -my_bool event_flag= FALSE; -static int volumeid= -1; - - /* NEB event callback */ -unsigned long neb_event_callback(struct EventBlock *eblock); -static void registerwithneb(); -static void getvolumename(); -static void getvolumeID(BYTE *volumeName); -#endif /* __NETWARE__ */ - - #ifdef _AIX41 int initgroups(const char *,unsigned int); #endif @@ -782,7 +741,15 @@ void Buffered_log::print() sql_print_warning("Buffered warning: %s\n", m_message.c_ptr_safe()); break; case INFORMATION_LEVEL: - sql_print_information("Buffered information: %s\n", m_message.c_ptr_safe()); + /* + Messages printed as "information" still end up in the mysqld *error* log, + but with a [Note] tag instead of an [ERROR] tag. + While this is probably fine for a human reading the log, + it is upsetting existing automated scripts used to parse logs, + because such scripts are likely to not already handle [Note] properly. + INFORMATION_LEVEL messages are simply silenced, on purpose, + to avoid un needed verbosity. + */ break; } } @@ -1031,7 +998,7 @@ static void close_connections(void) flush_thread_cache(); /* kill connection thread */ -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) DBUG_PRINT("quit", ("waiting for select thread: 0x%lx", (ulong) select_thread)); mysql_mutex_lock(&LOCK_thread_count); @@ -1209,14 +1176,6 @@ static void close_server_sock() ip_sock=INVALID_SOCKET; DBUG_PRINT("info",("calling shutdown on TCP/IP socket")); (void) shutdown(tmp_sock, SHUT_RDWR); -#if defined(__NETWARE__) - /* - The following code is disabled for normal systems as it causes MySQL - to hang on AIX 4.3 during shutdown - */ - DBUG_PRINT("info",("calling closesocket on TCP/IP socket")); - (void) closesocket(tmp_sock); -#endif } tmp_sock=unix_sock; if (tmp_sock != INVALID_SOCKET) @@ -1224,14 +1183,6 @@ static void close_server_sock() unix_sock=INVALID_SOCKET; DBUG_PRINT("info",("calling shutdown on unix socket")); (void) shutdown(tmp_sock, SHUT_RDWR); -#if defined(__NETWARE__) - /* - The following code is disabled for normal systems as it may cause MySQL - to hang on AIX 4.3 during shutdown - */ - DBUG_PRINT("info",("calling closesocket on unix/IP socket")); - (void) closesocket(tmp_sock); -#endif (void) unlink(mysqld_unix_port); } DBUG_VOID_RETURN; @@ -1300,10 +1251,7 @@ void kill_mysql(void) or stop, we just want to kill the server. */ -#if defined(__NETWARE__) -extern "C" void kill_server(int sig_ptr) -#define RETURN_FROM_KILL_SERVER return -#elif !defined(__WIN__) +#if !defined(__WIN__) static void *kill_server(void *sig_ptr) #define RETURN_FROM_KILL_SERVER return 0 #else @@ -1349,11 +1297,6 @@ static void __cdecl kill_server(int sig_ptr) unireg_end(); /* purecov: begin deadcode */ -#ifdef __NETWARE__ - if (!event_flag) - pthread_join(select_thread, NULL); // wait for main thread -#endif /* __NETWARE__ */ - DBUG_LEAVE; // Must match DBUG_ENTER() my_thread_end(); pthread_exit(0); @@ -1370,7 +1313,7 @@ static void __cdecl kill_server(int sig_ptr) } -#if defined(USE_ONE_SIGNAL_HAND) || (defined(__NETWARE__) && defined(SIGNALS_DONT_BREAK_READ)) +#if defined(USE_ONE_SIGNAL_HAND) pthread_handler_t kill_server_thread(void *arg __attribute__((unused))) { my_thread_init(); // Initialize new thread @@ -1388,10 +1331,10 @@ extern "C" sig_handler print_signal_warning(int sig) { if (global_system_variables.log_warnings) sql_print_warning("Got signal %d from thread %ld", sig,my_thread_id()); -#ifdef DONT_REMEMBER_SIGNAL +#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY my_sigset(sig,print_signal_warning); /* int. thread system calls */ #endif -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) if (sig == SIGALRM) alarm(2); /* reschedule alarm */ #endif @@ -1425,7 +1368,7 @@ void unireg_end(void) { clean_up(1); my_thread_end(); -#if defined(SIGNALS_DONT_BREAK_READ) && !defined(__NETWARE__) +#if defined(SIGNALS_DONT_BREAK_READ) exit(0); #else pthread_exit(0); // Exit is in main thread @@ -1579,7 +1522,6 @@ void clean_up(bool print_message) */ static void wait_for_signal_thread_to_end() { -#ifndef __NETWARE__ uint i; /* Wait up to 10 seconds for signal thread to die. We use this mainly to @@ -1591,7 +1533,6 @@ static void wait_for_signal_thread_to_end() break; my_sleep(100); // Give it time to die } -#endif } @@ -1687,7 +1628,7 @@ static void set_ports() static struct passwd *check_user(const char *user) { -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) struct passwd *tmp_user_info; uid_t user_id= geteuid(); @@ -1752,7 +1693,7 @@ err: static void set_user(const char *user, struct passwd *user_info_arg) { /* purecov: begin tested */ -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) DBUG_ASSERT(user_info_arg != 0); #ifdef HAVE_INITGROUPS /* @@ -1782,7 +1723,7 @@ static void set_user(const char *user, struct passwd *user_info_arg) static void set_effective_user(struct passwd *user_info_arg) { -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) DBUG_ASSERT(user_info_arg != 0); if (setregid((gid_t)-1, user_info_arg->pw_gid) == -1) { @@ -1801,7 +1742,7 @@ static void set_effective_user(struct passwd *user_info_arg) /** Change root user if started with @c --chroot . */ static void set_root(const char *path) { -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) if (chroot(path) == -1) { sql_perror("chroot"); @@ -2133,6 +2074,16 @@ static bool cache_thread() /* Don't kill the thread, just put it in cache for reuse */ DBUG_PRINT("info", ("Adding thread to cache")); cached_thread_count++; + +#ifdef HAVE_PSI_INTERFACE + /* + Delete the instrumentation for the job that just completed, + before parking this pthread in the cache (blocked on COND_thread_cache). + */ + if (likely(PSI_server != NULL)) + PSI_server->delete_current_thread(); +#endif + while (!abort_loop && ! wake_thread && ! kill_cached_threads) mysql_cond_wait(&COND_thread_cache, &LOCK_thread_count); cached_thread_count--; @@ -2145,6 +2096,21 @@ static bool cache_thread() thd= thread_cache.get(); thd->thread_stack= (char*) &thd; // For store_globals (void) thd->store_globals(); + +#ifdef HAVE_PSI_INTERFACE + /* + Create new instrumentation for the new THD job, + and attach it to this running pthread. + */ + if (likely(PSI_server != NULL)) + { + PSI_thread *psi= PSI_server->new_thread(key_thread_one_connection, + thd, thd->thread_id); + if (likely(psi != NULL)) + PSI_server->set_thread(psi); + } +#endif + /* THD::mysys_var::abort is associated with physical thread rather than with THD object. So we need to reset this flag before using @@ -2391,243 +2357,7 @@ static void start_signal_handler(void) static void check_data_home(const char *path) {} - -#elif defined(__NETWARE__) - -/// down server event callback. -void mysql_down_server_cb(void *, void *) -{ - event_flag= TRUE; - kill_server(0); -} - - -/// destroy callback resources. -void mysql_cb_destroy(void *) -{ - UnRegisterEventNotification(eh); // cleanup down event notification - NX_UNWRAP_INTERFACE(ref); - /* Deregister NSS volume deactivation event */ - NX_UNWRAP_INTERFACE(refneb); - if (neb_consumer_id) - UnRegisterConsumer(neb_consumer_id, NULL); -} - - -/// initialize callbacks. -void mysql_cb_init() -{ - // register for down server event - void *handle = getnlmhandle(); - rtag_t rt= AllocateResourceTag(handle, "MySQL Down Server Callback", - EventSignature); - NX_WRAP_INTERFACE((void *)mysql_down_server_cb, 2, (void **)&ref); - eh= RegisterForEventNotification(rt, EVENT_PRE_DOWN_SERVER, - EVENT_PRIORITY_APPLICATION, - NULL, ref, NULL); - - /* - Register for volume deactivation event - Wrap the callback function, as it is called by non-LibC thread - */ - (void *) NX_WRAP_INTERFACE(neb_event_callback, 1, &refneb); - registerwithneb(); - - NXVmRegisterExitHandler(mysql_cb_destroy, NULL); // clean-up -} - - -/** To get the name of the NetWare volume having MySQL data folder. */ -static void getvolumename() -{ - char *p; - /* - We assume that data path is already set. - If not it won't come here. Terminate after volume name - */ - if ((p= strchr(mysql_real_data_home, ':'))) - strmake(datavolname, mysql_real_data_home, - (uint) (p - mysql_real_data_home)); -} - - -/** - Registering with NEB for NSS Volume Deactivation event. -*/ - -static void registerwithneb() -{ - - ConsumerRegistrationInfo reg_info; - - /* Clear NEB registration structure */ - bzero((char*) ®_info, sizeof(struct ConsumerRegistrationInfo)); - - /* Fill the NEB consumer information structure */ - reg_info.CRIVersion= 1; // NEB version - /* NEB Consumer name */ - reg_info.CRIConsumerName= (BYTE *) "MySQL Database Server"; - /* Event of interest */ - reg_info.CRIEventName= (BYTE *) "NSS.ChangeVolState.Enter"; - reg_info.CRIUserParameter= NULL; // Consumer Info - reg_info.CRIEventFlags= 0; // Event flags - /* Consumer NLM handle */ - reg_info.CRIOwnerID= (LoadDefinitionStructure *)getnlmhandle(); - reg_info.CRIConsumerESR= NULL; // No consumer ESR required - reg_info.CRISecurityToken= 0; // No security token for the event - reg_info.CRIConsumerFlags= 0; // SMP_ENABLED_BIT; - reg_info.CRIFilterName= 0; // No event filtering - reg_info.CRIFilterDataLength= 0; // No filtering data - reg_info.CRIFilterData= 0; // No filtering data - /* Callback function for the event */ - (void *)reg_info.CRIConsumerCallback= (void *) refneb; - reg_info.CRIOrder= 0; // Event callback order - reg_info.CRIConsumerType= CHECK_CONSUMER; // Consumer type - - /* Register for the event with NEB */ - if (RegisterConsumer(®_info)) - { - consoleprintf("Failed to register for NSS Volume Deactivation event \n"); - return; - } - /* This ID is required for deregistration */ - neb_consumer_id= reg_info.CRIConsumerID; - - /* Get MySQL data volume name, stored in global variable datavolname */ - getvolumename(); - - /* - Get the NSS volume ID of the MySQL Data volume. - Volume ID is stored in a global variable - */ - getvolumeID((BYTE*) datavolname); -} - - -/** - Callback for NSS Volume Deactivation event. -*/ - -ulong neb_event_callback(struct EventBlock *eblock) -{ - EventChangeVolStateEnter_s *voldata; - extern bool nw_panic; - - voldata= (EventChangeVolStateEnter_s *)eblock->EBEventData; - - /* Deactivation of a volume */ - if ((voldata->oldState == zVOLSTATE_ACTIVE && - voldata->newState == zVOLSTATE_DEACTIVE || - voldata->newState == zVOLSTATE_MAINTENANCE)) - { - /* - Ensure that we bring down MySQL server only for MySQL data - volume deactivation - */ - if (!memcmp(&voldata->volID, &datavolid, sizeof(VolumeID_t))) - { - consoleprintf("MySQL data volume is deactivated, shutting down MySQL Server \n"); - event_flag= TRUE; - nw_panic = TRUE; - event_flag= TRUE; - kill_server(0); - } - } - return 0; -} - - -#define ADMIN_VOL_PATH "_ADMIN:/Volumes/" - -/** - Function to get NSS volume ID of the MySQL data. -*/ -static void getvolumeID(BYTE *volumeName) -{ - char path[zMAX_FULL_NAME]; - Key_t rootKey= 0, fileKey= 0; - QUAD getInfoMask; - zInfo_s info; - STATUS status; - - /* Get the root key */ - if ((status= zRootKey(0, &rootKey)) != zOK) - { - consoleprintf("\nGetNSSVolumeProperties - Failed to get root key, status: %d\n.", (int) status); - goto exit; - } - - /* - Get the file key. This is the key to the volume object in the - NSS admin volumes directory. - */ - - strxmov(path, (const char *) ADMIN_VOL_PATH, (const char *) volumeName, - NullS); - if ((status= zOpen(rootKey, zNSS_TASK, zNSPACE_LONG|zMODE_UTF8, - (BYTE *) path, zRR_READ_ACCESS, &fileKey)) != zOK) - { - consoleprintf("\nGetNSSVolumeProperties - Failed to get file, status: %d\n.", (int) status); - goto exit; - } - - getInfoMask= zGET_IDS | zGET_VOLUME_INFO ; - if ((status= zGetInfo(fileKey, getInfoMask, sizeof(info), - zINFO_VERSION_A, &info)) != zOK) - { - consoleprintf("\nGetNSSVolumeProperties - Failed in zGetInfo, status: %d\n.", (int) status); - goto exit; - } - - /* Copy the data to global variable */ - datavolid.timeLow= info.vol.volumeID.timeLow; - datavolid.timeMid= info.vol.volumeID.timeMid; - datavolid.timeHighAndVersion= info.vol.volumeID.timeHighAndVersion; - datavolid.clockSeqHighAndReserved= info.vol.volumeID.clockSeqHighAndReserved; - datavolid.clockSeqLow= info.vol.volumeID.clockSeqLow; - /* This is guranteed to be 6-byte length (but sizeof() would be better) */ - memcpy(datavolid.node, info.vol.volumeID.node, (unsigned int) 6); - -exit: - if (rootKey) - zClose(rootKey); - if (fileKey) - zClose(fileKey); -} - - -static void init_signals(void) -{ - int signals[] = {SIGINT,SIGILL,SIGFPE,SIGSEGV,SIGTERM,SIGABRT}; - - for (uint i=0 ; i < sizeof(signals)/sizeof(int) ; i++) - signal(signals[i], kill_server); - mysql_cb_init(); // initialize callbacks - -} - - -static void start_signal_handler(void) -{ - // Save vm id of this process - if (!opt_bootstrap) - create_pid_file(); - // no signal handler -} - - -/** - Warn if the data is on a Traditional volume. - - @note - Already done by mysqld_safe -*/ - -static void check_data_home(const char *path) -{ -} - -#endif /*__WIN__ || __NETWARE */ +#endif /* __WIN__ */ #ifdef HAVE_LINUXTHREADS #define UNSAFE_DEFAULT_LINUX_THREADS 200 @@ -2647,7 +2377,6 @@ extern "C" sig_handler handle_segfault(int sig) { time_t curr_time; struct tm tm; - THD *thd=current_thd; /* Strictly speaking, one needs a mutex here @@ -2707,13 +2436,15 @@ the thread stack. Please read http://dev.mysql.com/doc/mysql/en/linux.html\n\n", #endif /* HAVE_LINUXTHREADS */ #ifdef HAVE_STACKTRACE + THD *thd=current_thd; + if (!(test_flags & TEST_NO_STACKTRACE)) { - fprintf(stderr,"thd: 0x%lx\n",(long) thd); - fprintf(stderr,"\ -Attempting backtrace. You can use the following information to find out\n\ -where mysqld died. If you see no messages after this, something went\n\ -terribly wrong...\n"); + fprintf(stderr, "thd: 0x%lx\n",(long) thd); + fprintf(stderr, "Attempting backtrace. You can use the following " + "information to find out\nwhere mysqld died. If " + "you see no messages after this, something went\n" + "terribly wrong...\n"); my_print_stacktrace(thd ? (uchar*) thd->thread_stack : NULL, my_thread_stack_size); } @@ -2796,7 +2527,7 @@ bugs.\n"); #endif } -#if !defined(__WIN__) && !defined(__NETWARE__) +#if !defined(__WIN__) #ifndef SA_RESETHAND #define SA_RESETHAND 0 #endif @@ -4317,10 +4048,6 @@ a file name for --log-bin-index option", opt_binlog_index_name); mysql_bin_log.purge_logs_before_date(purge_time); } #endif -#ifdef __NETWARE__ - /* Increasing stacksize of threads on NetWare */ - pthread_attr_setstacksize(&connection_attrib, NW_THD_STACKSIZE); -#endif if (opt_myisam_log) (void) mi_log(1); @@ -4554,16 +4281,6 @@ int mysqld_main(int argc, char **argv) buffered_logs.buffer(WARNING_LEVEL, "Performance schema disabled (reason: init failed)."); } - else - { - buffered_logs.buffer(INFORMATION_LEVEL, - "Performance schema enabled."); - } - } - else - { - buffered_logs.buffer(INFORMATION_LEVEL, - "Performance schema disabled (reason: start parameters)."); } } #else @@ -4709,10 +4426,6 @@ int mysqld_main(int argc, char **argv) } } #endif -#ifdef __NETWARE__ - /* Increasing stacksize of threads on NetWare */ - pthread_attr_setstacksize(&connection_attrib, NW_THD_STACKSIZE); -#endif (void) thr_setconcurrency(concurrency); // 10 by default @@ -4790,9 +4503,9 @@ int mysqld_main(int argc, char **argv) { abort_loop=1; select_thread_in_use=0; -#ifndef __NETWARE__ + (void) pthread_kill(signal_thread, MYSQL_KILL_SIGNAL); -#endif /* __NETWARE__ */ + if (!opt_bootstrap) mysql_file_delete(key_file_pid, pidfile_name, MYF(MY_WME)); // Not needed anymore @@ -4831,7 +4544,14 @@ int mysqld_main(int argc, char **argv) #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE initialize_performance_schema_acl(opt_bootstrap); - check_performance_schema(); + /* + Do not check the structure of the performance schema tables + during bootstrap: + - the tables are not supposed to exist yet, bootstrap will create them + - a check would print spurious error messages + */ + if (! opt_bootstrap) + check_performance_schema(); #endif initialize_information_schema_acl(); @@ -5338,15 +5058,12 @@ static void create_new_thread(THD *thd) inline void kill_broken_server() { /* hack to get around signals ignored in syscalls for problem OS's */ - if ( -#if !defined(__NETWARE__) - unix_sock == INVALID_SOCKET || -#endif + if (unix_sock == INVALID_SOCKET || (!opt_disable_networking && ip_sock == INVALID_SOCKET)) { select_thread_in_use = 0; /* The following call will never return */ - kill_server(IF_NETWARE(MYSQL_KILL_SIGNAL, (void*) MYSQL_KILL_SIGNAL)); + kill_server((void*) MYSQL_KILL_SIGNAL); } } #define MAYBE_BROKEN_SYSCALL kill_broken_server(); @@ -5480,13 +5197,6 @@ void handle_connections_sockets() size_socket length= sizeof(struct sockaddr_storage); new_sock= accept(sock, (struct sockaddr *)(&cAddr), &length); -#ifdef __NETWARE__ - // TODO: temporary fix, waiting for TCP/IP fix - DEFECT000303149 - if ((new_sock == INVALID_SOCKET) && (socket_errno == EINVAL)) - { - kill_server(SIGTERM); - } -#endif if (new_sock != INVALID_SOCKET || (socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN)) break; @@ -6425,7 +6135,7 @@ static int show_heartbeat_period(THD *thd, SHOW_VAR *var, char *buff) { var->type= SHOW_CHAR; var->value= buff; - my_sprintf(buff, (buff, "%.3f",active_mi->heartbeat_period)); + sprintf(buff, "%.3f", active_mi->heartbeat_period); } else var->type= SHOW_UNDEF; @@ -7142,23 +6852,21 @@ static int mysql_init_variables(void) shared_memory_base_name= default_shared_memory_base_name; #endif -#if defined(__WIN__) || defined(__NETWARE__) - /* Allow Win32 and NetWare users to move MySQL anywhere */ +#if defined(__WIN__) + /* Allow Win32 users to move MySQL anywhere */ { char prg_dev[LIBLEN]; -#if defined __WIN__ - char executing_path_name[LIBLEN]; - if (!test_if_hard_path(my_progname)) - { - // we don't want to use GetModuleFileName inside of my_path since - // my_path is a generic path dereferencing function and here we care - // only about the executing binary. - GetModuleFileName(NULL, executing_path_name, sizeof(executing_path_name)); - my_path(prg_dev, executing_path_name, NULL); - } - else -#endif - my_path(prg_dev,my_progname,"mysql/bin"); + char executing_path_name[LIBLEN]; + if (!test_if_hard_path(my_progname)) + { + // we don't want to use GetModuleFileName inside of my_path since + // my_path is a generic path dereferencing function and here we care + // only about the executing binary. + GetModuleFileName(NULL, executing_path_name, sizeof(executing_path_name)); + my_path(prg_dev, executing_path_name, NULL); + } + else + my_path(prg_dev, my_progname, "mysql/bin"); strcat(prg_dev,"/../"); // Remove 'bin' to get base dir cleanup_dirname(mysql_home,prg_dev); } @@ -7576,13 +7284,8 @@ static int get_options(int *argc_ptr, char ***argv_ptr) } if (opt_disable_networking) - { -#if defined(__NETWARE__) - sql_print_error("Can't start server: skip-networking option is currently not supported on NetWare"); - return 1; -#endif mysqld_port= 0; - } + if (opt_skip_show_db) opt_specialflag|= SPECIAL_SKIP_SHOW_DB; diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 83435740ead..6f0b7a817ca 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -44,9 +44,6 @@ #include #include #include "probes_mysql.h" -#ifdef __NETWARE__ -#include -#endif #ifdef EMBEDDED_LIBRARY #undef MYSQL_SERVER diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 48235ba588a..af5b4b7c7d6 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1227,7 +1227,7 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT() QUICK_INDEX_MERGE_SELECT::QUICK_INDEX_MERGE_SELECT(THD *thd_param, TABLE *table) - :pk_quick_select(NULL), thd(thd_param) + :unique(NULL), pk_quick_select(NULL), thd(thd_param) { DBUG_ENTER("QUICK_INDEX_MERGE_SELECT::QUICK_INDEX_MERGE_SELECT"); index= MAX_KEY; @@ -1269,6 +1269,7 @@ QUICK_INDEX_MERGE_SELECT::~QUICK_INDEX_MERGE_SELECT() List_iterator_fast quick_it(quick_selects); QUICK_RANGE_SELECT* quick; DBUG_ENTER("QUICK_INDEX_MERGE_SELECT::~QUICK_INDEX_MERGE_SELECT"); + delete unique; quick_it.rewind(); while ((quick= quick_it++)) quick->file= NULL; @@ -7716,7 +7717,7 @@ check_quick_keys(PARAM *param, uint idx, SEL_ARG *key_tree, if (unlikely(param->thd->killed != 0)) return HA_POS_ERROR; - + keynr=param->real_keynr[idx]; param->range_count++; if (!tmp_min_flag && ! tmp_max_flag && @@ -8252,7 +8253,6 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge() List_iterator_fast cur_quick_it(quick_selects); QUICK_RANGE_SELECT* cur_quick; int result; - Unique *unique; handler *file= head->file; DBUG_ENTER("QUICK_INDEX_MERGE_SELECT::read_keys_and_merge"); @@ -8271,9 +8271,22 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge() if (cur_quick->init() || cur_quick->reset()) DBUG_RETURN(1); - unique= new Unique(refpos_order_cmp, (void *)file, - file->ref_length, - thd->variables.sortbuff_size); + if (unique == NULL) + { + DBUG_EXECUTE_IF("index_merge_may_not_create_a_Unique", abort(); ); + DBUG_EXECUTE_IF("only_one_Unique_may_be_created", + DBUG_SET("+d,index_merge_may_not_create_a_Unique"); ); + + unique= new Unique(refpos_order_cmp, (void *)file, + file->ref_length, + thd->variables.sortbuff_size); + } + else + unique->reset(); + + DBUG_ASSERT(file->ref_length == unique->get_size()); + DBUG_ASSERT(thd->variables.sortbuff_size == unique->get_max_in_memory_size()); + if (!unique) DBUG_RETURN(1); for (;;) @@ -8288,10 +8301,7 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge() if (cur_quick->file->inited != handler::NONE) cur_quick->file->ha_index_end(); if (cur_quick->init() || cur_quick->reset()) - { - delete unique; DBUG_RETURN(1); - } } if (result) @@ -8299,17 +8309,13 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge() if (result != HA_ERR_END_OF_FILE) { cur_quick->range_end(); - delete unique; DBUG_RETURN(result); } break; } if (thd->killed) - { - delete unique; DBUG_RETURN(1); - } /* skip row if it will be retrieved by clustered PK scan */ if (pk_quick_select && pk_quick_select->row_in_ranges()) @@ -8318,10 +8324,7 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge() cur_quick->file->position(cur_quick->record); result= unique->unique_add((char*)cur_quick->file->ref); if (result) - { - delete unique; DBUG_RETURN(1); - } } /* @@ -8330,7 +8333,6 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge() sequence. */ result= unique->get(head); - delete unique; doing_pk_scan= FALSE; /* index_merge currently doesn't support "using index" at all */ head->set_keyread(FALSE); @@ -8448,6 +8450,7 @@ int QUICK_ROR_INTERSECT_SELECT::get_next() if ((error= quick->get_next())) DBUG_RETURN(error); } + quick->file->position(quick->record); } memcpy(last_rowid, quick->file->ref, head->file->ref_length); last_rowid_count= 1; @@ -10425,7 +10428,7 @@ QUICK_GROUP_MIN_MAX_SELECT(TABLE *table, JOIN *join_arg, bool have_min_arg, ha_rows records_arg, uint key_infix_len_arg, uchar *key_infix_arg, MEM_ROOT *parent_alloc, bool is_index_scan_arg) - :join(join_arg), index_info(index_info_arg), + :file(table->file), join(join_arg), index_info(index_info_arg), group_prefix_len(group_prefix_len_arg), group_key_parts(group_key_parts_arg), have_min(have_min_arg), have_max(have_max_arg), have_agg_distinct(have_agg_distinct_arg), @@ -10435,7 +10438,6 @@ QUICK_GROUP_MIN_MAX_SELECT(TABLE *table, JOIN *join_arg, bool have_min_arg, is_index_scan(is_index_scan_arg) { head= table; - file= head->file; index= use_index; record= head->record[0]; tmp_record= head->record[1]; diff --git a/sql/opt_range.h b/sql/opt_range.h index 7f05bdb64f0..0d4000002b0 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -520,6 +520,7 @@ public: class QUICK_INDEX_MERGE_SELECT : public QUICK_SELECT_I { + Unique *unique; public: QUICK_INDEX_MERGE_SELECT(THD *thd, TABLE *table); ~QUICK_INDEX_MERGE_SELECT(); @@ -703,7 +704,7 @@ private: class QUICK_GROUP_MIN_MAX_SELECT : public QUICK_SELECT_I { private: - handler *file; /* The handler used to get data. */ + handler * const file; /* The handler used to get data. */ JOIN *join; /* Descriptor of the current query */ KEY *index_info; /* The index chosen for data access */ uchar *record; /* Buffer where the next record is returned. */ diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 5b0b681c3a6..43934551016 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -109,8 +109,8 @@ char *partition_info::create_default_partition_names(uint part_no, { do { - my_sprintf(move_ptr, (move_ptr,"p%u", (start_no + i))); - move_ptr+=MAX_PART_NAME_SIZE; + sprintf(move_ptr, "p%u", (start_no + i)); + move_ptr+= MAX_PART_NAME_SIZE; } while (++i < num_parts_arg); } else @@ -177,7 +177,7 @@ char *partition_info::create_subpartition_name(uint subpart_no, if (likely(ptr != NULL)) { - my_sprintf(ptr, (ptr, "%ssp%u", part_name, subpart_no)); + my_snprintf(ptr, size_alloc, "%ssp%u", part_name, subpart_no); } else { diff --git a/sql/protocol.cc b/sql/protocol.cc index ac78ac88ec6..3f957dcc2de 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -1166,16 +1166,12 @@ bool Protocol_text::store(MYSQL_TIME *tm) #endif char buff[40]; uint length; - length= my_sprintf(buff,(buff, "%04d-%02d-%02d %02d:%02d:%02d", - (int) tm->year, - (int) tm->month, - (int) tm->day, - (int) tm->hour, - (int) tm->minute, - (int) tm->second)); + length= sprintf(buff, "%04d-%02d-%02d %02d:%02d:%02d", + (int) tm->year, (int) tm->month, + (int) tm->day, (int) tm->hour, + (int) tm->minute, (int) tm->second); if (tm->second_part) - length+= my_sprintf(buff+length,(buff+length, ".%06d", - (int)tm->second_part)); + length+= sprintf(buff+length, ".%06d", (int) tm->second_part); return net_store_data((uchar*) buff, length); } @@ -1209,13 +1205,11 @@ bool Protocol_text::store_time(MYSQL_TIME *tm) char buff[40]; uint length; uint day= (tm->year || tm->month) ? 0 : tm->day; - length= my_sprintf(buff,(buff, "%s%02ld:%02d:%02d", - tm->neg ? "-" : "", - (long) day*24L+(long) tm->hour, - (int) tm->minute, - (int) tm->second)); + length= sprintf(buff, "%s%02ld:%02d:%02d", tm->neg ? "-" : "", + (long) day*24L+(long) tm->hour, (int) tm->minute, + (int) tm->second); if (tm->second_part) - length+= my_sprintf(buff+length,(buff+length, ".%06d", (int)tm->second_part)); + length+= sprintf(buff+length, ".%06d", (int) tm->second_part); return net_store_data((uchar*) buff, length); } diff --git a/sql/rpl_handler.cc b/sql/rpl_handler.cc index 55418cbec84..5f16544d855 100644 --- a/sql/rpl_handler.cc +++ b/sql/rpl_handler.cc @@ -89,29 +89,44 @@ int get_user_var_str(const char *name, char *value, int delegates_init() { - static Aligned_char_array trans_mem; - static Aligned_char_array storage_mem; + static my_aligned_storage trans_mem; + static my_aligned_storage storage_mem; #ifdef HAVE_REPLICATION - static Aligned_char_array transmit_mem; - static Aligned_char_array relay_io_mem; + static my_aligned_storage transmit_mem; + static my_aligned_storage relay_io_mem; #endif - if (!(transaction_delegate= new (trans_mem.arr()) Trans_delegate) - || (!transaction_delegate->is_inited()) - || !(binlog_storage_delegate= - new (storage_mem.arr()) Binlog_storage_delegate) - || (!binlog_storage_delegate->is_inited()) -#ifdef HAVE_REPLICATION - || !(binlog_transmit_delegate= - new (transmit_mem.arr()) Binlog_transmit_delegate) - || (!binlog_transmit_delegate->is_inited()) - || !(binlog_relay_io_delegate= - new (relay_io_mem.arr()) Binlog_relay_IO_delegate) - || (!binlog_relay_io_delegate->is_inited()) -#endif /* HAVE_REPLICATION */ - ) + void *place_trans_mem= trans_mem.data; + void *place_storage_mem= storage_mem.data; + + transaction_delegate= new (place_trans_mem) Trans_delegate; + + if (!transaction_delegate->is_inited()) return 1; + binlog_storage_delegate= new (place_storage_mem) Binlog_storage_delegate; + + if (!binlog_storage_delegate->is_inited()) + return 1; + +#ifdef HAVE_REPLICATION + void *place_transmit_mem= transmit_mem.data; + void *place_relay_io_mem= relay_io_mem.data; + + binlog_transmit_delegate= new (place_transmit_mem) Binlog_transmit_delegate; + + if (!binlog_transmit_delegate->is_inited()) + return 1; + + binlog_relay_io_delegate= new (place_relay_io_mem) Binlog_relay_IO_delegate; + + if (!binlog_relay_io_delegate->is_inited()) + return 1; +#endif + if (pthread_key_create(&RPL_TRANS_BINLOG_INFO, NULL)) return 1; return 0; diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index 308f6d7f06e..cda876ee764 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -479,16 +479,13 @@ int flush_master_info(Master_info* mi, (1 + mi->ignore_server_ids.elements), MYF(MY_WME)); if (!ignore_server_ids_buf) DBUG_RETURN(1); - for (ulong i= 0, cur_len= my_sprintf(ignore_server_ids_buf, - (ignore_server_ids_buf, "%u", - mi->ignore_server_ids.elements)); - i < mi->ignore_server_ids.elements; i++) + ulong cur_len= sprintf(ignore_server_ids_buf, "%u", + mi->ignore_server_ids.elements); + for (ulong i= 0; i < mi->ignore_server_ids.elements; i++) { ulong s_id; get_dynamic(&mi->ignore_server_ids, (uchar*) &s_id, i); - cur_len +=my_sprintf(ignore_server_ids_buf + cur_len, - (ignore_server_ids_buf + cur_len, - " %lu", s_id)); + cur_len+= sprintf(ignore_server_ids_buf + cur_len, " %lu", s_id); } } @@ -509,7 +506,7 @@ int flush_master_info(Master_info* mi, of file we don't care about this garbage. */ char heartbeat_buf[sizeof(mi->heartbeat_period) * 4]; // buffer to suffice always - my_sprintf(heartbeat_buf, (heartbeat_buf, "%.3f", mi->heartbeat_period)); + sprintf(heartbeat_buf, "%.3f", mi->heartbeat_period); my_b_seek(file, 0L); my_b_printf(file, "%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n%d\n%s\n%s\n%s\n", diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 08377fe887d..03c369394bf 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -1138,8 +1138,7 @@ bool Relay_log_info::cached_charset_compare(char *charset) const { DBUG_ENTER("Relay_log_info::cached_charset_compare"); - if (bcmp((uchar*) cached_charset, (uchar*) charset, - sizeof(cached_charset))) + if (memcmp(cached_charset, charset, sizeof(cached_charset))) { memcpy(const_cast(cached_charset), charset, sizeof(cached_charset)); DBUG_RETURN(1); diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc index 2c6a9e5d9b9..6f66905eb5d 100644 --- a/sql/rpl_utility.cc +++ b/sql/rpl_utility.cc @@ -517,10 +517,12 @@ void show_sql_type(enum_field_types type, uint16 metadata, String *str, CHARSET_ bool is_conversion_ok(int order, Relay_log_info *rli) { DBUG_ENTER("is_conversion_ok"); - bool allow_non_lossy= - bit_is_set(slave_type_conversions_options, SLAVE_TYPE_CONVERSIONS_ALL_NON_LOSSY); - bool allow_lossy= - bit_is_set(slave_type_conversions_options, SLAVE_TYPE_CONVERSIONS_ALL_LOSSY); + bool allow_non_lossy, allow_lossy; + + allow_non_lossy = slave_type_conversions_options & + (ULL(1) << SLAVE_TYPE_CONVERSIONS_ALL_NON_LOSSY); + allow_lossy= slave_type_conversions_options & + (ULL(1) << SLAVE_TYPE_CONVERSIONS_ALL_LOSSY); DBUG_PRINT("enter", ("order: %d, flags:%s%s", order, allow_non_lossy ? " ALL_NON_LOSSY" : "", diff --git a/sql/slave.cc b/sql/slave.cc index 58b23c44bc7..d41d0479dde 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1528,7 +1528,7 @@ when it try to get the value of TIME_ZONE global variable from master."; the period is an ulonglong of nano-secs. */ llstr((ulonglong) (mi->heartbeat_period*1000000000UL), llbuf); - my_sprintf(query, (query, query_format, llbuf)); + sprintf(query, query_format, llbuf); if (mysql_real_query(mysql, query, strlen(query)) && !check_io_slave_killed(mi->io_thd, mi, NULL)) @@ -1934,17 +1934,17 @@ bool show_master_info(THD* thd, Master_info* mi) ulong s_id, slen; char sbuff[FN_REFLEN]; get_dynamic(&mi->ignore_server_ids, (uchar*) &s_id, i); - slen= my_sprintf(sbuff, (sbuff, (i==0? "%lu" : ", %lu"), s_id)); + slen= sprintf(sbuff, (i==0? "%lu" : ", %lu"), s_id); if (cur_len + slen + 4 > FN_REFLEN) { /* break the loop whenever remained space could not fit ellipses on the next cycle */ - my_sprintf(buff + cur_len, (buff + cur_len, "...")); + sprintf(buff + cur_len, "..."); break; } - cur_len += my_sprintf(buff + cur_len, (buff + cur_len, "%s", sbuff)); + cur_len += sprintf(buff + cur_len, "%s", sbuff); } protocol->store(buff, &my_charset_bin); } @@ -2295,7 +2295,7 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli) DBUG_PRINT("info", ("thd->options: %s%s; rli->last_event_start_time: %lu", FLAGSTR(thd->variables.option_bits, OPTION_NOT_AUTOCOMMIT), FLAGSTR(thd->variables.option_bits, OPTION_BEGIN), - rli->last_event_start_time)); + (ulong) rli->last_event_start_time)); /* Execute the event to change the database and update the binary @@ -3125,8 +3125,8 @@ pthread_handler_t handle_slave_sql(void *arg) char llbuff[22],llbuff1[22]; char saved_log_name[FN_REFLEN]; char saved_master_log_name[FN_REFLEN]; - my_off_t saved_log_pos; - my_off_t saved_master_log_pos; + my_off_t UNINIT_VAR(saved_log_pos); + my_off_t UNINIT_VAR(saved_master_log_pos); my_off_t saved_skip= 0; Relay_log_info* rli = &((Master_info*)arg)->rli; diff --git a/sql/spatial.cc b/sql/spatial.cc index fcf06119db9..f96196cb836 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -36,7 +36,7 @@ static Geometry::Class_info **ci_collection_end= Geometry::ci_collection+Geometry::wkb_last + 1; Geometry::Class_info::Class_info(const char *name, int type_id, - void(*create_func)(void *)): + create_geom_t create_func): m_type_id(type_id), m_create_func(create_func) { m_name.str= (char *) name; @@ -45,39 +45,39 @@ Geometry::Class_info::Class_info(const char *name, int type_id, ci_collection[type_id]= this; } -static void create_point(void *buffer) +static Geometry *create_point(char *buffer) { - new(buffer) Gis_point; + return new (buffer) Gis_point; } -static void create_linestring(void *buffer) +static Geometry *create_linestring(char *buffer) { - new(buffer) Gis_line_string; + return new (buffer) Gis_line_string; } -static void create_polygon(void *buffer) +static Geometry *create_polygon(char *buffer) { - new(buffer) Gis_polygon; + return new (buffer) Gis_polygon; } -static void create_multipoint(void *buffer) +static Geometry *create_multipoint(char *buffer) { - new(buffer) Gis_multi_point; + return new (buffer) Gis_multi_point; } -static void create_multipolygon(void *buffer) +static Geometry *create_multipolygon(char *buffer) { - new(buffer) Gis_multi_polygon; + return new (buffer) Gis_multi_polygon; } -static void create_multilinestring(void *buffer) +static Geometry *create_multilinestring(char *buffer) { - new(buffer) Gis_multi_line_string; + return new (buffer) Gis_multi_line_string; } -static void create_geometrycollection(void *buffer) +static Geometry *create_geometrycollection(char *buffer) { - new(buffer) Gis_geometry_collection; + return new (buffer) Gis_geometry_collection; } @@ -131,10 +131,9 @@ Geometry::Class_info *Geometry::find_class(const char *name, uint32 len) Geometry *Geometry::create_by_typeid(Geometry_buffer *buffer, int type_id) { Class_info *ci; - if (!(ci= find_class((int) type_id))) + if (!(ci= find_class(type_id))) return NULL; - (*ci->m_create_func)(buffer->buf.arr()); - return my_reinterpret_cast(Geometry *)(buffer->buf.arr()); + return (*ci->m_create_func)(buffer->data); } @@ -172,9 +171,7 @@ Geometry *Geometry::create_from_wkt(Geometry_buffer *buffer, if (!(ci= find_class(name.str, name.length)) || wkt->reserve(1 + 4, 512)) return NULL; - (*ci->m_create_func)((void *)buffer); - Geometry *result= (Geometry *)buffer; - + Geometry *result= (*ci->m_create_func)(buffer->data); wkt->q_append((char) wkb_ndr); wkt->q_append((uint32) result->get_class_info()->m_type_id); if (trs->check_next_symbol('(') || diff --git a/sql/spatial.h b/sql/spatial.h index aabbb7a1b97..b0c609ceeef 100644 --- a/sql/spatial.h +++ b/sql/spatial.h @@ -17,6 +17,7 @@ #define _spatial_h #include "sql_string.h" /* String, LEX_STRING */ +#include #ifdef HAVE_SPATIAL @@ -229,15 +230,18 @@ public: { wkb_xdr= 0, /* Big Endian */ wkb_ndr= 1 /* Little Endian */ - }; + }; + + /** Callback which creates Geometry objects on top of a given placement. */ + typedef Geometry *(*create_geom_t)(char *); class Class_info { public: LEX_STRING m_name; int m_type_id; - void (*m_create_func)(void *); - Class_info(const char *name, int type_id, void(*create_func)(void *)); + create_geom_t m_create_func; + Class_info(const char *name, int type_id, create_geom_t create_func); }; virtual const Class_info *get_class_info() const=0; @@ -525,10 +529,8 @@ public: const Class_info *get_class_info() const; }; -struct Geometry_buffer -{ - Aligned_char_array buf; -}; +struct Geometry_buffer : public + my_aligned_storage {}; #endif /*HAVE_SPATAIAL*/ #endif diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 99226bad03f..d4c4f464884 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -210,6 +210,7 @@ static bool compare_hostname(const acl_host_and_ip *host,const char *hostname, const char *ip); static my_bool acl_load(THD *thd, TABLE_LIST *tables); static my_bool grant_load(THD *thd, TABLE_LIST *tables); +static inline void get_grantor(THD *thd, char* grantor); /* Convert scrambled password to binary form, according to scramble type, @@ -1642,12 +1643,10 @@ bool change_password(THD *thd, const char *host, const char *user, result= 0; if (mysql_bin_log.is_open()) { - query_length= - my_sprintf(buff, - (buff,"SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'", - acl_user->user ? acl_user->user : "", - acl_user->host.hostname ? acl_user->host.hostname : "", - new_password)); + query_length= sprintf(buff, "SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'", + acl_user->user ? acl_user->user : "", + acl_user->host.hostname ? acl_user->host.hostname : "", + new_password); thd->clear_error(); result= thd->binlog_query(THD::STMT_QUERY_TYPE, buff, query_length, FALSE, FALSE, FALSE, 0); @@ -2753,6 +2752,20 @@ end: DBUG_RETURN(result); } +static inline void get_grantor(THD *thd, char *grantor) +{ + const char *user= thd->security_ctx->user; + const char *host= thd->security_ctx->host_or_ip; + +#if defined(HAVE_REPLICATION) + if (thd->slave_thread && thd->has_invoker()) + { + user= thd->get_invoker_user().str; + host= thd->get_invoker_host().str; + } +#endif + strxmov(grantor, user, "@", host, NullS); +} static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, TABLE *table, const LEX_USER &combo, @@ -2767,9 +2780,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, uchar user_key[MAX_KEY_LENGTH]; DBUG_ENTER("replace_table_table"); - strxmov(grantor, thd->security_ctx->user, "@", - thd->security_ctx->host_or_ip, NullS); - + get_grantor(thd, grantor); /* The following should always succeed as new users are created before this function is called! @@ -2899,9 +2910,7 @@ static int replace_routine_table(THD *thd, GRANT_NAME *grant_name, DBUG_RETURN(-1); } - strxmov(grantor, thd->security_ctx->user, "@", - thd->security_ctx->host_or_ip, NullS); - + get_grantor(thd, grantor); /* New users are created before this function is called. diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index 0b3e5117c97..4b6756188dd 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -408,7 +408,7 @@ void field_real::add() if ((decs = decimals()) == NOT_FIXED_DEC) { - length= my_sprintf(buff, (buff, "%g", num)); + length= sprintf(buff, "%g", num); if (rint(num) != num) max_notzero_dec_len = 1; } @@ -419,7 +419,7 @@ void field_real::add() snprintf(buff, sizeof(buff)-1, "%-.*f", (int) decs, num); length = (uint) strlen(buff); #else - length= my_sprintf(buff, (buff, "%-.*f", (int) decs, num)); + length= sprintf(buff, "%-.*f", (int) decs, num); #endif // We never need to check further than this @@ -1006,9 +1006,9 @@ void field_decimal::get_opt_type(String *answer, my_decimal_set_zero(&zero); my_bool is_unsigned= (my_decimal_cmp(&zero, &min_arg) >= 0); - length= my_sprintf(buff, (buff, "DECIMAL(%d, %d)", - (int) (max_length - (item->decimals ? 1 : 0)), - item->decimals)); + length= my_snprintf(buff, sizeof(buff), "DECIMAL(%d, %d)", + (int) (max_length - (item->decimals ? 1 : 0)), + item->decimals); if (is_unsigned) length= (uint) (strmov(buff+length, " UNSIGNED")- buff); answer->append(buff, length); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index f18d5e26f01..790898baae6 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -8469,15 +8469,15 @@ my_bool mysql_rm_tmp_tables(void) (file->name[1] == '.' && !file->name[2]))) continue; - if (!bcmp((uchar*) file->name, (uchar*) tmp_file_prefix, - tmp_file_prefix_length)) + if (!memcmp(file->name, tmp_file_prefix, + tmp_file_prefix_length)) { char *ext= fn_ext(file->name); uint ext_len= strlen(ext); uint filePath_len= my_snprintf(filePath, sizeof(filePath), "%s%c%s", tmpdir, FN_LIBCHAR, file->name); - if (!bcmp((uchar*) reg_ext, (uchar*) ext, ext_len)) + if (!memcmp(reg_ext, ext, ext_len)) { handler *handler_file= 0; /* We should cut file extention before deleting of table */ diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc index 52ac34b7b60..6f59c3f51e1 100644 --- a/sql/sql_binlog.cc +++ b/sql/sql_binlog.cc @@ -52,9 +52,13 @@ void mysql_client_binlog_statement(THD* thd) if (check_global_access(thd, SUPER_ACL)) DBUG_VOID_RETURN; - size_t coded_len= thd->lex->comment.length + 1; + size_t coded_len= thd->lex->comment.length; + if (!coded_len) + { + my_error(ER_SYNTAX_ERROR, MYF(0)); + DBUG_VOID_RETURN; + } size_t decoded_len= base64_needed_decoded_length(coded_len); - DBUG_ASSERT(coded_len > 0); /* Allocation @@ -155,14 +159,16 @@ void mysql_client_binlog_statement(THD* thd) /* Checking that the first event in the buffer is not truncated. */ - ulong event_len= uint4korr(bufptr + EVENT_LEN_OFFSET); - DBUG_PRINT("info", ("event_len=%lu, bytes_decoded=%d", - event_len, bytes_decoded)); - if (bytes_decoded < EVENT_LEN_OFFSET || (uint) bytes_decoded < event_len) + ulong event_len; + if (bytes_decoded < EVENT_LEN_OFFSET + 4 || + (event_len= uint4korr(bufptr + EVENT_LEN_OFFSET)) > + (uint) bytes_decoded) { my_error(ER_SYNTAX_ERROR, MYF(0)); goto end; } + DBUG_PRINT("info", ("event_len=%lu, bytes_decoded=%d", + event_len, bytes_decoded)); /* If we have not seen any Format_description_event, then we must @@ -200,17 +206,6 @@ void mysql_client_binlog_statement(THD* thd) bufptr += event_len; DBUG_PRINT("info",("ev->get_type_code()=%d", ev->get_type_code())); -#ifndef HAVE_purify - /* - This debug printout should not be used for valgrind builds - since it will read from unassigned memory. - */ - DBUG_PRINT("info",("bufptr+EVENT_TYPE_OFFSET: 0x%lx", - (long) (bufptr+EVENT_TYPE_OFFSET))); - DBUG_PRINT("info", ("bytes_decoded: %d bufptr: 0x%lx buf[EVENT_LEN_OFFSET]: %lu", - bytes_decoded, (long) bufptr, - (ulong) uint4korr(bufptr+EVENT_LEN_OFFSET))); -#endif ev->thd= thd; /* We go directly to the application phase, since we don't need diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h index 8d00c984d14..54a207c8adf 100644 --- a/sql/sql_bitmap.h +++ b/sql/sql_bitmap.h @@ -102,16 +102,7 @@ template <> class Bitmap<64> ulonglong map; public: Bitmap<64>() { } -#if defined(__NETWARE__) || defined(__MWERKS__) - /* - Metwork compiler gives error on Bitmap<64> - Changed to Bitmap, since in this case also it will proper construct - this class - */ - explicit Bitmap(uint prefix_to_set) { set_prefix(prefix_to_set); } -#else explicit Bitmap<64>(uint prefix_to_set) { set_prefix(prefix_to_set); } -#endif void init() { } void init(uint prefix_to_set) { set_prefix(prefix_to_set); } uint length() const { return 64; } diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 2fbdc2b58ac..eb4d353db81 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -628,6 +628,9 @@ THD::THD() thr_lock_owner_init(&main_lock_id, &lock_info); m_internal_handler= NULL; + current_user_used= FALSE; + memset(&invoker_user, 0, sizeof(invoker_user)); + memset(&invoker_host, 0, sizeof(invoker_host)); } @@ -1168,6 +1171,9 @@ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var) while (to != end) *(to++)+= *(from++); + + to_var->bytes_received+= from_var->bytes_received; + to_var->bytes_sent+= from_var->bytes_sent; } /* @@ -1193,6 +1199,9 @@ void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var, while (to != end) *(to++)+= *(from++) - *(dec++); + + to_var->bytes_received+= from_var->bytes_received - dec_var->bytes_received;; + to_var->bytes_sent+= from_var->bytes_sent - dec_var->bytes_sent; } @@ -1344,6 +1353,7 @@ void THD::cleanup_after_query() where= THD::DEFAULT_WHERE; /* reset table map for multi-table update */ table_map_for_update= 0; + clean_current_user_used(); } @@ -3412,6 +3422,22 @@ void THD::leave_locked_tables_mode() mysql_ha_move_tickets_after_trans_sentinel(this); } +void THD::get_definer(LEX_USER *definer) +{ + set_current_user_used(); +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + if (slave_thread && has_invoker()) + { + definer->user = invoker_user; + definer->host= invoker_host; + definer->password.str= NULL; + definer->password.length= 0; + } + else +#endif + get_default_definer(this, definer); +} + /** Mark transaction to rollback and mark error as fatal to a sub-statement. diff --git a/sql/sql_class.h b/sql/sql_class.h index db22fc5d67b..c095fee6232 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -472,15 +472,18 @@ typedef struct system_variables my_bool sysdate_is_now; double long_query_time_double; + } SV; -/* per thread status variables */ +/** + Per thread status variables. + Must be long/ulong up to last_system_status_var so that + add_to_status/add_diff_to_status can work. +*/ typedef struct system_status_var { - ulonglong bytes_received; - ulonglong bytes_sent; ulong com_other; ulong com_stat[(uint) SQLCOM_END]; ulong created_tmp_disk_tables; @@ -536,13 +539,14 @@ typedef struct system_status_var Number of statements sent from the client */ ulong questions; + + ulonglong bytes_received; + ulonglong bytes_sent; /* IMPORTANT! SEE last_system_status_var DEFINITION BELOW. - Below 'last_system_status_var' are all variables which doesn't make any - sense to add to the /global/ status variable counter. - Status variables which it does not make sense to add to - global status variable counter + Below 'last_system_status_var' are all variables that cannot be handled + automatically by add_to_status()/add_diff_to_status(). */ double last_query_cost; } STATUS_VAR; @@ -2459,7 +2463,12 @@ public: /** Return FALSE if connection to client is broken. */ bool is_connected() { - return vio_ok() ? vio_is_connected(net.vio) : FALSE; + /* + All system threads (e.g., the slave IO thread) are connected but + not using vio. So this function always returns true for all + system threads. + */ + return system_thread || (vio_ok() ? vio_is_connected(net.vio) : FALSE); } #else inline bool vio_ok() const { return TRUE; } @@ -2839,6 +2848,18 @@ public: } void leave_locked_tables_mode(); int decide_logging_format(TABLE_LIST *tables); + void set_current_user_used() { current_user_used= TRUE; } + bool is_current_user_used() { return current_user_used; } + void clean_current_user_used() { current_user_used= FALSE; } + void get_definer(LEX_USER *definer); + void set_invoker(const LEX_STRING *user, const LEX_STRING *host) + { + invoker_user= *user; + invoker_host= *host; + } + LEX_STRING get_invoker_user() { return invoker_user; } + LEX_STRING get_invoker_host() { return invoker_host; } + bool has_invoker() { return invoker_user.length > 0; } private: /** The current internal error handler for this thread, or NULL. */ @@ -2861,6 +2882,25 @@ private: MEM_ROOT main_mem_root; Warning_info main_warning_info; Diagnostics_area main_da; + + /** + It will be set TURE if CURRENT_USER() is called in account management + statements or default definer is set in CREATE/ALTER SP, SF, Event, + TRIGGER or VIEW statements. + + Current user will be binlogged into Query_log_event if current_user_used + is TRUE; It will be stored into invoker_host and invoker_user by SQL thread. + */ + bool current_user_used; + + /** + It points to the invoker in the Query_log_event. + SQL thread use it as the default definer in CREATE/ALTER SP, SF, Event, + TRIGGER or VIEW statements or current user in account management + statements if it is not NULL. + */ + LEX_STRING invoker_user; + LEX_STRING invoker_host; }; @@ -3415,6 +3455,9 @@ public: void reset(); bool walk(tree_walk_action action, void *walk_action_arg); + uint get_size() const { return size; } + ulonglong get_max_in_memory_size() const { return max_in_memory_size; } + friend int unique_write_to_file(uchar* key, element_count count, Unique *unique); friend int unique_write_to_ptrs(uchar* key, element_count count, Unique *unique); }; diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 05d20b386dd..003203b5466 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -1072,10 +1072,6 @@ static void prepare_new_connection_state(THD* thd) { Security_context *sctx= thd->security_ctx; -#ifdef __NETWARE__ - netware_reg_user(sctx->ip, sctx->user, "MySQL"); -#endif - if (thd->client_capabilities & CLIENT_COMPRESS) thd->net.compress=1; // Use compression diff --git a/sql/sql_list.h b/sql/sql_list.h index cc42fcae91b..5cd24236644 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -85,7 +85,7 @@ public: SQL_I_List() { empty(); } - SQL_I_List(const SQL_I_List &tmp) + SQL_I_List(const SQL_I_List &tmp) : Sql_alloc() { elements= tmp.elements; first= tmp.first; diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 9a5792407b1..b2a816a69dd 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -355,7 +355,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, (void) fn_format(name, ex->file_name, mysql_real_data_home, "", MY_RELATIVE_PATH | MY_UNPACK_FILENAME | MY_RETURN_REAL_PATH); -#if !defined(__WIN__) && ! defined(__NETWARE__) +#if !defined(__WIN__) MY_STAT stat_info; if (!mysql_file_stat(key_file_load, name, &stat_info, MYF(MY_WME))) DBUG_RETURN(TRUE); @@ -1441,29 +1441,6 @@ int READ_INFO::read_field() while ( to < end_of_buff) { chr = GET; -#ifdef USE_MB - if ((my_mbcharlen(read_charset, chr) > 1) && - to+my_mbcharlen(read_charset, chr) <= end_of_buff) - { - uchar* p = (uchar*)to; - *to++ = chr; - int ml = my_mbcharlen(read_charset, chr); - int i; - for (i=1; i 1 && + to + my_mbcharlen(read_charset, chr) <= end_of_buff) + { + uchar* p= (uchar*) to; + int ml, i; + *to++ = chr; + + ml= my_mbcharlen(read_charset, chr); + + for (i= 1; i < ml; i++) + { + chr= GET; + if (chr == my_b_EOF) + { + /* + Need to back up the bytes already ready from illformed + multi-byte char + */ + to-= i; + goto found_eof; + } + *to++ = chr; + } + if (my_ismbchar(read_charset, + (const char *)p, + (const char *)to)) + continue; + for (i= 0; i < ml; i++) + PUSH((uchar) *--to); + chr= GET; + } +#endif *to++ = (uchar) chr; } /* diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 3cc4964ebe9..8a94aea8aa7 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -7623,7 +7623,7 @@ LEX_USER *create_default_definer(THD *thd) if (! (definer= (LEX_USER*) thd->alloc(sizeof(LEX_USER)))) return 0; - get_default_definer(thd, definer); + thd->get_definer(definer); return definer; } diff --git a/sql/sql_parse.h b/sql/sql_parse.h index df76df72e09..475811d45b7 100644 --- a/sql/sql_parse.h +++ b/sql/sql_parse.h @@ -183,9 +183,8 @@ inline bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *table_list) inline bool check_some_routine_access(THD *thd, const char *db, const char *name, bool is_proc) { return false; } -inline bool check_access(THD *thd, ulong access, const char *db, - ulong *save_priv, bool no_grant, bool no_errors, - bool schema_db) +inline bool check_access(THD *, ulong, const char *, ulong *save_priv, + GRANT_INTERNAL_INFO *, bool, bool) { if (save_priv) *save_priv= GLOBAL_ACLS; diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 09ae0acc6ad..089e751900e 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -791,6 +791,19 @@ static void setup_one_conversion_function(THD *thd, Item_param *param, } #ifndef EMBEDDED_LIBRARY + +/** + Check whether this parameter data type is compatible with long data. + Used to detect whether a long data stream has been supplied to a + incompatible data type. +*/ +inline bool is_param_long_data_type(Item_param *param) +{ + return ((param->param_type >= MYSQL_TYPE_TINY_BLOB) && + (param->param_type <= MYSQL_TYPE_STRING)); +} + + /** Routines to assign parameters from data supplied by the client. @@ -860,6 +873,14 @@ static bool insert_params_with_log(Prepared_statement *stmt, uchar *null_array, DBUG_RETURN(1); } } + /* + A long data stream was supplied for this parameter marker. + This was done after prepare, prior to providing a placeholder + type (the types are supplied at execute). Check that the + supplied type of placeholder can accept a data stream. + */ + else if (!is_param_long_data_type(param)) + DBUG_RETURN(1); res= param->query_val_str(&str); if (param->convert_str_value(thd)) DBUG_RETURN(1); /* out of memory */ @@ -898,6 +919,14 @@ static bool insert_params(Prepared_statement *stmt, uchar *null_array, DBUG_RETURN(1); } } + /* + A long data stream was supplied for this parameter marker. + This was done after prepare, prior to providing a placeholder + type (the types are supplied at execute). Check that the + supplied type of placeholder can accept a data stream. + */ + else if (is_param_long_data_type(param)) + DBUG_RETURN(1); if (param->convert_str_value(stmt->thd)) DBUG_RETURN(1); /* out of memory */ } diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 787f9dcae2c..5f994c09d6d 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -257,8 +257,7 @@ bool log_in_use(const char* log_name) if ((linfo = tmp->current_linfo)) { mysql_mutex_lock(&linfo->lock); - result = !bcmp((uchar*) log_name, (uchar*) linfo->log_file_name, - log_name_len); + result = !memcmp(log_name, linfo->log_file_name, log_name_len); mysql_mutex_unlock(&linfo->lock); if (result) break; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 24d2a21147c..11378ac0d11 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -195,7 +195,8 @@ static bool test_if_cheaper_ordering(const JOIN_TAB *tab, ha_rows select_limit, int *new_key, int *new_key_direction, ha_rows *new_select_limit, - uint *new_used_key_parts= NULL); + uint *new_used_key_parts= NULL, + uint *saved_best_key_parts= NULL); static bool test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order, ha_rows select_limit, bool no_changes, key_map *map); @@ -592,13 +593,21 @@ JOIN::prepare(Item ***rref_pointer_array, { Item *item= *ord->item; /* - Disregard sort order if there's only "{VAR}CHAR(0) NOT NULL" fields - there. Such fields don't contain any data to sort. + Disregard sort order if there's only + zero length NOT NULL fields (e.g. {VAR}CHAR(0) NOT NULL") or + zero length NOT NULL string functions there. + Such tuples don't contain any data to sort. */ if (!real_order && - (item->type() != Item::FIELD_ITEM || - ((Item_field *) item)->field->maybe_null() || - ((Item_field *) item)->field->sort_length())) + /* Not a zero length NOT NULL field */ + ((item->type() != Item::FIELD_ITEM || + ((Item_field *) item)->field->maybe_null() || + ((Item_field *) item)->field->sort_length()) && + /* AND not a zero length NOT NULL string function. */ + (item->type() != Item::FUNC_ITEM || + item->maybe_null || + item->result_type() != STRING_RESULT || + item->max_length))) real_order= TRUE; if (item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM) @@ -1152,7 +1161,7 @@ JOIN::optimize() elements may be lost during further having condition transformation in JOIN::exec. */ - if (having && const_table_map) + if (having && const_table_map && !having->with_sum_func) { having->update_used_tables(); having= remove_eq_conds(thd, having, &having_value); @@ -7356,7 +7365,8 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond, *simple_order=0; // Must do a temp table to sort else if (!(order_tables & not_const_tables)) { - if (order->item[0]->with_subselect) + if (order->item[0]->with_subselect && + !(join->select_lex->options & SELECT_DESCRIBE)) order->item[0]->val_str(&order->item[0]->str_value); DBUG_PRINT("info",("removing: %s", order->item[0]->full_name())); continue; // skip const item @@ -13694,6 +13704,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, } { uint best_key_parts= 0; + uint saved_best_key_parts= 0; int best_key_direction= 0; int best_key= -1; JOIN *join= tab->join; @@ -13702,7 +13713,8 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, test_if_cheaper_ordering(tab, order, table, usable_keys, ref_key, select_limit, &best_key, &best_key_direction, - &select_limit, &best_key_parts); + &select_limit, &best_key_parts, + &saved_best_key_parts); /* filesort() and join cache are usually faster than reading in @@ -13781,8 +13793,15 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, */ } } - used_key_parts= best_key_parts; order_direction= best_key_direction; + /* + saved_best_key_parts is actual number of used keyparts found by the + test_if_order_by_key function. It could differ from keyinfo->key_parts, + thus we have to restore it in case of desc order as it affects + QUICK_SELECT_DESC behaviour. + */ + used_key_parts= (order_direction == -1) ? + saved_best_key_parts : best_key_parts; } else DBUG_RETURN(0); @@ -17374,6 +17393,8 @@ void JOIN::cache_const_exprs() @param [out] new_used_key_parts NULL by default, otherwise return number of new_key prefix columns if success or undefined if the function fails + @param [out] saved_best_key_parts NULL by default, otherwise preserve the + value for further use in QUICK_SELECT_DESC @note This function takes into account table->quick_condition_rows statistic @@ -17388,7 +17409,8 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table, key_map usable_keys, int ref_key, ha_rows select_limit, int *new_key, int *new_key_direction, - ha_rows *new_select_limit, uint *new_used_key_parts) + ha_rows *new_select_limit, uint *new_used_key_parts, + uint *saved_best_key_parts) { DBUG_ENTER("test_if_cheaper_ordering"); /* @@ -17567,6 +17589,8 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table, { best_key= nr; best_key_parts= keyinfo->key_parts; + if (saved_best_key_parts) + *saved_best_key_parts= used_key_parts; best_records= quick_records; is_best_covering= is_covering; best_key_direction= direction; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index fc2f22f6f48..a8ae5832a2a 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2128,8 +2128,8 @@ static bool show_status_array(THD *thd, const char *wild, bool ucase_names, COND *cond) { - MY_ALIGNED_BYTE_ARRAY(buff_data, SHOW_VAR_FUNC_BUFF_SIZE, long); - char * const buff= (char *) &buff_data; + my_aligned_storage buffer; + char * const buff= buffer.data; char *prefix_end; /* the variable name should not be longer than 64 characters */ char name_buffer[64]; @@ -2626,36 +2626,54 @@ bool get_lookup_field_values(THD *thd, COND *cond, TABLE_LIST *tables, { LEX *lex= thd->lex; const char *wild= lex->wild ? lex->wild->ptr() : NullS; + bool rc= 0; + bzero((char*) lookup_field_values, sizeof(LOOKUP_FIELD_VALUES)); switch (lex->sql_command) { case SQLCOM_SHOW_DATABASES: if (wild) { - lookup_field_values->db_value.str= (char*) wild; - lookup_field_values->db_value.length= strlen(wild); + thd->make_lex_string(&lookup_field_values->db_value, + wild, strlen(wild), 0); lookup_field_values->wild_db_value= 1; } - return 0; + break; case SQLCOM_SHOW_TABLES: case SQLCOM_SHOW_TABLE_STATUS: case SQLCOM_SHOW_TRIGGERS: case SQLCOM_SHOW_EVENTS: - lookup_field_values->db_value.str= lex->select_lex.db; - lookup_field_values->db_value.length=strlen(lex->select_lex.db); + thd->make_lex_string(&lookup_field_values->db_value, + lex->select_lex.db, strlen(lex->select_lex.db), 0); if (wild) { - lookup_field_values->table_value.str= (char*)wild; - lookup_field_values->table_value.length= strlen(wild); + thd->make_lex_string(&lookup_field_values->table_value, + wild, strlen(wild), 0); lookup_field_values->wild_table_value= 1; } - return 0; + break; default: /* The "default" is for queries over I_S. All previous cases handle SHOW commands. */ - return calc_lookup_values_from_cond(thd, cond, tables, lookup_field_values); + rc= calc_lookup_values_from_cond(thd, cond, tables, lookup_field_values); + break; } + + if (lower_case_table_names && !rc) + { + /* + We can safely do in-place upgrades here since all of the above cases + are allocating a new memory buffer for these strings. + */ + if (lookup_field_values->db_value.str && lookup_field_values->db_value.str[0]) + my_casedn_str(system_charset_info, lookup_field_values->db_value.str); + if (lookup_field_values->table_value.str && + lookup_field_values->table_value.str[0]) + my_casedn_str(system_charset_info, lookup_field_values->table_value.str); + } + + return rc; } @@ -2857,9 +2875,15 @@ make_table_name_list(THD *thd, List *table_names, LEX *lex, { if (with_i_schema) { - if (find_schema_table(thd, lookup_field_vals->table_value.str)) + LEX_STRING *name; + ST_SCHEMA_TABLE *schema_table= + find_schema_table(thd, lookup_field_vals->table_value.str); + if (schema_table && !schema_table->hidden) { - if (table_names->push_back(&lookup_field_vals->table_value)) + if (!(name= + thd->make_lex_string(NULL, schema_table->table_name, + strlen(schema_table->table_name), TRUE)) || + table_names->push_back(name)) return 1; } } @@ -3439,6 +3463,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) error= 0; goto err; } + DBUG_PRINT("INDEX VALUES",("db_name='%s', table_name='%s'", STR_OR_NIL(lookup_field_vals.db_value.str), STR_OR_NIL(lookup_field_vals.table_value.str))); @@ -3997,10 +4022,13 @@ void store_column_type(TABLE *table, Field *field, CHARSET_INFO *cs, case MYSQL_TYPE_TINY: case MYSQL_TYPE_SHORT: case MYSQL_TYPE_LONG: - case MYSQL_TYPE_LONGLONG: case MYSQL_TYPE_INT24: field_length= field->max_display_length() - 1; break; + case MYSQL_TYPE_LONGLONG: + field_length= field->max_display_length() - + ((field->flags & UNSIGNED_FLAG) ? 0 : 1); + break; case MYSQL_TYPE_BIT: field_length= field->max_display_length(); decimals= -1; // return NULL diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 934ec9c35ab..ca951897055 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1932,11 +1932,9 @@ master_def: { const char format[]= "%d seconds"; char buf[4*sizeof(SLAVE_MAX_HEARTBEAT_PERIOD) + sizeof(format)]; - my_sprintf(buf, (buf, format, SLAVE_MAX_HEARTBEAT_PERIOD)); + sprintf(buf, format, SLAVE_MAX_HEARTBEAT_PERIOD); my_error(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE, - MYF(0), - " is negative or exceeds the maximum ", - buf); + MYF(0), " is negative or exceeds the maximum ", buf); MYSQL_YYABORT; } if (Lex->mi.heartbeat_period > slave_net_timeout) diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index eafb20cf0a3..6e95961ebb0 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -942,10 +942,10 @@ static bool update_cached_long_query_time(sys_var *self, THD *thd, { if (type == OPT_SESSION) thd->variables.long_query_time= - thd->variables.long_query_time_double * 1e6; + double2ulonglong(thd->variables.long_query_time_double * 1e6); else global_system_variables.long_query_time= - global_system_variables.long_query_time_double * 1e6; + double2ulonglong(global_system_variables.long_query_time_double * 1e6); return false; } @@ -1630,7 +1630,7 @@ static Sys_var_ulong Sys_thread_stack( static Sys_var_charptr Sys_tmpdir( "tmpdir", "Path for temporary files. Several paths may " "be specified, separated by a " -#if defined(__WIN__) || defined(__NETWARE__) +#if defined(__WIN__) "semicolon (;)" #else "colon (:)" diff --git a/sql/sys_vars.h b/sql/sys_vars.h index 18c073b1e90..ca3fc99deba 100644 --- a/sql/sys_vars.h +++ b/sql/sys_vars.h @@ -741,13 +741,13 @@ public: uint deprecated_version=0, const char *substitute=0, int parse_flag= PARSE_NORMAL) : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id, - getopt.arg_type, SHOW_DOUBLE, def_val, lock, binlog_status_arg, - on_check_func, on_update_func, deprecated_version, substitute, - parse_flag) + getopt.arg_type, SHOW_DOUBLE, (longlong) double2ulonglong(def_val), + lock, binlog_status_arg, on_check_func, on_update_func, + deprecated_version, substitute, parse_flag) { option.var_type= GET_DOUBLE; - option.min_value= min_val; - option.max_value= max_val; + option.min_value= (longlong) double2ulonglong(min_val); + option.max_value= (longlong) double2ulonglong(max_val); global_var(double)= (double)option.def_value; DBUG_ASSERT(min_val < max_val); DBUG_ASSERT(min_val <= def_val); diff --git a/sql/tztime.cc b/sql/tztime.cc index 79f3b83553e..af8574c38f1 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -2551,7 +2551,6 @@ scan_tz_dir(char * name_end) int main(int argc, char **argv) { -#ifndef __NETWARE__ MY_INIT(argv[0]); if (argc != 2 && argc != 3) @@ -2610,10 +2609,6 @@ main(int argc, char **argv) free_root(&tz_storage, MYF(0)); } -#else - fprintf(stderr, "This tool has not been ported to NetWare\n"); -#endif /* __NETWARE__ */ - return 0; } diff --git a/sql/udf_example.c b/sql/udf_example.c index fa1b44178ac..284689d329f 100644 --- a/sql/udf_example.c +++ b/sql/udf_example.c @@ -146,7 +146,9 @@ typedef long long longlong; #ifdef HAVE_DLOPEN +#if !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_SOLARIS_STYLE_GETHOST) static pthread_mutex_t LOCK_hostname; +#endif /* These must be right or mysqld will not find the symbol! */ diff --git a/sql/unireg.h b/sql/unireg.h index dbbeea077a9..b897c887c89 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -77,8 +77,8 @@ typedef struct st_ha_create_information HA_CREATE_INFO; #define SPECIAL_LOG_QUERIES_NOT_USING_INDEXES 4096 /* Obsolete */ /* Extern defines */ -#define store_record(A,B) bmove_align((A)->B,(A)->record[0],(size_t) (A)->s->reclength) -#define restore_record(A,B) bmove_align((A)->record[0],(A)->B,(size_t) (A)->s->reclength) +#define store_record(A,B) memcpy((A)->B,(A)->record[0],(size_t) (A)->s->reclength) +#define restore_record(A,B) memcpy((A)->record[0],(A)->B,(size_t) (A)->s->reclength) #define cmp_record(A,B) memcmp((A)->record[0],(A)->B,(size_t) (A)->s->reclength) #define empty_record(A) { \ restore_record((A),s->default_values); \ diff --git a/storage/archive/Makefile.am b/storage/archive/Makefile.am index adc11358df6..8b08105cef3 100644 --- a/storage/archive/Makefile.am +++ b/storage/archive/Makefile.am @@ -37,14 +37,14 @@ noinst_PROGRAMS = archive_test archive_reader EXTRA_LTLIBRARIES = ha_archive.la pkgplugin_LTLIBRARIES = @plugin_archive_shared_target@ ha_archive_la_LDFLAGS = -module -rpath $(pkgplugindir) -ha_archive_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_archive_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_archive_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_archive_la_SOURCES = ha_archive.cc azio.c EXTRA_LIBRARIES = libarchive.a noinst_LIBRARIES = @plugin_archive_static_target@ -libarchive_a_CXXFLAGS = $(AM_CFLAGS) +libarchive_a_CXXFLAGS = $(AM_CXXFLAGS) libarchive_a_CFLAGS = $(AM_CFLAGS) libarchive_a_SOURCES = ha_archive.cc azio.c diff --git a/storage/blackhole/Makefile.am b/storage/blackhole/Makefile.am index f3bdbdbd070..38c2f354844 100644 --- a/storage/blackhole/Makefile.am +++ b/storage/blackhole/Makefile.am @@ -35,14 +35,14 @@ noinst_HEADERS = ha_blackhole.h EXTRA_LTLIBRARIES = ha_blackhole.la pkgplugin_LTLIBRARIES = @plugin_blackhole_shared_target@ ha_blackhole_la_LDFLAGS=-module -rpath $(pkgplugindir) -ha_blackhole_la_CXXFLAGS=$(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_blackhole_la_CXXFLAGS=$(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_blackhole_la_CFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_blackhole_la_SOURCES=ha_blackhole.cc EXTRA_LIBRARIES = libblackhole.a noinst_LIBRARIES = @plugin_blackhole_static_target@ -libblackhole_a_CXXFLAGS=$(AM_CFLAGS) +libblackhole_a_CXXFLAGS=$(AM_CXXFLAGS) libblackhole_a_CFLAGS = $(AM_CFLAGS) libblackhole_a_SOURCES= ha_blackhole.cc diff --git a/storage/csv/Makefile.am b/storage/csv/Makefile.am index 36d6b464fcc..5e3587c893f 100644 --- a/storage/csv/Makefile.am +++ b/storage/csv/Makefile.am @@ -32,12 +32,12 @@ noinst_HEADERS = ha_tina.h transparent_file.h EXTRA_LTLIBRARIES = ha_csv.la pkglib_LTLIBRARIES = @plugin_csv_shared_target@ ha_csv_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) -ha_csv_la_CXXFLAGS = $(AM_CFLAGS) -DMYSQL_PLUGIN +ha_csv_la_CXXFLAGS = $(AM_CXXFLAGS) -DMYSQL_PLUGIN ha_csv_la_SOURCES = transparent_file.cc ha_tina.cc EXTRA_LIBRARIES = libcsv.a noinst_LIBRARIES = @plugin_csv_static_target@ -libcsv_a_CXXFLAGS = $(AM_CFLAGS) +libcsv_a_CXXFLAGS = $(AM_CXXFLAGS) libcsv_a_SOURCES = transparent_file.cc ha_tina.cc EXTRA_DIST = CMakeLists.txt plug.in diff --git a/storage/example/Makefile.am b/storage/example/Makefile.am index 47d95d4663c..c79fbe97cc3 100644 --- a/storage/example/Makefile.am +++ b/storage/example/Makefile.am @@ -35,14 +35,14 @@ noinst_HEADERS = ha_example.h EXTRA_LTLIBRARIES = ha_example.la pkgplugin_LTLIBRARIES = @plugin_example_shared_target@ ha_example_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices -ha_example_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_example_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_example_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_example_la_SOURCES = ha_example.cc EXTRA_LIBRARIES = libexample.a noinst_LIBRARIES = @plugin_example_static_target@ -libexample_a_CXXFLAGS = $(AM_CFLAGS) +libexample_a_CXXFLAGS = $(AM_CXXFLAGS) libexample_a_CFLAGS = $(AM_CFLAGS) libexample_a_SOURCES= ha_example.cc diff --git a/storage/federated/Makefile.am b/storage/federated/Makefile.am index f4cd634567d..e07b0d95b97 100644 --- a/storage/federated/Makefile.am +++ b/storage/federated/Makefile.am @@ -36,14 +36,14 @@ noinst_HEADERS = ha_federated.h EXTRA_LTLIBRARIES = ha_federated.la pkgplugin_LTLIBRARIES = @plugin_federated_shared_target@ ha_federated_la_LDFLAGS = -module -rpath $(pkgplugindir) -ha_federated_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_federated_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_federated_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_federated_la_SOURCES = ha_federated.cc EXTRA_LIBRARIES = libfederated.a noinst_LIBRARIES = @plugin_federated_static_target@ -libfederated_a_CXXFLAGS = $(AM_CFLAGS) +libfederated_a_CXXFLAGS = $(AM_CXXFLAGS) libfederated_a_CFLAGS = $(AM_CFLAGS) libfederated_a_SOURCES= ha_federated.cc diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 5534c520604..d17b56bd4b1 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -594,7 +594,6 @@ static int parse_url_error(FEDERATED_SHARE *share, TABLE *table, int error_num) int get_connection(MEM_ROOT *mem_root, FEDERATED_SHARE *share) { int error_num= ER_FOREIGN_SERVER_DOESNT_EXIST; - char error_buffer[FEDERATED_QUERY_BUFFER_SIZE]; FOREIGN_SERVER *server, server_buffer; DBUG_ENTER("ha_federated::get_connection"); @@ -646,10 +645,8 @@ int get_connection(MEM_ROOT *mem_root, FEDERATED_SHARE *share) DBUG_RETURN(0); error: - my_sprintf(error_buffer, - (error_buffer, "server name: '%s' doesn't exist!", - share->connection_string)); - my_error(error_num, MYF(0), error_buffer); + my_printf_error(error_num, "server name: '%s' doesn't exist!", + MYF(0), share->connection_string); DBUG_RETURN(error_num); } @@ -2443,8 +2440,8 @@ int ha_federated::index_read_idx_with_result_set(uchar *buf, uint index, if (real_query(sql_query.ptr(), sql_query.length())) { - my_sprintf(error_buffer, (error_buffer, "error: %d '%s'", - mysql_errno(mysql), mysql_error(mysql))); + sprintf(error_buffer, "error: %d '%s'", + mysql_errno(mysql), mysql_error(mysql)); retval= ER_QUERY_ON_FOREIGN_DATA_SOURCE; goto error; } @@ -2841,7 +2838,6 @@ int ha_federated::rnd_pos(uchar *buf, uchar *pos) int ha_federated::info(uint flag) { - char error_buffer[FEDERATED_QUERY_BUFFER_SIZE]; char status_buf[FEDERATED_QUERY_BUFFER_SIZE]; int error; uint error_code; @@ -2925,9 +2921,8 @@ error: mysql_free_result(result); if (mysql) { - my_sprintf(error_buffer, (error_buffer, ": %d : %s", - mysql_errno(mysql), mysql_error(mysql))); - my_error(error_code, MYF(0), error_buffer); + my_printf_error(error_code, ": %d : %s", MYF(0), + mysql_errno(mysql), mysql_error(mysql)); } else if (remote_error_number != -1 /* error already reported */) diff --git a/storage/heap/CMakeLists.txt b/storage/heap/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/storage/heap/hp_hash.c b/storage/heap/hp_hash.c index aaaa0fe833f..f56df42aab3 100644 --- a/storage/heap/hp_hash.c +++ b/storage/heap/hp_hash.c @@ -577,7 +577,7 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2, } else { - if (bcmp(rec1+seg->start,rec2+seg->start,seg->length)) + if (memcmp(rec1+seg->start,rec2+seg->start,seg->length)) return 1; } } @@ -660,7 +660,7 @@ int hp_key_cmp(HP_KEYDEF *keydef, const uchar *rec, const uchar *key) } else { - if (bcmp(rec+seg->start,key,seg->length)) + if (memcmp(rec+seg->start,key,seg->length)) return 1; } } diff --git a/storage/heap/hp_open.c b/storage/heap/hp_open.c index ef2ce15f9b3..12d9bfe1ed3 100644 --- a/storage/heap/hp_open.c +++ b/storage/heap/hp_open.c @@ -16,10 +16,6 @@ /* open a heap-database */ #include "heapdef.h" -#ifdef VMS -#include "hp_static.c" /* Stupid vms-linker */ -#endif - #include "my_sys.h" /* diff --git a/storage/heap/hp_test2.c b/storage/heap/hp_test2.c index 5b0c8d8685d..1571fc98402 100644 --- a/storage/heap/hp_test2.c +++ b/storage/heap/hp_test2.c @@ -401,7 +401,7 @@ int main(int argc, char *argv[]) bmove(record2,record,reclength); if (heap_rsame(file,record,-1) || heap_rsame(file,record2,2)) goto err; - if (bcmp(record2,record,reclength)) + if (memcmp(record2,record,reclength)) { puts("heap_rsame didn't find right record"); goto end; @@ -410,7 +410,7 @@ int main(int argc, char *argv[]) puts("- Test of read through position"); if (heap_rrnd(file,record,position)) goto err; - if (bcmp(record3,record,reclength)) + if (memcmp(record3,record,reclength)) { puts("heap_frnd didn't find right record"); goto end; diff --git a/storage/ibmdb2i/Makefile.am b/storage/ibmdb2i/Makefile.am index 041bdc270e4..a9977de895d 100644 --- a/storage/ibmdb2i/Makefile.am +++ b/storage/ibmdb2i/Makefile.am @@ -34,7 +34,7 @@ EXTRA_LTLIBRARIES = ha_ibmdb2i.la pkgplugin_LTLIBRARIES = @plugin_ibmdb2i_shared_target@ ha_ibmdb2i_la_LIBADD = -liconv ha_ibmdb2i_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) -ha_ibmdb2i_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_ibmdb2i_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_ibmdb2i_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_ibmdb2i_la_SOURCES = ha_ibmdb2i.cc db2i_ileBridge.cc db2i_conversion.cc \ db2i_blobCollection.cc db2i_file.cc db2i_charsetSupport.cc \ @@ -44,7 +44,7 @@ ha_ibmdb2i_la_SOURCES = ha_ibmdb2i.cc db2i_ileBridge.cc db2i_conversion.cc \ EXTRA_LIBRARIES = libibmdb2i.a noinst_LIBRARIES = @plugin_ibmdb2i_static_target@ -libibmdb2i_a_CXXFLAGS = $(AM_CFLAGS) +libibmdb2i_a_CXXFLAGS = $(AM_CXXFLAGS) libibmdb2i_a_CFLAGS = $(AM_CFLAGS) libibmdb2i_a_SOURCES= $(ha_ibmdb2i_la_SOURCES) diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index 90246aaa99d..b6399dcc478 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -95,7 +95,7 @@ IF(NOT CMAKE_CROSSCOMPILING) #include #include - int main(int argc, char** argv) { + int main() { pthread_t x1; pthread_t x2; pthread_t x3; diff --git a/storage/innobase/Makefile.am b/storage/innobase/Makefile.am index c15c46abaf0..7a6103d9e79 100644 --- a/storage/innobase/Makefile.am +++ b/storage/innobase/Makefile.am @@ -323,14 +323,14 @@ libinnobase_a_SOURCES= \ ut/ut0vec.c \ ut/ut0wqueue.c -libinnobase_a_CXXFLAGS= $(AM_CFLAGS) +libinnobase_a_CXXFLAGS= $(AM_CXXFLAGS) libinnobase_a_CFLAGS= $(AM_CFLAGS) EXTRA_LTLIBRARIES= ha_innodb.la pkgplugin_LTLIBRARIES= @plugin_innobase_shared_target@ ha_innodb_la_LDFLAGS= -module -rpath $(pkgplugindir) -ha_innodb_la_CXXFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) +ha_innodb_la_CXXFLAGS= $(AM_CXXFLAGS) $(INNODB_DYNAMIC_CFLAGS) ha_innodb_la_CFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) ha_innodb_la_SOURCES= $(libinnobase_a_SOURCES) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 6b0d68241ea..f5227add6f1 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -187,10 +187,6 @@ static ulong innobase_active_counter = 0; static hash_table_t* innobase_open_tables; -#ifdef __NETWARE__ /* some special cleanup for NetWare */ -bool nw_panic = FALSE; -#endif - /** Allowed values of innodb_change_buffering */ static const char* innobase_change_buffering_values[IBUF_USE_COUNT] = { "none", /* IBUF_USE_NONE */ @@ -2469,11 +2465,6 @@ innobase_end( DBUG_ENTER("innobase_end"); DBUG_ASSERT(hton == innodb_hton_ptr); -#ifdef __NETWARE__ /* some special cleanup for NetWare */ - if (nw_panic) { - set_panic_flag_for_netware(); - } -#endif if (innodb_inited) { srv_fast_shutdown = (ulint) innobase_fast_shutdown; @@ -10794,14 +10785,8 @@ static MYSQL_SYSVAR_ULONG(purge_threads, srv_n_purge_threads, static MYSQL_SYSVAR_ULONG(fast_shutdown, innobase_fast_shutdown, PLUGIN_VAR_OPCMDARG, "Speeds up the shutdown process of the InnoDB storage engine. Possible " - "values are 0, 1 (faster)" - /* - NetWare can't close unclosed files, can't automatically kill remaining - threads, etc, so on this OS we disable the crash-like InnoDB shutdown. - */ - IF_NETWARE("", " or 2 (fastest - crash-like)") - ".", - NULL, NULL, 1, 0, IF_NETWARE(1,2), 0); + "values are 0, 1 (faster) or 2 (fastest - crash-like).", + NULL, NULL, 1, 0, 2, 0); static MYSQL_SYSVAR_BOOL(file_per_table, srv_file_per_table, PLUGIN_VAR_NOCMDARG, diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index a112cb06697..197e361b2b1 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -194,12 +194,12 @@ various file I/O operations with performance schema. used to register file creation, opening, closing and renaming. 2) register_pfs_file_io_begin() and register_pfs_file_io_end() are used to register actual file read, write and flush */ -# define register_pfs_file_open_begin(locker, key, op, name, \ +# define register_pfs_file_open_begin(state, locker, key, op, name, \ src_file, src_line) \ do { \ if (PSI_server) { \ locker = PSI_server->get_thread_file_name_locker( \ - key, op, name, &locker); \ + state, key, op, name, &locker); \ if (locker) { \ PSI_server->start_file_open_wait( \ locker, src_file, src_line); \ @@ -215,12 +215,12 @@ do { \ } \ } while (0) -# define register_pfs_file_io_begin(locker, file, count, op, \ +# define register_pfs_file_io_begin(state, locker, file, count, op, \ src_file, src_line) \ do { \ if (PSI_server) { \ locker = PSI_server->get_thread_file_descriptor_locker( \ - file, op); \ + state, file, op); \ if (locker) { \ PSI_server->start_file_wait( \ locker, count, src_file, src_line); \ @@ -383,8 +383,6 @@ os_io_init_simple(void); /***********************************************************************//** Creates a temporary file. This function is like tmpfile(3), but the temporary file is created in the MySQL temporary directory. -On Netware, this function is like tmpfile(3), because the C run-time -library of Netware does not expose the delete-on-close flag. @return temporary file handle, or NULL on error */ FILE* @@ -1166,7 +1164,7 @@ os_file_get_status( os_file_stat_t* stat_info); /*!< information of a file in a directory */ -#if !defined(UNIV_HOTBACKUP) && !defined(__NETWARE__) +#if !defined(UNIV_HOTBACKUP) /*********************************************************************//** Creates a temporary file that will be deleted on close. This function is defined in ha_innodb.cc. @@ -1175,7 +1173,7 @@ UNIV_INTERN int innobase_mysql_tmpfile(void); /*========================*/ -#endif /* !UNIV_HOTBACKUP && !__NETWARE__ */ +#endif /* !UNIV_HOTBACKUP */ #if defined(LINUX_NATIVE_AIO) diff --git a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0file.ic index 32f0e7cf666..648070c6909 100644 --- a/storage/innobase/include/os0file.ic +++ b/storage/innobase/include/os0file.ic @@ -55,9 +55,10 @@ pfs_os_file_create_simple_func( { os_file_t file; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; /* register a file open or creation depending on "create_mode" */ - register_pfs_file_open_begin(locker, key, + register_pfs_file_open_begin(&state, locker, key, ((create_mode == OS_FILE_CREATE) ? PSI_FILE_CREATE : PSI_FILE_OPEN), @@ -101,9 +102,10 @@ pfs_os_file_create_simple_no_error_handling_func( { os_file_t file; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; /* register a file open or creation depending on "create_mode" */ - register_pfs_file_open_begin(locker, key, + register_pfs_file_open_begin(&state, locker, key, ((create_mode == OS_FILE_CREATE) ? PSI_FILE_CREATE : PSI_FILE_OPEN), @@ -153,9 +155,10 @@ pfs_os_file_create_func( { os_file_t file; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; /* register a file open or creation depending on "create_mode" */ - register_pfs_file_open_begin(locker, key, + register_pfs_file_open_begin(&state, locker, key, ((create_mode == OS_FILE_CREATE) ? PSI_FILE_CREATE : PSI_FILE_OPEN), @@ -183,9 +186,10 @@ pfs_os_file_close_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; /* register the file close */ - register_pfs_file_io_begin(locker, file, 0, PSI_FILE_CLOSE, + register_pfs_file_io_begin(&state, locker, file, 0, PSI_FILE_CLOSE, src_file, src_line); result = os_file_close_func(file); @@ -230,9 +234,10 @@ pfs_os_aio_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; /* Register the read or write I/O depending on "type" */ - register_pfs_file_io_begin(locker, file, n, + register_pfs_file_io_begin(&state, locker, file, n, (type == OS_FILE_WRITE) ? PSI_FILE_WRITE : PSI_FILE_READ, @@ -268,8 +273,9 @@ pfs_os_file_read_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; - register_pfs_file_io_begin(locker, file, n, PSI_FILE_READ, + register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ, src_file, src_line); result = os_file_read_func(file, buf, offset, offset_high, n); @@ -303,8 +309,9 @@ pfs_os_file_read_no_error_handling_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; - register_pfs_file_io_begin(locker, file, n, PSI_FILE_READ, + register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ, src_file, src_line); result = os_file_read_no_error_handling_func(file, buf, offset, @@ -339,8 +346,9 @@ pfs_os_file_write_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; - register_pfs_file_io_begin(locker, file, n, PSI_FILE_WRITE, + register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_WRITE, src_file, src_line); result = os_file_write_func(name, file, buf, offset, offset_high, n); @@ -366,8 +374,9 @@ pfs_os_file_flush_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; - register_pfs_file_io_begin(locker, file, 0, PSI_FILE_SYNC, + register_pfs_file_io_begin(&state, locker, file, 0, PSI_FILE_SYNC, src_file, src_line); result = os_file_flush_func(file); @@ -395,8 +404,9 @@ pfs_os_file_rename_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; - register_pfs_file_open_begin(locker, key, PSI_FILE_RENAME, newpath, + register_pfs_file_open_begin(&state, locker, key, PSI_FILE_RENAME, newpath, src_file, src_line); result = os_file_rename_func(oldpath, newpath); diff --git a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h index 8abf15da9c1..796d2cade3b 100644 --- a/storage/innobase/include/srv0start.h +++ b/storage/innobase/include/srv0start.h @@ -91,10 +91,6 @@ extern ib_uint64_t srv_shutdown_lsn; /** Log sequence number immediately after startup */ extern ib_uint64_t srv_start_lsn; -#ifdef __NETWARE__ -void set_panic_flag_for_netware(void); -#endif - #ifdef HAVE_DARWIN_THREADS /** TRUE if the F_FULLFSYNC option is available */ extern ibool srv_have_fullfsync; diff --git a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0rw.ic index 73405759bce..2ffd9fdafb5 100644 --- a/storage/innobase/include/sync0rw.ic +++ b/storage/innobase/include/sync0rw.ic @@ -675,12 +675,13 @@ pfs_rw_lock_x_lock_func( const char* file_name,/*!< in: file name where lock requested */ ulint line) /*!< in: line where requested */ { - struct PSI_rwlock_locker* locker = NULL; + struct PSI_rwlock_locker* locker = NULL; + PSI_rwlock_locker_state state; /* Record the entry of rw x lock request in performance schema */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { locker = PSI_server->get_thread_rwlock_locker( - lock->pfs_psi, PSI_RWLOCK_WRITELOCK); + &state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK); if (locker) { PSI_server->start_rwlock_wrwait(locker, @@ -709,13 +710,14 @@ pfs_rw_lock_x_lock_func_nowait( requested */ ulint line) /*!< in: line where requested */ { - struct PSI_rwlock_locker* locker = NULL; + struct PSI_rwlock_locker* locker = NULL; + PSI_rwlock_locker_state state; ibool ret; /* Record the entry of rw x lock request in performance schema */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { locker = PSI_server->get_thread_rwlock_locker( - lock->pfs_psi, PSI_RWLOCK_WRITELOCK); + &state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK); if (locker) { PSI_server->start_rwlock_wrwait(locker, @@ -764,12 +766,13 @@ pfs_rw_lock_s_lock_func( requested */ ulint line) /*!< in: line where requested */ { - struct PSI_rwlock_locker* locker = NULL; + struct PSI_rwlock_locker* locker = NULL; + PSI_rwlock_locker_state state; /* Instrumented to inform we are aquiring a shared rwlock */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { locker = PSI_server->get_thread_rwlock_locker( - lock->pfs_psi, PSI_RWLOCK_READLOCK); + &state, lock->pfs_psi, PSI_RWLOCK_READLOCK); if (locker) { PSI_server->start_rwlock_rdwait(locker, file_name, line); @@ -798,14 +801,14 @@ pfs_rw_lock_s_lock_low( const char* file_name, /*!< in: file name where lock requested */ ulint line) /*!< in: line where requested */ { - - struct PSI_rwlock_locker* locker = NULL; + struct PSI_rwlock_locker* locker = NULL; + PSI_rwlock_locker_state state; ibool ret; /* Instrumented to inform we are aquiring a shared rwlock */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { locker = PSI_server->get_thread_rwlock_locker( - lock->pfs_psi, PSI_RWLOCK_READLOCK); + &state, lock->pfs_psi, PSI_RWLOCK_READLOCK); if (locker) { PSI_server->start_rwlock_rdwait(locker, file_name, line); @@ -838,11 +841,7 @@ pfs_rw_lock_x_unlock_func( { /* Inform performance schema we are unlocking the lock */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { - struct PSI_thread* thread; - thread = PSI_server->get_thread(); - if (thread) { - PSI_server->unlock_rwlock(thread, lock->pfs_psi); - } + PSI_server->unlock_rwlock(lock->pfs_psi); } rw_lock_x_unlock_func( @@ -869,11 +868,7 @@ pfs_rw_lock_s_unlock_func( { /* Inform performance schema we are unlocking the lock */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { - struct PSI_thread* thread; - thread = PSI_server->get_thread(); - if (thread) { - PSI_server->unlock_rwlock(thread, lock->pfs_psi); - } + PSI_server->unlock_rwlock(lock->pfs_psi); } rw_lock_s_unlock_func( diff --git a/storage/innobase/include/sync0sync.ic b/storage/innobase/include/sync0sync.ic index cf080e2e3ce..2977f71154a 100644 --- a/storage/innobase/include/sync0sync.ic +++ b/storage/innobase/include/sync0sync.ic @@ -237,11 +237,12 @@ pfs_mutex_enter_func( ulint line) /*!< in: line where locked */ { struct PSI_mutex_locker* locker = NULL; + PSI_mutex_locker_state state; int result = 0; if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) { locker = PSI_server->get_thread_mutex_locker( - mutex->pfs_psi, PSI_MUTEX_LOCK); + &state, mutex->pfs_psi, PSI_MUTEX_LOCK); if (locker) { PSI_server->start_mutex_wait(locker, file_name, line); } @@ -270,11 +271,12 @@ pfs_mutex_enter_nowait_func( { ulint ret; struct PSI_mutex_locker* locker = NULL; + PSI_mutex_locker_state state; int result = 0; if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) { locker = PSI_server->get_thread_mutex_locker( - mutex->pfs_psi, PSI_MUTEX_LOCK); + &state, mutex->pfs_psi, PSI_MUTEX_LOCK); if (locker) { PSI_server->start_mutex_wait(locker, file_name, line); } @@ -300,12 +302,7 @@ pfs_mutex_exit_func( mutex_t* mutex) /*!< in: pointer to mutex */ { if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) { - struct PSI_thread* thread; - thread = PSI_server->get_thread(); - - if (thread) { - PSI_server->unlock_mutex(thread, mutex->pfs_psi); - } + PSI_server->unlock_mutex(mutex->pfs_psi); } mutex_exit_func(mutex); diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 11cec113fc8..ea213486445 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -115,7 +115,7 @@ if we are compiling on Windows. */ /* Include to get S_I... macros defined for os0file.c */ # include -# if !defined(__NETWARE__) && !defined(__WIN__) +# if !defined(__WIN__) # include /* mmap() for os0proc.c */ # endif diff --git a/storage/innobase/include/ut0dbg.h b/storage/innobase/include/ut0dbg.h index 78b525c38ab..d7ec90db0fb 100644 --- a/storage/innobase/include/ut0dbg.h +++ b/storage/innobase/include/ut0dbg.h @@ -54,29 +54,18 @@ ut_dbg_assertion_failed( const char* file, /*!< in: source file containing the assertion */ ulint line); /*!< in: line number of the assertion */ -#ifdef __NETWARE__ -/** Flag for ignoring further assertion failures. This is set to TRUE -when on NetWare there happens an InnoDB assertion failure or other -fatal error condition that requires an immediate shutdown. */ -extern ibool panic_shutdown; -/* Abort the execution. */ -void ut_dbg_panic(void); -# define UT_DBG_PANIC ut_dbg_panic() -/* Stop threads in ut_a(). */ -# define UT_DBG_STOP do {} while (0) /* We do not do this on NetWare */ -#else /* __NETWARE__ */ -# if defined(__WIN__) || defined(__INTEL_COMPILER) -# undef UT_DBG_USE_ABORT -# elif defined(__GNUC__) && (__GNUC__ > 2) -# define UT_DBG_USE_ABORT -# endif +#if defined(__WIN__) || defined(__INTEL_COMPILER) +# undef UT_DBG_USE_ABORT +#elif defined(__GNUC__) && (__GNUC__ > 2) +# define UT_DBG_USE_ABORT +#endif -# ifndef UT_DBG_USE_ABORT +#ifndef UT_DBG_USE_ABORT /** A null pointer that will be dereferenced to trigger a memory trap */ extern ulint* ut_dbg_null_ptr; -# endif +#endif -# if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT) +#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT) /** If this is set to TRUE by ut_dbg_assertion_failed(), all threads will stop at the next ut_a() or ut_ad(). */ extern ibool ut_dbg_stop_threads; @@ -89,24 +78,23 @@ ut_dbg_stop_thread( /*===============*/ const char* file, ulint line); -# endif +#endif -# ifdef UT_DBG_USE_ABORT +#ifdef UT_DBG_USE_ABORT /** Abort the execution. */ -# define UT_DBG_PANIC abort() +# define UT_DBG_PANIC abort() /** Stop threads (null operation) */ -# define UT_DBG_STOP do {} while (0) -# else /* UT_DBG_USE_ABORT */ +# define UT_DBG_STOP do {} while (0) +#else /* UT_DBG_USE_ABORT */ /** Abort the execution. */ -# define UT_DBG_PANIC \ +# define UT_DBG_PANIC \ if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL /** Stop threads in ut_a(). */ -# define UT_DBG_STOP do \ +# define UT_DBG_STOP do \ if (UNIV_UNLIKELY(ut_dbg_stop_threads)) { \ ut_dbg_stop_thread(__FILE__, (ulint) __LINE__); \ } while (0) -# endif /* UT_DBG_USE_ABORT */ -#endif /* __NETWARE__ */ +#endif /* UT_DBG_USE_ABORT */ /** Abort execution if EXPR does not evaluate to nonzero. @param EXPR assertion expression that should hold */ diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c index c07f8f4bf95..7c502d616d3 100644 --- a/storage/innobase/os/os0file.c +++ b/storage/innobase/os/os0file.c @@ -623,7 +623,7 @@ os_file_handle_error_no_exit( #undef USE_FILE_LOCK #define USE_FILE_LOCK -#if defined(UNIV_HOTBACKUP) || defined(__WIN__) || defined(__NETWARE__) +#if defined(UNIV_HOTBACKUP) || defined(__WIN__) /* InnoDB Hot Backup does not lock the data files. * On Windows, mandatory locking is used. */ @@ -683,35 +683,27 @@ os_io_init_simple(void) /***********************************************************************//** Creates a temporary file. This function is like tmpfile(3), but the temporary file is created in the MySQL temporary directory. -On Netware, this function is like tmpfile(3), because the C run-time -library of Netware does not expose the delete-on-close flag. @return temporary file handle, or NULL on error */ UNIV_INTERN FILE* os_file_create_tmpfile(void) /*========================*/ { -#ifdef __NETWARE__ - FILE* file = tmpfile(); -#else /* __NETWARE__ */ FILE* file = NULL; int fd = innobase_mysql_tmpfile(); if (fd >= 0) { file = fdopen(fd, "w+b"); } -#endif /* __NETWARE__ */ if (!file) { ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Error: unable to create temporary file;" " errno: %d\n", errno); -#ifndef __NETWARE__ if (fd >= 0) { close(fd); } -#endif /* !__NETWARE__ */ } return(file); diff --git a/storage/innobase/os/os0proc.c b/storage/innobase/os/os0proc.c index 48922886f23..0f56a608f38 100644 --- a/storage/innobase/os/os0proc.c +++ b/storage/innobase/os/os0proc.c @@ -145,7 +145,7 @@ skip: os_fast_mutex_unlock(&ut_list_mutex); UNIV_MEM_ALLOC(ptr, size); } -#elif defined __NETWARE__ || !defined OS_MAP_ANON +#elif !defined OS_MAP_ANON size = *n; ptr = ut_malloc_low(size, TRUE, FALSE); #else @@ -213,7 +213,7 @@ os_mem_free_large( os_fast_mutex_unlock(&ut_list_mutex); UNIV_MEM_FREE(ptr, size); } -#elif defined __NETWARE__ || !defined OS_MAP_ANON +#elif !defined OS_MAP_ANON ut_free(ptr); #else if (munmap(ptr, size)) { diff --git a/storage/innobase/os/os0thread.c b/storage/innobase/os/os0thread.c index 78df66d7834..632199b56bc 100644 --- a/storage/innobase/os/os0thread.c +++ b/storage/innobase/os/os0thread.c @@ -162,16 +162,6 @@ os_thread_create( " returned %d\n", ret); exit(1); } -#endif -#ifdef __NETWARE__ - ret = pthread_attr_setstacksize(&attr, - (size_t) NW_THD_STACKSIZE); - if (ret) { - fprintf(stderr, - "InnoDB: Error: pthread_attr_setstacksize" - " returned %d\n", ret); - exit(1); - } #endif os_mutex_enter(os_sync_mutex); os_thread_count++; @@ -275,8 +265,6 @@ os_thread_sleep( { #ifdef __WIN__ Sleep((DWORD) tm / 1000); -#elif defined(__NETWARE__) - delay(tm / 1000); #else struct timeval t; diff --git a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c index d9084bb4ffd..eac2f9fb377 100644 --- a/storage/innobase/row/row0merge.c +++ b/storage/innobase/row/row0merge.c @@ -2164,8 +2164,9 @@ row_merge_file_create( /* This temp file open does not go through normal file APIs, add instrumentation to register with performance schema */ - struct PSI_file_locker* locker = NULL; - register_pfs_file_open_begin(locker, innodb_file_temp_key, + struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; + register_pfs_file_open_begin(&state, locker, innodb_file_temp_key, PSI_FILE_OPEN, "Innodb Merge Temp File", __FILE__, __LINE__); @@ -2187,8 +2188,9 @@ row_merge_file_destroy( merge_file_t* merge_file) /*!< out: merge file structure */ { #ifdef UNIV_PFS_IO - struct PSI_file_locker* locker = NULL; - register_pfs_file_io_begin(locker, merge_file->fd, 0, PSI_FILE_CLOSE, + struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; + register_pfs_file_io_begin(&state, locker, merge_file->fd, 0, PSI_FILE_CLOSE, __FILE__, __LINE__); #endif if (merge_file->fd != -1) { diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c index 4a0ecc5154f..686ee6a4198 100644 --- a/storage/innobase/srv/srv0start.c +++ b/storage/innobase/srv/srv0start.c @@ -1231,14 +1231,6 @@ innobase_start_or_create_for_mysql(void) maximum number of threads that can wait in the 'srv_conc array' for their time to enter InnoDB. */ -#if defined(__NETWARE__) - - /* Create less event semaphores because Win 98/ME had - difficulty creating 40000 event semaphores. Comment from - Novell, Inc.: also, these just take a lot of memory on - NetWare. */ - srv_max_n_threads = 1000; -#else if (srv_buf_pool_size >= 1000 * 1024 * 1024) { /* If buffer pool is less than 1000 MB, assume fewer threads. Also use only one @@ -1255,7 +1247,7 @@ innobase_start_or_create_for_mysql(void) especially in 64-bit computers */ } -#endif + err = srv_boot(); if (err != DB_SUCCESS) { @@ -1932,9 +1924,6 @@ innobase_shutdown_for_mysql(void) /*=============================*/ { ulint i; -#ifdef __NETWARE__ - extern ibool panic_shutdown; -#endif if (!srv_was_started) { if (srv_is_being_started) { ut_print_timestamp(stderr); @@ -1963,10 +1952,7 @@ innobase_shutdown_for_mysql(void) "InnoDB will do a crash recovery!\n"); } -#ifdef __NETWARE__ - if (!panic_shutdown) -#endif - logs_empty_and_mark_files_at_shutdown(); + logs_empty_and_mark_files_at_shutdown(); if (srv_conc_n_threads != 0) { fprintf(stderr, @@ -2133,12 +2119,4 @@ innobase_shutdown_for_mysql(void) return((int) DB_SUCCESS); } - -#ifdef __NETWARE__ -void set_panic_flag_for_netware() -{ - extern ibool panic_shutdown; - panic_shutdown = TRUE; -} -#endif /* __NETWARE__ */ #endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/ut/ut0dbg.c b/storage/innobase/ut/ut0dbg.c index 4484e6c36de..e79217d5b86 100644 --- a/storage/innobase/ut/ut0dbg.c +++ b/storage/innobase/ut/ut0dbg.c @@ -37,12 +37,7 @@ UNIV_INTERN ulint ut_dbg_zero = 0; will stop at the next ut_a() or ut_ad(). */ UNIV_INTERN ibool ut_dbg_stop_threads = FALSE; #endif -#ifdef __NETWARE__ -/** Flag for ignoring further assertion failures. This is set to TRUE -when on NetWare there happens an InnoDB assertion failure or other -fatal error condition that requires an immediate shutdown. */ -UNIV_INTERN ibool panic_shutdown = FALSE; -#elif !defined(UT_DBG_USE_ABORT) +#ifndef UT_DBG_USE_ABORT /** A null pointer that will be dereferenced to trigger a memory trap */ UNIV_INTERN ulint* ut_dbg_null_ptr = NULL; #endif @@ -86,22 +81,7 @@ ut_dbg_assertion_failed( #endif } -#ifdef __NETWARE__ -/*************************************************************//** -Shut down MySQL/InnoDB after assertion failure. */ -UNIV_INTERN -void -ut_dbg_panic(void) -/*==============*/ -{ - if (!panic_shutdown) { - panic_shutdown = TRUE; - innobase_shutdown_for_mysql(); - } - exit(1); -} -#else /* __NETWARE__ */ -# if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT) +#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT) /*************************************************************//** Stop a thread after assertion failure. */ UNIV_INTERN @@ -117,8 +97,7 @@ ut_dbg_stop_thread( os_thread_sleep(1000000000); #endif /* !UNIV_HOTBACKUP */ } -# endif -#endif /* __NETWARE__ */ +#endif #ifdef UNIV_COMPILE_TEST_FUNCS diff --git a/storage/innobase/ut/ut0mem.c b/storage/innobase/ut/ut0mem.c index f2baab67f09..53f15029e1b 100644 --- a/storage/innobase/ut/ut0mem.c +++ b/storage/innobase/ut/ut0mem.c @@ -179,9 +179,6 @@ retry: /* Make an intentional seg fault so that we get a stack trace */ - /* Intentional segfault on NetWare causes an abend. Avoid this - by graceful exit handling in ut_a(). */ -#if (!defined __NETWARE__) if (assert_on_error) { ut_print_timestamp(stderr); @@ -194,9 +191,6 @@ retry: } else { return(NULL); } -#else - ut_a(0); -#endif } if (set_to_zero) { diff --git a/storage/myisam/CMakeLists.txt b/storage/myisam/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c index c415264cd98..4a91c2d939b 100644 --- a/storage/myisam/mi_create.c +++ b/storage/myisam/mi_create.c @@ -19,12 +19,8 @@ #include "sp_defs.h" #include -#if defined(MSDOS) || defined(__WIN__) #ifdef __WIN__ #include -#else -#include /* Prototype for getpid */ -#endif #endif #include diff --git a/storage/myisam/mi_log.c b/storage/myisam/mi_log.c index 54498393f15..f6bbaab1f87 100644 --- a/storage/myisam/mi_log.c +++ b/storage/myisam/mi_log.c @@ -19,14 +19,8 @@ */ #include "myisamdef.h" -#if defined(MSDOS) || defined(__WIN__) +#ifdef __WIN__ #include -#ifndef __WIN__ -#include -#endif -#endif -#ifdef VMS -#include #endif #undef GETPID /* For HPUX */ diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index 014cf1c5a2c..5b3da9841b8 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -20,15 +20,8 @@ #include "rt_index.h" #include -#if defined(MSDOS) || defined(__WIN__) #ifdef __WIN__ #include -#else -#include /* Prototype for getpid */ -#endif -#endif -#ifdef VMS -#include "static.c" #endif static void setup_key_functions(MI_KEYDEF *keyinfo); diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c index c7ebf9ae220..24456e3d8fa 100644 --- a/storage/myisam/mi_search.c +++ b/storage/myisam/mi_search.c @@ -84,7 +84,7 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, if (!(buff=_mi_fetch_keypage(info,keyinfo,pos,DFLT_INIT_HITS,info->buff, test(!(nextflag & SEARCH_SAVE_BUFF))))) goto err; - DBUG_DUMP("page",(uchar*) buff,mi_getint(buff)); + DBUG_DUMP("page", buff, mi_getint(buff)); flag=(*keyinfo->bin_search)(info,keyinfo,buff,key,key_len,nextflag, &keypos,lastkey, &last_key); @@ -819,7 +819,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, DBUG_PRINT("error", ("Found too long null packed key: %u of %u at 0x%lx", length, keyseg->length, (long) *page_pos)); - DBUG_DUMP("key",(uchar*) *page_pos,16); + DBUG_DUMP("key", *page_pos, 16); mi_print_error(keyinfo->share, HA_ERR_CRASHED); my_errno=HA_ERR_CRASHED; return 0; @@ -876,7 +876,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, { DBUG_PRINT("error",("Found too long packed key: %u of %u at 0x%lx", length, keyseg->length, (long) *page_pos)); - DBUG_DUMP("key",(uchar*) *page_pos,16); + DBUG_DUMP("key", *page_pos, 16); mi_print_error(keyinfo->share, HA_ERR_CRASHED); my_errno=HA_ERR_CRASHED; return 0; /* Error */ @@ -948,7 +948,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, DBUG_PRINT("error", ("Found too long binary packed key: %u of %u at 0x%lx", length, keyinfo->maxlength, (long) *page_pos)); - DBUG_DUMP("key",(uchar*) *page_pos,16); + DBUG_DUMP("key", *page_pos, 16); mi_print_error(keyinfo->share, HA_ERR_CRASHED); my_errno=HA_ERR_CRASHED; DBUG_RETURN(0); /* Wrong key */ diff --git a/storage/myisam/mi_static.c b/storage/myisam/mi_static.c index 81d063a58fd..baa01a507eb 100644 --- a/storage/myisam/mi_static.c +++ b/storage/myisam/mi_static.c @@ -23,9 +23,9 @@ #endif LIST *myisam_open_list=0; -uchar NEAR myisam_file_magic[]= +uchar myisam_file_magic[]= { (uchar) 254, (uchar) 254,'\007', '\001', }; -uchar NEAR myisam_pack_file_magic[]= +uchar myisam_pack_file_magic[]= { (uchar) 254, (uchar) 254,'\010', '\002', }; char * myisam_log_filename=(char*) "myisam.log"; File myisam_log_file= -1; @@ -55,7 +55,7 @@ int (*myisam_test_invalid_symlink)(const char *filename)= always_valid; Position is , == , >= , <= , > , < */ -uint NEAR myisam_read_vec[]= +uint myisam_read_vec[]= { SEARCH_FIND, SEARCH_FIND | SEARCH_BIGGER, SEARCH_FIND | SEARCH_SMALLER, SEARCH_NO_FIND | SEARCH_BIGGER, SEARCH_NO_FIND | SEARCH_SMALLER, @@ -63,7 +63,7 @@ uint NEAR myisam_read_vec[]= MBR_CONTAIN, MBR_INTERSECT, MBR_WITHIN, MBR_DISJOINT, MBR_EQUAL }; -uint NEAR myisam_readnext_vec[]= +uint myisam_readnext_vec[]= { SEARCH_BIGGER, SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_SMALLER diff --git a/storage/myisam/mi_test2.c b/storage/myisam/mi_test2.c index 60b16d5549e..513b390ee68 100644 --- a/storage/myisam/mi_test2.c +++ b/storage/myisam/mi_test2.c @@ -28,7 +28,7 @@ #define STANDARD_LENGTH 37 #define MYISAM_KEYS 6 #define MAX_PARTS 4 -#if !defined(MSDOS) && !defined(labs) +#if !defined(labs) #define labs(a) abs(a) #endif @@ -412,7 +412,7 @@ int main(int argc, char *argv[]) } ant=0; while (mi_rprev(file,read_record3,0) == 0 && - bcmp(read_record3+start,key,length) == 0) ant++; + memcmp(read_record3+start,key,length) == 0) ant++; if (ant != dupp_keys) { printf("prev: Found: %d records of %d\n",ant,dupp_keys); @@ -450,7 +450,7 @@ int main(int argc, char *argv[]) goto end; } if (mi_rlast(file,read_record2,0) || - bcmp(read_record2,read_record3,reclength)) + memcmp(read_record2,read_record3,reclength)) { printf("Can't find last record\n"); DBUG_DUMP("record2",(uchar*) read_record2,reclength); @@ -465,7 +465,7 @@ int main(int argc, char *argv[]) printf("prev: I found: %d records of %d\n",ant,write_count); goto end; } - if (bcmp(read_record,read_record3,reclength)) + if (memcmp(read_record,read_record3,reclength)) { printf("Can't find first record\n"); goto end; @@ -480,7 +480,7 @@ int main(int argc, char *argv[]) mi_rprev(file,read_record3,0) == 0 || mi_rnext(file,read_record3,0)) goto err; - if (bcmp(read_record,read_record3,reclength) != 0) + if (memcmp(read_record,read_record3,reclength) != 0) printf("Can't find first record\n"); if (!silent) @@ -492,7 +492,7 @@ int main(int argc, char *argv[]) mi_rnext(file,read_record3,0) == 0 || mi_rprev(file,read_record3,0)) goto err; - if (bcmp(read_record2,read_record3,reclength)) + if (memcmp(read_record2,read_record3,reclength)) printf("Can't find last record\n"); #ifdef NOT_ANYMORE if (!silent) @@ -506,7 +506,7 @@ int main(int argc, char *argv[]) bzero((char*) file->lastkey,file->s->base.max_key_length*2); if (mi_rkey(file,read_record,0,key2,(uint) i,HA_READ_PREFIX)) goto err; - if (bcmp(read_record+start,key,(uint) i)) + if (memcmp(read_record+start,key,(uint) i)) { puts("Didn't find right record"); goto end; @@ -525,7 +525,7 @@ int main(int argc, char *argv[]) opt_delete++; ant=1; while (mi_rnext(file,read_record3,0) == 0 && - bcmp(read_record3+start,key,length) == 0) ant++; + memcmp(read_record3+start,key,length) == 0) ant++; if (ant != dupp_keys-1) { printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-1); @@ -543,7 +543,7 @@ int main(int argc, char *argv[]) opt_delete++; ant=1; while (mi_rprev(file,read_record3,0) == 0 && - bcmp(read_record3+start,key,length) == 0) ant++; + memcmp(read_record3+start,key,length) == 0) ant++; if (ant != dupp_keys-2) { printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-2); @@ -563,7 +563,7 @@ int main(int argc, char *argv[]) if (mi_rnext(file,read_record,0)) goto err; /* Skall finnas poster */ while (mi_rnext(file,read_record3,0) == 0 && - bcmp(read_record3+start,key,length) == 0) ant++; + memcmp(read_record3+start,key,length) == 0) ant++; if (ant != dupp_keys-3) { printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-3); @@ -578,7 +578,7 @@ int main(int argc, char *argv[]) opt_delete++; ant=0; while (mi_rprev(file,read_record3,0) == 0 && - bcmp(read_record3+start,key,length) == 0) ant++; + memcmp(read_record3+start,key,length) == 0) ant++; if (ant != dupp_keys-4) { printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-4); @@ -601,7 +601,7 @@ int main(int argc, char *argv[]) for (i=min(2,keys) ; i-- > 0 ;) { if (mi_rsame(file,read_record2,(int) i)) goto err; - if (bcmp(read_record,read_record2,reclength) != 0) + if (memcmp(read_record,read_record2,reclength) != 0) { printf("is_rsame didn't find same record\n"); goto end; diff --git a/storage/myisam/mi_test3.c b/storage/myisam/mi_test3.c index 7b16d6c05d6..bf36d8df7f4 100644 --- a/storage/myisam/mi_test3.c +++ b/storage/myisam/mi_test3.c @@ -15,8 +15,6 @@ /* Test av locking */ -#ifndef __NETWARE__ - #include "myisam.h" #include #ifdef HAVE_SYS_WAIT_H @@ -489,15 +487,3 @@ int test_update(MI_INFO *file,int id,int lock_type) } #include "mi_extrafunc.h" - -#else /* __NETWARE__ */ - -#include - -main() -{ - fprintf(stderr,"this test has not been ported to NetWare\n"); - return 0; -} - -#endif /* __NETWARE__ */ diff --git a/storage/myisam/mi_unique.c b/storage/myisam/mi_unique.c index 02fcd9289dd..fdba84a2e67 100644 --- a/storage/myisam/mi_unique.c +++ b/storage/myisam/mi_unique.c @@ -56,7 +56,7 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, uchar *record, if (_mi_search_next(info,info->s->keyinfo+def->key, info->lastkey, MI_UNIQUE_HASH_LENGTH, SEARCH_BIGGER, info->s->state.key_root[def->key]) || - bcmp((char*) info->lastkey, (char*) key_buff, MI_UNIQUE_HASH_LENGTH)) + memcmp(info->lastkey, key_buff, MI_UNIQUE_HASH_LENGTH)) { info->page_changed=1; /* Can't optimize read next */ info->lastpos=lastpos; diff --git a/storage/myisam/myisam_ftdump.c b/storage/myisam/myisam_ftdump.c index 74fa506a5b5..4718abc3481 100644 --- a/storage/myisam/myisam_ftdump.c +++ b/storage/myisam/myisam_ftdump.c @@ -253,18 +253,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), return 0; } -#include static void usage() { printf("Use: myisam_ftdump \n"); my_print_help(my_long_options); my_print_variables(my_long_options); - NETWARE_SET_SCREEN_MODE(1); exit(1); } -#include static void complain(int val) /* Kinda assert :-) */ { diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index 0e32dc59d89..e1cedf6bc31 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -148,7 +148,7 @@ enum options_mc { OPT_READ_BUFFER_SIZE, OPT_WRITE_BUFFER_SIZE, OPT_SORT_BUFFER_SIZE, OPT_SORT_KEY_BLOCKS, OPT_DECODE_BITS, OPT_FT_MIN_WORD_LEN, OPT_FT_MAX_WORD_LEN, OPT_FT_STOPWORD_FILE, - OPT_MAX_RECORD_LENGTH, OPT_AUTO_CLOSE, OPT_STATS_METHOD + OPT_MAX_RECORD_LENGTH, OPT_STATS_METHOD }; static struct my_option my_long_options[] = @@ -156,10 +156,6 @@ static struct my_option my_long_options[] = {"analyze", 'a', "Analyze distribution of keys. Will make some joins in MySQL faster. You can check the calculated distribution.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"block-search", 'b', "No help available.", 0, 0, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -336,13 +332,10 @@ static struct my_option my_long_options[] = }; -#include - static void print_version(void) { printf("%s Ver 2.7 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } @@ -364,7 +357,7 @@ static void usage(void) -?, --help Display this help and exit.\n\ -t, --tmpdir=path Path for temporary files. Multiple paths can be\n\ specified, separated by "); -#if defined( __WIN__) || defined(__NETWARE__) +#if defined( __WIN__) printf("semicolon (;)"); #else printf("colon (:)"); @@ -460,7 +453,6 @@ static void usage(void) my_print_variables(my_long_options); } -#include const char *myisam_stats_method_names[] = {"nulls_unequal", "nulls_equal", "nulls_ignored", NullS}; @@ -476,11 +468,6 @@ get_one_option(int optid, char *argument) { switch (optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'a': if (argument == disabled_my_option) check_param.testflag&= ~T_STATISTICS; diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h index d88ebdf5f12..130a96bc9e0 100644 --- a/storage/myisam/myisamdef.h +++ b/storage/myisam/myisamdef.h @@ -347,11 +347,11 @@ typedef struct st_mi_sort_param int (*key_read)(struct st_mi_sort_param *,void *); int (*key_write)(struct st_mi_sort_param *, const void *); void (*lock_in_memory)(MI_CHECK *); - NEAR int (*write_keys)(struct st_mi_sort_param *, register uchar **, - uint , struct st_buffpek *, IO_CACHE *); - NEAR uint (*read_to_buffer)(IO_CACHE *,struct st_buffpek *, uint); - NEAR int (*write_key)(struct st_mi_sort_param *, IO_CACHE *,uchar *, - uint, uint); + int (*write_keys)(struct st_mi_sort_param *, register uchar **, + uint , struct st_buffpek *, IO_CACHE *); + uint (*read_to_buffer)(IO_CACHE *,struct st_buffpek *, uint); + int (*write_key)(struct st_mi_sort_param *, IO_CACHE *,uchar *, + uint, uint); } MI_SORT_PARAM; /* Some defines used by isam-funktions */ @@ -475,8 +475,8 @@ extern mysql_mutex_t THR_LOCK_myisam; /* Some extern variables */ extern LIST *myisam_open_list; -extern uchar NEAR myisam_file_magic[],NEAR myisam_pack_file_magic[]; -extern uint NEAR myisam_read_vec[],NEAR myisam_readnext_vec[]; +extern uchar myisam_file_magic[], myisam_pack_file_magic[]; +extern uint myisam_read_vec[], myisam_readnext_vec[]; extern uint myisam_quick_table_bits; extern File myisam_log_file; extern ulong myisam_pid; @@ -774,9 +774,9 @@ void _mi_report_crashed(MI_INFO *file, const char *message, /* Functions needed by mi_check */ volatile int *killed_ptr(MI_CHECK *param); -void mi_check_print_error _VARARGS((MI_CHECK *param, const char *fmt,...)); -void mi_check_print_warning _VARARGS((MI_CHECK *param, const char *fmt,...)); -void mi_check_print_info _VARARGS((MI_CHECK *param, const char *fmt,...)); +void mi_check_print_error(MI_CHECK *param, const char *fmt,...); +void mi_check_print_warning(MI_CHECK *param, const char *fmt,...); +void mi_check_print_info(MI_CHECK *param, const char *fmt,...); int flush_pending_blocks(MI_SORT_PARAM *param); int sort_ft_buf_flush(MI_SORT_PARAM *sort_param); int thr_write_keys(MI_SORT_PARAM *sort_param); diff --git a/storage/myisam/myisamlog.c b/storage/myisam/myisamlog.c index 1733d7140cd..d3da0eab22c 100644 --- a/storage/myisam/myisamlog.c +++ b/storage/myisam/myisamlog.c @@ -248,7 +248,6 @@ static void get_options(register int *argc, register char ***argv) /* Fall through */ case 'I': case '?': -#include printf("%s Ver 1.4 for %s at %s\n",my_progname,SYSTEM_TYPE, MACHINE_TYPE); puts("By Monty, for your professional use\n"); @@ -270,7 +269,6 @@ static void get_options(register int *argc, register char ***argv) puts("If a recover is done all writes and all possibly updates and deletes is done\nand errors are only counted."); puts("If one gives table names as arguments only these tables will be updated\n"); help=1; -#include break; default: printf("illegal option: \"-%c\"\n",*pos); diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c index d4997a2bcbb..4cd305fdc69 100644 --- a/storage/myisam/myisampack.c +++ b/storage/myisam/myisampack.c @@ -23,9 +23,6 @@ #include #include #include "mysys_err.h" -#ifdef MSDOS -#include -#endif #ifndef __GNU_LIBRARY__ #define __GNU_LIBRARY__ /* Skip warnings in getopt.h */ #endif @@ -256,14 +253,10 @@ int main(int argc, char **argv) #endif } -enum options_mp {OPT_CHARSETS_DIR_MP=256, OPT_AUTO_CLOSE}; +enum options_mp {OPT_CHARSETS_DIR_MP=256}; static struct my_option my_long_options[] = { -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"backup", 'b', "Make a backup of the table as table_name.OLD.", &backup, &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"character-sets-dir", OPT_CHARSETS_DIR_MP, @@ -295,13 +288,11 @@ static struct my_option my_long_options[] = { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; -#include static void print_version(void) { printf("%s Ver 1.23 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } @@ -323,7 +314,6 @@ static void usage(void) my_print_variables(my_long_options); } -#include static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), @@ -332,11 +322,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), uint length; switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'f': force_pack= 1; tmpfile_createflag= O_RDWR | O_TRUNC; diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c index a824de8c9fb..9532b9f0474 100644 --- a/storage/myisam/sort.c +++ b/storage/myisam/sort.c @@ -19,7 +19,7 @@ */ #include "fulltext.h" -#if defined(MSDOS) || defined(__WIN__) +#if defined(__WIN__) #include #else #include @@ -41,46 +41,46 @@ Pointers of functions for store and read keys from temp file */ -extern void print_error _VARARGS((const char *fmt,...)); +extern void print_error(const char *fmt,...); /* Functions defined in this file */ -static ha_rows NEAR_F find_all_keys(MI_SORT_PARAM *info,uint keys, - uchar **sort_keys, - DYNAMIC_ARRAY *buffpek,int *maxbuffer, - IO_CACHE *tempfile, - IO_CACHE *tempfile_for_exceptions); -static int NEAR_F write_keys(MI_SORT_PARAM *info,uchar **sort_keys, - uint count, BUFFPEK *buffpek,IO_CACHE *tempfile); -static int NEAR_F write_key(MI_SORT_PARAM *info, uchar *key, - IO_CACHE *tempfile); -static int NEAR_F write_index(MI_SORT_PARAM *info,uchar * *sort_keys, - uint count); -static int NEAR_F merge_many_buff(MI_SORT_PARAM *info,uint keys, - uchar * *sort_keys, - BUFFPEK *buffpek,int *maxbuffer, - IO_CACHE *t_file); -static uint NEAR_F read_to_buffer(IO_CACHE *fromfile,BUFFPEK *buffpek, - uint sort_length); -static int NEAR_F merge_buffers(MI_SORT_PARAM *info,uint keys, - IO_CACHE *from_file, IO_CACHE *to_file, - uchar * *sort_keys, BUFFPEK *lastbuff, - BUFFPEK *Fb, BUFFPEK *Tb); -static int NEAR_F merge_index(MI_SORT_PARAM *,uint,uchar **,BUFFPEK *, int, - IO_CACHE *); +static ha_rows find_all_keys(MI_SORT_PARAM *info,uint keys, + uchar **sort_keys, + DYNAMIC_ARRAY *buffpek,int *maxbuffer, + IO_CACHE *tempfile, + IO_CACHE *tempfile_for_exceptions); +static int write_keys(MI_SORT_PARAM *info,uchar **sort_keys, + uint count, BUFFPEK *buffpek,IO_CACHE *tempfile); +static int write_key(MI_SORT_PARAM *info, uchar *key, + IO_CACHE *tempfile); +static int write_index(MI_SORT_PARAM *info,uchar * *sort_keys, + uint count); +static int merge_many_buff(MI_SORT_PARAM *info,uint keys, + uchar * *sort_keys, + BUFFPEK *buffpek,int *maxbuffer, + IO_CACHE *t_file); +static uint read_to_buffer(IO_CACHE *fromfile,BUFFPEK *buffpek, + uint sort_length); +static int merge_buffers(MI_SORT_PARAM *info,uint keys, + IO_CACHE *from_file, IO_CACHE *to_file, + uchar * *sort_keys, BUFFPEK *lastbuff, + BUFFPEK *Fb, BUFFPEK *Tb); +static int merge_index(MI_SORT_PARAM *,uint,uchar **,BUFFPEK *, int, + IO_CACHE *); static int flush_ft_buf(MI_SORT_PARAM *info); -static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info,uchar **sort_keys, - uint count, BUFFPEK *buffpek, - IO_CACHE *tempfile); -static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile,BUFFPEK *buffpek, - uint sort_length); -static int NEAR_F write_merge_key(MI_SORT_PARAM *info, IO_CACHE *to_file, - uchar *key, uint sort_length, uint count); -static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info, - IO_CACHE *to_file, - uchar* key, uint sort_length, - uint count); +static int write_keys_varlen(MI_SORT_PARAM *info,uchar **sort_keys, + uint count, BUFFPEK *buffpek, + IO_CACHE *tempfile); +static uint read_to_buffer_varlen(IO_CACHE *fromfile,BUFFPEK *buffpek, + uint sort_length); +static int write_merge_key(MI_SORT_PARAM *info, IO_CACHE *to_file, + uchar *key, uint sort_length, uint count); +static int write_merge_key_varlen(MI_SORT_PARAM *info, + IO_CACHE *to_file, + uchar* key, uint sort_length, + uint count); static inline int my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs); @@ -253,10 +253,10 @@ err: /* Search after all keys and place them in a temp. file */ -static ha_rows NEAR_F find_all_keys(MI_SORT_PARAM *info, uint keys, - uchar **sort_keys, DYNAMIC_ARRAY *buffpek, - int *maxbuffer, IO_CACHE *tempfile, - IO_CACHE *tempfile_for_exceptions) +static ha_rows find_all_keys(MI_SORT_PARAM *info, uint keys, + uchar **sort_keys, DYNAMIC_ARRAY *buffpek, + int *maxbuffer, IO_CACHE *tempfile, + IO_CACHE *tempfile_for_exceptions) { int error; uint idx; @@ -641,8 +641,8 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) /* Write all keys in memory to file for later merge */ -static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys, - uint count, BUFFPEK *buffpek, IO_CACHE *tempfile) +static int write_keys(MI_SORT_PARAM *info, register uchar **sort_keys, + uint count, BUFFPEK *buffpek, IO_CACHE *tempfile) { uchar **end; uint sort_length=info->key_length; @@ -682,10 +682,10 @@ my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs) } -static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info, - register uchar **sort_keys, - uint count, BUFFPEK *buffpek, - IO_CACHE *tempfile) +static int write_keys_varlen(MI_SORT_PARAM *info, + register uchar **sort_keys, + uint count, BUFFPEK *buffpek, + IO_CACHE *tempfile) { uchar **end; int err; @@ -709,8 +709,7 @@ static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info, } /* write_keys_varlen */ -static int NEAR_F write_key(MI_SORT_PARAM *info, uchar *key, - IO_CACHE *tempfile) +static int write_key(MI_SORT_PARAM *info, uchar *key, IO_CACHE *tempfile) { uint key_length=info->real_key_length; DBUG_ENTER("write_key"); @@ -729,8 +728,8 @@ static int NEAR_F write_key(MI_SORT_PARAM *info, uchar *key, /* Write index */ -static int NEAR_F write_index(MI_SORT_PARAM *info, register uchar **sort_keys, - register uint count) +static int write_index(MI_SORT_PARAM *info, register uchar **sort_keys, + register uint count) { DBUG_ENTER("write_index"); @@ -747,9 +746,9 @@ static int NEAR_F write_index(MI_SORT_PARAM *info, register uchar **sort_keys, /* Merge buffers to make < MERGEBUFF2 buffers */ -static int NEAR_F merge_many_buff(MI_SORT_PARAM *info, uint keys, - uchar **sort_keys, BUFFPEK *buffpek, - int *maxbuffer, IO_CACHE *t_file) +static int merge_many_buff(MI_SORT_PARAM *info, uint keys, + uchar **sort_keys, BUFFPEK *buffpek, + int *maxbuffer, IO_CACHE *t_file) { register int i; IO_CACHE t_file2, *from_file, *to_file, *temp; @@ -810,8 +809,8 @@ cleanup: -1 Error */ -static uint NEAR_F read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek, - uint sort_length) +static uint read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek, + uint sort_length) { register uint count; uint length; @@ -830,8 +829,8 @@ static uint NEAR_F read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek, return (count*sort_length); } /* read_to_buffer */ -static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek, - uint sort_length) +static uint read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek, + uint sort_length) { register uint count; uint16 length_of_key = 0; @@ -862,9 +861,9 @@ static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek, } /* read_to_buffer_varlen */ -static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info, - IO_CACHE *to_file, uchar* key, - uint sort_length, uint count) +static int write_merge_key_varlen(MI_SORT_PARAM *info, + IO_CACHE *to_file, uchar* key, + uint sort_length, uint count) { uint idx; uchar *bufs = key; @@ -880,9 +879,9 @@ static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info, } -static int NEAR_F write_merge_key(MI_SORT_PARAM *info __attribute__((unused)), - IO_CACHE *to_file, uchar *key, - uint sort_length, uint count) +static int write_merge_key(MI_SORT_PARAM *info __attribute__((unused)), + IO_CACHE *to_file, uchar *key, + uint sort_length, uint count) { return my_b_write(to_file, key, (size_t) sort_length*count); } @@ -892,7 +891,7 @@ static int NEAR_F write_merge_key(MI_SORT_PARAM *info __attribute__((unused)), If to_file == 0 then use info->key_write */ -static int NEAR_F +static int merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file, IO_CACHE *to_file, uchar **sort_keys, BUFFPEK *lastbuff, BUFFPEK *Fb, BUFFPEK *Tb) @@ -1035,7 +1034,7 @@ err: /* Do a merge to output-file (save only positions) */ -static int NEAR_F +static int merge_index(MI_SORT_PARAM *info, uint keys, uchar **sort_keys, BUFFPEK *buffpek, int maxbuffer, IO_CACHE *tempfile) { diff --git a/storage/myisammrg/CMakeLists.txt b/storage/myisammrg/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index 6e3047afb34..f41629ff882 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -299,9 +299,8 @@ extern "C" int myisammrg_parent_open_callback(void *callback_param, if (! db || ! table_name) DBUG_RETURN(1); - DBUG_PRINT("myrg", ("open: '%.*s'.'%.*s'", db_length, db, - table_name_length, table_name)); - + DBUG_PRINT("myrg", ("open: '%.*s'.'%.*s'", (int) db_length, db, + (int) table_name_length, table_name)); /* Convert to lowercase if required. */ if (lower_case_table_names && table_name_length) diff --git a/storage/myisammrg/myrg_open.c b/storage/myisammrg/myrg_open.c index e4793ffe672..c9e19d32e96 100644 --- a/storage/myisammrg/myrg_open.c +++ b/storage/myisammrg/myrg_open.c @@ -18,9 +18,6 @@ #include "myrg_def.h" #include #include -#ifdef VMS -#include "mrg_static.c" -#endif /* open a MyISAM MERGE table diff --git a/storage/ndb/src/common/portlib/NdbMutex.c b/storage/ndb/src/common/portlib/NdbMutex.c index c9184e5d1f2..5595baba7c4 100644 --- a/storage/ndb/src/common/portlib/NdbMutex.c +++ b/storage/ndb/src/common/portlib/NdbMutex.c @@ -24,36 +24,31 @@ NdbMutex* NdbMutex_Create(void) { NdbMutex* pNdbMutex; int result; - DBUG_ENTER("NdbMutex_Create"); - + pNdbMutex = (NdbMutex*)NdbMem_Allocate(sizeof(NdbMutex)); - DBUG_PRINT("info",("NdbMem_Allocate 0x%lx", (long) pNdbMutex)); - + if (pNdbMutex == NULL) - DBUG_RETURN(NULL); - + return NULL; + result = pthread_mutex_init(pNdbMutex, NULL); assert(result == 0); - - DBUG_RETURN(pNdbMutex); + + return pNdbMutex; } int NdbMutex_Destroy(NdbMutex* p_mutex) { int result; - DBUG_ENTER("NdbMutex_Destroy"); if (p_mutex == NULL) - DBUG_RETURN(-1); + return -1; result = pthread_mutex_destroy(p_mutex); - DBUG_PRINT("info",("NdbMem_Free 0x%lx", (long) p_mutex)); NdbMem_Free(p_mutex); - - DBUG_RETURN(result); + return result; } diff --git a/storage/ndb/src/mgmclient/main.cpp b/storage/ndb/src/mgmclient/main.cpp index fbd81c71700..980530953ad 100644 --- a/storage/ndb/src/mgmclient/main.cpp +++ b/storage/ndb/src/mgmclient/main.cpp @@ -20,7 +20,7 @@ extern "C" { #if defined( __WIN__) #include -#elif !defined(__NETWARE__) +#else #include extern "C" int add_history(const char *command); /* From readline directory */ extern "C" int read_history(const char *command); diff --git a/storage/ndb/src/mgmsrv/main.cpp b/storage/ndb/src/mgmsrv/main.cpp index 16c560868ef..26198a44a23 100644 --- a/storage/ndb/src/mgmsrv/main.cpp +++ b/storage/ndb/src/mgmsrv/main.cpp @@ -48,7 +48,7 @@ const char *load_default_groups[]= { "mysql_cluster","ndb_mgmd",0 }; extern "C" { #if defined( __WIN__) #include -#elif !defined(__NETWARE__) +#else #include extern "C" int add_history(const char *command); /* From readline directory */ #define HAVE_READLINE diff --git a/storage/ndb/src/ndbapi/DictCache.cpp b/storage/ndb/src/ndbapi/DictCache.cpp index 04be3711847..9c66b2be9d2 100644 --- a/storage/ndb/src/ndbapi/DictCache.cpp +++ b/storage/ndb/src/ndbapi/DictCache.cpp @@ -20,8 +20,10 @@ #include #include -static NdbTableImpl f_invalid_table; -static NdbTableImpl f_altered_table; +static NdbTableImpl * f_invalid_table = 0; +static NdbTableImpl * f_altered_table = 0; + +static int ndb_dict_cache_count = 0; Ndb_local_table_info * Ndb_local_table_info::create(NdbTableImpl *table_impl, Uint32 sz) @@ -93,11 +95,29 @@ GlobalDictCache::GlobalDictCache(){ DBUG_ENTER("GlobalDictCache::GlobalDictCache"); m_tableHash.createHashTable(); m_waitForTableCondition = NdbCondition_Create(); + if (f_invalid_table == NULL) + f_invalid_table = new NdbTableImpl(); + if (f_altered_table == NULL) + f_altered_table = new NdbTableImpl(); + ndb_dict_cache_count++; DBUG_VOID_RETURN; } GlobalDictCache::~GlobalDictCache(){ DBUG_ENTER("GlobalDictCache::~GlobalDictCache"); + if (--ndb_dict_cache_count == 0) + { + if (f_invalid_table) + { + delete f_invalid_table; + f_invalid_table = 0; + } + if (f_altered_table) + { + delete f_altered_table; + f_altered_table = 0; + } + } NdbElement_t > * curr = m_tableHash.getNext(0); while(curr != 0){ Vector * vers = curr->theData; @@ -254,7 +274,7 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab) TableVersion & ver = vers->back(); if(ver.m_status != RETREIVING || !(ver.m_impl == 0 || - ver.m_impl == &f_invalid_table || ver.m_impl == &f_altered_table) || + ver.m_impl == f_invalid_table || ver.m_impl == f_altered_table) || ver.m_version != 0 || ver.m_refCount == 0){ abort(); @@ -271,7 +291,7 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab) ver.m_version = tab->m_version; ver.m_status = OK; } - else if (ver.m_impl == &f_invalid_table) + else if (ver.m_impl == f_invalid_table) { DBUG_PRINT("info", ("Table DROPPED invalid")); ver.m_impl = tab; @@ -279,7 +299,7 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab) ver.m_status = DROPPED; ver.m_impl->m_status = NdbDictionary::Object::Invalid; } - else if(ver.m_impl == &f_altered_table) + else if(ver.m_impl == f_altered_table) { DBUG_PRINT("info", ("Table DROPPED altered")); ver.m_impl = tab; @@ -440,7 +460,7 @@ GlobalDictCache::alter_table_rep(const char * name, if(i == sz - 1 && ver.m_status == RETREIVING) { - ver.m_impl = altered ? &f_altered_table : &f_invalid_table; + ver.m_impl = altered ? f_altered_table : f_invalid_table; DBUG_VOID_RETURN; } } diff --git a/storage/perfschema/CMakeLists.txt b/storage/perfschema/CMakeLists.txt index 6c7731f2d07..5cd651a35bd 100644 --- a/storage/perfschema/CMakeLists.txt +++ b/storage/perfschema/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc. +# 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 @@ -10,9 +10,8 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/include diff --git a/storage/perfschema/Makefile.am b/storage/perfschema/Makefile.am index 8c30c812bc6..374415cfdfd 100644 --- a/storage/perfschema/Makefile.am +++ b/storage/perfschema/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2008-2009 Sun Microsystems, Inc +# Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA #called from the top level Makefile diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc index 588ba5edec1..0fac734f7a0 100644 --- a/storage/perfschema/ha_perfschema.cc +++ b/storage/perfschema/ha_perfschema.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,18 +10,19 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/ha_perfschema.cc Performance schema storage engine (implementation). */ -#include "sql_priv.h" -#include "unireg.h" -#include "ha_perfschema.h" +#include "my_global.h" +#include "my_pthread.h" +#include "sql_plugin.h" #include "mysql/plugin.h" +#include "ha_perfschema.h" #include "pfs_engine_table.h" #include "pfs_column_values.h" #include "pfs_instr_class.h" @@ -145,7 +146,7 @@ mysql_declare_plugin(perfschema) MYSQL_STORAGE_ENGINE_PLUGIN, &pfs_storage_engine, pfs_engine_name, - "Marc Alff, Sun Microsystems", + "Marc Alff, Oracle", /* Formerly Sun Microsystems, formerly MySQL */ "Performance Schema", PLUGIN_LICENSE_GPL, pfs_init_func, /* Plugin Init */ diff --git a/storage/perfschema/ha_perfschema.h b/storage/perfschema/ha_perfschema.h index 92cc0476e73..2c7b45fbbf7 100644 --- a/storage/perfschema/ha_perfschema.h +++ b/storage/perfschema/ha_perfschema.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef HA_PERFSCHEMA_H #define HA_PERFSCHEMA_H diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc index 3cd637ffa66..93c9cf14e9d 100644 --- a/storage/perfschema/pfs.cc +++ b/storage/perfschema/pfs.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs.cc @@ -1093,7 +1093,8 @@ static void delete_thread_v1(PSI_thread *thread) } static PSI_mutex_locker* -get_thread_mutex_locker_v1(PSI_mutex *mutex, PSI_mutex_operation op) +get_thread_mutex_locker_v1(PSI_mutex_locker_state *state, + PSI_mutex *mutex, PSI_mutex_operation op) { PFS_mutex *pfs_mutex= reinterpret_cast (mutex); DBUG_ASSERT((int) op >= 0); @@ -1138,7 +1139,8 @@ get_thread_mutex_locker_v1(PSI_mutex *mutex, PSI_mutex_operation op) } static PSI_rwlock_locker* -get_thread_rwlock_locker_v1(PSI_rwlock *rwlock, PSI_rwlock_operation op) +get_thread_rwlock_locker_v1(PSI_rwlock_locker_state *state, + PSI_rwlock *rwlock, PSI_rwlock_operation op) { PFS_rwlock *pfs_rwlock= reinterpret_cast (rwlock); DBUG_ASSERT(static_cast (op) >= 0); @@ -1184,7 +1186,8 @@ get_thread_rwlock_locker_v1(PSI_rwlock *rwlock, PSI_rwlock_operation op) } static PSI_cond_locker* -get_thread_cond_locker_v1(PSI_cond *cond, PSI_mutex * /* unused: mutex */, +get_thread_cond_locker_v1(PSI_cond_locker_state *state, + PSI_cond *cond, PSI_mutex * /* unused: mutex */, PSI_cond_operation op) { /* @@ -1242,7 +1245,8 @@ get_thread_cond_locker_v1(PSI_cond *cond, PSI_mutex * /* unused: mutex */, } static PSI_table_locker* -get_thread_table_locker_v1(PSI_table *table) +get_thread_table_locker_v1(PSI_table_locker_state *state, + PSI_table *table) { PFS_table *pfs_table= reinterpret_cast (table); DBUG_ASSERT(pfs_table != NULL); @@ -1284,7 +1288,8 @@ get_thread_table_locker_v1(PSI_table *table) } static PSI_file_locker* -get_thread_file_name_locker_v1(PSI_file_key key, +get_thread_file_name_locker_v1(PSI_file_locker_state *state, + PSI_file_key key, PSI_file_operation op, const char *name, const void *identity) { @@ -1341,7 +1346,8 @@ get_thread_file_name_locker_v1(PSI_file_key key, } static PSI_file_locker* -get_thread_file_stream_locker_v1(PSI_file *file, PSI_file_operation op) +get_thread_file_stream_locker_v1(PSI_file_locker_state *state, + PSI_file *file, PSI_file_operation op) { PFS_file *pfs_file= reinterpret_cast (file); @@ -1392,7 +1398,8 @@ get_thread_file_stream_locker_v1(PSI_file *file, PSI_file_operation op) } static PSI_file_locker* -get_thread_file_descriptor_locker_v1(File file, PSI_file_operation op) +get_thread_file_descriptor_locker_v1(PSI_file_locker_state *state, + File file, PSI_file_operation op) { int index= static_cast (file); @@ -1462,7 +1469,7 @@ get_thread_file_descriptor_locker_v1(File file, PSI_file_operation op) return NULL; } -static void unlock_mutex_v1(PSI_thread * thread, PSI_mutex *mutex) +static void unlock_mutex_v1(PSI_mutex *mutex) { PFS_mutex *pfs_mutex= reinterpret_cast (mutex); DBUG_ASSERT(pfs_mutex != NULL); @@ -1501,7 +1508,7 @@ static void unlock_mutex_v1(PSI_thread * thread, PSI_mutex *mutex) #endif } -static void unlock_rwlock_v1(PSI_thread *thread, PSI_rwlock *rwlock) +static void unlock_rwlock_v1(PSI_rwlock *rwlock) { PFS_rwlock *pfs_rwlock= reinterpret_cast (rwlock); DBUG_ASSERT(pfs_rwlock != NULL); @@ -1577,7 +1584,7 @@ static void unlock_rwlock_v1(PSI_thread *thread, PSI_rwlock *rwlock) #endif } -static void signal_cond_v1(PSI_thread *thread, PSI_cond* cond) +static void signal_cond_v1(PSI_cond* cond) { PFS_cond *pfs_cond= reinterpret_cast (cond); DBUG_ASSERT(pfs_cond != NULL); @@ -1585,7 +1592,7 @@ static void signal_cond_v1(PSI_thread *thread, PSI_cond* cond) pfs_cond->m_cond_stat.m_signal_count++; } -static void broadcast_cond_v1(PSI_thread *thread, PSI_cond* cond) +static void broadcast_cond_v1(PSI_cond* cond) { PFS_cond *pfs_cond= reinterpret_cast (cond); DBUG_ASSERT(pfs_cond != NULL); diff --git a/storage/perfschema/pfs.h b/storage/perfschema/pfs.h index f529d09a05c..4e11736b1b9 100644 --- a/storage/perfschema/pfs.h +++ b/storage/perfschema/pfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_H #define PFS_H @@ -23,9 +23,8 @@ #define HAVE_PSI_1 -#include #include -#include +#include #include extern struct PSI_bootstrap PFS_bootstrap; diff --git a/storage/perfschema/pfs_atomic.cc b/storage/perfschema/pfs_atomic.cc index c33bb251767..06090accdc6 100644 --- a/storage/perfschema/pfs_atomic.cc +++ b/storage/perfschema/pfs_atomic.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_atomic.cc diff --git a/storage/perfschema/pfs_atomic.h b/storage/perfschema/pfs_atomic.h index 7833c5f1c7a..b0070f7b8d0 100644 --- a/storage/perfschema/pfs_atomic.h +++ b/storage/perfschema/pfs_atomic.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_ATOMIC_H #define PFS_ATOMIC_H diff --git a/storage/perfschema/pfs_check.cc b/storage/perfschema/pfs_check.cc index 4ef4b8bdbc6..c52be6f0da2 100644 --- a/storage/perfschema/pfs_check.cc +++ b/storage/perfschema/pfs_check.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_check.cc @@ -23,7 +23,6 @@ */ #include "my_global.h" -#include "sql_priv.h" #include "pfs_server.h" #include "pfs_engine_table.h" diff --git a/storage/perfschema/pfs_column_types.h b/storage/perfschema/pfs_column_types.h index c6f652d57a0..96b33636ff9 100644 --- a/storage/perfschema/pfs_column_types.h +++ b/storage/perfschema/pfs_column_types.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_COLUMN_TYPES_H #define PFS_COLUMN_TYPES_H diff --git a/storage/perfschema/pfs_column_values.cc b/storage/perfschema/pfs_column_values.cc index 6da1e04e63a..ea65441b8c6 100644 --- a/storage/perfschema/pfs_column_values.cc +++ b/storage/perfschema/pfs_column_values.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_column_values.cc @@ -19,7 +19,6 @@ schema tables (implementation). */ -#include "sql_priv.h" #include "pfs_column_values.h" LEX_STRING PERFORMANCE_SCHEMA_str= diff --git a/storage/perfschema/pfs_column_values.h b/storage/perfschema/pfs_column_values.h index 0172ddd1d18..f9e7f90dbc9 100644 --- a/storage/perfschema/pfs_column_values.h +++ b/storage/perfschema/pfs_column_values.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_COLUMN_VALUES_H #define PFS_COLUMN_VALUES_H diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc index 857b8a66de7..7b6fd055729 100644 --- a/storage/perfschema/pfs_engine_table.cc +++ b/storage/perfschema/pfs_engine_table.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,15 +10,14 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_engine_table.cc Performance schema tables (implementation). */ -#include "sql_priv.h" #include "pfs_engine_table.h" #include "table_events_waits.h" @@ -36,6 +35,7 @@ /* For show status */ #include "pfs_column_values.h" #include "pfs_instr.h" +#include "pfs_global.h" #include "sql_base.h" // close_thread_tables #include "lock.h" // MYSQL_LOCK_IGNORE_TIMEOUT @@ -108,7 +108,12 @@ void PFS_check_intact::report_error(uint code, const char *fmt, ...) my_vsnprintf(buff, sizeof(buff), fmt, args); va_end(args); - my_message(code, buff, MYF(0)); + /* + This is an install/upgrade issue: + - do not report it in the user connection, there is none in main(), + - report it in the server error log. + */ + sql_print_error("%s", buff); } /** @@ -139,6 +144,9 @@ void PFS_engine_table_share::check_one_table(THD *thd) m_checked= true; close_thread_tables(thd); } + else + sql_print_error(ER(ER_WRONG_NATIVE_TABLE_STRUCTURE), + PERFORMANCE_SCHEMA_str.str, m_name.str); lex_end(&dummy_lex); thd->lex= old_lex; @@ -327,10 +335,10 @@ ulonglong PFS_engine_table::get_field_enum(Field *f) return f2->val_int(); } -int PFS_readonly_table::update_row_values(TABLE *, - const unsigned char *, - unsigned char *, - Field **) +int PFS_engine_table::update_row_values(TABLE *, + const unsigned char *, + unsigned char *, + Field **) { my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); return HA_ERR_WRONG_COMMAND; @@ -466,7 +474,22 @@ PFS_unknown_acl pfs_unknown_acl; ACL_internal_access_result PFS_unknown_acl::check(ulong want_access, ulong *save_priv) const { - return ACL_INTERNAL_ACCESS_DENIED; + const ulong always_forbidden= INSERT_ACL | UPDATE_ACL | DELETE_ACL + | CREATE_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL + | CREATE_VIEW_ACL | TRIGGER_ACL | LOCK_TABLES_ACL; + + if (unlikely(want_access & always_forbidden)) + return ACL_INTERNAL_ACCESS_DENIED; + + /* + There is no point in hidding (by enforcing ACCESS_DENIED for SELECT_ACL + on performance_schema.*) tables that do not exist anyway. + When SELECT_ACL is granted on performance_schema.* or *.*, + SELECT * from performance_schema.wrong_table + will fail with a more understandable ER_NO_SUCH_TABLE error, + instead of ER_TABLEACCESS_DENIED_ERROR. + */ + return ACL_INTERNAL_ACCESS_CHECK_GRANT; } /** @@ -678,6 +701,7 @@ bool pfs_show_status(handlerton *hton, THD *thd, case 40: name= "(PFS_FILE_HANDLE).MEMORY"; size= file_handle_max * sizeof(PFS_file*); + total_memory+= size; break; case 41: name= "EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME.ROW_SIZE"; @@ -692,13 +716,41 @@ bool pfs_show_status(handlerton *hton, THD *thd, size= thread_max * instr_class_per_thread * sizeof(PFS_single_stat_chain); total_memory+= size; break; + case 44: + name= "(PFS_TABLE_SHARE).ROW_SIZE"; + size= sizeof(PFS_table_share); + break; + case 45: + name= "(PFS_TABLE_SHARE).ROW_COUNT"; + size= table_share_max; + break; + case 46: + name= "(PFS_TABLE_SHARE).MEMORY"; + size= table_share_max * sizeof(PFS_table_share); + total_memory+= size; + break; + case 47: + name= "(PFS_TABLE).ROW_SIZE"; + size= sizeof(PFS_table); + break; + case 48: + name= "(PFS_TABLE).ROW_COUNT"; + size= table_max; + break; + case 49: + name= "(PFS_TABLE).MEMORY"; + size= table_max * sizeof(PFS_table); + total_memory+= size; + break; /* This case must be last, for aggregation in total_memory. */ - case 44: + case 50: name= "PERFORMANCE_SCHEMA.MEMORY"; size= total_memory; + /* This will fail if something is not advertised here */ + DBUG_ASSERT(size == pfs_allocated_memory); break; default: goto end; diff --git a/storage/perfschema/pfs_engine_table.h b/storage/perfschema/pfs_engine_table.h index b4c7a4ee866..ec73c5a3688 100644 --- a/storage/perfschema/pfs_engine_table.h +++ b/storage/perfschema/pfs_engine_table.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_ENGINE_TABLE_H #define PFS_ENGINE_TABLE_H @@ -81,7 +81,7 @@ protected: @param fields Table fields */ virtual int update_row_values(TABLE *table, const unsigned char *old_buf, - unsigned char *new_buf, Field **fields)= 0; + unsigned char *new_buf, Field **fields); /** Constructor. @@ -151,27 +151,6 @@ struct PFS_engine_table_share bool m_checked; }; -/** Adapter for read only PERFORMANCE_SCHEMA tables. */ -class PFS_readonly_table : public PFS_engine_table -{ -protected: - /** - Constructor. - @param share table share - @param pos address of the m_pos position member - */ - PFS_readonly_table(const PFS_engine_table_share *share, void *pos) - : PFS_engine_table(share, pos) - {} - - ~PFS_readonly_table() - {} - - virtual int update_row_values(TABLE *table, const unsigned char *old_buf, - unsigned char *new_buf, Field **fields); - -}; - class PFS_readonly_acl : public ACL_internal_table_access { public: diff --git a/storage/perfschema/pfs_events_waits.cc b/storage/perfschema/pfs_events_waits.cc index 22448af7c5f..aae8f9dc8c1 100644 --- a/storage/perfschema/pfs_events_waits.cc +++ b/storage/perfschema/pfs_events_waits.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_events_waits.cc diff --git a/storage/perfschema/pfs_events_waits.h b/storage/perfschema/pfs_events_waits.h index c677e83ad34..9a5ed8644f3 100644 --- a/storage/perfschema/pfs_events_waits.h +++ b/storage/perfschema/pfs_events_waits.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_EVENTS_WAITS_H #define PFS_EVENTS_WAITS_H diff --git a/storage/perfschema/pfs_global.cc b/storage/perfschema/pfs_global.cc index cac7d0b06e7..fa57f335325 100644 --- a/storage/perfschema/pfs_global.cc +++ b/storage/perfschema/pfs_global.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_global.cc @@ -26,6 +26,7 @@ #include bool pfs_initialized= false; +ulonglong pfs_allocated_memory= 0; /** Memory allocation for the performance schema. @@ -38,7 +39,9 @@ void *pfs_malloc(size_t size, myf flags) DBUG_ASSERT(size > 0); void *ptr= malloc(size); - if (ptr && (flags & MY_ZEROFILL)) + if (likely(ptr != NULL)) + pfs_allocated_memory+= size; + if (likely((ptr != NULL) && (flags & MY_ZEROFILL))) memset(ptr, 0, size); return ptr; } diff --git a/storage/perfschema/pfs_global.h b/storage/perfschema/pfs_global.h index 37809f8cc2e..6050612e24c 100644 --- a/storage/perfschema/pfs_global.h +++ b/storage/perfschema/pfs_global.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_GLOBAL_H #define PFS_GLOBAL_H @@ -22,6 +22,7 @@ */ extern bool pfs_initialized; +extern ulonglong pfs_allocated_memory; void *pfs_malloc(size_t size, myf flags); #define PFS_MALLOC_ARRAY(n, T, f) \ @@ -30,27 +31,50 @@ void pfs_free(void *ptr); inline uint randomized_index(const void *ptr, uint max_size) { + static uint seed1= 0; + static uint seed2= 0; + uint result; + register intptr value; + if (unlikely(max_size == 0)) return 0; /* - ptr is typically an aligned structure, - so the last bits are not really random, but this has no effect. - Apply a factor A*x to spread - close values of ptr further apart (which helps with arrays), - and to spread values way beyond a typical max_size. - Then, apply a modulo to end within [0, max_size - 1]. - A is big prime numbers, to avoid resonating with max_size, - to have a uniform distribution in [0, max_size - 1]. - The value of A is chosen so that index(ptr) and index(ptr + N) (for arrays) - are likely to be not similar for typical values of max_size - (50, 100, 1000, etc). - In other words, (sizeof(T)*A % max_size) should not be a small number, - to avoid that with 'T array[max_size]', index(array[i]) - and index(array[i + 1]) end up pointing in the same area in [0, max_size - 1]. + ptr is typically an aligned structure, and can be in an array. + - The last bits are not random because of alignment, + so we divide by 8. + - The high bits are mostly constant, especially with 64 bits architectures, + but we keep most of them anyway, by doing computation in intptr. + The high bits are significant depending on where the data is + stored (the data segment, the stack, the heap, ...). + - To spread consecutive cells in an array further, we multiply by + a factor A. This factor should not be too high, which would cause + an overflow and cause loss of randomness (droping the top high bits). + The factor is a prime number, to help spread the distribution. + - To add more noise, and to be more robust if the calling code is + passing a constant value instead of a random identity, + we add the previous results, for hysteresys, with a degree 2 polynom, + X^2 + X + 1. + - Last, a modulo is applied to be within the [0, max_size - 1] range. + Note that seed1 and seed2 are static, and are *not* thread safe, + which is even better. + Effect with arrays: T array[N] + - ptr(i) = & array[i] = & array[0] + i * sizeof(T) + - ptr(i+1) = ptr(i) + sizeof(T). + What we want here, is to have index(i) and index(i+1) fall into + very different areas in [0, max_size - 1], to avoid locality. */ - return static_cast - (((reinterpret_cast (ptr)) * 2166179) % max_size); + value= (reinterpret_cast (ptr)) >> 3; + value*= 1789; + value+= seed2 + seed1 + 1; + + result= (static_cast (value)) % max_size; + + seed2= seed1*seed1; + seed1= result; + + DBUG_ASSERT(result < max_size); + return result; } void pfs_print_error(const char *format, ...); diff --git a/storage/perfschema/pfs_instr.cc b/storage/perfschema/pfs_instr.cc index 9507e2d2582..0c7b25a03de 100644 --- a/storage/perfschema/pfs_instr.cc +++ b/storage/perfschema/pfs_instr.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_instr.cc @@ -21,8 +21,8 @@ #include #include "my_global.h" -#include "sql_priv.h" #include "my_sys.h" +#include "pfs.h" #include "pfs_stat.h" #include "pfs_instr.h" #include "pfs_global.h" @@ -411,6 +411,8 @@ void cleanup_instruments(void) thread_instr_class_waits_array= NULL; } +extern "C" +{ static uchar *filename_hash_get_key(const uchar *entry, size_t *length, my_bool) { @@ -425,6 +427,7 @@ static uchar *filename_hash_get_key(const uchar *entry, size_t *length, result= file->m_filename; return const_cast (reinterpret_cast (result)); } +} /** Initialize the file name hash. @@ -451,6 +454,75 @@ void cleanup_file_hash(void) } } +void PFS_scan::init(uint random, uint max_size) +{ + m_pass= 0; + + if (max_size == 0) + { + /* Degenerated case, no buffer */ + m_pass_max= 0; + return; + } + + DBUG_ASSERT(random < max_size); + + if (PFS_MAX_ALLOC_RETRY < max_size) + { + /* + The buffer is big compared to PFS_MAX_ALLOC_RETRY, + scan it only partially. + */ + if (random + PFS_MAX_ALLOC_RETRY < max_size) + { + /* + Pass 1: [random, random + PFS_MAX_ALLOC_RETRY - 1] + Pass 2: not used. + */ + m_pass_max= 1; + m_first[0]= random; + m_last[0]= random + PFS_MAX_ALLOC_RETRY; + m_first[1]= 0; + m_last[1]= 0; + } + else + { + /* + Pass 1: [random, max_size - 1] + Pass 2: [0, ...] + The combined length of pass 1 and 2 is PFS_MAX_ALLOC_RETRY. + */ + m_pass_max= 2; + m_first[0]= random; + m_last[0]= max_size; + m_first[1]= 0; + m_last[1]= PFS_MAX_ALLOC_RETRY - (max_size - random); + } + } + else + { + /* + The buffer is small compared to PFS_MAX_ALLOC_RETRY, + scan it in full in two passes. + Pass 1: [random, max_size - 1] + Pass 2: [0, random - 1] + */ + m_pass_max= 2; + m_first[0]= random; + m_last[0]= max_size; + m_first[1]= 0; + m_last[1]= random; + } + + DBUG_ASSERT(m_first[0] < max_size); + DBUG_ASSERT(m_first[1] < max_size); + DBUG_ASSERT(m_last[1] <= max_size); + DBUG_ASSERT(m_last[1] <= max_size); + /* The combined length of all passes should not exceed PFS_MAX_ALLOC_RETRY. */ + DBUG_ASSERT((m_last[0] - m_first[0]) + + (m_last[1] - m_first[1]) <= PFS_MAX_ALLOC_RETRY); +} + /** Create instrumentation for a mutex instance. @param klass the mutex class @@ -459,17 +531,15 @@ void cleanup_file_hash(void) */ PFS_mutex* create_mutex(PFS_mutex_class *klass, const void *identity) { - int pass; - uint i= randomized_index(identity, mutex_max); + PFS_scan scan; + uint random= randomized_index(identity, mutex_max); - /* - Pass 1: [random, mutex_max - 1] - Pass 2: [0, mutex_max - 1] - */ - for (pass= 1; pass <= 2; i=0, pass++) + for (scan.init(random, mutex_max); + scan.has_pass(); + scan.next_pass()) { - PFS_mutex *pfs= mutex_array + i; - PFS_mutex *pfs_last= mutex_array + mutex_max; + PFS_mutex *pfs= mutex_array + scan.first(); + PFS_mutex *pfs_last= mutex_array + scan.last(); for ( ; pfs < pfs_last; pfs++) { if (pfs->m_lock.is_free()) @@ -517,17 +587,15 @@ void destroy_mutex(PFS_mutex *pfs) */ PFS_rwlock* create_rwlock(PFS_rwlock_class *klass, const void *identity) { - int pass; - uint i= randomized_index(identity, rwlock_max); + PFS_scan scan; + uint random= randomized_index(identity, rwlock_max); - /* - Pass 1: [random, rwlock_max - 1] - Pass 2: [0, rwlock_max - 1] - */ - for (pass= 1; pass <= 2; i=0, pass++) + for (scan.init(random, rwlock_max); + scan.has_pass(); + scan.next_pass()) { - PFS_rwlock *pfs= rwlock_array + i; - PFS_rwlock *pfs_last= rwlock_array + rwlock_max; + PFS_rwlock *pfs= rwlock_array + scan.first(); + PFS_rwlock *pfs_last= rwlock_array + scan.last(); for ( ; pfs < pfs_last; pfs++) { if (pfs->m_lock.is_free()) @@ -581,17 +649,15 @@ void destroy_rwlock(PFS_rwlock *pfs) */ PFS_cond* create_cond(PFS_cond_class *klass, const void *identity) { - int pass; - uint i= randomized_index(identity, cond_max); + PFS_scan scan; + uint random= randomized_index(identity, cond_max); - /* - Pass 1: [random, cond_max - 1] - Pass 2: [0, cond_max - 1] - */ - for (pass= 1; pass <= 2; i=0, pass++) + for (scan.init(random, cond_max); + scan.has_pass(); + scan.next_pass()) { - PFS_cond *pfs= cond_array + i; - PFS_cond *pfs_last= cond_array + cond_max; + PFS_cond *pfs= cond_array + scan.first(); + PFS_cond *pfs_last= cond_array + scan.last(); for ( ; pfs < pfs_last; pfs++) { if (pfs->m_lock.is_free()) @@ -639,17 +705,15 @@ void destroy_cond(PFS_cond *pfs) PFS_thread* create_thread(PFS_thread_class *klass, const void *identity, ulong thread_id) { - int pass; - uint i= randomized_index(identity, thread_max); + PFS_scan scan; + uint random= randomized_index(identity, thread_max); - /* - Pass 1: [random, thread_max - 1] - Pass 2: [0, thread_max - 1] - */ - for (pass= 1; pass <= 2; i=0, pass++) + for (scan.init(random, thread_max); + scan.has_pass(); + scan.next_pass()) { - PFS_thread *pfs= thread_array + i; - PFS_thread *pfs_last= thread_array + thread_max; + PFS_thread *pfs= thread_array + scan.first(); + PFS_thread *pfs_last= thread_array + scan.last(); for ( ; pfs < pfs_last; pfs++) { if (pfs->m_lock.is_free()) @@ -733,7 +797,7 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass, const char *filename, uint len) { PFS_file *pfs; - int pass; + PFS_scan scan; if (! filename_hash_inited) { @@ -765,7 +829,7 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass, - it fits into pfs->m_filename - it is safe to use mysys apis to normalize the file name. */ - memcpy(safe_buffer, filename, FN_REFLEN - 2); + memcpy(safe_buffer, filename, FN_REFLEN - 1); safe_buffer[FN_REFLEN - 1]= 0; safe_filename= safe_buffer; } @@ -776,16 +840,58 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass, Normalize the file name to avoid duplicates when using aliases: - absolute or relative paths - symbolic links + Names are resolved as follows: + - /real/path/to/real_file ==> same + - /path/with/link/to/real_file ==> /real/path/to/real_file + - real_file ==> /real/path/to/real_file + - ./real_file ==> /real/path/to/real_file + - /real/path/to/sym_link ==> same + - /path/with/link/to/sym_link ==> /real/path/to/sym_link + - sym_link ==> /real/path/to/sym_link + - ./sym_link ==> /real/path/to/sym_link + When the last component of a file is a symbolic link, + the last component is *not* resolved, so that all file io + operations on a link (create, read, write, delete) are counted + against the link itself, not the target file. + Resolving the name would lead to create counted against the link, + and read/write/delete counted against the target, leading to + incoherent results and instrumentation leaks. + Also note that, when creating files, this name resolution + works properly for files that do not exist (yet) on the file system. */ char buffer[FN_REFLEN]; + char dirbuffer[FN_REFLEN]; + size_t dirlen; const char *normalized_filename; int normalized_length; - /* - Ignore errors, the file may not exist. - my_realpath always provide a best effort result in buffer. - */ - (void) my_realpath(buffer, safe_filename, MYF(0)); + dirlen= dirname_length(safe_filename); + if (dirlen == 0) + { + dirbuffer[0]= FN_CURLIB; + dirbuffer[1]= FN_LIBCHAR; + dirbuffer[2]= '\0'; + } + else + { + memcpy(dirbuffer, safe_filename, dirlen); + dirbuffer[dirlen]= '\0'; + } + + if (my_realpath(buffer, dirbuffer, MYF(0)) != 0) + { + file_lost++; + return NULL; + } + + /* Append the unresolved file name to the resolved path */ + char *ptr= buffer + strlen(buffer); + char *buf_end= &buffer[sizeof(buffer)-1]; + if (buf_end > ptr) + *ptr++= FN_LIBCHAR; + if (buf_end > ptr) + strncpy(ptr, safe_filename + dirlen, buf_end - ptr); + *buf_end= '\0'; normalized_filename= buffer; normalized_length= strlen(normalized_filename); @@ -806,17 +912,14 @@ search: } /* filename is not constant, just using it for noise on create */ - uint i= randomized_index(filename, file_max); + uint random= randomized_index(filename, file_max); - /* - Pass 1: [random, file_max - 1] - Pass 2: [0, file_max - 1] - */ - for (pass= 1; pass <= 2; i=0, pass++) + for (scan.init(random, file_max); + scan.has_pass(); + scan.next_pass()) { - pfs= file_array + i; - PFS_file *pfs_last= file_array + file_max; - + pfs= file_array + scan.first(); + PFS_file *pfs_last= file_array + scan.last(); for ( ; pfs < pfs_last; pfs++) { if (pfs->m_lock.is_free()) @@ -901,17 +1004,15 @@ void destroy_file(PFS_thread *thread, PFS_file *pfs) */ PFS_table* create_table(PFS_table_share *share, const void *identity) { - int pass; - uint i= randomized_index(identity, table_max); + PFS_scan scan; + uint random= randomized_index(identity, table_max); - /* - Pass 1: [random, table_max - 1] - Pass 2: [0, table_max - 1] - */ - for (pass= 1; pass <= 2; i=0, pass++) + for (scan.init(random, table_max); + scan.has_pass(); + scan.next_pass()) { - PFS_table *pfs= table_array + i; - PFS_table *pfs_last= table_array + table_max; + PFS_table *pfs= table_array + scan.first(); + PFS_table *pfs_last= table_array + scan.last(); for ( ; pfs < pfs_last; pfs++) { if (pfs->m_lock.is_free()) diff --git a/storage/perfschema/pfs_instr.h b/storage/perfschema/pfs_instr.h index a509d054d69..791e2cd1f8d 100644 --- a/storage/perfschema/pfs_instr.h +++ b/storage/perfschema/pfs_instr.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_INSTR_H #define PFS_INSTR_H @@ -21,7 +21,6 @@ Performance schema instruments (declarations). */ -#include #include "pfs_lock.h" #include "pfs_instr_class.h" #include "pfs_events_waits.h" @@ -136,6 +135,48 @@ struct PFS_table : public PFS_instr */ #define LOCKER_STACK_SIZE 3 +/** + @def PFS_MAX_ALLOC_RETRY + Maximum number of times the code attempts to allocate an item + from internal buffers, before giving up. +*/ +#define PFS_MAX_ALLOC_RETRY 1000 + +#define PFS_MAX_SCAN_PASS 2 + +/** + Helper to scan circular buffers. + Given a buffer of size [0, max_size - 1], + and a random starting point in the buffer, + this helper returns up to two [first, last -1] intervals that: + - fit into the [0, max_size - 1] range, + - have a maximum combined length of at most PFS_MAX_ALLOC_RETRY. +*/ +struct PFS_scan +{ +public: + void init(uint random, uint max_size); + + bool has_pass() const + { return (m_pass < m_pass_max); } + + void next_pass() + { m_pass++; } + + uint first() const + { return m_first[m_pass]; } + + uint last() const + { return m_last[m_pass]; } + +private: + uint m_pass; + uint m_pass_max; + uint m_first[PFS_MAX_SCAN_PASS]; + uint m_last[PFS_MAX_SCAN_PASS]; +}; + + /** Instrumented thread implementation. @see PSI_thread. */ struct PFS_thread { diff --git a/storage/perfschema/pfs_instr_class.cc b/storage/perfschema/pfs_instr_class.cc index d1535aa851b..48547f73628 100644 --- a/storage/perfschema/pfs_instr_class.cc +++ b/storage/perfschema/pfs_instr_class.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_instr_class.cc diff --git a/storage/perfschema/pfs_instr_class.h b/storage/perfschema/pfs_instr_class.h index fa82bceb0c1..bd6560dbb55 100644 --- a/storage/perfschema/pfs_instr_class.h +++ b/storage/perfschema/pfs_instr_class.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_INSTR_CLASS_H #define PFS_INSTR_CLASS_H @@ -38,7 +38,6 @@ */ #define PFS_MAX_FULL_PREFIX_NAME_LENGTH 32 -#include #include #include #include "pfs_lock.h" diff --git a/storage/perfschema/pfs_lock.h b/storage/perfschema/pfs_lock.h index 46d7d33617b..5c74d3944ba 100644 --- a/storage/perfschema/pfs_lock.h +++ b/storage/perfschema/pfs_lock.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_LOCK_H #define PFS_LOCK_H diff --git a/storage/perfschema/pfs_server.cc b/storage/perfschema/pfs_server.cc index f852a9fe732..0f322a9cb76 100644 --- a/storage/perfschema/pfs_server.cc +++ b/storage/perfschema/pfs_server.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_server.cc @@ -21,7 +21,6 @@ #include "my_global.h" #include "my_sys.h" #include "mysys_err.h" -#include "sql_priv.h" #include "pfs_server.h" #include "pfs.h" #include "pfs_global.h" diff --git a/storage/perfschema/pfs_server.h b/storage/perfschema/pfs_server.h index acf483e1f86..a7af27c1038 100644 --- a/storage/perfschema/pfs_server.h +++ b/storage/perfschema/pfs_server.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_SERVER_H #define PFS_SERVER_H diff --git a/storage/perfschema/pfs_stat.h b/storage/perfschema/pfs_stat.h index 654f292d82c..c78d5c83039 100644 --- a/storage/perfschema/pfs_stat.h +++ b/storage/perfschema/pfs_stat.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_STAT_H #define PFS_STAT_H diff --git a/storage/perfschema/pfs_timer.cc b/storage/perfschema/pfs_timer.cc index 65883b62c32..f30a9f8e865 100644 --- a/storage/perfschema/pfs_timer.cc +++ b/storage/perfschema/pfs_timer.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_timer.cc diff --git a/storage/perfschema/pfs_timer.h b/storage/perfschema/pfs_timer.h index beba263f45a..cd2a8df9be3 100644 --- a/storage/perfschema/pfs_timer.h +++ b/storage/perfschema/pfs_timer.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_TIMER_H #define PFS_TIMER_H diff --git a/storage/perfschema/plug.in b/storage/perfschema/plug.in index e6539dc1260..36a1c1e8bda 100644 --- a/storage/perfschema/plug.in +++ b/storage/perfschema/plug.in @@ -1,6 +1,6 @@ dnl -*- ksh -*- -# Copyright (C) 2008-2009 Sun Microsystems, Inc +# Copyright (c) 2008, 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 @@ -12,8 +12,8 @@ dnl -*- ksh -*- # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA dnl This file is part of the configure scripts used by autoconf. diff --git a/storage/perfschema/table_all_instr.cc b/storage/perfschema/table_all_instr.cc index ffbe31bbadd..f29a006107a 100644 --- a/storage/perfschema/table_all_instr.cc +++ b/storage/perfschema/table_all_instr.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,22 +10,21 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_all_instr.cc Abstract tables for all instruments (implementation). */ -#include "sql_priv.h" #include "my_global.h" #include "my_pthread.h" #include "table_all_instr.h" #include "pfs_global.h" table_all_instr::table_all_instr(const PFS_engine_table_share *share) - : PFS_readonly_table(share, &m_pos), + : PFS_engine_table(share, &m_pos), m_pos(), m_next_pos() {} @@ -154,7 +153,7 @@ int table_all_instr::rnd_pos(const void *pos) table_all_instr_class::table_all_instr_class (const PFS_engine_table_share *share) - : PFS_readonly_table(share, &m_pos), + : PFS_engine_table(share, &m_pos), m_pos(), m_next_pos() {} diff --git a/storage/perfschema/table_all_instr.h b/storage/perfschema/table_all_instr.h index a8767695602..6e404659030 100644 --- a/storage/perfschema/table_all_instr.h +++ b/storage/perfschema/table_all_instr.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_ALL_INSTR_H #define TABLE_ALL_INSTR_H @@ -63,7 +63,7 @@ struct pos_all_instr_class : public PFS_double_index, - a view on all cond classes, - a view on all file classes */ -class table_all_instr_class : public PFS_readonly_table +class table_all_instr_class : public PFS_engine_table { public: virtual int rnd_next(); @@ -122,7 +122,7 @@ struct pos_all_instr : public PFS_double_index, - a view on all cond instances, - a view on all file instances */ -class table_all_instr : public PFS_readonly_table +class table_all_instr : public PFS_engine_table { public: virtual int rnd_next(); diff --git a/storage/perfschema/table_events_waits.cc b/storage/perfschema/table_events_waits.cc index cb565373bd8..a09d7f1ba30 100644 --- a/storage/perfschema/table_events_waits.cc +++ b/storage/perfschema/table_events_waits.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,15 +10,16 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_events_waits.cc Table EVENTS_WAITS_xxx (implementation). */ -#include "sql_priv.h" +#include "my_global.h" +#include "my_pthread.h" #include "table_events_waits.h" #include "pfs_instr_class.h" #include "pfs_instr.h" @@ -165,7 +166,7 @@ table_events_waits_history_long::m_share= table_events_waits_common::table_events_waits_common (const PFS_engine_table_share *share, void *pos) - : PFS_readonly_table(share, pos), + : PFS_engine_table(share, pos), m_row_exists(false) {} diff --git a/storage/perfschema/table_events_waits.h b/storage/perfschema/table_events_waits.h index 5aa16cc0cab..2aa88b54be4 100644 --- a/storage/perfschema/table_events_waits.h +++ b/storage/perfschema/table_events_waits.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_EVENTS_WAITS_H #define TABLE_EVENTS_WAITS_H @@ -121,7 +121,7 @@ struct pos_events_waits_history : public PFS_double_index Adapter, for table sharing the structure of PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT. */ -class table_events_waits_common : public PFS_readonly_table +class table_events_waits_common : public PFS_engine_table { protected: virtual int read_row_values(TABLE *table, diff --git a/storage/perfschema/table_events_waits_summary.cc b/storage/perfschema/table_events_waits_summary.cc index 0eca9f6722e..9d0d6fe0f67 100644 --- a/storage/perfschema/table_events_waits_summary.cc +++ b/storage/perfschema/table_events_waits_summary.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,16 +10,16 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_events_waits_summary.cc Table EVENTS_WAITS_SUMMARY_BY_xxx (implementation). */ -#include "sql_priv.h" -#include "unireg.h" +#include "my_global.h" +#include "my_pthread.h" #include "pfs_instr_class.h" #include "pfs_column_types.h" #include "pfs_column_values.h" @@ -101,7 +101,7 @@ table_events_waits_summary_by_thread_by_event_name::delete_all_rows(void) table_events_waits_summary_by_thread_by_event_name ::table_events_waits_summary_by_thread_by_event_name() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(), m_next_pos() {} diff --git a/storage/perfschema/table_events_waits_summary.h b/storage/perfschema/table_events_waits_summary.h index 28c820e5c81..47ec9523d68 100644 --- a/storage/perfschema/table_events_waits_summary.h +++ b/storage/perfschema/table_events_waits_summary.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_EVENTS_WAITS_SUMMARY_H #define TABLE_EVENTS_WAITS_SUMMARY_H @@ -96,7 +96,7 @@ struct pos_events_waits_summary_by_thread_by_event_name /** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME. */ class table_events_waits_summary_by_thread_by_event_name - : public PFS_readonly_table + : public PFS_engine_table { public: /** Table share */ diff --git a/storage/perfschema/table_file_instances.cc b/storage/perfschema/table_file_instances.cc index 3de5cbe4b47..f1676421616 100644 --- a/storage/perfschema/table_file_instances.cc +++ b/storage/perfschema/table_file_instances.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,16 +10,16 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_file_instances.cc Table FILE_INSTANCES (implementation). */ -#include "sql_priv.h" -#include "unireg.h" +#include "my_global.h" +#include "my_pthread.h" #include "pfs_instr.h" #include "pfs_column_types.h" #include "pfs_column_values.h" @@ -72,7 +72,7 @@ PFS_engine_table* table_file_instances::create(void) } table_file_instances::table_file_instances() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(0), m_next_pos(0) {} diff --git a/storage/perfschema/table_file_instances.h b/storage/perfschema/table_file_instances.h index fb5298f37b3..7365000b21f 100644 --- a/storage/perfschema/table_file_instances.h +++ b/storage/perfschema/table_file_instances.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_FILE_INSTANCES_H #define TABLE_FILE_INSTANCES_H @@ -45,7 +45,7 @@ struct row_file_instances }; /** Table PERFORMANCE_SCHEMA.FILE_INSTANCES. */ -class table_file_instances : public PFS_readonly_table +class table_file_instances : public PFS_engine_table { public: /** Table share */ diff --git a/storage/perfschema/table_file_summary.cc b/storage/perfschema/table_file_summary.cc index 16942e73916..f8b9e66118b 100644 --- a/storage/perfschema/table_file_summary.cc +++ b/storage/perfschema/table_file_summary.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,16 +10,16 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_file_summary.cc Table FILE_SUMMARY_BY_xxx (implementation). */ -#include "sql_priv.h" -#include "unireg.h" +#include "my_global.h" +#include "my_pthread.h" #include "pfs_instr_class.h" #include "pfs_column_types.h" #include "pfs_column_values.h" @@ -88,7 +88,7 @@ int table_file_summary_by_event_name::delete_all_rows(void) } table_file_summary_by_event_name::table_file_summary_by_event_name() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_pos(1), m_next_pos(1) {} @@ -251,7 +251,7 @@ int table_file_summary_by_instance::delete_all_rows(void) } table_file_summary_by_instance::table_file_summary_by_instance() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(0), m_next_pos(0) {} diff --git a/storage/perfschema/table_file_summary.h b/storage/perfschema/table_file_summary.h index e962292a725..92837189f1f 100644 --- a/storage/perfschema/table_file_summary.h +++ b/storage/perfschema/table_file_summary.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_FILE_SUMMARY_H #define TABLE_FILE_SUMMARY_H @@ -46,7 +46,7 @@ struct row_file_summary_by_event_name }; /** Table PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_EVENT_NAME. */ -class table_file_summary_by_event_name : public PFS_readonly_table +class table_file_summary_by_event_name : public PFS_engine_table { public: /** Table share */ @@ -105,7 +105,7 @@ struct row_file_summary_by_instance }; /** Table PERFORMANCE_SCHEMA.FILE_UMMARY_BY_INSTANCE. */ -class table_file_summary_by_instance : public PFS_readonly_table +class table_file_summary_by_instance : public PFS_engine_table { public: /** Table share */ diff --git a/storage/perfschema/table_performance_timers.cc b/storage/perfschema/table_performance_timers.cc index 7a20e7e18e0..f400e37366c 100644 --- a/storage/perfschema/table_performance_timers.cc +++ b/storage/perfschema/table_performance_timers.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,16 +10,16 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_performance_timers.cc Table PERFORMANCE_TIMERS (implementation). */ -#include "sql_priv.h" #include "my_global.h" +#include "my_pthread.h" #include "table_performance_timers.h" #include "pfs_timer.h" #include "pfs_global.h" @@ -76,7 +76,7 @@ PFS_engine_table* table_performance_timers::create(void) } table_performance_timers::table_performance_timers() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row(NULL), m_pos(0), m_next_pos(0) { int index; diff --git a/storage/perfschema/table_performance_timers.h b/storage/perfschema/table_performance_timers.h index 0818a0af2fe..dbd47665ff6 100644 --- a/storage/perfschema/table_performance_timers.h +++ b/storage/perfschema/table_performance_timers.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_PERFORMANCE_TIMERS_H #define TABLE_PERFORMANCE_TIMERS_H @@ -43,7 +43,7 @@ struct row_performance_timers }; /** Table PERFORMANCE_SCHEMA.PERFORMANCE_TIMERS. */ -class table_performance_timers : public PFS_readonly_table +class table_performance_timers : public PFS_engine_table { public: /** Table share. */ diff --git a/storage/perfschema/table_processlist.cc b/storage/perfschema/table_processlist.cc index 7518882ccea..06c628c5f80 100644 --- a/storage/perfschema/table_processlist.cc +++ b/storage/perfschema/table_processlist.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,15 +10,16 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_processlist.cc Table PROCESSLIST (implementation). */ -#include "sql_priv.h" +#include "my_global.h" +#include "my_pthread.h" #include "table_processlist.h" #include "pfs_instr_class.h" #include "pfs_instr.h" @@ -69,7 +70,7 @@ PFS_engine_table* table_processlist::create(void) } table_processlist::table_processlist() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(0), m_next_pos(0) {} diff --git a/storage/perfschema/table_processlist.h b/storage/perfschema/table_processlist.h index 2c6d5160f41..d4fe5e4af1a 100644 --- a/storage/perfschema/table_processlist.h +++ b/storage/perfschema/table_processlist.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_PROCESSIST_H #define TABLE_PROCESSIST_H @@ -45,7 +45,7 @@ struct row_processlist }; /** Table PERFORMANCE_SCHEMA.PROCESSLIST. */ -class table_processlist : public PFS_readonly_table +class table_processlist : public PFS_engine_table { public: /** Table share. */ diff --git a/storage/perfschema/table_setup_consumers.cc b/storage/perfschema/table_setup_consumers.cc index ff74e7d3f28..3cc6a1441c1 100644 --- a/storage/perfschema/table_setup_consumers.cc +++ b/storage/perfschema/table_setup_consumers.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,15 +10,16 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_setup_consumers.cc Table SETUP_CONSUMERS (implementation). */ -#include "sql_priv.h" +#include "my_global.h" +#include "my_pthread.h" #include "table_setup_consumers.h" #include "pfs_instr.h" #include "pfs_events_waits.h" diff --git a/storage/perfschema/table_setup_consumers.h b/storage/perfschema/table_setup_consumers.h index f54f69fcef5..4d007645db2 100644 --- a/storage/perfschema/table_setup_consumers.h +++ b/storage/perfschema/table_setup_consumers.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_SETUP_CONSUMERS_H #define TABLE_SETUP_CONSUMERS_H diff --git a/storage/perfschema/table_setup_instruments.cc b/storage/perfschema/table_setup_instruments.cc index 095299c4b69..259ccee3c84 100644 --- a/storage/perfschema/table_setup_instruments.cc +++ b/storage/perfschema/table_setup_instruments.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,16 +10,16 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_setup_instruments.cc Table SETUP_INSTRUMENTS (implementation). */ -#include "sql_priv.h" -#include "unireg.h" +#include "my_global.h" +#include "my_pthread.h" #include "pfs_instr_class.h" #include "pfs_column_types.h" #include "pfs_column_values.h" diff --git a/storage/perfschema/table_setup_instruments.h b/storage/perfschema/table_setup_instruments.h index 549fe4fa5f9..b9df2dd3e0b 100644 --- a/storage/perfschema/table_setup_instruments.h +++ b/storage/perfschema/table_setup_instruments.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_SETUP_INSTRUMENTS_H #define TABLE_SETUP_INSTRUMENTS_H diff --git a/storage/perfschema/table_setup_timers.cc b/storage/perfschema/table_setup_timers.cc index 98e27808e0a..8ca218913bb 100644 --- a/storage/perfschema/table_setup_timers.cc +++ b/storage/perfschema/table_setup_timers.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,15 +10,16 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_setup_timers.cc Table SETUP_TIMERS (implementation). */ -#include "sql_priv.h" +#include "my_global.h" +#include "my_pthread.h" #include "table_setup_timers.h" #include "pfs_column_values.h" #include "pfs_timer.h" diff --git a/storage/perfschema/table_setup_timers.h b/storage/perfschema/table_setup_timers.h index 96af76ae05c..a81e6fefaaf 100644 --- a/storage/perfschema/table_setup_timers.h +++ b/storage/perfschema/table_setup_timers.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_SETUP_TIMERS_H #define TABLE_SETUP_TIMERS_H diff --git a/storage/perfschema/table_sync_instances.cc b/storage/perfschema/table_sync_instances.cc index c76c62cc9fd..82587ce493d 100644 --- a/storage/perfschema/table_sync_instances.cc +++ b/storage/perfschema/table_sync_instances.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_sync_instances.cc @@ -19,8 +19,8 @@ and COND_INSTANCES (implementation). */ -#include "sql_priv.h" -#include "unireg.h" +#include "my_global.h" +#include "my_pthread.h" #include "pfs_instr.h" #include "pfs_column_types.h" #include "pfs_column_values.h" @@ -73,7 +73,7 @@ PFS_engine_table* table_mutex_instances::create(void) } table_mutex_instances::table_mutex_instances() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(0), m_next_pos(0) {} @@ -241,7 +241,7 @@ PFS_engine_table* table_rwlock_instances::create(void) } table_rwlock_instances::table_rwlock_instances() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(0), m_next_pos(0) {} @@ -406,7 +406,7 @@ PFS_engine_table* table_cond_instances::create(void) } table_cond_instances::table_cond_instances() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(0), m_next_pos(0) {} diff --git a/storage/perfschema/table_sync_instances.h b/storage/perfschema/table_sync_instances.h index a8a9cdaa071..3c359852338 100644 --- a/storage/perfschema/table_sync_instances.h +++ b/storage/perfschema/table_sync_instances.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_SYNC_INSTANCE_H #define TABLE_SYNC_INSTANCE_H @@ -49,7 +49,7 @@ struct row_mutex_instances }; /** Table PERFORMANCE_SCHEMA.MUTEX_INSTANCES. */ -class table_mutex_instances : public PFS_readonly_table +class table_mutex_instances : public PFS_engine_table { public: /** Table share. */ @@ -108,7 +108,7 @@ struct row_rwlock_instances }; /** Table PERFORMANCE_SCHEMA.RWLOCK_INSTANCES. */ -class table_rwlock_instances : public PFS_readonly_table +class table_rwlock_instances : public PFS_engine_table { public: /** Table share */ @@ -161,7 +161,7 @@ struct row_cond_instances }; /** Table PERFORMANCE_SCHEMA.COND_INSTANCES. */ -class table_cond_instances : public PFS_readonly_table +class table_cond_instances : public PFS_engine_table { public: /** Table share. */ diff --git a/storage/perfschema/unittest/CMakeLists.txt b/storage/perfschema/unittest/CMakeLists.txt index 8a72b25b5b7..501cf82d23a 100644 --- a/storage/perfschema/unittest/CMakeLists.txt +++ b/storage/perfschema/unittest/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# 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 @@ -10,8 +10,8 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/include/mysql diff --git a/storage/perfschema/unittest/conf.txt b/storage/perfschema/unittest/conf.txt index a3bee9c3be5..8afd0b4dca7 100644 --- a/storage/perfschema/unittest/conf.txt +++ b/storage/perfschema/unittest/conf.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# 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 @@ -10,8 +10,8 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA Performance schema test configurations. (Used internally for performance testing) diff --git a/storage/perfschema/unittest/pfs-t.cc b/storage/perfschema/unittest/pfs-t.cc index 2f3fb2792fc..c51f358c4d8 100644 --- a/storage/perfschema/unittest/pfs-t.cc +++ b/storage/perfschema/unittest/pfs-t.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,12 +10,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#include -#include #include +#include #include #include #include @@ -941,9 +940,13 @@ void test_locker_disabled() ok(file_A1 != NULL, "instrumented"); PSI_mutex_locker *mutex_locker; + PSI_mutex_locker_state mutex_state; PSI_rwlock_locker *rwlock_locker; + PSI_rwlock_locker_state rwlock_state; PSI_cond_locker *cond_locker; + PSI_cond_locker_state cond_state; PSI_file_locker *file_locker; + PSI_file_locker_state file_state; /* Pretend thread T-1 is disabled */ /* ------------------------------ */ @@ -955,17 +958,17 @@ void test_locker_disabled() cond_class_A->m_enabled= true; file_class_A->m_enabled= true; - mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK); ok(mutex_locker == NULL, "no locker"); - rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK); ok(rwlock_locker == NULL, "no locker"); - cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT); ok(cond_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); /* Pretend the consumer is disabled */ @@ -978,17 +981,17 @@ void test_locker_disabled() cond_class_A->m_enabled= true; file_class_A->m_enabled= true; - mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK); ok(mutex_locker == NULL, "no locker"); - rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK); ok(rwlock_locker == NULL, "no locker"); - cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT); ok(cond_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); /* Pretend the instrument is disabled */ @@ -1001,17 +1004,17 @@ void test_locker_disabled() cond_class_A->m_enabled= false; file_class_A->m_enabled= false; - mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK); ok(mutex_locker == NULL, "no locker"); - rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK); ok(rwlock_locker == NULL, "no locker"); - cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT); ok(cond_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); /* Pretend everything is enabled */ @@ -1024,27 +1027,27 @@ void test_locker_disabled() cond_class_A->m_enabled= true; file_class_A->m_enabled= true; - mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK); ok(mutex_locker != NULL, "locker"); psi->start_mutex_wait(mutex_locker, __FILE__, __LINE__); psi->end_mutex_wait(mutex_locker, 0); - rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK); ok(rwlock_locker != NULL, "locker"); psi->start_rwlock_rdwait(rwlock_locker, __FILE__, __LINE__); psi->end_rwlock_rdwait(rwlock_locker, 0); - cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT); ok(cond_locker != NULL, "locker"); psi->start_cond_wait(cond_locker, __FILE__, __LINE__); psi->end_cond_wait(cond_locker, 0); - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL); ok(file_locker != NULL, "locker"); psi->start_file_open_wait(file_locker, __FILE__, __LINE__); psi->end_file_open_wait(file_locker); - file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ); ok(file_locker != NULL, "locker"); psi->start_file_wait(file_locker, 10, __FILE__, __LINE__); psi->end_file_wait(file_locker, 10); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker != NULL, "locker"); psi->start_file_wait(file_locker, 10, __FILE__, __LINE__); psi->end_file_wait(file_locker, 10); @@ -1059,17 +1062,17 @@ void test_locker_disabled() cond_class_A->m_enabled= true; file_class_A->m_enabled= true; - mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK); ok(mutex_locker == NULL, "no locker"); - rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK); ok(rwlock_locker == NULL, "no locker"); - cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT); ok(cond_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); shutdown_performance_schema(); @@ -1102,6 +1105,7 @@ void test_file_instrumentation_leak() PFS_file_class *file_class_A; PFS_file_class *file_class_B; + PSI_file_locker_state file_state; PSI_thread *thread_1; /* Preparation */ @@ -1130,24 +1134,24 @@ void test_file_instrumentation_leak() /* Simulate OPEN + READ of 100 bytes + CLOSE on descriptor 12 */ - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "AAA", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "AAA", NULL); ok(file_locker != NULL, "locker"); psi->start_file_open_wait(file_locker, __FILE__, __LINE__); psi->end_file_open_wait_and_bind_to_descriptor(file_locker, 12); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker != NULL, "locker"); psi->start_file_wait(file_locker, 100, __FILE__, __LINE__); psi->end_file_wait(file_locker, 100); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_CLOSE); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_CLOSE); ok(file_locker != NULL, "locker"); psi->start_file_wait(file_locker, 0, __FILE__, __LINE__); psi->end_file_wait(file_locker, 0); /* Simulate uninstrumented-OPEN + WRITE on descriptor 24 */ - file_locker= psi->get_thread_file_descriptor_locker((File) 24, PSI_FILE_WRITE); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 24, PSI_FILE_WRITE); ok(file_locker == NULL, "no locker, since the open was not instrumented"); /* @@ -1155,7 +1159,7 @@ void test_file_instrumentation_leak() the instrumentation should not leak (don't charge the file io on unknown B to "AAA") */ - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_WRITE); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_WRITE); ok(file_locker == NULL, "no locker, no leak"); shutdown_performance_schema(); diff --git a/storage/perfschema/unittest/pfs_instr-oom-t.cc b/storage/perfschema/unittest/pfs_instr-oom-t.cc index 7b3df877133..9a3b179aa56 100644 --- a/storage/perfschema/unittest/pfs_instr-oom-t.cc +++ b/storage/perfschema/unittest/pfs_instr-oom-t.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,12 +10,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#include -#include #include +#include #include #include #include diff --git a/storage/perfschema/unittest/pfs_instr-t.cc b/storage/perfschema/unittest/pfs_instr-t.cc index 157031cb234..7dcc8cec7f8 100644 --- a/storage/perfschema/unittest/pfs_instr-t.cc +++ b/storage/perfschema/unittest/pfs_instr-t.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,12 +10,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#include -#include #include +#include #include #include #include diff --git a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc index 064c8c062a4..20fa0f3e6ff 100644 --- a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc +++ b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,12 +10,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#include -#include #include +#include #include #include #include diff --git a/storage/perfschema/unittest/pfs_instr_class-t.cc b/storage/perfschema/unittest/pfs_instr_class-t.cc index c8dce2fd7fb..c5a199727d5 100644 --- a/storage/perfschema/unittest/pfs_instr_class-t.cc +++ b/storage/perfschema/unittest/pfs_instr_class-t.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,13 +10,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#include #include -#include - +#include #include // strncpy #include #include diff --git a/storage/perfschema/unittest/pfs_timer-t.cc b/storage/perfschema/unittest/pfs_timer-t.cc index 46efe3fd7b1..d8663c5ccda 100644 --- a/storage/perfschema/unittest/pfs_timer-t.cc +++ b/storage/perfschema/unittest/pfs_timer-t.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,11 +10,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#include #include +#include #include #include "my_sys.h" #include diff --git a/storage/perfschema/unittest/stub_pfs_global.h b/storage/perfschema/unittest/stub_pfs_global.h index 85088061d3f..300d3cb6fa0 100644 --- a/storage/perfschema/unittest/stub_pfs_global.h +++ b/storage/perfschema/unittest/stub_pfs_global.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #include #include diff --git a/storage/perfschema/unittest/stub_print_error.h b/storage/perfschema/unittest/stub_print_error.h index 12dabb46ceb..caad24e5257 100644 --- a/storage/perfschema/unittest/stub_print_error.h +++ b/storage/perfschema/unittest/stub_print_error.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 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 @@ -10,8 +10,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #include #include diff --git a/strings/CMakeLists.txt b/strings/CMakeLists.txt old mode 100755 new mode 100644 index bb32f0d3f84..abc03302b64 --- a/strings/CMakeLists.txt +++ b/strings/CMakeLists.txt @@ -15,7 +15,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) -SET(STRINGS_SOURCES bchange.c bcmp.c bfill.c bmove512.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c +SET(STRINGS_SOURCES bchange.c bfill.c bmove512.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c ctype-czech.c ctype-euc_kr.c ctype-eucjpms.c ctype-extra.c ctype-gb2312.c ctype-gbk.c ctype-latin1.c ctype-mb.c ctype-simple.c ctype-sjis.c ctype-tis620.c ctype-uca.c ctype-ucs2.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype.c decimal.c dtoa.c int2str.c diff --git a/strings/Makefile.am b/strings/Makefile.am index 9b32f42c49a..fd884a1296a 100644 --- a/strings/Makefile.am +++ b/strings/Makefile.am @@ -30,19 +30,19 @@ pkglib_LIBRARIES = libmystrings.a # Exact one of ASSEMBLER_X if ASSEMBLER_x86 ASRCS = strings-x86.s longlong2str-x86.s my_strtoll10-x86.s -CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c str_alloc.c longlong2str_asm.c my_strchr.c dtoa.c strmov.c +CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c str_alloc.c longlong2str_asm.c my_strchr.c dtoa.c strmov.c else if ASSEMBLER_sparc32 # These file MUST all be on the same line!! Otherwise automake # generats a very broken makefile ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s -CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c dtoa.c strmov.c +CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c dtoa.c strmov.c else #no assembler ASRCS = # These file MUST all be on the same line!! Otherwise automake # generats a very broken makefile -CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c dtoa.c +CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c dtoa.c endif endif @@ -66,7 +66,7 @@ EXTRA_DIST = ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc CHARSET_INFO.txt libmystrings_a_LIBADD= -conf_to_src_SOURCES = conf_to_src.c xml.c ctype.c bcmp.c +conf_to_src_SOURCES = conf_to_src.c xml.c ctype.c conf_to_src_LDADD= #force static linking of conf_to_src - essential when linking against #custom installation of libc diff --git a/strings/bcmp.c b/strings/bcmp.c deleted file mode 100644 index 1b6ed22fc22..00000000000 --- a/strings/bcmp.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (C) 2000 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* - bcmp(s1, s2, len) returns 0 if the "len" bytes starting at "s1" are - identical to the "len" bytes starting at "s2", non-zero if they are - different. - Now only used with purify because purify gives wrong warnings when - comparing a shorter string with bcmp. -*/ - -#include -#include "m_string.h" - -#ifdef HAVE_purify -#undef bcmp -#undef HAVE_BCMP -#endif - -#if !defined(bcmp) && !defined(HAVE_BCMP) - -#if defined(MC68000) && defined(DS90) - -int bcmp(s1,s2, len) -const char *s1; -const char *s2; -uint len; /* 0 <= len <= 65535 */ -{ - asm(" movl 12(a7),d0 "); - asm(" subqw #1,d0 "); - asm(" blt .L5 "); - asm(" movl 4(a7),a1 "); - asm(" movl 8(a7),a0 "); - asm(".L4: cmpmb (a0)+,(a1)+ "); - asm(" dbne d0,.L4 "); - asm(".L5: addqw #1,d0 "); -} - -#else - -#ifndef HAVE_purify -size_t bcmp(register const uchar *s1,register const uchar *s2, - register size_t len) -#else -size_t my_bcmp(register const uchar *s1,register const uchar *s2, - register size_t len) -#endif -{ - while (len-- != 0 && *s1++ == *s2++) ; - return len+1; -} - -#endif -#endif /* BSD_FUNCS */ diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index 966acdfa8f0..f5221bb3a21 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -47,7 +47,7 @@ #define big5head(e) ((uchar)(e>>8)) #define big5tail(e) ((uchar)(e&0xff)) -static uchar NEAR ctype_big5[257] = +static uchar ctype_big5[257] = { 0, /* For standard library */ 32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32, @@ -68,7 +68,7 @@ static uchar NEAR ctype_big5[257] = 3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0, }; -static uchar NEAR to_lower_big5[]= +static uchar to_lower_big5[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -104,7 +104,7 @@ static uchar NEAR to_lower_big5[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; -static uchar NEAR to_upper_big5[]= +static uchar to_upper_big5[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -140,7 +140,7 @@ static uchar NEAR to_upper_big5[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; -static uchar NEAR sort_order_big5[]= +static uchar sort_order_big5[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c index 2e405eeaf06..67555ac4384 100644 --- a/strings/ctype-cp932.c +++ b/strings/ctype-cp932.c @@ -31,7 +31,7 @@ * .configure. mbmaxlen_cp932=2 */ -static uchar NEAR ctype_cp932[257] = +static uchar ctype_cp932[257] = { 0, /* For standard library */ 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */ @@ -68,7 +68,7 @@ static uchar NEAR ctype_cp932[257] = 0020, 0020, 0020, 0020, 0020, 0000, 0000, 0000 }; -static uchar NEAR to_lower_cp932[]= +static uchar to_lower_cp932[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -104,7 +104,7 @@ static uchar NEAR to_lower_cp932[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' }; -static uchar NEAR to_upper_cp932[]= +static uchar to_upper_cp932[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -140,7 +140,7 @@ static uchar NEAR to_upper_cp932[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' }; -static uchar NEAR sort_order_cp932[]= +static uchar sort_order_cp932[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c index a5df86cc6b3..0095fe7f995 100644 --- a/strings/ctype-czech.c +++ b/strings/ctype-czech.c @@ -430,7 +430,7 @@ static my_bool my_like_range_czech(CHARSET_INFO *cs __attribute__((unused)), #include #include "m_string.h" -static uchar NEAR ctype_czech[257] = { +static uchar ctype_czech[257] = { 0, 32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, @@ -450,7 +450,7 @@ static uchar NEAR ctype_czech[257] = { 2, 2, 2, 2, 2, 2, 2, 16, 2, 2, 2, 2, 2, 2, 2, 16, }; -static uchar NEAR to_lower_czech[] = { +static uchar to_lower_czech[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, @@ -469,7 +469,7 @@ static uchar NEAR to_lower_czech[] = { 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255, }; -static uchar NEAR to_upper_czech[] = { +static uchar to_upper_czech[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, @@ -488,7 +488,7 @@ static uchar NEAR to_upper_czech[] = { 240,209,210,211,212,213,214,247,216,217,218,219,220,221,222,255, }; -static uchar NEAR sort_order_czech[] = { +static uchar sort_order_czech[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index 154d49ed085..c2067ac6f6b 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -32,7 +32,7 @@ #ifdef HAVE_CHARSET_euckr -static uchar NEAR ctype_euc_kr[257] = +static uchar ctype_euc_kr[257] = { 0, /* For standard library */ 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */ @@ -69,7 +69,7 @@ static uchar NEAR ctype_euc_kr[257] = 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0000, }; -static uchar NEAR to_lower_euc_kr[]= +static uchar to_lower_euc_kr[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -105,7 +105,7 @@ static uchar NEAR to_lower_euc_kr[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; -static uchar NEAR to_upper_euc_kr[]= +static uchar to_upper_euc_kr[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -141,7 +141,7 @@ static uchar NEAR to_upper_euc_kr[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; -static uchar NEAR sort_order_euc_kr[]= +static uchar sort_order_euc_kr[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', diff --git a/strings/ctype-eucjpms.c b/strings/ctype-eucjpms.c index 0a7f6be71cc..25c15a08d4e 100644 --- a/strings/ctype-eucjpms.c +++ b/strings/ctype-eucjpms.c @@ -33,7 +33,7 @@ ctype-ujis.c file. #ifdef HAVE_CHARSET_eucjpms -static uchar NEAR ctype_eucjpms[257] = +static uchar ctype_eucjpms[257] = { 0, /* For standard library */ 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */ @@ -70,7 +70,7 @@ static uchar NEAR ctype_eucjpms[257] = 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0000, }; -static uchar NEAR to_lower_eucjpms[]= +static uchar to_lower_eucjpms[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -106,7 +106,7 @@ static uchar NEAR to_lower_eucjpms[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' }; -static uchar NEAR to_upper_eucjpms[]= +static uchar to_upper_eucjpms[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -142,7 +142,7 @@ static uchar NEAR to_upper_eucjpms[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' }; -static uchar NEAR sort_order_eucjpms[]= +static uchar sort_order_eucjpms[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c index c3a52047977..46f3e9c6da5 100644 --- a/strings/ctype-gb2312.c +++ b/strings/ctype-gb2312.c @@ -29,7 +29,7 @@ #ifdef HAVE_CHARSET_gb2312 -static uchar NEAR ctype_gb2312[257] = +static uchar ctype_gb2312[257] = { 0, /* For standard library */ 32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32, @@ -50,7 +50,7 @@ static uchar NEAR ctype_gb2312[257] = 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0, }; -static uchar NEAR to_lower_gb2312[]= +static uchar to_lower_gb2312[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -86,7 +86,7 @@ static uchar NEAR to_lower_gb2312[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; -static uchar NEAR to_upper_gb2312[]= +static uchar to_upper_gb2312[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -122,7 +122,7 @@ static uchar NEAR to_upper_gb2312[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; -static uchar NEAR sort_order_gb2312[]= +static uchar sort_order_gb2312[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index 52a8d994fa4..609bc2ecd27 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -44,7 +44,7 @@ #define gbkhead(e) ((uchar)(e>>8)) #define gbktail(e) ((uchar)(e&0xff)) -static uchar NEAR ctype_gbk[257] = +static uchar ctype_gbk[257] = { 0, /* For standard library */ 32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32, @@ -65,7 +65,7 @@ static uchar NEAR ctype_gbk[257] = 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0, }; -static uchar NEAR to_lower_gbk[]= +static uchar to_lower_gbk[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -101,7 +101,7 @@ static uchar NEAR to_lower_gbk[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; -static uchar NEAR to_upper_gbk[]= +static uchar to_upper_gbk[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -995,7 +995,7 @@ static MY_UNICASE_INFO *my_caseinfo_gbk[256]= -static uchar NEAR sort_order_gbk[]= +static uchar sort_order_gbk[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -1031,7 +1031,7 @@ static uchar NEAR sort_order_gbk[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; -static uint16 NEAR gbk_order[]= +static uint16 gbk_order[]= { 8653,14277,17116,11482,11160,2751,14613,3913,13337,9827, 19496,1759,8105,7103,7836,5638,2223,21433,5878,8006, diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index 6ff8c83dcf7..8a3d3d7425c 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -1385,19 +1385,6 @@ int my_mb_ctype_8bit(CHARSET_INFO *cs, int *ctype, } -#undef ULONGLONG_MAX -/* - Needed under MetroWerks Compiler, since MetroWerks compiler does not - properly handle a constant expression containing a mod operator -*/ -#if defined(__NETWARE__) && defined(__MWERKS__) -static ulonglong ulonglong_max= ~(ulonglong) 0; -#define ULONGLONG_MAX ulonglong_max -#else -#define ULONGLONG_MAX (~(ulonglong) 0) -#endif /* __NETWARE__ && __MWERKS__ */ - - #define CUTOFF (ULONGLONG_MAX / 10) #define CUTLIM (ULONGLONG_MAX % 10) #define DIGITS_IN_ULONGLONG 20 diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index 4face391f5e..90c76dc3c79 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -31,7 +31,7 @@ * .configure. mbmaxlen_sjis=2 */ -static uchar NEAR ctype_sjis[257] = +static uchar ctype_sjis[257] = { 0, /* For standard library */ 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */ @@ -68,7 +68,7 @@ static uchar NEAR ctype_sjis[257] = 0020, 0020, 0020, 0020, 0020, 0000, 0000, 0000 }; -static uchar NEAR to_lower_sjis[]= +static uchar to_lower_sjis[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -104,7 +104,7 @@ static uchar NEAR to_lower_sjis[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' }; -static uchar NEAR to_upper_sjis[]= +static uchar to_upper_sjis[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -140,7 +140,7 @@ static uchar NEAR to_upper_sjis[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' }; -static uchar NEAR sort_order_sjis[]= +static uchar sort_order_sjis[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index a8c05dc4fd0..14b661ab0fc 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -323,7 +323,7 @@ static int t_ctype[][TOT_LEVELS] = { /*0xFF*/ { 255 /*IGNORE*/, IGNORE, IGNORE, IGNORE, X }, }; -static uchar NEAR ctype_tis620[257] = +static uchar ctype_tis620[257] = { 0, /* For standard library */ 32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32, @@ -344,7 +344,7 @@ static uchar NEAR ctype_tis620[257] = 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; -static uchar NEAR to_lower_tis620[]= +static uchar to_lower_tis620[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -380,7 +380,7 @@ static uchar NEAR to_lower_tis620[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; -static uchar NEAR to_upper_tis620[]= +static uchar to_upper_tis620[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -416,7 +416,7 @@ static uchar NEAR to_upper_tis620[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; -static uchar NEAR sort_order_tis620[]= +static uchar sort_order_tis620[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index 0ea4a2617cb..4fabbdbaeb3 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -32,7 +32,7 @@ #ifdef HAVE_CHARSET_ujis -static uchar NEAR ctype_ujis[257] = +static uchar ctype_ujis[257] = { 0, /* For standard library */ 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */ @@ -69,7 +69,7 @@ static uchar NEAR ctype_ujis[257] = 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0000, }; -static uchar NEAR to_lower_ujis[]= +static uchar to_lower_ujis[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -105,7 +105,7 @@ static uchar NEAR to_lower_ujis[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' }; -static uchar NEAR to_upper_ujis[]= +static uchar to_upper_ujis[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', @@ -141,7 +141,7 @@ static uchar NEAR to_upper_ujis[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' }; -static uchar NEAR sort_order_ujis[]= +static uchar sort_order_ujis[]= { '\000','\001','\002','\003','\004','\005','\006','\007', '\010','\011','\012','\013','\014','\015','\016','\017', diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c index b22b4364e8a..d9d092beb8f 100644 --- a/strings/ctype-win1250ch.c +++ b/strings/ctype-win1250ch.c @@ -152,7 +152,7 @@ static MY_UNI_IDX idx_uni_cp1250[]={ }; -static uchar NEAR ctype_win1250ch[] = { +static uchar ctype_win1250ch[] = { 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x28, 0x28, 0x28, 0x28, 0x20, 0x20, @@ -188,7 +188,7 @@ static uchar NEAR ctype_win1250ch[] = { 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x10 }; -static uchar NEAR to_lower_win1250ch[] = { +static uchar to_lower_win1250ch[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, @@ -223,7 +223,7 @@ static uchar NEAR to_lower_win1250ch[] = { 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }; -static uchar NEAR to_upper_win1250ch[] = { +static uchar to_upper_win1250ch[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, @@ -260,7 +260,7 @@ static uchar NEAR to_upper_win1250ch[] = { -static uchar NEAR sort_order_win1250ch[] = { +static uchar sort_order_win1250ch[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, @@ -279,7 +279,7 @@ static uchar NEAR sort_order_win1250ch[] = { 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 }; -static uchar NEAR _sort_order_win1250ch1[] = { +static uchar _sort_order_win1250ch1[] = { 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, @@ -339,7 +339,7 @@ static uchar NEAR _sort_order_win1250ch1[] = { 0xb8, 0xbd, 0xbd, 0xbd, 0xbd, 0xc1, 0xbc, 0xf5 }; -static uchar NEAR _sort_order_win1250ch2[] = { +static uchar _sort_order_win1250ch2[] = { 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, @@ -513,7 +513,7 @@ static size_t my_strnxfrm_win1250ch(CHARSET_INFO * cs __attribute__((unused)), #ifdef REAL_MYSQL -static uchar NEAR like_range_prefix_min_win1250ch[]= +static uchar like_range_prefix_min_win1250ch[]= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, @@ -557,7 +557,7 @@ static uchar NEAR like_range_prefix_min_win1250ch[]= For all other characters: prefix_max[i] == i */ -static uchar NEAR like_range_prefix_max_win1250ch[]= +static uchar like_range_prefix_max_win1250ch[]= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, diff --git a/strings/do_ctype.c b/strings/do_ctype.c index f33ddc5eb81..d038d313a98 100644 --- a/strings/do_ctype.c +++ b/strings/do_ctype.c @@ -25,8 +25,8 @@ #include #include "m_string.h" -uchar NEAR to_upper[256]; -uchar NEAR to_lower[256],NEAR sort_order[256]; +uchar to_upper[256]; +uchar to_lower[256], sort_order[256]; static int ascii_output=1; static string tab_names[]={ "to_lower[]={","to_upper[]={","sort_order[]={" }; @@ -47,7 +47,7 @@ char *argv[]; puts("Tabells for caseconverts and sorttest of characters\n"); for (i=0 ; i < 3 ; i++) { - printf("uchar NEAR %s\n",tab_names[i]); + printf("uchar %s\n",tab_names[i]); for (j=0 ; j <= 255 ; j++) { ch=(int) tabell[i][j]; @@ -140,10 +140,6 @@ void init_case_convert() to_upper[i]= sort_order[i]= to_lower[i]= (char) i; #endif -#ifdef MSDOS - higher_pos= (uchar *) "\217\216\231\232\220"; /* Extra chars to konv. */ - lower_pos= (uchar *) "\206\204\224\201\202"; -#else #if defined(HPUX10) && ASCII_BITS_USED == 8 higher_pos= (uchar *) "\xd0\xd8\xda\xdb\xdc\xd3"; lower_pos= (uchar *) "\xd4\xcc\xce\xdf\xc9\xd7"; @@ -160,7 +156,6 @@ void init_case_convert() #endif #endif /* USE_INTERNAL_CTYPE */ #endif /* HPUX10 */ -#endif /* MSDOS */ while (*higher_pos) { @@ -171,10 +166,6 @@ void init_case_convert() /* sets upp sortorder; higer_pos character (upper and lower) is */ /* changed to lower_pos character */ -#ifdef MSDOS - higher_pos= (uchar *) "\217\216\231\232\220"; - lower_pos= (uchar *) "\216\217\231YE"; -#else #if defined(HPUX10) && ASCII_BITS_USED == 8 higher_pos= lower_pos= (uchar *) ""; /* Tecknen i r{tt ordning */ #else @@ -186,7 +177,6 @@ void init_case_convert() lower_pos= (uchar *) "[\\]YE"; /* Ordning enligt ascii */ #endif /* USE_ISO_8859_1 */ #endif /* HPUX10 */ -#endif /* MSDOS */ while (*higher_pos) { diff --git a/strings/int2str.c b/strings/int2str.c index fba98aac3f1..ecc214d58d5 100644 --- a/strings/int2str.c +++ b/strings/int2str.c @@ -19,9 +19,9 @@ /* _dig_vec arrays are public because they are used in several outer places. */ -char NEAR _dig_vec_upper[] = +char _dig_vec_upper[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; -char NEAR _dig_vec_lower[] = +char _dig_vec_lower[] = "0123456789abcdefghijklmnopqrstuvwxyz"; diff --git a/strings/my_strtoll10.c b/strings/my_strtoll10.c index 4f73b1f8e71..b9fc4b4be8e 100644 --- a/strings/my_strtoll10.c +++ b/strings/my_strtoll10.c @@ -17,17 +17,6 @@ #include /* Needed for MY_ERRNO_ERANGE */ #include -#undef ULONGLONG_MAX -/* - Needed under MetroWerks Compiler, since MetroWerks compiler does not - properly handle a constant expression containing a mod operator -*/ -#if defined(__NETWARE__) && defined(__MWERKS__) -static ulonglong ulonglong_max= ~(ulonglong) 0; -#define ULONGLONG_MAX ulonglong_max -#else -#define ULONGLONG_MAX (~(ulonglong) 0) -#endif /* __NETWARE__ && __MWERKS__ */ #define MAX_NEGATIVE_NUMBER ((ulonglong) LL(0x8000000000000000)) #define INIT_CNT 9 #define LFACTOR ULL(1000000000) diff --git a/strings/str_test.c b/strings/str_test.c index e4358196f27..0814647472c 100644 --- a/strings/str_test.c +++ b/strings/str_test.c @@ -50,10 +50,10 @@ int main(void) errors=tests=0; init_strings(); - test_arg("bcmp(from,to,5)",(long) my_test(bcmp(from,to,5)),1L); - test_arg("bcmp(from,from,5)",(long) bcmp(from,from,5),0L); + test_arg("memcmp(from,to,5)",(long) my_test(memcmp(from,to,5)),1L); + test_arg("memcmp(from,from,5)",(long) memcmp(from,from,5),0L); - test_arg("bcmp(from,to,0)",(long) bcmp(from,to,0),0L); + test_arg("memcmp(from,to,0)",(long) memcmp(from,to,0),0L); test_arg("strend(from)",(long) strend(from),(long) from+F_LEN); test_arg("strchr(v1,'M')",(long) strchr(v1,'M'),(long) v1); test_arg("strchr(v1,'y')",(long) strchr(v1,'y'),(long) v1+4); @@ -93,7 +93,7 @@ int main(void) test_strarg("bmove_upp(to+6,from+6,3)",(bmove_upp(to+6,from+6,3),0L),INT_MAX32, 3,T_CHAR,3,F_CHAR,0,0); test_strarg("bmove_upp(to,from,0)",(bmove_upp(to,from,0),0L),INT_MAX32,0,0); - test_strarg("bmove_align(to,from,8)",(bmove_align(to,from,8),0L),INT_MAX32, + test_strarg("memcpy(to,from,8)",(memcpy(to,from,8),0L),INT_MAX32, 8,F_CHAR,0,0); test_strarg("strappend(to,3,' ')",(strappend(to,3,' '),0L),INT_MAX32, 3,T_CHAR,1,0,T_LEN-4,T_CHAR,1,0,0,0); @@ -233,7 +233,7 @@ int compare_buff(const char *message, char * b1, char * b2, int length, { int i,error=0; - if (bcmp(b1,b2,length)) + if (memcmp(b1,b2,length)) { errors++; printf("func: '%s' Buffers differ\nIs: ",message); diff --git a/strings/strtol.c b/strings/strtol.c index 42476b0226a..2f0a5286ee9 100644 --- a/strings/strtol.c +++ b/strings/strtol.c @@ -23,6 +23,6 @@ #include #include -#if !defined(MSDOS) && !defined(HAVE_STRTOL) && !defined(__WIN__) +#if !defined(HAVE_STRTOL) && !defined(__WIN__) #include "strto.c" #endif diff --git a/strings/strtoul.c b/strings/strtoul.c index 3e2b51bc982..df5c46c220f 100644 --- a/strings/strtoul.c +++ b/strings/strtoul.c @@ -23,7 +23,7 @@ #include #include -#if !defined(MSDOS) && !defined(HAVE_STRTOUL) +#if !defined(HAVE_STRTOUL) #define USE_UNSIGNED #include "strto.c" #endif diff --git a/strings/xml.c b/strings/xml.c index 1b697ec6b26..f3cfaad54fa 100644 --- a/strings/xml.c +++ b/strings/xml.c @@ -123,16 +123,16 @@ static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a) a->beg=p->cur; a->end=p->cur; - if ((p->end - p->cur > 3) && !bcmp(p->cur,"", 3); p->cur++) + for (; (p->cur < p->end) && memcmp(p->cur, "-->", 3); p->cur++) {} - if (!bcmp(p->cur, "-->", 3)) + if (!memcmp(p->cur, "-->", 3)) p->cur+=3; a->end=p->cur; lex=MY_XML_COMMENT; } - else if (!bcmp(p->cur, "cur, "cur+= 9; for (; p->cur < p->end - 2 ; p->cur++) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 1fd2c45cb63..a3640077889 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -2270,7 +2270,7 @@ static void test_prepare() /* now, execute the prepared statement to insert 10 records.. */ for (tiny_data= 0; tiny_data < 100; tiny_data++) { - length[1]= my_sprintf(str_data, (str_data, "MySQL%d", int_data)); + length[1]= sprintf(str_data, "MySQL%d", int_data); rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); int_data += 25; @@ -2309,7 +2309,7 @@ static void test_prepare() /* now, execute the prepared statement to insert 10 records.. */ for (o_tiny_data= 0; o_tiny_data < 100; o_tiny_data++) { - len= my_sprintf(data, (data, "MySQL%d", o_int_data)); + len= sprintf(data, "MySQL%d", o_int_data); rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); @@ -3675,7 +3675,7 @@ static void test_simple_update() my_bind[0].buffer= szData; /* string data */ my_bind[0].buffer_length= sizeof(szData); my_bind[0].length= &length[0]; - length[0]= my_sprintf(szData, (szData, "updated-data")); + length[0]= sprintf(szData, "updated-data"); my_bind[1].buffer= (void *) &nData; my_bind[1].buffer_type= MYSQL_TYPE_LONG; @@ -3871,7 +3871,7 @@ static void test_long_data_str() DIE_UNLESS(rc == 1); mysql_free_result(result); - my_sprintf(data, (data, "%d", i*5)); + sprintf(data, "%d", i*5); verify_col_data("test_long_data_str", "LENGTH(longstr)", data); data[0]= '\0'; while (i--) @@ -3929,7 +3929,7 @@ static void test_long_data_str1() rc= mysql_stmt_bind_param(stmt, my_bind); check_execute(stmt, rc); - length= my_sprintf(data, (data, "MySQL AB")); + length= sprintf(data, "MySQL AB"); /* supply data in pieces */ for (i= 0; i < 3; i++) @@ -3969,10 +3969,10 @@ static void test_long_data_str1() DIE_UNLESS(rc == 1); mysql_free_result(result); - my_sprintf(data, (data, "%ld", (long)i*length)); + sprintf(data, "%ld", (long)i*length); verify_col_data("test_long_data_str", "length(longstr)", data); - my_sprintf(data, (data, "%d", i*2)); + sprintf(data, "%d", i*2); verify_col_data("test_long_data_str", "length(blb)", data); /* Test length of field->max_length */ @@ -4244,7 +4244,7 @@ static void test_update() my_bind[0].buffer= szData; my_bind[0].buffer_length= sizeof(szData); my_bind[0].length= &length[0]; - length[0]= my_sprintf(szData, (szData, "inserted-data")); + length[0]= sprintf(szData, "inserted-data"); my_bind[1].buffer= (void *)&nData; my_bind[1].buffer_type= MYSQL_TYPE_LONG; @@ -4273,7 +4273,7 @@ static void test_update() my_bind[0].buffer= szData; my_bind[0].buffer_length= sizeof(szData); my_bind[0].length= &length[0]; - length[0]= my_sprintf(szData, (szData, "updated-data")); + length[0]= sprintf(szData, "updated-data"); my_bind[1].buffer= (void *)&nData; my_bind[1].buffer_type= MYSQL_TYPE_LONG; @@ -4842,7 +4842,7 @@ static void bind_fetch(int row_count) /* CHAR */ { char buff[20]; - long len= my_sprintf(buff, (buff, "%d", rc)); + long len= sprintf(buff, "%d", rc); DIE_UNLESS(strcmp(s_data, buff) == 0); DIE_UNLESS(length[6] == (ulong) len); } @@ -5435,7 +5435,7 @@ static void test_insert() /* now, execute the prepared statement to insert 10 records.. */ for (tiny_data= 0; tiny_data < 3; tiny_data++) { - length= my_sprintf(str_data, (str_data, "MySQL%d", tiny_data)); + length= sprintf(str_data, "MySQL%d", tiny_data); rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); } @@ -18097,7 +18097,7 @@ static void test_wl4166_1() /* now, execute the prepared statement to insert 10 records.. */ for (tiny_data= 0; tiny_data < 10; tiny_data++) { - length[1]= my_sprintf(str_data, (str_data, "MySQL%d", int_data)); + length[1]= sprintf(str_data, "MySQL%d", int_data); rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); int_data += 25; @@ -18120,7 +18120,7 @@ static void test_wl4166_1() for (tiny_data= 50; tiny_data < 60; tiny_data++) { - length[1]= my_sprintf(str_data, (str_data, "MySQL%d", int_data)); + length[1]= sprintf(str_data, "MySQL%d", int_data); rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); int_data += 25; @@ -19060,6 +19060,63 @@ static void test_bug42373() } +/** + Bug#54041: MySQL 5.0.92 fails when tests from Connector/C suite run +*/ + +static void test_bug54041() +{ + int rc; + MYSQL_STMT *stmt; + MYSQL_BIND bind; + + DBUG_ENTER("test_bug54041"); + myheader("test_bug54041"); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); + myquery(rc); + + rc= mysql_query(mysql, "CREATE TABLE t1 (a INT)"); + myquery(rc); + + stmt= mysql_simple_prepare(mysql, "INSERT INTO t1 (a) VALUES (?)"); + check_stmt(stmt); + verify_param_count(stmt, 1); + + memset(&bind, 0, sizeof(bind)); + + /* Any type that does not support long data handling. */ + bind.buffer_type= MYSQL_TYPE_LONG; + + rc= mysql_stmt_bind_param(stmt, &bind); + check_execute(stmt, rc); + + /* + Trick the client API into sending a long data packet for + the parameter. Long data is only supported for string and + binary types. + */ + stmt->params[0].buffer_type= MYSQL_TYPE_STRING; + + rc= mysql_stmt_send_long_data(stmt, 0, "data", 5); + check_execute(stmt, rc); + + /* Undo API violation. */ + stmt->params[0].buffer_type= MYSQL_TYPE_LONG; + + rc= mysql_stmt_execute(stmt); + /* Incorrect arguments. */ + check_execute_r(stmt, rc); + + mysql_stmt_close(stmt); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); + myquery(rc); + + DBUG_VOID_RETURN; +} + + /* Bug#49972: Crash in prepared statements. @@ -19500,6 +19557,7 @@ static struct my_tests_st my_tests[]= { { "test_bug44495", test_bug44495 }, { "test_bug49972", test_bug49972 }, { "test_bug42373", test_bug42373 }, + { "test_bug54041", test_bug54041 }, { 0, 0 } }; diff --git a/vio/CMakeLists.txt b/vio/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/vio/test-ssl.c b/vio/test-ssl.c index 25a394a1ce0..1e846727d00 100644 --- a/vio/test-ssl.c +++ b/vio/test-ssl.c @@ -14,7 +14,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include -#if defined(HAVE_OPENSSL) && !defined(__NETWARE__) +#if defined(HAVE_OPENSSL) #include #include #include diff --git a/vio/viossl.c b/vio/viossl.c index 0651fd8b7a3..79f358b047c 100644 --- a/vio/viossl.c +++ b/vio/viossl.c @@ -24,36 +24,6 @@ #ifdef HAVE_OPENSSL -#ifdef __NETWARE__ - -/* yaSSL already uses BSD sockets */ -#ifndef HAVE_YASSL - -/* - The default OpenSSL implementation on NetWare uses WinSock. - This code allows us to use the BSD sockets. -*/ - -static int SSL_set_fd_bsd(SSL *s, int fd) -{ - int result= -1; - BIO_METHOD *BIO_s_bsdsocket(); - BIO *bio; - - if ((bio= BIO_new(BIO_s_bsdsocket()))) - { - result= BIO_set_fd(bio, fd, BIO_NOCLOSE); - SSL_set_bio(s, bio, bio); - } - return result; -} - -#define SSL_set_fd(A, B) SSL_set_fd_bsd((A), (B)) - -#endif /* HAVE_YASSL */ -#endif /* __NETWARE__ */ - - static void report_errors(SSL* ssl) { diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c index 2a38bbdfd57..4971dec37fb 100644 --- a/vio/viosslfactories.c +++ b/vio/viosslfactories.c @@ -143,36 +143,6 @@ vio_set_cert_stuff(SSL_CTX *ctx, const char *cert_file, const char *key_file, } -#ifdef __NETWARE__ - -/* NetWare SSL cleanup */ -void netware_ssl_cleanup() -{ - /* free memory from SSL_library_init() */ - EVP_cleanup(); - -/* OpenSSL NetWare port specific functions */ -#ifndef HAVE_YASSL - - /* free global X509 method */ - X509_STORE_method_cleanup(); - - /* free the thread_hash error table */ - ERR_free_state_table(); -#endif -} - - -/* NetWare SSL initialization */ -static void netware_ssl_init() -{ - /* cleanup OpenSSL library */ - NXVmRegisterExitHandler(netware_ssl_cleanup, NULL); -} - -#endif /* __NETWARE__ */ - - static void check_ssl_init() { if (!ssl_algorithms_added) @@ -183,10 +153,6 @@ static void check_ssl_init() } -#ifdef __NETWARE__ - netware_ssl_init(); -#endif - if (!ssl_error_strings_loaded) { ssl_error_strings_loaded= TRUE; diff --git a/win/mysql_manifest.cmake b/win/mysql_manifest.cmake old mode 100755 new mode 100644 diff --git a/zlib/CMakeLists.txt b/zlib/CMakeLists.txt old mode 100755 new mode 100644