From 6f80e0697dc84b102ac5f940d6ca711c532d95c1 Mon Sep 17 00:00:00 2001 From: Magne Mahre Date: Sun, 14 Feb 2010 19:12:58 +0100 Subject: [PATCH 01/24] Bug#48929 Error in Accept() if using many file descriptors In POSIX systems, the file descriptor set used in the select(2) system call is represented by a bit vector of size FD_SETSIZE. When select(2) is used on file/socket descriptors with a value that is beyond this size, unpredictable errors may occur. In this case, the error happens when there are a large number of tables that need repair. These tables are opened before the sockets for incoming connections are acquired, resulting in these sockets getting descriptor id which is higher than FD_SETSIZE. Replacing the call to select(2) with poll(2) fixes the problem, as poll takes an array of the wanted descriptors, instead of a bit vector. MS Windows has a different implementation of 'select', and is not affected by this bug. --- configure.in | 2 +- sql/mysqld.cc | 64 +++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 55 insertions(+), 11 deletions(-) diff --git a/configure.in b/configure.in index 9361052e2d9..9776fc12fe6 100644 --- a/configure.in +++ b/configure.in @@ -839,7 +839,7 @@ AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h fenv.h float.h floatingpoint.h ieeefp.h limits.h \ - memory.h pwd.h select.h \ + memory.h pwd.h select.h poll.h \ stdlib.h stddef.h \ strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \ sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 983f1750a38..5a88ad1970a 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -52,6 +52,10 @@ #include "sp_rcontext.h" #include "sp_cache.h" +#ifdef HAVE_POLL_H +#include +#endif + #define mysqld_charset &my_charset_latin1 /* stack traces are only supported on linux intel */ @@ -5343,26 +5347,47 @@ void handle_connections_sockets() { my_socket sock,new_sock; uint error_count=0; - uint max_used_connection= (uint) (max(ip_sock,unix_sock)+1); - fd_set readFDs,clientFDs; THD *thd; struct sockaddr_storage cAddr; - int ip_flags=0,socket_flags=0,flags; + int ip_flags=0,socket_flags=0,flags,retval; st_vio *vio_tmp; +#ifdef HAVE_POLL + int socket_count= 0; + struct pollfd fds[2]; // for ip_sock and unix_sock +#else + fd_set readFDs,clientFDs; + uint max_used_connection= (uint) (max(ip_sock,unix_sock)+1); +#endif + DBUG_ENTER("handle_connections_sockets"); LINT_INIT(new_sock); +#ifndef HAVE_POLL FD_ZERO(&clientFDs); +#endif + if (ip_sock != INVALID_SOCKET) { +#ifdef HAVE_POLL + fds[socket_count].fd= ip_sock; + fds[socket_count].events= POLLIN; + socket_count++; +#else FD_SET(ip_sock,&clientFDs); +#endif #ifdef HAVE_FCNTL ip_flags = fcntl(ip_sock, F_GETFL, 0); #endif } #ifdef HAVE_SYS_UN_H +#ifdef HAVE_POLL + fds[socket_count].fd= unix_sock; + fds[socket_count].events= POLLIN; + socket_count++; +#else FD_SET(unix_sock,&clientFDs); +#endif #ifdef HAVE_FCNTL socket_flags=fcntl(unix_sock, F_GETFL, 0); #endif @@ -5372,12 +5397,15 @@ void handle_connections_sockets() MAYBE_BROKEN_SYSCALL; while (!abort_loop) { - readFDs=clientFDs; -#ifdef HPUX10 - if (select(max_used_connection,(int*) &readFDs,0,0,0) < 0) - continue; +#ifdef HAVE_POLL + retval= poll(fds, socket_count, -1); #else - if (select((int) max_used_connection,&readFDs,0,0,0) < 0) + readFDs=clientFDs; + + retval= select((int) max_used_connection,&readFDs,0,0,0); +#endif + + if (retval < 0) { if (socket_errno != SOCKET_EINTR) { @@ -5387,7 +5415,7 @@ void handle_connections_sockets() MAYBE_BROKEN_SYSCALL continue; } -#endif /* HPUX10 */ + if (abort_loop) { MAYBE_BROKEN_SYSCALL; @@ -5395,6 +5423,21 @@ void handle_connections_sockets() } /* Is this a new connection request ? */ +#ifdef HAVE_POLL + for (int i= 0; i < socket_count; ++i) + { + if (fds[i].revents & POLLIN) + { + sock= fds[i].fd; +#ifdef HAVE_FCNTL + flags= fcntl(sock, F_GETFL, 0); +#else + flags= 0; +#endif // HAVE_FCNTL + break; + } + } +#else // HAVE_POLL #ifdef HAVE_SYS_UN_H if (FD_ISSET(unix_sock,&readFDs)) { @@ -5402,11 +5445,12 @@ void handle_connections_sockets() flags= socket_flags; } else -#endif +#endif // HAVE_SYS_UN_H { sock = ip_sock; flags= ip_flags; } +#endif // HAVE_POLL #if !defined(NO_FCNTL_NONBLOCK) if (!(test_flags & TEST_BLOCKING)) From ed76c63c30815f9812eca6ed0ac2266151106cf4 Mon Sep 17 00:00:00 2001 From: Serge Kozlov Date: Tue, 16 Feb 2010 22:34:34 +0300 Subject: [PATCH 02/24] Bug#48308. 1. Now test use fake_relay_log primitive 2. Added RESET SLAVE to include/setup_fake_relay_log.inc for removing relay log info file 3. Added RESET SLAVE to include/cleanup_fake_relay_log.inc 4. Test moved to rpl suite as rpl_binlog_auto_inc_bug33029.test 5. Updated result file --- mysql-test/include/cleanup_fake_relay_log.inc | 4 + mysql-test/include/setup_fake_relay_log.inc | 28 +++---- .../t/binlog_auto_increment_bug33029.test | 74 ------------------- .../r/rpl_binlog_auto_inc_bug33029.result} | 9 +-- .../rpl_binlog_auto_inc_bug33029-master.opt} | 0 .../rpl/t/rpl_binlog_auto_inc_bug33029.test | 42 +++++++++++ 6 files changed, 58 insertions(+), 99 deletions(-) delete mode 100644 mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test rename mysql-test/suite/{binlog/r/binlog_auto_increment_bug33029.result => rpl/r/rpl_binlog_auto_inc_bug33029.result} (61%) rename mysql-test/suite/{binlog/t/binlog_auto_increment_bug33029-master.opt => rpl/t/rpl_binlog_auto_inc_bug33029-master.opt} (100%) create mode 100644 mysql-test/suite/rpl/t/rpl_binlog_auto_inc_bug33029.test diff --git a/mysql-test/include/cleanup_fake_relay_log.inc b/mysql-test/include/cleanup_fake_relay_log.inc index 43aa46cb657..000c80f3761 100644 --- a/mysql-test/include/cleanup_fake_relay_log.inc +++ b/mysql-test/include/cleanup_fake_relay_log.inc @@ -12,5 +12,9 @@ remove_file $_fake_relay_log; remove_file $_fake_relay_index; --disable_query_log +--disable_warnings +STOP SLAVE SQL_THREAD; +RESET SLAVE; eval SET @@global.relay_log_purge= $_fake_relay_log_purge; +--enable_warnings --enable_query_log diff --git a/mysql-test/include/setup_fake_relay_log.inc b/mysql-test/include/setup_fake_relay_log.inc index 9510a557159..86a5da328af 100644 --- a/mysql-test/include/setup_fake_relay_log.inc +++ b/mysql-test/include/setup_fake_relay_log.inc @@ -66,8 +66,16 @@ let $_fake_relay_index= $MYSQLD_DATADIR/$_fake_filename.index; # CHANGE MASTER modifies it (see the manual for CHANGE MASTER). let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`; +# Reset slave and remove relay log and index files if they exist +RESET SLAVE; +error 0,1; +remove_file $MYSQLD_DATADIR/$_fake_filename.000001; +error 0,1; +remove_file $MYSQLD_DATADIR/$_fake_filename.index; + # Create relay log file. copy_file $fake_relay_log $_fake_relay_log; + # Create relay log index. # After patch for BUG#12190, the filename used in CHANGE MASTER @@ -77,28 +85,12 @@ copy_file $fake_relay_log $_fake_relay_log; if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") = 0`) { - -- let $_index_entry= ./$_fake_filename-fake.000001 + eval select './$_fake_filename-fake.000001\n' into dumpfile '$_fake_relay_index'; } if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") != 0`) { - -- let $_index_entry= .\\\\$_fake_filename-fake.000001 -} - -if (`SELECT LENGTH(@@secure_file_priv) > 0`) -{ - -- let $_file_priv_dir= `SELECT @@secure_file_priv`; - -- let $_suffix= `SELECT UUID()` - -- let $_tmp_file= $_file_priv_dir/fake-index.$_suffix - - -- eval select '$_index_entry\n' into dumpfile '$_tmp_file' - -- copy_file $_tmp_file $_fake_relay_index - -- remove_file $_tmp_file -} - -if (`SELECT LENGTH(@@secure_file_priv) = 0`) -{ - -- eval select '$_index_entry\n' into dumpfile '$_fake_relay_index' + eval select '.\\\\$_fake_filename-fake.000001\n' into dumpfile '$_fake_relay_index'; } # Setup replication from existing relay log. diff --git a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test deleted file mode 100644 index 19137066429..00000000000 --- a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test +++ /dev/null @@ -1,74 +0,0 @@ -# BUG#33029 5.0 to 5.1 replication fails on dup key when inserting -# using a trig in SP - -# For all 5.0 up to 5.0.58 exclusive, and 5.1 up to 5.1.12 exclusive, -# if one statement in a SP generated AUTO_INCREMENT value by the top -# statement, all statements after it would be considered generated -# AUTO_INCREMENT value by the top statement, and a erroneous INSERT_ID -# value might be associated with these statement, which could cause -# duplicate entry error and stop the slave. - -# Test if the slave can replicate from such a buggy master - -# The bug33029-slave-relay-bin.000001 file is the -# slave-replay-bin.000003 file generated by run the -# rpl_auto_increment_bug33029.test with clean up statements at the end -# of the test case removed on a buggy 5.0 server - -source include/have_log_bin.inc; - -# Need to restore this at the end; CHANGE MASTER modifies it (see the -# manual for CHANGE MASTER). -SET @old_relay_log_purge= @@global.relay_log_purge; - -let $MYSQLD_DATADIR= `select @@datadir`; - -copy_file $MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001 $MYSQLD_DATADIR/slave-relay-bin.000001; - - -# After patch for BUG#12190, the filename used in CHANGE MASTER -# RELAY_LOG_FILE will be automatically added the directory of the -# relay log before comparison, thus we need to added the directory -# part (./ on unix .\ on windows) when faking the relay-log-bin.index. -disable_query_log; -if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") = 0`) -{ - eval select './slave-relay-bin.000001\n' into dumpfile '$MYSQLD_DATADIR/slave-relay-bin.index'; -} - -if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") != 0`) -{ - eval select '.\\\\slave-relay-bin.000001\n' into dumpfile '$MYSQLD_DATADIR/slave-relay-bin.index'; -} -enable_query_log; - -change master to - MASTER_HOST='dummy.localdomain', - RELAY_LOG_FILE='slave-relay-bin.000001', - RELAY_LOG_POS=4; - -start slave sql_thread; -disable_result_log; -select MASTER_POS_WAIT('master-bin.000001', 3776); -enable_result_log; - -echo # Result on slave; -SELECT * FROM t1; -SELECT * FROM t2; - -# clean up -disable_warnings; -DROP TABLE IF EXISTS t1, t2; -DROP PROCEDURE IF EXISTS p1; -DROP PROCEDURE IF EXISTS p2; -DROP FUNCTION IF EXISTS f1; -DROP TRIGGER IF EXISTS tr1; -enable_warnings; - -stop slave sql_thread; -reset slave; -source include/wait_for_slave_sql_to_stop.inc; -remove_file $MYSQLD_DATADIR/slave-relay-bin.000001; -remove_file $MYSQLD_DATADIR/slave-relay-bin.index; - -SET @@global.relay_log_purge= @old_relay_log_purge; diff --git a/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result b/mysql-test/suite/rpl/r/rpl_binlog_auto_inc_bug33029.result similarity index 61% rename from mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result rename to mysql-test/suite/rpl/r/rpl_binlog_auto_inc_bug33029.result index 8226469fcf7..f0fdd5eaa1f 100644 --- a/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result +++ b/mysql-test/suite/rpl/r/rpl_binlog_auto_inc_bug33029.result @@ -1,8 +1,4 @@ -SET @old_relay_log_purge= @@global.relay_log_purge; -change master to -MASTER_HOST='dummy.localdomain', -RELAY_LOG_FILE='slave-relay-bin.000001', -RELAY_LOG_POS=4; +Setting up fake replication from MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001 start slave sql_thread; select MASTER_POS_WAIT('master-bin.000001', 3776); # Result on slave @@ -38,5 +34,4 @@ DROP PROCEDURE IF EXISTS p2; DROP FUNCTION IF EXISTS f1; DROP TRIGGER IF EXISTS tr1; stop slave sql_thread; -reset slave; -SET @@global.relay_log_purge= @old_relay_log_purge; +Cleaning up after setup_fake_relay_log.inc diff --git a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029-master.opt b/mysql-test/suite/rpl/t/rpl_binlog_auto_inc_bug33029-master.opt similarity index 100% rename from mysql-test/suite/binlog/t/binlog_auto_increment_bug33029-master.opt rename to mysql-test/suite/rpl/t/rpl_binlog_auto_inc_bug33029-master.opt diff --git a/mysql-test/suite/rpl/t/rpl_binlog_auto_inc_bug33029.test b/mysql-test/suite/rpl/t/rpl_binlog_auto_inc_bug33029.test new file mode 100644 index 00000000000..dbdd96347a2 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_binlog_auto_inc_bug33029.test @@ -0,0 +1,42 @@ +# BUG#33029 5.0 to 5.1 replication fails on dup key when inserting +# using a trig in SP + +# For all 5.0 up to 5.0.58 exclusive, and 5.1 up to 5.1.12 exclusive, +# if one statement in a SP generated AUTO_INCREMENT value by the top +# statement, all statements after it would be considered generated +# AUTO_INCREMENT value by the top statement, and a erroneous INSERT_ID +# value might be associated with these statement, which could cause +# duplicate entry error and stop the slave. + +# Test if the slave can replicate from such a buggy master + +# The bug33029-slave-relay-bin.000001 file is the +# slave-replay-bin.000003 file generated by run the +# rpl_auto_increment_bug33029.test with clean up statements at the end +# of the test case removed on a buggy 5.0 server + +source include/have_log_bin.inc; + +let $fake_relay_log= $MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001; +source include/setup_fake_relay_log.inc; + +start slave sql_thread; +disable_result_log; +select MASTER_POS_WAIT('master-bin.000001', 3776); +enable_result_log; + +echo # Result on slave; +SELECT * FROM t1; +SELECT * FROM t2; + +# clean up +disable_warnings; +DROP TABLE IF EXISTS t1, t2; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS tr1; +enable_warnings; + +stop slave sql_thread; +source include/cleanup_fake_relay_log.inc; From 1f7f620f3042a5b9c08912ae64b92c129e03065f Mon Sep 17 00:00:00 2001 From: Magne Mahre Date: Wed, 17 Feb 2010 10:18:17 +0100 Subject: [PATCH 03/24] WL#5154 Remove deprecated 4.1 features A set of program options and variables was deprecated in MySQL 5.1, and is hereby removed. --- client/client_priv.h | 4 +-- client/mysql.cc | 19 ++-------- client/mysqlbinlog.cc | 7 +--- client/mysqldump.c | 9 +---- mysql-test/include/default_mysqld.cnf | 2 +- mysql-test/r/func_time.result | 35 ------------------- mysql-test/r/locale.result | 2 +- mysql-test/r/mysqlbinlog.result | 4 +-- mysql-test/r/mysqld--help-notwin.result | 18 ---------- mysql-test/r/mysqld--help-win.result | 18 ---------- mysql-test/r/variables.result | 3 -- .../suite/rpl/t/rpl_row_mysqlbinlog.test | 6 ++-- mysql-test/t/bug47671-master.opt | 2 +- mysql-test/t/ctype_latin1_de-master.opt | 2 +- mysql-test/t/ctype_ucs2_def-master.opt | 2 +- mysql-test/t/func_time.test | 33 ++--------------- mysql-test/t/mysqlbinlog.test | 12 +++---- mysql-test/t/ps-master.opt | 2 +- mysql-test/t/show_check-master.opt | 2 +- mysql-test/t/union-master.opt | 2 +- mysql-test/t/variables.test | 1 - scripts/mysqld_multi.sh | 22 ++---------- sql/lex.h | 2 -- sql/mysql_priv.h | 10 +++--- sql/mysqld.cc | 17 --------- sql/share/errmsg-utf8.txt | 4 +-- sql/sql_yacc.yy | 27 +------------- sql/sys_vars.cc | 24 ------------- 28 files changed, 38 insertions(+), 253 deletions(-) diff --git a/client/client_priv.h b/client/client_priv.h index 9cd151f6160..3090a50bd43 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -34,7 +34,7 @@ enum options_client { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET, - OPT_PAGER, OPT_NOPAGER, OPT_TEE, OPT_NOTEE, + OPT_PAGER, OPT_TEE, OPT_NOTEE, OPT_LOW_PRIORITY, OPT_AUTO_REPAIR, OPT_COMPRESS, OPT_DROP, OPT_LOCKS, OPT_KEYWORDS, OPT_DELAYED, OPT_OPTIMIZE, OPT_FTB, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC, OPT_TABLES, @@ -49,7 +49,7 @@ enum options_client OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION, OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH, OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS, OPT_SERVER_ARG, - OPT_START_POSITION, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME, + OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME, OPT_SIGINT_IGNORE, OPT_HEXBLOB, OPT_ORDER_BY_PRIMARY, OPT_COUNT, #ifdef HAVE_NDBCLUSTER_DB OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, diff --git a/client/mysql.cc b/client/mysql.cc index 1a03034a30c..4c22cc9ebed 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1373,7 +1373,7 @@ static struct my_option my_long_options[] = (uchar**) &opt_rehash, (uchar**) &opt_rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"no-auto-rehash", 'A', - "No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options deprecated; use --disable-auto-rehash instead.", + "No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"auto-vertical-output", OPT_AUTO_VERTICAL_OUTPUT, "Automatically switch to vertical output mode if the result is wider than the terminal width.", @@ -1425,9 +1425,6 @@ static struct my_option my_long_options[] = "Enable named commands. Named commands mean this program's internal commands; see mysql> help . When enabled, the named commands can be used from any line of the query, otherwise only from the first line, before an enter. Disable with --disable-named-commands. This option is disabled by default.", (uchar**) &named_cmds, (uchar**) &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"no-named-commands", 'g', - "Named commands are disabled. Use \\* form only, or use named commands only in the beginning of a line ending with a semicolon (;) Since version 10.9 the client now starts with this option ENABLED by default! Disable with '-G'. Long format commands still work from the first line. WARNING: option deprecated; use --disable-named-commands instead.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"ignore-spaces", 'i', "Ignore space after function names.", (uchar**) &ignore_spaces, (uchar**) &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -1449,7 +1446,7 @@ static struct my_option my_long_options[] = {"line-numbers", OPT_LINE_NUMBERS, "Write line numbers for errors.", (uchar**) &line_numbers, (uchar**) &line_numbers, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"skip-line-numbers", 'L', "Don't write line number for errors. WARNING: -L is deprecated, use long version of this option instead.", 0, 0, 0, GET_NO_ARG, + {"skip-line-numbers", 'L', "Don't write line number for errors.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"unbuffered", 'n', "Flush buffer after each query.", (uchar**) &unbuffered, (uchar**) &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -1457,11 +1454,8 @@ static struct my_option my_long_options[] = (uchar**) &column_names, (uchar**) &column_names, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"skip-column-names", 'N', - "Don't write column names in results. WARNING: -N is deprecated, use long version of this options instead.", + "Don't write column names in results.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"set-variable", 'O', - "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.", - 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"sigint-ignore", OPT_SIGINT_IGNORE, "Ignore SIGINT (CTRL-C)", (uchar**) &opt_sigint_ignore, (uchar**) &opt_sigint_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -1472,9 +1466,6 @@ static struct my_option my_long_options[] = {"pager", OPT_PAGER, "Pager to use to display results. If you don't supply an option the default pager is taken from your ENV variable PAGER. Valid pagers are less, more, cat [> filename], etc. See interactive help (\\h) also. This option does not work in batch mode. Disable with --disable-pager. This option is disabled by default.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"no-pager", OPT_NOPAGER, - "Disable pager and print to stdout. See interactive help (\\h) also. WARNING: option deprecated; use --disable-pager instead.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif {"password", 'p', "Password to use when connecting to server. If password is not given it's asked from the tty.", @@ -1683,10 +1674,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_nopager= 1; } break; - case OPT_NOPAGER: - printf("WARNING: option deprecated; use --disable-pager instead.\n"); - opt_nopager= 1; - break; case OPT_MYSQL_PROTOCOL: #ifndef EMBEDDED_LIBRARY opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index dae6b36eeb2..79c232f86d0 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1077,11 +1077,6 @@ static struct my_option my_long_options[] = "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").", (uchar**) &port, (uchar**) &port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"position", 'j', "Deprecated. Use --start-position instead.", - (uchar**) &start_position, (uchar**) &start_position, 0, GET_ULL, - REQUIRED_ARG, BIN_LOG_HEADER_SIZE, BIN_LOG_HEADER_SIZE, - /* COM_BINLOG_DUMP accepts only 4 bytes for the position */ - (ulonglong)(~(uint32)0), 0, 0, 0}, {"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -1120,7 +1115,7 @@ static struct my_option my_long_options[] = "(you should probably use quotes for your shell to set it properly).", (uchar**) &start_datetime_str, (uchar**) &start_datetime_str, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"start-position", OPT_START_POSITION, + {"start-position", 'j', "Start reading the binlog at position N. Applies to the first binlog " "passed on the command line.", (uchar**) &start_position, (uchar**) &start_position, 0, GET_ULL, diff --git a/client/mysqldump.c b/client/mysqldump.c index 3f4ce1ab0af..fadb7e6649b 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -304,9 +304,6 @@ static struct my_option my_long_options[] = (uchar**) &opt_enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0}, {"fields-escaped-by", OPT_ESC, "Fields in the i.file are escaped by ...", (uchar**) &escaped, (uchar**) &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"first-slave", 'x', "Deprecated, renamed to --lock-all-tables.", - (uchar**) &opt_lock_all_tables, (uchar**) &opt_lock_all_tables, 0, GET_BOOL, NO_ARG, - 0, 0, 0, 0, 0, 0}, {"flush-logs", 'F', "Flush logs file in server before starting dump. " "Note that if you dump many databases at once (using the option " "--databases= or --all-databases), the logs will be flushed for " @@ -394,8 +391,7 @@ static struct my_option my_long_options[] = NO_ARG, 0, 0, 0, 0, 0, 0}, {"no-data", 'd', "No row information.", (uchar**) &opt_no_data, (uchar**) &opt_no_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"no-set-names", 'N', - "Deprecated. Use --skip-set-charset instead.", + {"no-set-names", 'N', "Same as--skip-set-charset.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"opt", OPT_OPTIMIZE, "Same as --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys. Enabled by default, disable with --skip-opt.", @@ -433,9 +429,6 @@ static struct my_option my_long_options[] = "Add 'SET NAMES default_character_set' to the output.", (uchar**) &opt_set_charset, (uchar**) &opt_set_charset, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"set-variable", 'O', - "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.", - 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_SMEM {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME, "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name, diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf index c54ac93133b..46fdda7df84 100644 --- a/mysql-test/include/default_mysqld.cnf +++ b/mysql-test/include/default_mysqld.cnf @@ -17,7 +17,7 @@ [mysqld] open-files-limit= 1024 local-infile -default-character-set= latin1 +character-set-server= latin1 # Increase default connect_timeout to avoid intermittent # disconnects when test servers are put under load see BUG#28359 diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 7bcaf5567cf..c3f210edee5 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -678,11 +678,6 @@ timestampadd(WEEK, 1, date) select timestampadd(SQL_TSI_SECOND, 1, date) from t1; timestampadd(SQL_TSI_SECOND, 1, date) 2003-01-02 00:00:01 -select timestampadd(SQL_TSI_FRAC_SECOND, 1, date) from t1; -timestampadd(SQL_TSI_FRAC_SECOND, 1, date) -2003-01-02 00:00:00.000001 -Warnings: -Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 6.2. Please use MICROSECOND instead select timestampdiff(MONTH, '2001-02-01', '2001-05-01') as a; a 3 @@ -713,11 +708,6 @@ a select timestampdiff(SQL_TSI_SECOND, '2001-02-01 12:59:59', '2001-05-01 12:58:58') as a; a 7689539 -select timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a; -a -7689538999999 -Warnings: -Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 6.2. Please use MICROSECOND instead select timestampdiff(SQL_TSI_DAY, '1986-02-01', '1986-03-01') as a1, timestampdiff(SQL_TSI_DAY, '1900-02-01', '1900-03-01') as a2, timestampdiff(SQL_TSI_DAY, '1996-02-01', '1996-03-01') as a3, @@ -1082,13 +1072,6 @@ week(20061108), week(20061108.01), week(20061108085411.000002); isnull(week(now() + 0)) isnull(week(now() + 0.2)) week(20061108) week(20061108.01) week(20061108085411.000002) 0 0 45 45 45 End of 4.1 tests -explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1, -timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used -Warnings: -Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 6.2. Please use MICROSECOND instead -Note 1003 select timestampdiff(WEEK,'2001-02-01','2001-05-01') AS `a1`,timestampdiff(SECOND_FRAC,'2001-02-01 12:59:59.120000','2001-05-01 12:58:58.119999') AS `a2` select time_format('100:00:00', '%H %k %h %I %l'); time_format('100:00:00', '%H %k %h %I %l') 100 100 04 04 4 @@ -1282,24 +1265,6 @@ DATE_ADD(20071108, INTERVAL 1 DAY) select LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND; LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND 2007-12-30 23:59:59 -SELECT TIMESTAMPADD(FRAC_SECOND, 1, '2008-02-18'); -TIMESTAMPADD(FRAC_SECOND, 1, '2008-02-18') -2008-02-18 00:00:00.000001 -Warnings: -Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 6.2. Please use MICROSECOND instead -SELECT TIMESTAMPDIFF(FRAC_SECOND, '2008-02-17', '2008-02-18'); -TIMESTAMPDIFF(FRAC_SECOND, '2008-02-17', '2008-02-18') -86400000000 -Warnings: -Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 6.2. Please use MICROSECOND instead -SELECT DATE_ADD('2008-02-18', INTERVAL 1 FRAC_SECOND); -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 near 'FRAC_SECOND)' at line 1 -SELECT DATE_SUB('2008-02-18', INTERVAL 1 FRAC_SECOND); -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 near 'FRAC_SECOND)' at line 1 -SELECT '2008-02-18' + INTERVAL 1 FRAC_SECOND; -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 near 'FRAC_SECOND' at line 1 -SELECT '2008-02-18' - INTERVAL 1 FRAC_SECOND; -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 near 'FRAC_SECOND' at line 1 select date_add('1000-01-01 00:00:00', interval '1.03:02:01.05' day_microsecond); date_add('1000-01-01 00:00:00', interval '1.03:02:01.05' day_microsecond) 1000-01-02 03:02:01.050000 diff --git a/mysql-test/r/locale.result b/mysql-test/r/locale.result index af7f9e3c132..b52ed8070f9 100644 --- a/mysql-test/r/locale.result +++ b/mysql-test/r/locale.result @@ -51,7 +51,7 @@ DROP TABLE t1; # SET lc_messages=sr_YU; Warnings: -Warning 1287 'sr_YU' is deprecated; use 'sr_RS' instead +Warning 1287 'sr_YU' is deprecated and will be removed in a future release. Please use sr_RS instead SHOW VARIABLES LIKE 'lc_messages'; Variable_name Value lc_messages sr_RS diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 097e51a78de..55e68e9f8f3 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -187,7 +187,7 @@ DELIMITER ; ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; ---- --position -- +--- --start-position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; @@ -388,7 +388,7 @@ DELIMITER ; ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; ---- --position -- +--- --start-position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; diff --git a/mysql-test/r/mysqld--help-notwin.result b/mysql-test/r/mysqld--help-notwin.result index a66b722ba4b..f8faeaf76ec 100644 --- a/mysql-test/r/mysqld--help-notwin.result +++ b/mysql-test/r/mysqld--help-notwin.result @@ -101,12 +101,6 @@ The following options may be given as the first argument: --date-format=name The DATE format (ignored) --datetime-format=name The DATETIME format (ignored) - -C, --default-character-set=name - Set the default character set (deprecated option, use - --character-set-server instead). - --default-collation=name - Set the default collation (deprecated option, use - --collation-server instead). --default-storage-engine=name The default storage engine for new tables --default-time-zone=name @@ -244,10 +238,6 @@ The following options may be given as the first argument: can safely set this to TRUE --log-error[=name] Error log file --log-isam[=name] Log all MyISAM changes to file. - -0, --log-long-format - Log some extra information to update log. Please note - that this option is deprecated; see --log-short-format - option. --log-output=name Syntax: log-output=value[,value...], where "value" could be TABLE, FILE or NONE --log-queries-not-using-indexes @@ -604,8 +594,6 @@ The following options may be given as the first argument: --rpl-recovery-rank=# Unused, will be removed --safe-mode Skip some optimize stages (for testing). - --safe-show-database - Deprecated option; use GRANT SHOW DATABASES instead... --safe-user-create Don't allow new user creation by the user who has no write privileges to the mysql.user table. --secure-auth Disallow authentication for accounts that have old @@ -615,10 +603,6 @@ The following options may be given as the first argument: files within specified directory --server-id=# Uniquely identifies the server instance in the community of replication partners - -O, --set-variable=name - Change the value of a variable. Please note that this - option is deprecated;you can set variables directly with - --variable-name=value. --show-slave-auth-info Show user and password in SHOW SLAVE HOSTS on this master --skip-grant-tables Start without grant tables. This gives all users FULL @@ -793,8 +777,6 @@ connect-timeout 10 console FALSE date-format %Y-%m-%d datetime-format %Y-%m-%d %H:%i:%s -default-character-set latin1 -default-collation latin1_swedish_ci default-storage-engine MyISAM default-time-zone (No default value) default-week-format 0 diff --git a/mysql-test/r/mysqld--help-win.result b/mysql-test/r/mysqld--help-win.result index e7048c71a48..abc7bdb2655 100644 --- a/mysql-test/r/mysqld--help-win.result +++ b/mysql-test/r/mysqld--help-win.result @@ -101,12 +101,6 @@ The following options may be given as the first argument: --date-format=name The DATE format (ignored) --datetime-format=name The DATETIME format (ignored) - -C, --default-character-set=name - Set the default character set (deprecated option, use - --character-set-server instead). - --default-collation=name - Set the default collation (deprecated option, use - --collation-server instead). --default-storage-engine=name The default storage engine for new tables --default-time-zone=name @@ -243,10 +237,6 @@ The following options may be given as the first argument: can safely set this to TRUE --log-error[=name] Error log file --log-isam[=name] Log all MyISAM changes to file. - -0, --log-long-format - Log some extra information to update log. Please note - that this option is deprecated; see --log-short-format - option. --log-output=name Syntax: log-output=value[,value...], where "value" could be TABLE, FILE or NONE --log-queries-not-using-indexes @@ -604,8 +594,6 @@ The following options may be given as the first argument: --rpl-recovery-rank=# Unused, will be removed --safe-mode Skip some optimize stages (for testing). - --safe-show-database - Deprecated option; use GRANT SHOW DATABASES instead... --safe-user-create Don't allow new user creation by the user who has no write privileges to the mysql.user table. --secure-auth Disallow authentication for accounts that have old @@ -615,10 +603,6 @@ The following options may be given as the first argument: files within specified directory --server-id=# Uniquely identifies the server instance in the community of replication partners - -O, --set-variable=name - Change the value of a variable. Please note that this - option is deprecated;you can set variables directly with - --variable-name=value. --shared-memory Enable the shared memory --shared-memory-base-name=name Base name of shared memory @@ -797,8 +781,6 @@ connect-timeout 10 console FALSE date-format %Y-%m-%d datetime-format %Y-%m-%d %H:%i:%s -default-character-set latin1 -default-collation latin1_swedish_ci default-storage-engine MyISAM default-time-zone (No default value) default-week-format 0 diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index a8437961117..9701a939b19 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -569,9 +569,6 @@ set sql_big_tables=1; set sql_buffer_result=1; set sql_log_bin=1; set sql_log_off=1; -set sql_log_update=1; -Warnings: -Note 1315 The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored. This option will be removed in MySQL 5.6. set sql_low_priority_updates=1; set sql_quote_show_create=1; set sql_safe_updates=1; diff --git a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test index 9a645baead0..ebb8bb6c718 100644 --- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test +++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test @@ -161,14 +161,14 @@ connection master; remove_file $MYSQLTEST_VARDIR/tmp/master.sql; -# this test for position option +# this test for start-position option # By setting this position to 416, we should only get the create of t3 --disable_query_log 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/ --position=417 --stop-position=570 $MYSQLD_DATADIR/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --start-position=417 --stop-position=570 $MYSQLD_DATADIR/master-bin.000001 # These are tests for remote binlog. # They should return the same as previous test. @@ -266,7 +266,7 @@ let $MYSQLD_DATADIR= `select @@datadir;`; select "--- Test 7 reading stdin w/position --" as ""; --enable_query_log --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL_BINLOG --short-form --position=417 --stop-position=570 - < $MYSQLD_DATADIR/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --start-position=417 --stop-position=570 - < $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/t/bug47671-master.opt b/mysql-test/t/bug47671-master.opt index 0afdf49e022..ad54fbc3467 100644 --- a/mysql-test/t/bug47671-master.opt +++ b/mysql-test/t/bug47671-master.opt @@ -1 +1 @@ ---default-character-set=utf8 --skip-character-set-client-handshake +--character-set-server=utf8 --skip-character-set-client-handshake diff --git a/mysql-test/t/ctype_latin1_de-master.opt b/mysql-test/t/ctype_latin1_de-master.opt index 79fdb1c63dc..0c072424de9 100644 --- a/mysql-test/t/ctype_latin1_de-master.opt +++ b/mysql-test/t/ctype_latin1_de-master.opt @@ -1 +1 @@ ---default-character-set=latin1 --default-collation=latin1_german2_ci +--character-set-server=latin1 --collation-server=latin1_german2_ci diff --git a/mysql-test/t/ctype_ucs2_def-master.opt b/mysql-test/t/ctype_ucs2_def-master.opt index 84d2a52b639..711ec42bd8a 100644 --- a/mysql-test/t/ctype_ucs2_def-master.opt +++ b/mysql-test/t/ctype_ucs2_def-master.opt @@ -1 +1 @@ ---default-collation=ucs2_unicode_ci --default-character-set=ucs2,latin1 +--collation-server=ucs2_unicode_ci --character-set-server=ucs2,latin1 diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 95b8a8ec38d..219a857a597 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -345,10 +345,6 @@ select date_add(date,INTERVAL "1" QUARTER) from t1; select timestampadd(MINUTE, 1, date) from t1; select timestampadd(WEEK, 1, date) from t1; select timestampadd(SQL_TSI_SECOND, 1, date) from t1; -# mysqltest.c discards an expected 'deprecated' warning on prepare stage ---disable_ps_protocol -select timestampadd(SQL_TSI_FRAC_SECOND, 1, date) from t1; ---enable_ps_protocol select timestampdiff(MONTH, '2001-02-01', '2001-05-01') as a; select timestampdiff(YEAR, '2002-05-01', '2001-01-01') as a; @@ -360,10 +356,6 @@ select timestampdiff(SQL_TSI_HOUR, '2001-02-01', '2001-05-01') as a; select timestampdiff(SQL_TSI_DAY, '2001-02-01', '2001-05-01') as a; select timestampdiff(SQL_TSI_MINUTE, '2001-02-01 12:59:59', '2001-05-01 12:58:59') as a; select timestampdiff(SQL_TSI_SECOND, '2001-02-01 12:59:59', '2001-05-01 12:58:58') as a; -# mysqltest.c discards an expected 'deprecated' warning on prepare stage ---disable_ps_protocol -select timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a; ---enable_ps_protocol select timestampdiff(SQL_TSI_DAY, '1986-02-01', '1986-03-01') as a1, timestampdiff(SQL_TSI_DAY, '1900-02-01', '1900-03-01') as a2, @@ -602,9 +594,6 @@ select isnull(week(now() + 0)), isnull(week(now() + 0.2)), --echo End of 4.1 tests -explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1, - timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2; - # # Bug #10590: %h, %I, and %l format specifies should all return results in # the 0-11 range @@ -797,27 +786,11 @@ select DATE_ADD(20071108, INTERVAL 1 DAY); select LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND; -# # Bug#33834: FRAC_SECOND: Applicability not clear in documentation # -# Show that he use of FRAC_SECOND, for anything other than -# TIMESTAMPADD / TIMESTAMPDIFF, is a server error. - -# mysqltest.c discards an expected 'deprecated' warning on prepare stage ---disable_ps_protocol -SELECT TIMESTAMPADD(FRAC_SECOND, 1, '2008-02-18'); -SELECT TIMESTAMPDIFF(FRAC_SECOND, '2008-02-17', '2008-02-18'); ---enable_ps_protocol - ---error ER_PARSE_ERROR -SELECT DATE_ADD('2008-02-18', INTERVAL 1 FRAC_SECOND); ---error ER_PARSE_ERROR -SELECT DATE_SUB('2008-02-18', INTERVAL 1 FRAC_SECOND); - ---error ER_PARSE_ERROR -SELECT '2008-02-18' + INTERVAL 1 FRAC_SECOND; ---error ER_PARSE_ERROR -SELECT '2008-02-18' - INTERVAL 1 FRAC_SECOND; +# Test case removed since FRAC_SECOND was deprecated and +# removed as part of WL#5154 +# # # Bug #36466: diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index 55593bed124..f8172696215 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -65,13 +65,13 @@ select "--- --database --" as ""; --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --database=nottest $MYSQLD_DATADIR/master-bin.000001 2> /dev/null -# this test for position option +# this test for start-position option --disable_query_log -select "--- --position --" as ""; +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/ --position=1074 $MYSQLD_DATADIR/master-bin.000002 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --start-position=1074 $MYSQLD_DATADIR/master-bin.000002 # These are tests for remote binlog. # They should return the same as previous test. @@ -103,11 +103,11 @@ select "--- --database --" as ""; # Strangely but this works --disable_query_log -select "--- --position --" as ""; +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 --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=1074 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 # Bug#7853 mysqlbinlog does not accept input from stdin @@ -120,7 +120,7 @@ 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 --position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001 +--exec $MYSQL_BINLOG --short-form --start-position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001 drop table t1,t2; # diff --git a/mysql-test/t/ps-master.opt b/mysql-test/t/ps-master.opt index 31c287d2bb5..1deeb6c9c63 100644 --- a/mysql-test/t/ps-master.opt +++ b/mysql-test/t/ps-master.opt @@ -1 +1 @@ ---log-output=table,file --log-slow-queries --log-long-format --log-queries-not-using-indexes +--log-output=table,file --log-slow-queries --log-queries-not-using-indexes diff --git a/mysql-test/t/show_check-master.opt b/mysql-test/t/show_check-master.opt index aab832e2848..108caf42203 100644 --- a/mysql-test/t/show_check-master.opt +++ b/mysql-test/t/show_check-master.opt @@ -1 +1 @@ ---log-output=table,file --log-slow-queries --log-long-format --log-queries-not-using-indexes --myisam-recover="" +--log-output=table,file --log-slow-queries --log-queries-not-using-indexes --myisam-recover="" diff --git a/mysql-test/t/union-master.opt b/mysql-test/t/union-master.opt index 3eb98fc3d6b..c852f488260 100644 --- a/mysql-test/t/union-master.opt +++ b/mysql-test/t/union-master.opt @@ -1 +1 @@ ---log-slow-queries --log-long-format --log-queries-not-using-indexes +--log-slow-queries --log-queries-not-using-indexes diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index d4b88fc6f9c..cab37510931 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -346,7 +346,6 @@ set sql_big_tables=1; set sql_buffer_result=1; set sql_log_bin=1; set sql_log_off=1; -set sql_log_update=1; set sql_low_priority_updates=1; set sql_quote_show_create=1; set sql_safe_updates=1; diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh index 430c74874eb..588c48fae4c 100644 --- a/scripts/mysqld_multi.sh +++ b/scripts/mysqld_multi.sh @@ -59,18 +59,6 @@ sub main push @defaults_options, (shift @ARGV); } - # Handle deprecated --config-file option: convert to --defaults-extra-file - foreach my $arg (@ARGV) - { - if ($arg =~ m/^--config-file=(.*)/) - { - # Put it at the beginning of the list, so it has lower precedence - # than a correct --defaults-extra-file option - - unshift @defaults_options, "--defaults-extra-file=$1"; - } - } - foreach (@defaults_options) { $_ = quote_shell_word($_); @@ -79,11 +67,6 @@ sub main # Add [mysqld_multi] options to front of @ARGV, ready for GetOptions() unshift @ARGV, defaults_for_group('mysqld_multi'); - # The --config-file option can be ignored; if passed on the command - # line, it's already handled; if specified in the configuration file, - # it's redundant and not useful - @ARGV= grep { not /^--config-file=/ } @ARGV; - # We've already handled --no-defaults, --defaults-file, etc. if (!GetOptions("help", "example", "version", "mysqld=s", "mysqladmin=s", "user=s", "password=s", "log=s", "no-log", @@ -740,8 +723,8 @@ from both [mysqld_multi] and [mysqld#], a group that is tried to be used, $my_progname will abort with an error. $my_progname will search for groups named [mysqld#] from my.cnf (or -the given --config-file=...), where '#' can be any positive integer -starting from 1. These groups should be the same as the regular +the given --defaults-extra-file=...), where '#' can be any positive +integer starting from 1. These groups should be the same as the regular [mysqld] group, but with those port, socket and any other options that are to be used with each separate mysqld process. The number in the group name has another function; it can be used for starting, @@ -767,7 +750,6 @@ These options must be given before any others: standard system-wide and user-specific files Using: @{[join ' ', @defaults_options]} ---config-file=... Deprecated, please use --defaults-extra-file instead --example Give an example of a config file with extra information. --help Print this help and exit. --log=... Log file. Full path to and the name for the log file. NOTE: diff --git a/sql/lex.h b/sql/lex.h index 7961339c4f3..463c251fa24 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -226,7 +226,6 @@ static SYMBOL symbols[] = { { "FORCE", SYM(FORCE_SYM)}, { "FOREIGN", SYM(FOREIGN)}, { "FOUND", SYM(FOUND_SYM)}, - { "FRAC_SECOND", SYM(FRAC_SECOND_SYM)}, { "FROM", SYM(FROM)}, { "FULL", SYM(FULL)}, { "FULLTEXT", SYM(FULLTEXT_SYM)}, @@ -517,7 +516,6 @@ static SYMBOL symbols[] = { { "SQL_NO_CACHE", SYM(SQL_NO_CACHE_SYM)}, { "SQL_SMALL_RESULT", SYM(SQL_SMALL_RESULT)}, { "SQL_THREAD", SYM(SQL_THREAD)}, - { "SQL_TSI_FRAC_SECOND", SYM(FRAC_SECOND_SYM)}, { "SQL_TSI_SECOND", SYM(SECOND_SYM)}, { "SQL_TSI_MINUTE", SYM(MINUTE_SYM)}, { "SQL_TSI_HOUR", SYM(HOUR_SYM)}, diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 8daf8f5ecb3..7ef8517ad13 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -198,12 +198,12 @@ char* query_table_status(THD *thd,const char *db,const char *table_name); if (((THD *) Thd) != NULL) \ push_warning_printf(((THD *) Thd), MYSQL_ERROR::WARN_LEVEL_WARN, \ ER_WARN_DEPRECATED_SYNTAX, \ - ER(ER_WARN_DEPRECATED_SYNTAX_WITH_VER), \ - (Old), #VerHi "." #VerLo, (New)); \ + ER(ER_WARN_DEPRECATED_SYNTAX), \ + (Old), (New)); \ else \ sql_print_warning("The syntax '%s' is deprecated and will be removed " \ - "in MySQL %s. Please use %s instead.", \ - (Old), #VerHi "." #VerLo, (New)); \ + "in a future release. Please use %s instead.", \ + (Old), (New)); \ } while(0) extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *system_charset_info; @@ -2032,7 +2032,7 @@ extern bool in_bootstrap; extern uint volatile thread_count, global_read_lock; extern uint connection_count; extern my_bool opt_sql_bin_update, opt_safe_user_create, opt_no_mix_types; -extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap; +extern my_bool opt_local_infile, opt_myisam_use_mmap; extern my_bool opt_slave_compressed_protocol, use_temp_pool; extern uint slave_exec_mode_options; extern ulonglong slave_type_conversions_options; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 5a88ad1970a..7b59a8a61ef 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -6014,12 +6014,6 @@ struct my_option my_long_options[]= 0, 0, 0}, {"core-file", OPT_WANT_CORE, "Write core on errors.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"default-character-set", 'C', "Set the default character set (deprecated option, use --character-set-server instead).", - (uchar**) &default_character_set_name, (uchar**) &default_character_set_name, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, - {"default-collation", 0, "Set the default collation (deprecated option, use --collation-server instead).", - (uchar**) &default_collation_name, (uchar**) &default_collation_name, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, /* default-storage-engine should have "MyISAM" as def_value. Instead of initializing it here it is done in init_common_variables() due to a compiler bug in Sun Studio compiler. */ @@ -6101,9 +6095,6 @@ struct my_option my_long_options[]= {"log-isam", OPT_ISAM_LOG, "Log all MyISAM changes to file.", (uchar**) &myisam_log_filename, (uchar**) &myisam_log_filename, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"log-long-format", '0', - "Log some extra information to update log. Please note that this option is deprecated; see --log-short-format option.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"log-short-format", 0, "Don't log extra information to update and slow-query logs.", (uchar**) &opt_short_log_format, (uchar**) &opt_short_log_format, @@ -6204,11 +6195,6 @@ Can't be set to 1 if --log-slave-updates is used.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"safe-mode", OPT_SAFE, "Skip some optimize stages (for testing).", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifndef TO_BE_DELETED - {"safe-show-database", 0, - "Deprecated option; use GRANT SHOW DATABASES instead...", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"safe-user-create", 0, "Don't allow new user creation by the user who has no write privileges to the mysql.user table.", (uchar**) &opt_safe_user_create, (uchar**) &opt_safe_user_create, 0, GET_BOOL, @@ -6221,9 +6207,6 @@ Can't be set to 1 if --log-slave-updates is used.", (uchar**)&sf_malloc_mem_limit, (uchar**)&sf_malloc_mem_limit, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"set-variable", 'O', - "Change the value of a variable. Please note that this option is deprecated;you can set variables directly with --variable-name=value.", - 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"show-slave-auth-info", 0, "Show user and password in SHOW SLAVE HOSTS on this master", (uchar**) &opt_show_slave_auth_info, (uchar**) &opt_show_slave_auth_info, 0, diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 8ed5bef2046..50bd40325a0 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -5018,10 +5018,8 @@ ER_UNKNOWN_STORAGE_ENGINE 42000 ger "Unbekannte Speicher-Engine '%s'" por "Motor de tabela desconhecido '%s'" spa "Desconocido motor de tabla '%s'" -# When using this error code, use ER(ER_WARN_DEPRECATED_SYNTAX_WITH_VER) -# for the message string. See, for example, code in mysql_priv.h. ER_WARN_DEPRECATED_SYNTAX - eng "'%s' is deprecated; use '%s' instead" + eng "'%s' is deprecated and will be removed in a future release. Please use %s instead" ger "'%s' ist veraltet. Bitte benutzen Sie '%s'" por "'%s' é desatualizado. Use '%s' em seu lugar" spa "'%s' está desaprobado, use '%s' en su lugar" diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 0b0ca2e6215..f88c364b22c 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -967,7 +967,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token FOREIGN /* SQL-2003-R */ %token FOR_SYM /* SQL-2003-R */ %token FOUND_SYM /* SQL-2003-R */ -%token FRAC_SECOND_SYM %token FROM %token FULL /* SQL-2003-R */ %token FULLTEXT_SYM @@ -1493,8 +1492,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %type date_time_type; %type interval -%type interval_time_st - %type interval_time_stamp %type storage_engines known_storage_engines @@ -9487,7 +9484,7 @@ using_list: ; interval: - interval_time_st {} + interval_time_stamp {} | DAY_HOUR_SYM { $$=INTERVAL_DAY_HOUR; } | DAY_MICROSECOND_SYM { $$=INTERVAL_DAY_MICROSECOND; } | DAY_MINUTE_SYM { $$=INTERVAL_DAY_MINUTE; } @@ -9502,27 +9499,6 @@ interval: ; interval_time_stamp: - interval_time_st {} - | FRAC_SECOND_SYM - { - $$=INTERVAL_MICROSECOND; - /* - FRAC_SECOND was mistakenly implemented with - a wrong resolution. According to the ODBC - standard it should be nanoseconds, not - microseconds. Changing it to nanoseconds - in MySQL would mean making TIMESTAMPDIFF - and TIMESTAMPADD to return DECIMAL, since - the return value would be too big for BIGINT - Hence we just deprecate the incorrect - implementation without changing its - resolution. - */ - WARN_DEPRECATED(yythd, 6, 2, "FRAC_SECOND", "MICROSECOND"); - } - ; - -interval_time_st: DAY_SYM { $$=INTERVAL_DAY; } | WEEK_SYM { $$=INTERVAL_WEEK; } | HOUR_SYM { $$=INTERVAL_HOUR; } @@ -12258,7 +12234,6 @@ keyword_sp: | FILE_SYM {} | FIRST_SYM {} | FIXED_SYM {} - | FRAC_SECOND_SYM {} | GEOMETRY_SYM {} | GEOMETRYCOLLECTION {} | GET_FORMAT {} diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index eef403e1a86..8f71d27e8d4 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2203,30 +2203,6 @@ static Sys_var_bit Sys_log_binlog( DEFAULT(TRUE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_has_super), ON_UPDATE(fix_sql_log_bin)); -static bool deprecated_log_update(sys_var *self, THD *thd, set_var *var) -{ - /* - The update log is not supported anymore since 5.0. - See sql/mysqld.cc/, comments in function init_server_components() for an - explaination of the different warnings we send below - */ - - if (opt_sql_bin_update) - push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, - ER_UPDATE_LOG_DEPRECATED_TRANSLATED, - ER(ER_UPDATE_LOG_DEPRECATED_TRANSLATED)); - else - push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, - ER_UPDATE_LOG_DEPRECATED_IGNORED, - ER(ER_UPDATE_LOG_DEPRECATED_IGNORED)); - return check_has_super(self, thd, var); -} -static Sys_var_bit Sys_log_update( - "sql_log_update", "alias for sql_log_bin", - SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_BIN_LOG, - DEFAULT(TRUE), NO_MUTEX_GUARD, NOT_IN_BINLOG, - ON_CHECK(deprecated_log_update), ON_UPDATE(fix_sql_log_bin)); - static Sys_var_bit Sys_sql_warnings( "sql_warnings", "sql_warnings", SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_WARNINGS, From efaf2ee25372f440dadde8fc16269e91ae940c5e Mon Sep 17 00:00:00 2001 From: Magne Mahre Date: Wed, 17 Feb 2010 13:15:07 +0100 Subject: [PATCH 04/24] WL#5182 Remove more deprecated 4.1/5.0 features WL#5154 was a task for formally deprecating and removing items that were mentioned in the manual as having been deprecated since MySQL 4.1 or 5.0, but that had never been removed. Since WL#5154 was created, examination of mysqld.cc, mysql.cc, and mysqldump.c reveals additional deprecations not mentioned in the manual. (In some cases, the items are simply not mentioned in the 5.1+ manuals.) This is a follow-on task to deprecate and remove these additional items. The deprecation happened in MySQL 5.1, and the options/variables are now removed from the code. --- client/client_priv.h | 4 +- client/mysql.cc | 7 ---- client/mysqldump.c | 5 +-- mysql-test/r/mysqld--help-notwin.result | 21 ---------- mysql-test/r/mysqld--help-win.result | 21 ---------- sql/mysql_priv.h | 4 -- sql/mysqld.cc | 56 +------------------------ 7 files changed, 5 insertions(+), 113 deletions(-) diff --git a/client/client_priv.h b/client/client_priv.h index 3090a50bd43..27ba3c973c5 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -34,7 +34,7 @@ enum options_client { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET, - OPT_PAGER, OPT_TEE, OPT_NOTEE, + OPT_PAGER, OPT_TEE, OPT_LOW_PRIORITY, OPT_AUTO_REPAIR, OPT_COMPRESS, OPT_DROP, OPT_LOCKS, OPT_KEYWORDS, OPT_DELAYED, OPT_OPTIMIZE, OPT_FTB, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC, OPT_TABLES, @@ -48,7 +48,7 @@ enum options_client OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL, OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION, OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH, - OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS, OPT_SERVER_ARG, + OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_SERVER_ARG, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME, OPT_SIGINT_IGNORE, OPT_HEXBLOB, OPT_ORDER_BY_PRIMARY, OPT_COUNT, #ifdef HAVE_NDBCLUSTER_DB diff --git a/client/mysql.cc b/client/mysql.cc index 4c22cc9ebed..179392d5965 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1511,8 +1511,6 @@ static struct my_option my_long_options[] = {"tee", OPT_TEE, "Append everything into outfile. See interactive help (\\h) also. Does not work in batch mode. Disable with --disable-tee. This option is disabled by default.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"no-tee", OPT_NOTEE, "Disable outfile. See interactive help (\\h) also. WARNING: option deprecated; use --disable-tee instead", 0, 0, 0, GET_NO_ARG, - NO_ARG, 0, 0, 0, 0, 0, 0}, #ifndef DONT_ALLOW_USER_CHANGE {"user", 'u', "User for login if not current user.", (uchar**) ¤t_user, (uchar**) ¤t_user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -1651,11 +1649,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), else init_tee(argument); break; - case OPT_NOTEE: - printf("WARNING: option deprecated; use --disable-tee instead.\n"); - if (opt_outfile) - end_tee(); - break; case OPT_PAGER: if (argument == disabled_my_option) opt_nopager= 1; diff --git a/client/mysqldump.c b/client/mysqldump.c index fadb7e6649b..f94309205c6 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -184,9 +184,6 @@ HASH ignore_table; static struct my_option my_long_options[] = { - {"all", 'a', "Deprecated. Use --create-options instead.", - (uchar**) &create_options, (uchar**) &create_options, 0, GET_BOOL, NO_ARG, 1, - 0, 0, 0, 0, 0}, {"all-databases", 'A', "Dump all the databases. This will be same as --databases with all databases selected.", (uchar**) &opt_alldbs, (uchar**) &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, @@ -239,7 +236,7 @@ static struct my_option my_long_options[] = {"compress", 'C', "Use compression in server/client protocol.", (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"create-options", OPT_CREATE_OPTIONS, + {"create-options", 'a', "Include all MySQL specific create options.", (uchar**) &create_options, (uchar**) &create_options, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, diff --git a/mysql-test/r/mysqld--help-notwin.result b/mysql-test/r/mysqld--help-notwin.result index f8faeaf76ec..4a6993c54ee 100644 --- a/mysql-test/r/mysqld--help-notwin.result +++ b/mysql-test/r/mysqld--help-notwin.result @@ -109,10 +109,6 @@ The following options may be given as the first argument: The default week format used by WEEK() functions --delay-key-write[=name] Type of DELAY_KEY_WRITE - --delay-key-write-for-all-tables - Don't flush key buffers between writes for any MyISAM - table (Deprecated option, use --delay-key-write=all - instead). --delayed-insert-limit=# After inserting delayed_insert_limit rows, the INSERT DELAYED handler will check if there are any SELECT @@ -132,7 +128,6 @@ The following options may be given as the first argument: --div-precision-increment=# Precision of the result of '/' operator will be increased on that value - --enable-locking Deprecated option, use --external-locking instead. --engine-condition-pushdown Push supported query conditions to the storage engine. Deprecated, use --optimizer-switch instead. @@ -264,9 +259,6 @@ The following options may be given as the first argument: transactions that affect more than one storage engine, when binary log is disabled) --log-tc-size=# Size of transaction coordinator log. - --log-update[=name] The update log is deprecated since version 5.0, is - replaced by the binary log and this option justs turns on - --log-bin instead. -W, --log-warnings[=#] Log some not critical warnings to the log file --long-query-time=# Log all queries that have taken more than long_query_time @@ -497,7 +489,6 @@ The following options may be given as the first argument: When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks. If not set, then it's set to the value of record_buffer - --record-buffer=# Deprecated; use --read-buffer-size instead. --relay-log=name The location and name to use for relay logs --relay-log-index=name The location and name to use for the file that keeps a @@ -608,7 +599,6 @@ The following options may be given as the first argument: --skip-grant-tables Start without grant tables. This gives all users FULL ACCESS to all tables! --skip-host-cache Don't cache host names. - --skip-locking Deprecated option, use --skip-external-locking instead. --skip-name-resolve Don't resolve hostnames. All hostnames are IP's or 'localhost'. --skip-networking Don't allow connection with TCP/IP @@ -617,8 +607,6 @@ The following options may be given as the first argument: Don't allow 'SHOW DATABASE' commands --skip-slave-start If set, slave is not autostarted. --skip-stack-trace Don't print a stack trace on failure. - --skip-symlink Don't allow symlinking of tables. Deprecated option. Use - --skip-symbolic-links instead. --skip-thread-priority Don't give threads different priorities. This option is deprecated because it has no effect; the implied behavior @@ -670,10 +658,6 @@ The following options may be given as the first argument: --sporadic-binlog-dump-fail Option used by mysql-test for debugging and testing of replication. - --sql-bin-update-same - The update log is deprecated since version 5.0, is - replaced by the binary log and this option does nothing - anymore. --sql-mode=name Syntax: sql-mode=mode[,mode[,mode...]]. See the manual for the complete list of valid sql modes -s, --symbolic-links @@ -745,7 +729,6 @@ The following options may be given as the first argument: -V, --version Output version information and exit. --wait-timeout=# The number of seconds the server waits for activity on a connection before closing it - -W, --warnings[=#] Deprecated; use --log-warnings instead. Variables (--variable-name=value) and boolean options {FALSE|TRUE} Value (after reading options) @@ -786,7 +769,6 @@ delayed-insert-timeout 300 delayed-queue-size 1000 disconnect-slave-event-count 0 div-precision-increment 4 -enable-locking FALSE engine-condition-pushdown TRUE event-scheduler OFF expire-logs-days 0 @@ -834,7 +816,6 @@ log-slow-admin-statements FALSE log-slow-slave-statements FALSE log-tc tc.log log-tc-size 24576 -log-update (No default value) log-warnings 1 long-query-time 10 low-priority-updates FALSE @@ -918,7 +899,6 @@ range-alloc-block-size 4096 read-buffer-size 131072 read-only FALSE read-rnd-buffer-size 262144 -record-buffer 131072 relay-log (No default value) relay-log-index (No default value) relay-log-info-file relay-log.info @@ -977,7 +957,6 @@ updatable-views-with-limit YES use-symbolic-links FALSE verbose TRUE wait-timeout 28800 -warnings 1 To see what values a running MySQL server is using, type 'mysqladmin variables' instead of 'mysqld --verbose --help'. diff --git a/mysql-test/r/mysqld--help-win.result b/mysql-test/r/mysqld--help-win.result index abc7bdb2655..c9fe5344c42 100644 --- a/mysql-test/r/mysqld--help-win.result +++ b/mysql-test/r/mysqld--help-win.result @@ -109,10 +109,6 @@ The following options may be given as the first argument: The default week format used by WEEK() functions --delay-key-write[=name] Type of DELAY_KEY_WRITE - --delay-key-write-for-all-tables - Don't flush key buffers between writes for any MyISAM - table (Deprecated option, use --delay-key-write=all - instead). --delayed-insert-limit=# After inserting delayed_insert_limit rows, the INSERT DELAYED handler will check if there are any SELECT @@ -132,7 +128,6 @@ The following options may be given as the first argument: --div-precision-increment=# Precision of the result of '/' operator will be increased on that value - --enable-locking Deprecated option, use --external-locking instead. --engine-condition-pushdown Push supported query conditions to the storage engine. Deprecated, use --optimizer-switch instead. @@ -263,9 +258,6 @@ The following options may be given as the first argument: transactions that affect more than one storage engine, when binary log is disabled) --log-tc-size=# Size of transaction coordinator log. - --log-update[=name] The update log is deprecated since version 5.0, is - replaced by the binary log and this option justs turns on - --log-bin instead. -W, --log-warnings[=#] Log some not critical warnings to the log file --long-query-time=# Log all queries that have taken more than long_query_time @@ -497,7 +489,6 @@ The following options may be given as the first argument: When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks. If not set, then it's set to the value of record_buffer - --record-buffer=# Deprecated; use --read-buffer-size instead. --relay-log=name The location and name to use for relay logs --relay-log-index=name The location and name to use for the file that keeps a @@ -611,7 +602,6 @@ The following options may be given as the first argument: --skip-grant-tables Start without grant tables. This gives all users FULL ACCESS to all tables! --skip-host-cache Don't cache host names. - --skip-locking Deprecated option, use --skip-external-locking instead. --skip-name-resolve Don't resolve hostnames. All hostnames are IP's or 'localhost'. --skip-networking Don't allow connection with TCP/IP @@ -620,8 +610,6 @@ The following options may be given as the first argument: Don't allow 'SHOW DATABASE' commands --skip-slave-start If set, slave is not autostarted. --skip-stack-trace Don't print a stack trace on failure. - --skip-symlink Don't allow symlinking of tables. Deprecated option. Use - --skip-symbolic-links instead. --skip-thread-priority Don't give threads different priorities. This option is deprecated because it has no effect; the implied behavior @@ -673,10 +661,6 @@ The following options may be given as the first argument: --sporadic-binlog-dump-fail Option used by mysql-test for debugging and testing of replication. - --sql-bin-update-same - The update log is deprecated since version 5.0, is - replaced by the binary log and this option does nothing - anymore. --sql-mode=name Syntax: sql-mode=mode[,mode[,mode...]]. See the manual for the complete list of valid sql modes --standalone Dummy option to start as a standalone program (NT). @@ -749,7 +733,6 @@ The following options may be given as the first argument: -V, --version Output version information and exit. --wait-timeout=# The number of seconds the server waits for activity on a connection before closing it - -W, --warnings[=#] Deprecated; use --log-warnings instead. Variables (--variable-name=value) and boolean options {FALSE|TRUE} Value (after reading options) @@ -790,7 +773,6 @@ delayed-insert-timeout 300 delayed-queue-size 1000 disconnect-slave-event-count 0 div-precision-increment 4 -enable-locking FALSE engine-condition-pushdown TRUE event-scheduler OFF expire-logs-days 0 @@ -837,7 +819,6 @@ log-slow-admin-statements FALSE log-slow-slave-statements FALSE log-tc tc.log log-tc-size 24576 -log-update (No default value) log-warnings 1 long-query-time 10 low-priority-updates FALSE @@ -922,7 +903,6 @@ range-alloc-block-size 4096 read-buffer-size 131072 read-only FALSE read-rnd-buffer-size 262144 -record-buffer 131072 relay-log (No default value) relay-log-index (No default value) relay-log-info-file relay-log.info @@ -983,7 +963,6 @@ updatable-views-with-limit YES use-symbolic-links FALSE verbose TRUE wait-timeout 28800 -warnings 1 To see what values a running MySQL server is using, type 'mysqladmin variables' instead of 'mysqld --verbose --help'. diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 7ef8517ad13..477b443ff88 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -2629,7 +2629,6 @@ enum options_mysqld OPT_BOOTSTRAP, OPT_CONSOLE, OPT_DEBUG_SYNC_TIMEOUT, - OPT_DELAY_KEY_WRITE_ALL, OPT_ISAM_LOG, OPT_KEY_BUFFER_SIZE, OPT_KEY_CACHE_AGE_THRESHOLD, @@ -2648,19 +2647,16 @@ enum options_mysqld OPT_SAFE, OPT_SERVER_ID, OPT_SKIP_HOST_CACHE, - OPT_SKIP_LOCK, OPT_SKIP_NEW, OPT_SKIP_PRIOR, OPT_SKIP_RESOLVE, OPT_SKIP_STACK_TRACE, - OPT_SKIP_SYMLINKS, OPT_SLOW_QUERY_LOG, OPT_SSL_CA, OPT_SSL_CAPATH, OPT_SSL_CERT, OPT_SSL_CIPHER, OPT_SSL_KEY, - OPT_UPDATE_LOG, OPT_WANT_CORE, OPT_ENGINE_CONDITION_PUSHDOWN }; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 7b59a8a61ef..39c94d4f261 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4007,21 +4007,13 @@ static int init_server_components() Implementation of the above : - If mysqld is started with --log-update and --log-bin, ignore --log-update (print a warning), push a warning when SQL_LOG_UPDATE - is used, and turn off --sql-bin-update-same. + is used, This will completely ignore SQL_LOG_UPDATE - If mysqld is started with --log-update only, change it to --log-bin (with the filename passed to log-update, plus '-bin') (print a warning), push a warning when SQL_LOG_UPDATE is - used, and turn on --sql-bin-update-same. + used. This will translate SQL_LOG_UPDATE to SQL_LOG_BIN. - - Note that we tell the user that --sql-bin-update-same is deprecated and - does nothing, and we don't take into account if he used this option or - not; but internally we give this variable a value to have the behaviour - we want (i.e. have SQL_LOG_UPDATE influence SQL_LOG_BIN or not). - As sql-bin-update-same, log-update and log-bin cannot be changed by the - user after starting the server (they are not variables), the user will - not later interfere with the settings we do here. */ if (opt_bin_log) { @@ -6023,9 +6015,6 @@ struct my_option my_long_options[]= {"default-time-zone", 0, "Set the default time zone.", (uchar**) &default_tz_name, (uchar**) &default_tz_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, - {"delay-key-write-for-all-tables", OPT_DELAY_KEY_WRITE_ALL, - "Don't flush key buffers between writes for any MyISAM table (Deprecated option, use --delay-key-write=all instead).", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_OPENSSL {"des-key-file", 0, "Load keys for des_encrypt() and des_encrypt from given file.", @@ -6039,10 +6028,6 @@ struct my_option my_long_options[]= (uchar**) &disconnect_slave_event_count, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif /* HAVE_REPLICATION */ - {"enable-locking", 0, - "Deprecated option, use --external-locking instead.", - (uchar**) &opt_external_locking, (uchar**) &opt_external_locking, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_STACK_TRACE_ON_SEGV {"enable-pstack", 0, "Print a symbolic stack trace on failure.", (uchar**) &opt_do_pstack, (uchar**) &opt_do_pstack, 0, GET_BOOL, NO_ARG, 0, 0, @@ -6127,11 +6112,6 @@ struct my_option my_long_options[]= REQUIRED_ARG, TC_LOG_MIN_SIZE, TC_LOG_MIN_SIZE, ULONG_MAX, 0, TC_LOG_PAGE_SIZE, 0}, #endif - {"log-update", OPT_UPDATE_LOG, - "The update log is deprecated since version 5.0, is replaced by the binary \ -log and this option justs turns on --log-bin instead.", - (uchar**) &opt_update_logname, (uchar**) &opt_update_logname, 0, GET_STR, - OPT_ARG, 0, 0, 0, 0, 0, 0}, {"master-info-file", 0, "The location and name of the file that remembers the master and where the I/O replication \ thread is in the master's binlogs.", @@ -6219,9 +6199,6 @@ Can't be set to 1 if --log-slave-updates is used.", #endif {"skip-host-cache", OPT_SKIP_HOST_CACHE, "Don't cache host names.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"skip-locking", OPT_SKIP_LOCK, - "Deprecated option, use --skip-external-locking instead.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"skip-name-resolve", OPT_SKIP_RESOLVE, "Don't resolve hostnames. All hostnames are IP's or 'localhost'.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -6233,8 +6210,6 @@ Can't be set to 1 if --log-slave-updates is used.", {"skip-stack-trace", OPT_SKIP_STACK_TRACE, "Don't print a stack trace on failure.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"skip-symlink", OPT_SKIP_SYMLINKS, "Don't allow symlinking of tables. Deprecated option. Use --skip-symbolic-links instead.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"skip-thread-priority", OPT_SKIP_PRIOR, "Don't give threads different priorities. This option is deprecated " "because it has no effect; the implied behavior is already the default.", @@ -6246,10 +6221,6 @@ Can't be set to 1 if --log-slave-updates is used.", (uchar**) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif /* HAVE_REPLICATION */ - {"sql-bin-update-same", 0, - "The update log is deprecated since version 5.0, is replaced by the " - "binary log and this option does nothing anymore.", - 0, 0, 0, GET_DISABLED, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_OPENSSL {"ssl", 0, "Enable SSL for connection (automatically enabled with other flags).", @@ -6308,20 +6279,12 @@ Can't be set to 1 if --log-slave-updates is used.", 0, 0}, {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"warnings", 'W', "Deprecated; use --log-warnings instead.", - (uchar**) &global_system_variables.log_warnings, - (uchar**) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, - 1, 0, ULONG_MAX, 0, 0, 0}, {"plugin-load", 0, "Optional semicolon-separated list of plugins to load, where each plugin is " "identified as name=library, where name is the plugin name and library " "is the plugin library in plugin_dir.", (uchar**) &opt_plugin_load, (uchar**) &opt_plugin_load, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"record_buffer", 0, "Deprecated; use --read-buffer-size instead.", - (uchar**) &global_system_variables.read_buff_size, - (uchar**) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG, - 128*1024L, IO_SIZE*2, INT_MAX32, 0, IO_SIZE, 0}, {"table_cache", 0, "Deprecated; use --table-open-cache instead.", (uchar**) &table_cache_size, (uchar**) &table_cache_size, 0, GET_ULONG, REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0}, @@ -7235,9 +7198,6 @@ mysqld_get_one_option(int optid, case (int) OPT_ISAM_LOG: opt_myisam_log=1; break; - case (int) OPT_UPDATE_LOG: - opt_update_log=1; - break; case (int) OPT_BIN_LOG: opt_bin_log= test(argument != disabled_my_option); break; @@ -7358,9 +7318,6 @@ mysqld_get_one_option(int optid, "and will be removed in MySQL 7.0. This option has no effect " "as the implied behavior is already the default."); break; - case (int) OPT_SKIP_LOCK: - opt_external_locking=0; - break; case (int) OPT_SKIP_HOST_CACHE: opt_specialflag|= SPECIAL_NO_HOST_CACHE; break; @@ -7373,9 +7330,6 @@ mysqld_get_one_option(int optid, case (int) OPT_SKIP_STACK_TRACE: test_flags|=TEST_NO_STACKTRACE; break; - case (int) OPT_SKIP_SYMLINKS: - my_use_symdir=0; - break; case (int) OPT_BIND_ADDRESS: { struct addrinfo *res_lst, hints; @@ -7408,12 +7362,6 @@ mysqld_get_one_option(int optid, case OPT_SERVER_ID: server_id_supplied = 1; break; - case OPT_DELAY_KEY_WRITE_ALL: - if (argument != disabled_my_option) - delay_key_write_options= DELAY_KEY_WRITE_ALL; - else - delay_key_write_options= DELAY_KEY_WRITE_NONE; - break; case OPT_ONE_THREAD: thread_handling= SCHEDULER_ONE_THREAD_PER_CONNECTION; break; From 547f9acd528ad156a11acd5d542e2b00fe248446 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 17 Feb 2010 19:08:49 +0100 Subject: [PATCH 05/24] Bug #51248 Server start fails with MTR_VERSION=1 and code with WL5154 Replaced --default-character-set with --character-set-server Replaced --language with --lc-messages-dir NB full test suite not tested yet --- mysql-test/lib/v1/mysql-test-run.pl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl index b1e746dd80e..c3e4e6a1827 100755 --- a/mysql-test/lib/v1/mysql-test-run.pl +++ b/mysql-test/lib/v1/mysql-test-run.pl @@ -805,7 +805,7 @@ sub command_line_setup () { "$glob_basedir/sql/share", "$glob_basedir/share"); - $path_language= mtr_path_exists("$path_share/english"); + $path_language= mtr_path_exists("$path_share"); $path_charsetsdir= mtr_path_exists("$path_share/charsets"); @@ -1463,7 +1463,7 @@ sub collect_mysqld_features () { # # --datadir must exist, mysqld will chdir into it # - my $list= `$exe_mysqld --no-defaults --datadir=$tmpdir --language=$path_language --skip-grant-tables --verbose --help`; + my $list= `$exe_mysqld --no-defaults --datadir=$tmpdir --lc-messages-dir=$path_language --skip-grant-tables --verbose --help`; foreach my $line (split('\n', $list)) { @@ -1807,7 +1807,7 @@ sub mysql_client_test_arguments() if ( $glob_use_embedded_server ) { mtr_add_arg($args, - " -A --language=$path_language"); + " -A --lc-messages-dir=$path_language"); mtr_add_arg($args, " -A --datadir=$slave->[0]->{'path_myddir'}"); mtr_add_arg($args, @@ -3158,7 +3158,7 @@ sub install_db ($$) { if ( ! $glob_netware ) { - mtr_add_arg($args, "--language=%s", $path_language); + mtr_add_arg($args, "--lc-messages-dir=%s", $path_language); mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); } @@ -3283,10 +3283,10 @@ socket = $instance->{path_sock} pid-file = $instance->{path_pid} port = $instance->{port} datadir = $instance->{path_datadir} +lc-messages-dir = $path_language log = $instance->{path_datadir}/mysqld$server_id.log log-error = $instance->{path_datadir}/mysqld$server_id.err.log log-slow-queries = $instance->{path_datadir}/mysqld$server_id.slow.log -language = $path_language character-sets-dir = $path_charsetsdir basedir = $path_my_basedir server_id = $server_id @@ -3893,8 +3893,8 @@ sub mysqld_arguments ($$$$) { mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix); } - mtr_add_arg($args, "%s--default-character-set=latin1", $prefix); - mtr_add_arg($args, "%s--language=%s", $prefix, $path_language); + mtr_add_arg($args, "%s--character-set-server=latin1", $prefix); + mtr_add_arg($args, "%s--lc-messages-dir=%s", $prefix, $path_language); mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix); # Increase default connect_timeout to avoid intermittent From b0cdcdcbb9a6e9fccbe548fba3b34ff693ebb83f Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 17 Feb 2010 14:19:17 +0400 Subject: [PATCH 06/24] Bug#38959 archive_gis fails due to rounding difference Multi_polygon::centroid() has an error in the implementation per-file messages: sql/spatial.cc Bug#38959 archive_gis fails due to rounding difference multi_polygon::centroid() implementation fixed --- sql/spatial.cc | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/sql/spatial.cc b/sql/spatial.cc index 671b8544b8a..9a31b099e92 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -1612,9 +1612,8 @@ int Gis_multi_polygon::area(double *ar, const char **end_of_data) const int Gis_multi_polygon::centroid(String *result) const { uint32 n_polygons; - bool first_loop= 1; Gis_polygon p; - double UNINIT_VAR(res_area), UNINIT_VAR(res_cx), UNINIT_VAR(res_cy); + double res_area= 0.0, res_cx= 0.0, res_cy= 0.0; double cur_area, cur_cx, cur_cy; const char *data= m_data; @@ -1631,20 +1630,13 @@ int Gis_multi_polygon::centroid(String *result) const p.centroid_xy(&cur_cx, &cur_cy)) return 1; - if (!first_loop) - { - double sum_area= res_area + cur_area; - res_cx= (res_area * res_cx + cur_area * cur_cx) / sum_area; - res_cy= (res_area * res_cy + cur_area * cur_cy) / sum_area; - } - else - { - first_loop= 0; - res_area= cur_area; - res_cx= cur_cx; - res_cy= cur_cy; - } + res_area+= cur_area; + res_cx+= cur_area * cur_cx; + res_cy+= cur_area * cur_cy; } + + res_cx/= res_area; + res_cy/= res_area; return create_point(result, res_cx, res_cy); } From 2529fa94edbb8d0f882253a89a805f568b9b6179 Mon Sep 17 00:00:00 2001 From: Jon Olav Hauglid Date: Wed, 17 Feb 2010 11:24:53 +0100 Subject: [PATCH 07/24] Bug #44613 SELECT statement inside FUNCTION takes a shared lock The problem was that a shared InnoDB row lock was taken when executing SELECT statements inside a stored function as a part of a transaction using REPEATABLE READ. This prevented other transactions from updating the row. InnoDB uses multi-versioning and consistent nonlocking reads. SELECTs should therefore not acquire locks and block other transactions wishing to do updates. This bug is no longer repeatable with the changes introduced in the scope of metadata locking. Test case added to innodb_mysql.test. --- mysql-test/r/innodb_mysql.result | 25 ++++++++++++++++++++ mysql-test/t/innodb_mysql.test | 39 ++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index bccb5caf7d4..085e5440712 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -2297,3 +2297,28 @@ t2 CREATE TABLE `t2` ( CONSTRAINT `x` FOREIGN KEY (`fk`) REFERENCES `t1` (`pk`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t2, t1; +# +# Bug#44613 SELECT statement inside FUNCTION takes a shared lock +# +DROP TABLE IF EXISTS t1; +DROP FUNCTION IF EXISTS f1; +CREATE TABLE t1(x INT PRIMARY KEY, y INT) ENGINE=innodb; +INSERT INTO t1 VALUES (1, 0), (2, 0); +CREATE FUNCTION f1(z INT) RETURNS INT READS SQL DATA +RETURN (SELECT x FROM t1 WHERE x = z); +# Connection default +START TRANSACTION; +SELECT f1(1); +f1(1) +1 +# Connection con2 +START TRANSACTION; +SELECT f1(1); +f1(1) +1 +UPDATE t1 SET y = 1 WHERE x = 1; +COMMIT; +# Connection default +COMMIT; +DROP TABLE t1; +DROP FUNCTION f1; diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index 3cd7b40f4ab..d7a255a7f39 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -555,3 +555,42 @@ create table t2 (fk int, key x (fk), constraint x foreign key (FK) references t1 (PK)) engine=InnoDB; show create table t2; drop table t2, t1; + + +--echo # +--echo # Bug#44613 SELECT statement inside FUNCTION takes a shared lock +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP FUNCTION IF EXISTS f1; +--enable_warnings + +CREATE TABLE t1(x INT PRIMARY KEY, y INT) ENGINE=innodb; +INSERT INTO t1 VALUES (1, 0), (2, 0); + +CREATE FUNCTION f1(z INT) RETURNS INT READS SQL DATA + RETURN (SELECT x FROM t1 WHERE x = z); + +--echo # Connection default +START TRANSACTION; +SELECT f1(1); + +--echo # Connection con2 +--disable_query_log +connect (con2, localhost, root); +--enable_query_log +START TRANSACTION; +SELECT f1(1); +# This next statement used to block. +UPDATE t1 SET y = 1 WHERE x = 1; + +COMMIT; + +disconnect con2; +--source include/wait_until_disconnected.inc +--echo # Connection default +connection default; +COMMIT; +DROP TABLE t1; +DROP FUNCTION f1; From a83c305e43f897a5997c9771b88c456440eaf68f Mon Sep 17 00:00:00 2001 From: Magne Mahre Date: Wed, 17 Feb 2010 22:17:17 +0100 Subject: [PATCH 08/24] Bug#47017 rpl_timezone fails on PB-2 with mismatch error This is a post-fix cleanup to move rpl.rpl_timezone out of 'experimental' state. --- mysql-test/collections/default.experimental | 1 - 1 file changed, 1 deletion(-) diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index 4460262cfa8..fa9c3d75b7f 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -24,7 +24,6 @@ rpl.rpl_plugin_load* @solaris # Bug#47146 rpl.rpl_row_sp011* @solaris # Bug#47791 2010-01-31 alik Several test cases fail on Solaris with error Thread stack overrun rpl.rpl_slave_load_remove_tmpfile @windows # Bug#50474 2010-01-28 alik rpl_slave_load_remove_tmpfile failed on windows debug enabled binary rpl.rpl_sync* @windows # Bug#50473 2010-01-31 alik rpl_sync fails on windows debug enabled binaries -rpl.rpl_timezone* # Bug#47017 2009-10-27 alik rpl_timezone fails on PB-2 with mismatch error # Declare all NDB-tests in ndb and rpl_ndb test suites experimental. # Usually the test cases from ndb and rpl_ndb test suites are not run in PB, From 813ad38ef4538a7de0cfa618d252822d2d6d510c Mon Sep 17 00:00:00 2001 From: Jon Olav Hauglid Date: Thu, 18 Feb 2010 14:54:38 +0100 Subject: [PATCH 09/24] Bug #48315 Metadata lock is not taken for merged views that use an INFORMATION_SCHEMA table When a prepared statement using a merged view containing an information schema table was executed, a metadata lock of the view was not taken. This meant that it was possible for concurrent view DDL to execute, thereby breaking the binary log. For example, it was possible for DROP VIEW to appear in the binary log before a query using the view. This also happened when a statement in a stored routine was executed a second time. For such views, the information schema table is merged into the view during the prepare phase (or first execution of a statement in a routine). The problem was that we took a short cut and were not executing full-blown view opening during subsequent executions of the statement. As a result, a metadata lock on the view was not taken to protect the view definition. This patch resolves the problem by making sure a metadata lock is taken for views even after information schema tables are merged into them. Test cased added to view.test. --- mysql-test/r/view.result | 33 +++++++++++++++++ mysql-test/t/view.test | 79 ++++++++++++++++++++++++++++++++++++++++ sql/sql_base.cc | 15 ++++++-- 3 files changed, 124 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 4c0acc2eb6a..5c5afd2a0ec 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -4004,3 +4004,36 @@ CREATE VIEW t2 AS SELECT * FROM t1; ERROR HY000: Can't execute the query because you have a conflicting read lock UNLOCK TABLES; DROP TABLE t1, t2; +# +# Bug#48315 Metadata lock is not taken for merged views that +# use an INFORMATION_SCHEMA table +# +DROP TABLE IF EXISTS t1; +DROP VIEW IF EXISTS v1; +DROP PROCEDURE IF EXISTS p1; +# Connection default +CREATE VIEW v1 AS SELECT schema_name FROM information_schema.schemata; +CREATE TABLE t1 (str VARCHAR(50)); +CREATE PROCEDURE p1() INSERT INTO t1 SELECT * FROM v1; +# CALL p1() so the view is merged. +CALL p1(); +# Connection 3 +LOCK TABLE t1 READ; +# Connection default +# Try to CALL p1() again, this time it should block for t1. +# Sending: +CALL p1(); +# Connection 2 +# ... then try to drop the view. This should block. +# Sending: +DROP VIEW v1; +# Connection 3 +# Now allow CALL p1() to complete +UNLOCK TABLES; +# Connection default +# Reaping: CALL p1() +# Connection 2 +# Reaping: DROP VIEW v1 +# Connection default +DROP PROCEDURE p1; +DROP TABLE t1; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 8297013611f..2cca4ccd186 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -6,6 +6,9 @@ drop database if exists mysqltest; --enable_warnings use test; +# Save the initial number of concurrent sessions. +--source include/count_sessions.inc + # # some basic test of views and its functionality # @@ -3975,3 +3978,79 @@ CREATE VIEW t2 AS SELECT * FROM t1; UNLOCK TABLES; DROP TABLE t1, t2; + + +--echo # +--echo # Bug#48315 Metadata lock is not taken for merged views that +--echo # use an INFORMATION_SCHEMA table +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP VIEW IF EXISTS v1; +DROP PROCEDURE IF EXISTS p1; +--enable_warnings + +connect (con2, localhost, root); +connect (con3, localhost, root); + +--echo # Connection default +connection default; + +CREATE VIEW v1 AS SELECT schema_name FROM information_schema.schemata; +CREATE TABLE t1 (str VARCHAR(50)); +CREATE PROCEDURE p1() INSERT INTO t1 SELECT * FROM v1; + +--echo # CALL p1() so the view is merged. +CALL p1(); + +--echo # Connection 3 +connection con3; +LOCK TABLE t1 READ; + +--echo # Connection default +connection default; +--echo # Try to CALL p1() again, this time it should block for t1. +--echo # Sending: +--send CALL p1() + +--echo # Connection 2 +connection con2; +let $wait_condition= + SELECT COUNT(*) = 1 from information_schema.processlist + WHERE state = "Table lock" AND info = "INSERT INTO t1 SELECT * FROM v1"; +--source include/wait_condition.inc +--echo # ... then try to drop the view. This should block. +--echo # Sending: +--send DROP VIEW v1 + +--echo # Connection 3 +connection con3; +let $wait_condition= + SELECT COUNT(*) = 1 from information_schema.processlist + WHERE state = "Waiting for table" AND info = "DROP VIEW v1"; +--source include/wait_condition.inc +--echo # Now allow CALL p1() to complete +UNLOCK TABLES; + +--echo # Connection default +connection default; +--echo # Reaping: CALL p1() +--reap + +--echo # Connection 2 +connection con2; +--echo # Reaping: DROP VIEW v1 +--reap + +--echo # Connection default +connection default; +DROP PROCEDURE p1; +DROP TABLE t1; +disconnect con2; +disconnect con3; + + +# Check that all connections opened by test cases in this file are really +# gone so execution of other tests won't be affected by their presence. +--source include/wait_until_count_sessions.inc diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 6ff7085f740..d5a664df0d0 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -4168,9 +4168,18 @@ open_and_process_table(THD *thd, LEX *lex, TABLE_LIST *tables, TABLE_LIST is processed. This code works only during re-execution. */ if (tables->view) - goto process_view_routines; - if (!mysql_schema_table(thd, lex, tables) && - !check_and_update_table_version(thd, tables, tables->table->s)) + { + /* + We still need to take a MDL lock on the merged view to protect + it from concurrent changes. + */ + if (!open_table_get_mdl_lock(thd, tables, &tables->mdl_request, + ot_ctx, flags)) + goto process_view_routines; + /* Fall-through to return error. */ + } + else if (!mysql_schema_table(thd, lex, tables) && + !check_and_update_table_version(thd, tables, tables->table->s)) { goto end; } From 2da4521fb801d980470f21e48583337c882682d6 Mon Sep 17 00:00:00 2001 From: Magne Mahre Date: Thu, 18 Feb 2010 18:10:39 +0100 Subject: [PATCH 10/24] Cleanup after push of WL#5154 - Remove deprecated 4.1 features The fix is the removal of the sql_log_update_basic test, as this option is deprecated and removed, and a minor change to the result file of lc_time_names_basic as the error message has changed. --- .../sys_vars/r/lc_time_names_basic.result | 4 +- .../sys_vars/r/sql_log_update_basic.result | 82 ------------------- .../sys_vars/t/sql_log_update_basic.test | 53 ------------ 3 files changed, 2 insertions(+), 137 deletions(-) delete mode 100644 mysql-test/suite/sys_vars/r/sql_log_update_basic.result delete mode 100644 mysql-test/suite/sys_vars/t/sql_log_update_basic.test diff --git a/mysql-test/suite/sys_vars/r/lc_time_names_basic.result b/mysql-test/suite/sys_vars/r/lc_time_names_basic.result index 39e93a6f76c..3f19c7dda15 100644 --- a/mysql-test/suite/sys_vars/r/lc_time_names_basic.result +++ b/mysql-test/suite/sys_vars/r/lc_time_names_basic.result @@ -460,7 +460,7 @@ SELECT @@session.lc_time_names; sq_AL SET @@session.lc_time_names=sr_YU; Warnings: -Warning 1287 'sr_YU' is deprecated; use 'sr_RS' instead +Warning 1287 'sr_YU' is deprecated and will be removed in a future release. Please use sr_RS instead SELECT @@session.lc_time_names; @@session.lc_time_names sr_RS @@ -907,7 +907,7 @@ SELECT @@global.lc_time_names; sq_AL SET @@global.lc_time_names=sr_YU; Warnings: -Warning 1287 'sr_YU' is deprecated; use 'sr_RS' instead +Warning 1287 'sr_YU' is deprecated and will be removed in a future release. Please use sr_RS instead SELECT @@global.lc_time_names; @@global.lc_time_names sr_RS diff --git a/mysql-test/suite/sys_vars/r/sql_log_update_basic.result b/mysql-test/suite/sys_vars/r/sql_log_update_basic.result deleted file mode 100644 index c18b9017021..00000000000 --- a/mysql-test/suite/sys_vars/r/sql_log_update_basic.result +++ /dev/null @@ -1,82 +0,0 @@ -SET @start_global_value = @@global.sql_log_update; -SELECT @start_global_value; -@start_global_value -1 -select @@global.sql_log_update; -@@global.sql_log_update -1 -select @@session.sql_log_update; -@@session.sql_log_update -1 -show global variables like 'sql_log_update'; -Variable_name Value -sql_log_update ON -show session variables like 'sql_log_update'; -Variable_name Value -sql_log_update ON -select * from information_schema.global_variables where variable_name='sql_log_update'; -VARIABLE_NAME VARIABLE_VALUE -SQL_LOG_UPDATE ON -select * from information_schema.session_variables where variable_name='sql_log_update'; -VARIABLE_NAME VARIABLE_VALUE -SQL_LOG_UPDATE ON -set global sql_log_update=1; -Warnings: -Note 1315 The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored. This option will be removed in MySQL 5.6. -set session sql_log_update=ON; -Warnings: -Note 1315 The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored. This option will be removed in MySQL 5.6. -select @@global.sql_log_update; -@@global.sql_log_update -1 -select @@session.sql_log_update; -@@session.sql_log_update -1 -show global variables like 'sql_log_update'; -Variable_name Value -sql_log_update ON -show session variables like 'sql_log_update'; -Variable_name Value -sql_log_update ON -select * from information_schema.global_variables where variable_name='sql_log_update'; -VARIABLE_NAME VARIABLE_VALUE -SQL_LOG_UPDATE ON -select * from information_schema.session_variables where variable_name='sql_log_update'; -VARIABLE_NAME VARIABLE_VALUE -SQL_LOG_UPDATE ON -set global sql_log_update=0; -Warnings: -Note 1315 The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored. This option will be removed in MySQL 5.6. -set session sql_log_update=OFF; -Warnings: -Note 1315 The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored. This option will be removed in MySQL 5.6. -select @@global.sql_log_update; -@@global.sql_log_update -0 -select @@session.sql_log_update; -@@session.sql_log_update -0 -show global variables like 'sql_log_update'; -Variable_name Value -sql_log_update OFF -show session variables like 'sql_log_update'; -Variable_name Value -sql_log_update OFF -select * from information_schema.global_variables where variable_name='sql_log_update'; -VARIABLE_NAME VARIABLE_VALUE -SQL_LOG_UPDATE OFF -select * from information_schema.session_variables where variable_name='sql_log_update'; -VARIABLE_NAME VARIABLE_VALUE -SQL_LOG_UPDATE OFF -set global sql_log_update=1.1; -ERROR 42000: Incorrect argument type to variable 'sql_log_update' -set global sql_log_update=1e1; -ERROR 42000: Incorrect argument type to variable 'sql_log_update' -set global sql_log_update="foo"; -ERROR 42000: Variable 'sql_log_update' can't be set to the value of 'foo' -SET @@global.sql_log_update = @start_global_value; -Warnings: -Note 1315 The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored. This option will be removed in MySQL 5.6. -SELECT @@global.sql_log_update; -@@global.sql_log_update -1 diff --git a/mysql-test/suite/sys_vars/t/sql_log_update_basic.test b/mysql-test/suite/sys_vars/t/sql_log_update_basic.test deleted file mode 100644 index 9b9f6f375b6..00000000000 --- a/mysql-test/suite/sys_vars/t/sql_log_update_basic.test +++ /dev/null @@ -1,53 +0,0 @@ - -# -# 2010-01-20 OBN - Added check of I_S tables after variable value changes. -# - Added value change to ON/OFF to ensure change of current value -# - ---source include/have_profiling.inc - -SET @start_global_value = @@global.sql_log_update; -SELECT @start_global_value; - -# -# exists as global and session -# -select @@global.sql_log_update; -select @@session.sql_log_update; -show global variables like 'sql_log_update'; -show session variables like 'sql_log_update'; -select * from information_schema.global_variables where variable_name='sql_log_update'; -select * from information_schema.session_variables where variable_name='sql_log_update'; - -# -# show that it's writable -# -set global sql_log_update=1; -set session sql_log_update=ON; -select @@global.sql_log_update; -select @@session.sql_log_update; -show global variables like 'sql_log_update'; -show session variables like 'sql_log_update'; -select * from information_schema.global_variables where variable_name='sql_log_update'; -select * from information_schema.session_variables where variable_name='sql_log_update'; -set global sql_log_update=0; -set session sql_log_update=OFF; -select @@global.sql_log_update; -select @@session.sql_log_update; -show global variables like 'sql_log_update'; -show session variables like 'sql_log_update'; -select * from information_schema.global_variables where variable_name='sql_log_update'; -select * from information_schema.session_variables where variable_name='sql_log_update'; - -# -# incorrect types -# ---error ER_WRONG_TYPE_FOR_VAR -set global sql_log_update=1.1; ---error ER_WRONG_TYPE_FOR_VAR -set global sql_log_update=1e1; ---error ER_WRONG_VALUE_FOR_VAR -set global sql_log_update="foo"; - -SET @@global.sql_log_update = @start_global_value; -SELECT @@global.sql_log_update; From 1e6b33ec0f7ba01cb0bb86b6a1f0972c01d0b803 Mon Sep 17 00:00:00 2001 From: Konstantin Osipov Date: Fri, 19 Feb 2010 17:20:29 +0300 Subject: [PATCH 11/24] Fix compiler warnings in my_atomic.h --- include/atomic/x86-gcc.h | 2 +- include/my_atomic.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/atomic/x86-gcc.h b/include/atomic/x86-gcc.h index 77c32f8d70c..61b94a48568 100644 --- a/include/atomic/x86-gcc.h +++ b/include/atomic/x86-gcc.h @@ -88,7 +88,7 @@ */ #define make_atomic_add_body64 \ int64 tmp=*a; \ - while (!my_atomic_cas64(a, &tmp, tmp+v)); \ + while (!my_atomic_cas64(a, &tmp, tmp+v)) ; \ v=tmp; /* diff --git a/include/my_atomic.h b/include/my_atomic.h index b506aa7d3d1..e2304e3246d 100644 --- a/include/my_atomic.h +++ b/include/my_atomic.h @@ -77,13 +77,13 @@ #ifndef make_atomic_add_body #define make_atomic_add_body(S) \ int ## S tmp=*a; \ - while (!my_atomic_cas ## S(a, &tmp, tmp+v)); \ + while (!my_atomic_cas ## S(a, &tmp, tmp+v)) ; \ v=tmp; #endif #ifndef make_atomic_fas_body #define make_atomic_fas_body(S) \ int ## S tmp=*a; \ - while (!my_atomic_cas ## S(a, &tmp, v)); \ + while (!my_atomic_cas ## S(a, &tmp, v)) ; \ v=tmp; #endif #ifndef make_atomic_load_body From 6b443a7e2c72993ffbbe2eca1e89d48adf80499f Mon Sep 17 00:00:00 2001 From: Serge Kozlov Date: Fri, 19 Feb 2010 22:37:23 +0300 Subject: [PATCH 12/24] Bug#48308. Post-fix Removed --remove_file in cleanup procedure --- mysql-test/include/cleanup_fake_relay_log.inc | 3 --- 1 file changed, 3 deletions(-) diff --git a/mysql-test/include/cleanup_fake_relay_log.inc b/mysql-test/include/cleanup_fake_relay_log.inc index 000c80f3761..269cd04ca34 100644 --- a/mysql-test/include/cleanup_fake_relay_log.inc +++ b/mysql-test/include/cleanup_fake_relay_log.inc @@ -8,9 +8,6 @@ --echo Cleaning up after setup_fake_relay_log.inc -# Remove files. -remove_file $_fake_relay_log; -remove_file $_fake_relay_index; --disable_query_log --disable_warnings STOP SLAVE SQL_THREAD; From 1e638e728abb3ba75b62bbc01baf9cbe6c60e111 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Mon, 22 Feb 2010 00:26:29 +0000 Subject: [PATCH 13/24] Post-push fix for BUG#50364. There was an erroneous parameter when calling flush_master_info from write_ignored_events_info_to_relay_log which could lead to a server crash. This happens because the I/O thread releases the log_lock before calling the flush_master_info. Set the function to call flush_master_info with third parameter to true, so that the mutex is properly taken. --- sql/slave.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/slave.cc b/sql/slave.cc index 3678c2497de..f88a961815f 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1726,7 +1726,7 @@ static void write_ignored_events_info_to_relay_log(THD *thd, Master_info *mi) " to the relay log, SHOW SLAVE STATUS may be" " inaccurate"); rli->relay_log.harvest_bytes_written(&rli->log_space_total); - if (flush_master_info(mi, TRUE, FALSE)) + if (flush_master_info(mi, TRUE, TRUE)) sql_print_error("Failed to flush master info file"); delete ev; } From e605213c2a52bb0991853acd9a9d42897613abd6 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 22 Feb 2010 19:39:36 +0100 Subject: [PATCH 14/24] Bug#51393 : remove mtr_fix_privilege_tables from MTR v1 --- mysql-test/lib/v1/mysql-test-run.pl | 31 +---------------------------- 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl index 3ea815cb45a..b4d2870e546 100755 --- a/mysql-test/lib/v1/mysql-test-run.pl +++ b/mysql-test/lib/v1/mysql-test-run.pl @@ -152,8 +152,6 @@ our $exe_mysqldump; our $exe_mysqlslap; our $exe_mysqlimport; our $exe_mysqlshow; -our $exe_mysql_fix_system_tables; -our $file_mysql_fix_privilege_tables; our $exe_mysqltest; our $exe_ndbd; our $exe_ndb_mgmd; @@ -1680,19 +1678,7 @@ sub executable_setup () { $exe_mysql_upgrade= ""; } - if ( ! $glob_win32 ) - { - # Look for mysql_fix_system_table script - $exe_mysql_fix_system_tables= - mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables", - "$path_client_bindir/mysql_fix_privilege_tables"); - } - - # Look for mysql_fix_privilege_tables.sql script - $file_mysql_fix_privilege_tables= - mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql", - "$glob_basedir/share/mysql_fix_privilege_tables.sql", - "$glob_basedir/share/mysql/mysql_fix_privilege_tables.sql"); + if ( ! $opt_skip_ndbcluster and executable_setup_ndb()) { @@ -2159,21 +2145,6 @@ sub environment_setup () { $ENV{'MYSQL_UPGRADE'}= mysql_upgrade_arguments(); } - # ---------------------------------------------------- - # Setup env so childs can execute mysql_fix_system_tables - # ---------------------------------------------------- - if ( !$opt_extern && ! $glob_win32 ) - { - my $cmdline_mysql_fix_system_tables= - "$exe_mysql_fix_system_tables --no-defaults --host=localhost " . - "--user=root --password= " . - "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " . - "--port=$master->[0]->{'port'} " . - "--socket=$master->[0]->{'path_sock'}"; - $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables; - - } - $ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables; # ---------------------------------------------------- # Setup env so childs can execute my_print_defaults From f4284ba6bdbe682b9d6737ba2d8ac9c7fbc1f0f5 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 22 Feb 2010 20:55:27 +0100 Subject: [PATCH 15/24] Fix BUILD/compile-pentium64-xxx scripts, when ccache is present. Fix contains of : - splitting CC/CXX if there are more that 2 space-delimited tokens, add the rest to CFLAGS (in this case CC was set to "ccache gcc --pipe", and this broke recognition of gcc compiler as CMake understands CC consisting of 2 space delimited tokens but not more) - add my_new.cc to mysys fle list if C++ operator new is not found. Always, not only for gcc (the original problem was that missing operator new when compiling with CXX=gcc) --- cmake/configure.pl | 32 ++++++++++++++++++++++++++++++++ mysys/CMakeLists.txt | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/cmake/configure.pl b/cmake/configure.pl index 52c57011ce0..5886a554789 100644 --- a/cmake/configure.pl +++ b/cmake/configure.pl @@ -38,6 +38,38 @@ sub set_installdir } } +# CMake understands CC and CXX env.variables correctly, if they contain 1 or 2 tokens +# e.g CXX=gcc and CXX="ccache gcc" are ok. However it could have a problem if there +# (recognizing gcc) with more tokens ,e.g CXX="ccache gcc --pipe". +# The problem is simply fixed by splitting compiler and flags, e.g +# CXX="ccache gcc --pipe" => CXX=ccache gcc CXXFLAGS=--pipe + +sub check_compiler +{ + my ($varname, $flagsvarname) = @_; + my @tokens = split(/ /,$ENV{$varname}); + if($#tokens >= 2) + { + $ENV{$varname} = $tokens[0]." ".$tokens[1]; + my $flags; + + for(my $i=2; $i<=$#tokens; $i++) + { + $flags= $flags." ".$tokens[$i]; + } + if(defined $ENV{$flagsvarname}) + { + $flags = $flags." ".$ENV{$flagsvarname}; + } + $ENV{$flagsvarname}=$flags; + print("$varname=$ENV{$varname}\n"); + print("$flagsvarname=$ENV{$flagsvarname}\n"); + } +} + +check_compiler("CC", "CFLAGS"); +check_compiler("CXX", "CXXFLAGS"); + foreach my $option (@ARGV) { if (substr ($option, 0, 2) == "--") diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt index c035a2f0b49..2fbaac7fe72 100755 --- a/mysys/CMakeLists.txt +++ b/mysys/CMakeLists.txt @@ -42,7 +42,7 @@ IF (WIN32) SET (MYSYS_SOURCES ${MYSYS_SOURCES} my_winthread.c my_wincond.c my_winerr.c my_winfile.c my_windac.c my_conio.c) ENDIF() -IF(CMAKE_COMPILER_IS_GNUCC AND NOT HAVE_CXX_NEW) +IF(NOT HAVE_CXX_NEW) # gcc as C++ compiler does not have new/delete SET(MYSYS_SOURCES ${MYSYS_SOURCES} my_new.cc) ADD_DEFINITIONS( -DUSE_MYSYS_NEW) From b0a89a2ee578435999038b39b5ab41dc3adbd2df Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Tue, 23 Feb 2010 09:53:48 +0000 Subject: [PATCH 16/24] Support non-GPL builds. --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 567f6dce2e8..5e5ac3ae7a8 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -268,7 +268,8 @@ ELSE() SET(CPACK_GENERATOR "TGZ") ENDIF() INCLUDE(CPack) -INSTALL(FILES COPYING EXCEPTIONS-CLIENT README DESTINATION ${INSTALL_DOCREADMEDIR}) +INSTALL(FILES COPYING EXCEPTIONS-CLIENT LICENSE.mysql DESTINATION ${INSTALL_DOCREADMEDIR} OPTIONAL) +INSTALL(FILES README DESTINATION ${INSTALL_DOCREADMEDIR}) IF(UNIX) INSTALL(FILES Docs/INSTALL-BINARY DESTINATION ${INSTALL_DOCREADMEDIR}) @@ -282,4 +283,4 @@ INSTALL(DIRECTORY Docs/ DESTINATION ${INSTALL_DOCDIR} PATTERN "glibc*" EXCLUDE PATTERN "sp-imp-spec.txt" EXCLUDE PATTERN "linuxthreads.txt" EXCLUDE -) \ No newline at end of file +) From c88200172e0de06df30d4466f6c9de43a318b7ac Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 23 Feb 2010 12:32:57 +0100 Subject: [PATCH 17/24] Bug #51414: Arguments with embedded spaces are not correctly handled by configure wrapper. The bug was that ./configure was passing paramers to subscripts as $@, and to handle embedded spaces it needs to be quoted as "$@". This resulting into a bug when ./configure was called e.g with CFLAGS='-m64 -Xstrconst'.. Additionally, fixed cmake/configure.pl did not handle environment variables passed on the command line. this is fixed in this push --- BUILD/choose_configure.sh | 4 ++-- cmake/configure.pl | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/BUILD/choose_configure.sh b/BUILD/choose_configure.sh index 71243ea09b6..476b8b51657 100644 --- a/BUILD/choose_configure.sh +++ b/BUILD/choose_configure.sh @@ -7,8 +7,8 @@ cmake -P cmake/check_minimal_version.cmake >/dev/null 2>&1 || HAVE_CMAKE=no perl --version >/dev/null 2>&1 || HAVE_CMAKE=no if test "$HAVE_CMAKE" = "no" then - sh ./configure.am $@ + sh ./configure.am "$@" else - perl ./cmake/configure.pl $@ + perl ./cmake/configure.pl "$@" fi diff --git a/cmake/configure.pl b/cmake/configure.pl index 5886a554789..50225a0ef5e 100644 --- a/cmake/configure.pl +++ b/cmake/configure.pl @@ -72,10 +72,21 @@ check_compiler("CXX", "CXXFLAGS"); foreach my $option (@ARGV) { - if (substr ($option, 0, 2) == "--") + if (substr ($option, 0, 2) eq "--") { $option = substr($option, 2); } + else + { + # This must be environment variable + my @v = split('=', $option); + my $name = shift(@v); + if(@v) + { + $ENV{$name} = join('=', @v); + } + next; + } if($option =~ /srcdir/) { $srcdir = substr($option,7); From 94bd96e815333955974b53ca42e4480c8754b75c Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 23 Feb 2010 12:48:26 +0100 Subject: [PATCH 18/24] Bug#43201 : Stack overrun when running sp-error test. It appears that stack overflow checks for recusrive stored procedure calls, that run in the normal server, did not work in embedded and were dummified with preprocessor magic( #ifndef EMBEDDED_SERVER ). The fix is to remove ifdefs, there is no reason not to run overflow checks and crash in deeply recursive calls. Note: Start of the stack (thd->thread_stack variable) in embedded is not necessarily exact but stil provides the best guess. Unless the caller of mysql_read_connect() is already deep in the stack, thd->thread_stack variable should approximate stack start address well. --- sql/item_cmpfunc.cc | 4 ---- sql/item_func.cc | 4 ---- sql/opt_range.cc | 2 -- sql/sql_parse.cc | 3 +-- sql/sql_select.cc | 2 -- 5 files changed, 1 insertion(+), 14 deletions(-) diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 1da383ce3e9..ed465cbe280 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2865,9 +2865,7 @@ bool Item_func_case::fix_fields(THD *thd, Item **ref) buff should match stack usage from Item_func_case::val_int() -> Item_func_case::find_item() */ -#ifndef EMBEDDED_LIBRARY uchar buff[MAX_FIELD_WIDTH*2+sizeof(String)*2+sizeof(String*)*2+sizeof(double)*2+sizeof(longlong)*2]; -#endif bool res= Item_func::fix_fields(thd, ref); /* Call check_stack_overrun after fix_fields to be sure that stack variable @@ -4081,9 +4079,7 @@ Item_cond::fix_fields(THD *thd, Item **ref) DBUG_ASSERT(fixed == 0); List_iterator li(list); Item *item; -#ifndef EMBEDDED_LIBRARY uchar buff[sizeof(char*)]; // Max local vars in function -#endif not_null_tables_cache= used_tables_cache= 0; const_item_cache= 1; /* diff --git a/sql/item_func.cc b/sql/item_func.cc index 75f8b2045b5..e49ee4346b1 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -151,9 +151,7 @@ Item_func::fix_fields(THD *thd, Item **ref) { DBUG_ASSERT(fixed == 0); Item **arg,**arg_end; -#ifndef EMBEDDED_LIBRARY // Avoid compiler warning uchar buff[STACK_BUFF_ALLOC]; // Max argument in function -#endif used_tables_cache= not_null_tables_cache= 0; const_item_cache=1; @@ -2839,9 +2837,7 @@ bool udf_handler::fix_fields(THD *thd, Item_result_field *func, uint arg_count, Item **arguments) { -#ifndef EMBEDDED_LIBRARY // Avoid compiler warning uchar buff[STACK_BUFF_ALLOC]; // Max argument in function -#endif DBUG_ENTER("Item_udf_func::fix_fields"); if (check_stack_overrun(thd, STACK_MIN_SIZE, buff)) diff --git a/sql/opt_range.cc b/sql/opt_range.cc index b9ea8c7c991..68285563239 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2266,9 +2266,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, keys_to_use.intersect(head->keys_in_use_for_query); if (!keys_to_use.is_clear_all()) { -#ifndef EMBEDDED_LIBRARY // Avoid compiler warning uchar buff[STACK_BUFF_ALLOC]; -#endif MEM_ROOT alloc; SEL_TREE *tree= NULL; KEY_PART *key_parts; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index b0d8614dc84..c7e1be2237b 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5171,7 +5171,6 @@ bool check_global_access(THD *thd, ulong want_access) Check stack size; Send error if there isn't enough stack to continue ****************************************************************************/ -#ifndef EMBEDDED_LIBRARY #if STACK_DIRECTION < 0 #define used_stack(A,B) (long) (A - B) @@ -5209,7 +5208,7 @@ bool check_stack_overrun(THD *thd, long margin, #endif return 0; } -#endif /* EMBEDDED_LIBRARY */ + #define MY_YACC_INIT 1000 // Start with big alloc #define MY_YACC_MAX 32000 // Because of 'short' diff --git a/sql/sql_select.cc b/sql/sql_select.cc index c37aeb39f6c..468f81a7d87 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2516,9 +2516,7 @@ static ha_rows get_quick_record_count(THD *thd, SQL_SELECT *select, { int error; DBUG_ENTER("get_quick_record_count"); -#ifndef EMBEDDED_LIBRARY // Avoid compiler warning uchar buff[STACK_BUFF_ALLOC]; -#endif if (check_stack_overrun(thd, STACK_MIN_SIZE, buff)) DBUG_RETURN(0); // Fatal error flag is set if (select) From 3f4d6f9aa743f91fbafe622a8a6803b98a89dec2 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Tue, 23 Feb 2010 16:18:24 +0300 Subject: [PATCH 19/24] Add ignore pattern for valgrind messages. --- mysql-test/include/mtr_warnings.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index 9378329353b..dc21410c435 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -201,6 +201,8 @@ INSERT INTO global_suppressions VALUES ("==[0-9]*== For more details"), /* This comes with innodb plugin tests */ ("==[0-9]*== Warning: set address range perms: large range"), + /* valgrind-3.5.0 dumps this */ + ("==[0-9]*== Command: "), /* valgrind warnings: invalid file descriptor -1 in syscall write()/read(). Bug #50414 */ From 843ce43e1935df223082dc4fe54343c432b97392 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 23 Feb 2010 14:28:06 +0100 Subject: [PATCH 20/24] remove whitespace at the end of line in Makefile.am, to keep BUILD/autorun.sh silent --- cmake/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Makefile.am b/cmake/Makefile.am index 86244a526c1..334c9fc7a0e 100644 --- a/cmake/Makefile.am +++ b/cmake/Makefile.am @@ -25,7 +25,7 @@ EXTRA_DIST = \ mysql_add_executable.cmake \ install_layout.cmake \ build_configurations/mysql_release.cmake \ - os/Windows.cmake \ + os/Windows.cmake \ os/WindowsCache.cmake \ os/Linux.cmake \ os/SunOS.cmake \ From 22e9e95a7c0922da63cb0d5a600f204f427caf1f Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Tue, 23 Feb 2010 11:43:26 -0700 Subject: [PATCH 21/24] Bug#31767 DROP FUNCTION name resolution Backport to 5.5.99 --- mysql-test/r/errors.result | 4 +- mysql-test/r/grant.result | 2 +- mysql-test/r/signal.result | 2 +- mysql-test/r/sp-error.result | 4 +- mysql-test/r/sp-vars.result | 4 +- mysql-test/r/sp.result | 4 +- mysql-test/r/sp_notembedded.result | 4 +- mysql-test/r/strict.result | 2 +- mysql-test/r/udf.result | 46 ++++++++++++ mysql-test/r/view.result | 2 +- mysql-test/r/warnings.result | 6 +- .../r/max_prepared_stmt_count_func.result | 2 +- mysql-test/t/udf.test | 69 ++++++++++++++++++ sql/sql_parse.cc | 71 +++++++++++-------- 14 files changed, 175 insertions(+), 47 deletions(-) diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result index 79474b960f5..a3a8fe0b147 100644 --- a/mysql-test/r/errors.result +++ b/mysql-test/r/errors.result @@ -61,10 +61,10 @@ create table t1 (a int unique); create table t2 (a int); drop function if exists f1; Warnings: -Note 1305 FUNCTION f1 does not exist +Note 1305 FUNCTION test.f1 does not exist drop function if exists f2; Warnings: -Note 1305 FUNCTION f2 does not exist +Note 1305 FUNCTION test.f2 does not exist create function f1() returns int begin insert into t1 (a) values (1); diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 542a056c68c..b182ee5656c 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -1231,7 +1231,7 @@ Warnings: Note 1051 Unknown table 'test' drop function if exists test_function; Warnings: -Note 1305 FUNCTION test_function does not exist +Note 1305 FUNCTION test.test_function does not exist drop view if exists v1; Warnings: Note 1051 Unknown table 'test.v1' diff --git a/mysql-test/r/signal.result b/mysql-test/r/signal.result index 7fb09b87778..410abffcdf0 100644 --- a/mysql-test/r/signal.result +++ b/mysql-test/r/signal.result @@ -2181,7 +2181,7 @@ drop procedure peter_p1 $$ drop procedure peter_p2 $$ drop procedure if exists peter_p3 $$ Warnings: -Note 1305 PROCEDURE peter_p3 does not exist +Note 1305 PROCEDURE test.peter_p3 does not exist create procedure peter_p3() begin declare continue handler for sqlexception diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 4cefee95903..0f658ee831e 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -46,7 +46,7 @@ call foo()| ERROR 42000: PROCEDURE test.foo does not exist drop procedure if exists foo| Warnings: -Note 1305 PROCEDURE foo does not exist +Note 1305 PROCEDURE test.foo does not exist show create procedure foo| ERROR 42000: PROCEDURE foo does not exist show create function foo| @@ -1028,7 +1028,7 @@ drop table t1| drop function bug_13627_f| drop function if exists bug12329; Warnings: -Note 1305 FUNCTION bug12329 does not exist +Note 1305 FUNCTION test.bug12329 does not exist create table t1 as select 1 a; create table t2 as select 1 a; create function bug12329() returns int return (select a from t1); diff --git a/mysql-test/r/sp-vars.result b/mysql-test/r/sp-vars.result index f167986e82c..6f5b6dfb224 100644 --- a/mysql-test/r/sp-vars.result +++ b/mysql-test/r/sp-vars.result @@ -394,10 +394,10 @@ CASE expression tests. DROP PROCEDURE IF EXISTS p1; Warnings: -Note 1305 PROCEDURE p1 does not exist +Note 1305 PROCEDURE test.p1 does not exist DROP PROCEDURE IF EXISTS p2; Warnings: -Note 1305 PROCEDURE p2 does not exist +Note 1305 PROCEDURE test.p2 does not exist DROP TABLE IF EXISTS t1; Warnings: Note 1051 Unknown table 't1' diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index b656680326b..cd7874be414 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -2695,10 +2695,10 @@ delete from t3| insert into t3 values(1)| drop procedure if exists bug7992_1| Warnings: -Note 1305 PROCEDURE bug7992_1 does not exist +Note 1305 PROCEDURE test.bug7992_1 does not exist drop procedure if exists bug7992_2| Warnings: -Note 1305 PROCEDURE bug7992_2 does not exist +Note 1305 PROCEDURE test.bug7992_2 does not exist create procedure bug7992_1() begin declare i int; diff --git a/mysql-test/r/sp_notembedded.result b/mysql-test/r/sp_notembedded.result index 228fe008447..931e66dba73 100644 --- a/mysql-test/r/sp_notembedded.result +++ b/mysql-test/r/sp_notembedded.result @@ -21,11 +21,11 @@ end| call bug4902_2()| show warnings| Level Code Message -Note 1305 PROCEDURE bug4902_2 does not exist +Note 1305 PROCEDURE test.bug4902_2 does not exist call bug4902_2()| show warnings| Level Code Message -Note 1305 PROCEDURE bug4902_2 does not exist +Note 1305 PROCEDURE test.bug4902_2 does not exist drop procedure bug4902_2| drop table if exists t1| create table t1 ( diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index fa4096cb424..a835f021d3a 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -1183,7 +1183,7 @@ drop table t1; create table t1 (col1 tinyint); drop procedure if exists t1; Warnings: -Note 1305 PROCEDURE t1 does not exist +Note 1305 PROCEDURE test.t1 does not exist create procedure t1 () begin declare exit handler for sqlexception select'a'; insert into t1 values (200); end;| call t1(); diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result index fbf87b2e4cc..4ddf427df8c 100644 --- a/mysql-test/r/udf.result +++ b/mysql-test/r/udf.result @@ -392,6 +392,52 @@ a 4 DROP FUNCTION sequence; DROP TABLE t1,t2; +drop function if exists test.metaphon; +drop function if exists metaphon; +CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; +select metaphon("Hello"); +metaphon("Hello") +HL +drop function if exists test.metaphon; +Warnings: +Note 1305 FUNCTION test.metaphon does not exist +select metaphon("Hello"); +metaphon("Hello") +HL +drop function metaphon; +CREATE FUNCTION test.metaphon(a TEXT) RETURNS TEXT return "This is a SF"; +create database db_31767; +use db_31767; +CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; +use test; +select metaphon("Hello"); +metaphon("Hello") +HL +select test.metaphon("Hello"); +test.metaphon("Hello") +This is a SF +drop function metaphon; +select metaphon("Hello"); +metaphon("Hello") +This is a SF +drop function metaphon; +use db_31767; +drop database db_31767; +drop function if exists no_such_func; +Warnings: +Note 1305 FUNCTION (UDF) no_such_func does not exist +drop function no_such_func; +ERROR 42000: FUNCTION (UDF) no_such_func does not exist +drop function if exists test.no_such_func; +Warnings: +Note 1305 FUNCTION test.no_such_func does not exist +drop function test.no_such_func; +ERROR 42000: FUNCTION test.no_such_func does not exist +drop procedure if exists no_such_proc; +ERROR 3D000: No database selected +drop procedure no_such_proc; +ERROR 3D000: No database selected +use test; # # Bug#46259: 5.0.83 -> 5.1.36, query doesn't work # diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index e678718d3d5..0e79446ba81 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -2086,7 +2086,7 @@ CREATE TABLE t1 ( bug_table_seq INTEGER NOT NULL); CREATE OR REPLACE VIEW v1 AS SELECT * from t1; DROP PROCEDURE IF EXISTS p1; Warnings: -Note 1305 PROCEDURE p1 does not exist +Note 1305 PROCEDURE test.p1 does not exist CREATE PROCEDURE p1 ( ) BEGIN DO (SELECT @next := IFNULL(max(bug_table_seq),0) + 1 FROM v1); diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index 8e70ea8b53d..70b54ffceaf 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -228,13 +228,13 @@ INSERT INTO t2 VALUES ( 'a`', 'a`' ); INSERT INTO t3 VALUES ( 'a`', 'a`', '1000-01-1' ); DROP PROCEDURE IF EXISTS sp1; Warnings: -Note 1305 PROCEDURE sp1 does not exist +Note 1305 PROCEDURE test.sp1 does not exist DROP PROCEDURE IF EXISTS sp2; Warnings: -Note 1305 PROCEDURE sp2 does not exist +Note 1305 PROCEDURE test.sp2 does not exist DROP PROCEDURE IF EXISTS sp3; Warnings: -Note 1305 PROCEDURE sp3 does not exist +Note 1305 PROCEDURE test.sp3 does not exist CREATE PROCEDURE sp1() BEGIN DECLARE x NUMERIC ZEROFILL; diff --git a/mysql-test/suite/sys_vars/r/max_prepared_stmt_count_func.result b/mysql-test/suite/sys_vars/r/max_prepared_stmt_count_func.result index 562ef63f811..d71bdc0984f 100644 --- a/mysql-test/suite/sys_vars/r/max_prepared_stmt_count_func.result +++ b/mysql-test/suite/sys_vars/r/max_prepared_stmt_count_func.result @@ -66,7 +66,7 @@ SET GLOBAL max_prepared_stmt_count=3; ** Creating procedure ** DROP PROCEDURE IF EXISTS sp_checkstmts; Warnings: -Note 1305 PROCEDURE sp_checkstmts does not exist +Note 1305 PROCEDURE test.sp_checkstmts does not exist CREATE PROCEDURE sp_checkstmts () BEGIN PREPARE newstmt from "SELECT * FROM information_schema.CHARACTER_SETS C"; diff --git a/mysql-test/t/udf.test b/mysql-test/t/udf.test index 7e383ce69fa..9bf872fa466 100644 --- a/mysql-test/t/udf.test +++ b/mysql-test/t/udf.test @@ -436,6 +436,75 @@ SELECT * FROM t2 WHERE a = sequence(); DROP FUNCTION sequence; DROP TABLE t1,t2; +# +# Bug#31767 (DROP FUNCTION name resolution) +# + +--disable_warnings +drop function if exists test.metaphon; +drop function if exists metaphon; +--enable_warnings + +--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB +eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_LIB"; + +select metaphon("Hello"); + +# The UDF should not be dropped +drop function if exists test.metaphon; + +select metaphon("Hello"); + +drop function metaphon; + +CREATE FUNCTION test.metaphon(a TEXT) RETURNS TEXT return "This is a SF"; + +create database db_31767; +use db_31767; + +--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB +eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_LIB"; + +use test; + +# Uses the UDF +select metaphon("Hello"); + +# Uses the SF +select test.metaphon("Hello"); + +# Should drop the UDF, resolving the name the same way select does. +drop function metaphon; + +# Should call the SF +select metaphon("Hello"); + +# Drop the SF +drop function metaphon; + +# Change the current database to none. +use db_31767; +drop database db_31767; + +drop function if exists no_such_func; + +--error ER_SP_DOES_NOT_EXIST +drop function no_such_func; + +drop function if exists test.no_such_func; + +--error ER_SP_DOES_NOT_EXIST +drop function test.no_such_func; + +--error ER_NO_DB_ERROR +drop procedure if exists no_such_proc; + +--error ER_NO_DB_ERROR +drop procedure no_such_proc; + +use test; + + --echo # --echo # Bug#46259: 5.0.83 -> 5.1.36, query doesn't work --echo # diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index c7e1be2237b..714e3af5296 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4132,6 +4132,47 @@ create_sp_error: case SQLCOM_DROP_PROCEDURE: case SQLCOM_DROP_FUNCTION: { +#ifdef HAVE_DLOPEN + if (lex->sql_command == SQLCOM_DROP_FUNCTION && + ! lex->spname->m_explicit_name) + { + /* DROP FUNCTION */ + udf_func *udf = find_udf(lex->spname->m_name.str, + lex->spname->m_name.length); + if (udf) + { + if (check_access(thd, DELETE_ACL, "mysql", NULL, NULL, 1, 0)) + goto error; + + if (!(res = mysql_drop_function(thd, &lex->spname->m_name))) + { + my_ok(thd); + break; + } + my_error(ER_SP_DROP_FAILED, MYF(0), + "FUNCTION (UDF)", lex->spname->m_name.str); + goto error; + } + + if (lex->spname->m_db.str == NULL) + { + if (lex->drop_if_exists) + { + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), + "FUNCTION (UDF)", lex->spname->m_name.str); + res= FALSE; + my_ok(thd); + break; + } + my_error(ER_SP_DOES_NOT_EXIST, MYF(0), + "FUNCTION (UDF)", lex->spname->m_name.str); + goto error; + } + /* Fall thought to test for a stored function */ + } +#endif + int sp_result; int type= (lex->sql_command == SQLCOM_DROP_PROCEDURE ? TYPE_ENUM_PROCEDURE : TYPE_ENUM_FUNCTION); @@ -4178,34 +4219,6 @@ create_sp_error: } #endif } - else - { -#ifdef HAVE_DLOPEN - if (lex->sql_command == SQLCOM_DROP_FUNCTION) - { - udf_func *udf = find_udf(lex->spname->m_name.str, - lex->spname->m_name.length); - if (udf) - { - if (check_access(thd, DELETE_ACL, "mysql", NULL, NULL, 1, 0)) - goto error; - - if (!(res = mysql_drop_function(thd, &lex->spname->m_name))) - { - my_ok(thd); - break; - } - } - } -#endif - if (lex->spname->m_db.str) - sp_result= SP_KEY_NOT_FOUND; - else - { - my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0)); - goto error; - } - } res= sp_result; switch (sp_result) { case SP_OK: @@ -4217,7 +4230,7 @@ create_sp_error: res= write_bin_log(thd, TRUE, thd->query(), thd->query_length()); push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), - SP_COM_STRING(lex), lex->spname->m_name.str); + SP_COM_STRING(lex), lex->spname->m_qname.str); if (!res) my_ok(thd); break; From 53771dd1a28c166c491a68e3ee07df2db2859c6f Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 23 Feb 2010 20:25:38 +0100 Subject: [PATCH 22/24] Bug#43201: Post-fix. Set thread stack address at the start of each query. Reason: implementation of send/reap in mysqltest uses the same "embedded" connection in a thread different from current, so thread stack has to change when connection is used in different OS thread.. --- libmysqld/lib_sql.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index c1c5ce3ec97..41ca574ab05 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -118,6 +118,7 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command, net_clear_error(net); thd->current_stmt= stmt; + thd->thread_stack= (char*) &thd; thd->store_globals(); // Fix if more than one connect /* We have to call free_old_query before we start to fill mysql->fields From 9d5deb076a323b1c1dea9f447f407a3e9c699be5 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Tue, 23 Feb 2010 17:45:49 -0700 Subject: [PATCH 23/24] Bug#10143 Perror not showing error description Backport to 5.5.99 --- client/mysqltest.cc | 3 +- extra/comp_err.c | 32 +++++++++++++++-- extra/perror.c | 48 +++++++++++++++++++++++++ mysql-test/r/perror.result | 5 +++ mysql-test/suite/ndb/r/ndb_basic.result | 1 + mysql-test/t/perror.test | 14 ++++++++ 6 files changed, 99 insertions(+), 4 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 9281d40bd60..327b6f9246f 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -4460,12 +4460,13 @@ typedef struct { const char *name; uint code; + const char *text; } st_error; static st_error global_error_names[] = { #include - { 0, 0 } + { 0, 0, 0 } }; uint get_errcode_from_name(char *error_name, char *error_end) diff --git a/extra/comp_err.c b/extra/comp_err.c index 0b894dae477..e4a07caa2ef 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -199,11 +199,34 @@ int main(int argc, char *argv[]) } +static void print_escaped_string(FILE *f, const char *str) +{ + const char *tmp = str; + + while (tmp[0] != 0) + { + switch (tmp[0]) + { + case '\\': fprintf(f, "\\\\"); break; + case '\'': fprintf(f, "\\\'"); break; + case '\"': fprintf(f, "\\\""); break; + case '\n': fprintf(f, "\\n"); break; + case '\r': fprintf(f, "\\r"); break; + default: fprintf(f, "%c", tmp[0]); + } + tmp++; + } +} + + static int create_header_files(struct errors *error_head) { uint er_last; FILE *er_definef, *sql_statef, *er_namef; struct errors *tmp_error; + struct message *er_msg; + const char *er_text; + DBUG_ENTER("create_header_files"); LINT_INIT(er_last); @@ -245,9 +268,12 @@ static int create_header_files(struct errors *error_head) "{ %-40s,\"%s\", \"%s\" },\n", tmp_error->er_name, tmp_error->sql_code1, tmp_error->sql_code2); /*generating er_name file */ - fprintf(er_namef, "{ \"%s\", %d },\n", tmp_error->er_name, - tmp_error->d_code); - + er_msg= find_message(tmp_error, default_language, 0); + er_text = (er_msg ? er_msg->text : ""); + fprintf(er_namef, "{ \"%s\", %d, \"", tmp_error->er_name, + tmp_error->d_code); + print_escaped_string(er_namef, er_text); + fprintf(er_namef, "\" },\n"); } /* finishing off with mysqld_error.h */ fprintf(er_definef, "#define ER_ERROR_LAST %d\n", er_last); diff --git a/extra/perror.c b/extra/perror.c index a98a4fc3d1b..d9c636ceb8c 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -184,6 +184,45 @@ static const char *get_ha_error_msg(int code) return NullS; } +typedef struct +{ + const char *name; + uint code; + const char *text; +} st_error; + +static st_error global_error_names[] = +{ +#include + { 0, 0, 0 } +}; + +/** + Lookup an error by code in the global_error_names array. + @param code the code to lookup + @param [out] name_ptr the error name, when found + @param [out] msg_ptr the error text, when found + @return 1 when found, otherwise 0 +*/ +int get_ER_error_msg(uint code, const char **name_ptr, const char **msg_ptr) +{ + st_error *tmp_error; + + tmp_error= & global_error_names[0]; + + while (tmp_error->name != NULL) + { + if (tmp_error->code == code) + { + *name_ptr= tmp_error->name; + *msg_ptr= tmp_error->text; + return 1; + } + tmp_error++; + } + + return 0; +} #if defined(__WIN__) static my_bool print_win_error_msg(DWORD error, my_bool verbose) @@ -211,6 +250,7 @@ int main(int argc,char *argv[]) { int error,code,found; const char *msg; + const char *name; char *unknown_error = 0; #if defined(__WIN__) my_bool skip_win_message= 0; @@ -316,6 +356,14 @@ int main(int argc,char *argv[]) else puts(msg); } + if (get_ER_error_msg(code, & name, & msg)) + { + found= 1; + if (verbose) + printf("MySQL error code %3d (%s): %s\n", code, name, msg); + else + puts(msg); + } if (!found) { #if defined(__WIN__) diff --git a/mysql-test/r/perror.result b/mysql-test/r/perror.result index 4946523bc42..74842b77ba1 100644 --- a/mysql-test/r/perror.result +++ b/mysql-test/r/perror.result @@ -1 +1,6 @@ Illegal error code: 10000 +MySQL error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192s' for key %d +MySQL error code 1076 (ER_READY): %s: ready for connections. +Version: '%s' socket: '%s' port: %d +MySQL error code 1459 (ER_TABLE_NEEDS_UPGRADE): Table upgrade required. Please do "REPAIR TABLE `%-.32s`" or dump/reload to fix it! +MySQL error code 1461 (ER_MAX_PREPARED_STMT_COUNT_REACHED): Can't create more than max_prepared_stmt_count statements (current value: %lu) diff --git a/mysql-test/suite/ndb/r/ndb_basic.result b/mysql-test/suite/ndb/r/ndb_basic.result index 08da3d599e8..8cb86fb4c2b 100644 --- a/mysql-test/suite/ndb/r/ndb_basic.result +++ b/mysql-test/suite/ndb/r/ndb_basic.result @@ -787,6 +787,7 @@ f1 f2 f3 222222 bbbbbb 2 drop table t1; Illegal ndb error code: 1186 +MySQL error code 1186 (ER_FLUSH_MASTER_BINLOG_CLOSED): Binlog closed, cannot RESET MASTER CREATE TABLE t1 ( a VARBINARY(40) NOT NULL, b VARCHAR (256) CHARACTER SET UTF8 NOT NULL, diff --git a/mysql-test/t/perror.test b/mysql-test/t/perror.test index a4b99d8aa22..df0779139f0 100644 --- a/mysql-test/t/perror.test +++ b/mysql-test/t/perror.test @@ -17,3 +17,17 @@ enable_query_log; # As there is no error code defined for 10000, expect error --error 1 --exec $MY_PERROR 10000 2>&1 + +# +# Bug#10143 (Perror not showing error description) +# + +# test reported case +--exec $MY_PERROR 1062 2>&1 + +# test errors that contain characters to escape in the text. +--exec $MY_PERROR 1076 2>&1 +--exec $MY_PERROR 1459 2>&1 +--exec $MY_PERROR 1461 2>&1 + + From b6663c64ce16479925783abe0a34c3e8e8c673d2 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 24 Feb 2010 02:06:08 +0100 Subject: [PATCH 24/24] Fix typo HAVE_IBGCC_ATOMIC_BUILTINS=>HAVE_IB_GCC_ATOMIC_BUILTINS. Due to the typo, detection of atomics was broken. It also lead to valgrind error during shutdown (access to freed memory),which is likely present in all builds where atomics are not used. --- storage/innobase/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index 81a73513806..a11007c8472 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -78,8 +78,8 @@ IF(NOT CMAKE_CROSSCOMPILING) ) ENDIF() -IF(HAVE_IBGCC_ATOMIC_BUILTINS) - ADD_DEFINITIONS(-DHAVE_IBGCCC_ATOMIC_BUILTINS=1) +IF(HAVE_IB_GCC_ATOMIC_BUILTINS) + ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_BUILTINS=1) ENDIF() # either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not